Class: BuildWatcher::ZigbeeDevice
- Inherits:
-
Object
- Object
- BuildWatcher::ZigbeeDevice
- Defined in:
- lib/build_watcher/zigbee_device.rb
Constant Summary collapse
- MAX_SERIAL_DEVICE_ATTEMPTS =
5
Instance Method Summary collapse
- #broadcast_status(public_key, status) ⇒ Object
-
#initialize(device) ⇒ ZigbeeDevice
constructor
A new instance of ZigbeeDevice.
- #project_info(project_index) ⇒ Object
- #project_quantity ⇒ Object
Constructor Details
#initialize(device) ⇒ ZigbeeDevice
Returns a new instance of ZigbeeDevice.
4 5 6 7 8 |
# File 'lib/build_watcher/zigbee_device.rb', line 4 def initialize(device) @device = device @connection = "USE #serial_device INSTEAD OF CONNECTION DIRECTLY" Struct.new("ProjectInfo", :public_key, :private_key) unless defined?(Struct::ProjectInfo) end |
Instance Method Details
#broadcast_status(public_key, status) ⇒ Object
26 27 28 29 30 |
# File 'lib/build_watcher/zigbee_device.rb', line 26 def broadcast_status(public_key, status) serial_device do |connection| connection.puts(Message.project_status(public_key, status)) end end |
#project_info(project_index) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/build_watcher/zigbee_device.rb', line 18 def project_info(project_index) serial_device do request_project_info(project_index) sleep(0.5) read_project_info end end |
#project_quantity ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/build_watcher/zigbee_device.rb', line 10 def project_quantity serial_device do request_project_count sleep(0.5) read_project_count end end |