Documentation

Mistake on this page? Email us

Connected Device

Hierarchy

  • Device
    • ConnectedDevice

Index

Constructors

constructor

Properties

accountId

accountId: string

The owning Identity and Access Management (IAM) account ID

alias

alias: string

The alias of the device

bootstrapCertificateExpiration

bootstrapCertificateExpiration: Date

Expiration date of the certificate used to connect to bootstrap server

bootstrappedTimestamp

bootstrappedTimestamp: Date

The date and time the device was bootstrapped

certificateFingerprint

certificateFingerprint: string

This is not part of the certificate but rather the SH-256 hash of the certificate.

certificateIssuerId

certificateIssuerId: string

This is the value of the CN field (in the Subject) of the Issuer of the certificate.

claimedAt

claimedAt: Date

The claim date/time

connectorCertificateExpiration

connectorCertificateExpiration: Date

Expiration date of the certificate used to connect to connector server

createdAt

createdAt: Date

The timestamp of when the device was created

customAttributes

customAttributes: object

Up to 5 custom JSON attributes

Type declaration

  • [key: string]: string

description

description: string

The description of the device

deviceClass

deviceClass: string

The device class

deviceExecutionMode

deviceExecutionMode: number

The device execution mode

deviceType

deviceType: string

The type of the device - e.g. if the device is a gateway.

firmwareChecksum

firmwareChecksum: string

The SHA256 checksum of the current firmware image

hostGateway

hostGateway: string

The device name of the host gateway, if appropriate.

id

id: string

The ID of the device

manifestTimestamp

manifestTimestamp: Date

The date-time of the current manifest version

mechanism

mechanism: MechanismEnum

The ID of the channel used to communicate with the device

mechanismUrl

mechanismUrl: string

The address of the connector to use

name

name: string

The name of the device

serialNumber

serialNumber: string

The serial number of the device

state

The current state of the device

updatedAt

updatedAt: Date

The date-time of when the device was updated

vendorId

vendorId: string

The device vendor ID

Methods

addResourceSubscription

  • addResourceSubscription(resourcePath: string, notifyFn?: function): Promise<void>
  • Subscribe to a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional notifyFn: function

      Function to call with notification

        • (any: any): any
        • Parameters

          • any: any

          Returns any

    Returns Promise<void>

    empty Promise

  • addResourceSubscription(resourcePath: string, notifyFn?: function, callback?: CallbackFn<void>): void
  • Subscribe to a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional notifyFn: function

      Function to call with notification

        • (any: any): any
        • Parameters

          • any: any

          Returns any

    • Optional callback: CallbackFn<void>

      A function that is passed any error

    Returns void

delete

  • delete(): Promise<void>
  • Deletes a device

    Returns Promise<void>

    Promise containing any error

  • Deletes a device

    Parameters

    • callback: CallbackFn<void>

      A function that is passed any error

    Returns void

deleteResourceSubscription

  • deleteResourceSubscription(resourcePath: string): Promise<void>
  • Deletes a resource's subscription

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    Returns Promise<void>

    empty Promise

  • deleteResourceSubscription(resourcePath: string, callback: CallbackFn<void>): void
  • Deletes a resource's subscription

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • callback: CallbackFn<void>

      A function that is passed any error

    Returns void

deleteSubscriptions

  • deleteSubscriptions(): Promise<void>
  • Removes a device's subscriptions

    Returns Promise<void>

    empty Promise

  • deleteSubscriptions(callback: CallbackFn<void>): void
  • Removes a device's subscriptions

    Parameters

    • callback: CallbackFn<void>

      A function that is passed any error

    Returns void

