Class: SDN::Message::ILT2::PostMotorIP

Inherits:
SDN::Message show all
Defined in:
lib/sdn/message/ilt2/post.rb

Constant Summary collapse

MSG =
0x63
PARAMS_LENGTH =
3

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

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(ip = nil, position_pulses = nil, **kwargs) ⇒ PostMotorIP

Returns a new instance of PostMotorIP.



62
63
64
65
66
# File 'lib/sdn/message/ilt2/post.rb', line 62

def initialize(ip = nil, position_pulses = nil, **kwargs)
  super(**kwargs)
  self.ip = ip
  self.position_pulses = position_pulses
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



60
61
62
# File 'lib/sdn/message/ilt2/post.rb', line 60

def ip
  @ip
end

#position_pulsesObject

Returns the value of attribute position_pulses.



60
61
62
# File 'lib/sdn/message/ilt2/post.rb', line 60

def position_pulses
  @position_pulses
end

Instance Method Details

#paramsObject



74
75
76
# File 'lib/sdn/message/ilt2/post.rb', line 74

def params
  transform_param(ip - 1) + from_number(position_pulses, 2)
end

#parse(params) ⇒ Object



68
69
70
71
72
# File 'lib/sdn/message/ilt2/post.rb', line 68

def parse(params)
  super
  self.ip = to_number(params[0]) + 1
  self.position_pulses = to_number(params[1..2], nillable: true)
end