Device

Device

new Device(adapter)

Source:

The base class for all devices

Parameters:
Name Type Description
adapter Adapter

The adapter object associated with this sequencer

Members

(static) constants

Source:
Properties:
Name Type Description
constants Object

The available constants

devicePath :String

Source:

Usually this will be the path to the device on the K4Model. If the device is temporary, this path will not reflect a K4Model node path and cannot be used to retrieve a K4Model node.

Type:
  • String

id :String

Source:

The id of the device. Retrieved from the model property using the id key in the Bridge opts

Type:
  • String

isTemporaryDevice :Boolean

Source:

Set to True if this device instance is intended to be temporary. Defaults to False, because standard practice is to only have device instances on the bridge that also have nodes defined on the K4Model

Type:
  • Boolean

mapping :Object

Source:

The adapter mapping for this device

Type:
  • Object

model :Object

Source:

The K4Model node of the device

Type:
  • Object

Methods

(private) checkEvent(key, event, response)

Source:

Fires appropriate event (if any) from response

Parameters:
Name Type Description
key String

K4Model event associated with a device

event String

The mapped response name for the K4model event

response Response

The Response object to compare and check

(private) checkVariable(key, variable, response)

Source:

Updates appropriate variable (if any) from response

Parameters:
Name Type Description
key String

K4Model variable associated with a device

variable String

The mapped response name for the K4model variable

response Response

The Response object to compare and check

cleanup()

Source:

Performs any wrapping up of device class remnants. Might no longer have a corresponding sender node on the K4Model.

(private) getCommand(modelCmdName) → {Command|null}

Source:

Returns the command class for a given name

Parameters:
Name Type Description
modelCmdName String

The command name on the K4Model

Returns:
Type
Command | null

(private) received(response)

Source:

Processes a response to the appropriate variable/event

Parameters:
Name Type Description
response Response

The response

restoreAllModelVarsFromCache()

Source:

Loads all the cached variable values into the live K4Model

retrieveCachedModelVar(modelVarPath) → {any}

Source:

Gets the latest cached state for a given K4Model variable

Parameters:
Name Type Description
modelVarPath String

Path to the K4Model variable node

Returns:

The value cached for the K4Model variable node

Type
any

updateModelVarCache(modelVarPath, valueToSet)

Source:

Sets the cached state for a given K4Model variable

Parameters:
Name Type Description
modelVarPath String

Path to the K4Model variable node

valueToSet any

The value to cache for the K4Model variable node