Reader small image

You're reading from  Mastering Internet of Things

Product typeBook
Published inMar 2018
PublisherPackt
ISBN-139781788397483
Edition1st Edition
Right arrow
Author (1)
Peter Waher
Peter Waher
author image
Peter Waher

Peter Waher is the founder of Little Sister®, a standards-based distributed social network, based on the principles of edge computing, privacy & information ownership, for humans and machines. Currently, Peter advises companies on topics such as privacy, the IoT and Smart Cities. He has worked for 24 years with computers and device communication, including low-level development in assembler for resource-constrained devices to high-level system design and architecture. His award-winning applications has attracted global attention, and he has been invited to speak at prestigious events.
Read more about Peter Waher

Right arrow

Chapter 8. Interoperability

Up to this point, we have been satisfied with making our devices communicate using IP-based protocols. We've created our own communication interfaces. Doing so might be simple and a quick way to get started, but it has serious disadvantages: nobody else will be able to communicate without great effort, and we will not be able to use standardized software to help us with our tasks.

In this chapter, we will introduce the concept of application-level interoperability, how standardized technologies can help us in our work. You'll be introduced to Constrained RESTful Environments (CoRE), the Light-weight Machine-to-Machine enabler (LWM2M), a standardized object model for the management of devices based on CoAP and CoRE. IPSO Smart Objects, a set of standardized object interfaces for sensors and actuators, will also be presented. Standardized technologies will allow you to utilize existing software to interact and manage your devices, which in turn will allow you to...

Understanding the benefits of interoperability


While designing proprietary technologies might be exciting, fun, and a quick way to start experimenting and learning, it might not always be the best option. Often, there are alternatives. Others have often solved similar problems and created solutions that you might explore. Some of these might even include technologies that have been standardized by recognized standardization bodies. While these technologies might restrict you at first glance, they provide several positive advantages as well. One of these is peer review. Often, simple and obvious mistakes are caught and corrected during peer review. Experience gained during experimentation is fed back into the process, resulting in better design. Standards are more stable, and do not change quickly over time. Changes are also made in a way which avoid breaking compatibility. This makes your solutions based on them resilient and more future-proof. The technology is also more battle tested....

Achieving interoperability using CoAP


Application-layer interoperability using CoAP can be achieved by the introduction of three technologies: CoRE, LWM2M, and IPSO Smart Objects.

Discovering resources using CoRE

We've already mentioned CoRE in the previous chapter. The CoAP protocol is an artefact published by the IETF CoRE Working Group. Another artefact is the CoRE Link Format, which we've used to find what resources are available on a device. By performing a GET method call on the /.well-known/core resource, the caller will receive a Link Format document, briefly describing what resources are available on the device, and some minimal set of corresponding information, such as if the resource is observable or not.

The following is an example Link Format document, generated by our SensorCoap application developed in the previous chapter. New lines have been added for readability. Resources are separated by commas (,), and parameters for each resource are separated by semicolons (;). The obs...

Adding LWM2M to our devices


We are now ready to implement LWM2M in our projects. To do this, we create two new projects which we will call SensorLwm2m and ActuatorLwm2m, copying the corresponding code from the SensorCoap and ActuatorCoap projects. This allows us to immediately inherit what we've done to enable CoAP in our devices. We use the same hardware we've used in previous chapters. We add the Waher.Networking.LWM2M.UWP NuGet package to both projects.

Note

For .NET standard, .NET Core, or traditional .NET Framework projects, you can use the Waher.Networking.LWM2M NuGet instead. Universal Windows Platform apps use different libraries and runtime binaries when it comes to accessing network adaptors. For this reason, it requires a somewhat modified version of the original library.

We must also make sure to initialize the runtime inventory of classes with a reference to the LWM2M library assembly, at the beginning of the application, to make sure content encoding and decoding includes the...

Testing your LWM2M device


We are now ready to test our LWM2M devices. You can use any LWM2M-enabled server, either publicly available on the internet or hosted by yourself. This is one of the benefits of using standards. The examples in this chapter assume we use the publicly available Leshan server sandbox hosted by eclipse.org. The following table summarizes some of the communication parameters:

LWM2M Server Web portal:

http://leshan.eclipse.org/

LWM2M CoAP/UDP port:

5683

LWM2M CoAP/DTLS/UDP port:

5684

Bootstrap portal:

http://leshan.eclipse.org/bs/

Bootstrap CoAP/UDP port:

5783

Bootstrap CoAP/DTLS/UDP port:

5784

Home page:

https://eclipse.org/leshan/

GitHub:

https://github.com/eclipse/leshan

Configuring the bootstrap server

The first step is to configure the bootstrap server. Go to the bootstrap portal and click Add new client bootstrap configuration. The web portal will allow you to create a bootstrap configuration, where the client connects to the bootstrap server using unencrypted CoAP, and then gets...

Summary


In this chapter, you've been shown how application-layer standards can help you in your development by providing third-party infrastructure software you can use, as well as enabling them to interact with others without having to customize your code.

As you've seen, tightly-coupled interfaces are straightforward to implement. However, if you want to do something that goes beyond the interfaces that have already been established, it all becomes a bit tricky. All of the software interacting with your devices needs to be updated to take into consideration the new interfaces you create. If you want your interfaces standardized, it becomes even harder.

In this chapter, you've learned also learned the basics of CoRE, the LWM2M object model and IPSO Smart Objects. You've been introduced to the Leshan project and used it to publish sensor data and actuator control parameters using LWM2M. In the coming chapters, you will learn more about XMPP and how its loosely coupled IoT interfaces can be...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Internet of Things
Published in: Mar 2018Publisher: PacktISBN-13: 9781788397483
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Peter Waher

Peter Waher is the founder of Little Sister®, a standards-based distributed social network, based on the principles of edge computing, privacy & information ownership, for humans and machines. Currently, Peter advises companies on topics such as privacy, the IoT and Smart Cities. He has worked for 24 years with computers and device communication, including low-level development in assembler for resource-constrained devices to high-level system design and architecture. His award-winning applications has attracted global attention, and he has been invited to speak at prestigious events.
Read more about Peter Waher