Options
All
  • Public
  • Public/Protected
  • All
Menu

iotile-device

A Typescript library for interacting with IOTile Devices

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AnchorValueProcessor

AnchorValueProcessor: function

A conversion function that takes the value of a reading in a given stream and turns it into a utc date.

Type declaration

    • (streamID: number, readingID: number, uptime: number, value: number): Date
    • Parameters

      • streamID: number
      • readingID: number
      • uptime: number
      • value: number

      Returns Date

AndroidAdvertisement

AndroidAdvertisement: ArrayBuffer | SharedArrayBuffer

ConnectionHookCallback

ConnectionHookCallback: function
ngdoc

overview

name

iotile.device

description

Introduction

The iotile.device module contains all services and classes needed for interacting with IOTile Devices, including receiving data from them, sending commands to them, updating their firmware and querying their status. It is designed to be dropped into an otherwise IOTile unaware angular application and provide a small API that encapsulates all necessary interactions with IOTile Devices.

The main point of entry in the iotile.device module is the IOTileAdapter service, which is the only public service provided by iotile.device. The IOTileAdapter service provides a way to scan for, connect to, receive data from, control and update IOTile Devices.

Type declaration

DecodedWaveformInfo

DecodedWaveformInfo: object

Type declaration

DeviceTime

IOSAdvertisement

IOSAdvertisement: object

Type declaration

ManufacturerData

ManufacturerData: object

Type declaration

  • [key: number]: ArrayBuffer | SharedArrayBuffer

MobilePlatform

MobilePlatform: "ios" | "android"

NotificationCallback

NotificationCallback: function

Type declaration

    • (ArrayBuffer: ArrayBuffer): void
    • Parameters

      • ArrayBuffer: ArrayBuffer

      Returns void

PeakAxis

PeakAxis: "x" | "y" | "z"

PreconnectionHookCallback

PreconnectionHookCallback: function

Type declaration

PrestreamingHook

PrestreamingHook: function

Type declaration

RPCResponse

RPCResponse: Promise<(string | number)[]> | (string | number)[]

RawWaveformInfo

RawWaveformInfo: object

Type declaration

  • [key: number]: object
    • crcCode: number
    • rawWaveform: ArrayBuffer
    • timestamp: number

ServiceData

ServiceData: object

Type declaration

  • [key: number]: ArrayBuffer | SharedArrayBuffer

Variables

Const ArchManufacturerCode

ArchManufacturerCode: number = 960

Const COMBINED_REPORT_STREAMER

COMBINED_REPORT_STREAMER: number = 255

Const END_STREAM

END_STREAM: number = mapStreamName('system buffered node 1537')

Const HighspeedDataCharacteristic

HighspeedDataCharacteristic: "2006" = "2006"

Const INPUT_BUFFER_LENGTH

INPUT_BUFFER_LENGTH: 64 = 64

Let IOTileServiceName

IOTileServiceName: string = "00002000-3FF7-53BA-E611-132C0FF60F63"

Const IOTileV1ServiceUUID

IOTileV1ServiceUUID: string = "00002000-3FF7-53BA-E611-132C0FF60F63"

Constants used to decode advertisement data into a uniform format.

Const IOTileV2ServiceUUID

IOTileV2ServiceUUID: string = "FDDD"

Const LOOKAHEAD_BITS

LOOKAHEAD_BITS: 4 = 4

Const REPORT_HEADER_SIZE

REPORT_HEADER_SIZE: number = 20

Let RSSI

RSSI: number = -50

Const ReceiveHeaderCharacteristic

ReceiveHeaderCharacteristic: "2001" = "2001"

Const ReceivePayloadCharacteristic

ReceivePayloadCharacteristic: "2002" = "2002"

Const SAMPLING_RATE

SAMPLING_RATE: number = 3200 / 3.0

Let SECONDS_AT_2000

SECONDS_AT_2000: number = Date.UTC(2000, 0, 1).valueOf() / 1000

Const START_STREAM

START_STREAM: number = mapStreamName('system buffered node 1536')

Const SYSTEM_REPORT_STREAMER

SYSTEM_REPORT_STREAMER: number = 1

Const SendHeaderCharacteristic

SendHeaderCharacteristic: "2003" = "2003"

Const SendPayloadCharacteristic

SendPayloadCharacteristic: "2004" = "2004"

Const StreamingCharacteristic

StreamingCharacteristic: "2005" = "2005"

Const TracingCharacteristic

TracingCharacteristic: "2007" = "2007"

Const USER_REPORT_STREAMER

USER_REPORT_STREAMER: number = 0

Let VOLTAGE

VOLTAGE: number = 3.8

