Class: SDN::Message::UnknownMessage

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

Overview

messages after this point were decoded from UAI+ communication and may be named wrong

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

Methods inherited from SDN::Message

#==, expected_response?, inherited, #inspect, parse

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(params = [], **kwargs) ⇒ UnknownMessage

Returns a new instance of UnknownMessage.



193
194
195
196
# File 'lib/sdn/message.rb', line 193

def initialize(params = [], **kwargs)
  super(**kwargs)
  self.params = params
end

Instance Attribute Details

#msgObject

Returns the value of attribute msg.



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

def msg
  @msg
end

#paramsObject

Returns the value of attribute params.



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

def params
  @params
end

Instance Method Details

#class_inspectObject



207
208
209
210
211
212
213
214
215
216
# File 'lib/sdn/message.rb', line 207

def class_inspect
  result = if instance_of?(UnknownMessage)
             format(", @msg=%02xh", msg)
           else
             super || ""
           end
  return result if params.empty?

  result << ", @params=#{params.map { |b| format("%02x", b) }.join(" ")}"
end

#serializeObject

Raises:

  • (NotImplementedError)


200
201
202
203
204
205
# File 'lib/sdn/message.rb', line 200

def serialize
  # prevent serializing something we don't know
  raise NotImplementedError unless params

  super
end