Class: XBee::Frames::ATCommandResponse

Inherits:
IdentifiedFrame show all
Defined in:
lib/xbee/frames/at_command_response.rb

Instance Attribute Summary collapse

Attributes inherited from IdentifiedFrame

#id

Attributes inherited from Frame

#packet

Instance Method Summary collapse

Methods inherited from Frame

api_id, from_packet, #to_packet

Constructor Details

#initialize(packet: nil) ⇒ ATCommandResponse

Returns a new instance of ATCommandResponse.



14
15
16
17
18
19
20
21
22
23
# File 'lib/xbee/frames/at_command_response.rb', line 14

def initialize(packet: nil)
  super

  if @parse_bytes
    @command = @parse_bytes.shift 2
    @status = @parse_bytes.shift
    @data = @parse_bytes
    @parse_bytes = []
  end
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



9
10
11
# File 'lib/xbee/frames/at_command_response.rb', line 9

def command
  @command
end

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/xbee/frames/at_command_response.rb', line 11

def data
  @data
end

#statusObject

Returns the value of attribute status.



10
11
12
# File 'lib/xbee/frames/at_command_response.rb', line 10

def status
  @status
end

Instance Method Details

#bytesObject



26
27
28
# File 'lib/xbee/frames/at_command_response.rb', line 26

def bytes
  super + (command || [0x00] * 2) + [status || 0x00] + (data || [])
end