ModelChangeMonitor

ModelChangeMonitor

new ModelChangeMonitor(adapter)

Source:

Checks for changes in the K4Model nodes. Emits events to indicate which device nodes have changed.

Parameters:
Name Type Description
adapter Adapter

Members

(static) constants

Source:
Properties:
Name Type Description
constants Object

Methods

cacheCurrentDeviceModelNode(devicePath)

Source:

Adds the current device model to the cache.

Parameters:
Name Type Description
devicePath String

Path to the K4Model node for the device

checkWhichModelFieldsHaveChanged(oldDeviceNodeObj, currentDeviceNodeObj, modelFieldsToCompareopt) → {Array.<String>}

Source:

Determine which fields are actually different between two instances of a device node.

Parameters:
Name Type Attributes Description
oldDeviceNodeObj Object

The previous state of the model node for a device.

currentDeviceNodeObj Object

The current state of the model node for a device.

modelFieldsToCompare Array.<String> <optional>

The potential model fields that could have changed.

Returns:

The list of model fields which have actually changed

Type
Array.<String>

close()

Source:

close Tear down method: unsubscribe device model change listeners and clear device model cache.

identifyDevicesInCacheNotOnBridge() → {Array.<Object>}

Source:

Find devices that there is a snapshot for, but do not exist on the bridge currently

Returns:
Type
Array.<Object>

identifyDevicesOnBridgeNotInCache() → {Array.<Object>}

Source:

Find devices that exist on the bridge, but do not yet have a snapshot for

Returns:
Type
Array.<Object>

identifyDevicesWithChangedNodes() → {Array.<Object>}

Source:

Compare last known snapshots of device nodes with the current state-of-things, and indicate what has changed

Returns:
Type
Array.<Object>

init()

Source:

Set up K4Model change listeners and initialize model cache.

pruneDeviceNodesCache()

Source:

Removes cache of devices nodes that no longer exist on the bridge.

removeAdapterDevicesChangeListener()

Source:

Unregisters listener to Adapter mapping change events

setupAdapterDevicesChangeListener()

Source:

Creates an EventListener to monitor changes to the device nodes list

uncacheDeviceModel(devicePath)

Source:

Removes the current device model from the cache.

Parameters:
Name Type Description
devicePath String

Path to the K4Model node for the device