Device Class
Defined in:
Module: Hive
src/device.js:4
Device class.
Represents a the current device running the code.
Constructor
Device
()
Item Index
Methods
executeAction
(
Object
-
label
Execute an action given a label
Parameters:
-
labelString- the Measurement label to post.
Returns:
Object:
the result of executing the action.
postMeasurement
(
Object
-
label -
base -
data
Post a measurement to the Hive Server.
Parameters:
-
labelString- the Measurement label to post.
-
baseString- the url to the Hive server.
-
dataObject- the data to be posted like { name: ..., value:... }.
Returns:
Object:
the response from the API.
registerAction
(
Array
-
label -
action
Register an action by the device
Parameters:
-
labelString- the Measurement label to post.
-
actionFunction- the action to be carried out on the device
action label, with an optional input argument,
(input) => {}.
- the action to be carried out on the device
action label, with an optional input argument,
Returns:
Array:
the list of all current actions.
registerMeasurement
(
Array
-
label -
base -
interval -
action -
callback
Register a measurement taken by the device
Parameters:
-
labelString- the Measurement label to post.
-
baseString- the base URL of where to post.
-
intervalNumber- the interval to execute the measurement at.
-
actionFunction- the action used to calculate the measurement (must return a valid {@link Measurement}).
-
callbackFunction- the callback to execute after the measurement has been posted.
Returns:
Array:
the list of all current actions.
Hive Node