NodeStateMonitor

NodeStateMonitor

new NodeStateMonitor(optsopt, adapter)

Source:

Plugin to observe and update node states

Parameters:
Name Type Attributes Description
opts Object <optional>

General settings for NodeStateMonitor

adapter Adapter

Adapter for which this is a plugin

Members

(static) constants

Source:
Properties:
Name Type Description
constants Object

adapter :Adapter

Source:

The adapter instance

Type:

opts :Object

Source:

The options object for this NodeStateMonitor

Type:
  • Object

Methods

closeRoutine()

Source:

Tear down method

extractNodeMonitoringSettings(device) → {Object}

Source:

Obtain the set of node (state) monitoring settings from mapping

Parameters:
Name Type Description
device Device

The device whose nodeState is monitored

Throws:
Error
Returns:

The settings for monitoring nodeState for this device

Type
Object

findDevicePathById(nodeId) → {String}

Source:

Identifies the device model node given nodeId

Parameters:
Name Type Description
nodeId Number

The target nodeId

Throws:
Error
Returns:

The path to the device node corresponding to the nodeId

Type
String

getFailureRecoveryAttemptsTally(devicePath) → {Number}

Source:

Retrieve the count of how many times a specified device node has progressed to the failure recovery stage during its lifetime

Parameters:
Name Type Description
devicePath String
Throws:
Error
Returns:
Type
Number

getNodeStateByDevicePath(devicePath)

Source:

Obtains the latest nodeState from the device model node

Parameters:
Name Type Description
devicePath String

The path to the device model node

Throws:
Error

getNodeStateById(nodeId)

Source:

Retrieves the current device node state for the specified node id

Parameters:
Name Type Description
nodeId Number
Throws:
Error

incrementFailureRecoveryAttemptTally(devicePath)

Source:

Update the count of how many times a specified device node has progressed to the failure recovery stage during its lifetime

Parameters:
Name Type Description
devicePath String

init()

Source:

This method should be named as 'init' because Adapter instance calls the 'init' methods (if they exist) for all Adapter plugins

initializeLastSeenTimers() → {Promise}

Source:

Ensure that lastSeenTimers (i.e. last-heard-from-device timers) are set up properly.

Returns:
Type
Promise

issuePing(devicePath)

Source:

Sends a noOp command to the device

Parameters:
Name Type Description
devicePath String

Path to the device model node

obtainNodeMonitorPropOverrideForArgVal(argName, device, nodeMonitoringSettings) → {any}

Source:

Determine, if available, the K4Model property override value for a node monitoring argument overrides

Parameters:
Name Type Description
argName String

Name of the argument belonging to a node monitoring parameter

device Device

The device whose nodeState is monitored

nodeMonitoringSettings Object

The settings for monitoring

Returns:

The appropriate value the argument should be set to

Type
any

obtainNodeMonitorSettingArgVal(argName, device, nodeMonitoringSettings) → {any}

Source:

Determine the value to set for a specific node monitoring setting argument, giving primacy to K4Model property overrides

Parameters:
Name Type Description
argName String

Name of the argument belonging to a node monitoring parameter

device Device

The device whose nodeState is monitored

nodeMonitoringSettings Object

The settings for monitoring

Returns:

The appropriate value the argument should be set to

Type
any

onNodeStatusEvent(nodeId, nodeStatus)

Source:

Handles the updating of node states and timer renewals

Parameters:
Name Type Description
nodeId Number

The nodeId of the device whose node status was updated

nodeStatus any

The emitted status for this node

removeNodeStatusAdapterEventListener()

Source:

Unregisters listener from node status update events emitted by the Adapter instance

resetLastSeenTimerForDevice(devicePath, resetModeopt, nodeMonitoringSettingsopt)

Source:

Resets/refills the timer for the device when it has been responsive/active

Parameters:
Name Type Attributes Description
devicePath String

Path to the device model node

resetMode String <optional>

The type of timeout to refill the timer using

nodeMonitoringSettings Object <optional>

The settings object for node monitoring timeouts, intervals, etc.

Throws:
Error

resetPingTimerForDevice(devicePath, nodeMonitoringSettingsopt)

Source:

Resets the timer for when to send the next noOp ping to the device.

Parameters:
Name Type Attributes Description
devicePath String

Path to the device model node

nodeMonitoringSettings Object <optional>
Throws:
Error

setupNodeStatusAdapterEventListener()

Source:

Creates an EventListener to monitor updates of node statuses emitted by the Adapter instance

updateNodeState(devicePath, nodeState)

Source:

Updates the K4Model variable for the specified device's node state

Parameters:
Name Type Description
devicePath String

Path to the device model node

nodeState String

The raw, local node state for this device