Device class

Warning

This API is now deprecated.

Creates a representation of a device for use with the device identity registry APIs.

This class is deprecated because the device identity registry can work directly with JSON objects containing a partial description of the device, not necessarily the full object. On top of that initially this class was shipped with a typo on the symmetricKey property name (it was pascal-cased instead of camel-cased). The SDK is keeping this class around in order not to break existing code but this will be removed in a future major version update and customers should instead use plain JSON objects.

Constructors

Device(any)

Instantiate a new Device object.

Properties

authentication

Contains the symmetric keys used to authenticate this device.

capabilities

Contains the capabilities of this device.

cloudToDeviceMessageCount

Number of c2d messages waiting to by delivered to the device.

connectionState

Whether the device is 'connected' or 'disconnected'. It is not recommended to use this property to determine if the device is actually connected right now though, since the device connection may have timed out and the IoT hub may not have detected it, or if the device is using HTTPS to connect. If you have a need to monitor device connections, the recommneded way is to use the operations monitoring feature of your hub.

connectionStateUpdatedTime

Timestamp representing the last time connectionState changed.

deviceId

Unique device identifier as it exists in the Azure IoT hub device registry.

etag

Weak entity tag assigned to this device identity description

generationId

Used to disambiguate devices that have been deleted/recreated with the same deviceId

lastActivityTime

Timestamp representing the last time the device authenticated, sent a message, or received a message.

status

'enabled' (device authorized to connect, can send/receive messages) or 'disabled'.

statusReason

128-character string set when the device is disabled.

statusUpdatedTime

Timestamp representing the last time status changed.

Constructor Details

Device(any)

Instantiate a new Device object.

new Device(jsonData?: any)

Parameters

jsonData

any

An optional JSON representation of the device, which will be mapped to properties in the object. If no argument is provided, Device properties will be assigned default values.

Property Details

authentication

Contains the symmetric keys used to authenticate this device.

authentication?: Authentication

Property Value

capabilities

Contains the capabilities of this device.

capabilities?: Capabilities

Property Value

cloudToDeviceMessageCount

Number of c2d messages waiting to by delivered to the device.

cloudToDeviceMessageCount?: string

Property Value

string

connectionState

Whether the device is 'connected' or 'disconnected'. It is not recommended to use this property to determine if the device is actually connected right now though, since the device connection may have timed out and the IoT hub may not have detected it, or if the device is using HTTPS to connect. If you have a need to monitor device connections, the recommneded way is to use the operations monitoring feature of your hub.

connectionState?: ConnectionState

Property Value

connectionStateUpdatedTime

Timestamp representing the last time connectionState changed.

connectionStateUpdatedTime?: string

Property Value

string

deviceId

Unique device identifier as it exists in the Azure IoT hub device registry.

deviceId: string

Property Value

string

etag

Weak entity tag assigned to this device identity description

etag?: string

Property Value

string

generationId

Used to disambiguate devices that have been deleted/recreated with the same deviceId

generationId?: string

Property Value

string

lastActivityTime

Timestamp representing the last time the device authenticated, sent a message, or received a message.

lastActivityTime?: string

Property Value

string

status

'enabled' (device authorized to connect, can send/receive messages) or 'disabled'.

status?: DeviceStatus

Property Value

statusReason

128-character string set when the device is disabled.

statusReason?: string

Property Value

string

statusUpdatedTime

Timestamp representing the last time status changed.

statusUpdatedTime?: string

Property Value

string