@iotize/device-client.js
Version:
IoTize Device client for Javascript
42 lines (41 loc) • 1.38 kB
TypeScript
import { SinglePacket as SinglePacketModel, SinglePacketPart } from "../../../device/model";
export declare module SinglePacket {
function fillComputedField(packet: SinglePacketModel): SinglePacketModel;
namespace KeyGenerator {
interface Options {
headerBytes: Uint8Array;
serialNumber: string;
username: string;
hashKey: Uint8Array;
}
}
interface KeyGenerator {
generate(options: KeyGenerator.Options): Uint8Array;
}
/**
* TODO shared constant
*/
const MAX_PART_SIZE = 192;
const PACKET_HEADER_SIZE: number;
/**
* Utility class to split a big single packet data into {@link SinglePacketPart}
*/
class Splitter {
protected chunkSize: number;
protected unitBlockSize: number;
/**
* TODO shared constant
*/
static DEFAULT_BLOCK_SIZE: number;
/**
* @param chunkSize size (in bytes) of one chunk
* @param unitBlockSize multiple to compute real size (in bytes)
* @throws {@link #chunkSize} < {@link #unitBlockSize}
*/
constructor(chunkSize: number, unitBlockSize?: number);
/**
* @return an array of single packet parts
*/
chunk(data: Uint8Array): SinglePacketPart[];
}
}