Class: MideaAirCondition::Command::BaseCommand
- Inherits:
-
Object
- Object
- MideaAirCondition::Command::BaseCommand
- Defined in:
- lib/commands/command.rb
Overview
Base Command class
Direct Known Subclasses
Instance Method Summary collapse
- #finalize(security) ⇒ Object
-
#initialize(device_type: 0xAC) ⇒ BaseCommand
constructor
Default device type: 0xAC.
Constructor Details
#initialize(device_type: 0xAC) ⇒ BaseCommand
Default device type: 0xAC
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/commands/command.rb', line 8 def initialize(device_type: 0xAC) @data = [0xaa, 0x23, device_type, 0x00, 0x00, 0x00, 0x00, 0x00] @data += [ 0x03, 0x02, 0xff, 0x81, 0x00, 0xff, 0x03, 0xff, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] fill end |
Instance Method Details
#finalize(security) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/commands/command.rb', line 20 def finalize(security) # Add command sequence number # Can't be lower than 3 @data << 0x03 @data << security.crc8(@data[0x10..(@data.length - 1)]) @data[0x01] = @data.length @data end |