XBEE_NEWCON

Section: Linux Programmer's Manual (3)
Updated: 2009-11-01
Index Return to Main Contents
 

NAME

xbee_newcon  

SYNOPSIS

#include <xbee.h>

xbee_con *xbee_newcon(unsigned char frameID, xbee_types type, ...);

void xbee_flushcon(xbee_con *con);

void xbee_endcon(xbee_con *con);  

DESCRIPTION

The xbee_newcon() function will setup a new connection with the specified settings. It takes at least 2 arguments, and possibly up to 4 depending on the type.

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:

xbee_localAT
communicates AT commands with the local XBee
xbee_txStatus
recieves transmit status information from the local XBee
xbee_modemStatus
recieves modem status information from the local XBee
xbee_16bitRemoteAT
communicates AT commands with a remote node (using 16-bit addressing)
xbee_64bitRemoteAT
communicates AT commands with a remote node (using 64-bit addressing)
xbee_16bitData
sends/recieves data through a remote node (using 16-bit addressing)
xbee_64bitData
sends/recieves data through a remote node (using 64-bit addressing)
xbee_16bitIO
sends/recieves I/O data through a remote node (using 16-bit addressing)
xbee_64bitIO
sends/recieves I/O data through a remote node (using 64-bit addressing)

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.  

RETURN VALUE

A pointer to the connection is returned. A connection can only be made once, using the same type , frameID and address (if needed). The second call using the same parameters will return the same connection.

For information on using callback functions for packet handling please see xbee_con(3)  

EXAMPLE

To create a local AT connection:
#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);
 

AUTHOR

Attie Grande <attie@attie.co.uk>  

SEE ALSO

libxbee(3), xbee_setup(3), xbee_getpacket(3), xbee_con(3), xbee_senddata(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 00:08:23 GMT, March 30, 2011