Commit 2374891c authored by Don Gagne's avatar Don Gagne

Remove XBee support

Even though it hasn't been supported forever, the files where still
being compiled
parent d7f2c8f5
......@@ -65,103 +65,6 @@ DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
}
#
# [OPTIONAL] XBee wireless support. This is not necessary for basic serial/UART communications.
# It's only required for speaking directly to the Xbee using their proprietary API.
# Unsupported on Mac.
# Installation on Windows is unnecessary, as we just link to our included .dlls directly.
# Installing on Linux involves running `make;sudo make install` in `libs/thirdParty/libxbee`
# Uninstalling from Linux can be done with `sudo make uninstall`.
#
XBEE_DEPENDENT_HEADERS += \
src/comm/XbeeLinkInterface.h \
src/comm/XbeeLink.h \
src/comm/HexSpinBox.h \
src/ui/XbeeConfigurationWindow.h \
src/comm/CallConv.h
XBEE_DEPENDENT_SOURCES += \
src/comm/XbeeLink.cpp \
src/comm/HexSpinBox.cpp \
src/ui/XbeeConfigurationWindow.cpp
XBEE_DEFINES = QGC_XBEE_ENABLED
contains(DEFINES, DISABLE_XBEE) {
message("Skipping support for native XBee API (manual override from command line)")
DEFINES -= DISABLE_XBEE
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_XBEE) {
message("Skipping support for native XBee API (manual override from user_config.pri)")
} else:LinuxBuild {
linux-g++-64 {
message("Skipping support for XBee API (64-bit Linux builds not supported)")
} else:exists(/usr/include/xbee.h) {
message("Including support for XBee API")
HEADERS += $$XBEE_DEPENDENT_HEADERS
SOURCES += $$XBEE_DEPENDENT_SOURCES
DEFINES += $$XBEE_DEFINES
LIBS += -L/usr/lib -lxbee
} else {
warning("Skipping support for XBee API (missing libraries, see README)")
}
} else:WindowsBuild {
message("Including support for XBee API")
HEADERS += $$XBEE_DEPENDENT_HEADERS
SOURCES += $$XBEE_DEPENDENT_SOURCES
DEFINES += $$XBEE_DEFINES
INCLUDEPATH += libs/thirdParty/libxbee
LIBS += -l$$BASEDIR/libs/thirdParty/libxbee/lib/libxbee
} else {
message("Skipping support for XBee API (unsupported platform)")
}
#
# [OPTIONAL] Opal RT-LAB Library. Provides integration with Opal-RT's RT-LAB simulator.
#
contains(DEFINES, DISABLE_RTLAB) {
message("Skipping support for RT-LAB (manual override from command line)")
DEFINES -= DISABLE_RTLAB
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_RTLAB) {
message("Skipping support for RT-LAB (manual override from user_config.pri)")
} else:WindowsBuild {
exists(src/lib/opalrt/OpalApi.h) : exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) {
message("Including support for RT-LAB")
DEFINES += QGC_RTLAB_ENABLED
INCLUDEPATH +=
src/lib/opalrt
libs/lib/opal/include \
FORMS += src/ui/OpalLinkSettings.ui
HEADERS += \
src/comm/OpalRT.h \
src/comm/OpalLink.h \
src/comm/Parameter.h \
src/comm/QGCParamID.h \
src/comm/ParameterList.h \
src/ui/OpalLinkConfigurationWindow.h
SOURCES += \
src/comm/OpalRT.cc \
src/comm/OpalLink.cc \
src/comm/Parameter.cc \
src/comm/QGCParamID.cc \
src/comm/ParameterList.cc \
src/ui/OpalLinkConfigurationWindow.cc
LIBS += \
-LC:/OPAL-RT/RT-LAB7.2.4/Common/bin \
-lOpalApi
} else {
warning("Skipping support for RT-LAB (missing libraries, see README)")
}
} else {
message("Skipping support for RT-LAB (unsupported platform)")
}
#
# [REQUIRED] SDL dependency. Provides joystick/gamepad support.
# The SDL is packaged with QGC for the Mac and Windows. Linux support requires installing the SDL
......
This diff is collapsed.
Welcome to libxbee!
I have proveded sample code in the ./sample directory. Hopefully this will help
get you up and running with libxbee. If you would like samples showing a different
aspect of libxbee, then please do not hesitate to file an 'issue' on the project
site, and I will get to it ASAP:
http://code.google.com/p/libxbee/issues/list
Documentation is avaliable via the man page system once you have installed the
library, or as HTML in the 'doc' directory.
$ man libxbee
Please note that this project is still in development, so should not be used for
any purpose other than learning/playing/testing etc... Basically don't use it to
make money, and then hold me responsible if it breaks!
Feel free to contact me directly with any queries:
attie@attie.co.uk
For those of you that are planning to use this on an embedded board, I have
included a small makefile (umakefile) that has only the information needed to
compile the library. I suggest you use this instead!
=== Installation ===
To install simply type:
$ make install
For more information, or if you can't install it, please see the wiki:
http://code.google.com/p/libxbee/wiki/install_libxbee
=== Usage ===
If you are compiling the object file directly into your executable instead
of making use of the shared library, you must include the following link
flags:
-lpthread -lrt
This diff is collapsed.
/*
libxbee - a C library to aid the use of Digi's Series 1 XBee modules
running in API mode (AP=2).
Copyright (C) 2009 Attie Grande (attie@attie.co.uk)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#ifdef __GNUC__ /* ---- */
#include <unistd.h>
#include <termios.h>
#define __USE_GNU
#include <pthread.h>
#undef __USE_GNU
#include <sys/time.h>
#else /* -------------- */
#include <Windows.h>
#include <io.h>
#include <time.h>
#include <sys/timeb.h>
#endif /* ------------- */
#ifdef __UMAKEFILE
#define HOST_OS "Embedded"
#elif defined(__GNUC__)
#define HOST_OS "Linux"
#elif defined(_WIN32)
#define HOST_OS "Win32"
#else
#define HOST_OS "UNKNOWN"
#endif
#define TRUE 1
#define FALSE 0
#define M8(x) (x & 0xFF)
/* various connection types */
#define XBEE_LOCAL_AT 0x88
#define XBEE_LOCAL_ATREQ 0x08
#define XBEE_LOCAL_ATQUE 0x09
#define XBEE_REMOTE_AT 0x97
#define XBEE_REMOTE_ATREQ 0x17
#define XBEE_MODEM_STATUS 0x8A
/* XBee Series 1 stuff */
#define XBEE_TX_STATUS 0x89
#define XBEE_64BIT_DATATX 0x00
#define XBEE_64BIT_DATARX 0x80
#define XBEE_16BIT_DATATX 0x01
#define XBEE_16BIT_DATARX 0x81
#define XBEE_64BIT_IO 0x82
#define XBEE_16BIT_IO 0x83
/* XBee Series 2 stuff */
#define XBEE2_DATATX 0x10
#define XBEE2_DATARX 0x90
#define XBEE2_TX_STATUS 0x8B
typedef struct xbee_hnd* xbee_hnd;
#define __LIBXBEE_API_H
#include "xbee.h"
typedef struct t_threadList t_threadList;
struct t_threadList {
xbee_thread_t thread;
t_threadList *next;
};
struct xbee_hnd {
xbee_file_t tty;
#ifdef __GNUC__ /* ---- */
int ttyfd;
#else /* -------------- */
int ttyr;
int ttyw;
int ttyeof;
OVERLAPPED ttyovrw;
OVERLAPPED ttyovrr;
OVERLAPPED ttyovrs;
#endif /* ------------- */
char *path; /* serial port path */
xbee_mutex_t logmutex;
FILE *log;
int logfd;
xbee_mutex_t conmutex;
xbee_con *conlist;
xbee_mutex_t pktmutex;
xbee_pkt *pktlist;
xbee_pkt *pktlast;
int pktcount;
xbee_mutex_t sendmutex;
xbee_thread_t listent;
xbee_thread_t threadt;
xbee_mutex_t threadmutex;
xbee_sem_t threadsem;
t_threadList *threadList;
int run;
int oldAPI;
char cmdSeq;
int cmdTime;
/* ready flag.
needs to be set to -1 so that the listen thread can begin. */
volatile int xbee_ready;
xbee_hnd next;
};
xbee_hnd default_xbee = NULL;
xbee_mutex_t xbee_hnd_mutex;
typedef struct t_data t_data;
struct t_data {
unsigned char data[128];
unsigned int length;
};
typedef struct t_LTinfo t_LTinfo;
struct t_LTinfo {
int i;
xbee_hnd xbee;
};
typedef struct t_CBinfo t_CBinfo;
struct t_CBinfo {
xbee_hnd xbee;
xbee_con *con;
};
typedef struct t_callback_list t_callback_list;
struct t_callback_list {
xbee_pkt *pkt;
t_callback_list *next;
};
static void *Xmalloc2(xbee_hnd xbee, size_t size);
static void *Xcalloc2(xbee_hnd xbee, size_t size);
static void *Xrealloc2(xbee_hnd xbee, void *ptr, size_t size);
static void Xfree2(void **ptr);
#define Xmalloc(x) Xmalloc2(xbee,(x))
#define Xcalloc(x) Xcalloc2(xbee,(x))
#define Xrealloc(x,y) Xrealloc2(xbee,(x),(y))
#define Xfree(x) Xfree2((void **)&x)
/* usage:
xbee_logSf() lock the log
xbee_logEf() unlock the log
xbee_log() lock print with \n unlock # to print a single line
xbee_logc() lock print with no \n # to print a single line with a custom ending
xbee_logcf() print \n unlock # to end a custom-ended single line
xbee_logS() lock print with \n # to start a continuous block
xbee_logI() print with \n # to continue a continuous block
xbee_logIc() print with no \n # to continue a continuous block with a custom ending
xbee_logIcf() print \n # to continue a continuous block with ended custom-ended line
xbee_logE() print with \n unlock # to end a continuous block
*/
static void xbee_logf(xbee_hnd xbee, const char *logformat, const char *file,
const int line, const char *function, char *format, ...);
#define LOG_FORMAT "[%s:%d] %s(): %s"
#define xbee_logSf() if (xbee->log) { xbee_mutex_lock(xbee->logmutex); }
#define xbee_logEf() if (xbee->log) { xbee_mutex_unlock(xbee->logmutex); }
#define xbee_log(...) if (xbee->log) { xbee_logSf(); xbee_logf(xbee,LOG_FORMAT"\n",__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); xbee_logEf(); }
#define xbee_logc(...) if (xbee->log) { xbee_logSf(); xbee_logf(xbee,LOG_FORMAT ,__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); }
#define xbee_logcf() if (xbee->log) { fprintf(xbee->log, "\n"); xbee_logEf(); }
#define xbee_logS(...) if (xbee->log) { xbee_logSf(); xbee_logf(xbee,LOG_FORMAT"\n",__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); }
#define xbee_logI(...) if (xbee->log) { xbee_logf(xbee,LOG_FORMAT"\n",__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); }
#define xbee_logIc(...) if (xbee->log) { xbee_logf(xbee,LOG_FORMAT ,__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); }
#define xbee_logIcf() if (xbee->log) { fprintf(xbee->log, "\n"); }
#define xbee_logE(...) if (xbee->log) { xbee_logf(xbee,LOG_FORMAT"\n",__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__); xbee_logEf(); }
#define xbee_perror(str) \
if (xbee->log) xbee_logI("%s:%s",str,strerror(errno)); \
perror(str);
static int xbee_startAPI(xbee_hnd xbee);
static int xbee_sendAT(xbee_hnd xbee, char *command, char *retBuf, int retBuflen);
static int xbee_sendATdelay(xbee_hnd xbee, int guardTime, char *command, char *retBuf, int retBuflen);
static int xbee_parse_io(xbee_hnd xbee, xbee_pkt *p, unsigned char *d,
int maskOffset, int sampleOffset, int sample);
static void xbee_thread_watch(xbee_hnd xbee);
static void xbee_listen_wrapper(xbee_hnd xbee);
static int xbee_listen(xbee_hnd xbee);
static unsigned char xbee_getbyte(xbee_hnd xbee);
static unsigned char xbee_getrawbyte(xbee_hnd xbee);
static int xbee_matchpktcon(xbee_hnd xbee, xbee_pkt *pkt, xbee_con *con);
static t_data *xbee_make_pkt(xbee_hnd xbee, unsigned char *data, int len);
static int _xbee_send_pkt(xbee_hnd xbee, t_data *pkt, xbee_con *con);
static void xbee_callbackWrapper(t_CBinfo *info);
/* these functions can be found in the xsys files */
static int init_serial(xbee_hnd xbee, int baudrate);
static int xbee_select(xbee_hnd xbee, struct timeval *timeout);
#ifdef __GNUC__ /* ---- */
#include "xsys/linux.c"
#else /* -------------- */
#include "xsys\win32.c"
#endif /* ------------- */
#ifndef Win32Message
#define Win32Message()
#endif
#define ISREADY(a) if (!xbee || !xbee->xbee_ready) { \
if (stderr) fprintf(stderr,"libxbee: Run xbee_setup() first!...\n"); \
Win32Message(); \
a; \
}
#define ISREADYP() ISREADY(return)
#define ISREADYR(a) ISREADY(return a)
<HTML><HEAD><TITLE>Manpage of LIBXBEE</TITLE>
</HEAD><BODY>
<H1>LIBXBEE</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>
libxbee
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
libxbee is a C library to aid the use of Series 1 Digi XBee radios running in API mode (AP=2).
<P>
I have tried to keep flexibility to a maximum.
By allowing connections to individual nodes to be created you don't have to address each packet,
or filter through incomming packets to get at the one you are after. This is all taken care of
for you by
<B>libxbee!</B>
<P>
libxbee is still in development, so if you find any bugs or have any enhancement requests, please
feel free to submit an issue on the project page:
<PRE>
<A HREF="http://code.google.com/p/libxbee/">http://code.google.com/p/libxbee/</A>
</PRE>
or contact me (Attie) directly:
<PRE>
<A HREF="mailto:attie@attie.co.uk">attie@attie.co.uk</A>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>MAN PAGES</H2>
Documentation is avaliable via the following man pages, or by example in the 'sample' folder in the SVN repository
<P>
<B><A HREF="../man3/xbee_pkt.3.html">xbee_pkt</A></B>(3) - libxbee's packet structure
<B><A HREF="../man3/xbee_con.3.html">xbee_con</A></B>(3) - libxbee's connection structure
<P>
<B><A HREF="../man3/xbee_setup.3.html">xbee_setup</A></B>(3) - function to setup libxbee (and its variants)
<B><A HREF="../man3/xbee_end.3.html">xbee_end</A></B>(3) - function to end the libxbee session and close any open handles
<P>
<B><A HREF="../man3/xbee_logit.3.html">xbee_logit</A></B>(3) - function that allows the user to add to the xbee log output
<P>
<B><A HREF="../man3/xbee_newcon.3.html">xbee_newcon</A></B>(3) - function to create a new connection
<B><A HREF="../man3/xbee_flushcon.3.html">xbee_flushcon</A></B>(3) - function to flush packets from a connection
<B><A HREF="../man3/xbee_endcon.3.html">xbee_endcon</A></B>(3) - function to end a connection
<P>
<B><A HREF="../man3/xbee_senddata.3.html">xbee_senddata</A></B>(3) - function to send data to a remote XBee (and its variants)
<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</A></B>(3) - function to get a packet from a connection (and its variants)
<P>
<B><A HREF="../man3/xbee_hasdigital.3.html">xbee_hasdigital</A></B>(3) - function to check if digital sample is in the packet
<B><A HREF="../man3/xbee_getdigital.3.html">xbee_getdigital</A></B>(3) - function to get digital sample from the packet
<P>
<B><A HREF="../man3/xbee_hasanalog.3.html">xbee_hasanalog</A></B>(3) - function to check if analog sample is in the packet
<B><A HREF="../man3/xbee_getanalog.3.html">xbee_getanalog</A></B>(3) - function to get the analog sample from the packet
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<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_setup.3.html">xbee_setup</A></B>(3),
<B><A HREF="../man3/xbee_end.3.html">xbee_end</A></B>(3),
<B><A HREF="../man3/xbee_logit.3.html">xbee_logit</A></B>(3),
<B><A HREF="../man3/xbee_newcon.3.html">xbee_newcon</A></B>(3),
<B><A HREF="../man3/xbee_flushcon.3.html">xbee_flushcon</A></B>(3),
<B><A HREF="../man3/xbee_endcon.3.html">xbee_endcon</A></B>(3),
<B><A HREF="../man3/xbee_senddata.3.html">xbee_senddata</A></B>(3),
<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</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">DESCRIPTION</A><DD>
<DT><A HREF="#lbAD">MAN PAGES</A><DD>
<DT><A HREF="#lbAE">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>
<HTML><HEAD><TITLE>Manpage of LIBXBEE</TITLE>
</HEAD><BODY>
<H1>LIBXBEE</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>
libxbee
<P>
This page has not been written yet...
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</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>
<HTML><HEAD><TITLE>Manpage of LIBXBEE</TITLE>
</HEAD><BODY>
<H1>LIBXBEE</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>
libxbee
<P>
This page has not been written yet...
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</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>
<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
<BODY>
<H1>Invalid Manpage</H1>
The requested file ./man/man3/xbee_endcon.3 is not a valid (unformatted) man page.</BODY></HTML>
<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
<BODY>
<H1>Invalid Manpage</H1>
The requested file ./man/man3/xbee_flushcon.3 is not a valid (unformatted) man page.</BODY></HTML>
<
<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_hasanalog, xbee_getanalog
<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_hasanalog(xbee_pkt *</B><I>pkt</I><B>,int </B><I>sample</I><B>, int </B><I>input</I><B>);</B>
<P>
<B>double xbee_getanalog(xbee_pkt *</B><I>pkt</I><B>,int </B><I>sample</I><B>, int </B><I>input</I><B>, double </B><I>Vref</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>xbee_hasanalog</B>()
function will check the packet for the presence of an analog sample on the specified input.
<P>
The
<B>xbee_getanalog</B>()
function will read the packet and return the sample value for the specified analog 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.
<P>
<B>xbee_getanalog</B>()
also takes a fourth argument that allows you to provide a
<I>Vref</I>
value. This allows the function to convert the raw ADC value into a voltage for you.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The
<B>xbee_hasanalog</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_getanalog</B>()
function will return the raw ADC value (0 - 1023) if the provided packet has sample data for the specified input and Vref was given as zero.
If Vref was non-zero, then the return value will be the voltage read.
A
<B>-1</B>
will be returned if 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;
double Vref = 3.3;
if ((pkt = xbee_getpacket(con)) != NULL) {
if (xbee_hasanalog(pkt,0,0)) {
printf(&quot;A0 read %fv,xbee_getanalog(pkt,0,0,Vref));
} else {
printf(&quot;No A0 data);
}