MappingChangeMonitor

MappingChangeMonitor

new MappingChangeMonitor(adapter)

Source:

Checks for changes in the Adapter mapping. Emits events to indicate which devices have experienced changes in their mappings.

Parameters:
Name Type Description
adapter Adapter

Members

(static) constants

Source:
Properties:
Name Type Description
constants Object

Methods

cacheAllBridgeDeviceMappings()

Source:

Stores all the bridge device mappings in the mappings cache.

cacheCurrentDeviceMapping(devicePath)

Source:

cacheCurrentDeviceMapping Adds the current device mapping to the cache.

Parameters:
Name Type Description
devicePath String

Path to the K4Model node for the device

checkWhichFieldsHaveChanged(previousDeviceMappingObj, currentDeviceMappingObj, fieldsToCompareopt) → {Array.<String>}

Source:

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

Parameters:
Name Type Attributes Description
previousDeviceMappingObj Object

The previous state of the mapping for a device.

currentDeviceMappingObj Object

The current state of the mapping for a device.

fieldsToCompare Array.<String> <optional>

The potential mapping fields that could have changed.

Returns:

The list of model fields which have actually changed

Type
Array.<String>

close()

Source:

Tear down method: unsubscribe adapter mapping change listener and clear mapping cache.

identifyDevicesInCacheNotOnBridge() → {Array.<Object>}

Source:

identifyDevicesInCacheNotOnBridge Determines which devices that exist in the cache are no longer on the bridge.

Returns:

List of devices in the cache and not currently on the bridge.

Type
Array.<Object>

identifyDevicesOnBridgeNotInCache() → {Array.<Object>}

Source:

Determines which devices that exist on the bridge have not yet been cached.

Returns:

List of devices on the bridge and not currently cached.

Type
Array.<Object>

identifyDevicesWithChangedMappings() → {Array.<Object>}

Source:

identifyDevicesWithChangedMappings Determines which devices that exist in the cache and on the bridge whose mappings have changed.

Returns:

List of devices whose existence has not changed, but whose mappings may have been modified.

Type
Array.<Object>

init()

Source:

Set up Adapter mapping change listener and initialize mapping cache.

onAdapterMappingChange()

Source:

onAdapterMappingChanged Handles the cached mapping to current mapping comparison. Emits an event to all subscribers if the mapping has actually changed.

(private) onAdapterMappingWatcherClosed()

Source:

Creates an EventListener to monitor changes to Adapter mapping

pruneMappingsCache()

Source:

Removes cache of mappings for devices that no longer exist on the bridge (and therefore, the current adapter mapping)

removeAdapterMappingListener()

Source:

removeAdapterMappingListener Unregisters listener to Adapter mapping change events

setupAdapterMappingListener()

Source:

Creates an EventListener to monitor changes to Adapter mapping

uncacheDeviceMapping(devicePath)

Source:

uncacheDeviceMapping Removes the current device mapping from the cache.

Parameters:
Name Type Description
devicePath String

Path to the K4Model node for the device