PhysicalTrafficLight

physical. PhysicalTrafficLight

A physical traffic light.

Constructor

new PhysicalTrafficLight(device, redopt, yellowopt, greenopt)

Source:
Parameters:
Name Type Attributes Description
device physical.Device

The device associated with this traffic light.

red physical.PhysicalLight <optional>

Red light.

yellow physical.PhysicalLight <optional>

Yellow light.

green physical.PhysicalLight <optional>

Green light.

Extends

Members

green :trafficLight.Light

Source:
Overrides:

The green light.

Type:

isAvailable :boolean

Source:
Overrides:

If the traffic light is available: enabled and not checked-out.

Type:
  • boolean

isCheckedOut :boolean

Source:
Overrides:

If the traffic light is checked-out or reserved.

Type:
  • boolean

isConnected :boolean

Source:

If the traffic light's device is connected. Same as isEnabled.

Type:
  • boolean

isEnabled :boolean

Source:
Overrides:

If the traffic light is enabled and ready to use. Same as isConnected.

Type:
  • boolean

red :trafficLight.Light

Source:
Overrides:

The red light.

Type:

yellow :trafficLight.Light

Source:
Overrides:

The yellow light.

Type:

Methods

checkIn()

Source:
Overrides:

Checks-in the traffic light, making it available for checking out again.

checkOut() → {boolean}

Source:
Overrides:

Checks-out or reserve the traffic light for exclusive usage, making it unavailable for other users.

Returns:

True if the traffic light was successfully checked out. False if it was already checked out.

Type
boolean

reset()

Source:
Overrides:

Sets all lights to off.

(async) sync()

Source:

Syncs the physical lights in the device with the state of this instance.

Events

disabled

Source:
Overrides:

Traffic light disabled event.

enabled

Source:
Overrides:

Traffic light enabled event.