Class: SDN::Message::SetMotorRollingSpeed
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::SetMotorRollingSpeed
- Defined in:
- lib/sdn/messages/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, #reserved, #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, #inspect, parse, readpartial, #serialize
Methods included from Helpers
#checksum, #from_number, #from_string, #is_group_address?, #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.
80 81 82 83 84 85 86 |
# File 'lib/sdn/messages/set.rb', line 80 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.
79 80 81 |
# File 'lib/sdn/messages/set.rb', line 79 def down_speed @down_speed end |
#slow_speed ⇒ Object
Returns the value of attribute slow_speed.
79 80 81 |
# File 'lib/sdn/messages/set.rb', line 79 def slow_speed @slow_speed end |
#up_speed ⇒ Object
Returns the value of attribute up_speed.
79 80 81 |
# File 'lib/sdn/messages/set.rb', line 79 def up_speed @up_speed end |
Instance Method Details
#params ⇒ Object
95 96 97 |
# File 'lib/sdn/messages/set.rb', line 95 def params transform_param(up_speed || 0xff) + transform_param(down_speed || 0xff) + transform_param(slow_speed || 0xff) end |
#parse(params) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/sdn/messages/set.rb', line 88 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 |