PhysicalTrafficLightSelector

selectors. PhysicalTrafficLightSelector

Selects a physical traffic light to use.

Constructor

(package) new PhysicalTrafficLightSelector(optionsopt)

Source:
See:

Selects a physical traffic light to use. Checks-out and uses a specific traffic light or the first available one to issue commands.

Parameters:
Name Type Attributes Description
options object <optional>

Options.

Properties
Name Type Attributes Description
manager physical.DeviceManager <optional>

The Device Manager to use.

serialNum string | number <optional>

The serial number of the traffic light to use, if available. Cleware USB traffic lights have a numeric serial number.

Extends

  • EventEmitter

Methods

close()

Source:
See:

Called to close this instance and to stop monitoring for devices. Should be done as the last operation before exiting the process.

logInfo(loggeropt)

Source:

Logs information about known devices.

Parameters:
Name Type Attributes Default Description
logger object <optional>
console

A Console-like object for logging.

resolveTrafficLight() → {physical.PhysicalTrafficLight}

Source:

Retrieves a traffic light for exclusive usage of the caller, or null if one could not be found or checked-out. Traffic lights are released (checked-in) when disconnected.

Returns:
  • A traffic light, or null.
Type
physical.PhysicalTrafficLight

Events

disabled

Source:

Traffic light disabled event. Only fired if the specific traffic light that was checked-out was disconnected.

enabled

Source:

Traffic light enabled event. Only fired if there's currently no checked-out traffic light.