xbee_getpacket.3.html 3.23 KB
<HTML><HEAD><TITLE>Manpage of XBEE_GETPACKET</TITLE>
</HEAD><BODY>
<H1>XBEE_GETPACKET</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2009-11-01<BR><A HREF="#index">Index</A>
<A HREF="../index.html">Return to Main Contents</A><HR>

<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

xbee_getpacket
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;</B>

<P>
<B>xbee_pkt *xbee_getpacket(xbee_con *</B><I>con</I><B>);</B>

<P>
<B>xbee_pkt *xbee_getpacketwait(xbee_con *</B><I>con</I><B>);</B>


<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

The
<B>xbee_getpacket</B>()

function will return the next avaliable packet for the provided connection.
It takes 1 argument.
<P>
The argument
<I>con</I>

points to a connection made previously with
<B>xbee_newcon</B>().

<P>
The
<B>xbee_getpacketwait</B>()

function behaves the same, but will wait for an internally specified time for a packet to arrive (currently around 1 second).
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>

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
<B>free</B>()

it to prevent memory leaks.
<P>
If a packet was not avaliable for the provided connection, a
<B>NULL</B>

is returned.
<P>
If an error occured a
<B>NULL</B>

is also returned (though unlikely).
<P>
For more information on the structure of the packet, please see
<B><A HREF="../man3/xbee_pkt.3.html">xbee_pkt</A></B>(3)

<P>
For information on using callback functions with connections instead, please see
<B><A HREF="../man3/xbee_con.3.html">xbee_con</A></B>(3)

<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLE</H2>

To recieve a packet from a previously made connection:

<PRE>
#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
xbee_pkt *pkt;
if ((pkt = xbee_getpacket(con)) != NULL) {
  /* process packet... */
  free(pkt);
}
</PRE>


<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>

Attie Grande &lt;<A HREF="mailto:attie@attie.co.uk">attie@attie.co.uk</A>&gt; 
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>

<B><A HREF="../man3/libxbee.3.html">libxbee</A></B>(3),

<B><A HREF="../man3/xbee_setup.3.html">xbee_setup</A></B>(3),

<B><A HREF="../man3/xbee_newcon.3.html">xbee_newcon</A></B>(3),

<B><A HREF="../man3/xbee_senddata.3.html">xbee_senddata</A></B>(3),

<B><A HREF="../man3/xbee_pkt.3.html">xbee_pkt</A></B>(3),

<B><A HREF="../man3/xbee_con.3.html">xbee_con</A></B>(3),

<B><A HREF="../man3/xbee_hasDigital.3.html">xbee_hasDigital</A></B>(3),

<B><A HREF="../man3/xbee_getDigital.3.html">xbee_getDigital</A></B>(3),

<B><A HREF="../man3/xbee_hasAnalog.3.html">xbee_hasAnalog</A></B>(3),

<B><A HREF="../man3/xbee_getAnalog.3.html">xbee_getAnalog</A></B>(3)

<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT><A HREF="#lbAF">EXAMPLE</A><DD>
<DT><A HREF="#lbAG">AUTHOR</A><DD>
<DT><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:08:23 GMT, March 30, 2011
</BODY>
</HTML>