new Device(address, options)
Handles communication with BCS.
Parameters:
Name | Type | Description |
---|---|---|
address |
string | IP Address for BCS |
options |
options | for BCS. Currently only supports authentication. ex. |
- Source:
Properties:
Name | Type | Description |
---|---|---|
ready |
boolean | Ready to communicate with BCS (other properties are not valid until ready is true) |
type |
string | BCS type, eg |
version |
string | BCS firmware version, eg, |
helpers |
BCS.Helpers | Helpers object |
probeCount |
number | The number of temp probes supported by the BCS hardware |
inputCount |
number | The number of discrete inputs supported by the BCS hardware |
outputCount |
number | The number of outputs supported by the BCS hardware |
Methods
-
on(event, callback)
-
Add an event listener
Parameters:
Name Type Description event
String The event to respond to. ('ready', 'notReady')
callback
callback The function to be called when the event is triggered
-
read(resource)
-
Read from the BCS API
Parameters:
Name Type Description resource
String The API endpoint to query
Returns:
A Promise of the response from the API
- Type
- Promise.Object
Example
var bcs = BCS.Device("192.168.0.63"); bcs.read('device').then(function (response) { alert("BCS Name:" + response.name); });
-
<private> trigger(event, arg)
-
Trigger an event listener
Parameters:
Name Type Description event
String The event to trigger
arg
Object Argument to pass to the callback
-
write(resource, JSON)
-
Write to the BCS API
Parameters:
Name Type Description resource
String The API endpoint to update
JSON
Object object to POST to the API
Returns:
A Promise of the response from the API
- Type
- Promise.Object