你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Device class

警告

现已弃用此 API。

创建用于 设备标识注册表 API 的设备表示形式。

此类已弃用,因为 设备标识注册表 可以直接处理包含设备部分说明的 JSON 对象,不一定是完整对象。 除此之外,此类最初是随 symmetricKey 属性名称上的拼写错误一起提供的(它是 pascal 大小写而不是 camel 大小写)。 SDK 为了不中断现有代码,SDK 将保留此类,但在将来的主版本更新中将删除此类,客户应改用纯 JSON 对象。

构造函数

Device(any)

实例化新的 Device 对象。

属性

authentication

包含用于对此设备进行身份验证的对称密钥。

capabilities

包含此设备的功能。

cloudToDeviceMessageCount

等待传递到设备的 c2d 消息数。

connectionState

设备是“已连接”还是“已断开连接”。 建议不要使用此属性来确定设备是否现在实际连接,因为设备连接可能已超时,IoT 中心可能未检测到它,或者设备是否正在使用 HTTPS 进行连接。 如果需要监视设备连接,则重新建议的方法是使用中心的 作监视 功能。

connectionStateUpdatedTime

表示上次更改 connectionState 时间的时间戳。

deviceId

Azure IoT 中心设备注册表中存在的唯一设备标识符。

etag

分配给此设备标识说明的弱实体标记

generationId

用于消除已删除/重新创建具有相同 deviceId 的设备

lastActivityTime

时间戳,表示设备上次进行身份验证、发送消息或收到消息的时间。

status

“enabled”(有权连接的设备,可以发送/接收消息)或“disabled”。

statusReason

禁用设备时设置 128 个字符的字符串。

statusUpdatedTime

表示上次更改 status 时间的时间戳。

构造函数详细信息

Device(any)

实例化新的 Device 对象。

new Device(jsonData?: any)

参数

jsonData

any

设备的可选 JSON 表示形式,该表示形式将映射到对象中的属性。 如果未提供任何参数,则会为设备属性分配默认值。

属性详细信息

authentication

包含用于对此设备进行身份验证的对称密钥。

authentication?: Authentication

属性值

capabilities

包含此设备的功能。

capabilities?: Capabilities

属性值

cloudToDeviceMessageCount

等待传递到设备的 c2d 消息数。

cloudToDeviceMessageCount?: string

属性值

string

connectionState

设备是“已连接”还是“已断开连接”。 建议不要使用此属性来确定设备是否现在实际连接,因为设备连接可能已超时,IoT 中心可能未检测到它,或者设备是否正在使用 HTTPS 进行连接。 如果需要监视设备连接,则重新建议的方法是使用中心的 作监视 功能。

connectionState?: ConnectionState

属性值

connectionStateUpdatedTime

表示上次更改 connectionState 时间的时间戳。

connectionStateUpdatedTime?: string

属性值

string

deviceId

Azure IoT 中心设备注册表中存在的唯一设备标识符。

deviceId: string

属性值

string

etag

分配给此设备标识说明的弱实体标记

etag?: string

属性值

string

generationId

用于消除已删除/重新创建具有相同 deviceId 的设备

generationId?: string

属性值

string

lastActivityTime

时间戳,表示设备上次进行身份验证、发送消息或收到消息的时间。

lastActivityTime?: string

属性值

string

status

“enabled”(有权连接的设备,可以发送/接收消息)或“disabled”。

status?: DeviceStatus

属性值

statusReason

禁用设备时设置 128 个字符的字符串。

statusReason?: string

属性值

string

statusUpdatedTime

表示上次更改 status 时间的时间戳。

statusUpdatedTime?: string

属性值

string