executeResource

  • executeResource(resourcePath: string, payload?: any, timeout?: number, mimeType?: string, accepts?: string): Promise<AsyncResponse>
  • Execute a function on a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional payload: any

      The payload to be sent to the device.

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The content type of the payload

    • Optional accepts: string

      The content type of an accepted response

    Returns Promise<AsyncResponse>

    the AsyncResponse

  • executeResource(resourcePath: string, payload?: any, timeout?: number, mimeType?: string, accepts?: string, callback?: CallbackFn<AsyncResponse>): void
  • Execute a function on a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional payload: any

      The payload to be sent to the device.

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The content type of the payload

    • Optional accepts: string

      The content type of an accepted response

    • Optional callback: CallbackFn<AsyncResponse>

      A function that is passed any error

    Returns void

getResource

  • getResource(resourcePath: string): Promise<Resource>
  • Get a resource

    Parameters

    • resourcePath: string

      Path of the resource to get

    Returns Promise<Resource>

    Promise of device resource

  • getResource(resourcePath: string, callback?: CallbackFn<Resource>): void
  • Get a resource

    Parameters

    • resourcePath: string

      Path of the resource to get

    • Optional callback: CallbackFn<Resource>

      A function that is passed the arguments (error, resource)

    Returns void

getResourceSubscription

  • getResourceSubscription(resourcePath: string): Promise<boolean>
  • Gets the status of a resource's subscription

    Parameters

    • resourcePath: string

      Resource path

    Returns Promise<boolean>

    Promise containing resource subscription status

  • getResourceSubscription(resourcePath: string, callback: CallbackFn<boolean>): void
  • Gets the status of a resource's subscription

    Parameters

    • resourcePath: string

      Resource path

    • callback: CallbackFn<boolean>

      A function that is passed (error, subscribed) where subscribed is true or false

    Returns void

getResourceValue

  • getResourceValue(resourcePath: string, timeout?: number, mimeType?: string): Promise<string | number | void>
  • Gets the value of a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The requested mime type format of the value

    Returns Promise<string | number | void>

    Promise of resource value

  • getResourceValue(resourcePath: string, timeout?: number, mimeType?: string, callback?: CallbackFn<string | number | void>): void
  • Gets the value of a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The requested mime type format of the value

    • Optional callback: CallbackFn<string | number | void>

      A function that is passed the arguments (error, value) where value is the resource value

    Returns void

listResources

  • listResources(): Promise<Array<Resource>>
  • List device's resources

    Returns Promise<Array<Resource>>

    Promise of device resources

  • listResources(callback: CallbackFn<Array<Resource>>): void
  • List device's resources

    Parameters

    • callback: CallbackFn<Array<Resource>>

      A function that is passed the arguments (error, resources)

    Returns void

listSubscriptions

  • listSubscriptions(): Promise<string>
  • List a device's subscriptions

    Returns Promise<string>

    Promise containing the subscriptions

  • listSubscriptions(callback: CallbackFn<string>): void
  • List a device's subscriptions

    Parameters

    • callback: CallbackFn<string>

      A function that is passed (error, subscriptions)

    Returns void

setResourceValue

  • setResourceValue(resourcePath: string, value: string, timeout?: number, mimeType?: string): Promise<AsyncResponse>
  • Sets the value of a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • value: string

      The value of the resource

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The mime type format of the value

    Returns Promise<AsyncResponse>

    the AsyncResponse

  • setResourceValue(resourcePath: string, value: string, timeout?: number, mimeType?: string, callback?: CallbackFn<AsyncResponse>): void
  • Sets the value of a resource

    Note: This method requires a notification channel to be set up

    Parameters

    • resourcePath: string

      Resource path

    • value: string

      The value of the resource

    • Optional timeout: number

      async request will timeout after given number of milliseconds

    • Optional mimeType: string

      The mime type format of the value

    • Optional callback: CallbackFn<AsyncResponse>

      A function that is passed any error

    Returns void

update

  • update(): Promise<Device>
  • Update the device

    Returns Promise<Device>

    Promise of device

  • Update the device

    Parameters

    • callback: CallbackFn<Device>

      A function that is passed the arguments (error, device)

    Returns void