Class: SDN::Message::ILT2::PostMotorIP
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::ILT2::PostMotorIP
- Defined in:
- lib/sdn/message/ilt2/post.rb
Overview
Response carrying a stored ILT2 intermediate position.
Constant Summary collapse
- MSG =
Protocol message number
0x63- PARAMS_LENGTH =
Number of protocol parameter bytes expected
3
Instance Attribute Summary collapse
-
#ip ⇒ Integer?
Reported intermediate position slot in the range 1..16.
- #position_pulses ⇒ Integer?
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(ip = nil, position_pulses = nil) ⇒ PostMotorIP
constructor
Creates an ILT2 motor IP response.
-
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
-
#parse(params) ⇒ void
Parses protocol-specific parameter bytes into this message instance.
Methods inherited from SDN::Message
#==, expected_response?, #inspect, parse, #serialize
Methods included from Helpers
#checksum, #from_number, #from_string, #group_address?, #node_type_from_number, #node_type_to_number, #node_type_to_string, #parse_address, #print_address, #to_number, #to_string, #transform_param
Constructor Details
#initialize(ip = nil, position_pulses = nil) ⇒ PostMotorIP
Creates an ILT2 motor IP response.
100 101 102 103 104 |
# File 'lib/sdn/message/ilt2/post.rb', line 100 def initialize(ip = nil, position_pulses = nil, **) super(**) self.ip = ip self.position_pulses = position_pulses end |
Instance Attribute Details
#ip ⇒ Integer?
Reported intermediate position slot in the range 1..16.
91 92 93 |
# File 'lib/sdn/message/ilt2/post.rb', line 91 def ip @ip end |
#position_pulses ⇒ Integer?
94 95 96 |
# File 'lib/sdn/message/ilt2/post.rb', line 94 def position_pulses @position_pulses end |
Instance Method Details
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
114 115 116 |
# File 'lib/sdn/message/ilt2/post.rb', line 114 def params transform_param(ip - 1) + from_number(position_pulses, 2) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
107 108 109 110 111 |
# File 'lib/sdn/message/ilt2/post.rb', line 107 def parse(params) super self.ip = to_number(params[0]) + 1 self.position_pulses = to_number(params[1..2], nillable: true) end |