Class: XBee::Frames::ModemStatus

Inherits:
Frame
  • Object
show all
Defined in:
lib/xbee/frames/modem_status.rb

Constant Summary collapse

STATUSES =
{
  0x00 => 'Hardware reset',
  0x01 => 'Watchdog timer reset',
  0x02 => 'Joined network',
  0x03 => 'Disassociated',
  0x06 => 'Coordinator started',
  0x07 => 'Network security key was updated',
  0x0D => 'Voltage supply limit exceeded',
  0x11 => 'Modem configuration changed while join in progress',
}

Instance Attribute Summary collapse

Attributes inherited from Frame

#packet

Instance Method Summary collapse

Methods inherited from Frame

api_id, from_packet, #to_packet

Constructor Details

#initialize(packet: nil) ⇒ ModemStatus

Returns a new instance of ModemStatus.



24
25
26
27
28
29
30
# File 'lib/xbee/frames/modem_status.rb', line 24

def initialize(packet: nil)
  super

  if @parse_bytes
    @status = @parse_bytes.shift
  end
end

Instance Attribute Details

#statusObject

Returns the value of attribute status.



21
22
23
# File 'lib/xbee/frames/modem_status.rb', line 21

def status
  @status
end

Instance Method Details

#bytesObject



42
43
44
# File 'lib/xbee/frames/modem_status.rb', line 42

def bytes
  super + [status || 0x00]
end

#status_stringObject



33
34
35
36
37
38
39
# File 'lib/xbee/frames/modem_status.rb', line 33

def status_string
  if status < 0x80
    STATUSES[status]
  else
    'Ember ZigBee stack error'
  end
end