Class: SDN::Message::GetMotorIP

Inherits:
SDN::Message show all
Defined in:
lib/sdn/messages/get.rb

Constant Summary collapse

MSG =
0x25
PARAMS_LENGTH =
1

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #reserved, #src

Instance Method Summary collapse

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

Returns a new instance of GetMotorIP.



29
30
31
32
33
# File 'lib/sdn/messages/get.rb', line 29

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

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



27
28
29
# File 'lib/sdn/messages/get.rb', line 27

def ip
  @ip
end

Instance Method Details

#paramsObject



45
46
47
# File 'lib/sdn/messages/get.rb', line 45

def params
  transform_param(@ip || 0xff)
end

#parse(params) ⇒ Object



35
36
37
38
# File 'lib/sdn/messages/get.rb', line 35

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