Classes
Namespaces
Members
(static) description
Properties:
Name | Type | Description |
---|---|---|
iotcs.description |
string | The description of this library. |
(static) version
Properties:
Name | Type | Description |
---|---|---|
iotcs.version |
string | The version of this library. |
Methods
(static) createError()
Log and return an error message.
(static) device.DirectlyConnectedDevice#getDeviceModel()
(static) device.VirtualDevice#_callImpl(actionName, argumentValues)
Invoke an action callback.
Parameters:
Name | Type | Description |
---|---|---|
actionName |
string | The name of the action from the device model. |
argumentValues |
Map.<string, *> | A map of argument names to values. |
Returns:
a success or failure status code.
(static) device.VirtualDevice#_createAttributeMap(virtualDevice, deviceModel) → {Map.<string, iotcs.device.impl.VirtualDeviceAttribute>}
Parameters:
Name | Type | Description |
---|---|---|
virtualDevice |
VirtualDevice | |
deviceModel |
DeviceModel |
Returns:
- Type
- Map.<string, iotcs.device.impl.VirtualDeviceAttribute>
(static) device.VirtualDevice#_getActionArguments(action, argumentValues) → {iotcs.impl.NamedValue}
Return the arguments of the device model action as a NamedValue chain. The name/value
pairs in the chain are in the same order as they appear in the device model action.
All arguments are returned. If there is no value for an argument in the JSON body,
the argument's default value is used.
Parameters:
Name | Type | Description |
---|---|---|
action |
DeviceModelAction | The action. |
argumentValues |
Map.<string, *> | The arguments as a JSON map. |
Returns:
The root node of the NamedValue chain, or
null
if there are no
arguments.
- Type
- iotcs.impl.NamedValue
(static) device.VirtualDevice#_setOnAction(actionCallback, actionNameopt)
Set a callback that is invoked when a specific action, or any action in the device model is
received. To set a callback when any action is received, don't specify the action name. This
may be called multiple times to set multiple callbacks. If there is a callback for the
specific action and for all actions, both callbacks will be invoked, with the specific action
invoked first.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
actionCallback |
function | A callback to invoke when an action is received. If {@code null}, the existing callback will be removed | |
actionName |
string |
<optional> |
The name of the action which will be invoked. |
(static) device.VirtualDevice#_updateAttributes(attributes)
Updates the attributes for this VirtualDevice. If an attribute is a StorageObject, kicks off
the synchronization process if the storage object is ready to be synchronized.
Parameters:
Name | Type | Description |
---|---|---|
attributes |
Object.<string, any> | The attributes to update. |
(static) device.VirtualDevice#update()
(static) enterprise.EnterpriseClient#_syncStorage(storageObject, deliveryCallback, errorCallback, processCallback)
Synchronizes the storage object by either uploading or downloading the object.
Parameters:
Name | Type | Description |
---|---|---|
storageObject |
iotcs.StorageObject | The storage object to sync. |
deliveryCallback |
function | The function to call when |
errorCallback |
function | The function to call when the sync fails. |
processCallback |
function | The function to call when |
(static) enterprise.EnterpriseClient#getDeviceModel()
(static) enterprise.impl.Action#checkBounds(argument, value)
Checks the bounds (upper and lower), if there are any bounds, of the value of the argument.
Parameters:
Name | Type | Description |
---|---|---|
argument |
DeviceModelActionArgument | The argument to check. |
value |
number | The value of the argument. |
Throws:
error If there are bounds for the argument and the value is outside the bounds.
(static) enterprise.impl.Action#getArgument(fieldName) → {iotcs.impl.DeviceModelActionArgument}
Returns the argument with the specified name.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | The name of the argument. |
Returns:
The argument or
null
.
- Type
- iotcs.impl.DeviceModelActionArgument
(static) enterprise.impl.Action#getArguments() → {Map.<string, *>}
Returns the attributes to be updated and their values.
Returns:
An object containing the attributes to update.
- Type
- Map.<string, *>
(static) enterprise.impl.Action#set(argumentName, value) → {Action}
Sets the value for the argument with the specified name.
Parameters:
Name | Type | Description |
---|---|---|
argumentName |
string | The name of the argument. |
value |
* | The value. |
Throws:
error If the argument is not in the device model or of is the incorrect type.
Returns:
An Action for the argument.
- Type
- Action
(static) enterprise.VirtualDevice#createAction(actionName) → {Action}
Create an Action for this VirtualDevice. The action will be created for the named action in
the device model.
Parameters:
Name | Type | Description |
---|---|---|
actionName |
string | The name of the action. |
Returns:
- A DeviceModelAction.
- Type
- Action
(static) error()
Throw and log an error message
(static) impl.ActionEvent#getName() → {string}
Get the action name.
Returns:
The action name, never
null
.
- Type
- string
(static) impl.ActionEvent#getNamedValue() → {NamedValue}
Get the name-value pair.
Returns:
The name-value pair, never
null
.
- Type
- NamedValue
(static) impl.ActionEvent#getVirtualDevice() → {VirtualDevice}
Get the virtual device that is the source of the event.
Returns:
The virtual device, never
null
.
- Type
- VirtualDevice
(static) log()
Log an info message