Class: SDN::Message::PostGroupAddr
- Inherits:
-
Message
- Object
- Message
- SDN::Message::PostGroupAddr
- Defined in:
- lib/sdn/message/post.rb
Overview
Response carrying a motor's group address for a specific slot.
Constant Summary collapse
- MSG =
Protocol message number
0x61- PARAMS_LENGTH =
Number of protocol parameter bytes expected
4
Instance Attribute Summary collapse
-
#group_address ⇒ (Integer, Integer, Integer)?
Reported group address for the slot.
-
#group_index ⇒ Integer?
Reported group slot number.
Instance Method Summary collapse
-
#class_inspect ⇒ String?
Returns the protocol-specific portion of the inspection string.
-
#initialize(group_index = nil, group_address = nil) ⇒ PostGroupAddr
constructor
Creates a group address response message.
-
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
-
#parse(params) ⇒ void
Parses protocol-specific parameter bytes into this message instance.
Constructor Details
#initialize(group_index = nil, group_address = nil) ⇒ PostGroupAddr
Creates a group address response message.
16 17 18 19 20 |
# File 'lib/sdn/message/post.rb', line 16 def initialize(group_index = nil, group_address = nil, **) super(**) self.group_index = group_index self.group_address = group_address end |
Instance Attribute Details
#group_address ⇒ (Integer, Integer, Integer)?
Reported group address for the slot.
30 31 32 |
# File 'lib/sdn/message/post.rb', line 30 def group_address @group_address end |
#group_index ⇒ Integer?
Reported group slot number.
25 26 27 |
# File 'lib/sdn/message/post.rb', line 25 def group_index @group_index end |
Instance Method Details
#class_inspect ⇒ String?
Returns the protocol-specific portion of the inspection string.
46 47 48 |
# File 'lib/sdn/message/post.rb', line 46 def class_inspect ", group_index=#{group_index.inspect}, group_address=#{group_address ? print_address(group_address) : "nil"}" end |
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
41 42 43 |
# File 'lib/sdn/message/post.rb', line 41 def params from_number(group_index - 1) + transform_param(group_address || [0, 0, 0]) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
33 34 35 36 37 38 |
# File 'lib/sdn/message/post.rb', line 33 def parse(params) super self.group_index = to_number(params[0]) + 1 self.group_address = transform_param(params[1..3]) self.group_address = nil if [[0, 0, 0], [0x01, 0x01, 0xff]].include?(group_address) end |