Constructor
(abstract) new Device(serialNum, isConnectedopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
serialNum |
string | number | The unique serial number of the device. |
||
isConnected |
boolean |
<optional> |
true
|
If the device is connected. |
Extends
- EventEmitter
Members
isConnected :boolean
- Source:
If the device is connected.
Type:
- boolean
serialNum :string|number
- Source:
The unique serial number of the device.
Type:
- string | number
trafficLight :physical.PhysicalTrafficLight
- Source:
The physical traffic light associated with this device.
Type:
Methods
connect()
- Source:
Marks this device as connected.
Fires:
disconnect()
- Source:
Marks this device as disconnected.
Fires:
(abstract) turn(lightID, onOff)
- Source:
Turns a light on or off.
Parameters:
Name | Type | Description |
---|---|---|
lightID |
number | Zero-based index of the light to turn: 0 is red, 1 is yellow and 2 is green. |
onOff |
number | On (1) or off (0). |
Events
connected
- Source:
Connected event.
disconnected
- Source:
Disconnected event.