Class: BWA::Messages::ControlConfiguration2
- Inherits:
-
BWA::Message
- Object
- BWA::Message
- BWA::Messages::ControlConfiguration2
- Defined in:
- lib/bwa/messages/control_configuration.rb
Constant Summary collapse
- MESSAGE_TYPE =
"\xbf\x2e".b
- MESSAGE_LENGTH =
6
Instance Attribute Summary collapse
-
#aux ⇒ Object
Returns the value of attribute aux.
-
#blower ⇒ Object
Returns the value of attribute blower.
-
#circulation_pump ⇒ Object
Returns the value of attribute circulation_pump.
-
#lights ⇒ Object
Returns the value of attribute lights.
-
#mister ⇒ Object
Returns the value of attribute mister.
-
#pumps ⇒ Object
Returns the value of attribute pumps.
Attributes inherited from BWA::Message
Instance Method Summary collapse
-
#initialize ⇒ ControlConfiguration2
constructor
A new instance of ControlConfiguration2.
- #inspect ⇒ Object
- #parse(data) ⇒ Object
Methods inherited from BWA::Message
format_duration, format_time, inherited, #log?, parse, #serialize
Constructor Details
#initialize ⇒ ControlConfiguration2
Returns a new instance of ControlConfiguration2.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bwa/messages/control_configuration.rb', line 33 def initialize super self.pumps = Array.new(6, 0) self.lights = Array.new(2, false) self.circulation_pump = false self.blower = 0 self.mister = false self.aux = Array.new(2, false) end |
Instance Attribute Details
#aux ⇒ Object
Returns the value of attribute aux.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def aux @aux end |
#blower ⇒ Object
Returns the value of attribute blower.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def blower @blower end |
#circulation_pump ⇒ Object
Returns the value of attribute circulation_pump.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def circulation_pump @circulation_pump end |
#lights ⇒ Object
Returns the value of attribute lights.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def lights @lights end |
#mister ⇒ Object
Returns the value of attribute mister.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def mister @mister end |
#pumps ⇒ Object
Returns the value of attribute pumps.
31 32 33 |
# File 'lib/bwa/messages/control_configuration.rb', line 31 def pumps @pumps end |
Instance Method Details
#inspect ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bwa/messages/control_configuration.rb', line 65 def inspect items = [] items << "pumps=#{pumps.inspect}" items << "lights=#{lights.inspect}" items << "circulation_pump" if circulation_pump items << "blower=#{blower}" if blower != 0 items << "mister" if mister items << "aux=#{aux.inspect}" "#<BWA::Messages::ControlConfiguration2 #{items.join(" ")}>" end |
#parse(data) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bwa/messages/control_configuration.rb', line 44 def parse(data) flags = data[0].ord pumps[0] = flags & 0x03 pumps[1] = (flags >> 2) & 0x03 pumps[2] = (flags >> 4) & 0x03 pumps[3] = (flags >> 6) & 0x03 flags = data[1].ord pumps[4] = flags & 0x03 pumps[5] = (flags >> 6) & 0x03 flags = data[2].ord lights[0] = (flags & 0x03 != 0) lights[1] = ((flags >> 6) & 0x03 != 0) flags = data[3].ord self.blower = flags & 0x03 self.circulation_pump = ((flags >> 6) & 0x03 != 0) flags = data[4].ord self.mister = (flags & 0x30 != 0) aux[0] = (flags & 0x01 != 0) aux[1] = (flags & 0x02 != 0) end |