Class: Control

Control(properties, networkPropertiesopt)

new Control(properties, networkPropertiesopt)

Parameters:
Name Type Attributes Default Description
properties Object the properties of the object
networkProperties Object <optional>
{}
Properties
Name Type Attributes Default Description
endpointUrl String defines the Http(s) endpoint URL
tls Boolean defines is use Http or Https secure protocol for fetching data
streamProtocol String <optional>
'ws' the Stream protocol to use: 'ws' pr 'mqtt'
mqttOpts Object <optional>
{} the Mqtt options if stream protocol is 'mqtt'
Properties
Name Type Description
prefix String the Mqtt prefix value
endpointUrl String the Mqtt specific endpointUrl
Source:

Methods

(async) getCommandById(commandId, commandFilteropt) → {Promise.<Command>}

Get a specific command resource by ID. route: /systems/{sysid}/controls/{dsid}/commands/{cmdid}
Parameters:
Name Type Attributes Default Description
commandId String the ID of the Command resource
commandFilter CommandFilter <optional>
new CommandFilter() default Command filter
Source:
Returns:
- The corresponding Command
Type
Promise.<Command>

(async) getSchema(controlFilteropt) → {Promise.<JSON>}

Get the detailed schema of command messages in a command stream route: /systems/{sysid}/controls/{dsid}/schema
Parameters:
Name Type Attributes Default Description
controlFilter ControlFilter <optional>
new ControlFilter() default Control filter, using 'commandFormat' to select response format
Source:
Returns:
- The schema as JSON
Type
Promise.<JSON>

postCommand(jsonPayload, commandFilteropt)

Send a new command to this control interface route: /systems/{sysid}/controls/{dsid}/commands
Parameters:
Name Type Attributes Default Description
jsonPayload JSON the JSON payload
commandFilter CommandFilter <optional>
new CommandFilter() default Command filter specifying the 'sysid' and 'dsid'
Source:

publishCommand(jsonPayload, commandFilteropt)

Send a new command to this control interface using streaming protocol such like WS or MQTT route: /systems/{sysid}/controls/{dsid}/commands
Parameters:
Name Type Attributes Default Description
jsonPayload JSON the JSON payload
commandFilter CommandFilter <optional>
new CommandFilter() default Command filter specifying the 'sysid' and 'dsid'
Source:

(async) searchCommands(commandFilteropt, pageSizeopt) → {Promise.<Collection.<JSON>>}

Get the list of commands received by a particular control interface route: /systems/{sysid}/controls/{dsid}/commands
Parameters:
Name Type Attributes Default Description
commandFilter CommandFilter <optional>
new CommandFilter() default Command filter
pageSize Number <optional>
10 default page size
Source:
Returns:
- result as JSON
Type
Promise.<Collection.<JSON>>

(async) searchStatus(controlFilteropt, pageSizeopt) → {Promise.<Collection.<JSON>>}

Get all status messages sent by this control interface route: /systems/{sysid}/controls/{dsid}/status
Parameters:
Name Type Attributes Default Description
controlFilter ControlFilter <optional>
new ControlFilter() default Control filter
pageSize Number <optional>
10 default page size
Source:
Returns:
- A Collection of JSON
Type
Promise.<Collection.<JSON>>

streamCommands(controlFilteropt, callback)

Stream all commands received by a particular control interface route: /systems/{sysid}/controls/{dsid}/commands
Parameters:
Name Type Attributes Default Description
controlFilter ControlFilter <optional>
new ControlFilter() default Control filter
callback function A callback to get observations
Source:

streamStatus(controlFilteropt, callback)

Stream all status messages sent by this control interface route: /systems/{sysid}/controls/{dsid}/status
Parameters:
Name Type Attributes Default Description
controlFilter ControlFilter <optional>
new ControlFilter() default Control filter
callback function A callback to get observations
Source: