new AbstractVirtualDevice(endpointId, deviceModel)
The AbstractVirtualDevice API is identical for both the enterprise client and the device client. The semantics of the API are also the same. The processing model on the enterprise client is different, however, from the processing model on the device client.
A device model can be obtained by it's afferent URN with the Client if it is registered on the cloud.
An AbstractVirtualDevice can also be created with the appropriate parameters from the Client.
Parameters:
Name | Type | Description |
---|---|---|
endpointId |
string | The endpoint id of this device. |
deviceModel |
object | The device model, as a JSON object, holding the full description of that device model that this device implements. |
- See:
-
iotcs.Client#getDeviceModel
iotcs.Client#createVirtualDevice
Methods
(static) close()
(static) getDeviceModel() → {object}
Returns:
- Type
- object
(static) getEndpointId() → {string}
Returns:
- Type
- string
(static) update(attributes)
The values are sent to the server when the method is called, which also marks the end of the update transaction.
For example device.update({"min":10, "max":20});
If the virtual device has the onError property set with a callback method or any/all of the attributes given in the update call have the onError attribute set with a callback method, in case of error on update the callbacks will be called with related attribute information. See VirtualDevice description for more info on onError.
Parameters:
Name | Type | Description |
---|---|---|
attributes |
object | An object holding a list of attribute name/
value pairs to be updated as part of this transaction,
e.g. { "temperature":23, ... } . Note that keys shall refer
to device attribute names. |
- See:
-
iotcs.enterprise.VirtualDevice