XBee Firmware Library  1.6.0
Data Structures | Typedefs | Enumerations | Functions | Variables
device.h File Reference

Data Structures

struct  xbee_dev_t
 
struct  xbee_dev_t::rx
 Buffer and state variables used for receiving a frame. More...
 
struct  xbee_dispatch_table_entry
 

Typedefs

typedef struct xbee_dev_t xbee_dev_t
 
typedef struct xbee_dispatch_table_entry xbee_dispatch_table_entry_t
 
typedef PACKED_STRUCT xbee_frame_modem_status_t
 
Function Pointer Prototypes

Function pointer prototypes, forward declaration using "struct xbee_dev_t" instead of "xbee_dev_t" since we use the types in the xbee_dev_t definition.

typedef int(* xbee_frame_handler_fn) (struct xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
 Standard API for an XBee frame handler in xbee_frame_handlers global. These functions are only called when xbee_dev_tick() or wpan_tick() are called and a complete frame is ready for processing. More...
 
typedef int(* xbee_is_awake_fn) (struct xbee_dev_t *xbee)
 Function to check the XBee device's AWAKE pin to see if it is awake. More...
 
typedef void(* xbee_reset_fn) (struct xbee_dev_t *xbee, bool_t asserted)
 Function to toggle the /RESET pin to the XBee device. More...
 
typedef void(* xbee_disc_node_id_fn) (struct xbee_dev_t *xbee, const struct xbee_node_id_t *rec)
 Function to process parsed Node ID messages. More...
 

Enumerations

enum  xbee_dev_flags {
  XBEE_DEV_FLAG_CMD_INIT = 0x0001, XBEE_DEV_FLAG_QUERY_BEGIN = 0x0002, XBEE_DEV_FLAG_QUERY_DONE = 0x0004, XBEE_DEV_FLAG_QUERY_ERROR = 0x0008,
  XBEE_DEV_FLAG_QUERY_REFRESH = 0x0010, XBEE_DEV_FLAG_QUERY_INPROGRESS = 0x0020, XBEE_DEV_FLAG_IN_TICK = 0x0080, XBEE_DEV_FLAG_COORDINATOR = 0x0100,
  XBEE_DEV_FLAG_ROUTER = 0x0200, XBEE_DEV_FLAG_ENDDEV = 0x0400, XBEE_DEV_FLAG_ZNET = 0x0800, XBEE_DEV_FLAG_ZIGBEE = 0x1000,
  XBEE_DEV_FLAG_DIGIMESH = 0x2000, XBEE_DEV_FLAG_USE_FLOWCONTROL = (int)0x8000
}
 
enum  xbee_dev_mode {
  XBEE_MODE_UNKNOWN = 0, XBEE_MODE_BOOTLOADER, XBEE_MODE_API, XBEE_MODE_IDLE,
  XBEE_MODE_PRE_ESCAPE, XBEE_MODE_POST_ESCAPE, XBEE_MODE_COMMAND, XBEE_MODE_WAIT_IDLE,
  XBEE_MODE_WAIT_RESPONSE
}
 
enum  xbee_dev_rx_state { XBEE_RX_STATE_WAITSTART = 0, XBEE_RX_STATE_LENGTH_MSB, XBEE_RX_STATE_LENGTH_LSB, XBEE_RX_STATE_RXFRAME }
 
enum  xbee_frame_type {
  XBEE_FRAME_LOCAL_AT_CMD = 0x08, XBEE_FRAME_LOCAL_AT_CMD_Q = 0x09, XBEE_FRAME_TRANSMIT = 0x10, XBEE_FRAME_TRANSMIT_EXPLICIT = 0x11,
  XBEE_FRAME_REMOTE_AT_CMD = 0x17, XBEE_FRAME_CREATE_SRC_ROUTE = 0x21, XBEE_FRAME_REG_JOINING_DEV = 0x24, XBEE_FRAME_LOCAL_AT_RESPONSE = 0x88,
  XBEE_FRAME_MODEM_STATUS = 0x8A, XBEE_FRAME_TRANSMIT_STATUS = 0x8B, XBEE_FRAME_ROUTE_INFORMATION = 0x8D, XBEE_FRAME_AGGREGATE_ADDRESSING = 0x8E,
  XBEE_FRAME_RECEIVE = 0x90, XBEE_FRAME_RECEIVE_EXPLICIT = 0x91, XBEE_FRAME_IO_RESPONSE = 0x92, XBEE_FRAME_SENDOR_READ = 0x94,
  XBEE_FRAME_NODE_ID = 0x95, XBEE_FRAME_REMOTE_AT_RESPONSE = 0x97, XBEE_FRAME_FW_UPDATE_STATUS = 0xA0, XBEE_FRAME_ROUTE_RECORD = 0xA1,
  XBEE_FRAME_DEVICE_AUTHENTICATED = 0xA2, XBEE_FRAME_ROUTE_REQUEST_INDICATOR = 0xA3, XBEE_FRAME_REG_JOINING_DEV_STATUS = 0xA4, XBEE_FRAME_JOIN_NOTIFICATION_STATUS = 0xA5
}
 

Functions

uint8_t _xbee_checksum (const void FAR *bytes, uint_fast8_t length, uint_fast8_t initial)
 
void _xbee_dispatch_table_dump (const xbee_dev_t *xbee)
 
int _xbee_frame_dispatch (xbee_dev_t *xbee, const void FAR *frame, uint16_t length)
 
int _xbee_frame_load (xbee_dev_t *xbee)
 
void xbee_dev_dump_settings (xbee_dev_t *xbee, uint16_t flags)
 Print information to stdout about the XBee device. More...
 
void xbee_dev_flowcontrol (xbee_dev_t *xbee, bool_t enabled)
 Control whether xbee_frame_write() checks the XBee CTS signal before sending frames. More...
 
int xbee_dev_init (xbee_dev_t *xbee, const xbee_serial_t *serport, xbee_is_awake_fn is_awake, xbee_reset_fn reset)
 Initialize the XBee device structure and open a serial connection to a local, serially-attached XBee module. More...
 
int xbee_dev_reset (xbee_dev_t *xbee)
 Toggles the reset line of the XBee device. More...
 
int xbee_dev_tick (xbee_dev_t *xbee)
 Check for newly received frames on an XBee device and dispatch them to registered frame handlers. More...
 
int xbee_frame_dump_modem_status (xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
 Frame handler for 0x8A (XBEE_FRAME_MODEM_STATUS) frames – dumps modem status to STDOUT for debugging purposes. More...
 
int xbee_frame_write (xbee_dev_t *xbee, const void FAR *header, uint16_t headerlen, const void FAR *data, uint16_t datalen, uint16_t flags)
 Copies a frame into the transmit serial buffer to send to an XBee module. More...
 
uint8_t xbee_next_frame_id (xbee_dev_t *xbee)
 Increment and return current frame ID for a given XBee device. More...
 

Variables

uint8_t status
 
const xbee_dispatch_table_entry_t xbee_frame_handlers []
 

Detailed Description

Device layer for XBee module interface.