xbee_newcon.3.html 4.81 KB
Newer Older
Franz's avatar
Franz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
<HTML><HEAD><TITLE>Manpage of XBEE_NEWCON</TITLE>
</HEAD><BODY>
<H1>XBEE_NEWCON</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_newcon
<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_con *xbee_newcon(unsigned char </B><I>frameID</I><B>, xbee_types </B><I>type</I><B>, ...);</B>

<P>
<B>void xbee_flushcon(xbee_con *</B><I>con</I><B>);</B>

<P>
<B>void xbee_endcon(xbee_con *</B><I>con</I><B>);</B>


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

The
<B>xbee_newcon</B>()

function will setup a new connection with the specified settings.
It takes at least 2 arguments, and possibly up to 4 depending on the
<I>type.</I>

<P>
<B>NOTE:</B>

Packets will only be collected when they match an active connection.
You must setup a connection in order to recieve packets.
<P>
The argument
<I>frameID</I>

allows similar functionality to that of TCP/IP port numbers. This is 1 character (or 8-bit integer) that
identifies where the data is coming from or going to.

The
<I>type</I>

specifies the type of connection you would like. The following types are avaliable:
<DL COMPACT>
<DT><B>xbee_localAT</B>

<DD>
communicates AT commands with the local XBee
<DT><B>xbee_txStatus</B>

<DD>
recieves transmit status information from the local XBee
<DT><B>xbee_modemStatus</B>

<DD>
recieves modem status information from the local XBee
<DT><B>xbee_16bitRemoteAT</B>

<DD>
communicates AT commands with a remote node (using 16-bit addressing)
<DT><B>xbee_64bitRemoteAT</B>

<DD>
communicates AT commands with a remote node (using 64-bit addressing)
<DT><B>xbee_16bitData</B>

<DD>
sends/recieves data through a remote node (using 16-bit addressing)
<DT><B>xbee_64bitData</B>

<DD>
sends/recieves data through a remote node (using 64-bit addressing)
<DT><B>xbee_16bitIO</B>

<DD>
sends/recieves I/O data through a remote node (using 16-bit addressing)
<DT><B>xbee_64bitIO</B>

<DD>
sends/recieves I/O data through a remote node (using 64-bit addressing)
</DL>
<P>

If you are using
<B>xbee_localAT</B>, <B>xbee_txStatus</B> or <B>xbee_modemStatus</B>

then only the
<I>frameID</I>

and
<I>type</I>

arguments are required.
<P>
If you are using any 16-bit connection, you must also specify 1 right aligned integer,
containing the 16-bit address (e.g. 0x1234).
<P>
If you are using any 64-bit connection, you must also specify 2 integers containing the
64-bit address, first the high 32-bits, then the low 32-bits.
<P>
The
<B>xbee_flushcon</B>()

function is very basic. It removes any packets that have been collected in the buffer for the specified connection.
<P>
The
<B>xbee_endcon</B>()

function is used to end a connection. This will stop collecting packets for the given connection, and remove any packets from the buffer.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>

A pointer to the connection is returned. A connection can only be made once, using the same
<I>type</I>

,
<I>frameID</I>

and address (if needed). The second call using the same parameters will return the same
connection.
<P>
For information on using callback functions for packet handling please see
<B><A HREF="../man3/xbee_con.3.html">xbee_con</A></B>(3)

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

To create a local AT connection:

<PRE>
#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
xbee_con *con;
con = xbee_newcon('A', xbee_localAT);
</PRE>


<P>
To create a 16-bit Data connection:

<PRE>
#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
xbee_con *con;
con = xbee_newcon('A', xbee_16bitData, 0x1234);
</PRE>


<P>
To create a 64-bit Data connection:

<PRE>
#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
xbee_con *con;
con = xbee_newcon('A', xbee_64bitData, 0x0013A200, 0x40081826);
</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_getpacket.3.html">xbee_getpacket</A></B>(3),

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

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