You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
3.4 KiB
142 lines
3.4 KiB
<HTML><HEAD><TITLE>Manpage of XBEE_SETUP</TITLE> |
|
</HEAD><BODY> |
|
<H1>XBEE_SETUP</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"> </A> |
|
<H2>NAME</H2> |
|
|
|
xbee_setup |
|
<A NAME="lbAC"> </A> |
|
<H2>SYNOPSIS</H2> |
|
|
|
<B>#include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>></B> |
|
|
|
<P> |
|
<B>int xbee_setup(char *</B><I>path</I><B>, int </B><I>baudrate</I><B>);</B> |
|
|
|
<P> |
|
<B>int xbee_setuplog(char *</B><I>path</I><B>, int </B><I>baudrate</I><B>, int </B><I>logfd</I><B>);</B> |
|
|
|
<P> |
|
<B>int xbee_setupAPI(char *</B><I>path</I><B>, char </B><I>cmdSeq</I><B>, int </B><I>cmdTime</I><B>);</B> |
|
|
|
<P> |
|
<B>int xbee_setuplogAPI(char *</B><I>path</I><B>, int </B><I>baudrate</I><B>, int </B><I>logfd</I><B>, char </B><I>cmdSeq</I><B>, int </B><I>cmdTime</I><B>);</B> |
|
|
|
|
|
<A NAME="lbAD"> </A> |
|
<H2>DESCRIPTION</H2> |
|
|
|
<P> |
|
<B>A VERSION OF THIS FUNCTION MUST BE CALLED BEFORE ANY OTHER libxbee FUNCTION!</B> |
|
|
|
The |
|
<B>xbee_setup</B>() |
|
|
|
function will setup libxbee so that it can handle an XBee. |
|
It takes 2 arguments. |
|
<P> |
|
The argument |
|
<I>path</I> |
|
|
|
is the path to the serial port that the XBee is connected to (e.g. /dev/ttyUSB0). |
|
<P> |
|
The |
|
<I>baudrate</I> |
|
|
|
is the baud rate that the local XBee is configured to run at. The following are avaliable: |
|
|
|
<PRE> |
|
<B>1200</B> |
|
<B>2400</B> |
|
<B>4800</B> |
|
<B>9600</B> |
|
<B>19200</B> |
|
<B>38400</B> |
|
<B>57600</B> |
|
<B>115200</B> - this is potentially unstable (read the XBee manual to find out why...) |
|
</PRE> |
|
|
|
|
|
<P> |
|
Using |
|
<B>xbee_setuplog</B>() |
|
|
|
is exactly the same, but instead you give an open file descriptor. All log messages will be written to this file (you can use stderr or stdout if you want!). |
|
<P> |
|
Using |
|
<B>xbee_setupAPI</B>() |
|
|
|
is exactly the same, but instead you provide the 'Command Sequence' character and the 'Guard Time' that your local XBee has been configured with. |
|
libxbee will then place your XBee in API mode 2, and when you call xbee_end() it will return your XBee to its previous API mode. |
|
<P> |
|
Using |
|
<B>xbee_setuplogAPI</B>() |
|
|
|
is simply a combination of |
|
<B>xbee_setuplog</B>() |
|
|
|
and |
|
<B>xbee_setupAPI</B>() |
|
|
|
<A NAME="lbAE"> </A> |
|
<H2>RETURN VALUE</H2> |
|
|
|
If any error occures, |
|
<B>-1</B> |
|
|
|
is returned. Otherwise |
|
<B>0</B> |
|
|
|
is returned. |
|
<A NAME="lbAF"> </A> |
|
<H2>EXAMPLE</H2> |
|
|
|
To setup libxbee to use /dev/ttyUSB0 at 57600 baud: |
|
|
|
<PRE> |
|
#include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>> |
|
if (xbee_setup("/dev/ttyUSB0",57600) == -1) { |
|
printf("Oh no...); |
|
<A HREF="../man1/exit.1.html">exit</A>(1); |
|
} |
|
</PRE> |
|
|
|
|
|
<A NAME="lbAG"> </A> |
|
<H2>AUTHOR</H2> |
|
|
|
Attie Grande <<A HREF="mailto:attie@attie.co.uk">attie@attie.co.uk</A>> |
|
<A NAME="lbAH"> </A> |
|
<H2>SEE ALSO</H2> |
|
|
|
<B><A HREF="../man3/libxbee.3.html">libxbee</A></B>(3), |
|
|
|
<B><A HREF="../man3/xbee_newcon.3.html">xbee_newcon</A></B>(3), |
|
|
|
<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</A></B>(3), |
|
|
|
<B><A HREF="../man3/xbee_senddata.3.html">xbee_senddata</A></B>(3) |
|
|
|
<P> |
|
|
|
<HR> |
|
<A NAME="index"> </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>
|
|
|