Class: XBee::Frames::RemoteATCommandResponse

Inherits:
AddressedFrame show all
Defined in:
lib/xbee/frames/remote_at_command_response.rb

Overview

If a device receives this frame in response to a Remote Command Request (0x17) frame, the device sends an AT Command Response (0x97) frame out the serial interface. Some commands, such as the ND command, may send back multiple frames.

Constant Summary collapse

STATUS =

Possible values for status

{
	0 => :ok,
	1 => :error,
	2 => :invalid_command,
	3 => :invalid_parameter,
	4 => :transmission_failed,
}.freeze

Instance Attribute Summary collapse

Attributes inherited from AddressedFrame

#address16, #address64

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) ⇒ RemoteATCommandResponse

Returns a new instance of RemoteATCommandResponse.



27
28
29
30
31
32
33
34
35
36
# File 'lib/xbee/frames/remote_at_command_response.rb', line 27

def initialize(packet: nil)
	super

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

Instance Attribute Details

#at_commandObject

Returns the value of attribute at_command.



12
13
14
# File 'lib/xbee/frames/remote_at_command_response.rb', line 12

def at_command
  @at_command
end

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/xbee/frames/remote_at_command_response.rb', line 14

def data
  @data
end

#statusObject

Returns the value of attribute status.



13
14
15
# File 'lib/xbee/frames/remote_at_command_response.rb', line 13

def status
  @status
end

Instance Method Details

#bytesObject



39
40
41
# File 'lib/xbee/frames/remote_at_command_response.rb', line 39

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