Class: Lignite::SystemReply

Inherits:
Message
  • Object
show all
Defined in:
lib/lignite/message.rb

Overview

A reply to a SystemCommand

Instance Attribute Summary collapse

Attributes inherited from Message

#body, #type

Instance Method Summary collapse

Methods inherited from Message

#bytes, direct_command_no_reply, direct_command_with_reply, msgid, reply_from_bytes, reset_msgid, system_command_no_reply, system_command_with_reply

Methods included from Bytes

#bin_to_hex, #f32, #hex_to_bin, #u16, #u32, #u8, #unpack_f32, #unpack_u16, #unpack_u32, #unpack_u8

Methods included from Logger

default_logger, #logger

Constructor Details

#initialize(msgid:, error:, body:) ⇒ SystemReply

Returns a new instance of SystemReply.



76
77
78
79
80
81
82
# File 'lib/lignite/message.rb', line 76

def initialize(msgid:, error:, body:)
  @msgid = msgid
  @error = error
  @command = unpack_u8(body[0])
  @status = unpack_u8(body[1])
  @data = body[2..-1]
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



84
85
86
# File 'lib/lignite/message.rb', line 84

def command
  @command
end

#dataObject (readonly)

Returns the value of attribute data.



84
85
86
# File 'lib/lignite/message.rb', line 84

def data
  @data
end

#errorObject (readonly)

Returns the value of attribute error.



84
85
86
# File 'lib/lignite/message.rb', line 84

def error
  @error
end

#msgidObject (readonly)

Returns the value of attribute msgid.



84
85
86
# File 'lib/lignite/message.rb', line 84

def msgid
  @msgid
end

#statusObject (readonly)

Returns the value of attribute status.



84
85
86
# File 'lib/lignite/message.rb', line 84

def status
  @status
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/lignite/message.rb', line 86

def error?
  @error
end