@iotize/device-client.js
Version:
IoTize Device client for Javascript
73 lines (72 loc) • 2.98 kB
TypeScript
/**
* Created by IoTize on 09/03/
*
* Model representing an application protocol data unit
*/
export declare class APDUCommand {
static CLA_LENGTH: number;
static INS_LENGTH: number;
static P1P2_LENGTH: number;
/**
* Instruction class - indicates the type of command, e.g. interindustry or proprietary
*/
CLA: number;
/**
* Instruction code - indicates the specific command, e.g. "write data"
*/
instructionCode: number;
/**
* Instruction parameters for the command, e.g. offset into file at which to write the data
*/
instructionParameter: Uint8Array;
/**
* Encodes the number (Nc) of bytes of command data to follow
* 0 bytes denotes Nc=0
* 1 byte with a value from 1 to 255 denotes Nc with the same value
* 3 bytes, the first of which must be 0, denotes Nc in the range 1 to 65 535 (all three bytes may not be zero)
*/
private expectedResponseSize;
/**
* Nc bytes of data
*/
private data;
/**
* Encodes the maximum number (Ne) of response bytes expected
* 0 bytes denotes Ne=0
* 1 byte in the range 1 to 255 denotes that value of Ne, or 0 denotes Ne=256
* 2 bytes (if extended Lc was present in the command) in the range 1 to 65 535 denotes Ne of that value, or two zero bytes denotes 65 536
* 3 bytes (if Lc was not present in the command), the first of which must be 0, denote Ne in the same way as two-byte Le
*/
private sizeOfCommandInBytes;
setCLA(CLA: number): this;
setInstructionCode(instructionCode: number): this;
setInstructionParameter(p1: number, p2: number): this;
/**
* Encodes the maximum number (Ne) of response bytes expected
* - 0 bytes denotes Ne=0
* - 1 byte in the range 1 to 255 denotes that value of Ne, or 0 denotes Ne=256
* - 2 bytes (if extended Lc was present in the command) in the range 1 to 65 535 denotes Ne of that value, or two zero bytes denotes 65 536
* - 3 bytes (if Lc was not present in the command), the first of which must be 0, denote Ne in the same way as two-byte Le
*
* @param expectedResponseSize
* @return
*/
setExpectedResponseSize(expectedResponseSize: number): this;
setData(data: Uint8Array): this;
/**
* Encodes the number (Nc) of bytes of command data to follow
* 0 bytes denotes Nc=0
* 1 byte with a value from 1 to 255 denotes Nc with the same value
* 3 bytes, the first of which must be 0, denotes Nc in the range 1 to 65 535 (all three bytes may not be zero)
*
* @param nbBytes
*/
setSizeOfCommandInBytes(nbBytes: number): void;
getCLA(): number;
getInstructionCode(): number;
getParameters(): Uint8Array;
getSizeOfCommandInBytes(): Uint8Array;
getData(): Uint8Array;
getExpectedResponseSize(): Uint8Array;
hasExpectedResponseSize(): boolean;
}