Class: SDN::Message::UnknownMessage
- Inherits:
-
Message
- Object
- Message
- SDN::Message::UnknownMessage
- Defined in:
- lib/sdn/message.rb
Overview
Fallback wrapper for frames whose opcode is unknown to the library.
Messages after this point were decoded from UAI+ communication and may be named wrong.
Direct Known Subclasses
ILT2::PostMotorSettings, ILT2::SetMotorLimits, ILT2::SetMotorSettings, PostNetworkLock
Instance Attribute Summary collapse
-
#msg ⇒ Integer?
Unknown protocol opcode captured for this message.
-
#params ⇒ <Integer>?
Raw undecoded parameter bytes for this message.
Instance Method Summary collapse
-
#class_inspect ⇒ String?
Returns the protocol-specific portion of the inspection string.
-
#initialize(params = []) ⇒ UnknownMessage
constructor
Creates a message wrapper for an unrecognized protocol opcode.
-
#serialize ⇒ String
Serializes an unknown message only when raw parameters are present.
Constructor Details
#initialize(params = []) ⇒ UnknownMessage
Creates a message wrapper for an unrecognized protocol opcode.
294 295 296 297 |
# File 'lib/sdn/message.rb', line 294 def initialize(params = [], **) super(**) self.params = params end |
Instance Attribute Details
#msg ⇒ Integer?
Unknown protocol opcode captured for this message.
284 285 286 |
# File 'lib/sdn/message.rb', line 284 def msg @msg end |
#params ⇒ <Integer>?
Raw undecoded parameter bytes for this message.
289 290 291 |
# File 'lib/sdn/message.rb', line 289 def params @params end |
Instance Method Details
#class_inspect ⇒ String?
Returns the protocol-specific portion of the inspection string.
314 315 316 317 318 319 320 321 322 323 |
# File 'lib/sdn/message.rb', line 314 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 |
#serialize ⇒ String
Serializes an unknown message only when raw parameters are present.
306 307 308 309 310 311 |
# File 'lib/sdn/message.rb', line 306 def serialize # prevent serializing something we don't know raise NotImplementedError unless params super end |