Class: BWA::Messages::ToggleItem
- Inherits:
-
BWA::Message
- Object
- BWA::Message
- BWA::Messages::ToggleItem
- Defined in:
- lib/bwa/messages/toggle_item.rb
Constant Summary collapse
- MESSAGE_TYPE =
(+"\xbf\x11").force_encoding(Encoding::ASCII_8BIT)
- MESSAGE_LENGTH =
2
- ITEMS =
{ normal_operation: 0x01, clear_notification: 0x03, pump1: 0x04, pump2: 0x05, pump3: 0x06, pump4: 0x07, pump5: 0x08, pump6: 0x09, blower: 0x0c, mister: 0x0e, light1: 0x11, light2: 0x12, aux1: 0x16, aux2: 0x17, hold: 0x3c, temperature_range: 0x50, heating_mode: 0x51 }.freeze
Constants inherited from BWA::Message
BWA::Message::IGNORED_MESSAGES
Instance Attribute Summary collapse
-
#item ⇒ Object
Returns the value of attribute item.
Attributes inherited from BWA::Message
Instance Method Summary collapse
-
#initialize(item = nil) ⇒ ToggleItem
constructor
A new instance of ToggleItem.
- #inspect ⇒ Object
- #parse(data) ⇒ Object
- #serialize ⇒ Object
Methods inherited from BWA::Message
common_messages, format_duration, format_time, inherited, parse
Constructor Details
#initialize(item = nil) ⇒ ToggleItem
Returns a new instance of ToggleItem.
30 31 32 33 |
# File 'lib/bwa/messages/toggle_item.rb', line 30 def initialize(item = nil) super() self.item = item end |
Instance Attribute Details
#item ⇒ Object
Returns the value of attribute item.
28 29 30 |
# File 'lib/bwa/messages/toggle_item.rb', line 28 def item @item end |
Instance Method Details
#inspect ⇒ Object
49 50 51 |
# File 'lib/bwa/messages/toggle_item.rb', line 49 def inspect "#<BWA::Messages::ToggleItem #{item}>" end |
#parse(data) ⇒ Object
35 36 37 |
# File 'lib/bwa/messages/toggle_item.rb', line 35 def parse(data) self.item = ITEMS.invert[data[0].ord] || data[0].ord end |
#serialize ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/bwa/messages/toggle_item.rb', line 39 def serialize data = +"\x00\x00" data[0] = if item.is_a? Integer item.chr else ITEMS[item].chr end super(data) end |