Class: SDN::Message::ILT2::SetMotorIP
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::ILT2::SetMotorIP
- Defined in:
- lib/sdn/message/ilt2/set.rb
Overview
Command that writes an ILT2 intermediate position slot.
Constant Summary collapse
- MSG =
Protocol message number
0x53- PARAMS_LENGTH =
Number of protocol parameter bytes expected
3
Instance Attribute Summary collapse
-
#ip ⇒ Integer?
Requested ILT2 intermediate position slot in the range 1..16.
- #value ⇒ Integer?
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(dest = nil, ip = 1, value = nil, **kwargs) ⇒ SetMotorIP
constructor
Creates an ILT2 intermediate position write command.
-
#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(dest = nil, ip = 1, value = nil, **kwargs) ⇒ SetMotorIP
Creates an ILT2 intermediate position write command.
122 123 124 125 126 127 |
# File 'lib/sdn/message/ilt2/set.rb', line 122 def initialize(dest = nil, ip = 1, value = nil, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.ip = ip self.value = value end |
Instance Attribute Details
#ip ⇒ Integer?
Requested ILT2 intermediate position slot in the range 1..16.
111 112 113 |
# File 'lib/sdn/message/ilt2/set.rb', line 111 def ip @ip end |
#value ⇒ Integer?
114 115 116 |
# File 'lib/sdn/message/ilt2/set.rb', line 114 def value @value end |
Instance Method Details
#params ⇒ <Integer>
Returns the protocol-specific payload bytes for this message.
147 148 149 |
# File 'lib/sdn/message/ilt2/set.rb', line 147 def params transform_param(ip - 1) + from_number(value, 2) end |
#parse(params) ⇒ void
This method returns an undefined value.
Parses protocol-specific parameter bytes into this message instance.
130 131 132 133 134 |
# File 'lib/sdn/message/ilt2/set.rb', line 130 def parse(params) super self.ip = to_number(params[0]) + 1 self.value = to_number(params[1..2], nillable: true) end |