Const WINDOW_BITS

WINDOW_BITS: 8 = 8

Const catAdapter

catAdapter: Category = new Category("IOTileAdapter", catService)

Const catBLEOptimizer

catBLEOptimizer: Category = new Category("BLEOptimizer", catService)

Const catIOTileDevice

catIOTileDevice: Category = new Category("IOTileDevice", catService)

Const catMockBLE

catMockBLE: Category = new Category("MockBLE", catService)

Const catNotify

catNotify: Category = new Category("Notifications", catService)

Const catPOD1M

catPOD1M: Category = new Category("POD1M", catService)

Const catReports

catReports: Category = new Category("Reports", catService)

Const catService

catService: Category = new Category("iotile.device")

Const catStreaming

catStreaming: Category = new Category("Streaming", catService)

Const catUTCAssigner

catUTCAssigner: Category = new Category('UTCAssigner', catService)

Functions

buf2hex

  • buf2hex(buffer: ArrayBuffer): any

buildIndividualReport

  • buildIndividualReport(uuid: number, streamID: number, value: number): ArrayBuffer
  • Parameters

    • uuid: number
    • streamID: number
    • value: number

    Returns ArrayBuffer

calculateDeltaV

  • calculateDeltaV(data: number[], threshold: number, samplingRate: number): number

convertToSecondsSince2000

  • convertToSecondsSince2000(date: Date): number

copyAnchor

createHashListReport

  • createHashListReport(uuid: number, reportID: number, streamer: number, sentTime: number, readings: Reading[]): ArrayBuffer
  • Parameters

    • uuid: number
    • reportID: number
    • streamer: number
    • sentTime: number
    • readings: Reading[]

    Returns ArrayBuffer

createIndividualReport

  • createIndividualReport(uuid: number, stream: string, value: number, sentTime: any, rawTime: any): ArrayBuffer

createReading

  • createReading(stream: string, timestamp: any, value: number, id: any): object

createSequentialReport

  • createSequentialReport(uuid: number, stream: string, count: number, streamer: number, start?: undefined | number): ArrayBuffer

createWaveMap

createWaveformEvents

decompressWaveforms

dropNonUTCTimestamps

ensureUTCTimestamps

expectIndividual

  • expectIndividual(inReport: any, uuid: number, stream: string, value: number, sentTime: any, rawTime: any): void

expectSequential

  • expectSequential(inReport: any, uuid: number, stream: string, count: number, streamer: number): void

feedInPieces

  • feedInPieces(report: ArrayBuffer, handler: function, size: number): void
  • Parameters

    • report: ArrayBuffer
    • handler: function
        • (ArrayBuffer: ArrayBuffer): void
        • Parameters

          • ArrayBuffer: ArrayBuffer

          Returns void

    • size: number

    Returns void

findByDeviceID

getReportName

  • getReportName(streamer: number, streamerNames: object): string

maxAbs

  • maxAbs(data: number[]): number

packError

  • packError(subsystem: number, errorCode: number): number
  • Pack a 32-bit error code the same way an embedded device does it.

    Parameters

    • subsystem: number

      The subsystem ID that this error came from

    • errorCode: number

      The actual error code

    Returns number

parseBinary16BitUUID

  • parseBinary16BitUUID(data: ArrayBuffer | SharedArrayBuffer, reverse: boolean): string
  • Turn a binary 16 bit uuid into a string of the format {xxxx}

    All hex digits are printing in upper case.

    Parameters

    • data: ArrayBuffer | SharedArrayBuffer

      A 2-byte data field containin a binary UUID in either little-endian or big endian format.

    • reverse: boolean

      Reverse the 2-bytes before parsing them. This is useful if the data is being sent as a 16-bit little endian value such as what is included in Bluetooth advertisement packets.

    Returns string

parseBinaryUUID

  • parseBinaryUUID(data: ArrayBuffer | SharedArrayBuffer, reverse: boolean): string
  • Turn a binary 128 bit uuid into a string of the format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

    All hex digits are printing in upper case.

    Parameters

    • data: ArrayBuffer | SharedArrayBuffer

      A 16-byte data field containin a binary UUID in either little-endian or big endian format.

    • reverse: boolean

      Reverse the 16-bytes before parsing them. This is useful if the data is being sent as a 128-bit little endian value such as what is included in Bluetooth advertisement packets.

    Returns string

parseFlagsV1

parseFlagsV2

parseUTF8String

  • parseUTF8String(data: ArrayBuffer | SharedArrayBuffer): string

