次の方法で共有


BaseDevice Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.BaseDevice

public class BaseDevice

The BaseDevice class implementing constructors and serialization functionality.

Field Summary

Modifier and Type Field and Description
protected final java.lang.String OFFSET_TIME_DEFAULT
protected final java.lang.String UTC_TIME_DEFAULT
protected long cloudToDeviceMessageCount

Number of messages received by the device

protected DeviceConnectionState connectionState

Status of the device: {"connected" | "disconnected"}

protected java.lang.String connectionStateUpdatedTime

Datetime of last time the connection state was updated.

protected java.lang.String deviceId

Device name A case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars + {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}.

protected java.lang.String eTag

A string representing a weak ETAG version of this JSON description.

protected java.lang.String generationId

Device generation Id

protected java.lang.String lastActivityTime

Datetime of last time the device authenticated, received, or sent a message.

Constructor Summary

Modifier Constructor Description
protected BaseDevice(String deviceId, AuthenticationType authenticationType)

Create an BaseDevice instance using the given device name with the given authenticationType

protected BaseDevice(String deviceId, SymmetricKey symmetricKey)

Create an BaseDevice instance using the given device name

Method Summary

Modifier and Type Method and Description
AuthenticationType getAuthenticationType()

Getter for the authentication type of this device

long getCloudToDeviceMessageCount()

Getter for cloud to device message count

DeviceConnectionState getConnectionState()

Getter for connection state

java.lang.String getConnectionStateUpdatedTime()

Getter for connection state updated time

java.lang.String getDeviceId()

Getter for device name

java.lang.String getGenerationId()

Getter for GenerationId

java.lang.String getLastActivityTime()

Getter for last activity time

java.lang.String getPrimaryKey()

Getter for PrimaryKey part of the SymmetricKey

java.lang.String getPrimaryThumbprint()

Getter for primary thumbprint part of the whole thumbprint

java.lang.String getSecondaryKey()

Getter for SecondaryKey part of the SymmetricKey

java.lang.String getSecondaryThumbprint()

Getter for secondary thumbprint part of the whole thumbprint

SymmetricKey getSymmetricKey()

Getter for SymmetricKey object

java.lang.String geteTag()

Getter for eTag

void setForceUpdate(Boolean forceUpdate)

Deprecated

This method currently only validates forceUpdate parameter

Setter for force update boolean

void setSymmetricKey(SymmetricKey symmetricKey)

Setter for SymmetricKey object

void setThumbprint(String primaryThumbprint, String secondaryThumbprint)

Deprecated

as of service-client version 1.15.1, please use setThumbprintFinal(String primaryThumbprint, String secondaryThumbprint)

Setter for X509 thumbprint

final void setThumbprintFinal(String primaryThumbprint, String secondaryThumbprint)

Setter for X509 thumbprint

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

OFFSET_TIME_DEFAULT

protected final String OFFSET_TIME_DEFAULT

UTC_TIME_DEFAULT

protected final String UTC_TIME_DEFAULT

cloudToDeviceMessageCount

protected long cloudToDeviceMessageCount

Number of messages received by the device

connectionState

protected DeviceConnectionState connectionState

Status of the device: {"connected" | "disconnected"}

connectionStateUpdatedTime

protected String connectionStateUpdatedTime

Datetime of last time the connection state was updated.

deviceId

protected String deviceId

Device name A case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars + {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}.

eTag

protected String eTag

A string representing a weak ETAG version of this JSON description. This is a hash.

generationId

protected String generationId

Device generation Id

lastActivityTime

protected String lastActivityTime

Datetime of last time the device authenticated, received, or sent a message.

Constructor Details

BaseDevice

protected BaseDevice(String deviceId, AuthenticationType authenticationType)

Create an BaseDevice instance using the given device name with the given authenticationType

Parameters:

deviceId - Name of the device (used as device id)
authenticationType -
  • The type of authentication used by this device.

BaseDevice

protected BaseDevice(String deviceId, SymmetricKey symmetricKey)

Create an BaseDevice instance using the given device name

Parameters:

deviceId - Name of the device (used as device id)
symmetricKey -
  • Device key. If parameter is null, then the key will be auto generated.

Throws:

java.lang.IllegalArgumentException - if deviceId is null

Method Details

getAuthenticationType

public AuthenticationType getAuthenticationType()

Getter for the authentication type of this device

Returns:

the authentication type

getCloudToDeviceMessageCount

public long getCloudToDeviceMessageCount()

Getter for cloud to device message count

Returns:

The string containing the time when the cloudToDeviceMessageCount parameter was updated

getConnectionState

public DeviceConnectionState getConnectionState()

Getter for connection state

Returns:

The connectionState string

getConnectionStateUpdatedTime

public String getConnectionStateUpdatedTime()

Getter for connection state updated time

Returns:

The string containing the time when the connectionState parameter was updated

getDeviceId

public String getDeviceId()

Getter for device name

Returns:

The deviceId string

getGenerationId

public String getGenerationId()

Getter for GenerationId

Returns:

The generationId string

getLastActivityTime

public String getLastActivityTime()

Getter for last activity time

Returns:

The string containing the time when the lastActivity parameter was updated

getPrimaryKey

public String getPrimaryKey()

Getter for PrimaryKey part of the SymmetricKey

Returns:

The primaryKey string

getPrimaryThumbprint

public String getPrimaryThumbprint()

Getter for primary thumbprint part of the whole thumbprint

Returns:

The primary thumbprint string

getSecondaryKey

public String getSecondaryKey()

Getter for SecondaryKey part of the SymmetricKey

Returns:

The secondaryKey string

getSecondaryThumbprint

public String getSecondaryThumbprint()

Getter for secondary thumbprint part of the whole thumbprint

Returns:

The secondary thumbprint string

getSymmetricKey

public SymmetricKey getSymmetricKey()

Getter for SymmetricKey object

Returns:

The symmetricKey object

geteTag

public String geteTag()

Getter for eTag

Returns:

The eTag string

setForceUpdate


public void setForceUpdate(Boolean forceUpdate)

Deprecated

This method currently only validates forceUpdate parameter

Setter for force update boolean

Parameters:

forceUpdate -
  • Boolean controlling if the update should be forced or not

Throws:

java.lang.IllegalArgumentException - if the provided argument is null

setSymmetricKey

public void setSymmetricKey(SymmetricKey symmetricKey)

Setter for SymmetricKey object

Parameters:

symmetricKey - symmetricKey to be set

Throws:

java.lang.IllegalArgumentException - if the provided symmetric key is null

setThumbprint


public void setThumbprint(String primaryThumbprint, String secondaryThumbprint)

Deprecated

as of service-client version 1.15.1, please use setThumbprintFinal(String primaryThumbprint, String secondaryThumbprint)

Setter for X509 thumbprint

Parameters:

primaryThumbprint - the primary thumbprint to set
secondaryThumbprint - the secondary thumbprint to set

setThumbprintFinal

public final void setThumbprintFinal(String primaryThumbprint, String secondaryThumbprint)

Setter for X509 thumbprint

Parameters:

primaryThumbprint - the primary thumbprint to set
secondaryThumbprint - the secondary thumbprint to set

Applies to