Class: SDN::Message::ILT2::SetMotorIP

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

Constant Summary collapse

MSG =
0x53
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, #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, ip = 1, value = nil, **kwargs) ⇒ SetMotorIP

Returns a new instance of SetMotorIP.



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

def initialize(dest = nil, ip = 1, value = nil, **kwargs)
  kwargs[:dest] ||= dest
  super(**kwargs)
  self.ip = ip
  self.value = value
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



65
66
67
# File 'lib/sdn/message/ilt2/set.rb', line 65

def ip
  @ip
end

#valueObject

Returns the value of attribute value.



65
66
67
# File 'lib/sdn/message/ilt2/set.rb', line 65

def value
  @value
end

Instance Method Details

#paramsObject



89
90
91
# File 'lib/sdn/message/ilt2/set.rb', line 89

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

#parse(params) ⇒ Object



74
75
76
77
78
# File 'lib/sdn/message/ilt2/set.rb', line 74

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