<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"> </A> <H2>NAME</H2> xbee_newcon <A NAME="lbAC"> </A> <H2>SYNOPSIS</H2> <B>#include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>></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"> </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"> </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"> </A> <H2>EXAMPLE</H2> To create a local AT connection: <PRE> #include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>> xbee_con *con; con = xbee_newcon('A', xbee_localAT); </PRE> <P> To create a 16-bit Data connection: <PRE> #include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>> xbee_con *con; con = xbee_newcon('A', xbee_16bitData, 0x1234); </PRE> <P> To create a 64-bit Data connection: <PRE> #include <<A HREF="file:/usr/include/xbee.h">xbee.h</A>> xbee_con *con; con = xbee_newcon('A', xbee_64bitData, 0x0013A200, 0x40081826); </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_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"> </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>