class XBee::Frame::ATCommandResponse

Attributes

at_command[RW]
frame_id[RW]
retrieved_value[RW]
status[RW]

Public Class Methods

new(data = nil) { |self| ... } click to toggle source
Calls superclass method
# File lib/apimode/frame/at_command_response.rb, line 6
def initialize(data = nil)
  super(data) && (yield self if block_given?)
end

Public Instance Methods

cmd_data=(data_string) click to toggle source
# File lib/apimode/frame/at_command_response.rb, line 14
def cmd_data=(data_string)
  self.frame_id, self.at_command, status_byte, self.retrieved_value = data_string.unpack("Ca2Ca*")
  self.status = case status_byte
  when 0..3 
    command_statuses[status_byte]
  else
    raise "AT Command Response frame appears to include an invalid status: 0x%x" % status_byte
  end
  #actually assign and move along
  @cmd_data = data_string
  #### DEBUG ####
  if $DEBUG then
    print "Retrieved Value: #{self.retrieved_value.unpack('C*').join(', ')} | "
    print "Retrieved Value: #{self.retrieved_value.unpack('a*')} | "
  end
  #### DEBUG ####
end
command_statuses() click to toggle source
# File lib/apimode/frame/at_command_response.rb, line 10
def command_statuses
  [:OK, :ERROR, :Invalid_Command, :Invalid_Parameter]
end