xbee_con *xbee_newcon(unsigned char frameID, xbee_types type, ...);
void xbee_flushcon(xbee_con *con);
void xbee_endcon(xbee_con *con);
NOTE: Packets will only be collected when they match an active connection. You must setup a connection in order to recieve packets.
The argument frameID allows similar functionality to that of TCP/IP port numbers. This is 1 character (or 8-bit integer) that identifies where the data is coming from or going to. The type specifies the type of connection you would like. The following types are avaliable:
If you are using xbee_localAT, xbee_txStatus or xbee_modemStatus then only the frameID and type arguments are required.
If you are using any 16-bit connection, you must also specify 1 right aligned integer, containing the 16-bit address (e.g. 0x1234).
If you are using any 64-bit connection, you must also specify 2 integers containing the 64-bit address, first the high 32-bits, then the low 32-bits.
The xbee_flushcon() function is very basic. It removes any packets that have been collected in the buffer for the specified connection.
The xbee_endcon() function is used to end a connection. This will stop collecting packets for the given connection, and remove any packets from the buffer.
For information on using callback functions for packet handling please see xbee_con(3)
#include <xbee.h> xbee_con *con; con = xbee_newcon('A', xbee_localAT);
To create a 16-bit Data connection:
#include <xbee.h> xbee_con *con; con = xbee_newcon('A', xbee_16bitData, 0x1234);
To create a 64-bit Data connection:
#include <xbee.h> xbee_con *con; con = xbee_newcon('A', xbee_64bitData, 0x0013A200, 0x40081826);