This distribution contains Friendly LwM2M client as a reference for how to use Lightweight machine-to-machine implementations for IoT devices. This code is provided under the associated LICENSE
Friendly LwM2M Client is an open-source Lightweight machine-to-machine (LwM2M) client implementation designed for IoT devices. LwM2M is a protocol specified by the Open Mobile Alliance (OMA) for remote device management and service enablement for M2M and IoT devices and systems, intended for both resource-constrained and high-performance edge devices.
- Lightweight and efficient implementation
- Supports LwM2M version 1.0 and 1.1
- Flexible configuration options
- Secure communication using DTLS
- Resource management and reporting
- Cross-platform support
Supported LwM2M OMA Objects
Mandatory
- LWM2M Security
- LwM2M Server
- Device
Optional
- LwM2M Access Control
- Connectivity Monitoring
- Firmware Update
- Supported IPSO Objects
Transport
- UDP/DTLS
Supported Interfaces & Features
Bootstrap
- Request
- Finish
- Discover
- Read
- Write
- Delete
Registration
- Register
- Update
- De-register
Device Management & Service Enablement
- Read
- Discover
- Write
- Execute
- Create
- Delete
- Send
Information reporting
- Observe
- Notify
- Cancel Observation
- Send Operation
Data Formats
- Plain Text
- Opaque
- CBOR
- TLV
- JSON
- SenML JSON
- SenML CBOR
Security
- PSK
- Raw Public Key
- No-Sec mode
Additional features
- Access control
- Connectivity monitoring
- Firmware update
- CoAP Block transfer
Note that additional features such as transport layers (TCP/TLS, SMS binding, MQTT, and HTTP transport binding); Composite operations, and Security modes (Certificate and Certificate mode with EST) are commercially available.
For more information please contact Friendly Technologies
This section provides instructions on how to build and run the Friendly LwM2M client. Also, this section will describe the environment requirements, and the setup process for the build, and explain the two methods for building and running the Friendly LwM2M client. The Friendly LwM2M client can be built and run in two different ways: using VS Code and using the command line. The method using VS Code is suitable for developing and modifying example parameters, while the command line is suitable for quick building and exploring the capabilities.
Before proceeding with the description, it should also be noted that this guide will cover running an example that demonstrates the Friendly LwM2M client functionality. The client itself is provided as a library that can be built separately.
- OS Ubuntu 22.04
- CMake version 3.10 or higher
- OpenSSL for DTLS support
- C/C++ compiler (clang-14, clang++-14)
-
Clone the repository:
git clone --recurse-submodules git@github.com:Friendly-Technologies/Friendly-LwM2M-Client.git cd Friendly-LwM2M-Client
-
Setup environment:
sh ./wpp_env_setup.sh
During step 2, documentation will also be automatically generated and launched in the browser, so for more information on the structure and usage of the Friendly LwM2M client, you can refer to it.
After successfully completing these steps, we will have a fully configured environment with the loaded source files. The next steps are to build the example and run it. As mentioned earlier, this can be done using one of the two methods: via VS Code or the command line. Each method will be detailed further.
-
Create build directory:
mkdir _build cd _build
-
Generate build scripts with CMake:
cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
-
Building:
cmake --build . --config MinSizeRel --target WppExample -j 14 --
-
Running:
cd examples ./WppExample
- Download Visual Studio Code.
- Start VS Code and open workspace which is set up for this project
File → Open Workspace
from File. - In the open window, specify the path to the file
vs-code-wpp.code-workspace
located in theFriendly-LwM2M-Client
repository. - After the workspace has loaded, go to
Extensions
(Ctrl+Shift+x), setRecommended
(Text field: @recommended) in the extensions filter, and then install all recommended extensions. - Let’s move on to the
CMake Tool
extension, the open one contains the entire main interface. - Setup
Kit
forFriendly-LwM2M-Client
project, to do this in theConfigure
section selectWpp Linux Kit
. - Setup
Build Target
, to do this in theBuild
section selectWppExample
. - Press
Build
button - Launch the client, to do this in the
Launch
section selectWppExample
, and pressRun in Terminal
button.
The generated client example is configured using the source file: Friendly-LwM2M-Client/examples/objects.cpp
. After changing the configuration, the client example should be built again.
By default, WppExample
has the following configurations:
- COAP server: coaps://demodm.friendly-tech.com:5684.
- DTLS enabled.
- Data formats: CBOR, SENML CBOR, SENML JSON, JSON, TLV.
- Objects: DEVICE, LWM2M SERVER, LWM2M SECURITY, CONNECTIVITY MONITORING, LWM2M ACCESS CONTROL, FIRMWARE UPDATE.
We welcome contributions from the community! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Please ensure your code adheres to our coding standards.
This project is licensed under the following license- see the LICENSE file for details.