Class: SDN::Message::ILT2::SetMotorSettings

Inherits:
UnknownMessage show all
Defined in:
lib/sdn/message/ilt2/set.rb

Overview

the motor does not move, and just stores the new values flags of 1 is reverse direction, but you have to set it every time

Constant Summary collapse

MSG =
0x52
PARAMS_LENGTH =
5

Instance Attribute Summary collapse

Attributes inherited from UnknownMessage

#msg

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

Methods inherited from UnknownMessage

#class_inspect, #serialize

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, flags = 0, down_limit = 0, position_pulses = 0, **kwargs) ⇒ SetMotorSettings

Returns a new instance of SetMotorSettings.



176
177
178
179
180
181
182
# File 'lib/sdn/message/ilt2/set.rb', line 176

def initialize(dest = nil, flags = 0, down_limit = 0, position_pulses = 0, **kwargs)
  kwargs[:dest] ||= dest
  super(**kwargs)
  self.flags = flags
  self.down_limit = down_limit
  self.position_pulses = position_pulses
end

Instance Attribute Details

#down_limitObject

Returns the value of attribute down_limit.



174
175
176
# File 'lib/sdn/message/ilt2/set.rb', line 174

def down_limit
  @down_limit
end

#flagsObject

Returns the value of attribute flags.



174
175
176
# File 'lib/sdn/message/ilt2/set.rb', line 174

def flags
  @flags
end

#position_pulsesObject

Returns the value of attribute position_pulses.



174
175
176
# File 'lib/sdn/message/ilt2/set.rb', line 174

def position_pulses
  @position_pulses
end

Instance Method Details

#paramsObject



191
192
193
# File 'lib/sdn/message/ilt2/set.rb', line 191

def params
  transform_param(flags) + from_number(down_limit, 2) + from_number(position_pulses, 2)
end

#parse(params) ⇒ Object



184
185
186
187
188
189
# File 'lib/sdn/message/ilt2/set.rb', line 184

def parse(params)
  super
  self.flags = to_number(params[0])
  self.down_limit = to_number(params[1..2])
  self.position_pulses = to_number(params[3..4])
end