@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
48 lines • 1.4 kB
TypeScript
/**
* adb Protocol is a 4 byte prefixed message.
* the 4 fisrt byte can be on of the 10 predefined Code, of a 4-hexa string indicating the message len.
*/
export default class Protocol {
static OKAY: string;
static FAIL: string;
static STAT: string;
static STA2: string;
static LIST: string;
static LIS2: string;
static DENT: string;
static DNT2: string;
static RECV: string;
static DATA: string;
static DONE: string;
static SEND: string;
static QUIT: string;
static bOKAY: Buffer;
static bFAIL: Buffer;
static bSTAT: Buffer;
static bSTA2: Buffer;
static bLIST: Buffer;
static bLIS2: Buffer;
static bDENT: Buffer;
static bRECV: Buffer;
static bDATA: Buffer;
static bDONE: Buffer;
static bSEND: Buffer;
static bQUIT: Buffer;
/**
* parse a 4 char string
*/
static decodeLength(length: string): number;
/**
*
* @param length message len
* @returns message len as a 4 char string
*/
static encodeLength(length: number): string;
/**
* prefix a chunk with it's len stored in a 4 char hexa string, so data len can not exceed 0Xffff
* @param data string or buffer to send.
* @returns data as a Buffer prefixed by a 4 char Base16 length chunk
*/
static encodeData(data: Buffer | string): Buffer;
}
//# sourceMappingURL=protocol.d.ts.map