class XBee::Frame::ModemStatus

Attributes

status[RW]

Public Class Methods

new(data = nil) { |self| ... } click to toggle source
Calls superclass method XBee::Frame::ReceivedFrame::new
# File lib/apimode/frame/modem_status.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/modem_status.rb, line 18
def cmd_data=(data_string)
  status_byte = data_string.unpack("c")[0]
  # update status ivar for later use
  self.status = case status_byte
  when 0..2
    modem_statuses.assoc(status_byte)
  else
    raise "ModemStatus frame appears to include an invalid status value: 0x%02x" % status_byte
  end
  #actually assign and move along
  @cmd_data = data_string
end
modem_statuses() click to toggle source
# File lib/apimode/frame/modem_status.rb, line 10
def modem_statuses
  [
    [0, :Hardware_Reset],
    [1, :Watchdog_Timer_Reset],
    [2, :Associated],
  ]
end