UNPKG

@iotile/iotile-device

Version:

A typescript library for interfacing with IOTile BLE devices

69 lines (68 loc) 2.21 kB
/** * A dictionary based report that can either be saved as JSON or msgpack. * * This is suitable for uploading complex event data on behalf of an IOTile device. */ import { IOTileReport, RawReading } from "./iotile-reports"; export interface SerializedIOTileEvent { stream: number; device_timestamp: number; streamer_local_id: number; timestamp: string | null; data: object; extra_data: object; } export declare class IOTileEvent { private _stream; private _deviceTimestamp; private _utcTimestamp; private _summaryData; private _rawData; private _readingID; constructor(stream: number, deviceTimestamp: number, summaryData: {}, rawData: {}, readingID?: number, utcTimestamp?: Date | null); toObject(): SerializedIOTileEvent; readonly readingID: number; } export interface FlexibleDictionaryOptions { streamer: number; selector: number; sentTimestamp: number; reportID: number; receivedTime?: Date; } export interface SerializedFlexibleDictionary { format: "v100"; device: number; streamer_index: number; streamer_selector: number; incremental_id: number; lowest_id: number; highest_id: number; device_sent_timestamp: number; events: SerializedIOTileEvent[]; data: object[]; } export declare class FlexibleDictionaryReport extends IOTileReport { static DEFAULT_OPTIONS: FlexibleDictionaryOptions; private _receivedTime; private _uuid; private _reportID; private _streamerIndex; private _streamerSelector; private _sentTimestamp; private _lowestID; private _highestID; private _readings; private _events; private _cachedMsgpack; constructor(uuid: number, readings: RawReading[], events: IOTileEvent[], options?: FlexibleDictionaryOptions); readonly deviceID: number; readonly readingIDRange: [number, number]; readonly streamer: number; readonly rawData: ArrayBuffer; readonly numEvents: number; private sortAndCalculateIDRange; toObject(): SerializedFlexibleDictionary; toMsgpack(): ArrayBuffer; readonly receivedTime: Date; }