<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_hasdigital, xbee_getdigital
<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>int xbee_hasdigital(xbee_pkt *</B><I>pkt</I><B>, int </B><I>sample</I><B>, int </B><I>input</I><B>);</B>

<P>
<B>int xbee_getdigital(xbee_pkt *</B><I>pkt</I><B>, int </B><I>sample</I><B>, int </B><I>input</I><B>);</B>


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

The
<B>xbee_hasdigital</B>()

function will check the packet for the presence of a given sample on the specified input.
<P>
The
<B>xbee_getdigital</B>()

function will read the packet and return the sample value for the specified input.
<P>
They both take 3 arguments, with the same purposes.
<P>
The argument
<I>pkt</I>

points to a packet that was previously retrieved with 
<B>xbee_getpacket</B>()

<P>
The argument
<I>sample</I>

selects the sample within the packet to use.
<P>
The argument
<I>input</I>

specifies which input you are interested in testing.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>

The
<B>xbee_hasdigital</B>()

function will return
<B>1</B>

if the provided packet has sample data for the specified input, otherwise
<B>0</B>.

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

function will return
<B>1</B>

if the provided packet has sample data for the specified input and the sample was HIGH.
A
<B>0</B>

will be returned if the sample was LOW, or the packet does not contain sample data.
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLE</H2>

To read sample data from 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) {
  if (xbee_hasdigital(pkt,0,0)) {
    printf(&quot;D0 read %d,xbee_getdigital(pkt,0));
  } else {
    printf(&quot;No D0 data);
  }
  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_pkt.3.html">xbee_pkt</A></B>(3),

<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</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>