diff --git a/thirdParty/libxbee/LICENSE b/thirdParty/libxbee/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2
--- /dev/null
+++ b/thirdParty/libxbee/LICENSE
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/thirdParty/libxbee/README b/thirdParty/libxbee/README
new file mode 100644
index 0000000000000000000000000000000000000000..a5dbbfe0f3bd6fc9a433c4532221a140e283b4d4
--- /dev/null
+++ b/thirdParty/libxbee/README
@@ -0,0 +1,39 @@
+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
diff --git a/thirdParty/libxbee/api.c b/thirdParty/libxbee/api.c
new file mode 100644
index 0000000000000000000000000000000000000000..ef5923b56848f5c345c2712c7430919c40d676ba
--- /dev/null
+++ b/thirdParty/libxbee/api.c
@@ -0,0 +1,2433 @@
+/*
+  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/>.
+*/
+const char *SVN_REV = "$Id: api.c 508 2011-06-12 23:22:34Z attie@attie.co.uk $";
+char svn_rev[128] = "\0";
+
+#include "api.h"
+
+const char *xbee_svn_version(void) {
+  if (svn_rev[0] == '\0') {
+    char *t;
+    sprintf(svn_rev,"r%s",&SVN_REV[11]);
+    t = strrchr(svn_rev,' ');
+    if (t) {
+      t[0] = '\0';
+    }
+  }
+  return svn_rev;
+}
+
+const char *xbee_build_info(void) {
+  return "Built on " __DATE__ " @ " __TIME__ " for " HOST_OS;
+}
+
+/* ################################################################# */
+/* ### Memory Handling ############################################# */
+/* ################################################################# */
+
+/* malloc wrapper function */
+static void *Xmalloc2(xbee_hnd xbee, size_t size) {
+  void *t;
+  t = malloc(size);
+  if (!t) {
+    /* uhoh... thats pretty bad... */
+    xbee_perror("libxbee:malloc()");
+    exit(1);
+  }
+  return t;
+}
+
+/* calloc wrapper function */
+static void *Xcalloc2(xbee_hnd xbee, size_t size) {
+  void *t;
+  t = calloc(1, size);
+  if (!t) {
+    /* uhoh... thats pretty bad... */
+    xbee_perror("libxbee:calloc()");
+    exit(1);
+  }
+  return t;
+}
+
+/* realloc wrapper function */
+static void *Xrealloc2(xbee_hnd xbee, void *ptr, size_t size) {
+  void *t;
+  t = realloc(ptr,size);
+  if (!t) {
+    /* uhoh... thats pretty bad... */
+    fprintf(stderr,"libxbee:realloc(): Returned NULL\n");
+    exit(1);
+  }
+  return t;
+}
+
+/* free wrapper function (uses the Xfree macro and sets the pointer to NULL after freeing it) */
+static void Xfree2(void **ptr) {
+  if (!*ptr) return;
+  free(*ptr);
+  *ptr = NULL;
+}
+
+/* ################################################################# */
+/* ### Helper Functions ############################################ */
+/* ################################################################# */
+
+/* #################################################################
+   returns 1 if the packet has data for the digital input else 0 */
+int xbee_hasdigital(xbee_pkt *pkt, int sample, int input) {
+  int mask = 0x0001;
+  if (input < 0 || input > 7) return 0;
+  if (sample >= pkt->samples) return 0;
+
+  mask <<= input;
+  return !!(pkt->IOdata[sample].IOmask & mask);
+}
+
+/* #################################################################
+   returns 1 if the digital input is high else 0 (or 0 if no digital data present) */
+int xbee_getdigital(xbee_pkt *pkt, int sample, int input) {
+  int mask = 0x0001;
+  if (!xbee_hasdigital(pkt,sample,input)) return 0;
+
+  mask <<= input;
+  return !!(pkt->IOdata[sample].IOdigital & mask);
+}
+
+/* #################################################################
+   returns 1 if the packet has data for the analog input else 0 */
+int xbee_hasanalog(xbee_pkt *pkt, int sample, int input) {
+  int mask = 0x0200;
+  if (input < 0 || input > 5) return 0;
+  if (sample >= pkt->samples) return 0;
+
+  mask <<= input;
+  return !!(pkt->IOdata[sample].IOmask & mask);
+}
+
+/* #################################################################
+   returns analog input as a voltage if vRef is non-zero, else raw value (or 0 if no analog data present) */
+double xbee_getanalog(xbee_pkt *pkt, int sample, int input, double Vref) {
+  if (!xbee_hasanalog(pkt,sample,input)) return 0;
+
+  if (Vref) return (Vref / 1023) * pkt->IOdata[sample].IOanalog[input];
+  return pkt->IOdata[sample].IOanalog[input];
+}
+
+/* ################################################################# */
+/* ### XBee Functions ############################################## */
+/* ################################################################# */
+
+static void xbee_logf(xbee_hnd xbee, const char *logformat, const char *file,
+                      const int line, const char *function, char *format, ...) {
+  char buf[128];
+  va_list ap;
+  if (!xbee) return;
+  if (!xbee->log) return;
+  va_start(ap,format);
+  vsnprintf(buf,127,format,ap);
+  va_end(ap);
+  fprintf(xbee->log,logformat,file,line,function,buf);
+}
+void xbee_logitf(char *format, ...) {
+  char buf[128];
+  va_list ap;
+  va_start(ap,format);
+  vsnprintf(buf,127,format,ap);
+  va_end(ap);
+  xbee_logit(buf);
+}
+void _xbee_logitf(xbee_hnd xbee, char *format, ...) {
+  char buf[128];
+  va_list ap;
+  va_start(ap,format);
+  vsnprintf(buf,127,format,ap);
+  va_end(ap);
+  _xbee_logit(xbee, buf);
+}
+void xbee_logit(char *str) {
+  _xbee_logit(default_xbee, str);
+}
+void _xbee_logit(xbee_hnd xbee, char *str) {
+  if (!xbee) return;
+  if (!xbee->log) return;
+  xbee_mutex_lock(xbee->logmutex);
+  fprintf(xbee->log,LOG_FORMAT"\n",__FILE__,__LINE__,__FUNCTION__,str);
+  xbee_mutex_unlock(xbee->logmutex);
+}
+
+/* #################################################################
+   xbee_sendAT - INTERNAL
+   allows for an at command to be send, and the reply to be captured */
+static int xbee_sendAT(xbee_hnd xbee, char *command, char *retBuf, int retBuflen) {
+  return xbee_sendATdelay(xbee, 0, command, retBuf, retBuflen);
+}
+static int xbee_sendATdelay(xbee_hnd xbee, int guardTime, char *command, char *retBuf, int retBuflen) {
+  struct timeval to;
+
+  int ret;
+  int bufi = 0;
+
+  /* if there is a guardTime given, then use it and a bit more */
+  if (guardTime) usleep(guardTime * 1200);
+
+  /* get rid of any pre-command sludge... */
+  memset(&to, 0, sizeof(to));
+  ret = xbee_select(xbee,&to);
+  if (ret > 0) {
+    char t[128];
+    while (xbee_read(xbee,t,127));
+  }
+
+  /* send the requested command */
+  xbee_log("sendATdelay: Sending '%s'", command);
+  xbee_write(xbee,command, strlen(command));
+
+  /* if there is a guardTime, then use it */
+  if (guardTime) {
+    usleep(guardTime * 900);
+
+    /* get rid of any post-command sludge... */
+    memset(&to, 0, sizeof(to));
+    ret = xbee_select(xbee,&to);
+    if (ret > 0) {
+      char t[128];
+      while (xbee_read(xbee,t,127));
+    }
+  }
+
+  /* retrieve the data */
+  memset(retBuf, 0, retBuflen);
+  memset(&to, 0, sizeof(to));
+  if (guardTime) {
+    /* select on the xbee fd... wait at most 0.2 the guardTime for the response */
+    to.tv_usec = guardTime * 200;
+  } else {
+    /* or 250ms */
+    to.tv_usec = 250000;
+  }
+  if ((ret = xbee_select(xbee,&to)) == -1) {
+    xbee_perror("libxbee:xbee_sendATdelay()");
+    exit(1);
+  }
+
+  if (!ret) {
+    /* timed out, and there is nothing to be read */
+    xbee_log("sendATdelay: No Data to read - Timeout...");
+    return 1;
+  }
+
+  /* check for any dribble... */
+  do {
+    /* if there is actually no space in the retBuf then break out */
+    if (bufi >= retBuflen - 1) {
+      break;
+    }
+
+    /* read as much data as is possible into retBuf */
+    if ((ret = xbee_read(xbee,&retBuf[bufi], retBuflen - bufi - 1)) == 0) {
+      break;
+    }
+
+    /* advance the 'end of string' pointer */
+    bufi += ret;
+
+    /* wait at most 150ms for any more data */
+    memset(&to, 0, sizeof(to));
+    to.tv_usec = 150000;
+    if ((ret = xbee_select(xbee,&to)) == -1) {
+      xbee_perror("libxbee:xbee_sendATdelay()");
+      exit(1);
+    }
+
+    /* loop while data was read */
+  } while (ret);
+
+  if (!bufi) {
+    xbee_log("sendATdelay: No response...");
+    return 1;
+  }
+
+  /* terminate the string */
+  retBuf[bufi] = '\0';
+
+  xbee_log("sendATdelay: Recieved '%s'",retBuf);
+  return 0;
+}
+
+
+/* #################################################################
+   xbee_start
+   sets up the correct API mode for the xbee
+   cmdSeq  = CC
+   cmdTime = GT */
+static int xbee_startAPI(xbee_hnd xbee) {
+  char buf[256];
+
+  if (xbee->cmdSeq == 0 || xbee->cmdTime == 0) return 1;
+
+  /* setup the command sequence string */
+  memset(buf,xbee->cmdSeq,3);
+  buf[3] = '\0';
+
+  /* try the command sequence */
+  if (xbee_sendATdelay(xbee, xbee->cmdTime, buf, buf, sizeof(buf))) {
+    /* if it failed... try just entering 'AT' which should return OK */
+    if (xbee_sendAT(xbee, "AT\r", buf, 4) || strncmp(buf,"OK\r",3)) return 1;
+  } else if (strncmp(&buf[strlen(buf)-3],"OK\r",3)) {
+    /* if data was returned, but it wasn't OK... then something went wrong! */
+    return 1;
+  }
+
+  /* get the current API mode */
+  if (xbee_sendAT(xbee, "ATAP\r", buf, 3)) return 1;
+  buf[1] = '\0';
+  xbee->oldAPI = atoi(buf);
+
+  if (xbee->oldAPI != 2) {
+    /* if it wasnt set to mode 2 already, then set it to mode 2 */
+    if (xbee_sendAT(xbee, "ATAP2\r", buf, 4) || strncmp(buf,"OK\r",3)) return 1;
+  }
+
+  /* quit from command mode, ready for some packets! :) */
+  if (xbee_sendAT(xbee, "ATCN\r", buf, 4) || strncmp(buf,"OK\r",3)) return 1;
+
+  return 0;
+}
+
+/* #################################################################
+   xbee_end
+   resets the API mode to the saved value - you must have called xbee_setup[log]API */
+int xbee_end(void) {
+  return _xbee_end(default_xbee);
+}
+int _xbee_end(xbee_hnd xbee) {
+  int ret = 1;
+  xbee_con *con, *ncon;
+  xbee_pkt *pkt, *npkt;
+  xbee_hnd xbeet;
+
+  ISREADYR(0);
+  xbee_log("Stopping libxbee instance...");
+
+  /* unlink the instance from list... */
+  xbee_log("Unlinking instance from list...");
+  xbee_mutex_lock(xbee_hnd_mutex);
+  if (xbee == default_xbee) {
+    default_xbee = default_xbee->next;
+    if (!default_xbee) {
+      xbee_mutex_destroy(xbee_hnd_mutex);
+    }
+  } else {
+    xbeet = default_xbee;
+    while (xbeet) {
+      if (xbeet->next == xbee) {
+        xbeet->next = xbee->next;
+        break;
+      }
+      xbeet = xbeet->next;
+    }
+  }
+  if (default_xbee) xbee_mutex_unlock(xbee_hnd_mutex);
+  
+  /* if the api mode was not 2 to begin with then put it back */
+  if (xbee->oldAPI == 2) {
+    xbee_log("XBee was already in API mode 2, no need to reset");
+    ret = 0;
+  } else {
+    int to = 5;
+
+    con = _xbee_newcon(xbee,'I',xbee_localAT);
+    con->callback = NULL;
+    con->waitforACK = 1;
+    _xbee_senddata(xbee,con,"AP%c",xbee->oldAPI);
+
+    pkt = NULL;
+
+    while (!pkt && to--) {
+      pkt = _xbee_getpacketwait(xbee,con);
+    }
+    if (pkt) {
+      ret = pkt->status;
+      Xfree(pkt);
+    }
+    _xbee_endcon(xbee,con);
+  }
+
+  /* xbee_* functions may no longer run... */
+  xbee->xbee_ready = 0;
+  
+  /* nullify everything */
+
+  /* stop listening for data... either after timeout or next char read which ever is first */
+  xbee->run = 0;
+  
+  xbee_thread_cancel(xbee->listent,0);
+  xbee_thread_join(xbee->listent);
+  
+  xbee_thread_cancel(xbee->threadt,0);
+  xbee_thread_join(xbee->threadt);
+
+  /* free all connections */
+  con = xbee->conlist;
+  xbee->conlist = NULL;
+  while (con) {
+    ncon = con->next;
+    Xfree(con);
+    con = ncon;
+  }
+
+  /* free all packets */
+  xbee->pktlast = NULL;
+  pkt = xbee->pktlist;
+  xbee->pktlist = NULL;
+  while (pkt) {
+    npkt = pkt->next;
+    Xfree(pkt);
+    pkt = npkt;
+  }
+
+  /* destroy mutexes */
+  xbee_mutex_destroy(xbee->conmutex);
+  xbee_mutex_destroy(xbee->pktmutex);
+  xbee_mutex_destroy(xbee->sendmutex);
+
+  /* close the serial port */
+  Xfree(xbee->path);
+  if (xbee->tty) xbee_close(xbee->tty);
+
+  /* close log and tty */
+  if (xbee->log) {
+    fflush(xbee->log);
+    xbee_close(xbee->log);
+  }
+  xbee_mutex_destroy(xbee->logmutex);
+
+  Xfree(xbee);
+
+  return ret;
+}
+
+/* #################################################################
+   xbee_setup
+   opens xbee serial port & creates xbee listen thread
+   the xbee must be configured for API mode 2
+   THIS MUST BE CALLED BEFORE ANY OTHER XBEE FUNCTION */
+int xbee_setup(char *path, int baudrate) {
+  return xbee_setuplogAPI(path,baudrate,0,0,0);
+}
+xbee_hnd _xbee_setup(char *path, int baudrate) {
+  return _xbee_setuplogAPI(path,baudrate,0,0,0);
+}
+int xbee_setuplog(char *path, int baudrate, int logfd) {
+  return  xbee_setuplogAPI(path,baudrate,logfd,0,0);
+}
+xbee_hnd _xbee_setuplog(char *path, int baudrate, int logfd) {
+  return _xbee_setuplogAPI(path,baudrate,logfd,0,0);
+}
+int xbee_setupAPI(char *path, int baudrate, char cmdSeq, int cmdTime) {
+  return xbee_setuplogAPI(path,baudrate,0,cmdSeq,cmdTime);
+}
+xbee_hnd _xbee_setupAPI(char *path, int baudrate, char cmdSeq, int cmdTime) {
+  return _xbee_setuplogAPI(path,baudrate,0,cmdSeq,cmdTime);
+}
+int xbee_setuplogAPI(char *path, int baudrate, int logfd, char cmdSeq, int cmdTime) {
+  if (default_xbee) return 0;
+  default_xbee = _xbee_setuplogAPI(path,baudrate,logfd,cmdSeq,cmdTime);
+  return (default_xbee?0:-1);
+}
+xbee_hnd _xbee_setuplogAPI(char *path, int baudrate, int logfd, char cmdSeq, int cmdTime) {
+  int ret;
+  xbee_hnd xbee = NULL;
+
+  /* create a new instance */
+  xbee = Xcalloc(sizeof(struct xbee_hnd));
+  xbee->next = NULL;
+  
+  xbee_mutex_init(xbee->logmutex);
+#ifdef DEBUG
+  if (!logfd) logfd = 2;
+#endif
+  if (logfd) {
+    xbee->logfd = dup(logfd);
+    xbee->log = fdopen(xbee->logfd,"w");
+    if (!xbee->log) {
+      /* errno == 9 is bad file descriptor (probrably not provided) */
+      if (errno != 9) xbee_perror("xbee_setup(): Failed opening logfile");
+      xbee->logfd = 0;
+    } else {
+#ifdef __GNUC__ /* ---- */
+      /* set to line buffer - ensure lines are written to file when complete */
+      setvbuf(xbee->log,NULL,_IOLBF,BUFSIZ);
+#else /* -------------- */
+      /* Win32 is rubbish... so we have to completely disable buffering... */
+      setvbuf(xbee->log,NULL,_IONBF,BUFSIZ);
+#endif /* ------------- */
+    }
+  }
+
+  xbee_logS("---------------------------------------------------------------------");
+  xbee_logI("libxbee Starting...");
+  xbee_logI("SVN Info: %s",xbee_svn_version());
+  xbee_logI("Build Info: %s",xbee_build_info());
+  xbee_logE("---------------------------------------------------------------------");
+
+  /* setup the connection stuff */
+  xbee->conlist = NULL;
+
+  /* setup the packet stuff */
+  xbee->pktlist = NULL;
+  xbee->pktlast = NULL;
+  xbee->pktcount = 0;
+  xbee->run = 1;
+
+  /* setup the mutexes */
+  if (xbee_mutex_init(xbee->conmutex)) {
+    xbee_perror("xbee_setup():xbee_mutex_init(conmutex)");
+    if (xbee->log) xbee_close(xbee->log);
+    Xfree(xbee);
+    return NULL;
+  }
+  if (xbee_mutex_init(xbee->pktmutex)) {
+    xbee_perror("xbee_setup():xbee_mutex_init(pktmutex)");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    Xfree(xbee);
+    return NULL;
+  }
+  if (xbee_mutex_init(xbee->sendmutex)) {
+    xbee_perror("xbee_setup():xbee_mutex_init(sendmutex)");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    Xfree(xbee);
+    return NULL;
+  }
+
+  /* take a copy of the XBee device path */
+  if ((xbee->path = Xmalloc(sizeof(char) * (strlen(path) + 1))) == NULL) {
+    xbee_perror("xbee_setup():Xmalloc(path)");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee);
+    return NULL;
+  }
+  strcpy(xbee->path,path);
+  if (xbee->log) xbee_log("Opening serial port '%s'...",xbee->path);
+
+  /* call the relevant init function */
+  if ((ret = init_serial(xbee,baudrate)) != 0) {
+    xbee_log("Something failed while opening the serial port...");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+    Xfree(xbee);
+    return NULL;
+  }
+
+  /* when xbee_end() is called, if this is not 2 then ATAP will be set to this value */
+  xbee->oldAPI = 2;
+  xbee->cmdSeq = cmdSeq;
+  xbee->cmdTime = cmdTime;
+  if (xbee->cmdSeq && xbee->cmdTime) {
+    if (xbee_startAPI(xbee)) {
+      if (xbee->log) {
+        xbee_log("Couldn't communicate with XBee...");
+        xbee_close(xbee->log);
+      }
+      xbee_mutex_destroy(xbee->conmutex);
+      xbee_mutex_destroy(xbee->pktmutex);
+      xbee_mutex_destroy(xbee->sendmutex);
+      Xfree(xbee->path);
+#ifdef __GNUC__ /* ---- */
+      close(xbee->ttyfd);
+#endif /* ------------- */
+      xbee_close(xbee->tty);
+      Xfree(xbee);
+      return NULL;
+    }
+  }
+
+  /* allow the listen thread to start */
+  xbee->xbee_ready = -1;
+
+  /* can start xbee_listen thread now */
+  if (xbee_thread_create(xbee->listent, xbee_listen_wrapper, xbee)) {
+    xbee_perror("xbee_setup():xbee_thread_create(listent)");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+#ifdef __GNUC__ /* ---- */
+    close(xbee->ttyfd);
+#endif /* ------------- */
+    xbee_close(xbee->tty);
+    Xfree(xbee);
+    return NULL;
+  }
+  
+  /* can start xbee_thread_watch thread thread now */
+  if (xbee_thread_create(xbee->threadt, xbee_thread_watch, xbee)) {
+    xbee_perror("xbee_setup():xbee_thread_create(threadt)");
+    if (xbee->log) xbee_close(xbee->log);
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+#ifdef __GNUC__ /* ---- */
+    close(xbee->ttyfd);
+#endif /* ------------- */
+    xbee_close(xbee->tty);
+    Xfree(xbee);
+    return NULL;
+  }
+
+  usleep(500);
+  while (xbee->xbee_ready != -2) {
+    usleep(500);
+    xbee_log("Waiting for xbee_listen() to be ready...");
+  }
+
+  /* allow other functions to be used! */
+  xbee->xbee_ready = 1;
+  
+  xbee_log("Linking xbee instance...");
+  if (!default_xbee) {
+    xbee_mutex_init(xbee_hnd_mutex);
+    xbee_mutex_lock(xbee_hnd_mutex);
+    default_xbee = xbee;
+    xbee_mutex_unlock(xbee_hnd_mutex);
+  } else {
+    xbee_hnd xbeet;
+    xbee_mutex_lock(xbee_hnd_mutex);
+    xbeet = default_xbee;
+    while (xbeet->next) {
+      xbeet = xbeet->next;
+    }
+    xbeet->next = xbee;
+    xbee_mutex_unlock(xbee_hnd_mutex);
+  }
+  
+  xbee_log("libxbee: Started!");
+
+  return xbee;
+}
+
+/* #################################################################
+   xbee_con
+   produces a connection to the specified device and frameID
+   if a connection had already been made, then this connection will be returned */
+xbee_con *xbee_newcon(unsigned char frameID, xbee_types type, ...) {
+  xbee_con *ret;
+  va_list ap;
+
+  /* xbee_vnewcon() wants a va_list... */
+  va_start(ap, type);
+  /* hand it over :) */
+  ret = _xbee_vnewcon(default_xbee, frameID, type, ap);
+  va_end(ap);
+  return ret;
+}
+xbee_con *_xbee_newcon(xbee_hnd xbee, unsigned char frameID, xbee_types type, ...) {
+  xbee_con *ret;
+  va_list ap;
+
+  /* xbee_vnewcon() wants a va_list... */
+  va_start(ap, type);
+  /* hand it over :) */
+  ret = _xbee_vnewcon(xbee, frameID, type, ap);
+  va_end(ap);
+  return ret;
+}
+xbee_con *_xbee_vnewcon(xbee_hnd xbee, unsigned char frameID, xbee_types type, va_list ap) {
+  xbee_con *con, *ocon;
+  unsigned char tAddr[8];
+  int t;
+  int i;
+
+  ISREADYR(NULL);
+
+  if (!type || type == xbee_unknown) type = xbee_localAT; /* default to local AT */
+  else if (type == xbee_remoteAT) type = xbee_64bitRemoteAT; /* if remote AT, default to 64bit */
+
+  /* if: 64 bit address expected (2 ints) */
+  if ((type == xbee_64bitRemoteAT) ||
+      (type == xbee_64bitData) ||
+      (type == xbee_64bitIO) ||
+      (type == xbee2_data)) {
+    t = va_arg(ap, int);
+    tAddr[0] = (t >> 24) & 0xFF;
+    tAddr[1] = (t >> 16) & 0xFF;
+    tAddr[2] = (t >>  8) & 0xFF;
+    tAddr[3] = (t      ) & 0xFF;
+    t = va_arg(ap, int);
+    tAddr[4] = (t >> 24) & 0xFF;
+    tAddr[5] = (t >> 16) & 0xFF;
+    tAddr[6] = (t >>  8) & 0xFF;
+    tAddr[7] = (t      ) & 0xFF;
+
+    /* if: 16 bit address expected (1 int) */
+  } else if ((type == xbee_16bitRemoteAT) ||
+             (type == xbee_16bitData) ||
+             (type == xbee_16bitIO)) {
+    t = va_arg(ap, int);
+    tAddr[0] = (t >>  8) & 0xFF;
+    tAddr[1] = (t      ) & 0xFF;
+    tAddr[2] = 0;
+    tAddr[3] = 0;
+    tAddr[4] = 0;
+    tAddr[5] = 0;
+    tAddr[6] = 0;
+    tAddr[7] = 0;
+
+    /* otherwise clear the address */
+  } else {
+    memset(tAddr,0,8);
+  }
+
+  /* lock the connection mutex */
+  xbee_mutex_lock(xbee->conmutex);
+
+  /* are there any connections? */
+  if (xbee->conlist) {
+    con = xbee->conlist;
+    while (con) {
+      /* if: looking for a modemStatus, and the types match! */
+      if ((type == xbee_modemStatus) &&
+          (con->type == type)) {
+        xbee_mutex_unlock(xbee->conmutex);
+        return con;
+
+        /* if: looking for a txStatus and frameIDs match! */
+      } else if ((type == xbee_txStatus) &&
+                 (con->type == type) &&
+                 (frameID == con->frameID)) {
+        xbee_mutex_unlock(xbee->conmutex);
+        return con;
+
+        /* if: looking for a localAT, and the frameIDs match! */
+      } else if ((type == xbee_localAT) &&
+                 (con->type == type) &&
+                 (frameID == con->frameID)) {
+        xbee_mutex_unlock(xbee->conmutex);
+        return con;
+
+        /* if: connection types match, the frameIDs match, and the addresses match! */
+      } else if ((type == con->type) &&
+                 (frameID == con->frameID) &&
+                 (!memcmp(tAddr,con->tAddr,8))) {
+        xbee_mutex_unlock(xbee->conmutex);
+        return con;
+      }
+
+      /* if there are more, move along, dont want to loose that last item! */
+      if (con->next == NULL) break;
+      con = con->next;
+    }
+
+    /* keep hold of the last connection... we will need to link it up later */
+    ocon = con;
+  }
+
+  /* unlock the connection mutex */
+  xbee_mutex_unlock(xbee->conmutex);
+  
+  /* create a new connection and set its attributes */
+  con = Xcalloc(sizeof(xbee_con));
+  con->type = type;
+  /* is it a 64bit connection? */
+  if ((type == xbee_64bitRemoteAT) ||
+      (type == xbee_64bitData) ||
+      (type == xbee_64bitIO) ||
+      (type == xbee2_data)) {
+    con->tAddr64 = TRUE;
+  }
+  con->atQueue = 0; /* queue AT commands? */
+  con->txDisableACK = 0; /* disable ACKs? */
+  con->txBroadcastPAN = 0; /* broadcast? */
+  con->frameID = frameID;
+  con->waitforACK = 0;
+  memcpy(con->tAddr,tAddr,8); /* copy in the remote address */
+  xbee_mutex_init(con->callbackmutex);
+  xbee_mutex_init(con->callbackListmutex);
+  xbee_mutex_init(con->Txmutex);
+  xbee_sem_init(con->waitforACKsem);
+
+  if (xbee->log) {
+    switch(type) {
+    case xbee_localAT:
+      xbee_log("New local AT connection!");
+      break;
+    case xbee_16bitRemoteAT:
+    case xbee_64bitRemoteAT:
+      xbee_logc("New %d-bit remote AT connection! (to: ",(con->tAddr64?64:16));
+      for (i=0;i<(con->tAddr64?8:2);i++) {
+        fprintf(xbee->log,(i?":%02X":"%02X"),tAddr[i]);
+      }
+      fprintf(xbee->log,")");
+      xbee_logcf();
+      break;
+    case xbee_16bitData:
+    case xbee_64bitData:
+      xbee_logc("New %d-bit data connection! (to: ",(con->tAddr64?64:16));
+      for (i=0;i<(con->tAddr64?8:2);i++) {
+        fprintf(xbee->log,(i?":%02X":"%02X"),tAddr[i]);
+      }
+      fprintf(xbee->log,")");
+      xbee_logcf();
+      break;
+    case xbee_16bitIO:
+    case xbee_64bitIO:
+      xbee_logc("New %d-bit IO connection! (to: ",(con->tAddr64?64:16));
+      for (i=0;i<(con->tAddr64?8:2);i++) {
+        fprintf(xbee->log,(i?":%02X":"%02X"),tAddr[i]);
+      }
+      fprintf(xbee->log,")");
+      xbee_logcf();
+      break;
+    case xbee2_data:
+      xbee_logc("New Series 2 data connection! (to: ");
+      for (i=0;i<8;i++) {
+        fprintf(xbee->log,(i?":%02X":"%02X"),tAddr[i]);
+      }
+      fprintf(xbee->log,")");
+      xbee_logcf();
+      break;
+    case xbee_txStatus:
+      xbee_log("New Tx status connection!");
+      break;
+    case xbee_modemStatus:
+      xbee_log("New modem status connection!");
+      break;
+    case xbee_unknown:
+    default:
+      xbee_log("New unknown connection!");
+    }
+  }
+
+  /* lock the connection mutex */
+  xbee_mutex_lock(xbee->conmutex);
+  
+  /* make it the last in the list */
+  con->next = NULL;
+  /* add it to the list */
+  if (xbee->conlist) {
+    ocon->next = con;
+  } else {
+    xbee->conlist = con;
+  }
+
+  /* unlock the mutex */
+  xbee_mutex_unlock(xbee->conmutex);
+  return con;
+}
+
+/* #################################################################
+   xbee_conflush
+   removes any packets that have been collected for the specified
+   connection */
+void xbee_purgecon(xbee_con *con) {
+  _xbee_purgecon(default_xbee, con);
+}
+void _xbee_purgecon(xbee_hnd xbee, xbee_con *con) {
+  xbee_pkt *r, *p, *n;
+
+  ISREADYP();
+  
+  /* lock the packet mutex */
+  xbee_mutex_lock(xbee->pktmutex);
+
+  /* if: there are packets */
+  if ((p = xbee->pktlist) != NULL) {
+    r = NULL;
+    /* get all packets for this connection */
+    do {
+      /* does the packet match the connection? */
+      if (xbee_matchpktcon(xbee,p,con)) {
+        /* if it was the first packet */
+        if (!r) {
+          /* move the chain along */
+          xbee->pktlist = p->next;
+        } else {
+          /* otherwise relink the list */
+          r->next = p->next;
+        }
+        xbee->pktcount--;
+
+        /* free this packet! */
+        n = p->next;
+        Xfree(p);
+        /* move on */
+        p = n;
+      } else {
+        /* move on */
+        r = p;
+        p = p->next;
+      }
+    } while (p);
+    xbee->pktlast = r;
+  }
+
+  /* unlock the packet mutex */
+  xbee_mutex_unlock(xbee->pktmutex);
+}
+
+/* #################################################################
+   xbee_endcon
+   close the unwanted connection
+   free wrapper function (uses the Xfree macro and sets the pointer to NULL after freeing it) */
+void xbee_endcon2(xbee_con **con, int alreadyUnlinked) {
+  _xbee_endcon2(default_xbee, con, alreadyUnlinked);
+}
+void _xbee_endcon2(xbee_hnd xbee, xbee_con **con, int alreadyUnlinked) {
+  xbee_con *t, *u;
+
+  ISREADYP();
+  
+  /* lock the connection mutex */
+  xbee_mutex_lock(xbee->conmutex);
+
+  u = t = xbee->conlist;
+  while (t && t != *con) {
+    u = t;
+    t = t->next;
+  }
+  if (!t) {
+    /* this could be true if comming from the destroySelf signal... */
+    if (!alreadyUnlinked) {
+      /* invalid connection given... */
+      if (xbee->log) {
+        xbee_log("Attempted to close invalid connection...");
+      }
+      /* unlock the connection mutex */
+      xbee_mutex_unlock(xbee->conmutex);
+      return;
+    }
+  } else {
+    /* extract this connection from the list */
+    if (t == xbee->conlist) {
+      xbee->conlist = t->next;
+    } else {
+      u->next = t->next;
+    }
+  }
+  
+  /* unlock the connection mutex */
+  xbee_mutex_unlock(xbee->conmutex);
+
+  /* check if a callback thread is running... */
+  if (t->callback && xbee_mutex_trylock(t->callbackmutex)) {
+    /* if it is running... tell it to destroy the connection on completion */
+    xbee_log("Attempted to close a connection with active callbacks... "
+             "Connection will be destroyed when callbacks have completeted...");
+    t->destroySelf = 1;
+    return;
+  }
+
+  /* remove all packets for this connection */
+  _xbee_purgecon(xbee,t);
+
+  /* destroy the callback mutex */
+  xbee_mutex_destroy(t->callbackmutex);
+  xbee_mutex_destroy(t->callbackListmutex);
+  xbee_mutex_destroy(t->Txmutex);
+  xbee_sem_destroy(t->waitforACKsem);
+
+  /* free the connection! */
+  Xfree(*con);
+}
+
+/* #################################################################
+   xbee_senddata
+   send the specified data to the provided connection */
+int xbee_senddata(xbee_con *con, char *format, ...) {
+  int ret;
+  va_list ap;
+
+  /* xbee_vsenddata() wants a va_list... */
+  va_start(ap, format);
+  /* hand it over :) */
+  ret = _xbee_vsenddata(default_xbee, con, format, ap);
+  va_end(ap);
+  return ret;
+}
+int _xbee_senddata(xbee_hnd xbee, xbee_con *con, char *format, ...) {
+  int ret;
+  va_list ap;
+
+  /* xbee_vsenddata() wants a va_list... */
+  va_start(ap, format);
+  /* hand it over :) */
+  ret = _xbee_vsenddata(xbee, con, format, ap);
+  va_end(ap);
+  return ret;
+}
+
+int xbee_vsenddata(xbee_con *con, char *format, va_list ap) {
+  return _xbee_vsenddata(default_xbee, con, format, ap);
+}
+int _xbee_vsenddata(xbee_hnd xbee, xbee_con *con, char *format, va_list ap) {
+  unsigned char data[128]; /* max payload is 100 bytes... plus a bit of fluff... */
+  int length;
+
+  /* make up the data and keep the length, its possible there are nulls in there */
+  length = vsnprintf((char *)data, 128, format, ap);
+
+  /* hand it over :) */
+  return _xbee_nsenddata(xbee, con, (char *)data, length);
+}
+
+/* returns:
+    1 - if NAC was recieved
+    0 - if packet was successfully sent (or just sent if waitforACK is off)
+   -1 - if there was an error building the packet
+   -2 - if the connection type was unknown */
+int xbee_nsenddata(xbee_con *con, char *data, int length) {
+  return _xbee_nsenddata(default_xbee, con, data, length);
+}
+int _xbee_nsenddata(xbee_hnd xbee, xbee_con *con, char *data, int length) {
+  t_data *pkt;
+  int i;
+  unsigned char buf[128]; /* max payload is 100 bytes... plus a bit for the headers etc... */
+
+  ISREADYR(-1);
+
+  if (!con) return -1;
+  if (con->type == xbee_unknown) return -1;
+  if (length > 127) return -1;
+  
+  if (xbee->log) {
+    xbee_logS("--== TX Packet ============--");
+    xbee_logIc("Connection Type: ");
+    switch (con->type) {
+    case xbee_unknown:       fprintf(xbee->log,"Unknown"); break;
+    case xbee_localAT:       fprintf(xbee->log,"Local AT"); break;
+    case xbee_remoteAT:      fprintf(xbee->log,"Remote AT"); break;
+    case xbee_16bitRemoteAT: fprintf(xbee->log,"Remote AT (16-bit)"); break;
+    case xbee_64bitRemoteAT: fprintf(xbee->log,"Remote AT (64-bit)"); break;
+    case xbee_16bitData:     fprintf(xbee->log,"Data (16-bit)"); break;
+    case xbee_64bitData:     fprintf(xbee->log,"Data (64-bit)"); break;
+    case xbee_16bitIO:       fprintf(xbee->log,"IO (16-bit)"); break;
+    case xbee_64bitIO:       fprintf(xbee->log,"IO (64-bit)"); break;
+    case xbee2_data:         fprintf(xbee->log,"Series 2 Data"); break;
+    case xbee2_txStatus:     fprintf(xbee->log,"Series 2 Tx Status"); break;
+    case xbee_txStatus:      fprintf(xbee->log,"Tx Status"); break;
+    case xbee_modemStatus:   fprintf(xbee->log,"Modem Status"); break;
+    }
+    xbee_logIcf();
+    switch (con->type) {
+    case xbee_localAT: case xbee_remoteAT: case xbee_txStatus: case xbee_modemStatus:
+      break;
+    default:
+      xbee_logIc("Destination: ");
+      for (i=0;i<(con->tAddr64?8:2);i++) {
+        fprintf(xbee->log,(i?":%02X":"%02X"),con->tAddr[i]);
+      }
+      xbee_logIcf();
+    }
+    xbee_logI("Length: %d",length);
+    for (i=0;i<length;i++) {
+      xbee_logIc("%3d | 0x%02X ",i,(unsigned char)data[i]);
+      if ((data[i] > 32) && (data[i] < 127)) {
+        fprintf(xbee->log,"'%c'",data[i]);
+      } else{
+        fprintf(xbee->log," _");
+      }
+      xbee_logIcf();
+    }
+    xbee_logEf();
+  }
+
+  /* ########################################## */
+  /* if: local AT */
+  if (con->type == xbee_localAT) {
+    /* AT commands are 2 chars long (plus optional parameter) */
+    if (length < 2) return -1;
+    if (length > 32) return -1;
+
+    /* use the command? */
+    buf[0] = ((!con->atQueue)?XBEE_LOCAL_ATREQ:XBEE_LOCAL_ATQUE);
+    buf[1] = con->frameID;
+
+    /* copy in the data */
+    for (i=0;i<length;i++) {
+      buf[i+2] = data[i];
+    }
+
+    /* setup the packet */
+    pkt = xbee_make_pkt(xbee, buf, i+2);
+    /* send it on */
+    return _xbee_send_pkt(xbee, pkt, con);
+
+    /* ########################################## */
+    /* if: remote AT */
+  } else if ((con->type == xbee_16bitRemoteAT) ||
+             (con->type == xbee_64bitRemoteAT)) {
+    if (length < 2) return -1; /* at commands are 2 chars long (plus optional parameter) */
+    if (length > 32) return -1;
+    buf[0] = XBEE_REMOTE_ATREQ;
+    buf[1] = con->frameID;
+
+    /* copy in the relevant address */
+    if (con->tAddr64) {
+      memcpy(&buf[2],con->tAddr,8);
+      buf[10] = 0xFF;
+      buf[11] = 0xFE;
+    } else {
+      memset(&buf[2],0,8);
+      memcpy(&buf[10],con->tAddr,2);
+    }
+    /* queue the command? */
+    buf[12] = ((!con->atQueue)?0x02:0x00);
+
+    /* copy in the data */
+    for (i=0;i<length;i++) {
+      buf[i+13] = data[i];
+    }
+
+    /* setup the packet */
+    pkt = xbee_make_pkt(xbee, buf, i+13);
+    /* send it on */
+    return _xbee_send_pkt(xbee, pkt, con);
+
+    /* ########################################## */
+    /* if: 16 or 64bit Data */
+  } else if ((con->type == xbee_16bitData) ||
+             (con->type == xbee_64bitData)) {
+    int offset;
+    if (length > 100) return -1;
+
+    /* if: 16bit Data */
+    if (con->type == xbee_16bitData) {
+      buf[0] = XBEE_16BIT_DATATX;
+      offset = 5;
+      /* copy in the address */
+      memcpy(&buf[2],con->tAddr,2);
+
+      /* if: 64bit Data */
+    } else { /* 64bit Data */
+      buf[0] = XBEE_64BIT_DATATX;
+      offset = 11;
+      /* copy in the address */
+      memcpy(&buf[2],con->tAddr,8);
+    }
+
+    /* copy frameID */
+    buf[1] = con->frameID;
+
+    /* disable ack? broadcast? */
+    buf[offset-1] = ((con->txDisableACK)?0x01:0x00) | ((con->txBroadcastPAN)?0x04:0x00);
+
+    /* copy in the data */
+    for (i=0;i<length;i++) {
+      buf[i+offset] = data[i];
+    }
+
+    /* setup the packet */
+    pkt = xbee_make_pkt(xbee, buf, i+offset);
+    /* send it on */
+    return _xbee_send_pkt(xbee, pkt, con);
+
+    /* ########################################## */
+    /* if: I/O */
+  } else if ((con->type == xbee_64bitIO) ||
+             (con->type == xbee_16bitIO)) {
+    /* not currently implemented... is it even allowed? */
+    if (xbee->log) {
+      xbee_log("******* TODO ********\n");
+    }
+    
+    /* ########################################## */
+    /* if: Series 2 Data */
+  } else if (con->type == xbee2_data) {
+    if (length > 72) return -1;
+    
+    buf[0] = XBEE2_DATATX;
+    buf[1] = con->frameID;
+
+    /* copy in the relevant address */
+    memcpy(&buf[2],con->tAddr,8);
+    buf[10] = 0xFF;
+    buf[11] = 0xFE;
+
+    /* Maximum Radius/hops */
+    buf[12] = 0x00; 
+    
+    /* Options */
+    buf[13] = 0x00;
+    
+    /* copy in the data */
+    for (i=0;i<length;i++) {
+      buf[i+14] = data[i];
+    }
+
+    /* setup the packet */
+    pkt = xbee_make_pkt(xbee, buf, i+14);
+    /* send it on */
+    return _xbee_send_pkt(xbee, pkt, con);
+  }
+
+  return -2;
+}
+
+/* #################################################################
+   xbee_getpacket
+   retrieves the next packet destined for the given connection
+   once the packet has been retrieved, it is removed for the list! */
+xbee_pkt *xbee_getpacketwait(xbee_con *con) {
+  return _xbee_getpacketwait(default_xbee, con);
+}
+xbee_pkt *_xbee_getpacketwait(xbee_hnd xbee, xbee_con *con) {
+  xbee_pkt *p = NULL;
+  int i = 20;
+
+  /* 50ms * 20 = 1 second */
+  for (; i; i--) {
+    p = _xbee_getpacket(xbee, con);
+    if (p) break;
+    usleep(50000); /* 50ms */
+  }
+
+  return p;
+}
+xbee_pkt *xbee_getpacket(xbee_con *con) {
+  return _xbee_getpacket(default_xbee, con);
+}
+xbee_pkt *_xbee_getpacket(xbee_hnd xbee, xbee_con *con) {
+  xbee_pkt *l, *p, *q;
+
+  ISREADYR(NULL);
+  
+  /* lock the packet mutex */
+  xbee_mutex_lock(xbee->pktmutex);
+
+  /* if: there are no packets */
+  if ((p = xbee->pktlist) == NULL) {
+    xbee_mutex_unlock(xbee->pktmutex);
+    /*if (xbee->log) {
+      xbee_log("No packets avaliable...");
+      }*/
+    return NULL;
+  }
+
+  l = NULL;
+  q = NULL;
+  /* get the first avaliable packet for this connection */
+  do {
+    /* does the packet match the connection? */
+    if (xbee_matchpktcon(xbee, p, con)) {
+      q = p;
+      break;
+    }
+    /* move on */
+    l = p;
+    p = p->next;
+  } while (p);
+
+  /* if: no packet was found */
+  if (!q) {
+    xbee_mutex_unlock(xbee->pktmutex);    
+    if (xbee->log) {
+      struct timeval tv;
+      xbee_logS("--== Get Packet ==========--");
+      gettimeofday(&tv,NULL);
+      xbee_logE("Didn't get a packet @ %ld.%06ld",tv.tv_sec,tv.tv_usec);
+    }
+    return NULL;
+  }
+
+  /* if it was the first packet */
+  if (l) {
+    /* relink the list */
+    l->next = p->next;
+    if (!l->next) xbee->pktlast = l;
+  } else {
+    /* move the chain along */
+    xbee->pktlist = p->next;
+    if (!xbee->pktlist) {
+      xbee->pktlast = NULL;
+    } else if (!xbee->pktlist->next) {
+      xbee->pktlast = xbee->pktlist;
+    }
+  }
+  xbee->pktcount--;
+
+  /* unlink this packet from the chain! */
+  q->next = NULL;
+
+  if (xbee->log) {
+    struct timeval tv;
+    xbee_logS("--== Get Packet ==========--");
+    gettimeofday(&tv,NULL);
+    xbee_logI("Got a packet @ %ld.%06ld",tv.tv_sec,tv.tv_usec);
+    xbee_logE("Packets left: %d",xbee->pktcount);
+  }
+
+  /* unlock the packet mutex */
+  xbee_mutex_unlock(xbee->pktmutex);
+
+  /* and return the packet (must be free'd by caller!) */
+  return q;
+}
+
+/* #################################################################
+   xbee_matchpktcon - INTERNAL
+   checks if the packet matches the connection */
+static int xbee_matchpktcon(xbee_hnd xbee, xbee_pkt *pkt, xbee_con *con) {
+  /* if: the connection type matches the packet type OR
+     the connection is 16/64bit remote AT, and the packet is a remote AT response */
+  if ((pkt->type == con->type) || /* -- */
+      ((pkt->type == xbee_remoteAT) && /* -- */
+       ((con->type == xbee_16bitRemoteAT) ||
+        (con->type == xbee_64bitRemoteAT)))) {
+
+    
+    /* if: is a modem status (there can only be 1 modem status connection) */
+    if (pkt->type == xbee_modemStatus) return 1;
+
+    /* if: the packet is a txStatus or localAT and the frameIDs match */
+    if ((pkt->type == xbee_txStatus) ||
+        (pkt->type == xbee_localAT)) {
+      if (pkt->frameID == con->frameID) {
+        return 1;
+      }
+    /* if: the packet was sent as a 16bit remoteAT, and the 16bit addresss match */
+    } else if ((pkt->type == xbee_remoteAT) &&
+               (con->type == xbee_16bitRemoteAT) &&
+               !memcmp(pkt->Addr16,con->tAddr,2)) {
+      return 1;
+    /* if: the packet was sent as a 64bit remoteAT, and the 64bit addresss match */
+    } else if ((pkt->type == xbee_remoteAT) &&
+               (con->type == xbee_64bitRemoteAT) &&
+               !memcmp(pkt->Addr64,con->tAddr,8)) {
+      return 1;
+    /* if: the packet is 64bit addressed, and the addresses match */
+    } else if (pkt->sAddr64 && !memcmp(pkt->Addr64,con->tAddr,8)) {
+      return 1;
+    /* if: the packet is 16bit addressed, and the addresses match */
+    } else if (!pkt->sAddr64 && !memcmp(pkt->Addr16,con->tAddr,2)) {
+      return 1;
+    } else if (con->type == pkt->type && 
+               (con->type == xbee_16bitData || con->type == xbee_64bitData) && 
+               (pkt->isBroadcastADR || pkt->isBroadcastPAN)) {
+      unsigned char t[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+      if ((con->tAddr64 && !memcmp(con->tAddr,t,8)) ||
+          (!con->tAddr64 && !memcmp(con->tAddr,t,2))) {
+        return 1;
+      }
+    }
+  }
+  return 0;
+}
+
+/* #################################################################
+   xbee_parse_io - INTERNAL
+   parses the data given into the packet io information */
+static int xbee_parse_io(xbee_hnd xbee, xbee_pkt *p, unsigned char *d,
+                         int maskOffset, int sampleOffset, int sample) {
+  xbee_sample *s = &(p->IOdata[sample]);
+
+  /* copy in the I/O data mask */
+  s->IOmask = (((d[maskOffset]<<8) | d[maskOffset + 1]) & 0x7FFF);
+
+  /* copy in the digital I/O data */
+  s->IOdigital = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x01FF);
+
+  /* advance over the digital data, if its there */
+  sampleOffset += ((s->IOmask & 0x01FF)?2:0);
+
+  /* copy in the analog I/O data */
+  if (s->IOmask & 0x0200) {
+    s->IOanalog[0] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+  if (s->IOmask & 0x0400) {
+    s->IOanalog[1] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+  if (s->IOmask & 0x0800) {
+    s->IOanalog[2] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+  if (s->IOmask & 0x1000) {
+    s->IOanalog[3] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+  if (s->IOmask & 0x2000) {
+    s->IOanalog[4] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+  if (s->IOmask & 0x4000) {
+    s->IOanalog[5] = (((d[sampleOffset]<<8) | d[sampleOffset+1]) & 0x03FF);
+    sampleOffset+=2;
+  }
+
+  if (xbee->log) {
+    if (s->IOmask & 0x0001)
+      xbee_logI("Digital 0: %c",((s->IOdigital & 0x0001)?'1':'0'));
+    if (s->IOmask & 0x0002)
+      xbee_logI("Digital 1: %c",((s->IOdigital & 0x0002)?'1':'0'));
+    if (s->IOmask & 0x0004)
+      xbee_logI("Digital 2: %c",((s->IOdigital & 0x0004)?'1':'0'));
+    if (s->IOmask & 0x0008)
+      xbee_logI("Digital 3: %c",((s->IOdigital & 0x0008)?'1':'0'));
+    if (s->IOmask & 0x0010)
+      xbee_logI("Digital 4: %c",((s->IOdigital & 0x0010)?'1':'0'));
+    if (s->IOmask & 0x0020)
+      xbee_logI("Digital 5: %c",((s->IOdigital & 0x0020)?'1':'0'));
+    if (s->IOmask & 0x0040)
+      xbee_logI("Digital 6: %c",((s->IOdigital & 0x0040)?'1':'0'));
+    if (s->IOmask & 0x0080)
+      xbee_logI("Digital 7: %c",((s->IOdigital & 0x0080)?'1':'0'));
+    if (s->IOmask & 0x0100)
+      xbee_logI("Digital 8: %c",((s->IOdigital & 0x0100)?'1':'0'));
+    if (s->IOmask & 0x0200)
+      xbee_logI("Analog  0: %d (~%.2fv)",s->IOanalog[0],(3.3/1023)*s->IOanalog[0]);
+    if (s->IOmask & 0x0400)
+      xbee_logI("Analog  1: %d (~%.2fv)",s->IOanalog[1],(3.3/1023)*s->IOanalog[1]);
+    if (s->IOmask & 0x0800)
+      xbee_logI("Analog  2: %d (~%.2fv)",s->IOanalog[2],(3.3/1023)*s->IOanalog[2]);
+    if (s->IOmask & 0x1000)
+      xbee_logI("Analog  3: %d (~%.2fv)",s->IOanalog[3],(3.3/1023)*s->IOanalog[3]);
+    if (s->IOmask & 0x2000)
+      xbee_logI("Analog  4: %d (~%.2fv)",s->IOanalog[4],(3.3/1023)*s->IOanalog[4]);
+    if (s->IOmask & 0x4000)
+      xbee_logI("Analog  5: %d (~%.2fv)",s->IOanalog[5],(3.3/1023)*s->IOanalog[5]);
+  }
+
+  return sampleOffset;
+}
+
+/* #################################################################
+   xbee_listen_stop
+   stops the listen thread after the current packet has been processed */
+void xbee_listen_stop(xbee_hnd xbee) {
+  ISREADYP();
+  xbee->run = 0;
+}
+
+/* #################################################################
+   xbee_listen_wrapper - INTERNAL
+   the xbee_listen wrapper. Prints an error when xbee_listen ends */
+static void xbee_listen_wrapper(xbee_hnd xbee) {
+  int ret;
+
+  /* just falls out if the proper 'go-ahead' isn't given */
+  if (xbee->xbee_ready != -1) return;
+  /* now allow the parent to continue */
+  xbee->xbee_ready = -2;
+  
+#ifdef _WIN32 /* ---- */
+  /* win32 requires this delay... no idea why */
+  usleep(1000000);
+#endif /* ----------- */
+
+  while (xbee->run) {
+    ret = xbee_listen(xbee);
+    if (!xbee->run) break;
+    xbee_log("xbee_listen() returned [%d]... Restarting in 25ms!",ret);
+    usleep(25000);
+  }
+}
+
+/* xbee_listen - INTERNAL
+   the xbee xbee_listen thread
+   reads data from the xbee and puts it into a linked list to keep the xbee buffers free */
+static int xbee_listen(xbee_hnd xbee) {
+#define LISTEN_BUFLEN 1024
+  unsigned char c, t, d[LISTEN_BUFLEN];
+  unsigned int l, i, chksum, o;
+  int j;
+  xbee_pkt *p = NULL, *q;
+  xbee_con *con;
+  int hasCon;
+
+  /* do this forever :) */
+  while (xbee->run) {
+    /* clean up any undesired storage */
+    if (p) Xfree(p);
+    
+    /* wait for a valid start byte */
+    if ((c = xbee_getrawbyte(xbee)) != 0x7E) {
+      if (xbee->log) xbee_log("***** Unexpected byte (0x%02X)... *****",c);
+      continue;
+    }
+    if (!xbee->run) return 0;
+
+    xbee_logSf();
+    if (xbee->log) {
+      struct timeval tv;
+      xbee_logI("--== RX Packet ===========--");
+      gettimeofday(&tv,NULL);
+      xbee_logI("Got a packet @ %ld.%06ld",tv.tv_sec,tv.tv_usec);
+    }
+
+    /* get the length */
+    l = xbee_getbyte(xbee) << 8;
+    l += xbee_getbyte(xbee);
+
+    /* check it is a valid length... */
+    if (!l) {
+      if (xbee->log) {
+        xbee_logI("Recived zero length packet!");
+      }
+      continue;
+    }
+    if (l > 100) {
+      if (xbee->log) {
+        xbee_logI("Recived oversized packet! Length: %d",l - 1);
+      }
+    }
+    if (l > LISTEN_BUFLEN) {
+      if (xbee->log) {
+        xbee_logI("Recived packet larger than buffer! Discarding...");
+      }
+      continue;
+    }
+
+    if (xbee->log) {
+      xbee_logI("Length: %d",l - 1);
+    }
+
+    /* get the packet type */
+    t = xbee_getbyte(xbee);
+
+    /* start the checksum */
+    chksum = t;
+
+    /* suck in all the data */
+    for (i = 0; l > 1 && i < LISTEN_BUFLEN; l--, i++) {
+      /* get an unescaped byte */
+      c = xbee_getbyte(xbee);
+      d[i] = c;
+      chksum += c;
+      if (xbee->log) {
+        xbee_logIc("%3d | 0x%02X | ",i,c);
+        if ((c > 32) && (c < 127)) fprintf(xbee->log,"'%c'",c); else fprintf(xbee->log," _ ");
+
+        if ((t == XBEE_LOCAL_AT     && i == 4) ||
+            (t == XBEE_REMOTE_AT    && i == 14) ||
+            (t == XBEE_64BIT_DATARX && i == 10) ||
+            (t == XBEE_16BIT_DATARX && i == 4) ||
+            (t == XBEE_64BIT_IO     && i == 13) ||
+            (t == XBEE_16BIT_IO     && i == 7)) {
+          /* mark the beginning of the 'data' bytes */
+          fprintf(xbee->log,"   <-- data starts");
+        } else if (t == XBEE_64BIT_IO) {
+          if (i == 10)      fprintf(xbee->log,"   <-- sample count");
+          else if (i == 11) fprintf(xbee->log,"   <-- mask (msb)");
+          else if (i == 12) fprintf(xbee->log,"   <-- mask (lsb)");
+        } else if (t == XBEE_16BIT_IO) {
+          if (i == 4)       fprintf(xbee->log,"   <-- sample count");
+          else if (i == 5)  fprintf(xbee->log,"   <-- mask (msb)");
+          else if (i == 6)  fprintf(xbee->log,"   <-- mask (lsb)");
+        }
+        xbee_logIcf();
+      }
+    }
+    i--; /* it went up too many times!... */
+
+    /* add the checksum */
+    chksum += xbee_getbyte(xbee);
+
+    /* check if the whole packet was recieved, or something else occured... unlikely... */
+    if (l>1) {
+      if (xbee->log) {
+        xbee_logE("Didn't get whole packet... :(");
+      }
+      continue;
+    }
+
+    /* check the checksum */
+    if ((chksum & 0xFF) != 0xFF) {
+      if (xbee->log) {
+        chksum &= 0xFF;
+        xbee_logE("Invalid Checksum: 0x%02X",chksum);
+      }
+      continue;
+    }
+
+    /* make a new packet */
+    p = Xcalloc(sizeof(xbee_pkt));
+    q = NULL;
+    p->datalen = 0;
+
+    /* ########################################## */
+    /* if: modem status */
+    if (t == XBEE_MODEM_STATUS) {
+      if (xbee->log) {
+        xbee_logI("Packet type: Modem Status (0x8A)");
+        xbee_logIc("Event: ");
+        switch (d[0]) {
+        case 0x00: fprintf(xbee->log,"Hardware reset"); break;
+        case 0x01: fprintf(xbee->log,"Watchdog timer reset"); break;
+        case 0x02: fprintf(xbee->log,"Associated"); break;
+        case 0x03: fprintf(xbee->log,"Disassociated"); break;
+        case 0x04: fprintf(xbee->log,"Synchronization lost"); break;
+        case 0x05: fprintf(xbee->log,"Coordinator realignment"); break;
+        case 0x06: fprintf(xbee->log,"Coordinator started"); break;
+        }
+        fprintf(xbee->log,"... (0x%02X)",d[0]);
+        xbee_logIcf();
+      }
+      p->type = xbee_modemStatus;
+
+      p->sAddr64 = FALSE;
+      p->dataPkt = FALSE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = TRUE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+
+      /* modem status can only ever give 1 'data' byte */
+      p->datalen = 1;
+      p->data[0] = d[0];
+
+      /* ########################################## */
+      /* if: local AT response */
+    } else if (t == XBEE_LOCAL_AT) {
+      if (xbee->log) {
+        xbee_logI("Packet type: Local AT Response (0x88)");
+        xbee_logI("FrameID: 0x%02X",d[0]);
+        xbee_logI("AT Command: %c%c",d[1],d[2]);
+        xbee_logIc("Status: ");
+        if      (d[3] == 0x00) fprintf(xbee->log,"OK");
+        else if (d[3] == 0x01) fprintf(xbee->log,"Error");
+        else if (d[3] == 0x02) fprintf(xbee->log,"Invalid Command");
+        else if (d[3] == 0x03) fprintf(xbee->log,"Invalid Parameter");
+        fprintf(xbee->log," (0x%02X)",d[3]);
+        xbee_logIcf();
+      }
+      p->type = xbee_localAT;
+
+      p->sAddr64 = FALSE;
+      p->dataPkt = FALSE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+
+      p->frameID = d[0];
+      p->atCmd[0] = d[1];
+      p->atCmd[1] = d[2];
+
+      p->status = d[3];
+
+      /* copy in the data */
+      p->datalen = i-3;
+      for (;i>3;i--) p->data[i-4] = d[i];
+
+      /* ########################################## */
+      /* if: remote AT response */
+    } else if (t == XBEE_REMOTE_AT) {
+      if (xbee->log) {
+        xbee_logI("Packet type: Remote AT Response (0x97)");
+        xbee_logI("FrameID: 0x%02X",d[0]);
+        xbee_logIc("64-bit Address: ");
+        for (j=0;j<8;j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[1+j]);
+        }
+        xbee_logIcf();
+        xbee_logIc("16-bit Address: ");
+        for (j=0;j<2;j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[9+j]);
+        }
+        xbee_logIcf();
+        xbee_logI("AT Command: %c%c",d[11],d[12]);
+        xbee_logIc("Status: ");
+        if      (d[13] == 0x00) fprintf(xbee->log,"OK");
+        else if (d[13] == 0x01) fprintf(xbee->log,"Error");
+        else if (d[13] == 0x02) fprintf(xbee->log,"Invalid Command");
+        else if (d[13] == 0x03) fprintf(xbee->log,"Invalid Parameter");
+        else if (d[13] == 0x04) fprintf(xbee->log,"No Response");
+        fprintf(xbee->log," (0x%02X)",d[13]);
+        xbee_logIcf();
+      }
+      p->type = xbee_remoteAT;
+
+      p->sAddr64 = FALSE;
+      p->dataPkt = FALSE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = TRUE;
+      p->IOPkt = FALSE;
+
+      p->frameID = d[0];
+
+      p->Addr64[0] = d[1];
+      p->Addr64[1] = d[2];
+      p->Addr64[2] = d[3];
+      p->Addr64[3] = d[4];
+      p->Addr64[4] = d[5];
+      p->Addr64[5] = d[6];
+      p->Addr64[6] = d[7];
+      p->Addr64[7] = d[8];
+
+      p->Addr16[0] = d[9];
+      p->Addr16[1] = d[10];
+
+      p->atCmd[0] = d[11];
+      p->atCmd[1] = d[12];
+
+      p->status = d[13];
+
+      p->samples = 1;
+
+      if (p->status == 0x00 && p->atCmd[0] == 'I' && p->atCmd[1] == 'S') {
+        /* parse the io data */
+        xbee_logI("--- Sample -----------------");
+        xbee_parse_io(xbee, p, d, 15, 17, 0);
+        xbee_logI("----------------------------");
+      } else {
+        /* copy in the data */
+        p->datalen = i-13;
+        for (;i>13;i--) p->data[i-14] = d[i];
+      }
+
+      /* ########################################## */
+      /* if: TX status */
+    } else if (t == XBEE_TX_STATUS) {
+      if (xbee->log) {
+        xbee_logI("Packet type: TX Status Report (0x89)");
+        xbee_logI("FrameID: 0x%02X",d[0]);
+        xbee_logIc("Status: ");
+        if      (d[1] == 0x00) fprintf(xbee->log,"Success");
+        else if (d[1] == 0x01) fprintf(xbee->log,"No ACK");
+        else if (d[1] == 0x02) fprintf(xbee->log,"CCA Failure");
+        else if (d[1] == 0x03) fprintf(xbee->log,"Purged");
+        fprintf(xbee->log," (0x%02X)",d[1]);
+        xbee_logIcf();
+      }
+      p->type = xbee_txStatus;
+
+      p->sAddr64 = FALSE;
+      p->dataPkt = FALSE;
+      p->txStatusPkt = TRUE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+
+      p->frameID = d[0];
+
+      p->status = d[1];
+
+      /* never returns data */
+      p->datalen = 0;
+
+      /* check for any connections waiting for a status update */
+      /* lock the connection mutex */
+      xbee_mutex_lock(xbee->conmutex);
+      xbee_logI("Looking for a connection that wants a status update...");
+      con = xbee->conlist;
+      while (con) {
+        if ((con->frameID == p->frameID) &&
+            (con->ACKstatus == 0xFF)) {
+          xbee_logI("Found @ 0x%08X!",con);
+          con->ACKstatus = p->status;
+          xbee_sem_post(con->waitforACKsem);
+        }
+        con = con->next;
+      }
+      
+      /* unlock the connection mutex */
+      xbee_mutex_unlock(xbee->conmutex);
+      
+      /* ########################################## */
+      /* if: 16 / 64bit data recieve */
+    } else if ((t == XBEE_64BIT_DATARX) ||
+               (t == XBEE_16BIT_DATARX)) {
+      int offset;
+      if (t == XBEE_64BIT_DATARX) { /* 64bit */
+        offset = 8;
+      } else { /* 16bit */
+        offset = 2;
+      }
+      if (xbee->log) {
+        xbee_logI("Packet type: %d-bit RX Data (0x%02X)",((t == XBEE_64BIT_DATARX)?64:16),t);
+        xbee_logIc("%d-bit Address: ",((t == XBEE_64BIT_DATARX)?64:16));
+        for (j=0;j<offset;j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[j]);
+        }
+        xbee_logIcf();
+        xbee_logI("RSSI: -%ddB",d[offset]);
+        if (d[offset + 1] & 0x02) xbee_logI("Options: Address Broadcast");
+        if (d[offset + 1] & 0x04) xbee_logI("Options: PAN Broadcast");
+      }
+      p->isBroadcastADR = !!(d[offset+1] & 0x02);
+      p->isBroadcastPAN = !!(d[offset+1] & 0x04);
+      p->dataPkt = TRUE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+
+      if (t == XBEE_64BIT_DATARX) { /* 64bit */
+        p->type = xbee_64bitData;
+
+        p->sAddr64 = TRUE;
+
+        p->Addr64[0] = d[0];
+        p->Addr64[1] = d[1];
+        p->Addr64[2] = d[2];
+        p->Addr64[3] = d[3];
+        p->Addr64[4] = d[4];
+        p->Addr64[5] = d[5];
+        p->Addr64[6] = d[6];
+        p->Addr64[7] = d[7];
+      } else { /* 16bit */
+        p->type = xbee_16bitData;
+
+        p->sAddr64 = FALSE;
+
+        p->Addr16[0] = d[0];
+        p->Addr16[1] = d[1];
+      }
+
+      /* save the RSSI / signal strength
+         this can be used with printf as:
+         printf("-%ddB\n",p->RSSI); */
+      p->RSSI = d[offset];
+
+      p->status = d[offset + 1];
+
+      /* copy in the data */
+      p->datalen = i-(offset + 1);
+      for (;i>offset + 1;i--) p->data[i-(offset + 2)] = d[i];
+
+      /* ########################################## */
+      /* if: 16 / 64bit I/O recieve */
+    } else if ((t == XBEE_64BIT_IO) ||
+               (t == XBEE_16BIT_IO)) {
+      int offset,i2;
+      if (t == XBEE_64BIT_IO) { /* 64bit */
+        p->type = xbee_64bitIO;
+
+        p->sAddr64 = TRUE;
+
+        p->Addr64[0] = d[0];
+        p->Addr64[1] = d[1];
+        p->Addr64[2] = d[2];
+        p->Addr64[3] = d[3];
+        p->Addr64[4] = d[4];
+        p->Addr64[5] = d[5];
+        p->Addr64[6] = d[6];
+        p->Addr64[7] = d[7];
+
+        offset = 8;
+        p->samples = d[10];
+      } else { /* 16bit */
+        p->type = xbee_16bitIO;
+
+        p->sAddr64 = FALSE;
+
+        p->Addr16[0] = d[0];
+        p->Addr16[1] = d[1];
+
+        offset = 2;
+        p->samples = d[4];
+      }
+      if (p->samples > 1) {
+        p = Xrealloc(p, sizeof(xbee_pkt) + (sizeof(xbee_sample) * (p->samples - 1)));
+      }
+      if (xbee->log) {
+        xbee_logI("Packet type: %d-bit RX I/O Data (0x%02X)",((t == XBEE_64BIT_IO)?64:16),t);
+        xbee_logIc("%d-bit Address: ",((t == XBEE_64BIT_IO)?64:16));
+        for (j = 0; j < offset; j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[j]);
+        }
+        xbee_logIcf();
+        xbee_logI("RSSI: -%ddB",d[offset]);
+        xbee_logI("Samples: %d",d[offset + 2]);
+      }
+      i2 = offset + 5;
+
+      /* never returns data */
+      p->datalen = 0;
+
+      p->dataPkt = FALSE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = TRUE;
+
+      /* save the RSSI / signal strength
+         this can be used with printf as:
+         printf("-%ddB\n",p->RSSI); */
+      p->RSSI = d[offset];
+
+      p->status = d[offset + 1];
+
+      /* each sample is split into its own packet here, for simplicity */
+      for (o = 0; o < p->samples; o++) {
+        if (i2 >= i) {
+          xbee_logI("Invalid I/O data! Actually contained %d samples...",o);
+          p = Xrealloc(p, sizeof(xbee_pkt) + (sizeof(xbee_sample) * ((o>1)?o:1)));
+          p->samples = o;
+          break;
+        }
+        xbee_logI("--- Sample %3d -------------", o);
+
+        /* parse the io data */
+        i2 = xbee_parse_io(xbee, p, d, offset + 3, i2, o);
+      }
+      xbee_logI("----------------------------");
+
+      /* ########################################## */
+      /* if: Series 2 Transmit status */
+    } else if (t == XBEE2_TX_STATUS) {
+      if (xbee->log) {
+        xbee_logI("Packet type: Series 2 Transmit Status (0x%02X)", t);
+        xbee_logI("FrameID: 0x%02X",d[0]);
+        xbee_logI("16-bit Delivery Address: %02X:%02X",d[1],d[2]);
+        xbee_logI("Transmit Retry Count: %02X",d[3]);
+        xbee_logIc("Delivery Status: ");
+        if      (d[4] == 0x00) fprintf(xbee->log,"Success");
+        else if (d[4] == 0x02) fprintf(xbee->log,"CCA Failure");
+        else if (d[4] == 0x15) fprintf(xbee->log,"Invalid Destination");
+        else if (d[4] == 0x21) fprintf(xbee->log,"Network ACK Failure");
+        else if (d[4] == 0x22) fprintf(xbee->log,"Not Joined to Network");
+        else if (d[4] == 0x23) fprintf(xbee->log,"Self-Addressed");
+        else if (d[4] == 0x24) fprintf(xbee->log,"Address Not Found");
+        else if (d[4] == 0x25) fprintf(xbee->log,"Route Not Found");
+        else if (d[4] == 0x74) fprintf(xbee->log,"Data Payload Too Large"); /* ??? */
+        fprintf(xbee->log," (0x%02X)",d[4]);
+        xbee_logIcf();
+
+        xbee_logIc("Discovery Status: ");
+        if      (d[5] == 0x00) fprintf(xbee->log,"No Discovery Overhead");
+        else if (d[5] == 0x01) fprintf(xbee->log,"Address Discovery");
+        else if (d[5] == 0x02) fprintf(xbee->log,"Route Discovery");
+        else if (d[5] == 0x03) fprintf(xbee->log,"Address & Route Discovery");
+        fprintf(xbee->log," (0x%02X)",d[5]);
+        xbee_logIcf();
+      }
+
+      p->type = xbee2_txStatus;
+
+      p->sAddr64 = FALSE;
+      p->dataPkt = FALSE;
+      p->txStatusPkt = TRUE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+
+      p->frameID = d[0];
+
+      p->status = d[4];
+
+      /* never returns data */
+      p->datalen = 0;
+
+      /* ########################################## */
+      /* if: Series 2 data recieve */
+    } else if (t == XBEE2_DATARX) {
+      int offset;
+      offset = 10;
+      if (xbee->log) {
+        xbee_logI("Packet type: Series 2 Data Rx (0x%02X)", t);
+        
+        xbee_logIc("64-bit Address: ");
+        for (j=0;j<8;j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[j]);
+        }
+        xbee_logIcf();
+        
+        xbee_logIc("16-bit Address: ");
+        for (j=0;j<2;j++) {
+          fprintf(xbee->log,(j?":%02X":"%02X"),d[j+8]);
+        }
+        xbee_logIcf();
+        
+        if (d[offset] & 0x01) xbee_logI("Options: Packet Acknowledged");
+        if (d[offset] & 0x02) xbee_logI("Options: Packet was a broadcast packet");
+        if (d[offset] & 0x20) xbee_logI("Options: Packet Encrypted");                /* ??? */
+        if (d[offset] & 0x40) xbee_logI("Options: Packet from end device");          /* ??? */
+      }
+      p->dataPkt = TRUE;
+      p->txStatusPkt = FALSE;
+      p->modemStatusPkt = FALSE;
+      p->remoteATPkt = FALSE;
+      p->IOPkt = FALSE;
+      p->type = xbee2_data;
+      p->sAddr64 = TRUE;
+
+      p->Addr64[0] = d[0];
+      p->Addr64[1] = d[1];
+      p->Addr64[2] = d[2];
+      p->Addr64[3] = d[3];
+      p->Addr64[4] = d[4];
+      p->Addr64[5] = d[5];
+      p->Addr64[6] = d[6];
+      p->Addr64[7] = d[7];
+
+      p->Addr16[0] = d[8];
+      p->Addr16[1] = d[9];
+
+      p->status = d[offset];
+
+      /* copy in the data */
+      p->datalen = i - (offset + 1);
+      for (;i>offset;i--) {
+        p->data[i-(offset + 1)] = d[i];
+      }
+
+      /* ########################################## */
+      /* if: Unknown */
+    } else {
+      xbee_logE("Packet type: Unknown (0x%02X)",t);
+      continue;
+    }
+    p->next = NULL;
+
+    /* lock the connection mutex */
+    xbee_mutex_lock(xbee->conmutex);
+
+    hasCon = 0;
+    if (p->isBroadcastADR || p->isBroadcastPAN) {
+      unsigned char t[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+      /* if the packet was broadcast, search for a broadcast accepting connection */
+      con = xbee->conlist;
+      while (con) {
+        if (con->type == p->type && 
+            (con->type == xbee_16bitData || con->type == xbee_64bitData) &&
+            ((con->tAddr64 && !memcmp(con->tAddr,t,8)) ||
+             (!con->tAddr64 && !memcmp(con->tAddr,t,2)))) {
+          hasCon = 1;
+          xbee_logI("Found broadcasting connection @ 0x%08X",con);
+          break;
+        }
+        con = con->next;
+      }
+    }
+    if (!hasCon || !con) {
+      con = xbee->conlist;
+      while (con) {
+        if (xbee_matchpktcon(xbee, p, con)) {
+          hasCon = 1;
+          break;
+        }
+        con = con->next;
+      }
+    }
+
+    /* unlock the connection mutex */
+    xbee_mutex_unlock(xbee->conmutex);
+
+    /* if the packet doesn't have a connection, don't add it! */
+    if (!hasCon) {
+      xbee_logE("Connectionless packet... discarding!");
+      continue;
+    }
+
+    /* if the connection has a callback function then it is passed the packet
+       and the packet is not added to the list */
+    if (con && con->callback) {
+      t_callback_list *l, *q;
+
+      xbee_mutex_lock(con->callbackListmutex);
+      l = con->callbackList;
+      q = NULL;
+      while (l) {
+        q = l;
+        l = l->next;
+      }
+      l = Xcalloc(sizeof(t_callback_list));
+      l->pkt = p;
+      if (!con->callbackList || q == NULL) {
+        con->callbackList = l;
+      } else {
+        q->next = l;
+      }
+      xbee_mutex_unlock(con->callbackListmutex);
+
+      xbee_logI("Using callback function!");
+      xbee_logI("  info block @ 0x%08X",l);
+      xbee_logI("  function   @ 0x%08X",con->callback);
+      xbee_logI("  connection @ 0x%08X",con);
+      xbee_logE("  packet     @ 0x%08X",p);
+
+      /* if the callback thread not still running, then start a new one! */
+      if (!xbee_mutex_trylock(con->callbackmutex)) {
+        xbee_thread_t t;
+        int ret;
+        t_threadList *p, *q;
+        t_CBinfo info;
+        info.xbee = xbee;
+        info.con = con;
+        xbee_log("Starting new callback thread!");
+        if ((ret = xbee_thread_create(t,xbee_callbackWrapper,&info)) != 0) {
+          xbee_mutex_unlock(con->callbackmutex);
+          /* this MAY help with future attempts... */
+          xbee_sem_post(xbee->threadsem);
+          xbee_logS("An error occured while starting thread (%d)... Out of resources?", ret);
+          xbee_logE("This packet has been lost!");
+          continue;
+        }
+        xbee_log("Started thread 0x%08X!", t);
+        xbee_mutex_lock(xbee->threadmutex);
+        p = xbee->threadList;
+        q = NULL;
+        while (p) {
+          q = p;
+          p = p->next;
+        }
+        p = Xcalloc(sizeof(t_threadList));
+        if (q == NULL) {
+          xbee->threadList = p;
+        } else {
+          q->next = p;
+        }
+        p->thread = t;
+        p->next = NULL;
+        xbee_mutex_unlock(xbee->threadmutex);
+      } else {
+        xbee_logE("Using existing callback thread... callback has been scheduled.");
+      }
+      /* prevent the packet from being free'd */
+      p = NULL;
+      continue;
+    }
+
+    /* lock the packet mutex, so we can safely add the packet to the list */
+    xbee_mutex_lock(xbee->pktmutex);
+
+    /* if: the list is empty */
+    if (!xbee->pktlist) {
+      /* start the list! */
+      xbee->pktlist = p;
+    } else if (xbee->pktlast) {
+      /* add the packet to the end */
+      xbee->pktlast->next = p;
+    } else {
+      /* pktlast wasnt set... look for the end and then set it */
+      i = 0;
+      q = xbee->pktlist;
+      while (q->next) {
+        q = q->next;
+        i++;
+      }
+      q->next = p;
+      xbee->pktcount = i;
+    }
+    xbee->pktlast = p;
+    xbee->pktcount++;
+
+    /* unlock the packet mutex */
+    xbee_mutex_unlock(xbee->pktmutex);
+
+    xbee_logI("--========================--");
+    xbee_logE("Packets: %d",xbee->pktcount);
+
+    p = q = NULL;
+  }
+  return 0;
+}
+
+static void xbee_callbackWrapper(t_CBinfo *info) {
+  xbee_hnd xbee;
+  xbee_con *con;
+  xbee_pkt *pkt;
+  t_callback_list *temp;
+  xbee = info->xbee;
+  con = info->con;
+  /* dont forget! the callback mutex is already locked... by the parent thread :) */
+  xbee_mutex_lock(con->callbackListmutex);
+  while (con->callbackList) {
+    /* shift the list along 1 */
+    temp = con->callbackList;
+    con->callbackList = temp->next;
+    xbee_mutex_unlock(con->callbackListmutex);
+    /* get the packet */
+    pkt = temp->pkt;
+
+    xbee_logS("Starting callback function...");
+    xbee_logI("  info block @ 0x%08X",temp);
+    xbee_logI("  function   @ 0x%08X",con->callback);
+    xbee_logI("  connection @ 0x%08X",con);
+    xbee_logE("  packet     @ 0x%08X",pkt);
+    Xfree(temp);
+    if (con->callback) {
+      con->callback(con,pkt);
+      xbee_log("Callback complete!");
+      if (!con->noFreeAfterCB) Xfree(pkt);
+    } else {
+      xbee_pkt *q;
+      int i;
+      xbee_log("Callback function was removed! Appending packet to main list...");
+      /* lock the packet mutex, so we can safely add the packet to the list */
+      xbee_mutex_lock(xbee->pktmutex);
+
+      /* if: the list is empty */
+      if (!xbee->pktlist) {
+        /* start the list! */
+        xbee->pktlist = pkt;
+      } else if (xbee->pktlast) {
+        /* add the packet to the end */
+        xbee->pktlast->next = pkt;
+      } else {
+        /* pktlast wasnt set... look for the end and then set it */
+        i = 0;
+        q = xbee->pktlist;
+        while (q->next) {
+          q = q->next;
+          i++;
+        }
+        q->next = pkt;
+        xbee->pktcount = i;
+      }
+      xbee->pktlast = pkt;
+      xbee->pktcount++;
+
+      /* unlock the packet mutex */
+      xbee_mutex_unlock(xbee->pktmutex);
+    }
+
+    xbee_mutex_lock(con->callbackListmutex);
+  }
+  xbee_mutex_unlock(con->callbackListmutex);
+
+  xbee_log("Callback thread ending...");
+  /* releasing the thread mutex is the last thing we do! */
+  xbee_mutex_unlock(con->callbackmutex);
+
+  if (con->destroySelf) {
+    _xbee_endcon2(xbee,&con,1);
+  }
+  xbee_sem_post(xbee->threadsem);
+}
+
+/* #################################################################
+   xbee_thread_watch - INTERNAL
+   watches for dead threads and tidies up */
+static void xbee_thread_watch(xbee_hnd xbee) {
+
+#ifdef _WIN32 /* ---- */
+  /* win32 requires this delay... no idea why */
+  usleep(1000000);
+#endif /* ----------- */
+
+  xbee_mutex_init(xbee->threadmutex);
+  xbee_sem_init(xbee->threadsem);
+
+  while (xbee->run) {
+    t_threadList *p, *q, *t;
+    xbee_mutex_lock(xbee->threadmutex);
+    p = xbee->threadList;
+    q = NULL;
+    
+    while (p) {
+      t = p;
+      p = p->next;
+      if (!(xbee_thread_tryjoin(t->thread))) {
+        xbee_log("Joined with thread 0x%08X...",t->thread);
+        if (t == xbee->threadList) {
+          xbee->threadList = t->next;
+        } else if (q) {
+          q->next = t->next;
+        }
+        free(t);
+      } else {
+        q = t;
+      }
+    }
+    
+    xbee_mutex_unlock(xbee->threadmutex);
+    xbee_sem_wait(xbee->threadsem);
+    usleep(100000); /* 100ms to allow the thread to end before we try to join */
+  }
+  
+  xbee_mutex_destroy(xbee->threadmutex);
+  xbee_sem_destroy(xbee->threadsem);
+}
+
+
+/* #################################################################
+   xbee_getbyte - INTERNAL
+   waits for an escaped byte of data */
+static unsigned char xbee_getbyte(xbee_hnd xbee) {
+  unsigned char c;
+
+  /* take a byte */
+  c = xbee_getrawbyte(xbee);
+  /* if its escaped, take another and un-escape */
+  if (c == 0x7D) c = xbee_getrawbyte(xbee) ^ 0x20;
+
+  return (c & 0xFF);
+}
+
+/* #################################################################
+   xbee_getrawbyte - INTERNAL
+   waits for a raw byte of data */
+static unsigned char xbee_getrawbyte(xbee_hnd xbee) {
+  int ret;
+  unsigned char c = 0x00;
+
+  /* the loop is just incase there actually isnt a byte there to be read... */
+  do {
+    /* wait for a read to be possible */
+    if ((ret = xbee_select(xbee,NULL)) == -1) {
+      xbee_perror("libxbee:xbee_getrawbyte()");
+      exit(1);
+    }
+    if (!xbee->run) break;
+    if (ret == 0) continue;
+
+    /* read 1 character */
+    if (xbee_read(xbee,&c,1) == 0) {
+      /* for some reason no characters were read... */
+      if (xbee_ferror(xbee) || xbee_feof(xbee)) {
+        xbee_log("Error or EOF detected");
+        fprintf(stderr,"libxbee:xbee_read(): Error or EOF detected\n");
+        exit(1); /* this should have something nicer... */
+      }
+      /* no error... try again */
+      usleep(10);
+      continue;
+    }
+  } while (0);
+
+  return (c & 0xFF);
+}
+
+/* #################################################################
+   _xbee_send_pkt - INTERNAL
+   sends a complete packet of data */
+static int _xbee_send_pkt(xbee_hnd xbee, t_data *pkt, xbee_con *con) {
+  int retval = 0;
+
+  /* lock connection mutex */
+  xbee_mutex_lock(con->Txmutex);
+  /* lock the send mutex */
+  xbee_mutex_lock(xbee->sendmutex);
+  
+  /* write and flush the data */
+  xbee_write(xbee,pkt->data,pkt->length);
+
+  /* unlock the mutex */
+  xbee_mutex_unlock(xbee->sendmutex);
+
+  xbee_logSf();
+  if (xbee->log) {
+    int i,x,y;
+    /* prints packet in hex byte-by-byte */
+    xbee_logIc("TX Packet:");
+    for (i=0,x=0,y=0;i<pkt->length;i++,x--) {
+      if (x == 0) {
+        fprintf(xbee->log,"\n  0x%04X | ",y);
+        x = 0x8;
+        y += x;
+      }
+      if (x == 4) {
+        fprintf(xbee->log,"  ");
+      }
+      fprintf(xbee->log,"0x%02X ",pkt->data[i]);
+    }
+    xbee_logIcf();
+  }
+  xbee_logEf();
+  
+  if (con->waitforACK &&
+      ((con->type == xbee_16bitData) ||
+       (con->type == xbee_64bitData))) {
+    con->ACKstatus = 0xFF; /* waiting */
+    xbee_log("Waiting for ACK/NAK response...");
+    xbee_sem_wait1sec(con->waitforACKsem);
+    switch (con->ACKstatus) {
+      case 0: xbee_log("ACK recieved!"); break;
+      case 1: xbee_log("NAK recieved..."); break;
+      case 2: xbee_log("CCA failure..."); break;
+      case 3: xbee_log("Purged..."); break;
+      case 255: default: xbee_log("Timeout...");
+    }
+    if (con->ACKstatus) retval = 1; /* error */
+  }
+  
+  /* unlock connection mutex */
+  xbee_mutex_unlock(con->Txmutex);
+
+  /* free the packet */
+  Xfree(pkt);
+  
+  return retval;
+}
+
+/* #################################################################
+   xbee_make_pkt - INTERNAL
+   adds delimiter field
+   calculates length and checksum
+   escapes bytes */
+static t_data *xbee_make_pkt(xbee_hnd xbee, unsigned char *data, int length) {
+  t_data *pkt;
+  unsigned int l, i, o, t, x, m;
+  char d = 0;
+
+  /* check the data given isnt too long
+     100 bytes maximum payload + 12 bytes header information */
+  if (length > 100 + 12) return NULL;
+
+  /* calculate the length of the whole packet
+     start, length (MSB), length (LSB), DATA, checksum */
+  l = 3 + length + 1;
+
+  /* prepare memory */
+  pkt = Xcalloc(sizeof(t_data));
+
+  /* put start byte on */
+  pkt->data[0] = 0x7E;
+
+  /* copy data into packet */
+  for (t = 0, i = 0, o = 1, m = 1; i <= length; o++, m++) {
+    /* if: its time for the checksum */
+    if (i == length) d = M8((0xFF - M8(t)));
+    /* if: its time for the high length byte */
+    else if (m == 1) d = M8(length >> 8);
+    /* if: its time for the low length byte */
+    else if (m == 2) d = M8(length);
+    /* if: its time for the normal data */
+    else if (m > 2) d = data[i];
+
+    x = 0;
+    /* check for any escapes needed */
+    if ((d == 0x11) || /* XON */
+        (d == 0x13) || /* XOFF */
+        (d == 0x7D) || /* Escape */
+        (d == 0x7E)) { /* Frame Delimiter */
+      l++;
+      pkt->data[o++] = 0x7D;
+      x = 1;
+    }
+
+    /* move data in */
+    pkt->data[o] = ((!x)?d:d^0x20);
+    if (m > 2) {
+      i++;
+      t += d;
+    }
+  }
+
+  /* remember the length */
+  pkt->length = l;
+
+  return pkt;
+}
diff --git a/thirdParty/libxbee/api.h b/thirdParty/libxbee/api.h
new file mode 100644
index 0000000000000000000000000000000000000000..692bd7b165cfb9f8ae746af583da2f2c3317fd17
--- /dev/null
+++ b/thirdParty/libxbee/api.h
@@ -0,0 +1,254 @@
+/*
+  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)
diff --git a/thirdParty/libxbee/doc/man/man3/libxbee.3.html b/thirdParty/libxbee/doc/man/man3/libxbee.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..57b7f6a0c5721c77483ac1c30a3cd7c266aa78c3
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/libxbee.3.html
@@ -0,0 +1,127 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_con.3.html b/thirdParty/libxbee/doc/man/man3/xbee_con.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..9990d7f2e37d9187140c87fa43d681fce26a4aa7
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_con.3.html
@@ -0,0 +1,26 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_end.3.html b/thirdParty/libxbee/doc/man/man3/xbee_end.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..7eaa6c27017f7865a490d9b428ed84d979714c5a
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_end.3.html
@@ -0,0 +1,27 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_endcon.3.html b/thirdParty/libxbee/doc/man/man3/xbee_endcon.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..d7250a3cc42a2399be2d2f7f85d3a820517256e7
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_endcon.3.html
@@ -0,0 +1,4 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_flushcon.3.html b/thirdParty/libxbee/doc/man/man3/xbee_flushcon.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..1d046d7921238a0569928b2322d5518b29e7a0dd
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_flushcon.3.html
@@ -0,0 +1,4 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_getanalog.3.html b/thirdParty/libxbee/doc/man/man3/xbee_getanalog.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..1883c3262e23af1b6162b3d2c44c983d0cf53eb7
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_getanalog.3.html
@@ -0,0 +1,140 @@
+<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);
+  }
+  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_hasdigital.3.html">xbee_hasdigital</A></B>(3),
+
+<B><A HREF="../man3/xbee_getdigital.3.html">xbee_getdigital</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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_getdigital.3.html b/thirdParty/libxbee/doc/man/man3/xbee_getdigital.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..2df9136221c30ff8335915a7d73f6ee5f91111bf
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_getdigital.3.html
@@ -0,0 +1,134 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_getpacket.3.html b/thirdParty/libxbee/doc/man/man3/xbee_getpacket.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..45063f77369f1abf8072bb1d7e39dfcda77574d4
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_getpacket.3.html
@@ -0,0 +1,130 @@
+<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_getpacket
+<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_pkt *xbee_getpacket(xbee_con *</B><I>con</I><B>);</B>
+
+<P>
+<B>xbee_pkt *xbee_getpacketwait(xbee_con *</B><I>con</I><B>);</B>
+
+
+<A NAME="lbAD">&nbsp;</A>
+<H2>DESCRIPTION</H2>
+
+The
+<B>xbee_getpacket</B>()
+
+function will return the next avaliable packet for the provided connection.
+It takes 1 argument.
+<P>
+The argument
+<I>con</I>
+
+points to a connection made previously with
+<B>xbee_newcon</B>().
+
+<P>
+The
+<B>xbee_getpacketwait</B>()
+
+function behaves the same, but will wait for an internally specified time for a packet to arrive (currently around 1 second).
+<A NAME="lbAE">&nbsp;</A>
+<H2>RETURN VALUE</H2>
+
+Upon successful return, this function returns the packet, having unlinked it from the internal list of packets.
+You must keep hold of the packet until you are finished with it, and then you must
+<B>free</B>()
+
+it to prevent memory leaks.
+<P>
+If a packet was not avaliable for the provided connection, a
+<B>NULL</B>
+
+is returned.
+<P>
+If an error occured a
+<B>NULL</B>
+
+is also returned (though unlikely).
+<P>
+For more information on the structure of the packet, please see
+<B><A HREF="../man3/xbee_pkt.3.html">xbee_pkt</A></B>(3)
+
+<P>
+For information on using callback functions with connections instead, please see
+<B><A HREF="../man3/xbee_con.3.html">xbee_con</A></B>(3)
+
+<A NAME="lbAF">&nbsp;</A>
+<H2>EXAMPLE</H2>
+
+To recieve a packet from a 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) {
+  /* process packet... */
+  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_setup.3.html">xbee_setup</A></B>(3),
+
+<B><A HREF="../man3/xbee_newcon.3.html">xbee_newcon</A></B>(3),
+
+<B><A HREF="../man3/xbee_senddata.3.html">xbee_senddata</A></B>(3),
+
+<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_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">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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_hasanalog.3.html b/thirdParty/libxbee/doc/man/man3/xbee_hasanalog.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..e2c495c41a0ee5bd289201f4d5cfced40434af68
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_hasanalog.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_hasanalog.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_hasdigital.3.html b/thirdParty/libxbee/doc/man/man3/xbee_hasdigital.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..9774f408171e5530962325df7512425f27aff02c
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_hasdigital.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_hasdigital.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_logit.3.html b/thirdParty/libxbee/doc/man/man3/xbee_logit.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..7eaa6c27017f7865a490d9b428ed84d979714c5a
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_logit.3.html
@@ -0,0 +1,27 @@
+<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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_newcon.3.html b/thirdParty/libxbee/doc/man/man3/xbee_newcon.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..32f085b2685782320a34654812647c3898b51a46
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_newcon.3.html
@@ -0,0 +1,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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_nsenddata.3.html b/thirdParty/libxbee/doc/man/man3/xbee_nsenddata.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..3da3c6f217e80896fd86b61a576a2a7285721c2e
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_nsenddata.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_nsenddata.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_pkt.3.html b/thirdParty/libxbee/doc/man/man3/xbee_pkt.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..1859405aa7a94fb1384c2d2ba38b0ca6c4fb89df
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_pkt.3.html
@@ -0,0 +1,107 @@
+<HTML><HEAD><TITLE>Manpage of XBEE_PKT</TITLE>
+</HEAD><BODY>
+<H1>XBEE_PKT</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_pkt
+<A NAME="lbAC">&nbsp;</A>
+<H2>SYNOPSIS</H2>
+
+<B>#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;</B>
+
+
+<A NAME="lbAD">&nbsp;</A>
+<H2>DESCRIPTION</H2>
+
+This is the packet structure. If you want to get more advanced information from connections (such as RSSI) then this is where it lives.
+<P>
+
+<PRE>
+struct xbee_pkt {
+  unsigned char frameID;          /* AT        Status    */
+  unsigned char atCmd[2];         /* AT                  */
+  unsigned char status;           /* AT  Data  Status    */ /* status / options */
+  unsigned char Addr64[8];        /* AT  Data            */
+  unsigned char Addr16[2];        /* AT  Data            */
+  unsigned char data[128];        /* AT  Data            */
+  unsigned char RSSI;             /*     Data            */
+  unsigned int datalen;
+
+  /* X  A5 A4 A3 A2 A1 A0 D8    D7 D6 D5 D4 D3 D2 D1 D0 */
+  unsigned short IOmask;          /*                  IO */
+
+  /* X  X  X  X  X  X  X  D8    D7 D6 D5 D4 D3 D2 D1 D0 */
+  unsigned short IOdata;          /*                  IO */
+
+  /* X  X  X  X  X  D  D  D     D  D  D  D  D  D  D  D  */
+  unsigned short IOanalog[6];     /*                  IO */
+};
+typedef struct xbee_pkt xbee_pkt;
+</PRE>
+
+
+<P>
+Most of these fields are fairly self explanatory, however some need attention brought to them
+and others need explaining. I will touch on the most important here:
+<DL COMPACT>
+<DT><B>atCmd</B>
+
+<DD>
+This is the 2 character identifier for the AT command response you just recieved.
+Of course if you didnt setup an AT connection, you should never see, or try to see data here.
+<DT><B>Addr64</B> and <B>Addr16</B>
+
+<DD>
+These contain the address of the XBee that you recieved the packet from. You should really know this
+because you setup the connection. However remote AT packets will contain both 16 and 64 bit
+addresses.
+<DT><B>data</B>
+
+<DD>
+This is the data you just recieved. Either the AT reponse, or the data from the remote XBee node.
+<DT><B>datalen</B>
+
+<DD>
+Would you be suprised if I told you this is how much data there is?... Dont try and
+<B>printf</B>()
+
+the
+<B>data</B>
+
+as it isn't null terminated. Use this for processing instead.
+
+
+</DL>
+<A NAME="lbAE">&nbsp;</A>
+<H2>AUTHOR</H2>
+
+Attie Grande &lt;<A HREF="mailto:attie@attie.co.uk">attie@attie.co.uk</A>&gt; 
+<A NAME="lbAF">&nbsp;</A>
+<H2>SEE ALSO</H2>
+
+<B><A HREF="../man3/libxbee.3.html">libxbee</A></B>(3),
+
+<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</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">AUTHOR</A><DD>
+<DT><A HREF="#lbAF">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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_senddata.3.html b/thirdParty/libxbee/doc/man/man3/xbee_senddata.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..31baf1c73b44dcb38a0471d1cb3fb5495a53b321
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_senddata.3.html
@@ -0,0 +1,129 @@
+<HTML><HEAD><TITLE>Manpage of XBEE_SENDDATA</TITLE>
+</HEAD><BODY>
+<H1>XBEE_SENDDATA</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_senddata, xbee_vsenddata
+<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_senddata(xbee_con *</B><I>con</I><B>, char *</B><I>format</I><B>, ...);</B>
+
+<P>
+<B>int xbee_nsenddata(xbee_con *</B><I>con</I><B>, char *</B><I>data</I><B>, int </B><I>length</I><B>);</B>
+
+<P>
+<B>#include &lt;<A HREF="file:/usr/include/stdarg.h">stdarg.h</A>&gt;</B>
+
+<P>
+<B>int xbee_vsenddata(xbee_con *</B><I>con</I><B>, char *</B><I>format</I><B>, va_list </B><I>ap</I><B>);</B>
+
+
+<A NAME="lbAD">&nbsp;</A>
+<H2>DESCRIPTION</H2>
+
+The
+<B>xbee_senddata</B>()
+
+function will send data via a provided connection.
+It takes at least 2 arguments, and possibly more depending on the format string.
+<P>
+The argument
+<I>con</I>
+
+points to a connection made previously with
+<B>xbee_newcon</B>().
+
+<P>
+The
+<I>format</I>
+
+string and any following parameters are passed to
+<B>sprintf</B>()
+
+within these functions.
+Please see the
+<B><A HREF="../man3/printf.3.html">printf</A></B>(3)
+
+man page for more information.
+<P>
+If you are using
+<B>xbee_nsenddata</B>()
+
+you must provide a character array of the data, and the data's length.
+<P>
+If you are using
+<B>xbee_vsenddata</B>()
+
+you must provide a va_list. See
+<B><A HREF="../man3/stdarg.3.html">stdarg</A></B>(3).
+
+<A NAME="lbAE">&nbsp;</A>
+<H2>RETURN VALUE</H2>
+
+Upon successful completion, these functions return 0.
+<P>
+If an invalid packet or connection was provided, -1 is returned.
+<P>
+If an unknown error occured, -2 is returned.
+<P>
+If
+<I>con</I>
+
+has
+<I>waitforACK</I>
+
+enabled, then these functions return 1 when an ACK was not recieved within 1 second.
+<A NAME="lbAF">&nbsp;</A>
+<H2>EXAMPLE</H2>
+
+To send the string &quot;Hello World!&quot; through a previously made connection:
+
+<PRE>
+#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
+xbee_senddata(con,&quot;Hello World!&quot;);
+</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_newcon.3.html">xbee_newcon</A></B>(3),
+
+<B><A HREF="../man3/xbee_getpacket.3.html">xbee_getpacket</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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_setup.3.html b/thirdParty/libxbee/doc/man/man3/xbee_setup.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..5b69945a51c1bff7c75d9d21909791f5f934c41e
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_setup.3.html
@@ -0,0 +1,142 @@
+<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">&nbsp;</A>
+<H2>NAME</H2>
+
+xbee_setup
+<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_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">&nbsp;</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">&nbsp;</A>
+<H2>RETURN VALUE</H2>
+
+If any error occures,
+<B>-1</B>
+
+is returned. Otherwise
+<B>0</B>
+
+is returned.
+<A NAME="lbAF">&nbsp;</A>
+<H2>EXAMPLE</H2>
+
+To setup libxbee to use /dev/ttyUSB0 at 57600 baud:
+
+<PRE>
+#include &lt;<A HREF="file:/usr/include/xbee.h">xbee.h</A>&gt;
+if (xbee_setup(&quot;/dev/ttyUSB0&quot;,57600) == -1) {
+  printf(&quot;Oh no...);
+  <A HREF="../man1/exit.1.html">exit</A>(1);
+}
+</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_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">&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>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_setupAPI.3.html b/thirdParty/libxbee/doc/man/man3/xbee_setupAPI.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..158f1857c92583be548fb5d24e1ea8b856284f74
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_setupAPI.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_setupAPI.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_setuplog.3.html b/thirdParty/libxbee/doc/man/man3/xbee_setuplog.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..16accc571339096d89bb449e201a3f56a72e7dc0
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_setuplog.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_setuplog.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_setuplogAPI.3.html b/thirdParty/libxbee/doc/man/man3/xbee_setuplogAPI.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..801cbfaf90d574643d8ed624b7c0838e340df80c
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_setuplogAPI.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_setuplogAPI.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/doc/man/man3/xbee_vsenddata.3.html b/thirdParty/libxbee/doc/man/man3/xbee_vsenddata.3.html
new file mode 100644
index 0000000000000000000000000000000000000000..5a9b7d948c5ed228bbc005c20bb87dab963cea2f
--- /dev/null
+++ b/thirdParty/libxbee/doc/man/man3/xbee_vsenddata.3.html
@@ -0,0 +1,4 @@
+<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>
+<BODY>
+<H1>Invalid Manpage</H1>
+The requested file ./man/man3/xbee_vsenddata.3 is not a valid (unformatted) man page.</BODY></HTML>
diff --git a/thirdParty/libxbee/main.c b/thirdParty/libxbee/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..7dcacafa7e1a02da30b1d9397c34e06509143f9f
--- /dev/null
+++ b/thirdParty/libxbee/main.c
@@ -0,0 +1,229 @@
+/*
+  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 <string.h>
+
+#include "xbee.h"
+
+int main(int argc, char *argv[]) {
+  xbee_con *con, *con2;
+  xbee_pkt *pkt, *p;
+ 
+  if (xbee_setuplog("/dev/ttyUSB0",57600,2) == -1) {
+    perror("xbee_setuplog()");
+    exit(1);
+  }
+  if (argc >= 2 && !strcmp(argv[1],"sleep")) {
+    for (;;) {
+      sleep(86400); /* sleep for a day... forever :) */
+    }
+  }
+
+  /*if ((con = xbee_newcon(NULL,'X',xbee_localAT)) == (void *)-1) {
+    printf("error creating connection...\n");
+    exit(1);
+  }
+
+  while(1){sleep(10);}
+
+  xbee_senddata(con,"CH%c",0x0C);
+  sleep(1);
+  xbee_senddata(con,"ID%c%c",0x33, 0x32);
+  sleep(1);
+  xbee_senddata(con,"DH%c%c%c%c",0x00,0x00,0x00,0x00);
+  sleep(1);
+  xbee_senddata(con,"DL%c%c%c%c",0x00,0x00,0x00,0x00);
+  sleep(1);
+  xbee_senddata(con,"MY%c%c",0x00,0x00);
+  sleep(1);
+  // SH - read only
+  // SL - read only
+  xbee_senddata(con,"RR%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"RN%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"MM%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"NT%c",0x19);
+  sleep(1);
+  xbee_senddata(con,"NO%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"CE%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"SC%c%c",0x1F,0xFE);
+  sleep(1);
+  xbee_senddata(con,"SD%c",0x04);
+  sleep(1);
+  xbee_senddata(con,"A1%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"A2%c",0x00);
+  sleep(1);
+  // AI - read only
+  xbee_senddata(con,"EE%c",0x00);
+  sleep(1);
+  //xbee_senddata(con,"KY%c",0x00);
+  //sleep(1);
+  xbee_senddata(con,"NI%s","TIGGER");
+  sleep(1);
+  xbee_senddata(con,"PL%c",0x04);
+  sleep(1);
+  xbee_senddata(con,"CA%c",0x2C);
+  sleep(1);
+  xbee_senddata(con,"SM%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"ST%c%c",0x13,0x88);
+  sleep(1);
+  xbee_senddata(con,"SP%c%c",0x00,0x00);
+  sleep(1);
+  xbee_senddata(con,"DP%c%c",0x03,0xE8);
+  sleep(1);
+  xbee_senddata(con,"SO%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"BD%c",0x06);
+  sleep(1);
+  xbee_senddata(con,"RO%c",0x03);
+  sleep(1);
+  xbee_senddata(con,"AP%c",0x02);
+  sleep(1);
+  xbee_senddata(con,"PR%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"D8%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D7%c",0x01);
+  sleep(1);
+  xbee_senddata(con,"D6%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D5%c",0x01);
+  sleep(1);
+  xbee_senddata(con,"D4%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D3%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D2%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D1%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"D0%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"IU%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"IT%c",0x01);
+  sleep(1);
+  xbee_senddata(con,"IC%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"IR%c%c",0x00,0x00);
+  sleep(1);
+  xbee_senddata(con,"IA%c%c%c%c%c%c%c%c",0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
+  sleep(1);
+  xbee_senddata(con,"T0%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T1%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T2%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T3%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T4%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T5%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T6%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"T7%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"P0%c",0x01);
+  sleep(1);
+  xbee_senddata(con,"P1%c",0x00);
+  sleep(1);
+  xbee_senddata(con,"PT%c",0xFF);
+  sleep(1);
+  xbee_senddata(con,"RP%c",0x28);
+  sleep(1);
+  // VR - read only
+  // HV - read only
+  // DB - read only
+  // EC - read only
+  // EA - read only
+  // DD - read only
+  xbee_senddata(con,"CT%c",0x64);
+  sleep(1);
+  xbee_senddata(con,"GT%c%c",0x03,0xE8);
+  sleep(1);
+  xbee_senddata(con,"CC%c",0x2B);
+  sleep(1);
+
+  sleep(10);
+  */
+
+  /* test 64bit IO and Data */
+  con =  xbee_newcon('I',xbee_64bitIO,   0x0013A200, 0x403af247);
+  con2 = xbee_newcon('I',xbee_64bitData, 0x0013A200, 0x403af247);
+
+  while (1) {
+    while ((pkt = xbee_getpacket(con)) != NULL) {
+      int i;
+      for (i = 0; i < pkt->samples; i++) {
+        int m;
+        for (m = 0; m <= 8; m++) {
+          if (xbee_hasdigital(pkt,i,m)) printf("D%d: %d  ",m,xbee_getdigital(pkt,i,m));
+        }
+#define Vref 3.23
+        for (m = 0; m <= 5; m++) {
+          if (xbee_hasanalog(pkt,i,m)) printf("A%d: %.2fv  ",m,xbee_getanalog(pkt,i,m,Vref));
+        }
+        printf("\n");
+      }
+      if (xbee_senddata(con2, "the time is %d\r", time(NULL))) {
+	printf("Error: xbee_senddata\n");
+	return 1;
+      }
+      free(pkt);
+      if (p) {
+	switch (p->status) {
+	case 0x01: printf("XBee: txStatus: No ACK\n");      break;
+	case 0x02: printf("XBee: txStatus: CCA Failure\n"); break;
+	case 0x03: printf("XBee: txStatus: Purged\n");      break;
+	}
+	free(p);
+      }
+    }
+    while ((pkt = xbee_getpacket(con2)) != NULL) {
+      printf("he said '%s'\n", pkt->data);
+      if (xbee_senddata(con2, "you said '%s'\r", pkt->data)) {
+	printf("Error: xbee_senddata\n");
+	return 1;
+      }
+      free(pkt);
+      if (p) {
+	switch (p->status) {
+	case 0x01: printf("XBee: txStatus: No ACK\n");      break;
+	case 0x02: printf("XBee: txStatus: CCA Failure\n"); break;
+	case 0x03: printf("XBee: txStatus: Purged\n");      break;
+	}
+	free(p);
+      }
+    }
+    usleep(100);
+  }
+
+  return 0;
+}
diff --git a/thirdParty/libxbee/man/man3/libxbee.3 b/thirdParty/libxbee/man/man3/libxbee.3
new file mode 100644
index 0000000000000000000000000000000000000000..6bcb978f6f26255ee8bd5260d244e63a8730620a
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/libxbee.3
@@ -0,0 +1,91 @@
+.\" 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/>.
+.TH LIBXBEE 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+libxbee
+.SH DESCRIPTION
+libxbee is a C library to aid the use of Series 1 Digi XBee radios running in API mode (AP=2).
+.sp
+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
+.BR libxbee
+!
+.sp
+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:
+.in +4n
+.nf
+http://code.google.com/p/libxbee/
+.fi
+.in
+or contact me (Attie) directly:
+.in +4n
+.nf
+attie@attie.co.uk
+.fi
+.in
+.SH "MAN PAGES"
+Documentation is avaliable via the following man pages, or by example in the 'sample' folder in the SVN repository
+.in +4n
+.sp
+.BR xbee_pkt "(3) - libxbee's packet structure"
+.sp 0
+.BR xbee_con "(3) - libxbee's connection structure"
+.sp
+.BR xbee_setup "(3) - function to setup libxbee (and its variants)"
+.sp 0
+.BR xbee_end "(3) - function to end the libxbee session and close any open handles"
+.sp
+.BR xbee_logit "(3) - function that allows the user to add to the xbee log output"
+.sp
+.BR xbee_newcon "(3) - function to create a new connection"
+.sp 0
+.BR xbee_purgecon "(3) - function to purge packets from a connection"
+.sp 0
+.BR xbee_endcon "(3) - function to end a connection"
+.sp
+.BR xbee_senddata "(3) - function to send data to a remote XBee (and its variants)"
+.sp 0
+.BR xbee_getpacket "(3) - function to get a packet from a connection (and its variants)"
+.sp
+.BR xbee_hasdigital "(3) - function to check if digital sample is in the packet"
+.sp 0
+.BR xbee_getdigital "(3) - function to get digital sample from the packet"
+.sp
+.BR xbee_hasanalog "(3) - function to check if analog sample is in the packet"
+.sp 0
+.BR xbee_getanalog "(3) - function to get the analog sample from the packet"
+.fi
+.in
+.SH "SEE ALSO"
+.BR xbee_pkt (3),
+.BR xbee_con (3),
+.BR xbee_setup (3),
+.BR xbee_end (3),
+.BR xbee_logit (3),
+.BR xbee_newcon (3),
+.BR xbee_flushcon (3),
+.BR xbee_endcon (3),
+.BR xbee_senddata (3),
+.BR xbee_getpacket (3),
+.BR xbee_hasdigital (3),
+.BR xbee_getdigital (3),
+.BR xbee_hasanalog (3),
+.BR xbee_getanalog (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_con.3 b/thirdParty/libxbee/man/man3/xbee_con.3
new file mode 100644
index 0000000000000000000000000000000000000000..37e77050449f6d9365525e0d7df8cb8686e1f26a
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_con.3
@@ -0,0 +1,22 @@
+.\" 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/>.
+.TH LIBXBEE 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+libxbee
+.sp
+This page has not been written yet...
diff --git a/thirdParty/libxbee/man/man3/xbee_end.3 b/thirdParty/libxbee/man/man3/xbee_end.3
new file mode 100644
index 0000000000000000000000000000000000000000..5fd1de51279f51a2b0ec8b137b9731463e0d9732
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_end.3
@@ -0,0 +1,23 @@
+.\" 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/>.
+.TH LIBXBEE 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+libxbee
+.sp
+This page has not been written yet...
+
diff --git a/thirdParty/libxbee/man/man3/xbee_endcon.3 b/thirdParty/libxbee/man/man3/xbee_endcon.3
new file mode 100644
index 0000000000000000000000000000000000000000..e64ccedb26c6eed86c4ec13a5d8cbb107cdd6efe
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_endcon.3
@@ -0,0 +1 @@
+.so man3/xbee_newcon.3
diff --git a/thirdParty/libxbee/man/man3/xbee_flushcon.3 b/thirdParty/libxbee/man/man3/xbee_flushcon.3
new file mode 100644
index 0000000000000000000000000000000000000000..e64ccedb26c6eed86c4ec13a5d8cbb107cdd6efe
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_flushcon.3
@@ -0,0 +1 @@
+.so man3/xbee_newcon.3
diff --git a/thirdParty/libxbee/man/man3/xbee_getanalog.3 b/thirdParty/libxbee/man/man3/xbee_getanalog.3
new file mode 100644
index 0000000000000000000000000000000000000000..f7bc1d0c726036a64c6ace07b4247ccea91e1fcc
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_getanalog.3
@@ -0,0 +1,96 @@
+.\" 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/>.
+.TH XBEE_GETPACKET 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_hasanalog, xbee_getanalog
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "int xbee_hasanalog(xbee_pkt *" pkt ", int " sample ", int " input ");"
+.sp
+.BI "double xbee_getanalog(xbee_pkt *" pkt ", int " sample ", int " input ", double " Vref ");"
+.ad b
+.SH DESCRIPTION
+The
+.BR xbee_hasanalog ()
+function will check the packet for the presence of an analog sample on the specified input.
+.sp
+The
+.BR xbee_getanalog ()
+function will read the packet and return the sample value for the specified analog input.
+.sp
+They both take 3 arguments, with the same purposes.
+.sp
+The argument
+.I pkt
+points to a packet that was previously retrieved with 
+.BR xbee_getpacket ()
+.sp
+The argument
+.I sample
+selects the sample within the packet to use.
+.sp
+The argument
+.I input
+specifies which input you are interested in testing.
+.sp
+.BR xbee_getanalog ()
+also takes a fourth argument that allows you to provide a
+.I Vref
+value. This allows the function to convert the raw ADC value into a voltage for you.
+.SH "RETURN VALUE"
+The
+.BR xbee_hasanalog ()
+function will return
+.B 1
+if the provided packet has sample data for the specified input, otherwise
+.BR 0 .
+.sp
+The
+.BR xbee_getanalog ()
+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
+will be returned if the packet does not contain sample data.
+.sp
+.SH EXAMPLE
+To read sample data from previously made connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_pkt *pkt;
+double Vref = 3.3;
+if ((pkt = xbee_getpacket(con)) != NULL) {
+  if (xbee_hasanalog(pkt,0,0)) {
+    printf("A0 read %fv\\n",xbee_getanalog(pkt,0,0,Vref));
+  } else {
+    printf("No A0 data\\n");
+  }
+  free(pkt);
+}
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_pkt (3),
+.BR xbee_getpacket (3),
+.BR xbee_hasdigital (3),
+.BR xbee_getdigital (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_getdigital.3 b/thirdParty/libxbee/man/man3/xbee_getdigital.3
new file mode 100644
index 0000000000000000000000000000000000000000..4a0af65b50b11759c10080b4f5872995951d2489
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_getdigital.3
@@ -0,0 +1,91 @@
+.\" 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/>.
+.TH XBEE_GETPACKET 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_hasdigital, xbee_getdigital
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "int xbee_hasdigital(xbee_pkt *" pkt ", int " sample ", int " input ");"
+.sp
+.BI "int xbee_getdigital(xbee_pkt *" pkt ", int " sample ", int " input ");"
+.ad b
+.SH DESCRIPTION
+The
+.BR xbee_hasdigital ()
+function will check the packet for the presence of a given sample on the specified input.
+.sp
+The
+.BR xbee_getdigital ()
+function will read the packet and return the sample value for the specified input.
+.sp
+They both take 3 arguments, with the same purposes.
+.sp
+The argument
+.I pkt
+points to a packet that was previously retrieved with 
+.BR xbee_getpacket ()
+.sp
+The argument
+.I sample
+selects the sample within the packet to use.
+.sp
+The argument
+.I input
+specifies which input you are interested in testing.
+.SH "RETURN VALUE"
+The
+.BR xbee_hasdigital ()
+function will return
+.B 1
+if the provided packet has sample data for the specified input, otherwise
+.BR 0 .
+.sp
+The
+.BR xbee_getdigital ()
+function will return
+.B 1
+if the provided packet has sample data for the specified input and the sample was HIGH.
+A
+.B 0
+will be returned if the sample was LOW, or the packet does not contain sample data.
+.sp
+.SH EXAMPLE
+To read sample data from previously made connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_pkt *pkt;
+if ((pkt = xbee_getpacket(con)) != NULL) {
+  if (xbee_hasdigital(pkt,0,0)) {
+    printf("D0 read %d\n",xbee_getdigital(pkt,0));
+  } else {
+    printf("No D0 data\n");
+  }
+  free(pkt);
+}
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_pkt (3),
+.BR xbee_getpacket (3),
+.BR xbee_hasanalog (3),
+.BR xbee_getanalog (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_getpacket.3 b/thirdParty/libxbee/man/man3/xbee_getpacket.3
new file mode 100644
index 0000000000000000000000000000000000000000..a458e49602017c25295ee13bf3766e9b77ca424b
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_getpacket.3
@@ -0,0 +1,88 @@
+.\" 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/>.
+.TH XBEE_GETPACKET 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_getpacket, xbee_getpacketwait
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "xbee_pkt *xbee_getpacket(xbee_con *" con ");"
+.sp
+.BI "xbee_pkt *xbee_getpacketwait(xbee_con *" con ");"
+.ad b
+.SH DESCRIPTION
+The
+.BR xbee_getpacket ()
+function will return the next avaliable packet for the provided connection.
+It takes 1 argument.
+.sp
+The argument
+.I con
+points to a connection made previously with
+.BR xbee_newcon ().
+.sp
+The
+.BR xbee_getpacketwait ()
+function behaves the same, but will wait for an internally specified time for a packet to arrive (currently around 1 second).
+.SH "RETURN VALUE"
+Upon successful return, this function returns the packet, having unlinked it from the internal list.
+You must keep hold of the packet until you are finished with it, and then you must
+.BR free ()
+it to prevent memory leaks.
+.sp
+If a packet was not avaliable for the provided connection, a
+.B NULL
+is returned.
+.sp
+If an error occured a
+.B NULL
+is also returned (though unlikely).
+.sp
+For more information on the structure of the packet, please see
+.BR xbee_pkt (3)
+.sp
+For information on using callback functions with connections instead, please see
+.BR xbee_con (3)
+or
+.B callback.c
+in the SVN sample directory.
+.SH EXAMPLE
+To recieve a packet from a previously made connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_pkt *pkt;
+if ((pkt = xbee_getpacket(con)) != NULL) {
+  /* process packet... */
+  free(pkt);
+}
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_setup (3),
+.BR xbee_newcon (3),
+.BR xbee_senddata (3),
+.BR xbee_pkt (3),
+.BR xbee_con (3),
+.BR xbee_hasDigital (3),
+.BR xbee_getDigital (3),
+.BR xbee_hasAnalog (3),
+.BR xbee_getAnalog (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_hasanalog.3 b/thirdParty/libxbee/man/man3/xbee_hasanalog.3
new file mode 100644
index 0000000000000000000000000000000000000000..402a3f266f409988c87e9e6f2509cf9e4caeaccf
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_hasanalog.3
@@ -0,0 +1 @@
+.so man3/xbee_getanalog.3
diff --git a/thirdParty/libxbee/man/man3/xbee_hasdigital.3 b/thirdParty/libxbee/man/man3/xbee_hasdigital.3
new file mode 100644
index 0000000000000000000000000000000000000000..5557111123b0eb4622ba68b2a88c41426dfa685e
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_hasdigital.3
@@ -0,0 +1 @@
+.so man3/xbee_getdigital.3
diff --git a/thirdParty/libxbee/man/man3/xbee_logit.3 b/thirdParty/libxbee/man/man3/xbee_logit.3
new file mode 100644
index 0000000000000000000000000000000000000000..5fd1de51279f51a2b0ec8b137b9731463e0d9732
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_logit.3
@@ -0,0 +1,23 @@
+.\" 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/>.
+.TH LIBXBEE 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+libxbee
+.sp
+This page has not been written yet...
+
diff --git a/thirdParty/libxbee/man/man3/xbee_newcon.3 b/thirdParty/libxbee/man/man3/xbee_newcon.3
new file mode 100644
index 0000000000000000000000000000000000000000..2ec511278d45f27a7d0267bdf4deb2665d2ec6a0
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_newcon.3
@@ -0,0 +1,152 @@
+.\" 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/>.
+.TH XBEE_NEWCON 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_newcon, xbee_purgecon, xbee_endcon
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "xbee_con *xbee_newcon(unsigned char " frameID ", xbee_types " type ", ...);"
+.sp
+.BI "void xbee_purgecon(xbee_con *" con ");"
+.sp
+.BI "void xbee_endcon(xbee_con *" con ");"
+.ad b
+.SH DESCRIPTION
+The
+.BR xbee_newcon ()
+function will setup a new connection with the specified settings.
+It takes at least 2 arguments, and potentially up to 4 depending on the
+.I type.
+.sp
+.B NOTE:
+Packets will only be collected when they match an active connection.
+You must setup a connection in order to recieve packets.
+.sp
+The argument
+.I frameID
+allows similar functionality to that of TCP/IP port numbers. This is 1 
+.I unsigned char
+(or 8-bit integer) that identifies where the data is coming from or going to.
+.s
+The
+.I type
+specifies the type of connection you would like. The following types are avaliable:
+.TP
+.B xbee_localAT
+communicates AT commands with the local XBee
+.TP
+.B xbee_txStatus
+recieves transmit status information from the local XBee
+.TP
+.B xbee_modemStatus
+recieves modem status information from the local XBee
+.TP
+.B xbee_16bitRemoteAT
+communicates AT commands with a remote node (using 16-bit addressing)
+.TP
+.B xbee_64bitRemoteAT
+communicates AT commands with a remote node (using 64-bit addressing)
+.TP
+.B xbee_16bitData
+sends/recieves data through a remote node (using 16-bit addressing)
+.TP
+.B xbee_64bitData
+sends/recieves data through a remote node (using 64-bit addressing)
+.TP
+.B xbee_16bitIO
+sends/recieves I/O data through a remote node (using 16-bit addressing)
+.TP
+.B xbee_64bitIO
+sends/recieves I/O data through a remote node (using 64-bit addressing)
+.TP
+.B xbee2_data
+sends/recieves data using a Series 2 XBee (uses 64-bit addressing)
+.TP
+.B xbee2_txStatus
+recieves transmit status information from the local Series 2 XBee
+.PP
+If you are using
+.BR xbee_localAT ", " xbee_txStatus ", " xbee2_txStatus " or " xbee_modemStatus
+then only the
+.I frameID
+and
+.I type
+arguments are required.
+.sp
+If you are using any 16-bit connection, you must also specify 1 right aligned integer,
+containing the 16-bit address (e.g. 0x1234).
+.sp
+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.
+.sp
+The
+.BR xbee_purgecon ()
+function is very basic. It removes any packets that have been collected in the buffer for the specified connection.
+.sp
+The
+.BR xbee_endcon ()
+function is used to end a connection. This will stop collecting packets for the given connection, and remove any packets from the buffer.
+.SH "RETURN VALUE"
+A pointer to the connection is returned. A connection can only be made once, using the same
+.I type
+,
+.I frameID
+and address (if needed). The second call using the same parameters will return the same
+connection.
+.sp
+For information on using callback functions for packet handling please see
+.BR xbee_con (3)
+or
+.B callback.c
+in the SVN sample directory.
+.SH EXAMPLE
+To create a local AT connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_con *con;
+con = xbee_newcon('A', xbee_localAT);
+.fi
+.in
+.sp
+To create a 16-bit Data connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_con *con;
+con = xbee_newcon('A', xbee_16bitData, 0x1234);
+.fi
+.in
+.sp
+To create a 64-bit Data connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_con *con;
+con = xbee_newcon('A', xbee_64bitData, 0x0013A200, 0x40081826);
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_setup (3),
+.BR xbee_getpacket (3),
+.BR xbee_con (3),
+.BR xbee_senddata (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_nsenddata.3 b/thirdParty/libxbee/man/man3/xbee_nsenddata.3
new file mode 100644
index 0000000000000000000000000000000000000000..b36885d8542376a90c89c5864563bd12398a3cd0
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_nsenddata.3
@@ -0,0 +1 @@
+.so man3/xbee_senddata.3
diff --git a/thirdParty/libxbee/man/man3/xbee_pkt.3 b/thirdParty/libxbee/man/man3/xbee_pkt.3
new file mode 100644
index 0000000000000000000000000000000000000000..d5e269c13c7b6a702c91d9d341a732d2184b8a60
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_pkt.3
@@ -0,0 +1,79 @@
+.\" 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/>.
+.TH XBEE_PKT 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_pkt
+.SH SYNOPSIS
+.B #include <xbee.h>
+.ad b
+.SH DESCRIPTION
+This is the packet structure. If you want to get more advanced information from connections (such as RSSI) then this is where it lives.
+.sp
+.in +4n
+.nf
+struct xbee_pkt {
+  unsigned char frameID;          /* AT        Status    */
+  unsigned char atCmd[2];         /* AT                  */
+  unsigned char status;           /* AT  Data  Status    */ /* status / options */
+  unsigned char Addr64[8];        /* AT  Data            */
+  unsigned char Addr16[2];        /* AT  Data            */
+  unsigned char data[128];        /* AT  Data            */
+  unsigned char RSSI;             /*     Data            */
+  unsigned int datalen;
+
+  /* X  A5 A4 A3 A2 A1 A0 D8    D7 D6 D5 D4 D3 D2 D1 D0 */
+  unsigned short IOmask;          /*                  IO */
+
+  /* X  X  X  X  X  X  X  D8    D7 D6 D5 D4 D3 D2 D1 D0 */
+  unsigned short IOdata;          /*                  IO */
+
+  /* X  X  X  X  X  D  D  D     D  D  D  D  D  D  D  D  */
+  unsigned short IOanalog[6];     /*                  IO */
+};
+typedef struct xbee_pkt xbee_pkt;
+.fi
+.in
+.sp
+Most of these fields are fairly self explanatory, however some need attention brought to them
+and others need explaining. I will touch on the most important here:
+.TP
+.B atCmd
+This is the 2 character identifier for the AT command response you just recieved.
+Of course if you didnt setup an AT connection, you should never see, or try to see data here.
+.TP
+.BR Addr64 " and " Addr16
+These contain the address of the XBee that you recieved the packet from. You should really know this
+because you setup the connection. However remote AT packets will contain both 16 and 64 bit
+addresses.
+.TP
+.B data
+This is the data you just recieved. Either the AT reponse, or the data from the remote XBee node.
+.TP
+.B datalen
+Would you be suprised if I told you this is how much data there is?... Dont try and
+.BR printf ()
+the
+.B data
+as it isn't null terminated. Use this for processing instead.
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_getpacket (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_purgecon.3 b/thirdParty/libxbee/man/man3/xbee_purgecon.3
new file mode 100644
index 0000000000000000000000000000000000000000..e64ccedb26c6eed86c4ec13a5d8cbb107cdd6efe
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_purgecon.3
@@ -0,0 +1 @@
+.so man3/xbee_newcon.3
diff --git a/thirdParty/libxbee/man/man3/xbee_senddata.3 b/thirdParty/libxbee/man/man3/xbee_senddata.3
new file mode 100644
index 0000000000000000000000000000000000000000..10296bb8c12be3e6ad2c7e4420123a9f9a869ac4
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_senddata.3
@@ -0,0 +1,86 @@
+.\" 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/>.
+.TH XBEE_SENDDATA 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_senddata, xbee_nsenddata, xbee_vsenddata
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "int xbee_senddata(xbee_con *" con ", char *" format ", ...);"
+.sp
+.BI "int xbee_nsenddata(xbee_con *" con ", char *" data ", int " length ");"
+.sp
+.B #include <stdarg.h>
+.sp
+.BI "int xbee_vsenddata(xbee_con *" con ", char *" format ", va_list " ap ");
+.ad b
+.SH DESCRIPTION
+The
+.BR xbee_senddata ()
+function will send data via a provided connection.
+It takes at least 2 arguments, and possibly more depending on the format string.
+.sp
+The argument
+.I con
+points to a connection made previously with
+.BR xbee_newcon ().
+.sp
+The
+.I format
+string and any following parameters are passed to
+.BR snprintf ()
+within these functions.
+Please see the
+.BR printf (3)
+man page for more information.
+.sp
+If you are using
+.BR xbee_nsenddata ()
+you must provide a character array of the data, and the data's length.
+.sp
+If you are using
+.BR xbee_vsenddata ()
+you must provide a va_list. See
+.BR stdarg (3).
+.SH "RETURN VALUE"
+Upon successful completion, these functions return 0.
+.sp
+If an invalid packet or connection was provided, -1 is returned.
+.sp
+If an unknown error occured, -2 is returned.
+.sp
+If
+.I con
+has
+.I waitforACK
+enabled, then these functions return 1 when an ACK was not recieved within 1 second.
+.SH EXAMPLE
+To send the string "Hello World!" through a previously made connection:
+.in +4n
+.nf
+#include <xbee.h>
+xbee_senddata(con,"Hello World!");
+.fi
+.in
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_setup (3),
+.BR xbee_newcon (3),
+.BR xbee_getpacket (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_setup.3 b/thirdParty/libxbee/man/man3/xbee_setup.3
new file mode 100644
index 0000000000000000000000000000000000000000..2628c46f71f4cd59789dfa5636d35293bd83e6d2
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_setup.3
@@ -0,0 +1,108 @@
+.\" 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/>.
+.TH XBEE_SETUP 3  2009-11-01 "GNU" "Linux Programmer's Manual"
+.SH NAME
+xbee_setup, xbee_setuplog, xbee_setupAPI, xbee_setuplogAPI
+.SH SYNOPSIS
+.B #include <xbee.h>
+.sp
+.BI "int xbee_setup(char *" path ", int " baudrate ");"
+.sp
+.BI "int xbee_setuplog(char *" path ", int " baudrate ", int " logfd ");"
+.sp
+.BI "int xbee_setupAPI(char *" path ", int " baudrate ", char " cmdSeq ", int " cmdTime ");"
+.sp
+.BI "int xbee_setuplogAPI(char *" path ", int " baudrate ", int " logfd ", char " cmdSeq ", int " cmdTime ");"
+.ad b
+.SH DESCRIPTION
+.sp
+.B A VERSION OF THIS FUNCTION MUST BE CALLED BEFORE ANY OTHER libxbee FUNCTION!
+The
+.BR xbee_setup ()
+function will setup libxbee so that it can handle an XBee.
+It takes 2 arguments.
+.sp
+The argument
+.I path
+is the path to the serial port that the XBee is connected to (e.g. /dev/ttyUSB0).
+.sp
+The
+.I baudrate
+is the baud rate that the local XBee is configured to run at. The following are avaliable:
+.in +2n
+.nf
+.B 1200
+.B 2400
+.B 4800
+.B 9600
+.B 19200
+.B 38400
+.B 57600
+.BR 115200 " - this is potentially unstable (read the XBee manual to find out why...)"
+.fi
+.in
+.sp
+Using
+.BR xbee_setuplog ()
+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!). NOTE: The file descriptor is
+.BR dup ()'ed
+before use, so you may close it immediately. Providing a value of
+.B 0
+will disable the log output.
+.sp
+Using
+.BR xbee_setupAPI ()
+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
+.BR xbee_end ()
+it will return your XBee to its previous API mode.
+.sp
+Using
+.BR xbee_setuplogAPI ()
+is simply a combination of
+.BR xbee_setuplog ()
+and
+.BR xbee_setupAPI ()
+.SH "RETURN VALUE"
+If any error occures,
+.B -1
+is returned. Otherwise
+.B 0
+is returned.
+.SH EXAMPLE
+To setup libxbee to use /dev/ttyUSB0 at 57600 baud:
+.in +4n
+.nf
+#include <xbee.h>
+if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+  printf("Oh no...\n");
+  exit(1);
+}
+.fi
+.in
+.SH NOTE
+If libxbee is compiled with
+.B DEBUG
+defined, then the log output will ALWAYS be enabled. If no file descriptor is provided, then stderr will be used.
+.SH AUTHOR
+Attie Grande <attie@attie.co.uk> 
+.SH "SEE ALSO"
+.BR libxbee (3),
+.BR xbee_newcon (3),
+.BR xbee_getpacket (3),
+.BR xbee_senddata (3)
diff --git a/thirdParty/libxbee/man/man3/xbee_setupAPI.3 b/thirdParty/libxbee/man/man3/xbee_setupAPI.3
new file mode 100644
index 0000000000000000000000000000000000000000..56a5fcac56acdd751ad631991f2ba13495fc9fea
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_setupAPI.3
@@ -0,0 +1 @@
+.so man3/xbee_setup.3
diff --git a/thirdParty/libxbee/man/man3/xbee_setuplog.3 b/thirdParty/libxbee/man/man3/xbee_setuplog.3
new file mode 100644
index 0000000000000000000000000000000000000000..56a5fcac56acdd751ad631991f2ba13495fc9fea
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_setuplog.3
@@ -0,0 +1 @@
+.so man3/xbee_setup.3
diff --git a/thirdParty/libxbee/man/man3/xbee_setuplogAPI.3 b/thirdParty/libxbee/man/man3/xbee_setuplogAPI.3
new file mode 100644
index 0000000000000000000000000000000000000000..56a5fcac56acdd751ad631991f2ba13495fc9fea
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_setuplogAPI.3
@@ -0,0 +1 @@
+.so man3/xbee_setup.3
diff --git a/thirdParty/libxbee/man/man3/xbee_vsenddata.3 b/thirdParty/libxbee/man/man3/xbee_vsenddata.3
new file mode 100644
index 0000000000000000000000000000000000000000..b36885d8542376a90c89c5864563bd12398a3cd0
--- /dev/null
+++ b/thirdParty/libxbee/man/man3/xbee_vsenddata.3
@@ -0,0 +1 @@
+.so man3/xbee_senddata.3
diff --git a/thirdParty/libxbee/notes/Notepad++ Style.xml b/thirdParty/libxbee/notes/Notepad++ Style.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5e56ab9ce39d3f848af6ea05bc753c76fa08db27
--- /dev/null
+++ b/thirdParty/libxbee/notes/Notepad++ Style.xml	
@@ -0,0 +1,36 @@
+<NotepadPlus>
+    <UserLang name="libxbee" ext="xbl">
+        <Settings>
+            <Global caseIgnored="no" />
+            <TreatAsSymbol comment="no" commentLine="no" />
+            <Prefix words1="no" words2="no" words3="no" words4="no" />
+        </Settings>
+        <KeywordLists>
+            <Keywords name="Delimiters">000000</Keywords>
+            <Keywords name="Folder+"></Keywords>
+            <Keywords name="Folder-"></Keywords>
+            <Keywords name="Operators"></Keywords>
+            <Keywords name="Comment"></Keywords>
+            <Keywords name="Words1">_xbee_nsenddata(): xbee_send_pkt():</Keywords>
+            <Keywords name="Words2">xbee_listen():</Keywords>
+            <Keywords name="Words3">_xbee_logit():</Keywords>
+            <Keywords name="Words4">_xbee_getpacket():</Keywords>
+        </KeywordLists>
+        <Styles>
+            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="KEYWORD1" styleID="5" fgColor="000000" bgColor="D1FFC8" fontStyle="0" />
+            <WordsStyle name="KEYWORD2" styleID="6" fgColor="000000" bgColor="FFDBDB" fontStyle="0" />
+            <WordsStyle name="KEYWORD3" styleID="7" fgColor="000000" bgColor="C7D0FE" fontStyle="0" />
+            <WordsStyle name="KEYWORD4" styleID="8" fgColor="000000" bgColor="FFC1C1" fontStyle="0" />
+            <WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+        </Styles>
+    </UserLang>
+</NotepadPlus>
diff --git a/thirdParty/libxbee/notes/v1-v2.txt b/thirdParty/libxbee/notes/v1-v2.txt
new file mode 100644
index 0000000000000000000000000000000000000000..cb2e1c923dd418a905c61879eecd69ca14118613
--- /dev/null
+++ b/thirdParty/libxbee/notes/v1-v2.txt
@@ -0,0 +1,29 @@
+XBee
+0x8A* Modem Status
+0x08* AT Command
+0x09* AT Command (Queue)
+0x88* AT Command Response
+0x17* Remote AT Command Request
+0x97* Remote AT Command Response
+0x00* Tx Request (64-bit)
+0x01* Tx Request (16-bit)
+0x89* Tx Status
+0x80* Rx Data (64-bit)
+0x81* Rx Data (16-bit)
+
+XBee 2.5
+0x8A* Modem Status
+0x08* AT Command
+0x09* AT Command (Queue)
+0x88* AT Command Response
+0x17* Remote AT Command Request
+0x97* Remote AT Command Response
+0x10* ZigBee Transmit Request
+0x11  Explicit Addressing ZigBee Command Frame
+0x8B* ZigBee Transmit Status
+0x90* ZigBee Recieve Packet
+0x91  ZigBee Explicit Rx
+0x92  ZigBee IO Data Sample Rx
+0x94  Xbee Sensor Read
+0x95  Node Identification
+
diff --git a/thirdParty/libxbee/pdf/api.c.pdf b/thirdParty/libxbee/pdf/api.c.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..dc8c75af3cb7130fa8716de8a733fd3a3fe13ba3
Binary files /dev/null and b/thirdParty/libxbee/pdf/api.c.pdf differ
diff --git a/thirdParty/libxbee/pdf/api.h.pdf b/thirdParty/libxbee/pdf/api.h.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..43d99a493e1864ab981612be1960ae6e71117f56
Binary files /dev/null and b/thirdParty/libxbee/pdf/api.h.pdf differ
diff --git a/thirdParty/libxbee/pdf/main.c.pdf b/thirdParty/libxbee/pdf/main.c.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..4410e6b8e4d9f3a95779694316ce6943da6202e7
Binary files /dev/null and b/thirdParty/libxbee/pdf/main.c.pdf differ
diff --git a/thirdParty/libxbee/pdf/xbee.h.pdf b/thirdParty/libxbee/pdf/xbee.h.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..a4ee0d754dea35167f2c622db520a173d2fcd0e6
Binary files /dev/null and b/thirdParty/libxbee/pdf/xbee.h.pdf differ
diff --git a/thirdParty/libxbee/sample/README b/thirdParty/libxbee/sample/README
new file mode 100644
index 0000000000000000000000000000000000000000..3610d034694527c4111e1e8a08652f882ff26b74
--- /dev/null
+++ b/thirdParty/libxbee/sample/README
@@ -0,0 +1,12 @@
+To use these samples, you must first install libxbee.
+To install, simply type `make install` and provide the root password.
+
+If you cannot install the library for any reason, follow these instructions:
+  http://code.google.com/p/libxbee/wiki/install_libxbee#But_I_can't_install_it!
+
+The compile line can be found at the top of the source files, surrounded by #ifdef
+and #endif. These allow us to run the source file as a shell script. Simply type
+`sh simple.c` to compile the simple sample.
+If you do not have the library installed, you must edit the compile line, or type
+it by hand.
+  gcc <sample_file>.c ../obj/api.o -o <sample_file> -lpthread -lrt
diff --git a/thirdParty/libxbee/sample/analog.c b/thirdParty/libxbee/sample/analog.c
new file mode 100644
index 0000000000000000000000000000000000000000..84069e39a25e3be537c8c94c45b5e55e947147b8
--- /dev/null
+++ b/thirdParty/libxbee/sample/analog.c
@@ -0,0 +1,71 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will output the voltage read from analog 0 */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <xbee.h>
+
+/* set this to the voltage measured between GND and Vref - 3.3 is a good place to start */
+#define Vref 3.3
+
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+  xbee_pkt *pkt;
+  int i;
+
+  /* setup libxbee */
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    return 1;
+  }
+
+  /* get a connection to the remote XBee */
+  con = xbee_newcon('I',xbee_64bitIO, 0x13A200, 0x403CB26A);
+  /* do this forever! */
+  while (1) {
+    /* get as many packets as we can */
+    while ((pkt = xbee_getpacket(con)) != NULL) {
+      for (i = 0; i < pkt->samples; i++) {
+        /* did we get a value for A0? */
+        if (!xbee_hasanalog(pkt,i,0)) {
+          /* there was no data for A0 in the packet */
+          printf("A0: -- No Data --\n");
+          continue;
+        }
+        /* print out the reading in raw, and adjusted */
+        printf("A0: %.0f (~%.2fv)\n",
+               xbee_getanalog(pkt,i,0,0),
+               xbee_getanalog(pkt,i,0,Vref));
+        fflush(stdout);
+      }
+      /* release the packet */
+      free(pkt);
+    }
+    usleep(100);
+  }
+
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/api.c b/thirdParty/libxbee/sample/api.c
new file mode 100644
index 0000000000000000000000000000000000000000..cff70bf1ae9e643b220520753e7cf8493440ac81
--- /dev/null
+++ b/thirdParty/libxbee/sample/api.c
@@ -0,0 +1,42 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will show you how to seup the xbee and ensure that it is in API mode */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <xbee.h>
+
+int main(int argc, char *argv[]) {
+  /* the extra arguments are the CC ('+' by default) and GT (1000) by default AT values */
+  xbee_setuplogAPI("/dev/ttyUSB0",57600,2,'+',1000);
+
+  /* now we can do our stuff! */
+  sleep(10);
+
+  /* calling xbee_end() will return the xbee to its previous API mode */
+  xbee_end();
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/atis.c b/thirdParty/libxbee/sample/atis.c
new file mode 100644
index 0000000000000000000000000000000000000000..66946f184820cf3216089c8d8ffe2a6445523d4d
--- /dev/null
+++ b/thirdParty/libxbee/sample/atis.c
@@ -0,0 +1,81 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will output the voltage read from analog 0 */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <xbee.h>
+
+/* set this to the voltage measured between GND and Vref - 3.3 is a good place to start */
+#define Vref 3.3
+
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+  xbee_pkt *pkt;
+
+  /* setup libxbee */
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    printf("xbee_setup failed...\n");
+    return 1;
+  }
+
+  /* create an AT connection */
+  con = xbee_newcon('I',xbee_64bitRemoteAT,0x13A200,0x403CB26A);
+
+  /* do this forever! */
+  for (;;) {
+    /* request samples now! */
+    xbee_senddata(con,"IS");
+    /* get as many packets as we can */
+    while ((pkt = xbee_getpacketwait(con)) != NULL) {
+      if (pkt) {
+	if (pkt->status != 0x00) {
+	  /* if the return status was not 0x00 (OK) then the request failed... */
+	  printf("Sample A0: -- Request Failed --\n");
+	} else {
+          if (!xbee_hasanalog(pkt,0,0)) {
+            /* there was no data for A0 in the packet */
+            printf("Sample A0: -- No Data --\n");
+          } else {
+            /* it appears that there is sample data for A0! */
+	    printf("Sample A0: %.0f (~%.2fv)\n",
+		   xbee_getanalog(pkt,0,0,0),
+		   xbee_getanalog(pkt,0,0,Vref));
+	  }
+	}
+	/* dont forget to free the packet! */
+	free(pkt);
+      } else {
+	/* couldnt get a packet */
+	printf("Sample A0: -- No Packet Returned --\n");
+      }
+    }
+    /* wait a second for the next sample */
+    sleep(1);
+  }
+  
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/atsetup.c b/thirdParty/libxbee/sample/atsetup.c
new file mode 100644
index 0000000000000000000000000000000000000000..13afbe4169882f94c6de568370c0de3e6a7f3741
--- /dev/null
+++ b/thirdParty/libxbee/sample/atsetup.c
@@ -0,0 +1,157 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will setup certain AT parameters of the local XBee unit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <xbee.h>
+
+/* con        = connection to use
+   cmd        = 2 character command string, eg NI
+   parameter  =  NULL - no parameter
+                !NULL - command parameter, either NULL terminated string, or block of memory
+   length     =  0 - use parameter as NULL terminated string
+                !0 - use 'length' bytes from parameter
+   ret        =  NULL - don't return anything
+                !NULL - pointer to pointer. doAT will allocate memory, you must free it!
+   str        = return data pointer 
+   
+   returns the length of the data in ret, or -ve for error */
+int doAT(xbee_con *con, char *cmd, char *parameter, int length, unsigned char **ret) {
+  xbee_pkt *pkt;
+  if (con->type != xbee_localAT && con->type != xbee_16bitRemoteAT && con->type != xbee_64bitRemoteAT) {
+    printf("Thats not an AT connection!...\n");
+    return -1;
+  }
+  if (strlen(cmd) != 2) {
+    printf("Invalid command: \"%s\"\n",cmd);
+    return -2;
+  }
+  if (parameter == NULL) {
+    xbee_senddata(con,"%s",cmd);
+  } else if (length != 0) {
+    char *tmp;
+    if ((tmp = malloc(1024)) == NULL) {
+      printf("Failed to get memory!\n");
+      return -3;
+    }
+    snprintf(tmp,1024,"%s",cmd);
+    memcpy(&(tmp[2]),parameter,(length>1022)?1022:length);
+    xbee_nsenddata(con,tmp,length+2);
+    free(tmp);
+  } else {
+    xbee_senddata(con,"%s%s",cmd,parameter);
+  }
+  pkt = xbee_getpacketwait(con);
+  if (pkt == NULL) {
+    printf("Failed to set %s!\n",cmd);
+    return -4;
+  }
+  if (pkt->status != 0) {
+    printf("An error occured while setting %s!\n",cmd);
+    return -5;
+  }
+  if (ret && pkt->datalen > 0) {
+    *ret = realloc(*ret,sizeof(char) * (pkt->datalen + 1));
+    memcpy(*ret,pkt->data,pkt->datalen);
+    (*ret)[pkt->datalen] = '\0';
+    free(pkt);
+    return pkt->datalen;
+  }
+  free(pkt);
+  return 0;
+}
+
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+  int ret,i;
+  unsigned char *str = NULL;
+
+  if (argc != 2) {
+    printf("Usage: %s <newname>\n",argv[0]);
+    return 1;
+  }
+
+  /* setup libxbee */
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    printf("xbee_setup failed...\n");
+    return 1;
+  }
+
+  /* create an AT connection */
+  con = xbee_newcon('I',xbee_localAT);
+  /*con = xbee_newcon('I',xbee_64bitRemoteAT,0x13A200,0x403CB26A);*/
+
+  
+  /* get the node's address! */
+  if ((ret = doAT(con,"SH",NULL,0,&str)) < 0) return 1;
+  if (ret == 4) {
+    printf("SH: 0x%02X%02X%02X%02X\n", str[0], str[1], str[2], str[3]);
+  }
+  if ((ret = doAT(con,"SL",NULL,0,&str)) < 0) return 1;
+  if (ret == 4) {
+    printf("SL: 0x%02X%02X%02X%02X\n", str[0], str[1], str[2], str[3]);
+  }
+  
+  /* set the power level - 2 methods, i prefer the first but it generates compile warnings :( */
+  /*if ((ret = doAT(con,"PL",&((unsigned char[]){4}),1,&str)) < 0) return 1;*/
+  /*{
+    char t[] = {0};
+    if ((ret = doAT(con,"PL",t,1,&str)) < 0) return 1;
+  }*/
+  
+  /* get the power level */
+  if ((ret = doAT(con,"PL",NULL,0,&str)) < 0) return 1;
+  if (ret == 1) {
+    printf("PL: 0x%02X\n", str[0]);
+  }
+  
+  /* get NI */
+  if ((ret = doAT(con,"NI",NULL,0,&str)) < 0) return 1;
+  if (ret > 0) {
+    printf("NI: ");
+    for (i = 0; i < ret; i++) {
+      printf("%c",(str[i]>=32 && str[i]<=126)?str[i]:'.');
+    }
+    printf("\n");
+  }
+  
+  printf("Setting NI to '%s': ",(argc!=2)?"MyNode":argv[1]);
+  if ((ret = doAT(con,"NI",(argc!=2)?"MyNode":argv[1],0,NULL)) < 0) return 1;
+  printf("OK\n");
+  
+  if ((ret = doAT(con,"NI",NULL,0,&str)) < 0) return 1;
+  if (ret > 0) {
+    printf("NI: ");
+    for (i = 0; i < ret; i++) {
+      printf("%c",(str[i]>=32 && str[i]<=126)?str[i]:'.');
+    }
+    printf("\n");
+  }
+  
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/callback.c b/thirdParty/libxbee/sample/callback.c
new file mode 100644
index 0000000000000000000000000000000000000000..9e48276b0fcba221e7f294ae07d53822314bd768
--- /dev/null
+++ b/thirdParty/libxbee/sample/callback.c
@@ -0,0 +1,88 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will return any recieved data, using a callback function */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <xbee.h>
+
+void sighandler(int sig) {
+  xbee_pkt *pkt;
+  if (sig == SIGINT) {
+    xbee_end();
+    exit(0);
+  }
+}
+
+void callback(xbee_con *con, xbee_pkt *pkt) {
+  int ret;
+  /* print the recieved data */
+  printf("Rx: %s\n",pkt->data);
+  /* say thank you */
+  if ((ret = xbee_senddata(con,"%s",pkt->data)) != 0) {
+    printf("xbee_senddata: Error %d... Retrying!\n",ret);
+    if ((ret = xbee_senddata(con,"%s",pkt->data)) != 0) {
+      printf("xbee_senddata: Error %d... Data lost!\n",ret);
+    } else {
+      printf("xbee_senddata: Success after retry!\n",ret);
+    }
+  }
+free(pkt);
+}
+
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+  xbee_pkt *pkt, *rpkt;
+
+  /* setup the xbee */
+  //if (xbee_setupAPI("/dev/ttyUSB0",57600,'+',250) == -1) {
+  //if (xbee_setuplogAPI("/dev/ttyUSB0",57600,2,'+',250) == -1) {
+  if (xbee_setuplog("/dev/ttyUSB0",57600,2) == -1) {
+    /* oh no... it failed */
+    printf("xbee_setup() failed...\n");
+    exit(1);
+  }
+
+  /* handle ^C */
+  signal(SIGINT, sighandler);
+
+  /* setup a connection */
+  con = xbee_newcon('I',xbee_64bitData, 0x0013A200, 0x40081826);
+  con->waitforACK = 1;
+  con->callback = callback;
+
+  printf("Waiting...\n");
+
+  /* do nothing forever! */
+  for (;;) {
+    sleep(86400); /* 24hrs */
+  }
+
+  /* shouldn't ever get here but... */
+  return 0;
+}
+
diff --git a/thirdParty/libxbee/sample/digital.c b/thirdParty/libxbee/sample/digital.c
new file mode 100644
index 0000000000000000000000000000000000000000..4b0c9f63310654ae56cdd006b8d443c359b2e505
--- /dev/null
+++ b/thirdParty/libxbee/sample/digital.c
@@ -0,0 +1,146 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will control digital output pins of a chosen node */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <xbee.h>
+
+int mode;
+char bitmask;
+char outputs;
+
+void sighandler(int sig) {
+  if (sig == SIGINT) {
+    xbee_end();
+    exit(0);
+  }
+}
+
+void doneCB(xbee_con *con, xbee_pkt *pkt) {
+  /* this packet should be confirmation... */
+  xbee_end();
+  exit(0);
+}
+void doCB(xbee_con *con, xbee_pkt *pkt) {
+  int i,m;
+  outputs = pkt->IOdata[0].IOdigital;
+  printf("\n                       7 6 5 4 3 2 1 0\n");
+  printf("Current output state: ");
+  for (i = 0; i < 8; i++) {
+    if (xbee_hasdigital(pkt,0,7-i)) {
+      if (xbee_getdigital(pkt,0,7-i)) {
+        printf(" 1");
+      } else {
+        printf(" 0");
+      }
+    } else {
+      printf(" x");
+    }
+  }
+  printf("\n");
+  switch (mode) {
+  case 0: outputs |=  bitmask; break;
+  case 1: outputs &= ~bitmask; break;
+  case 2: default:
+    xbee_end();
+    exit(0);
+  }
+  m = outputs;
+  printf("New output state:     ");
+  for (i = 0; i < 8; i++) {
+    if (xbee_hasdigital(pkt,0,7-i)) {
+      if (m & 0x80) {
+        printf(" 1");
+      } else {
+        printf(" 0");
+      }
+    } else {
+      printf(" x");
+    }
+    m <<= 1;
+  }
+  printf("\n\n");
+  con->callback = doneCB;
+  xbee_senddata(con,"IO%c",outputs);
+}
+
+void usage(char *argv0) {
+  printf("Usage: %s <query>\n",argv0);
+  printf("Usage: %s <on|off> <port[0-7]>[port[0-7]]...\n",argv0);
+  exit(1);
+}
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+
+  if (argc < 2) usage(argv[0]);
+
+  if (!strcasecmp(argv[1],"on")) {
+    mode = 0;
+  } else if (!strcasecmp(argv[1],"off")) {
+    mode = 1;
+  } else if (!strcasecmp(argv[1],"query")) {
+    mode = 2;
+  } else usage(argv[0]);
+
+  if (mode != 2) {
+    int i;
+    char *c;
+    bitmask = 0;
+    c = argv[2];
+    while (*c != '\0') {
+      *c -= '0';
+      if ((*c >= 0) && (*c <= 7)) {
+        bitmask |= 0x01 << *c;
+      } else {
+        usage(argv[0]);
+      }
+      c++;
+    }
+  }
+
+  /* setup libxbee */
+  if (xbee_setupAPI("/dev/ttyUSB0",57600,'+',250) == -1) {
+    return 1;
+  }
+
+  /* handle ^C */
+  signal(SIGINT, sighandler);
+
+  /* get a connection to the remote XBee */
+  con = xbee_newcon('I',xbee_64bitRemoteAT,   0x0013A200, 0x403CB26B);
+  con->waitforACK = 1;
+  con->callback = doCB;
+
+  xbee_senddata(con,"IS");
+
+  /* timeout after 1 second... */
+  sleep(1);
+
+  xbee_end();
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/digitalout.c b/thirdParty/libxbee/sample/digitalout.c
new file mode 100644
index 0000000000000000000000000000000000000000..46db084f1381fba9c34d0ebaadfdbc6905748d19
--- /dev/null
+++ b/thirdParty/libxbee/sample/digitalout.c
@@ -0,0 +1,128 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will control the digital 0 output from the keyboard. Type:
+     0, <RETURN> - off
+     1, <RETURN> - on
+     q, <RETURN> - quit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <xbee.h>
+
+int main(int argc,char *argv[]) {
+  xbee_con *con;
+  xbee_pkt *pkt;
+
+  printf("Hello\n");
+
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    printf("failed to setup xbee\n");
+    return 1;
+  }
+
+  con = xbee_newcon('R',xbee_64bitRemoteAT,0x0013a200,0x403af247);
+  if (!con) {
+    printf("no connection returned\n");
+    return 1;
+  }
+
+  for (;;) {
+
+    xbee_senddata(con,"D0");
+    if ((pkt = xbee_getpacketwait(con)) == NULL) {
+      printf("no packet returned from state probe\n");
+      return 1;
+    }
+
+    if (pkt->status != 0) {
+      printf("state probe failed (ret=0x%02X - ",pkt->status);
+      switch (pkt->status) {
+      case 0x1: printf("Error");             break;
+      case 0x2: printf("Invalid Command");   break;
+      case 0x3: printf("Invalid Parameter"); break;
+      case 0x4: printf("No Response");       break;
+      default:  printf("Unknown");           break;
+      }
+      printf(")\n");
+      return 1;
+    }
+
+    if  (pkt->datalen != 1) {
+      printf("unexpected datalen from state probe\n");
+      return 1;
+    }
+
+    if (pkt->data[0] == 0x05) {
+      printf("this port is currently ON\n");
+    } else if (pkt->data[0] == 0x04) {
+      printf("this port is currently OFF\n");
+    } else {
+      printf("this port is currently in an unknown state\n");
+      return 1;
+    }
+    free(pkt);
+    pkt = NULL;
+
+  recharprompt:
+    printf("--> ");
+  rechar:
+    switch(getchar()) {
+    case 'q': case 'Q':
+      printf("byebye\n");
+      return 0;
+    case '0':
+      printf("turning off...\n");
+      xbee_senddata(con,"D0%c",0x04);
+      break;
+    case '1':
+      printf("turning on...\n");
+      xbee_senddata(con,"D0%c",0x05);
+      break;
+    case '\n': goto rechar;
+    default: goto recharprompt;
+    }
+
+    if ((pkt = xbee_getpacketwait(con)) != NULL) {
+      if (pkt->status != 0) {
+	printf("state set failed (ret=0x%02X - ",pkt->status);
+	switch (pkt->status) {
+	case 0x1: printf("Error");             break;
+	case 0x2: printf("Invalid Command");   break;
+	case 0x3: printf("Invalid Parameter"); break;
+	case 0x4: printf("No Response");       break;
+	default:  printf("Unknown");           break;
+	}
+	printf(")\n");
+	return 1;
+      }
+    }
+
+  }
+
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/multi.c b/thirdParty/libxbee/sample/multi.c
new file mode 100644
index 0000000000000000000000000000000000000000..107f88f6e9b7a570e293e50edf47e63016afc4be
--- /dev/null
+++ b/thirdParty/libxbee/sample/multi.c
@@ -0,0 +1,100 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will make use of multiple instances of libxbee and send messages between the attached XBees */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <xbee.h>
+
+int mode;
+char bitmask;
+char outputs;
+
+xbee_hnd xbee1;
+xbee_hnd xbee2;
+
+void sighandler(int sig) {
+  if (sig == SIGINT) {
+    _xbee_end(xbee1);
+    _xbee_end(xbee2);
+    exit(0);
+  }
+}
+
+void xbee1CB(xbee_con *con, xbee_pkt *pkt) {
+  char data[128];
+  snprintf(data,pkt->datalen+1,"%s",pkt->data);
+  printf("XBee1: Rx[%3d]: %s\n",pkt->datalen,data);
+}
+
+void xbee2CB(xbee_con *con, xbee_pkt *pkt) {
+  char data[128];
+  snprintf(data,pkt->datalen+1,"%s",pkt->data);
+  printf("XBee2: Rx[%3d]: %s\n",pkt->datalen,data);
+}
+
+int main(int argc, char *argv[]) {
+  xbee_con *con1;
+  xbee_con *con2;
+
+  if (!(xbee1 = _xbee_setuplogAPI("/dev/ttyUSB0",57600,3,'+',250))) {
+  //if (!(xbee1 = _xbee_setupAPI("/dev/ttyUSB0",57600,'+',250))) {
+    printf("xbee1: setup error...\n");
+    return 1;
+  }
+  if (!(xbee2 = _xbee_setuplogAPI("/dev/ttyUSB1",57600,4,'+',250))) {
+  //if (!(xbee2 = _xbee_setupAPI("/dev/ttyUSB1",57600,'+',250))) {
+    printf("xbee2: setup error...\n");
+    return 1;
+  }
+
+  /* handle ^C */
+  signal(SIGINT, sighandler);
+
+  con1 = _xbee_newcon(xbee1,'1',xbee_64bitData,   0x0013A200, 0x40081826);
+  con1->waitforACK = 1;
+  con1->callback = xbee1CB;
+  
+  con2 = _xbee_newcon(xbee2,'2',xbee_64bitData,   0x0013A200, 0x404B75DE);
+  con2->waitforACK = 1;
+  con2->callback = xbee2CB;
+
+  while (1) {
+    printf("xbee1: Tx\n");
+    _xbee_logit(xbee1,"xbee1: Tx");
+    _xbee_logit(xbee2,"xbee1: Tx");
+    _xbee_senddata(xbee1,con1,"Hello");
+    usleep(1000000);
+    printf("xbee2: Tx\n");
+    _xbee_logit(xbee1,"xbee2: Tx");
+    _xbee_logit(xbee2,"xbee2: Tx");
+    _xbee_senddata(xbee2,con2,"Hi There!");
+    usleep(1000000);
+  }
+  
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/scan.c b/thirdParty/libxbee/sample/scan.c
new file mode 100644
index 0000000000000000000000000000000000000000..4546887f9e541782a5b512213ffe72860185f359
--- /dev/null
+++ b/thirdParty/libxbee/sample/scan.c
@@ -0,0 +1,144 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will scan the currently configured channel for all nodes,
+   returning the values of a few useful settings */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <unistd.h>
+#include <xbee.h>
+
+#define MAXNODES 100
+
+int main(int argc, char *argv[]) {
+  int i;
+  int saidfull = 0;
+  int ATNT = 0x19; /* node discover timeout */
+  int ATNTc; /* counter */
+
+  int nodes = 0;
+  char addrs[MAXNODES][8];
+
+  xbee_con *con;
+  xbee_pkt *pkt, *rpkt;
+
+  time_t ttime;
+  char stime[32];
+
+  /* setup libxbee */
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    return 1;
+  }
+
+  /* grab a local AT connection */
+  con = xbee_newcon('I',xbee_localAT);
+
+  /* get the ND timeout */
+  xbee_senddata(con,"NT");
+  if ((rpkt = xbee_getpacketwait(con)) == NULL) {
+    printf("XBee didnt return a result for NT\n");
+    return 1;
+  }
+  ATNT = rpkt->data[0];
+  free(rpkt);
+
+  while (1) {
+    /* send a ND - Node Discover request */
+    xbee_senddata(con,"ND");
+    /* only wait for a bit longer than the ND timeout */
+    ATNTc = ATNT + 10;
+    /* loop until the end packet has been received or timeout reached */
+    while (ATNTc--) {
+      /* get a packet */
+      pkt = xbee_getpacketwait(con);
+      /* check a packet was returned, and that its one we are after... */
+      if (pkt && !memcmp(pkt->atCmd,"ND",2)) {
+        /* is this the end packet? you can tell from the 0 datalen */
+        if (pkt->datalen == 0) {
+          /* free the packet */
+          free(pkt);
+          break;
+        } else {
+          /* check if we know this node already */
+          for (i = 0; i < nodes; i++) {
+            /* the 64bit address will match one in the list */
+            if (!memcmp(&(pkt->data[2]),&(addrs[i]),8)) break;
+          }
+          ttime = time(NULL);
+          strftime(stime,32,"%I:%M:%S %p",gmtime(&ttime));
+          /* is there space for another? */
+          if ((i == nodes) &&
+              (nodes == MAXNODES) &&
+              (!saidfull)) {
+            printf("MAXNODES reached... Can't add more...\r");
+            /* flush so the change is seen! */
+            fflush(stdout);
+            saidfull = 1;
+          } else {
+            /* is this a rewrite? */
+            if (i != nodes) {
+              /* find the line to edit */
+              printf("%c[%dA",27,nodes-i);
+              /* clear the line */
+              printf("%c[2K",27);
+            }
+            /* write out the info */
+            memcpy(&(addrs[nodes]),&(pkt->data[2]),8);
+            printf("MY: 0x%02X%02X    ",pkt->data[0],pkt->data[1]);
+            printf("SH: 0x%02X%02X%02X%02X    ",pkt->data[2],pkt->data[3],pkt->data[4],pkt->data[5]);
+            printf("SL: 0x%02X%02X%02X%02X    ",pkt->data[6],pkt->data[7],pkt->data[8],pkt->data[9]);
+            printf("dB: -%2d    ",pkt->data[10]);
+            printf("NI: %-20s    ",&(pkt->data[11]));
+            printf("@: %s",stime);
+            /* is this a rewrite? */
+            if (i != nodes) {
+              /* go back the the bottom */
+              printf("%c[%dB\r",27,nodes-i);
+            } else {
+              /* new line is only wanted for new nodes */
+              printf("\n");
+              /* if not, then add 1 to the number of nodes! */
+              nodes++;
+            }
+          }
+          /* flush so the change is seen! */
+          fflush(stdout);
+        }
+        /* free the packet */
+        free(pkt);
+      }
+      /* sleep for 100ms (same as NT steps) */
+      usleep(100000);
+    }
+    /* try again! */
+    usleep(100000);
+  }
+
+  return 0;
+}
+
diff --git a/thirdParty/libxbee/sample/scan_adv.c b/thirdParty/libxbee/sample/scan_adv.c
new file mode 100644
index 0000000000000000000000000000000000000000..d3360222cc690f23d6032b6919072ec7377a1664
--- /dev/null
+++ b/thirdParty/libxbee/sample/scan_adv.c
@@ -0,0 +1,589 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will scan all possible channels for remote nodes and return
+   the value of a few useful settings */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <xbee.h>
+
+#define MAXNODES 100
+
+int ATCH = 0x0C; /* origional channel number */
+int ATNT = 0x19; /* node discover timeout */
+int ATNTc; /* node discover timeout counter */
+int BREAK = 0;
+xbee_con *con;
+
+void sighandler(int sig) {
+  xbee_pkt *pkt;
+  if (sig == SIGINT) {
+    BREAK = 1;
+    /* wait for the rest of the timeout... */
+    printf("\r%c[2KWaiting for node discover command to timeout...",27);
+    fflush(stdout);
+    for (; ATNTc; ATNTc--) {
+      usleep(100000);
+    }
+    /* Restore the XBee's channel setting */
+    printf("\r%c[2KRestoring channel to 0x%02X...",27,ATCH);
+    fflush(stdout);
+    if (xbee_senddata(con,"CH%c",ATCH)) {
+      printf("xbee_senddata: Error\n");
+      exit(1);
+    }
+    if ((pkt = xbee_getpacketwait(con)) == NULL) {
+      printf("\r%c[2K*** XBee didnt return a result for CH... ***\nPlease manually reset your channel to 0x%02X\n",27,ATCH);
+    }
+    if (pkt->status) {
+      printf("\r%c[2K*** An error occured while restoring the channel setting... ***\nPlease manually reset your channel to 0x%02X\n",27,ATCH);
+    } else {
+      printf("\nDone!\n");
+    }
+    free(pkt);
+    /* Restore the terminal */
+    printf("%c[?25h%c[0m",27,27);
+    fflush(stdout);
+    exit(0);
+  }
+}
+
+int main(int argc, char *argv[]) {
+  int i;
+  int saidfull = 0;
+  int ATCHc; /* current channel number */
+  int XBeePro = 0; /* XBee pro? */
+
+  int nodes = 0;
+  unsigned char addrs[MAXNODES][19]; /* 0-7  : 64 bit address
+					8    : channel
+					9-10 : id
+					11   : baud
+					12   : API
+					13-14: HV
+					15-16: VR
+					17   : CC
+					18   : mask - not address */
+
+  xbee_pkt *pkt, *rpkt;
+
+  time_t ttime;
+  char stime[32];
+
+  /* handle ^C */
+  signal(SIGINT, sighandler);
+
+  /* setup libxbee */
+  if (xbee_setupAPI("/dev/ttyUSB0",57600,'+',250) == -1) {
+    return 1;
+  }
+
+  /* grab a local AT connection */
+  con = xbee_newcon('I',xbee_localAT);
+
+  /* get the current channel */
+  if (xbee_senddata(con,"CH")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("XBee didnt return a result for CH\n");
+    return 1;
+  }
+  ATCH = pkt->data[0];
+  free(pkt);
+
+  /* XBee     - 0x0B - 0x1A
+     XBee Pro - 0x0C - 0x17 */
+  if (xbee_senddata(con,"CH%c",0x0B)) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("XBee didnt return a result for CH\n");
+    return 1;
+  }
+  /* did that fail? */
+  if (pkt->status == 0) {
+    /* nope.. its not a pro */
+    printf("Using XBee (not Pro) channels (0x0B - 0x1A)...\n");
+    XBeePro = 0;
+    ATCHc = 0x0B;
+  } else {
+    /* yup... its a pro */
+    printf("Using XBee Pro channels (0x0C - 0x17)...\n");
+    XBeePro = 1;
+    ATCHc = 0x0C;
+  }
+  free(pkt);
+
+  /* find and print data for the local node */
+  printf("\n%c[31mCH:%c[32m 0x%02X    ",27,27,ATCH);
+  if (xbee_senddata(con,"ID")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for ID\n");
+    return 1;
+  }
+  printf("%c[31mID:%c[32m 0x%02X%02X    ",27,27,pkt->data[0],pkt->data[1]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"MY")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for MY\n");
+    return 1;
+  }
+  printf("%c[31mMY:%c[32m 0x%02X%02X    ",27,27,pkt->data[0],pkt->data[1]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"SH")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for SH\n");
+    return 1;
+  }
+  printf("%c[31mSH:%c[32m 0x%02X%02X%02X%02X    ",27,27,pkt->data[0],pkt->data[1],pkt->data[2],pkt->data[3]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"SL")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for SL\n");
+    return 1;
+  }
+  printf("%c[31mSL:%c[32m 0x%02X%02X%02X%02X    ",27,27,pkt->data[0],pkt->data[1],pkt->data[2],pkt->data[3]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"BD")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for BD\n");
+    return 1;
+  }
+  printf("%c[31mBD:%c[32m ",27,27);
+  /* print the baud rate */
+  switch (pkt->data[3]) {
+  case 0:  printf("  1200"); break;
+  case 1:  printf("  2400"); break;
+  case 2:  printf("  4800"); break;
+  case 3:  printf("  9600"); break;
+  case 4:  printf(" 19200"); break;
+  case 5:  printf(" 38400"); break;
+  case 6:  printf(" 57600"); break;
+  case 7:  printf("115200"); break;
+  default: printf(" other"); break;
+  }
+  printf("    ");
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"AP")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for AP\n");
+    return 1;
+  }
+  printf("%c[31mAP:%c[32m 0x%02X    ",27,27,pkt->data[0]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"HV")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for HV\n");
+    return 1;
+  }
+  printf("%c[31mHV:%c[32m 0x%02X%02X    ",27,27,pkt->data[0],pkt->data[1]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"VR")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for VR\n");
+    return 1;
+  }
+  printf("%c[31mVR:%c[32m 0x%02X%02X    ",27,27,pkt->data[0],pkt->data[1]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"CC")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for CC\n");
+    return 1;
+  }
+  printf("%c[31mCC:%c[32m '%c' (0x%02X)    ",27,27,pkt->data[0],pkt->data[0]);
+  free(pkt);
+  /* ### */
+  if (xbee_senddata(con,"NI")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("\nXBee didnt return a result for NI\n");
+    return 1;
+  }
+  printf("%c[31mNI:%c[32m %-20s   ",27,27,pkt->data);
+  free(pkt);
+  /* ### */
+  printf("%c[95m* This is the lobal XBee *",27);
+
+  printf("%c[34m\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------%c[0m\n\n",27,27);
+
+  /* get the ND timeout */
+  if (xbee_senddata(con,"NT")) {
+    printf("xbee_senddata: Error\n");
+    return 1;
+  }
+  if ((pkt = xbee_getpacketwait(con)) == NULL) {
+    printf("XBee didnt return a result for NT\n");
+    return 1;
+  }
+  ATNT = pkt->data[0];
+  free(pkt);
+
+  printf("%c[?25l",27);
+  fflush(stdout);
+
+  usleep(100000);
+
+  while (!BREAK) {
+    /* set the channel to scan */
+    if (xbee_senddata(con,"CH%c",ATCHc)) {
+      printf("xbee_senddata: Error\n");
+      return 1;
+    }
+    pkt = xbee_getpacketwait(con);
+    if (!pkt || pkt->status) {
+      printf("\nXBee didnt return a result for CH\n");
+      return 1;
+    }
+    free(pkt);
+    printf("%c[2KScanning channel 0x%02X...\r",27,ATCHc);
+    fflush(stdout);
+    /* send a ND - Node Discover request */
+    if (!xbee_senddata(con,"ND")) {
+      /* only wait for a bit longer than the ND timeout */
+      ATNTc = ATNT + 10;
+      /* loop until the end packet has been received or timeout reached */
+      while (!BREAK && ATNTc--) {
+	/* get a packet */
+	pkt = xbee_getpacket(con);
+	/* check a packet was returned, and that its one we are after... */
+	if (pkt && !memcmp(pkt->atCmd,"ND",2)) {
+	  /* is this the end packet? you can tell from the 0 datalen */
+	  if (pkt->datalen == 0) {
+	    /* free the packet */
+	    free(pkt);
+	    break;
+	  } else {
+	    /* check if we know this node already */
+	    for (i = 0; i < nodes; i++) {
+	      /* the 64bit address will match one in the list */
+	      if (!memcmp(&(pkt->data[2]),&(addrs[i][0]),8)) break;
+	    }
+	    ttime = time(NULL);
+	    strftime(stime,32,"%I:%M:%S %p",gmtime(&ttime));
+	    /* is there space for another? */
+	    if ((i == nodes) &&
+		(nodes == MAXNODES) &&
+		(!saidfull)) {
+	      printf("%c[2KMAXNODES reached... Can't add more...\r",27);
+	      /* flush so the change is seen! */
+	      fflush(stdout);
+	      saidfull = 1;
+	    } else {
+	      /* is this a rewrite? */
+	      if (i != nodes) {
+		/* find the line to edit */
+		printf("%c[%dA",27,nodes-i+1);
+		/* clear the line */
+		printf("%c[2K",27);
+	      } else {
+		/* fill the blank line */
+		printf("%c[%dA",27,1);
+	      }
+	      /* save the channel */
+	      addrs[i][8] = ATCHc;
+	      /* write out the info */
+	      printf("%c[31mCH:%c[32m 0x%02X    ",27,27,ATCHc);
+	      printf("%c[31mID:%c[32m 0x",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x80)) {
+		printf("....");
+	      } else {
+		printf("%02X%02X",addrs[i][9],addrs[i][10]);
+	      }
+	      printf("    ");
+	      printf("%c[31mMY:%c[32m 0x%02X%02X    ",27,27,pkt->data[0],pkt->data[1]);
+	      printf("%c[31mSH:%c[32m 0x%02X%02X%02X%02X    ",27,27,pkt->data[2],pkt->data[3],pkt->data[4],pkt->data[5]);
+	      printf("%c[31mSL:%c[32m 0x%02X%02X%02X%02X    ",27,27,pkt->data[6],pkt->data[7],pkt->data[8],pkt->data[9]);
+	      printf("%c[31mBD:%c[32m ",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x40)) {
+		printf("......");
+	      } else {
+		switch (addrs[i][11]) {
+		case 0:  printf("  1200"); break;
+		case 1:  printf("  2400"); break;
+		case 2:  printf("  4800"); break;
+		case 3:  printf("  9600"); break;
+		case 4:  printf(" 19200"); break;
+		case 5:  printf(" 38400"); break;
+		case 6:  printf(" 57600"); break;
+		case 7:  printf("115200"); break;
+		default: printf(" other"); break;
+		}
+	      }
+	      printf("    ");
+	      printf("%c[31mAP:%c[32m 0x",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x20)) {
+		printf("..");
+	      } else {
+		printf("%02X",addrs[i][12]);
+	      }
+	      printf("    ");
+	      printf("%c[31mHV:%c[32m 0x",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x10)) {
+		printf("....");
+	      } else {
+		printf("%02X%02X",addrs[i][13],addrs[i][14]);
+	      }
+	      printf("    ");
+	      printf("%c[31mVR:%c[32m 0x",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x08)) {
+		printf("....");
+	      } else {
+		printf("%02X%02X",addrs[i][15],addrs[i][16]);
+	      }
+	      printf("    ");
+	      printf("%c[31mCC:%c[32m ",27,27);
+	      if (i == nodes || !(addrs[i][18] & 0x04)) {
+		printf(" .  (0x..)");
+	      } else {
+		printf("'%c' (0x%02X)",addrs[i][17],addrs[i][17]);
+	      }
+	      printf("    ");
+	      printf("%c[31mNI:%c[32m %-20s    ",27,27,&(pkt->data[11]));
+	      printf("%c[31mdB:%c[32m -%2d    ",27,27,pkt->data[10]);
+	      printf("%c[31m@:%c[32m %s",27,27,stime);
+	      /* is this a rewrite? */
+	      if (i != nodes) {
+		/* go back the the bottom */
+		printf("%c[%dB\r",27,nodes-i+1);
+	      } else {
+		/* if its new... save the address */
+		memcpy(&(addrs[nodes][0]),&(pkt->data[2]),8);
+		/* turn off all the flags */
+		addrs[nodes][18] = 0;
+		/* new line is only wanted for new nodes */
+		printf("\n%c[2K\n%c[0m",27,27);
+		/* if not, then add 1 to the number of nodes! */
+		nodes++;
+	      }
+	      printf("%c[0m%c[2KScanning channel 0x%02X...\r",27,27,ATCHc);
+	      fflush(stdout);
+	    }
+	    /* flush so the change is seen! */
+	    fflush(stdout);
+	  }
+	  /* free the packet */
+	  free(pkt);
+	}
+	/* sleep for 100ms (same as NT steps */
+	usleep(100000);
+      }
+    }
+    fflush(stdout);
+    /* check for all nodes on this channel, and get thier pan id */
+    for (i = 0; i < nodes; i++) {
+      int first = 1;
+      if (addrs[i][8] == ATCHc) {
+	xbee_con *tcon;
+	unsigned int dh,dl;
+	if (first) {
+	  printf("%c[2KGathering settings for nodes on channel 0x%02X...\r",27,ATCHc);
+	  first = 0;
+	}
+	/* get the address, and turn it the right way up! */
+	memcpy(&dh,&(addrs[i][0]),4);
+	dh = ((dh & 0xFF) << 24) | ((dh & 0xFF00) << 8) | ((dh & 0xFF0000) >> 8) | ((dh & 0xFF000000) >> 24);
+	memcpy(&dl,&(addrs[i][4]),4);
+	dl = ((dl & 0xFF) << 24) | ((dl & 0xFF00) << 8) | ((dl & 0xFF0000) >> 8) | ((dl & 0xFF000000) >> 24);
+	/* setup a connection the the remote node */
+	if ((tcon = xbee_newcon('I',xbee_64bitRemoteAT,dh,dl)) != NULL) {
+	  /* find the line to edit */
+	  printf("\r%c[%dA",27,nodes-i+1);
+
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"ID")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the ID column */
+	    printf("\r%c[18C",27);
+	    /* print the ID */
+	    printf("%c[32m%02X%02X%c[0m",27,rpkt->data[0],rpkt->data[1],27);
+	    addrs[i][9] = rpkt->data[0];
+	    addrs[i][10] = rpkt->data[1];
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x80;
+	    free(rpkt);
+	  }
+
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"BD")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the BD column */
+	    printf("\r%c[80C",27);
+	    if ((rpkt->data[0] != 0x00) || (rpkt->data[1] != 0x00) || (rpkt->data[2] != 0x00) || ((rpkt->data[3] & 0xF8) != 0x00)) {
+	      addrs[i][11] = 8;
+	    } else {
+	      addrs[i][11] = rpkt->data[3];
+	    }
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x40;
+	    /* print the baud rate */
+	    printf("%c[32m",27);
+	    switch (addrs[i][11]) {
+	    case 0:  printf("  1200"); break;
+	    case 1:  printf("  2400"); break;
+	    case 2:  printf("  4800"); break;
+	    case 3:  printf("  9600"); break;
+	    case 4:  printf(" 19200"); break;
+	    case 5:  printf(" 38400"); break;
+	    case 6:  printf(" 57600"); break;
+	    case 7:  printf("115200"); break;
+	    default: printf(" other"); break;
+	    }
+	    printf("%c[0m",27);
+	    free(rpkt);
+	  }
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"AP")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the AP column */
+	    printf("\r%c[96C",27);
+	    /* print the ID */
+	    printf("%c[32m%02X%c[0m",27,rpkt->data[0],27);
+	    addrs[i][12] = rpkt->data[0];
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x20;
+	    free(rpkt);
+	  }
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"HV")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the HV column */
+	    printf("\r%c[108C",27);
+	    /* print the ID */
+	    printf("%c[32m%02X%02X%c[0m",27,rpkt->data[0],rpkt->data[1],27);
+	    addrs[i][13] = rpkt->data[0];
+	    addrs[i][14] = rpkt->data[1];
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x10;
+	    free(rpkt);
+	  }
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"VR")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the VR column */
+	    printf("\r%c[122C",27);
+	    /* print the ID */
+	    printf("%c[32m%02X%02X%c[0m",27,rpkt->data[0],rpkt->data[1],27);
+	    addrs[i][15] = rpkt->data[0];
+	    addrs[i][16] = rpkt->data[1];
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x08;
+	    free(rpkt);
+	  }
+	  /* in this case we dont care if we dont get a response packet... */
+	  if (xbee_senddata(tcon,"CC")) {
+	    printf("xbee_senddata: Error\n");
+	    return 1;
+	  }
+	  if (((rpkt = xbee_getpacketwait(tcon)) != NULL) && (rpkt->status == 0)) {
+	    /* move over the CC column */
+	    printf("\r%c[134C",27);
+	    /* print the ID */
+	    printf("%c[32m'%c' (0x%02X)%c[0m",27,rpkt->data[0],rpkt->data[0],27);
+	    addrs[i][17] = rpkt->data[0];
+	    /* turn on the flag */
+	    addrs[i][18] |= 0x04;
+	    free(rpkt);
+	  }
+	  /* go back the the bottom */
+	  printf("%c[%dB\r",27,nodes-i+1);
+	  fflush(stdout);
+	}
+      }
+    }
+    /* fall back to the first channel if that was the last */
+    if (XBeePro && ATCHc == 0x17) {
+      ATCHc = 0x0C;
+    } else if (!XBeePro && ATCHc == 0x1A) {
+      ATCHc = 0x0B;
+    } else {
+      /* else move onto next channel */
+      ATCHc++;
+    }
+    usleep(100000);
+  }
+
+  return 0;
+}
+
diff --git a/thirdParty/libxbee/sample/simple.c b/thirdParty/libxbee/sample/simple.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ab776f127556968cf90f2a26b3daf30b02c4ea1
--- /dev/null
+++ b/thirdParty/libxbee/sample/simple.c
@@ -0,0 +1,68 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will politely return any recieved data */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <xbee.h>
+
+int main(int argc, char *argv[]) {
+  xbee_con *con;
+  xbee_pkt *pkt, *rpkt;
+
+  /* setup the xbee */
+  if (xbee_setup("/dev/ttyUSB0",57600) == -1) {
+    /* oh no... it failed */
+    printf("xbee_setup() failed...\n");
+    exit(1);
+  }
+
+  /* setup a connection */
+  con = xbee_newcon('I',xbee_64bitData, 0x0013A200, 0x40081826);
+
+  printf("Waiting...\n");
+
+  /* just wait for data, and echo it back! */
+  while (1) {
+    /* while there are packets avaliable... */
+    while ((pkt = xbee_getpacket(con)) != NULL) {
+      /* print the recieved data */
+      printf("Rx: %s\n",pkt->data);
+      /* say thank you */
+      if (xbee_senddata(con,"thank you for saying '%s'\r\n",pkt->data)) {
+	printf("xbee_senddata: Error\n");
+	return 1;
+      }
+      /* free the packet */
+      free(pkt);
+    }
+    usleep(100000);
+  }
+
+  /* shouldn't ever get here but... */
+  return 0;
+}
+
diff --git a/thirdParty/libxbee/sample/talk_to_me.c b/thirdParty/libxbee/sample/talk_to_me.c
new file mode 100644
index 0000000000000000000000000000000000000000..26750988abade8d0c1db9820391e660bc6cd7764
--- /dev/null
+++ b/thirdParty/libxbee/sample/talk_to_me.c
@@ -0,0 +1,82 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample will make the remote XBee talk to us! */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <xbee.h>
+
+int main(int argc, char *argv[]) {
+  union {
+    unsigned char as8[8];
+    unsigned int as32[2];
+  } addr;
+  xbee_con *atCon, *rCon;
+  xbee_pkt *pkt;
+
+  /* the extra arguments are the CC ('+' by default) and GT (1000) by default AT values */
+  xbee_setuplogAPI("/dev/ttyUSB0",57600,2,'+',1000);
+
+  atCon = xbee_newcon('@', xbee_localAT);
+
+  xbee_senddata(atCon, "SH");
+  pkt = xbee_getpacketwait(atCon);
+  if (!pkt || pkt->status || pkt->atCmd[0] != 'S' || pkt->atCmd[1] != 'H') {
+    printf("Missing SH Packet!\n");
+    return 1;
+  }
+  addr.as8[3] = pkt->data[0];
+  addr.as8[2] = pkt->data[1];
+  addr.as8[1] = pkt->data[2];
+  addr.as8[0] = pkt->data[3];
+  free(pkt);
+
+  xbee_senddata(atCon, "SL");
+  pkt = xbee_getpacketwait(atCon);
+  if (!pkt || pkt->status || pkt->atCmd[0] != 'S' || pkt->atCmd[1] != 'L') {
+    printf("Missing SL Packet!\n");
+    return 1;
+  }
+  addr.as8[7] = pkt->data[0];
+  addr.as8[6] = pkt->data[1];
+  addr.as8[5] = pkt->data[2];
+  addr.as8[4] = pkt->data[3];
+  free(pkt);
+
+  printf("Local XBee address is: 0x%08X %08X\n", addr.as32[0], addr.as32[1]);
+    
+  rCon = xbee_newcon('#', xbee_64bitRemoteAT, 0x13A200, 0x403CB26A);
+  
+  xbee_senddata(rCon, "DH%c%c%c%c", addr.as8[3], addr.as8[2], addr.as8[1], addr.as8[0]);
+  usleep(250000);
+  xbee_senddata(rCon, "DL%c%c%c%c", addr.as8[7], addr.as8[6], addr.as8[5], addr.as8[4]);
+  usleep(250000);
+  
+  /* calling xbee_end() will return the xbee to its previous API mode */
+  xbee_end();
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/vb6/README.txt b/thirdParty/libxbee/sample/vb6/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fe13a7dfcb43ee491a575dd2458781a8511ae2a0
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/README.txt
@@ -0,0 +1,8 @@
+These sample projects provide a quick demo of how to use various functions
+
+Running these assume that you have first compiled libxbee.dll successfully
+You will also need to either copy libxbee.dll into this folder or into a
+  directory in your PATH
+
+If you want to use libxbee in your own projects, you must include libxbee.bas
+  which will provide you with access to the functions and type declarations
diff --git a/thirdParty/libxbee/sample/vb6/demo/Form1.frm b/thirdParty/libxbee/sample/vb6/demo/Form1.frm
new file mode 100644
index 0000000000000000000000000000000000000000..4c7c6655bce1337956327e4676c5a025526583f2
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/demo/Form1.frm
@@ -0,0 +1,64 @@
+VERSION 5.00
+Begin VB.Form Form1 
+   Caption         =   "Form1"
+   ClientHeight    =   2250
+   ClientLeft      =   120
+   ClientTop       =   450
+   ClientWidth     =   3855
+   LinkTopic       =   "Form1"
+   ScaleHeight     =   2250
+   ScaleWidth      =   3855
+   StartUpPosition =   3  'Windows Default
+   Begin VB.TextBox tb 
+      Height          =   1995
+      Left            =   120
+      MultiLine       =   -1  'True
+      TabIndex        =   0
+      Top             =   120
+      Width           =   3615
+   End
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+Option Explicit
+
+Dim myCon As Long
+Dim myDataCon As Long
+
+Private Sub Form_Load()
+    Dim i As Long
+    Dim x As Byte
+    Dim ctype, addrH, addrL As Long
+    Me.Show
+    DoEvents
+    
+    ' Connect to the XBee on COM1 with a baud rate of 57600
+    ' The XBee should be in API mode 2 (ATAP2)
+    If xbee_setupDebug("COM8", 57600, "xbee.log") <> 0 Then
+        MsgBox "Error while setting up the local XBee module", vbCritical, "xbee_setup()"
+        End
+    End If
+    xbee_logit "Hello!"
+    
+    ' Enable callbacks, this only needs to be done ONCE
+    ' The window handle provided must remain in memory (dont unload the form - callbacks will automatically be disabled)
+    xbee_enableCallbacks Me.hWnd
+    
+    ' Create a Remote AT connection to a node using 64-bit addressing
+    myCon = xbee_newcon_64bit(&H30, xbee_64bitRemoteAT, &H13A200, &H404B75DE)
+    xbee_enableACKwait myCon
+    
+    myDataCon = xbee_newcon_64bit(&H31, xbee_64bitData, &H13A200, &H404B75DE)
+    
+    ' Setup callbacks
+    xbee_attachCallback myCon, AddressOf Module1.callback1
+    xbee_attachCallback myDataCon, AddressOf Module1.callback2
+    
+    ' Send the AT command NI (Node Identifier)
+    tb.text = "Sending 'ATNI'..."
+    xbee_sendstring myCon, "NI"
+End Sub
+
diff --git a/thirdParty/libxbee/sample/vb6/demo/demo.bas b/thirdParty/libxbee/sample/vb6/demo/demo.bas
new file mode 100644
index 0000000000000000000000000000000000000000..b1e51fd90780c9bc8ae03e29760788520990b97b
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/demo/demo.bas
@@ -0,0 +1,19 @@
+Attribute VB_Name = "Module1"
+Public Function callback1(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    ' Check the returned status, if it isnt 0 then an error occured
+    If pkt.status <> 0 Then
+        Form1.tb.Text = Form1.tb.Text & vbNewLine & "An error occured (" & pkt.status & ")"
+        Exit Function
+    End If
+    
+    ' Display the Node Identifier
+    Form1.tb.Text = Form1.tb.Text & vbNewLine & "Node Identifier:" & StrConv(pkt.data, vbUnicode)
+    Form1.tb.SelStart = Len(Form1.tb.Text)
+End Function
+
+Public Function callback2(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    ' Display the data
+    Form1.tb.Text = Form1.tb.Text & vbNewLine & "Rx:" & StrConv(pkt.data, vbUnicode)
+    Form1.tb.SelStart = Len(Form1.tb.Text)
+End Function
+
diff --git a/thirdParty/libxbee/sample/vb6/demo/demo.vbp b/thirdParty/libxbee/sample/vb6/demo/demo.vbp
new file mode 100644
index 0000000000000000000000000000000000000000..815e949e70ca2644e8bb8a92a830e0aee07670ac
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/demo/demo.vbp
@@ -0,0 +1,33 @@
+Type=Exe
+Form=Form1.frm
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automation
+Module=Module1; demo.bas
+Module=libxbee; ..\libxbee.bas
+IconForm="Form1"
+Startup="Form1"
+ExeName32="demo.exe"
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="Microsoft"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
diff --git a/thirdParty/libxbee/sample/vb6/libxbee.bas b/thirdParty/libxbee/sample/vb6/libxbee.bas
new file mode 100644
index 0000000000000000000000000000000000000000..0875907f91b157d595fe58d4906c4c42e53bddcb
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/libxbee.bas
@@ -0,0 +1,285 @@
+Attribute VB_Name = "libxbee"
+Option Explicit
+
+Enum xbee_types
+  xbee_unknown
+
+  xbee_localAT
+  xbee_remoteAT
+  xbee_modemStatus
+  xbee_txStatus
+  
+  ' XBee Series 1 stuff
+  xbee_16bitRemoteAT
+  xbee_64bitRemoteAT
+
+  xbee_16bitData
+  xbee_64bitData
+  
+  xbee_16bitIO
+  xbee_64bitIO
+  
+  ' XBee Series 2 stuff
+  xbee2_data
+  xbee2_txStatus
+End Enum
+
+Type xbee_sample
+    '# X  A5 A4 A3 A2 A1 A0 D8    D7 D6 D5 D4 D3 D2 D1 D0
+    IOmask As Integer
+    '# X  X  X  X  X  X  X  D8    D7 D6 D5 D4 D3 D2 D1 D0
+    IOdigital As Integer
+    '# X  X  X  X  X  D  D  D     D  D  D  D  D  D  D  D
+    IOanalog(0 To 5) As Integer
+End Type
+
+Type xbee_pkt
+    flags As Long               '# bit 0 - is64
+                                '# bit 1 - dataPkt
+                                '# bit 2 - txStatusPkt
+                                '# bit 3 - modemStatusPkt
+                                '# bit 4 - remoteATPkt
+                                '# bit 5 - IOPkt
+    frameID As Byte
+    atCmd(0 To 1) As Byte
+    
+    status As Byte
+    samples As Byte
+    RSSI As Byte
+    
+    Addr16(0 To 1) As Byte
+    
+    Addr64(0 To 7) As Byte
+    
+    data(0 To 127) As Byte
+    
+    datalen As Long
+    
+    type As Long ' enum xbee_types
+    
+    SPARE As Long ' IGNORE THIS (is the pointer to the next packet in C... this will ALWAYS be 0 in VB)
+    
+    IOdata As xbee_sample
+End Type
+
+Private OldhWndHandler As Long
+Private ActivehWnd As Long
+Private callbackMessageID As Long
+Private Callbacks As New Collection
+
+Public Declare Sub xbee_free Lib "libxbee.dll" (ByVal ptr As Long)
+
+Public Declare Function xbee_setup Lib "libxbee.dll" (ByVal port As String, ByVal baudRate As Long) As Long
+Public Declare Function xbee_setupDebug Lib "libxbee.dll" (ByVal port As String, ByVal baudRate As Long, ByVal logfile As String) As Long
+Private Declare Function xbee_setupDebugAPIRaw Lib "libxbee.dll" Alias "xbee_setupDebugAPI" (ByVal port As String, ByVal baudRate As Long, ByVal logfile As String, ByVal cmdSeq As Byte, ByVal cmdTime As Long) As Long
+Private Declare Function xbee_setupAPIRaw Lib "libxbee.dll" Alias "xbee_setupAPI" (ByVal port As String, ByVal baudRate As Long, ByVal cmdSeq As Byte, ByVal cmdTime As Long) As Long
+
+Public Declare Function xbee_end Lib "libxbee.dll" () As Long
+
+Public Declare Function xbee_newcon_simple Lib "libxbee.dll" (ByVal frameID As Byte, ByVal conType As Long) As Long 'xbee_con *
+Public Declare Function xbee_newcon_16bit Lib "libxbee.dll" (ByVal frameID As Byte, ByVal conType As Long, ByVal addr16bit As Long) As Long  'xbee_con *
+Public Declare Function xbee_newcon_64bit Lib "libxbee.dll" (ByVal frameID As Byte, ByVal conType As Long, ByVal addr64bitLow As Long, ByVal addr64bitHigh As Long) As Long  'xbee_con *
+Public Declare Sub xbee_enableACKwait Lib "libxbee.dll" (ByVal con As Long)
+Public Declare Sub xbee_disableACKwait Lib "libxbee.dll" (ByVal con As Long)
+Public Declare Sub xbee_enableDestroySelf Lib "libxbee.dll" (ByVal con As Long)
+
+Private Declare Sub xbee_enableCallbacksRaw Lib "libxbee.dll" Alias "xbee_enableCallbacks" (ByVal hWnd As Long, ByVal uMsg As Long)
+Private Declare Sub xbee_attachCallbackRaw Lib "libxbee.dll" Alias "xbee_attachCallback" (ByVal con As Long)
+Private Declare Sub xbee_detachCallbackRaw Lib "libxbee.dll" Alias "xbee_detachCallback" (ByVal con As Long)
+Private Declare Function xbee_runCallback Lib "libxbee.dll" (ByVal func As Long, ByVal con As Long, ByVal pkt As Long) As Long
+
+Public Declare Sub xbee_endcon2 Lib "libxbee.dll" (ByVal con As Long)
+Public Declare Sub xbee_flushcon Lib "libxbee.dll" (ByVal con As Long)
+
+Public Declare Function xbee_senddata Lib "libxbee.dll" Alias "xbee_nsenddata" (ByVal con As Long, ByRef data As Byte, ByVal Length As Long) As Long
+Private Declare Function xbee_senddata_str Lib "libxbee.dll" Alias "xbee_nsenddata" (ByVal con As Long, ByVal data As String, ByVal Length As Long) As Long
+
+Public Declare Function xbee_getpacketRaw Lib "libxbee.dll" Alias "xbee_getpacket" (ByVal con As Long) As Long 'xbee_pkt *
+
+Public Declare Function xbee_hasanalog Lib "libxbee.dll" (ByRef pkt As xbee_pkt, ByVal sample As Long, ByVal inputPin As Long) As Long
+Public Declare Function xbee_getanalog Lib "libxbee.dll" (ByRef pkt As xbee_pkt, ByVal sample As Long, ByVal inputPin As Long, ByVal Vref As Double) As Double
+
+Public Declare Function xbee_hasdigital Lib "libxbee.dll" (ByRef pkt As xbee_pkt, ByVal sample As Long, ByVal inputPin As Long) As Long
+Public Declare Function xbee_getdigital Lib "libxbee.dll" (ByRef pkt As xbee_pkt, ByVal sample As Long, ByVal inputPin As Long) As Long
+
+Private Declare Function xbee_svn_versionRaw Lib "libxbee.dll" Alias "xbee_svn_version" () As Long
+Public Declare Sub xbee_logit Lib "libxbee.dll" (ByVal text As String)
+
+'###########################################################################################################################################################################
+
+Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
+Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
+Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
+Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
+Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
+Private Const WM_DESTROY = &H2
+Private Const GWL_WNDPROC = -4
+
+Public Function PointerToString(lngPtr As Long) As String
+   Dim strTemp As String
+   Dim lngLen As Long
+   If lngPtr Then
+      lngLen = lstrlenW(lngPtr) * 2
+      If lngLen Then
+         strTemp = Space(lngLen)
+         CopyMemory ByVal strTemp, ByVal lngPtr, lngLen
+         PointerToString = Replace(strTemp, Chr(0), "")
+      End If
+   End If
+End Function
+
+Public Function ArrayToString(data() As Byte, Optional lb As Integer = -1, Optional ub As Integer = -1) As String
+    Dim tmp As String
+    Dim i
+    If lb = -1 Then lb = LBound(data)
+    If ub = -1 Then ub = UBound(data)
+    tmp = ""
+    For i = lb To ub
+        If (data(i) = 0) Then Exit For
+        tmp = tmp & Chr(data(i))
+    Next
+    ArrayToString = tmp
+End Function
+
+Public Function xbee_pointerToPacket(lngPtr As Long) As xbee_pkt
+    Dim p As xbee_pkt
+    CopyMemory p, ByVal lngPtr, Len(p)
+    xbee_pointerToPacket = p
+End Function
+
+Public Sub libxbee_load()
+    ' this function is simply to get VB6 to call a libxbee function
+    ' if you are using any C DLLs that make use of libxbee, then you should call this function first so that VB6 will load libxbee
+    xbee_svn_versionRaw
+End Sub
+
+Public Function xbee_svn_version() As String
+    xbee_svn_version = PointerToString(xbee_svn_versionRaw())
+End Function
+
+Public Function xbee_setupAPI(ByVal port As String, ByVal baudRate As Long, ByVal cmdSeq As String, ByVal cmdTime As Long)
+    xbee_setupAPI = xbee_setupAPIRaw(port, baudRate, Asc(cmdSeq), cmdTime)
+End Function
+
+Public Function xbee_setupDebugAPI(ByVal port As String, ByVal baudRate As Long, ByVal logfile As String, ByVal cmdSeq As String, ByVal cmdTime As Long)
+    xbee_setupDebugAPI = xbee_setupDebugAPIRaw(port, baudRate, logfile, Asc(cmdSeq), cmdTime)
+End Function
+
+Private Sub xbee_ensureMessageID()
+    If callbackMessageID = 0 Then
+        callbackMessageID = RegisterWindowMessage("libxbee")
+    End If
+    xbee_enableCallbacksRaw ActivehWnd, callbackMessageID
+End Sub
+
+Public Sub xbee_attachCallback(ByVal con As Long, ByVal func As Long)
+    Dim t(0 To 1) As Long
+    Dim c As String
+    If ActivehWnd = 0 Then
+        Debug.Print "Callbacks not enabled!"
+        Exit Sub
+    End If
+    xbee_ensureMessageID
+    c = CStr(con)
+    t(0) = con
+    t(1) = func
+    On Error Resume Next
+    Callbacks.Remove c
+    Callbacks.Add t, c
+    On Error GoTo 0
+    xbee_attachCallbackRaw con
+End Sub
+
+Public Sub xbee_detachCallback(ByVal con As Long)
+    If ActivehWnd = 0 Then
+        Debug.Print "Callbacks not enabled!"
+        Exit Sub
+    End If
+    On Error Resume Next
+    xbee_detachCallbackRaw con
+    Callbacks.Remove CStr(con)
+End Sub
+
+Public Sub xbee_enableCallbacks(ByVal hWnd As Long)
+    If ActivehWnd <> 0 Then
+        Debug.Print "Callbacks already enabled!"
+        Exit Sub
+    End If
+    ActivehWnd = hWnd
+    OldhWndHandler = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf libxbee.xbee_messageHandler)
+    xbee_ensureMessageID
+End Sub
+
+Public Sub xbee_disableCallbacks()
+    Dim id As Variant
+    If ActivehWnd = 0 Then
+        Debug.Print "Callbacks not enabled!"
+        Exit Sub
+    End If
+    For Each id In Callbacks
+        xbee_detachCallback id(0)
+    Next
+    SetWindowLong ActivehWnd, GWL_WNDPROC, OldhWndHandler
+    ActivehWnd = 0
+    OldhWndHandler = 0
+End Sub
+
+Private Function xbee_messageHandler(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
+    If uMsg = callbackMessageID Then
+        Dim t As Long
+        On Error Resume Next
+        Err.Clear
+        t = Callbacks.Item(CStr(wParam))(1)
+        If Err.Number = 0 Then
+            On Error GoTo 0
+            xbee_messageHandler = xbee_runCallback(t, wParam, lParam)
+            Exit Function
+        End If
+        On Error GoTo 0
+        xbee_logit "Unable to match Connection with active callback!"
+    End If
+    xbee_messageHandler = CallWindowProc(OldhWndHandler, hWnd, uMsg, wParam, lParam)
+    If uMsg = WM_DESTROY And ActivehWnd <> 0 Then
+        ' Disable the MessageHandler if the form "unload" event is detected
+        xbee_disableCallbacks
+    End If
+End Function
+
+Public Sub xbee_endcon(ByRef con As Long)
+    xbee_endcon2 con
+    con = 0
+End Sub
+
+Public Function xbee_sendstring(ByVal con As Long, ByVal str As String)
+    xbee_sendstring = xbee_senddata_str(con, str, Len(str))
+End Function
+
+Public Function xbee_getpacketPtr(ByVal con As Long, ByRef pkt As Long) As Integer
+    Dim ptr As Long
+    
+    ptr = xbee_getpacketRaw(con)
+    If ptr = 0 Then
+        pkt = 0
+        xbee_getpacketPtr = 0
+        Exit Function
+    End If
+    
+    pkt = ptr
+    xbee_getpacketPtr = 1
+End Function
+
+Public Function xbee_getpacket(ByVal con As Long, ByRef pkt As xbee_pkt) As Integer
+    Dim ptr As Long
+    
+    ptr = xbee_getpacketRaw(con)
+    If ptr = 0 Then
+        xbee_getpacket = 0
+        Exit Function
+    End If
+    
+    pkt = xbee_pointerToPacket(ptr)
+    xbee_free ptr
+    
+    xbee_getpacket = 1
+End Function
+
diff --git a/thirdParty/libxbee/sample/vb6/talk_to_me/Form1.frm b/thirdParty/libxbee/sample/vb6/talk_to_me/Form1.frm
new file mode 100644
index 0000000000000000000000000000000000000000..426a9df9395c731c789ccc64ec25a3f70fc8f160
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/talk_to_me/Form1.frm
@@ -0,0 +1,1197 @@
+VERSION 5.00
+Begin VB.Form Form1 
+   BorderStyle     =   1  'Fixed Single
+   Caption         =   "Talk to Me"
+   ClientHeight    =   7875
+   ClientLeft      =   45
+   ClientTop       =   375
+   ClientWidth     =   7515
+   LinkTopic       =   "Form1"
+   MaxButton       =   0   'False
+   ScaleHeight     =   7875
+   ScaleWidth      =   7515
+   StartUpPosition =   1  'CenterOwner
+   Begin VB.Timer tmr_timeout 
+      Enabled         =   0   'False
+      Interval        =   5000
+      Left            =   3720
+      Top             =   1380
+   End
+   Begin VB.Frame Frame2 
+      Caption         =   " Actions "
+      BeginProperty Font 
+         Name            =   "Courier New"
+         Size            =   9
+         Charset         =   0
+         Weight          =   400
+         Underline       =   0   'False
+         Italic          =   0   'False
+         Strikethrough   =   0   'False
+      EndProperty
+      Height          =   1335
+      Left            =   180
+      TabIndex        =   1
+      Top             =   6420
+      Width           =   7215
+      Begin VB.CommandButton write_settings 
+         Caption         =   "Write Settings"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   1920
+         TabIndex        =   50
+         Top             =   780
+         Width           =   1935
+      End
+      Begin VB.CommandButton set_default 
+         Caption         =   "Set Default"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   180
+         TabIndex        =   49
+         Top             =   780
+         Width           =   1575
+      End
+      Begin VB.CommandButton reset_node 
+         Caption         =   "Reset Node"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   4020
+         TabIndex        =   47
+         Top             =   780
+         Width           =   1575
+      End
+      Begin VB.CommandButton set_dest 
+         Caption         =   "Set destination"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   1920
+         TabIndex        =   46
+         Top             =   300
+         Width           =   1935
+      End
+      Begin VB.CommandButton talk_to_me 
+         Caption         =   "Talk to Me"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   180
+         TabIndex        =   45
+         Top             =   300
+         Width           =   1575
+      End
+      Begin VB.CommandButton set_ni 
+         Caption         =   "Set Node Identifier"
+         Enabled         =   0   'False
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   375
+         Left            =   4020
+         TabIndex        =   51
+         Top             =   300
+         Width           =   2355
+      End
+   End
+   Begin VB.Frame Frame1 
+      Caption         =   " Settings "
+      BeginProperty Font 
+         Name            =   "Courier New"
+         Size            =   9
+         Charset         =   0
+         Weight          =   400
+         Underline       =   0   'False
+         Italic          =   0   'False
+         Strikethrough   =   0   'False
+      EndProperty
+      Height          =   3315
+      Left            =   180
+      TabIndex        =   0
+      Top             =   3000
+      Width           =   7215
+      Begin VB.Label ni 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   24
+         Top             =   300
+         Width           =   3915
+      End
+      Begin VB.Label sl 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   22
+         Top             =   1020
+         Width           =   3915
+      End
+      Begin VB.Label sh 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   20
+         Top             =   780
+         Width           =   3915
+      End
+      Begin VB.Label my 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   18
+         Top             =   540
+         Width           =   3915
+      End
+      Begin VB.Label ap 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   17
+         Top             =   1260
+         Width           =   3915
+      End
+      Begin VB.Label bd 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   16
+         Top             =   1500
+         Width           =   3915
+      End
+      Begin VB.Label ch 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   15
+         Top             =   1740
+         Width           =   3915
+      End
+      Begin VB.Label dh 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   14
+         Top             =   1980
+         Width           =   3915
+      End
+      Begin VB.Label dl 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   13
+         Top             =   2220
+         Width           =   3915
+      End
+      Begin VB.Label ia 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   11
+         Top             =   2460
+         Width           =   3915
+      End
+      Begin VB.Label vr 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   10
+         Top             =   2940
+         Width           =   3915
+      End
+      Begin VB.Label hv 
+         BackStyle       =   0  'Transparent
+         Caption         =   "-"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Left            =   3180
+         TabIndex        =   12
+         Top             =   2700
+         Width           =   3915
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "NI - Node Identifier"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   17
+         Left            =   180
+         TabIndex        =   25
+         Top             =   300
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "MY - 16-bit Address"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   13
+         Left            =   180
+         TabIndex        =   19
+         Top             =   540
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "VR - Firmware Version"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   14
+         Left            =   180
+         TabIndex        =   9
+         Top             =   2940
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "IA - I/O Address"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   12
+         Left            =   180
+         TabIndex        =   8
+         Top             =   2460
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "DL - Destination Low"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   10
+         Left            =   180
+         TabIndex        =   6
+         Top             =   2220
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "DH - Destination High"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   9
+         Left            =   180
+         TabIndex        =   5
+         Top             =   1980
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "CH - Channel"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   8
+         Left            =   180
+         TabIndex        =   4
+         Top             =   1740
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "BD - Interface Rate"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   7
+         Left            =   180
+         TabIndex        =   3
+         Top             =   1500
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "AP - API Enable"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   6
+         Left            =   180
+         TabIndex        =   2
+         Top             =   1260
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "HV - Hardware Version"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   11
+         Left            =   180
+         TabIndex        =   7
+         Top             =   2700
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                      .....:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   29
+         Left            =   180
+         TabIndex        =   44
+         Top             =   2700
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                ...........:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   28
+         Left            =   180
+         TabIndex        =   43
+         Top             =   1260
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                    .......:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   27
+         Left            =   180
+         TabIndex        =   42
+         Top             =   1500
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "             ..............:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   26
+         Left            =   180
+         TabIndex        =   41
+         Top             =   1740
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                      .....:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   25
+         Left            =   180
+         TabIndex        =   40
+         Top             =   1980
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                     ......:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   24
+         Left            =   180
+         TabIndex        =   39
+         Top             =   2220
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                 ..........:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   23
+         Left            =   180
+         TabIndex        =   38
+         Top             =   2460
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                      .....:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   22
+         Left            =   180
+         TabIndex        =   37
+         Top             =   2940
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                    .......:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   21
+         Left            =   180
+         TabIndex        =   36
+         Top             =   540
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                     ......:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   18
+         Left            =   180
+         TabIndex        =   33
+         Top             =   300
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "SL - 64-bit Address (Lo)"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   16
+         Left            =   180
+         TabIndex        =   23
+         Top             =   1020
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "SH - 64-bit Address (Hi)"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   255
+         Index           =   15
+         Left            =   180
+         TabIndex        =   21
+         Top             =   780
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                         ..:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   20
+         Left            =   180
+         TabIndex        =   35
+         Top             =   780
+         Width           =   2955
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "                         ..:"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   255
+         Index           =   19
+         Left            =   180
+         TabIndex        =   34
+         Top             =   1020
+         Width           =   2955
+      End
+   End
+   Begin VB.Timer tmr_refresh 
+      Enabled         =   0   'False
+      Interval        =   500
+      Left            =   3240
+      Top             =   1380
+   End
+   Begin VB.Frame Frame3 
+      Caption         =   " Node List "
+      BeginProperty Font 
+         Name            =   "Courier New"
+         Size            =   9
+         Charset         =   0
+         Weight          =   400
+         Underline       =   0   'False
+         Italic          =   0   'False
+         Strikethrough   =   0   'False
+      EndProperty
+      Height          =   2775
+      Left            =   180
+      TabIndex        =   26
+      Top             =   120
+      Width           =   7215
+      Begin VB.ListBox nodelist 
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   2085
+         Left            =   180
+         TabIndex        =   27
+         Top             =   540
+         Width           =   6855
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "16-bit"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   195
+         Index           =   0
+         Left            =   240
+         TabIndex        =   32
+         Top             =   300
+         Width           =   675
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "RSSI"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   195
+         Index           =   3
+         Left            =   3660
+         TabIndex        =   30
+         Top             =   300
+         Width           =   435
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "@"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   195
+         Index           =   4
+         Left            =   4440
+         TabIndex        =   29
+         Top             =   300
+         Width           =   135
+      End
+      Begin VB.Label Label 
+         BackStyle       =   0  'Transparent
+         Caption         =   "Node Name"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   195
+         Index           =   5
+         Left            =   4740
+         TabIndex        =   28
+         Top             =   300
+         Width           =   915
+      End
+      Begin VB.Label Label 
+         Alignment       =   2  'Center
+         BackStyle       =   0  'Transparent
+         Caption         =   "-        -"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         ForeColor       =   &H00C0C0C0&
+         Height          =   195
+         Index           =   2
+         Left            =   1020
+         TabIndex        =   48
+         Top             =   300
+         Width           =   2355
+      End
+      Begin VB.Label Label 
+         Alignment       =   2  'Center
+         BackStyle       =   0  'Transparent
+         Caption         =   "(Hi)  64-bit  (Lo)"
+         BeginProperty Font 
+            Name            =   "Courier New"
+            Size            =   9
+            Charset         =   0
+            Weight          =   400
+            Underline       =   0   'False
+            Italic          =   0   'False
+            Strikethrough   =   0   'False
+         EndProperty
+         Height          =   195
+         Index           =   1
+         Left            =   1020
+         TabIndex        =   31
+         Top             =   300
+         Width           =   2355
+      End
+   End
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+Dim dieNow As Boolean
+
+Private Sub Form_Load()
+    Me.Show
+    DoEvents
+    dieNow = False
+    
+    ' setup libxbee
+    If (xbee_setupDebugAPI("COM8", 57600, "xbee.log", "+", 250) = -1) Then
+        MsgBox "libxbee setup failed...", vbCritical
+        Unload Me
+        End
+    End If
+    
+    ' enable callback functions
+    xbee_enableCallbacks Me.hWnd
+    
+    ' setup a local at connection
+    atcon = xbee_newcon_simple(Asc("A"), xbee_localAT)
+    xbee_enableACKwait atcon
+    xbee_attachCallback atcon, AddressOf localCB
+    
+    ' set off the chain reaction!
+    xbeesend atcon, "MY"
+End Sub
+
+Private Sub Form_Unload(Cancel As Integer)
+    Static c As Integer
+    dieNow = 1
+    Cancel = 1
+    Me.Caption = "Waiting for command to complete..."
+    c = c + 1
+    If (c >= 2) Then
+        Cancel = 0
+    End If
+End Sub
+
+Private Sub nodelist_Click()
+    Dim tmp() As String
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    If set_dest.Tag = "yes" Then
+        nodelist.Enabled = False
+    Else
+        If nodelist.ListIndex = 0 Then
+            remoteCon = atcon
+        Else
+            str2 = Split(nodelist.text, "  ")
+            remoteCon = xbee_newcon_64bit(Asc("2"), xbee_64bitRemoteAT, CLng("&H" & Right(str2(1), 8)), CLng("&H" & Right(str2(2), 8)))
+        End If
+        setButtons False
+        nodelist.Enabled = False
+        tmp = Split(nodelist.List(nodelist.ListIndex), "  ")
+        ni = tmp(5)
+        my = tmp(0)
+        sh = tmp(1)
+        sl = tmp(2)
+        ap = "-"
+        bd = "-"
+        ch = "-"
+        dh = "-"
+        dl = "-"
+        ia = "-"
+        hv = "-"
+        vr = "-"
+    End If
+End Sub
+
+Private Sub reset_node_Click()
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    nodelist.Enabled = False
+    setButtons False
+    reset_node.Tag = "yes"
+End Sub
+
+Private Sub set_default_Click()
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    nodelist.Enabled = False
+    setButtons False
+    set_default.Tag = "yes"
+End Sub
+
+Private Sub set_dest_Click()
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    nodelist.Tag = nodelist.ListIndex
+    setButtons False
+    set_dest.Tag = "yes"
+End Sub
+
+Private Sub set_ni_Click()
+    Dim newni As String
+    Dim oldni As String
+    oldni = Split(nodelist.text, "  ")(5)
+    newni = InputBox("New node identifier:", "Set Node Identifier", oldni)
+    If newni = oldni Then Exit Sub
+    nodelist.Enabled = False
+    setButtons False
+    set_ni.Tag = newni
+End Sub
+
+Private Sub talk_to_me_Click()
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    nodelist.Enabled = False
+    setButtons False
+    talk_to_me.Tag = "yes"
+End Sub
+
+Private Sub tmr_refresh_Timer()
+    Dim str As String
+    Dim str2() As String
+    tmr_refresh.Enabled = False
+    If atcon = 0 Then Exit Sub
+    
+    If (dieNow) Then
+        xbee_end
+        DoEvents
+        xbee_disableCallbacks
+        Unload Me
+        End
+    End If
+    
+    If nodelist.Enabled = False Then
+        xbee_attachCallback remoteCon, AddressOf remoteCB
+        If talk_to_me.Tag = "yes" Then
+            str2 = Split(Form1.nodelist.text, "  ")
+            xbee_attachCallback remoteCon, AddressOf setupCB_TTM
+            str2 = Split(nodelist.List(0), "  ")
+            str = Chr(CInt("&H" & Mid(str2(1), 9, 2)))
+            str = Chr(CInt("&H" & Mid(str2(1), 7, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(1), 5, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(1), 3, 2))) & str
+            str = "DH" & str
+            xbeesend remoteCon, str
+        ElseIf set_dest.Tag = "yes" Then
+            str2 = Split(Form1.nodelist.text, "  ")
+            xbee_attachCallback remoteCon, AddressOf setupCB_SDEST
+            str2 = Split(nodelist.text, "  ")
+            str = Chr(CInt("&H" & Mid(str2(1), 9, 2)))
+            str = Chr(CInt("&H" & Mid(str2(1), 7, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(1), 5, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(1), 3, 2))) & str
+            str = "DH" & str
+            xbeesend remoteCon, str
+        ElseIf reset_node.Tag = "yes" Then
+            xbee_sendstring remoteCon, "FR"
+            setButtons True
+            reset_node.Tag = ""
+            tmr_refresh.Enabled = True
+        ElseIf write_settings.Tag = "yes" Then
+            xbee_sendstring remoteCon, "WR"
+            setButtons True
+            write_settings.Tag = ""
+            tmr_refresh.Enabled = True
+        ElseIf set_default.Tag = "yes" Then
+            setupCB_Default_Start
+        ElseIf set_ni.Tag <> "" Then
+            xbeesend remoteCon, "NI" & set_ni.Tag
+            set_ni.Tag = ""
+        Else
+            xbeesend remoteCon, "AP"
+        End If
+        Exit Sub
+    End If
+    ' initiate network scan
+    xbee_attachCallback atcon, AddressOf localCB
+    xbeesend atcon, "MY"
+End Sub
+
+Private Sub tmr_timeout_Timer()
+    Dim con As Long
+    Dim str As String
+    Dim str2() As String
+    tmr_timeout.Enabled = False
+    str2 = Split(tmr_timeout.Tag, Chr(1), 2)
+    con = CStr(str2(0))
+    str = str2(1)
+    If MsgBox("Request timed out... Retry?", vbYesNo + vbQuestion, "Retry?") = vbNo Then
+        setButtons True
+        nodelist.Enabled = True
+        tmr_refresh.Enabled = True
+        Exit Sub
+    End If
+    xbeesend con, str
+End Sub
+
+Private Sub write_settings_Click()
+    If nodelist.ListCount = 0 Or nodelist.ListIndex = -1 Then Exit Sub
+    nodelist.Enabled = False
+    setButtons False
+    write_settings.Tag = "yes"
+End Sub
diff --git a/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.bas b/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.bas
new file mode 100644
index 0000000000000000000000000000000000000000..dc9f5f76d16bf1e09c4be2fc43ad579c411b04c2
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.bas
@@ -0,0 +1,431 @@
+Attribute VB_Name = "Module1"
+Public atcon As Long
+Public remoteCon As Long
+
+Public Sub setButtons(ByVal state As Boolean)
+    Form1.talk_to_me.Tag = ""
+    Form1.talk_to_me.Enabled = state
+    Form1.set_dest.Tag = ""
+    Form1.set_dest.Enabled = state
+    Form1.reset_node.Tag = ""
+    Form1.reset_node.Enabled = state
+    Form1.set_default.Tag = ""
+    Form1.set_default.Enabled = state
+    Form1.write_settings.Tag = ""
+    Form1.write_settings.Enabled = state
+    Form1.set_ni.Tag = ""
+    Form1.set_ni.Enabled = state
+End Sub
+
+Public Function xbeesend(ByVal con As Long, ByVal str As String) As Long
+    Form1.tmr_timeout.Enabled = False
+    Form1.tmr_timeout.Tag = CStr(con) & Chr(1) & str
+    Form1.tmr_timeout.Enabled = True
+    xbee_sendstring con, str
+End Function
+
+Public Sub setupCB_Default_Start()
+    xbee_attachCallback remoteCon, AddressOf setupCB_Default
+    xbee_attachCallback atcon, AddressOf setupCB_Default
+    xbeesend remoteCon, "CH" & Chr(16)
+End Sub
+Public Function setupCB_Default(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    Dim str As String
+    Dim str2() As String
+    ' default values (in order of setting):
+    ' CH = 10
+    ' local CH = 10
+    ' MY = FF
+    ' T3 = 1
+    ' BD = 6
+    ' AP = 0
+    ' RO = 1
+    ' D0 = 5 (turn on rest of system)
+    ' D1 = 2 (battery reading)
+    ' D2 = 0
+    ' D3 = 5 (reset)
+    ' D4 = 4 (battery reading power)
+    ' D5 = 0
+    ' D6 = 0
+    ' D7 = 0
+    ' D8 = 0
+    ' IA = 0xFFFF (accept inputs from anyone)
+    ' IU = 0
+    Debug.Print ArrayToString(pkt.atCmd)
+    If con = atcon Then
+        xbee_attachCallback con, AddressOf localCB
+        xbeesend remoteCon, "MY" & Chr(255) & Chr(255)
+        Exit Function
+    End If
+    Select Case ArrayToString(pkt.atCmd)
+        Case "CH"
+            xbeesend atcon, "CH" & Chr(16)
+        Case "MY"
+            xbeesend con, "T3" & Chr(1)
+        Case "T3"
+            xbeesend con, "BD" & Chr(0) & Chr(0) & Chr(0) & Chr(6)
+        Case "BD"
+            xbeesend con, "AP" & Chr(0)
+        Case "AP"
+            xbeesend con, "RO" & Chr(1)
+        Case "RO"
+            xbeesend con, "D0" & Chr(5)
+        Case "D0"
+            xbeesend con, "D1" & Chr(2)
+        Case "D1"
+            xbeesend con, "D2" & Chr(0)
+        Case "D2"
+            xbeesend con, "D3" & Chr(4)
+        Case "D3"
+            xbeesend con, "D4" & Chr(4)
+        Case "D4"
+            xbeesend con, "D5" & Chr(0)
+        Case "D5"
+            xbeesend con, "D6" & Chr(0)
+        Case "D6"
+            xbeesend con, "D7" & Chr(0)
+        Case "D7"
+            xbeesend con, "D8" & Chr(0)
+        Case "D8"
+            xbeesend con, "IA" & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(255) & Chr(255)
+        Case "IA"
+            xbeesend con, "IU" & Chr(0)
+        Case "IU"
+            Form1.set_default.Tag = ""
+            Form1.tmr_refresh.Enabled = True
+            Form1.tmr_timeout.Enabled = False
+    End Select
+End Function
+
+Public Function setupCB_TTM(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    Dim str As String
+    Dim str2() As String
+    Select Case ArrayToString(pkt.atCmd)
+        Case "DH"
+            str2 = Split(Form1.nodelist.List(0), "  ")
+            str = Chr(CInt("&H" & Mid(str2(2), 9, 2)))
+            str = Chr(CInt("&H" & Mid(str2(2), 7, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(2), 5, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(2), 3, 2))) & str
+            str = "DL" & str
+            xbeesend con, str
+        Case "DL"
+            Form1.talk_to_me.Tag = ""
+            Form1.tmr_refresh.Enabled = True
+    End Select
+End Function
+
+Public Function setupCB_SDEST(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    Dim str As String
+    Dim str2() As String
+    Select Case ArrayToString(pkt.atCmd)
+        Case "DH"
+            str2 = Split(Form1.nodelist.text, "  ")
+            str = Chr(CInt("&H" & Mid(str2(2), 9, 2)))
+            str = Chr(CInt("&H" & Mid(str2(2), 7, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(2), 5, 2))) & str
+            str = Chr(CInt("&H" & Mid(str2(2), 3, 2))) & str
+            str = "DL" & str
+            xbeesend con, str
+        Case "DL"
+            Form1.set_dest.Tag = ""
+            Form1.nodelist.ListIndex = Form1.nodelist.Tag
+            Form1.tmr_refresh.Enabled = True
+    End Select
+End Function
+
+Public Function remoteCB(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    Dim t As String
+    Dim i As Long
+    Debug.Print "<+>", ArrayToString(pkt.atCmd)
+    Form1.tmr_timeout.Enabled = False
+    Select Case ArrayToString(pkt.atCmd)
+        Case "AP"
+            Select Case pkt.data(0)
+                Case 0
+                    Form1.ap.Caption = "0 - API Disabled"
+                Case 1
+                    Form1.ap.Caption = "1 - API Enabled (no escapes)"
+                Case 2
+                    Form1.ap.Caption = "2 - API Enabled (with escapes)"
+                Case Default
+                    Form1.ap.Caption = "0x" & Hex(pkt.data(0)) & " - Unknown..."
+            End Select
+            xbeesend con, "BD"
+        Case "BD"
+            t = Hex(pkt.data(3))
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(2)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            t = Hex(pkt.data(1)) & t
+            If (Len(t) < 6) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 8) Then t = "0" & t
+            i = CStr("&H" & t)
+            Select Case i
+                Case 0
+                    Form1.bd.Caption = "0 - 1200 bps"
+                Case 1
+                    Form1.bd.Caption = "1 - 2400 bps"
+                Case 2
+                    Form1.bd.Caption = "2 - 4800 bps"
+                Case 3
+                    Form1.bd.Caption = "3 - 9600 bps"
+                Case 4
+                    Form1.bd.Caption = "4 - 19200 bps"
+                Case 5
+                    Form1.bd.Caption = "5 - 38400 bps"
+                Case 6
+                    Form1.bd.Caption = "6 - 57600 bps"
+                Case 7
+                    Form1.bd.Caption = "7 - 115200 bps"
+                Case Default
+                    Form1.bd.Caption = "0x" & Hex(i) & " - Unknwon..."
+            End Select
+            xbeesend con, "CH"
+        Case "CH"
+            t = Hex(pkt.data(0))
+            If (Len(t) < 2) Then t = "0" & t
+            Form1.ch.Caption = "0x" & t
+            xbeesend con, "DH"
+        Case "DH"
+            t = Hex(pkt.data(3))
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(2)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            t = Hex(pkt.data(1)) & t
+            If (Len(t) < 6) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 8) Then t = "0" & t
+            Form1.dh.Caption = "0x" & t
+            xbeesend con, "DL"
+        Case "DL"
+            t = Hex(pkt.data(3))
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(2)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            t = Hex(pkt.data(1)) & t
+            If (Len(t) < 6) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 8) Then t = "0" & t
+            Form1.dl.Caption = "0x" & t
+            xbeesend con, "IA"
+        Case "IA"
+            t = Hex(pkt.data(7)) & t
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(6)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            t = Hex(pkt.data(5)) & t
+            If (Len(t) < 6) Then t = "0" & t
+            t = Hex(pkt.data(4)) & t
+            If (Len(t) < 8) Then t = "0" & t
+            t = Hex(pkt.data(3)) & t
+            If (Len(t) < 10) Then t = "0" & t
+            t = Hex(pkt.data(2)) & t
+            If (Len(t) < 12) Then t = "0" & t
+            t = Hex(pkt.data(1)) & t
+            If (Len(t) < 14) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 16) Then t = "0" & t
+            Form1.ia.Caption = "0x" & t
+            xbeesend con, "HV"
+        Case "HV"
+            t = Hex(pkt.data(1))
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            Form1.hv.Caption = "0x" & t
+            xbeesend con, "VR"
+        Case "VR"
+            t = Hex(pkt.data(1))
+            If (Len(t) < 2) Then t = "0" & t
+            t = Hex(pkt.data(0)) & t
+            If (Len(t) < 4) Then t = "0" & t
+            Form1.vr.Caption = "0x" & t
+            If con = atcon Then
+                xbee_attachCallback con, AddressOf localCB
+            End If
+            setButtons True
+            Form1.nodelist.Enabled = True
+            Form1.tmr_refresh.Enabled = True
+            Form1.tmr_timeout.Enabled = False
+        Case Else
+            If con = atcon Then
+                xbee_attachCallback con, AddressOf localCB
+            End If
+            setButtons True
+            Form1.nodelist.Enabled = True
+            Form1.tmr_refresh.Enabled = True
+            Form1.tmr_timeout.Enabled = False
+    End Select
+End Function
+
+Public Function localCB(ByVal con As Long, ByRef pkt As xbee_pkt) As Long
+    Dim nodeinfo As String
+    Dim nodename As String
+    Dim tmp As String
+    Dim tmp2() As String
+    Dim sh, sl As String
+    Dim i, m As Integer
+    Dim AT As String
+    Form1.tmr_timeout.Enabled = False
+    AT = ArrayToString(pkt.atCmd)
+    ' handle initial stuff
+    Select Case AT
+        Case "MY"
+            nodeinfo = "0x"
+            tmp = Hex(pkt.data(0))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(1))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            If Form1.nodelist.ListCount > 0 Then
+                Form1.nodelist.List(0) = nodeinfo
+            Else
+                Form1.nodelist.AddItem nodeinfo
+            End If
+            ' issue next command
+            xbeesend con, "SH"
+        Case "SH"
+            nodeinfo = Form1.nodelist.List(0) & "  0x"
+            tmp = Hex(pkt.data(0))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(1))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(2))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(3))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            Form1.nodelist.List(0) = nodeinfo
+            ' issue next command
+            xbeesend con, "SL"
+        Case "SL"
+            nodeinfo = Form1.nodelist.List(0) & "  0x"
+            tmp = Hex(pkt.data(0))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(1))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(2))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            tmp = Hex(pkt.data(3))
+            If (Len(tmp) < 2) Then tmp = "0" & tmp
+            nodeinfo = nodeinfo & tmp
+            Form1.nodelist.List(0) = nodeinfo
+            ' issue next command
+            xbeesend con, "NI"
+        Case "NI"
+            nodeinfo = Form1.nodelist.List(0) & "  -***dB  *  "
+            tmp = ArrayToString(pkt.data)
+            nodeinfo = nodeinfo & tmp
+            Form1.nodelist.List(0) = nodeinfo
+            ' issue next command
+            xbeesend con, "ND"
+    End Select
+    
+    If (AT <> "ND") Then Exit Function
+    If (pkt.status <> 0) Then
+        MsgBox "An error occured when attempting to scan!", vbCritical
+        Exit Function
+    End If
+    
+    If (pkt.datalen = 0) Then
+        ' increment the counter for each node
+        For i = 0 To Form1.nodelist.ListCount - 1
+            tmp2 = Split(Form1.nodelist.List(i), "  ")
+            If tmp2(4) <> "+" And tmp2(4) <> "*" Then
+                tmp2(4) = CInt(tmp2(4)) + 1
+                If (CInt(tmp2(4)) > 9) Then tmp2(4) = "+"
+            End If
+            tmp = ""
+            For m = LBound(tmp2) To UBound(tmp2)
+                If m > 0 Then tmp = tmp & "  "
+                tmp = tmp & tmp2(m)
+            Next
+            Form1.nodelist.List(i) = tmp
+        Next
+        
+        ' restart the refresh timer
+        Form1.tmr_refresh.Enabled = True
+        Exit Function
+    End If
+    
+    ' extract the 16-bit address
+    nodeinfo = ""
+    tmp = Hex(pkt.data(1))
+    If (Len(tmp) < 2) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(0)) & tmp
+    If (Len(tmp) < 4) Then tmp = "0" & tmp
+    tmp = "0x" & tmp
+    nodeinfo = nodeinfo & tmp
+    
+    nodeinfo = nodeinfo & "  "
+    
+    ' extract the high portion of the 64-bit address
+    nodeinfo = nodeinfo
+    tmp = Hex(pkt.data(5))
+    If (Len(tmp) < 2) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(4)) & tmp
+    If (Len(tmp) < 4) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(3)) & tmp
+    If (Len(tmp) < 6) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(2)) & tmp
+    If (Len(tmp) < 8) Then tmp = "0" & tmp
+    tmp = "0x" & tmp
+    nodeinfo = nodeinfo & tmp
+    sh = tmp
+    
+    nodeinfo = nodeinfo & "  "
+    
+    ' extract the low portion of the 64-bit address
+    nodeinfo = nodeinfo
+    tmp = Hex(pkt.data(9))
+    If (Len(tmp) < 2) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(8)) & tmp
+    If (Len(tmp) < 4) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(7)) & tmp
+    If (Len(tmp) < 6) Then tmp = "0" & tmp
+    tmp = Hex(pkt.data(6)) & tmp
+    If (Len(tmp) < 8) Then tmp = "0" & tmp
+    tmp = "0x" & tmp
+    nodeinfo = nodeinfo & tmp
+    sl = tmp
+    
+    nodeinfo = nodeinfo & "  "
+    
+    ' extract the rssi (signal strength)
+    tmp = "-" & CStr(pkt.data(10))
+    If Len(tmp) < 3 Then tmp = " " & tmp
+    If Len(tmp) < 4 Then tmp = " " & tmp
+    tmp = tmp & "dB"
+    nodeinfo = nodeinfo & tmp
+    
+    nodeinfo = nodeinfo & "  "
+    ' add a number of scans
+    nodeinfo = nodeinfo & 0
+    
+    nodeinfo = nodeinfo & "  "
+    
+    ' extract the node name
+    nodename = ArrayToString(pkt.data, 11)
+    nodeinfo = nodeinfo & nodename
+    
+    ' see if we have already got this node
+    For i = 0 To Form1.nodelist.ListCount - 1
+        tmp2 = Split(Form1.nodelist.List(i), "  ")
+        If tmp2(1) = sh And tmp2(2) = sl Then
+            Form1.nodelist.List(i) = nodeinfo
+            Exit Function
+        End If
+    Next
+    
+    ' otherwise add the info to the list
+    Form1.nodelist.AddItem nodeinfo
+End Function
diff --git a/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.vbp b/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.vbp
new file mode 100644
index 0000000000000000000000000000000000000000..a80cc9bf25076b17986bd5d820465024fc8da7b5
--- /dev/null
+++ b/thirdParty/libxbee/sample/vb6/talk_to_me/talk_to_me.vbp
@@ -0,0 +1,33 @@
+Type=Exe
+Form=Form1.frm
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automation
+Module=libxbee; ..\libxbee.bas
+Module=Module1; talk_to_me.bas
+IconForm="Form1"
+Startup="Form1"
+ExeName32="talk_to_me.exe"
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="Microsoft"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
diff --git a/thirdParty/libxbee/sample/xbee2_rx.c b/thirdParty/libxbee/sample/xbee2_rx.c
new file mode 100644
index 0000000000000000000000000000000000000000..223ddcf63777e04cb991872a9e62facafa09cdf5
--- /dev/null
+++ b/thirdParty/libxbee/sample/xbee2_rx.c
@@ -0,0 +1,60 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample demonstrates how to communicate using series 2 radios */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <xbee.h>
+
+void callback(xbee_con *con, xbee_pkt *pkt) {
+  int ret;
+  /* print the recieved data */
+  printf("Rx: %s\n",pkt->data);
+}
+
+int main(int argc, char *argv[]) {
+  union {
+    unsigned char as8[8];
+    unsigned int as32[2];
+  } addr;
+  xbee_con *rCon;
+  xbee_pkt *pkt;
+
+  xbee_setuplog("/dev/ttyUSB1",57600, 2);
+
+  rCon = xbee_newcon('#', xbee2_data, 0x13A200, 0x403302B1);
+  rCon->waitforACK = 1;
+  rCon->callback = callback;
+  
+  for (;;) {
+    sleep(60);
+  }
+  
+  /* calling xbee_end() will return the xbee to its previous API mode */
+  xbee_end();
+  return 0;
+}
diff --git a/thirdParty/libxbee/sample/xbee2_tx.c b/thirdParty/libxbee/sample/xbee2_tx.c
new file mode 100644
index 0000000000000000000000000000000000000000..db49fe6fa618226cdcfba3c99b8cf79e4a57765a
--- /dev/null
+++ b/thirdParty/libxbee/sample/xbee2_tx.c
@@ -0,0 +1,54 @@
+#ifdef shell
+gcc -o ${0//.c/} $0 -lxbee -g
+exit
+}
+#endif
+/*
+  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/>.
+*/
+
+/* this sample demonstrates how to communicate using series 2 radios */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <xbee.h>
+
+int main(int argc, char *argv[]) {
+  union {
+    unsigned char as8[8];
+    unsigned int as32[2];
+  } addr;
+  xbee_con *rCon;
+  xbee_pkt *pkt;
+
+  xbee_setuplog("/dev/ttyUSB0",57600, 2);
+
+  rCon = xbee_newcon('#', xbee2_data, 0x13A200, 0x403302BF);
+  
+  for (;;) {
+    xbee_senddata(rCon, "Hello!");
+    printf("Sent!\n");
+    sleep(1);
+  }
+  
+  /* calling xbee_end() will return the xbee to its previous API mode */
+  xbee_end();
+  return 0;
+}
diff --git a/thirdParty/libxbee/win32.README.txt b/thirdParty/libxbee/win32.README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f16dc0d94eda4b5ad239c31e806ee2a90f970d92
--- /dev/null
+++ b/thirdParty/libxbee/win32.README.txt
@@ -0,0 +1,31 @@
+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 as HTML in the 'doc' folder.
+
+
+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
+
+
+=== Compiling & Using ===
+
+To compile you must:
+ 1)  Have Visual C++ 2008 (v9.0) installed (Express or otherwise)
+ 2)  Have make installed - see GnuWin
+ 3)  Modify win32.makefile so that the paths at the top are correct
+ 
+Compile using `make -f win32.makefile` from the command prompt
+
+For C/C++ (and probrably others) just include xbee.h and link with libxbee.dll
+For VB6 see ./sample/vb6/ for more info & examples
diff --git a/thirdParty/libxbee/xbee.h b/thirdParty/libxbee/xbee.h
new file mode 100644
index 0000000000000000000000000000000000000000..61331d84434f4170501acda1e794a6a8d669ad3c
--- /dev/null
+++ b/thirdParty/libxbee/xbee.h
@@ -0,0 +1,218 @@
+/*
+  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/>.
+*/
+#ifndef XBEE_H
+#define XBEE_H
+
+#if !defined(__GNUC__) && !defined(_WIN32)
+#error "This library is only currently compatible with Linux and Win32"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __LIBXBEE_API_H
+typedef void* xbee_hnd;
+#endif
+
+#include <stdarg.h>
+
+#ifdef __GNUC__ /* ---- */
+#include <semaphore.h>
+typedef pthread_mutex_t    xbee_mutex_t;
+typedef pthread_cond_t     xbee_cond_t;
+typedef pthread_t          xbee_thread_t;
+typedef sem_t              xbee_sem_t;
+typedef FILE*              xbee_file_t;
+#elif (defined(WIN32) || defined(_WIN32)) /* -------------- */
+#include <Windows.h>
+#define CALLTYPE   __stdcall
+#define CALLTYPEVA __cdecl
+typedef HANDLE             xbee_mutex_t;
+typedef CONDITION_VARIABLE xbee_cond_t;
+typedef HANDLE             xbee_thread_t;
+typedef HANDLE             xbee_sem_t;
+typedef HANDLE             xbee_file_t;
+#else
+#error "Unknown operating system or compiler"
+#endif /* ------------- */
+
+#ifndef CALLTYPE
+#define CALLTYPE
+#endif
+
+#ifndef CALLTYPEVA
+#define CALLTYPEVA
+#endif
+
+enum xbee_types {
+  xbee_unknown,
+
+  xbee_localAT,       /* frame ID */
+  xbee_remoteAT,
+  xbee_modemStatus,
+  xbee_txStatus,
+  
+  /* XBee Series 1 stuff */
+  xbee_16bitRemoteAT, /* frame ID */
+  xbee_64bitRemoteAT, /* frame ID */
+
+  xbee_16bitData,     /* frame ID for ACKs */
+  xbee_64bitData,     /* frame ID for ACKs */
+
+  xbee_16bitIO,
+  xbee_64bitIO,
+  
+  /* XBee Series 2 stuff */
+  xbee2_data,
+  xbee2_txStatus
+};
+typedef enum xbee_types xbee_types;
+
+typedef struct xbee_sample xbee_sample;
+struct xbee_sample {
+  /* X  A5 A4 A3 A2 A1 A0 D8    D7 D6 D5 D4 D3 D2 D1 D0  */
+  unsigned short IOmask;          /*                  IO */
+  /* X  X  X  X  X  X  X  D8    D7 D6 D5 D4 D3 D2 D1 D0  */
+  unsigned short IOdigital;       /*                  IO */
+  /* X  X  X  X  X  D  D  D     D  D  D  D  D  D  D  D   */
+  unsigned short IOanalog[6];     /*                  IO */
+};
+
+typedef struct xbee_pkt xbee_pkt;
+struct xbee_pkt {
+  unsigned int sAddr64        : 1; /* yes / no */
+  unsigned int dataPkt        : 1; /* if no - AT packet */
+  unsigned int txStatusPkt    : 1;
+  unsigned int modemStatusPkt : 1;
+  unsigned int remoteATPkt    : 1;
+  unsigned int IOPkt          : 1;
+  unsigned int isBroadcastADR : 1;
+  unsigned int isBroadcastPAN : 1;
+
+  unsigned char frameID;          /* AT        Status    */
+  unsigned char atCmd[2];         /* AT                  */
+
+  unsigned char status;           /* AT  Data  Status    */ /* status / options */
+  unsigned char samples;
+  unsigned char RSSI;             /*     Data            */
+
+  unsigned char Addr16[2];        /* AT  Data            */
+
+  unsigned char Addr64[8];        /* AT  Data            */
+
+  unsigned char data[128];        /* AT  Data            */
+
+  unsigned int datalen;
+  xbee_types type;
+
+  xbee_pkt *next;
+
+  xbee_sample IOdata[1];  /* this array can be extended by using a this trick:
+                             p = calloc(sizeof(xbee_pkt) + (sizeof(xbee_sample) * (samples - 1))) */
+};
+
+typedef struct xbee_con xbee_con;
+struct xbee_con {
+  unsigned int tAddr64       : 1;
+  unsigned int atQueue       : 1; /* queues AT commands until AC is sent */
+  unsigned int txDisableACK  : 1;
+  unsigned int txBroadcastPAN: 1; /* broadcasts to PAN */
+  unsigned int destroySelf   : 1; /* if set, the callback thread will destroy the connection
+                                     after all of the packets have been processed */
+  unsigned int waitforACK    : 1; /* waits for the ACK or NAK after transmission */
+  unsigned int noFreeAfterCB : 1; /* prevents libxbee from free'ing the packet after the callback has completed */
+  unsigned int __spare__     : 1;
+  xbee_types type;
+  unsigned char frameID;
+  unsigned char tAddr[8];         /* 64-bit 0-7   16-bit 0-1 */
+  void *customData;               /* can be used to store data related to this connection */
+  void (CALLTYPE *callback)(xbee_con*,xbee_pkt*); /* call back function */
+  void *callbackList;
+  xbee_mutex_t callbackmutex;
+  xbee_mutex_t callbackListmutex;
+  xbee_mutex_t Txmutex;
+  xbee_sem_t waitforACKsem;
+  volatile unsigned char ACKstatus; /* 255 = waiting, 0 = success, 1 = no ack, 2 = cca fail, 3 = purged */
+  xbee_con *next;
+};
+
+int CALLTYPE xbee_setup(char *path, int baudrate);
+int CALLTYPE xbee_setuplog(char *path, int baudrate, int logfd);
+int CALLTYPE xbee_setupAPI(char *path, int baudrate, char cmdSeq, int cmdTime);
+int CALLTYPE xbee_setuplogAPI(char *path, int baudrate, int logfd, char cmdSeq, int cmdTime);
+xbee_hnd CALLTYPE _xbee_setup(char *path, int baudrate);
+xbee_hnd CALLTYPE _xbee_setuplog(char *path, int baudrate, int logfd);
+xbee_hnd CALLTYPE _xbee_setupAPI(char *path, int baudrate, char cmdSeq, int cmdTime);
+xbee_hnd CALLTYPE _xbee_setuplogAPI(char *path, int baudrate, int logfd, char cmdSeq, int cmdTime);
+
+int CALLTYPE xbee_end(void);
+int CALLTYPE _xbee_end(xbee_hnd xbee);
+
+void CALLTYPE xbee_logitf(char *format, ...);
+void CALLTYPE _xbee_logitf(xbee_hnd xbee, char *format, ...);
+void CALLTYPE xbee_logit(char *str);
+void CALLTYPE _xbee_logit(xbee_hnd xbee, char *str);
+
+xbee_con * CALLTYPEVA xbee_newcon(unsigned char frameID, xbee_types type, ...);
+xbee_con * CALLTYPEVA _xbee_newcon(xbee_hnd xbee, unsigned char frameID, xbee_types type, ...);
+xbee_con * CALLTYPE _xbee_vnewcon(xbee_hnd xbee, unsigned char frameID, xbee_types type, va_list ap);
+
+void CALLTYPE xbee_purgecon(xbee_con *con);
+void CALLTYPE _xbee_purgecon(xbee_hnd xbee, xbee_con *con);
+
+void CALLTYPE xbee_endcon2(xbee_con **con, int alreadyUnlinked);
+void CALLTYPE _xbee_endcon2(xbee_hnd xbee, xbee_con **con, int alreadyUnlinked);
+#define xbee_endcon(x) xbee_endcon2(&(x),0)
+#define _xbee_endcon(xbee,x) _xbee_endcon2((xbee),&(x),0)
+
+int CALLTYPE xbee_nsenddata(xbee_con *con, char *data, int length);
+int CALLTYPE _xbee_nsenddata(xbee_hnd xbee, xbee_con *con, char *data, int length);
+int CALLTYPEVA xbee_senddata(xbee_con *con, char *format, ...);
+int CALLTYPEVA _xbee_senddata(xbee_hnd xbee, xbee_con *con, char *format, ...);
+int CALLTYPE xbee_vsenddata(xbee_con *con, char *format, va_list ap);
+int CALLTYPE _xbee_vsenddata(xbee_hnd xbee, xbee_con *con, char *format, va_list ap);
+
+#if defined(WIN32)
+/* oh and just 'cos windows has rubbish memory management rules... this too */
+void CALLTYPE xbee_free(void *ptr);
+#endif /* ------------- */
+
+xbee_pkt * CALLTYPE xbee_getpacket(xbee_con *con);
+xbee_pkt * CALLTYPE _xbee_getpacket(xbee_hnd xbee, xbee_con *con);
+xbee_pkt * CALLTYPE xbee_getpacketwait(xbee_con *con);
+xbee_pkt * CALLTYPE _xbee_getpacketwait(xbee_hnd xbee, xbee_con *con);
+
+int CALLTYPE xbee_hasdigital(xbee_pkt *pkt, int sample, int input);
+int CALLTYPE xbee_getdigital(xbee_pkt *pkt, int sample, int input);
+
+int CALLTYPE xbee_hasanalog(xbee_pkt *pkt, int sample, int input);
+double CALLTYPE xbee_getanalog(xbee_pkt *pkt, int sample, int input, double Vref);
+
+const char * CALLTYPE xbee_svn_version(void);
+const char * CALLTYPE xbee_build_info(void);
+
+void CALLTYPE xbee_listen_stop(xbee_hnd xbee);
+
+#ifdef __cplusplus
+} /* cplusplus */
+#endif
+
+#endif
diff --git a/thirdParty/libxbee/xsys/README b/thirdParty/libxbee/xsys/README
new file mode 100644
index 0000000000000000000000000000000000000000..48d3928505730bab3f66fd31195b427700648bd3
--- /dev/null
+++ b/thirdParty/libxbee/xsys/README
@@ -0,0 +1 @@
+This directory contains cross-system support files.
\ No newline at end of file
diff --git a/thirdParty/libxbee/xsys/linux.c b/thirdParty/libxbee/xsys/linux.c
new file mode 100644
index 0000000000000000000000000000000000000000..768d5b3d4ecb9edf05cc53bbc2c088df398810d6
--- /dev/null
+++ b/thirdParty/libxbee/xsys/linux.c
@@ -0,0 +1,148 @@
+/*
+  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/>.
+*/
+
+/* ################################################################# */
+/* ### Linux Code ################################################## */
+/* ################################################################# */
+
+/*  this file contains code that is used by Linux ONLY */
+#ifndef __GNUC__
+#error "This file should only be used on a Linux system"
+#endif
+
+#include "linux.h"
+
+int init_serial(xbee_hnd xbee, int baudrate) {
+  struct flock fl;
+  struct termios tc;
+  speed_t chosenbaud;
+
+  /* select the baud rate */
+  switch (baudrate) {
+  case 1200:  chosenbaud = B1200;   break;
+  case 2400:  chosenbaud = B2400;   break;
+  case 4800:  chosenbaud = B4800;   break;
+  case 9600:  chosenbaud = B9600;   break;
+  case 19200: chosenbaud = B19200;  break;
+  case 38400: chosenbaud = B38400;  break;
+  case 57600: chosenbaud = B57600;  break;
+  case 115200:chosenbaud = B115200; break;
+  default:
+    fprintf(stderr,"%s(): Unknown or incompatiable baud rate specified... (%d)\n",__FUNCTION__,baudrate);
+    return -1;
+  };
+
+  /* open the serial port as a file descriptor */
+  if ((xbee->ttyfd = open(xbee->path,O_RDWR | O_NOCTTY | O_NONBLOCK)) == -1) {
+    xbee_perror("xbee_setup():open()");
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+    return -1;
+  }
+
+  /* lock the file */
+  fl.l_type = F_WRLCK | F_RDLCK;
+  fl.l_whence = SEEK_SET;
+  fl.l_start = 0;
+  fl.l_len = 0;
+  fl.l_pid = getpid();
+  if (fcntl(xbee->ttyfd, F_SETLK, &fl) == -1) {
+    xbee_perror("xbee_setup():fcntl()");
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+    close(xbee->ttyfd);
+    return -1;
+  }
+
+  /* open the serial port as a FILE* */
+  if ((xbee->tty = fdopen(xbee->ttyfd,"r+")) == NULL) {
+    xbee_perror("xbee_setup():fdopen()");
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+    close(xbee->ttyfd);
+    return -1;
+  }
+
+  /* flush the serial port */
+  fflush(xbee->tty);
+
+  /* disable buffering */
+  setvbuf(xbee->tty,NULL,_IONBF,BUFSIZ);
+
+  /* setup the baud rate and other io attributes */
+  tcgetattr(xbee->ttyfd, &tc);
+  /* input flags */
+  tc.c_iflag &= ~ IGNBRK;           /* enable ignoring break */
+  tc.c_iflag &= ~(IGNPAR | PARMRK); /* disable parity checks */
+  tc.c_iflag &= ~ INPCK;            /* disable parity checking */
+  tc.c_iflag &= ~ ISTRIP;           /* disable stripping 8th bit */
+  tc.c_iflag &= ~(INLCR | ICRNL);   /* disable translating NL <-> CR */
+  tc.c_iflag &= ~ IGNCR;            /* disable ignoring CR */
+  tc.c_iflag &= ~(IXON | IXOFF);    /* disable XON/XOFF flow control */
+  /* output flags */
+  tc.c_oflag &= ~ OPOST;            /* disable output processing */
+  tc.c_oflag &= ~(ONLCR | OCRNL);   /* disable translating NL <-> CR */
+  tc.c_oflag &= ~ OFILL;            /* disable fill characters */
+  /* control flags */
+  tc.c_cflag |=   CREAD;            /* enable reciever */
+  tc.c_cflag &= ~ PARENB;           /* disable parity */
+  tc.c_cflag &= ~ CSTOPB;           /* disable 2 stop bits */
+  tc.c_cflag &= ~ CSIZE;            /* remove size flag... */
+  tc.c_cflag |=   CS8;              /* ...enable 8 bit characters */
+  tc.c_cflag |=   HUPCL;            /* enable lower control lines on close - hang up */
+  /* local flags */
+  tc.c_lflag &= ~ ISIG;             /* disable generating signals */
+  tc.c_lflag &= ~ ICANON;           /* disable canonical mode - line by line */
+  tc.c_lflag &= ~ ECHO;             /* disable echoing characters */
+  tc.c_lflag &= ~ ECHONL;           /* ??? */
+  tc.c_lflag &= ~ NOFLSH;           /* disable flushing on SIGINT */
+  tc.c_lflag &= ~ IEXTEN;           /* disable input processing */
+  /* control characters */
+  memset(tc.c_cc,0,sizeof(tc.c_cc));
+  /* i/o rates */
+  cfsetspeed(&tc, chosenbaud);     /* set i/o baud rate */
+  tcsetattr(xbee->ttyfd, TCSANOW, &tc);
+  tcflow(xbee->ttyfd, TCOON|TCION); /* enable input & output transmission */
+
+  return 0;
+}
+
+static int xbee_select(xbee_hnd xbee, struct timeval *timeout) {
+  fd_set fds;
+
+  FD_ZERO(&fds);
+  FD_SET(xbee->ttyfd, &fds);
+
+  return select(xbee->ttyfd+1, &fds, NULL, NULL, timeout);
+}
+
+#define xbee_sem_wait1sec(a) xbee_sem_wait1sec2(&(a))
+static inline int xbee_sem_wait1sec2(xbee_sem_t *sem) {
+  struct timespec to;
+  clock_gettime(CLOCK_REALTIME,&to);
+  to.tv_sec++;
+  return sem_timedwait(sem,&to);
+}
diff --git a/thirdParty/libxbee/xsys/linux.h b/thirdParty/libxbee/xsys/linux.h
new file mode 100644
index 0000000000000000000000000000000000000000..886bbf5bf1c33ed4a59fa6d7396dc198ff3d9342
--- /dev/null
+++ b/thirdParty/libxbee/xsys/linux.h
@@ -0,0 +1,57 @@
+/*
+  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/>.
+*/
+
+/*  this file contains code that is used by Linux ONLY */
+#ifndef __GNUC__
+#error "This file should only be used on a Linux system"
+#endif
+
+/* ################################################################# */
+/* ### Linux Code ################################################## */
+/* ################################################################# */
+
+#define xbee_thread_create(a,b,c) pthread_create(&(a),NULL,(void *(*)(void *))(b),(void *)(c))
+#define xbee_thread_cancel(a,b)   pthread_cancel((a))
+#define xbee_thread_join(a)       pthread_join((a),NULL)
+#define xbee_thread_tryjoin(a)    pthread_tryjoin_np((a),NULL)
+
+#define xbee_mutex_init(a)        pthread_mutex_init(&(a),NULL)
+#define xbee_mutex_destroy(a)     pthread_mutex_destroy(&(a))
+#define xbee_mutex_lock(a)        pthread_mutex_lock(&(a))
+#define xbee_mutex_trylock(a)     pthread_mutex_trylock(&(a))
+#define xbee_mutex_unlock(a)      pthread_mutex_unlock(&(a))
+
+#define xbee_sem_init(a)          sem_init(&(a),0,0)
+#define xbee_sem_destroy(a)       sem_destroy(&(a))
+#define xbee_sem_wait(a)          sem_wait(&(a))
+#define xbee_sem_post(a)          sem_post(&(a))
+
+#define xbee_cond_init(a)         pthread_cond_init(&(a),NULL)
+#define xbee_cond_destroy(a)      pthread_cond_destroy(&(a))
+#define xbee_cond_wait(a,b)       pthread_cond_wait(&(a),&(b))
+#define xbee_cond_signal(a)       pthread_cond_signal(&(a))
+#define xbee_cond_broadcast(a)    pthread_cond_broadcast(&(a))
+
+#define xbee_write(xbee,a,b)      fwrite((a),1,(b),(xbee)->tty)
+#define xbee_read(xbee,a,b)       fread((a),1,(b),(xbee)->tty)
+#define xbee_ferror(xbee)         ferror((xbee)->tty)
+#define xbee_feof(xbee)           feof((xbee)->tty)
+#define xbee_close(a)             fclose((a))
+
diff --git a/thirdParty/libxbee/xsys/pdf/linux.c.pdf b/thirdParty/libxbee/xsys/pdf/linux.c.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..75a9a38b29af858ad4bb773704982d44fa400b32
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/linux.c.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/linux.h.pdf b/thirdParty/libxbee/xsys/pdf/linux.h.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..a4c65ae408966bc912ed72e08fc49c4edee516ff
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/linux.h.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/win32.c.pdf b/thirdParty/libxbee/xsys/pdf/win32.c.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..ec776c30b824ae659ab2cb2f31907df2f608dff8
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/win32.c.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/win32.def.pdf b/thirdParty/libxbee/xsys/pdf/win32.def.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..99b0548e4d2703b57cf69ec0fde18166639f570e
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/win32.def.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/win32.dll.c.pdf b/thirdParty/libxbee/xsys/pdf/win32.dll.c.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..97d7acb34cfe49904b5c08b6c227512fc8bc6048
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/win32.dll.c.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/win32.h.pdf b/thirdParty/libxbee/xsys/pdf/win32.h.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..b844726f1a19607952831452b160be3896a412b1
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/win32.h.pdf differ
diff --git a/thirdParty/libxbee/xsys/pdf/win32.rc.pdf b/thirdParty/libxbee/xsys/pdf/win32.rc.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..8ff8a7956bff9e4e4ff4b5cb33683835c635a36c
Binary files /dev/null and b/thirdParty/libxbee/xsys/pdf/win32.rc.pdf differ
diff --git a/thirdParty/libxbee/xsys/win32.c b/thirdParty/libxbee/xsys/win32.c
new file mode 100644
index 0000000000000000000000000000000000000000..a05950a94b6a44e84db33f067f85c07ae9c90342
--- /dev/null
+++ b/thirdParty/libxbee/xsys/win32.c
@@ -0,0 +1,279 @@
+/*
+  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/>.
+*/
+
+/* ################################################################# */
+/* ### Win32 Code ################################################## */
+/* ################################################################# */
+
+/*  this file contains code that is used by Win32 ONLY */
+#ifndef _WIN32
+#error "This file should only be used on a Win32 system"
+#endif
+
+#include "win32.h"
+#include "win32.dll.c"
+
+static int init_serial(xbee_hnd xbee, int baudrate) {
+  int chosenbaud;
+  DCB tc;
+  int evtMask;
+  COMMTIMEOUTS timeouts;
+
+  /* open the serial port */
+  xbee->tty = CreateFile(TEXT(xbee->path),
+                        GENERIC_READ | GENERIC_WRITE,
+                        0,    /* exclusive access */
+                        NULL, /* default security attributes */
+                        OPEN_EXISTING,
+                        FILE_FLAG_OVERLAPPED,
+                        NULL);
+  if (xbee->tty == INVALID_HANDLE_VALUE) {
+    xbee_logS("Invalid file handle...");
+    xbee_logE("Is the XBee plugged in and avaliable on the correct port?");
+    xbee_mutex_destroy(xbee->conmutex);
+    xbee_mutex_destroy(xbee->pktmutex);
+    xbee_mutex_destroy(xbee->sendmutex);
+    Xfree(xbee->path);
+    return -1;
+  }
+
+  GetCommState(xbee->tty, &tc);
+  tc.BaudRate          = baudrate;
+  tc.fBinary           = TRUE;
+  tc.fParity           = FALSE;
+  tc.fOutxCtsFlow      = FALSE;
+  tc.fOutxDsrFlow      = FALSE;
+  tc.fDtrControl       = DTR_CONTROL_DISABLE;
+  tc.fDsrSensitivity   = FALSE;
+  tc.fTXContinueOnXoff = FALSE;
+  tc.fOutX             = FALSE;
+  tc.fInX              = FALSE;
+  tc.fErrorChar        = FALSE;
+  tc.fNull             = FALSE;
+  tc.fRtsControl       = RTS_CONTROL_DISABLE;
+  tc.fAbortOnError     = FALSE;
+  tc.ByteSize          = 8;
+  tc.Parity            = NOPARITY;
+  tc.StopBits          = ONESTOPBIT;
+  SetCommState(xbee->tty, &tc);
+
+  timeouts.ReadIntervalTimeout = MAXDWORD;
+  timeouts.ReadTotalTimeoutMultiplier = 0;
+  timeouts.ReadTotalTimeoutConstant = 0;
+  timeouts.WriteTotalTimeoutMultiplier = 0;
+  timeouts.WriteTotalTimeoutConstant = 0;
+  SetCommTimeouts(xbee->tty, &timeouts);
+
+  SetCommMask(xbee->tty, EV_RXCHAR);
+
+  return 0;
+}
+
+/* a replacement for the linux select() function... for a serial port */
+static int xbee_select(xbee_hnd xbee, struct timeval *timeout) {
+  int evtMask = 0;
+  COMSTAT status;
+  int ret;
+
+  for (;;) {
+    /* find out how many bytes are in the Rx buffer... */
+    if (ClearCommError(xbee->tty,NULL,&status) && (status.cbInQue > 0)) {
+      /* if there is data... return! */
+      return 1; /*status.cbInQue;*/
+    } else if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0) {
+      /* if the timeout was 0 (return immediately) then return! */
+      return 0;
+    }
+
+    /* otherwise wait for an Rx event... */
+    memset(&(xbee->ttyovrs),0,sizeof(OVERLAPPED));
+    xbee->ttyovrs.hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
+    if (!WaitCommEvent(xbee->tty,&evtMask,&(xbee->ttyovrs))) {
+      if (GetLastError() == ERROR_IO_PENDING) {
+        DWORD timeoutval;
+        if (!timeout) {
+          /* behave like the linux function... if the timeout pointer was NULL
+             then wait indefinately */
+          timeoutval = INFINITE;
+        } else {
+          /* Win32 doesn't give the luxury of microseconds and seconds... just miliseconds! */
+          timeoutval = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
+        }
+        ret = WaitForSingleObject(xbee->ttyovrs.hEvent,timeoutval);
+        if (ret == WAIT_TIMEOUT) {
+          /* cause the WaitCommEvent() call to stop */
+          SetCommMask(xbee->tty, EV_RXCHAR);
+          /* if a timeout occured, then return 0 */
+          CloseHandle(xbee->ttyovrs.hEvent);
+          return 0;
+        }
+      } else {
+        return -1;
+      }
+    }
+    CloseHandle(xbee->ttyovrs.hEvent);
+  }
+
+  /* always return -1 (error) for now... */
+  return -1;
+}
+
+/* this offers the same behavior as non-blocking I/O under linux */
+int xbee_write(xbee_hnd xbee, const void *ptr, size_t size) {
+  xbee->ttyeof = FALSE;
+  if (!WriteFile(xbee->tty, ptr, size, NULL, &(xbee->ttyovrw)) &&
+      (GetLastError() != ERROR_IO_PENDING)) return 0;
+  if (!GetOverlappedResult(xbee->tty, &(xbee->ttyovrw), &(xbee->ttyw), TRUE)) {
+    if (GetLastError() == ERROR_HANDLE_EOF) xbee->ttyeof = TRUE;
+    return 0;
+  }
+  return xbee->ttyw;
+}
+
+/* this offers the same behavior as non-blocking I/O under linux */
+int xbee_read(xbee_hnd xbee, void *ptr, size_t size) {
+  xbee->ttyeof = FALSE;
+  if (!ReadFile(xbee->tty, ptr, size, NULL, &(xbee->ttyovrr)) &&
+      (GetLastError() != ERROR_IO_PENDING)) return 0;
+  if (!GetOverlappedResult(xbee->tty, &(xbee->ttyovrr), &(xbee->ttyr), TRUE)) {
+    if (GetLastError() == ERROR_HANDLE_EOF) xbee->ttyeof = TRUE;
+    return 0;
+  }
+  return xbee->ttyr;
+}
+
+/* this is because Win32 has some weird memory management rules...
+   - the thread that allocated the memory, MUST free it... */
+void xbee_free(void *ptr) {
+  if (!ptr) return;
+  free(ptr);
+}
+
+/* win32 equivalent of unix gettimeofday() */
+int gettimeofday(struct timeval *tv, struct timezone *tz) {
+  if (tv) {
+    struct _timeb timeb;
+    _ftime(&timeb);
+    tv->tv_sec = timeb.time;
+    tv->tv_usec = timeb.millitm * 1000;
+  }
+  /* ignore tz for now */
+  return 0;
+}
+
+/* ################################################################# */
+/* ### Helper Functions (Mainly for VB6 use) ####################### */
+/* ################################################################# */
+
+/* enable the debug output to a custom file or fallback to stderr */
+int xbee_setupDebugAPI(char *path, int baudrate, char *logfile, char cmdSeq, int cmdTime) {
+  xbee_hnd xbee = NULL;
+  int fd, ret;
+  if ((fd = _open(logfile,_O_WRONLY | _O_CREAT | _O_TRUNC)) == -1) {
+    fd = 2;
+  }
+  ret = xbee_setuplogAPI(path,baudrate,fd,cmdSeq,cmdTime);
+  if (fd > 2) { /* close fd, as libxbee dup'ed it */
+    //_close(fd);
+  }
+  if (!ret) { /* libxbee started correctly */
+    xbee = default_xbee;
+    if (fd == -1) {
+      xbee_log("Error opening logfile '%s' (errno=%d)... using stderr instead!",logfile,errno);
+    }
+  }
+  return ret;
+}
+int xbee_setupDebug(char *path, int baudrate, char *logfile) {
+  return xbee_setupDebugAPI(path,baudrate,logfile,0,0);
+}
+
+/* These silly little functions are required for VB6
+   - it freaks out when you call a function that uses va_args... */
+xbee_con *xbee_newcon_simple(unsigned char frameID, xbee_types type) {
+  return xbee_newcon(frameID, type);
+}
+xbee_con *xbee_newcon_16bit(unsigned char frameID, xbee_types type, int addr) {
+  return xbee_newcon(frameID, type, addr);
+}
+xbee_con *xbee_newcon_64bit(unsigned char frameID, xbee_types type, int addrL, int addrH) {
+  return xbee_newcon(frameID, type, addrL, addrH);
+}
+
+void xbee_enableACKwait(xbee_con *con) {
+  con->waitforACK = 1;
+}
+void xbee_disableACKwait(xbee_con *con) {
+  con->waitforACK = 0;
+}
+
+void xbee_enableDestroySelf(xbee_con *con) {
+  con->destroySelf = 1;
+}
+
+/* for vb6... it will send a message to the given hWnd which can in turn check for a packet */
+void xbee_callback(xbee_con *con, xbee_pkt *pkt) {
+  xbee_hnd xbee = default_xbee;
+  
+  if (!win32_hWnd) {
+    xbee_log("*** Cannot do callback! No hWnd set... ***");
+    return;
+  }
+  if (!win32_MessageID) {
+    xbee_log("*** Cannot do callback! No MessageID set... ***");
+    return;
+  }
+  
+  xbee_log("Callback message sent!");
+  SendMessage(win32_hWnd, win32_MessageID, (int)con, (int)pkt);
+}
+
+/* very simple C function to provide more functionality to VB6 */
+int xbee_runCallback(int(*func)(xbee_con*,xbee_pkt*), xbee_con *con, xbee_pkt *pkt) {
+  return func(con,pkt);
+}
+
+void xbee_enableCallbacks(HWND hWnd, UINT uMsg) {
+  xbee_hnd xbee = default_xbee;
+  if (!win32_MessageID || win32_MessageID != uMsg) {
+    xbee_log("Configuring libxbee to use MessageID = 0x%08X", uMsg);
+    win32_MessageID = uMsg;
+  }
+  if (!win32_hWnd || win32_hWnd != hWnd) {
+    xbee_log("Configuring libxbee to use hWnd = 0x%08X", hWnd);
+    win32_hWnd = hWnd;
+  }
+}
+
+void xbee_attachCallback(xbee_con *con) {
+  xbee_hnd xbee = default_xbee;
+
+  /* setup the callback function */
+  xbee_log("Setting callback for connection @ 0x%08X",con);
+  con->callback = xbee_callback;
+}
+
+void xbee_detachCallback(xbee_con *con) {
+  xbee_hnd xbee = default_xbee;
+  
+  /* un-setup the callback function */
+  xbee_log("Unsetting callback for connection @ 0x%08X",con);
+  con->callback = NULL;
+}
diff --git a/thirdParty/libxbee/xsys/win32.def b/thirdParty/libxbee/xsys/win32.def
new file mode 100644
index 0000000000000000000000000000000000000000..888040ee38085c483632a80f083ba61390c36eb5
--- /dev/null
+++ b/thirdParty/libxbee/xsys/win32.def
@@ -0,0 +1,71 @@
+LIBRARY libxbee
+
+EXPORTS
+  ver
+  DllMain
+  DllCanUnloadNow     PRIVATE
+  DllRegisterServer   PRIVATE
+  DllUnregisterServer PRIVATE
+
+  xbee_free
+
+  xbee_setup
+  _xbee_setup
+  xbee_setuplog
+  _xbee_setuplog
+  xbee_setupAPI
+  _xbee_setupAPI
+  xbee_setuplogAPI
+  _xbee_setuplogAPI
+  xbee_setupDebug
+  xbee_setupDebugAPI
+
+  xbee_end
+  _xbee_end
+  xbee_listen_stop
+
+  xbee_newcon
+  _xbee_newcon
+  xbee_newcon_simple
+  xbee_newcon_16bit
+  xbee_newcon_64bit
+  
+  xbee_enableACKwait
+  xbee_disableACKwait
+  xbee_enableDestroySelf
+
+  xbee_enableCallbacks
+  xbee_attachCallback
+  xbee_detachCallback
+  xbee_runCallback
+
+  xbee_endcon2
+  _xbee_endcon2
+  xbee_purgecon
+  _xbee_purgecon
+
+  xbee_senddata
+  _xbee_senddata
+  xbee_nsenddata
+  _xbee_nsenddata
+  xbee_vsenddata
+  _xbee_vsenddata
+
+  xbee_getpacket
+  _xbee_getpacket
+  xbee_getpacketwait
+  _xbee_getpacketwait
+
+  xbee_hasanalog
+  xbee_getanalog
+
+  xbee_hasdigital
+  xbee_getdigital
+
+  xbee_svn_version
+  xbee_build_info
+  
+  xbee_logit
+  _xbee_logit
+  xbee_logitf
+  _xbee_logitf
diff --git a/thirdParty/libxbee/xsys/win32.dll.c b/thirdParty/libxbee/xsys/win32.dll.c
new file mode 100644
index 0000000000000000000000000000000000000000..1a9ebcaa8573d6b77f9af6cdc70d12eeaa6b308b
--- /dev/null
+++ b/thirdParty/libxbee/xsys/win32.dll.c
@@ -0,0 +1,131 @@
+/*
+    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/>.
+*/
+
+/* ################################################################# */
+/* ### Win32 DLL Code ############################################## */
+/* ################################################################# */
+
+/*  this file contains code that is used by Win32 ONLY */
+#ifndef _WIN32
+#error "This file should only be used on a Win32 system"
+#endif
+
+int ver(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow) {
+  char t[256];
+  sprintf(t,"libxbee.dll\n%s\n%s",xbee_svn_version(),xbee_build_info());
+  MessageBox(NULL, t, "libxbee Win32 DLL", MB_OK);
+  return 0;
+}
+
+void xbee_UNLOADALL(void) {
+  while (default_xbee) {
+    _xbee_end(default_xbee);
+  }
+}
+
+/* this gets called when the dll is loaded and unloaded... */
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) {
+  if (dwReason == DLL_PROCESS_DETACH) {
+    /* ensure that libxbee has been shut down nicely */
+    xbee_UNLOADALL();
+  } else if (dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH) {
+    if (!glob_hModule) {
+      /* keep a handle on the module */
+      glob_hModule = (HMODULE)hModule;
+    }
+  }
+  return TRUE;
+}
+
+HRESULT DllCanUnloadNow(void) {
+  if (default_xbee) return 0;
+  return 1;
+}
+
+/* ################################################################# */
+/* ### Win32 DLL COM Code ########################################## */
+/* ################################################################# */
+
+/* this function is from this tutorial:
+     http://www.codeguru.com/Cpp/COM-Tech/activex/tutorials/article.php/c5567 */
+BOOL RegWriteKey(HKEY roothk, const char *lpSubKey, LPCTSTR val_name, 
+                 DWORD dwType, void *lpvData,  DWORD dwDataSize) {
+  /*  roothk:     HKEY_CLASSES_ROOT, HKEY_LOCAL_MACHINE, etc
+      lpSubKey:   the key relative to 'roothk'
+      val_name:   the key value name where the data will be written
+      dwType:     REG_SZ,REG_BINARY, etc.
+      lpvData:    a pointer to the data buffer
+      dwDataSize: the size of the data pointed to by lpvData */
+  HKEY hk;
+  if (ERROR_SUCCESS != RegCreateKey(roothk,lpSubKey,&hk) ) return FALSE;
+  if (ERROR_SUCCESS != RegSetValueEx(hk,val_name,0,dwType,(CONST BYTE *)lpvData,dwDataSize)) return FALSE;
+  if (ERROR_SUCCESS != RegCloseKey(hk))   return FALSE;
+  return TRUE;
+}
+
+/* this is used by the regsrv32 application */
+STDAPI DllRegisterServer(void) {
+  char key[MAX_PATH];
+  char value[MAX_PATH];
+
+  wsprintf(key,"CLSID\\%s",dllGUID);
+  wsprintf(value,"%s",dlldesc);
+  RegWriteKey(HKEY_CLASSES_ROOT, key, NULL, REG_SZ, (void *)value, lstrlen(value));
+
+  wsprintf(key,"CLSID\\%s\\InprocServer32",dllGUID);
+  GetModuleFileName(glob_hModule,value,MAX_PATH);
+  RegWriteKey(HKEY_CLASSES_ROOT, key, NULL, REG_SZ, (void *)value, lstrlen(value));
+
+  wsprintf(key,"CLSID\\%s\\ProgId",dllGUID);
+  lstrcpy(value,dllid);
+  RegWriteKey(HKEY_CLASSES_ROOT, key, NULL, REG_SZ, (void *)value, lstrlen(value));
+
+  lstrcpy(key,dllid);
+  lstrcpy(value,dlldesc);
+  RegWriteKey(HKEY_CLASSES_ROOT, key, NULL, REG_SZ, (void *)value, lstrlen(value));
+
+  wsprintf(key,"%s\\CLSID",dllid);
+  RegWriteKey(HKEY_CLASSES_ROOT, key, NULL, REG_SZ, (void *)dllGUID, lstrlen(dllGUID));
+
+  return S_OK;
+}
+
+/* this is used by the regsrv32 application */
+STDAPI DllUnregisterServer(void) {
+  char key[MAX_PATH];
+  char value[MAX_PATH];
+
+  wsprintf(key,"%s\\CLSID",dllid);
+  RegDeleteKey(HKEY_CLASSES_ROOT,key);
+
+  wsprintf(key,"%s",dllid);
+  RegDeleteKey(HKEY_CLASSES_ROOT,key);
+
+  wsprintf(key,"CLSID\\%s\\InprocServer32",dllGUID);
+  RegDeleteKey(HKEY_CLASSES_ROOT,key);
+
+  wsprintf(key,"CLSID\\%s\\ProgId",dllGUID);
+  RegDeleteKey(HKEY_CLASSES_ROOT,key);
+
+  wsprintf(key,"CLSID\\%s",dllGUID);
+  RegDeleteKey(HKEY_CLASSES_ROOT,key);
+
+  return S_OK;
+}
diff --git a/thirdParty/libxbee/xsys/win32.h b/thirdParty/libxbee/xsys/win32.h
new file mode 100644
index 0000000000000000000000000000000000000000..65f19f805cb978899aa3e9a19cf3e9fd115185e4
--- /dev/null
+++ b/thirdParty/libxbee/xsys/win32.h
@@ -0,0 +1,73 @@
+/*
+  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/>.
+*/
+
+/*  this file contains code that is used by Win32 ONLY */
+#ifndef _WIN32
+#error "This file should only be used on a Win32 system"
+#endif
+
+/* ################################################################# */
+/* ### Win32 Code ################################################## */
+/* ################################################################# */
+
+#pragma comment(lib, "Advapi32.lib")
+#pragma comment(lib, "User32.lib")
+
+#define dllid   "attie-co-uk.libxbee"
+#define dlldesc "libxbee - XBee API Library"
+/* libxbee's GUID is {7A6E25AA-ECB5-4370-87B5-A1D31840FE23} */
+#define dllGUID "{7A6E25AA-ECB5-4370-87B5-A1D31840FE23}"
+
+#define Win32Message()  MessageBox(0,"Run xbee_setup() first!...","libxbee",MB_OK);
+
+HMODULE glob_hModule = NULL;
+
+/* this uses miliseconds not microseconds... */
+#define usleep(a)                 Sleep((a)/1000)
+
+#define xbee_thread_create(a,b,c) (((a) = CreateThread(NULL,0,(void *)(b),(void *)(c),0,NULL)) == NULL)
+#define xbee_thread_cancel(a,b)   TerminateThread((a),(b))
+#define xbee_thread_join(a)       WaitForSingleObject((a),INFINITE)
+#define xbee_thread_tryjoin(a)    WaitForSingleObject((a),0)
+
+#define xbee_mutex_init(a)        (((a) = CreateEvent(NULL,FALSE,TRUE,NULL)) == NULL)
+#define xbee_mutex_destroy(a)     CloseHandle((a))
+#define xbee_mutex_lock(a)        WaitForSingleObject((a),INFINITE)
+#define xbee_mutex_trylock(a)     WaitForSingleObject((a),0)
+#define xbee_mutex_unlock(a)      SetEvent((a))
+
+#define xbee_sem_init(a)          (((a) = CreateEvent(NULL,FALSE,FALSE,NULL)) == NULL)
+#define xbee_sem_destroy(a)       CloseHandle((a))
+#define xbee_sem_wait(a)          WaitForSingleObject((a),INFINITE)
+#define xbee_sem_wait1sec(a)      WaitForSingleObject((a),1000)
+#define xbee_sem_post(a)          SetEvent((a))
+
+#define xbee_cond_init(a)         InitializeConditionVariable(&(a))
+#define xbee_cond_destroy(a)      
+#define xbee_cond_wait(a,b)       SleepConditionVariableCS(&(a),&(b),INFINITE)
+#define xbee_cond_signal(a)       WakeConditionVariable(&(a))
+#define xbee_cond_broadcast(a)    WakeAllConditionVariable(&(a))
+
+#define xbee_feof(a)              (xbee->ttyeof)
+#define xbee_ferror(a)            (0)
+#define xbee_close(a)             (((a)==xbee->log)?fclose((a)):CloseHandle((a)))
+
+HWND win32_hWnd = 0;
+UINT win32_MessageID = 0;
diff --git a/thirdParty/libxbee/xsys/win32.rc b/thirdParty/libxbee/xsys/win32.rc
new file mode 100644
index 0000000000000000000000000000000000000000..80f7d33bc4d151193b3f12e5a59baf6c5b545405
--- /dev/null
+++ b/thirdParty/libxbee/xsys/win32.rc
@@ -0,0 +1,47 @@
+/* more info: http://msdn.microsoft.com/en-us/library/aa381058(v=vs.85).aspx */
+
+#define APSTUDIO_READONLY_SYMBOLS
+#include "winresrc.h"
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+
+#ifdef _WIN32
+/* Englush (UK) */
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+#pragma code_page(1252)
+#endif //_WIN32
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,4,1,0
+ FILEFLAGSMASK 0x00L
+ FILEFLAGS 0x00L
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Provides a simple interface for XBee radios"
+            VALUE "CompanyName", "attie.co.uk"
+            VALUE "FileDescription", "Provides a simple interface for XBee radios"
+            VALUE "InternalName", "libxbee"
+            VALUE "LegalCopyright", "Copyright (C) 2009 onwards Attie Grande"
+            VALUE "LegalTrademarks", ""
+            VALUE "OriginalFilename", "libxbee.dll"
+            VALUE "PrivateBuild", ""
+            VALUE "ProductName", "libxbee - http://code.google.com/p/libxbee/"
+            VALUE "ProductVersion", "v1.4.1"
+            VALUE "SpecialBuild", ""
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x809, 1200
+    END
+END
+
+
+#endif