XBEE_GETPACKET

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

NAME

xbee_getpacket  

SYNOPSIS

#include <xbee.h>

xbee_pkt *xbee_getpacket(xbee_con *con);

xbee_pkt *xbee_getpacketwait(xbee_con *con);  

DESCRIPTION

The xbee_getpacket() function will return the next available packet for the provided connection. It takes 1 argument.

The argument con points to a connection made previously with xbee_newcon().

The xbee_getpacketwait() function behaves the same, but will wait for an internally specified time for a packet to arrive (currently around 1 second).  

RETURN VALUE

Upon successful return, this function returns the packet, having unlinked it from the internal list of packets. You must keep hold of the packet until you are finished with it, and then you must free() it to prevent memory leaks.

If a packet was not available for the provided connection, a NULL is returned.

If an error occured a NULL is also returned (though unlikely).

For more information on the structure of the packet, please see xbee_pkt(3)

For information on using callback functions with connections instead, please see xbee_con(3)  

EXAMPLE

To receive a packet from a previously made connection:
#include <xbee.h>
xbee_pkt *pkt;
if ((pkt = xbee_getpacket(con)) != NULL) {
  /* process packet... */
  free(pkt);
}
 

AUTHOR

Attie Grande <attie@attie.co.uk>  

SEE ALSO

libxbee(3), xbee_setup(3), xbee_newcon(3), xbee_senddata(3), xbee_pkt(3), xbee_con(3), xbee_hasDigital(3), xbee_getDigital(3), xbee_hasAnalog(3), xbee_getAnalog(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