Class: BWA::Messages::ControlConfigurationRequest
- Inherits:
-
BWA::Message
- Object
- BWA::Message
- BWA::Messages::ControlConfigurationRequest
- Defined in:
- lib/bwa/messages/control_configuration_request.rb
Constant Summary collapse
- MESSAGE_TYPE =
"\xbf\x22".b
- MESSAGE_LENGTH =
3
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from BWA::Message
Instance Method Summary collapse
-
#initialize(type = 1) ⇒ ControlConfigurationRequest
constructor
A new instance of ControlConfigurationRequest.
- #inspect ⇒ Object
- #parse(data) ⇒ Object
- #serialize ⇒ Object
Methods inherited from BWA::Message
format_duration, format_time, inherited, #log?, parse
Constructor Details
#initialize(type = 1) ⇒ ControlConfigurationRequest
Returns a new instance of ControlConfigurationRequest.
11 12 13 14 |
# File 'lib/bwa/messages/control_configuration_request.rb', line 11 def initialize(type = 1) super() self.type = type end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/bwa/messages/control_configuration_request.rb', line 9 def type @type end |
Instance Method Details
#inspect ⇒ Object
35 36 37 |
# File 'lib/bwa/messages/control_configuration_request.rb', line 35 def inspect "#<BWA::Messages::ControlConfigurationRequest #{type}>" end |
#parse(data) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/bwa/messages/control_configuration_request.rb', line 16 def parse(data) self.type = case data when "\x02\x00\x00" then 1 when "\x00\x00\x01" then 2 when "\x01\x00\x00" then 3 else 0 end end |
#serialize ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/bwa/messages/control_configuration_request.rb', line 25 def serialize data = case type when 1 then "\x02\x00\x00" when 2 then "\x00\x00\x01" when 3 then "\x01\x00\x00" else "\x00\x00\x00" end super(data) end |