Class: GatewayDevice

iotcs.device.util.GatewayDevice(taStoreFileopt, taStorePasswordopt)

new GatewayDevice(taStoreFileopt, taStorePasswordopt)

This represents a GatewayDevice in the Messaging API. It has the exact same specifications and capabilities as a directly connected device from the Messaging API and additionally it has the capability to register indirectly connected 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.

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) registerDevice(restricted, hardwareIdnon-null, metaData, deviceModelUrns, callback)

Register an indirectly-connected device with the cloud service and specify whether the gateway device is required to have the appropriate credentials for activating the indirectly-connected device. The restricted parameter controls whether or not the client library is required to supply credentials for activating the indirectly-connected device. The client library will always supply credentials for an indirectly-connected device whose trusted assets have been provisioned to the client. If, however, the trusted assets of the indirectly-connected device have not been provisioned to the client, the client library can create credentials that attempt to restrict the indirectly connected device to this gateway device. Pass true for the restricted parameter to ensure the indirectly-connected device cannot be activated by this gateway device without presenting credentials. If restricted is true, the client library will provide credentials to the server. The server will reject the activation request if the indirectly connected device is not allowed to roam to this gateway device. Pass false to allow the indirectly-connected device to be activated without presenting credentials if the trusted assets of the indirectly-connected device have not been provisioned to the client. If restricted is false, the client library will provide credentials if, and only if, the credentials have been provisioned to the client. The server will reject the activation if credentials are required but not supplied, or if the provisioned credentials do not allow the indirectly connected device to roam to this gateway device. The hardwareId is a unique identifier within the cloud service instance and may not be null. If one is not present for the device, it should be generated based on other metadata such as: model, manufacturer, serial number, etc. The metaData Object should typically contain all the standard metadata (the constants documented in this class) along with any other vendor defined metadata.
Parameters:
Name Type Description
restricted boolean true if credentials are required for activating the indirectly connected device.
hardwareId string An identifier unique within the Cloud Service instance.
metaData object The metadata of the device.
deviceModelUrns Array.<string> An array of device model URNs supported by the indirectly connected device.
callback function The callback function. This function is called with the following argument: the endpoint ID of the indirectly-connected device is the registration was successful or null and an error object as the second parameter: callback(id, error). The reason can be retrieved from error.message and it represents the actual response from the server or any other network or framework error that can appear.

Home