Class: SDN::Message::SetMotorRollingSpeed
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::SetMotorRollingSpeed
- Defined in:
- lib/sdn/message/set.rb
Constant Summary collapse
- MSG =
0x13- PARAMS_LENGTH =
3
Instance Attribute Summary collapse
-
#down_speed ⇒ Object
Returns the value of attribute down_speed.
-
#slow_speed ⇒ Object
Returns the value of attribute slow_speed.
-
#up_speed ⇒ Object
Returns the value of attribute up_speed.
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(dest = nil, up_speed: nil, down_speed: nil, slow_speed: nil, **kwargs) ⇒ SetMotorRollingSpeed
constructor
A new instance of SetMotorRollingSpeed.
- #params ⇒ Object
- #parse(params) ⇒ Object
Methods inherited from SDN::Message
#==, #class_inspect, expected_response?, inherited, #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, up_speed: nil, down_speed: nil, slow_speed: nil, **kwargs) ⇒ SetMotorRollingSpeed
Returns a new instance of SetMotorRollingSpeed.
215 216 217 218 219 220 221 |
# File 'lib/sdn/message/set.rb', line 215 def initialize(dest = nil, up_speed: nil, down_speed: nil, slow_speed: nil, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.up_speed = up_speed self.down_speed = down_speed self.slow_speed = slow_speed end |
Instance Attribute Details
#down_speed ⇒ Object
Returns the value of attribute down_speed.
213 214 215 |
# File 'lib/sdn/message/set.rb', line 213 def down_speed @down_speed end |
#slow_speed ⇒ Object
Returns the value of attribute slow_speed.
213 214 215 |
# File 'lib/sdn/message/set.rb', line 213 def slow_speed @slow_speed end |
#up_speed ⇒ Object
Returns the value of attribute up_speed.
213 214 215 |
# File 'lib/sdn/message/set.rb', line 213 def up_speed @up_speed end |
Instance Method Details
#params ⇒ Object
230 231 232 |
# File 'lib/sdn/message/set.rb', line 230 def params transform_param(up_speed || 0xff) + transform_param(down_speed || 0xff) + transform_param(slow_speed || 0xff) end |
#parse(params) ⇒ Object
223 224 225 226 227 228 |
# File 'lib/sdn/message/set.rb', line 223 def parse(params) super self.up_speed = to_number(params[0]) self.down_speed = to_number(params[1]) self.slow_speed = to_number(params[2]) end |