Chapter 5. API and a Sensor Network
Here the plot heats up. You now have everything you need to conquer the XBee’s application programming interface. This is something we need to do so we can use all the data our networks can provide. We will start with simple concepts and scaffold you up to a full understanding of the structured API communication frames. That will get you ready to create a fully scalable sensor network of your own, using the example at the end of the chapter.
What’s an API?
An application programming interface (API) is simply a set of standard interfaces created to allow one software program to interact with another. APIs let one computer application request services from another application in a standard manner. For our purposes, the most important thing to note is that APIs are specifically engineered to enable computers to talk efficiently to other computers. They are not generally designed for direct human interaction.
So far, we’ve been using the XBee radios in transparent/command mode. For example, in the simple chat we set up in Chapter 2, we were able to type text at a keyboard to enter command mode, then issue AT commands by typing them right in. When we were done with configuration, we exited command mode and went right into transparent mode, where everything typed at the keyboard was transferred verbatim to the destination radio and read directly on the screen. This was a simple way to get started with wireless networking, and it’s one of the great strengths ...
Get Building Wireless Sensor Networks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.