Class: MonitoringConfig

MonitoringConfig(sensorType, dataopt)

new MonitoringConfig(sensorType, dataopt)

The monitoring configuration of a WirelessTagSensor.

A user will not normally need to create instances directly; instead they are returned from WirelessTagSensor#monitoringConfig.

Parameters:
Name Type Attributes Description
sensorType string

the type of the sensor

data Object <optional>

the object with the status properties and values for this monitoring configuration, as returned by the API endpoint

Source:

Members

data :object

the JSON object returned from the cloud API

Type:
  • object
Source:

Methods

(static) create(sensor, dataopt) → {MonitoringConfig}

Factory method for creating MonitoringConfig objects.

Parameters:
Name Type Attributes Description
sensor WirelessTagSensor

the sensor object for which to create the monitoring configuration

data object <optional>

the JSON object of monitoring configuration data returned by the cloud API. If omitted, update() must be called before the properties will hold any valid data.

Source:
Returns:
Type
MonitoringConfig

asJSON() → {object}

Obtains a JSON representation of the current state of this object. Includes all properties and their current values of the monitoring configuration data.

Source:
Returns:

a JSON object

Type
object

isModified(configPropertyopt) → {boolean}

Whether any or a specific property of this monitoring configuration has been modified since it was last updated from the cloud.

Parameters:
Name Type Attributes Description
configProperty string <optional>

the name of the property if querying for a specific one rather than any

Source:
Returns:
Type
boolean

markModified(configPropertyopt) → {MonitoringConfig}

Marks all or a specific property of this monitoring configuration as having been modified after it was last updated from the cloud.

Parameters:
Name Type Attributes Description
configProperty string <optional>

the name of the property to mark

Source:
Returns:

this object (to enable chaining)

Type
MonitoringConfig

resetModified() → {MonitoringConfig}

Resets all modification flags for this monitoring configuration.

Source:
Returns:

this object (to enable chaining)

Type
MonitoringConfig

save(callbackopt) → {Promise}

Saves the current values for this monitoring configuration for the sensor it is associated with. Upon success, any remaining modification flag is cleared.

To prevent overriding the currently active configuration with values that might be stale (in the sense of not being representative of recent changes), this method will do nothing if no property of this object has been marked as modified. Saving the current values can be forced by calling markModified() before calling tnis method.

Parameters:
Name Type Attributes Description
callback module:wirelesstags~apiCallback <optional>
Source:
Returns:

Resolves to this monitoring configuration object when saving the monitoring configuration to the cloud completes.

Type
Promise

toString() → {object}

Obtains a string representation of the current state of this object. Includes all properties and their current values of the monitoring configuration data.

At present, this simply converts the result of asJSON() to a string.

Source:
Returns:
Type
object

update(callbackopt) → {Promise}

Updates the current values of this monitoring configuration from the cloud API.

To prevent overriding possibly modified configuration properties with old values from the cloud, this method will do nothing if any property of this object has been marked as modified. Updating can be forced by calling resetModified() before calling tnis method.

Parameters:
Name Type Attributes Description
callback module:wirelesstags~apiCallback <optional>
Source:
Returns:

Resolves to this monitoring configuration object when updating (loading) the monitoring configuration from the cloud completes.

Type
Promise