Class: ParameterWatcher

ParameterWatcher(node, remoteNodeName, parameterNames, optionsopt)

ParameterWatcher - Watches parameter changes on a remote node Subscribes to /parameter_events and emits 'change' events when watched parameters on the target node are modified.

Extends

  • EventEmitter

Members

(readonly) remoteNodeName :string

Get the remote node name being watched.
Type:
  • string
Source:

(readonly) watchedParameters :Array.<string>

Get the list of watched parameter names.
Type:
  • Array.<string>
Source:

Methods

addParameter(name)

Add a parameter name to the watch list.
Parameters:
Name Type Description
name string Parameter name to watch
Source:
Throws:
  • If name is not a string
    Type
    TypeError
  • If the watcher has been destroyed
    Type
    Error

destroy()

Destroy the watcher and clean up resources. Unsubscribes from parameter events and destroys the parameter client.
Source:

(async) getCurrentValues(optionsopt) → {Promise.<Array.<Parameter>>}

Get current values of all watched parameters.
Parameters:
Name Type Attributes Description
options object <optional>
Options for the parameter client
Properties
Name Type Attributes Description
timeout number <optional>
Timeout in milliseconds
signal AbortSignal <optional>
AbortSignal for cancellation
Source:
Throws:
If the watcher has been destroyed
Type
Error
Returns:
Array of Parameter objects
Type
Promise.<Array.<Parameter>>

isDestroyed() → {boolean}

Check if the watcher has been destroyed.
Source:
Returns:
True if destroyed
Type
boolean

removeParameter(name) → {boolean}

Remove a parameter name from the watch list.
Parameters:
Name Type Description
name string Parameter name to stop watching
Source:
Throws:
If the watcher has been destroyed
Type
Error
Returns:
True if the parameter was in the watch list
Type
boolean

(async) start(timeoutopt) → {Promise.<boolean>}

Start watching for parameter changes. Waits for the remote node's parameter services and subscribes to parameter events.
Parameters:
Name Type Attributes Default Description
timeout number <optional>
5000 Timeout in milliseconds to wait for services
Source:
Throws:
If the watcher has been destroyed
Type
Error
Returns:
Resolves to true when watching has started
Type
Promise.<boolean>