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...