public class Device extends BaseDevice
| Modifier and Type | Field and Description |
|---|---|
protected com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities |
capabilities |
protected List<String> |
parentScopes |
protected String |
scope |
protected DeviceStatus |
status |
protected String |
statusReason
A 128 char long string storing the reason of suspension (all UTF-8 chars allowed).
|
protected String |
statusUpdatedTime |
cloudToDeviceMessageCount, connectionState, connectionStateUpdatedTime, deviceId, eTag, generationId, lastActivityTime, OFFSET_TIME_DEFAULT, UTC_TIME_DEFAULT| Modifier | Constructor and Description |
|---|---|
protected |
Device(String deviceId,
DeviceStatus status,
SymmetricKey symmetricKey)
Create an Device instance using the given device name.
|
| Modifier and Type | Method and Description |
|---|---|
static Device |
createDevice(String deviceId,
AuthenticationType authenticationType)
Static create function.
|
static Device |
createFromId(String deviceId,
DeviceStatus status,
SymmetricKey symmetricKey)
Static create function.
|
com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities |
getCapabilities()
Getter for capabilities.
|
List<String> |
getParentScopes()
Gets the scopes of the upper level edge devices, if applicable.
|
String |
getScope()
Gets the scope of the device.
|
DeviceStatus |
getStatus()
Getter for DeviceStatus object.
|
String |
getStatusReason()
Getter for status reason.
|
String |
getStatusUpdatedTime()
Getter for status updated on string.
|
void |
setCapabilities(com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities capabilities)
Setter for DeviceCapabilities object.
|
void |
setScope(String scope)
Sets the scope of the device.
|
void |
setStatus(DeviceStatus status)
Setter for DeviceStatus object.
|
getAuthenticationType, getCloudToDeviceMessageCount, getConnectionState, getConnectionStateUpdatedTime, getDeviceId, geteTag, getGenerationId, getLastActivityTime, getPrimaryKey, getPrimaryThumbprint, getSecondaryKey, getSecondaryThumbprint, getSymmetricKey, setForceUpdate, setSymmetricKey, setThumbprint, setThumbprintFinalprotected DeviceStatus status
protected String statusReason
protected String statusUpdatedTime
protected com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities capabilities
protected String scope
protected Device(String deviceId, DeviceStatus status, SymmetricKey symmetricKey) throws IllegalArgumentException
deviceId - Name of the device (used as device id)status - Device status. If parameter is null, then the status will be set to "Enabled".symmetricKey - Device key. If parameter is null, then the key will be auto-generated.IllegalArgumentException - This exception is thrown if the encryption method is not supported by the key
generator.public static Device createFromId(String deviceId, DeviceStatus status, SymmetricKey symmetricKey) throws IllegalArgumentException
deviceId - String containing the device name.status - Device status. If parameter is null, then the status will be set to "Enabled".symmetricKey - Device key. If parameter is null, then the key will be auto generated.IllegalArgumentException - This exception is thrown if deviceId is null or empty.public static Device createDevice(String deviceId, AuthenticationType authenticationType)
null then it will be auto-generated.deviceId - String containing the device name.authenticationType - The type of authentication used by this device.IllegalArgumentException - This exception is thrown if deviceId is null or empty.public DeviceStatus getStatus()
"Enabled", "Disabled".
If "Enabled", this device is authorized to connect.
If "Disabled" this device cannot receive or send messages, and statusReason must be set.public void setStatus(DeviceStatus status)
"Enabled", "Disabled".
If "Enabled", this device is authorized to connect.
If "Disabled" this device cannot receive or send messages, and statusReason must be set.status - status to be set.public String getStatusReason()
public String getStatusUpdatedTime()
public com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities getCapabilities()
public void setCapabilities(com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities capabilities)
capabilities - Capabilities to be set.public String getScope()
public void setScope(String scope)
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.
scope - The device scope to set.public List<String> getParentScopes()
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.
Copyright © 2022. All rights reserved.