We have an application on java springboot which would interact with IoT devices via HTTP Rest API. However, there is an IoT device that communicates with the LWM2M protocol. So, I need to set up an LWM2M server and make the application an LWM2M client. First I wanted to make a prototype on my local machine running application on Windows with eclipse ide. I tried importing the Leshan project from this . My ask is:
- Am I going the right way, in order to implement the LWM2M protocol locally?
- How to resolve all jars not creating with Maven clean Install.
CodePudding user response:
I have skipped the integration testing by commenting its dependency in the pom file. Then all other modules got compiled.
CodePudding user response:
Our commercial LWM2M offering that is part of Cumulocity IoT in fact is a Spring Boot application which includes Leshan. So you are definitely on the right track.
While I am not able to disclose internals, I am happy to provide you some pointers how to get this flying.
In your pom.xml, declare the needed Leshan dependencies, for example:
<dependency> <groupId>org.eclipse.leshan</groupId> <artifactId>leshan-core</artifactId> <version>2.0.0-M9</version> </dependency> <dependency> <groupId>org.eclipse.leshan</groupId> <artifactId>leshan-server-core</artifactId> <version>2.0.0-M9</version> </dependency> <dependency> <groupId>org.eclipse.leshan</groupId> <artifactId>leshan-server-cf</artifactId> <version>2.0.0-M9</version> </dependency> <dependency> <groupId>org.eclipse.leshan</groupId> <artifactId>leshan-server-redis</artifactId> <version>2.0.0-M9</version> </dependency> <dependency> <groupId>org.eclipse.californium</groupId> <artifactId>californium-core</artifactId> <version>3.7.0</version> </dependency> <dependency> <groupId>org.eclipse.californium</groupId> <artifactId>scandium</artifactId> <version>3.7.0</version> </dependency>
I assume you know how to set up a Spring Boot application using maven. If not, this tutorial shows precisely how it can be done.
In your spring boot application you then can construct a LeshanServer object and accept LWM2M traffic. Have a look at the leshan-server-demo maven module in the Eclipse Leshan source code on how to do that.