Class: SDN::Message::Nack

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

Constant Summary collapse

MSG =
0x6f
PARAMS_LENGTH =
1
VALUES =
{ data_error: 0x01,
unknown_message: 0x10,
node_is_locked: 0x20,
wrong_position: 0x21,
limits_not_set: 0x22,
ip_not_set: 0x23,
out_of_range: 0x24,
busy: 0xff }.freeze

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(dest = nil, error_code = nil, **kwargs) ⇒ Nack

Returns a new instance of Nack.



171
172
173
174
175
# File 'lib/sdn/message.rb', line 171

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

Instance Attribute Details

#error_codeObject

presumed



169
170
171
# File 'lib/sdn/message.rb', line 169

def error_code
  @error_code
end

Instance Method Details

#parse(params) ⇒ Object



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

def parse(params)
  super
  error_code = to_number(params[0])
  self.error_code = VALUES.invert[error_code] || error_code
end