rpc

  • rpc(address: number, rpcID: number, argFormat: string, respFormat: string): (Anonymous function)
  • Decorator factory that marks a function as a callable RPC with the given metadata.

    Parameters

    • address: number

      The address at which the RPC should appear

    • rpcID: number

      The 16-bit ID of the RPC

    • argFormat: string

      A format string compatible with unpackArrayBuffer to unpack arguments

    • respFormat: string

      A format string compatbile with packArrayBuffer to pack the return value

    Returns (Anonymous function)

rtcTimestampToDate

  • rtcTimestampToDate(seconds: number): Date

setupMockBLE

  • setupMockBLE(config: any): void

summarizeAxis

  • summarizeAxis(data: number[], threshold: number, samplingRate: number): AxisSummary

summarizeWaveform

tileRPC

  • tileRPC(rpcID: number, argFormat: string, respFormat: string): (Anonymous function)
  • Decorator factory that marks a function as a callable RPC with the given metadata.

    This function does not explicitly encode the RPC's address so it is suitable to use within a VirtualTile declaration that does not know its address in advance.

    Parameters

    • rpcID: number

      The 16-bit ID of the RPC

    • argFormat: string

      A format string compatible with unpackArrayBuffer to unpack arguments

    • respFormat: string

      A format string compatbile with packArrayBuffer to pack the return value

    Returns (Anonymous function)

timeAboveThreshold

  • timeAboveThreshold(data: number[], threshold: number, samplingRate: number): number
  • Calculate the maximum time that a given threshold is exceeded.

    Parameters

    • data: number[]

      A list of samples along a single axis in G's

    • threshold: number

      The threshold that we should count time above

    • samplingRate: number

      The sampling rate of the data in Hz

    Returns number

    The number of ms that data is above threshold in a single continuous event.

tryConvertUTCTimestamp

  • tryConvertUTCTimestamp(deviceTimestamp: number): Date | null

unpackVLEIntegerList

  • unpackVLEIntegerList(input: ArrayBuffer): number[]
  • Unpack an array buffer that corresponds to a list of VLE encoded integers.

    The function assumes that the input buffer was created from a list of integers in the range of -4095 to 4095 that were processed in the following way to create this binary buffer:

    • They were delta encoded, so all entries after the first were stored as the difference between the value and the last value.
    • They were zig-zag encoded so that all negative values became positive.
    • They were packed as variable length integers where 7-bit values are stored as a single byte and all other values are stored as two bytes.

    This function undoes all three of these packing steps

    Parameters

    • input: ArrayBuffer

      A list of integers that have been encoded in the following way: first they were delta encoded, then they were zigzag encoded and finally they were delta encoded.

    Returns number[]

Object literals

Const ANDROID_STRATEGY

ANDROID_STRATEGY: object

steps

steps: object[] = [{preupdateWait: 300,update: {minInterval: 7.5,maxInterval: 10,timeout: 1000}},{preupdateWait: 0,update: {minInterval: 7.5,maxInterval: 15,timeout: 1000}},{preupdateWait: 0,update: {minInterval: 7.5,maxInterval: 30,timeout: 1000}}]

Const IOSAdElementMap

IOSAdElementMap: object

kCBAdvDataLocalName

kCBAdvDataLocalName: AdElementType = AdElementType.LocalName

kCBAdvDataManufacturerData

kCBAdvDataManufacturerData: AdElementType = AdElementType.ManufacturerData

kCBAdvDataServiceData

kCBAdvDataServiceData: AdElementType = AdElementType.ServiceData

kCBAdvDataServiceUUIDs

kCBAdvDataServiceUUIDs: AdElementType = AdElementType.ServiceUUIDList

Const IOS_STRATEGY

IOS_STRATEGY: object

steps

steps: object[] = [{preupdateWait: 180,update: {minInterval: 15,maxInterval: 15,timeout: 1000}}]

Const TILE_STATE_TABLE

TILE_STATE_TABLE: object

capturing

capturing: number = 1

initializing

initializing: number = 0

streaming

streaming: number = 2

Const UPDATE_STRATEGIES

UPDATE_STRATEGIES: object

__computed

__computed: PlatformStrategy = ANDROID_STRATEGY

Const defaultShock

defaultShock: object

dVx

dVx: number = -41510

dVy

dVy: number = 56537

dVz

dVz: number = -16622

duration

duration: number = 164

peak

peak: number = 322

Const flagMask

flagMask: object

recording

recording: number = 1 << 0

settled

settled: number = 1 << 2

streaming

streaming: number = 1 << 4

Const status

status: object

recording

recording: boolean = true

settled

settled: boolean = true

streaming

streaming: boolean = false

tile_state

tile_state: number = TILE_STATE_TABLE.capturing

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc