Device Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. BaseDevice - com.
microsoft. azure. sdk. iot. service. Device
- com.
- com.
public class Device
extends BaseDevice
The Device class extends the BaseDevice class implementing constructors and serialization functionality.
Field Summary
Modifier and Type | Field and Description |
---|---|
protected
Device |
capabilities |
protected java.util.List<java.lang.String> | parentScopes |
protected java.lang.String | scope |
protected
Device |
status |
protected java.lang.String |
statusReason
A 128 char long string storing the reason of suspension (all UTF-8 chars allowed). |
protected java.lang.String | statusUpdatedTime |
Constructor Summary
Modifier | Constructor | Description |
---|---|---|
protected | Device(String deviceId, DeviceStatus status, SymmetricKey symmetricKey) |
Create an Device instance using the given device name. |
Method Summary
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. |
Device |
getCapabilities()
Getter for capabilities. |
java.util.List<java.lang.String> |
getParentScopes()
Gets the scopes of the upper level edge devices, if applicable. |
java.lang.String |
getScope()
Gets the scope of the device. |
Device |
getStatus()
Getter for Device |
java.lang.String |
getStatusReason()
Getter for status reason. |
java.lang.String |
getStatusUpdatedTime()
Getter for status updated on string. |
void |
setCapabilities(DeviceCapabilities capabilities)
Setter for Device |
void |
setScope(String scope)
Sets the scope of the device. |
void |
setStatus(DeviceStatus status)
Setter for Device |
Methods inherited from BaseDevice
Methods inherited from java.lang.Object
Field Details
capabilities
protected DeviceCapabilities capabilities
parentScopes
protected List
scope
protected String scope
status
protected DeviceStatus status
statusReason
protected String statusReason
A 128 char long string storing the reason of suspension (all UTF-8 chars allowed).
statusUpdatedTime
protected String statusUpdatedTime
Constructor Details
Device
protected Device(String deviceId, DeviceStatus status, SymmetricKey symmetricKey)
Create an Device instance using the given device name.
Parameters:
"Enabled"
.
null
, then the key will be auto-generated.
Throws:
Method Details
createDevice
public static Device 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 is null
then it will be auto-generated.
Parameters:
Returns:
createFromId
public static Device 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.
Parameters:
"Enabled"
.
Returns:
Throws:
deviceId
is null
or empty.
getCapabilities
public DeviceCapabilities getCapabilities()
Getter for capabilities.
Returns:
getParentScopes
public List
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.
Returns:
getScope
public String getScope()
Gets the scope of the device.
Returns:
getStatus
public DeviceStatus getStatus()
Getter for DeviceStatus object. Values: "Enabled"
, "Disabled"
. If "Enabled"
, this device is authorized to connect. If "Disabled"
this device cannot receive or send messages, and statusReason must be set.
Returns:
getStatusReason
public String getStatusReason()
Getter for status reason.
Returns:
getStatusUpdatedTime
public String getStatusUpdatedTime()
Getter for status updated on string.
Returns:
setCapabilities
public void setCapabilities(DeviceCapabilities capabilities)
Setter for DeviceCapabilities object.
Parameters:
setScope
public void 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.
Parameters:
setStatus
public void setStatus(DeviceStatus status)
Setter for DeviceStatus object. Values: "Enabled"
, "Disabled"
. If "Enabled"
, this device is authorized to connect. If "Disabled"
this device cannot receive or send messages, and statusReason must be set.
Parameters: