[From the last episode: An API provides a way for one programmer to make his or her work accessible to other programmers that want to use the code.]
One more thing before we look at the Big 3. We looked before at the communication stack, and we saw that, for two entities to communicate successfully, all levels between them must agree. That includes the very top level – the application layer.
We tend to think of an “application” as something like Microsoft Word, or perhaps a solitaire game, or even your browser. But, frankly, all kinds of stuff that we might think of as low-level is still considered to be at the application level.
Yes, your browser is an application. But the system for exchanging web pages, HTTP? Some little program on your computer has to be able to send and receive low-level messages for your browser. Even though that’s a really basic function, it’s still on the top of the stackRelated to communications: A way of organizing parts of a complicated process (like communications) so that any task relies on tasks below it and feeds the tasks above it. Related to computing: A place in memory where you store “where was I?” information when you go from, say, one function into another. Before starting a new function, you store where you were in the old one so that, when the new function ends and you’re back in the old one, you can figure out where you were and continue on.. So you can think of the application layer as being a stack of applications. Your browser would sit “on top of” the HTTP engine.
Applications and the IoT
So how does that relate to the IoTThe Internet of Things. A broad term covering many different applications where "things" are interconnected through the internet.? Well, here we have different gadgets trying to talk to each other. Let’s take an example involving detection of radon. Radon is a dangerous radioactive gas that can emanate from the ground through no fault of our own. In areas prone to this, basements are particularly vulnerable because they’re in the ground and they typically don’t have a lot of airflow to dissipate the radon gas.
So one solution is to have a radon detector that, when it detects the level of radon as too high, instructs a fan to turn on and clear out the gas. This means that the detector has to be able to talk to the fan. All the low-level communication protocolsAn agreed way of doing something. Like a convention, except that protocols tend to be related to processes. must first align for that to happen. If the detector uses Bluetooth and the fan uses WiFiA common type of wireless network used to connect computers and phones to each other and the internet., it’s not going to happen.
But those low-level layers are simply to get the message from the detector to the fan. Those protocols absolutely don’t care what the final message is; they’re just couriers holding a sealed bag, and they don’t look at the contents.
The Payload
Who does look at the contents? Ultimately, it’s some application-layer program on either side of the “wire.” A program on the radon detector side has to be able to send instructions to the fan. A program on the fan side has to be able to receive and understand the message. Engineers often refer to that message as the payloadThe main contents of a message. Using an analogy, when you receive a letter in the mail, the letter itself is the payload; the envelope is merely a carrier.. Some time in the future, when we dig into more detail, we’ll build on this.
So let’s say that the radon level goes down because the fan is on; the fan now needs to be turned back off. The detector sends a command, “Turn off the fan,” to the fan. The fan gets that command and turns off – if it can truly understand the command.
Why might it not? Well, we talked before about how interop is like human communication. So what if the detector sends, “Turn off the fan,” while the fan is listening for, “Apague el ventilador?” They’re both saying the same thing, but they’re saying it in different languages. So it’s not going to work.
Next time we’ll get more specific and look at this more from a programming language standpoint. Don’t worry, no programming knowledge will be required.
Leave a Reply