Device 类

定义

The Device class extends the BaseDevice class implementing constructors and serialization functionality.

public class Device extends BaseDevice
继承
java.lang.Object
Device

继承成员

构造函数

Device(String deviceId, DeviceStatus status, SymmetricKey symmetricKey)

Create an Device instance using the given device name.

字段

capabilities
parentScopes
scope
status
statusReason

A 128 char long string storing the reason of suspension (all UTF-8 chars allowed).

statusUpdatedTime

方法

createDevice(String deviceId, AuthenticationType authenticationType)

Static create function. Creates device object using the given name that will use a Certificate Authority signed certificate for authentication. If input device status isnull 

</code> then it will be auto-generated.</p>

createFromId(String deviceId, DeviceStatus status, SymmetricKey symmetricKey)

Static create function. Creates device object using the given name. If input device status and symmetric key are null then they will be auto generated.

getCapabilities()

Getter for capabilities.

getParentScopes()

Gets the scopes of the upper level edge devices, if applicable.

For edge devices, the value to set a parent edge device can be retrieved from the calling parent edge device's getScope() method.

For leaf devices, this could be set to the same value as getScope() or left for the service to copy over.

For now, this list can only have 1 element in the collection.

For more information, see this document.

getScope()

Gets the scope of the device.

getStatus()

Getter for DeviceStatus object. Values:"Enabled" 

</code> ,<code>"Disabled" 

</code> . If<code>"Enabled" 

</code> , this device is authorized to connect. If<code>"Disabled" 

</code> this device cannot receive or send messages, and <xref uid="com.microsoft.azure.sdk.iot.service.Device.statusReason" data-throw-if-not-resolved="false" data-raw-source="statusReason"></xref> must be set.</p>

getStatusReason()

Getter for status reason.

getStatusUpdatedTime()

Getter for status updated on string.

setCapabilities(DeviceCapabilities capabilities)

Setter for DeviceCapabilities object.

setScope(String scope)

Sets the scope of the device.

For edge devices, this is auto-generated and immutable.

For leaf devices, set this to create child/parent relationship. The value to set a parent edge device can be retrieved from calling the parent edge device's getScope() method.

For more information, see this document.

setStatus(DeviceStatus status)

Setter for DeviceStatus object. Values:"Enabled" 

</code> ,<code>"Disabled" 

</code> . If<code>"Enabled" 

</code> , this device is authorized to connect. If<code>"Disabled" 

</code> this device cannot receive or send messages, and statusReason must be set.</p>

适用于