Class: SDN::Message::MoveOf
- Inherits:
-
SDN::Message
- Object
- SDN::Message
- SDN::Message::MoveOf
- Defined in:
- lib/sdn/message/control.rb
Overview
Move relative to current position
Constant Summary collapse
- MSG =
0x04- PARAMS_LENGTH =
4- TARGET_TYPE =
{ next_ip: 0x00, previous_ip: 0x01, jog_down_pulses: 0x02, jog_up_pulses: 0x03, jog_down_ms: 0x04, jog_up_ms: 0x05 }
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
-
#target_type ⇒ Object
Returns the value of attribute target_type.
Attributes inherited from SDN::Message
#ack_requested, #dest, #node_type, #src
Instance Method Summary collapse
-
#initialize(dest = nil, target_type = nil, target = nil, **kwargs) ⇒ MoveOf
constructor
A new instance of MoveOf.
- #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, #is_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, target_type = nil, target = nil, **kwargs) ⇒ MoveOf
Returns a new instance of MoveOf.
100 101 102 103 104 105 |
# File 'lib/sdn/message/control.rb', line 100 def initialize(dest = nil, target_type = nil, target = nil, **kwargs) kwargs[:dest] ||= dest super(**kwargs) self.target_type = target_type self.target = target end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
98 99 100 |
# File 'lib/sdn/message/control.rb', line 98 def target @target end |
#target_type ⇒ Object
Returns the value of attribute target_type.
98 99 100 |
# File 'lib/sdn/message/control.rb', line 98 def target_type @target_type end |
Instance Method Details
#params ⇒ Object
125 126 127 128 129 |
# File 'lib/sdn/message/control.rb', line 125 def params param = target || 0xffff param /= 10 if I{jog_down_ms jog_up_ms}.include?(target_type) transform_param(TARGET_TYPE[target_type]) + from_number(param, 2) + transform_param(0) end |
#parse(params) ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/sdn/message/control.rb', line 107 def parse(params) super self.target_type = TARGET_TYPE.invert[to_number(params[0])] target = to_number(params[1..2], nillable: true) target *= 10 if I{jog_down_ms jog_up_ms}.include?(target_type) self.target = target end |