Digi XBee(R) ANSI C Host Library
Overview of Digi International's ANSI C XBee(R) Host Library

This codebase speeds development of C-based programs to interface serially with Digi International's XBee modules. It was designed for portability and works on a wide range of host processors/platforms.

The code is broken up into multiple layers, with well-defined interfaces between each layer. Layers are similar to an Ethernet NIC driver and a TCP/IP networking stack. In our case:

The core "XBee Driver" is responsible for extracting complete frames from the serial data stream and passing them to handlers via a frame dispatch table. It also provides an interface to send frames, automatically wrapping them with a frame start byte (0x7E), 2-byte length, and checksum byte.

See the Modules section for a full outline of the API layers, or view the more-detailed README. There's also a table of XBee frame types listing the source files designed to process them.

Quick Start Guide

If you're looking to get started quickly, use your desktop PC and an XBIB development board to connect to an XBee module. For the compiler requirements, review READMEs for the Windows Platform (using MinGW/MSYS) or POSIX Platform (for macOS, Linux, and Windows using Cygwin).

If you want to cross-compile programs for Digi International's ConnectCore product line, see the libdigiapix Platform. It's based on the POSIX platform files, but includes support for interfacing to GPIO pins connected to the /RESET and ON/SLEEP pins of the XBee module.

Start in samples/win32 for Windows and samples/posix for Linux, macOS or Cygwin. Run make all to build all of the sample programs. See the Samples README for a description of each program.

Most of the samples default to communicating at 115.2kbps to a module in API mode (ATAP=1). You can use the xbee_term sample as a simple terminal interface to enter command mode on the XBee module, reconfigure it, and then use ATWR to save the changes.

The "AT Inter" (short for "AT Interactive") sample is one of the simplest. It uses API frames to send AT commands to the locally-attached module, and then parses the responses. It's a useful tool to verify correct configuration of a platform's serial interface and of the XBee module's baud rate and ATAP setting. Most of the other interactive samples include this common functionality.

Note that most of the source for these samples exists in samples/common, including a shared Makefile, common.mk.