Class: DirectlyConnectedDevice

iotcs.device.DirectlyConnectedDevice(taStoreFileopt, taStorePasswordopt, gatewayopt)

new DirectlyConnectedDevice(taStoreFileopt, taStorePasswordopt, gatewayopt)

A directly-connected device is able to send messages to, and receive messages from, the IoT server. When the directly-connected device is activated on the server, the server assigns a logical-endpoint identifier. This logical-endpoint identifier is required for sending messages to, and receiving messages from, the server.

The directly-connected device is able to activate itself using the direct activation capability. The data required for activation and authentication is retrieved from a TrustedAssetsStore generated using the TrustedAssetsProvisioner tool using the Default TrustedAssetsManager.

This object represents the Virtualization API (high-level API) for the directly-connected device and uses the MessageDispatcher for sending/receiving messages. Also it implements the message dispatcher, diagnostics and connectivity test capabilities. Also it can be used for creating virtual devices.

Parameters:
Name Type Attributes Description
taStoreFile string <optional>
The trusted assets store file path to be used for trusted assets manager creation. This is optional. If none is given the default global library parameter is used: iotcs.oracle.iot.tam.store.
taStorePassword string <optional>
The trusted assets store file password to be used for trusted assets manager creation. This is optional. If none is given the default global library parameter is used: iotcs.oracle.iot.tam.storePassword.
gateway boolean <optional>
true to indicate creation of a GatewayDevice representation.
See:
  • iotcs.device.util.MessageDispatcher

Extends

Methods

(static) activate(deviceModelUrns, callback)

Activate the device. The device will be activated on the server if necessary. When the device is activated on the server. The activation would tell the server the models that the device implements. Also the activation can generate additional authorization information that will be stored in the TrustedAssetsStore and used for future authentication requests. This can be a time/resource consuming operation for some platforms.

If the device is already activated, this method will throw an exception. The user should call the isActivated() method prior to calling activate.

Parameters:
Name Type Description
deviceModelUrns Array.<string> An array of deviceModel URNs implemented by this directly connected device.
callback function The callback function. This function is called with this object but in the activated state. If the activation is not successful then the object will be null and an error object is passed in the form callback(device, error) and the reason can be taken from error.message.

(static) close()

This method will close this directly connected device (client) and all it's resources. All monitors required by the message dispatcher associated with this client will be stopped and all created virtual devices will be removed.

(static) createVirtualDevice(endpointId, deviceModel) → {iotcs.device.VirtualDevice}

Create a VirtualDevice instance with the given device model for the given device identifier. This method creates a new VirtualDevice instance for the given parameters. The client library does not cache previously created VirtualDevice objects.

A device model can be obtained by it's afferent URN with the DirectlyConnectedDevice if it is registered on the cloud.

Parameters:
Name Type Description
endpointId string The endpoint identifier of the device being modeled.
deviceModel object The device model object holding the full description of that device model that this device implements.
See:
Returns:
The newly created virtual device.
Type
iotcs.device.VirtualDevice

(static) getEndpointId() → {string}

Return the logical-endpoint identifier of this directly-connected device. The logical-endpoint identifier is assigned by the server as part of the activation process.
Returns:
The logical-endpoint identifier of this directly-connected device.
Type
string

(static) isActivated() → {boolean}

This will return the directly connected device activated state.
Returns:
true if the device is activated.
Type
boolean

Home