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.
Modifier and Type | Field and Description |
---|---|
protected
Device |
capabilities |
protected
Device |
status
"Enabled", "Disabled". |
protected java.lang.String |
status A 128 char long string storing the reason of suspension. |
protected java.lang.String |
status Datetime of last time the state was updated. |
Modifier | Constructor | Description |
---|---|---|
protected |
Device(String device |
Create an Device instance using the given device name |
Modifier and Type | Method and Description |
---|---|
static Device |
create Static create function Creates device object using the given name that will use a Certificate Authority signed certificate for authentication. |
static Device |
create Static create function Creates device object using the given name. |
Device |
get Getter for capabilities |
java.lang.String |
get Get the security scope for this device |
Device |
get Getter for Device |
java.lang.String |
get Getter for status reason |
java.lang.String |
get Getter for status updated time string |
void |
set Setter for Device |
void |
set Set the security scope for this device |
void |
set Setter for Device |
Methods inherited from BaseDevice
capabilities
protected DeviceCapabilities capabilities
status
protected 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.
statusReason
protected String statusReason
A 128 char long string storing the reason of suspension. (all UTF-8 chars allowed).
statusUpdatedTime
protected String statusUpdatedTime
Datetime of last time the state was updated.
Device
protected Device(String deviceId, DeviceStatus status, SymmetricKey symmetricKey)
Create an Device instance using the given device name
Parameters:
- Device status. If parameter is null, then the status will be set to Enabled.
- Device key. If parameter is null, then the key will be auto generated.
Throws:
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:
- String containing the device name
- The type of authentication used by this device.
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:
- String containing the device name
- Device status. If parameter is null, then the status will be set to Enabled.
- Device key. If parameter is null, then the key will be auto generated.
Returns:
Throws:
deviceId
is null
or empty.
getCapabilities
public DeviceCapabilities getCapabilities()
Getter for capabilities
Returns:
getScope
public String getScope()
Get the security scope for this device
Returns:
getStatus
public DeviceStatus getStatus()
Getter for DeviceStatus object
Returns:
getStatusReason
public String getStatusReason()
Getter for status reason
Returns:
getStatusUpdatedTime
public String getStatusUpdatedTime()
Getter for status updated time string
Returns:
setCapabilities
public void setCapabilities(DeviceCapabilities capabilities)
Setter for DeviceCapabilities object
Parameters:
setScope
public void setScope(String scope)
Set the security scope for this device
Parameters:
setStatus
public void setStatus(DeviceStatus status)
Setter for DeviceStatus object
Parameters:
Azure SDK for Java feedback
Azure SDK for Java is an open source project. Select a link to provide feedback: