Skip to content

malczuuu/iemu

Repository files navigation

iEmu - IoT Device Emulator

Gradle Build WebApp Build DockerHub License

Emulator application for an IoT device (with LwM2M).

Table of Contents

Features

  1. LwM2M protocol support for objects:
    • LwM2M Server (1),
    • Device (3),
    • Firmware Update (5),
    • Light Control (3311).
  2. HTTP UI for device management (REST API and Angular UI).
  3. Docker build.

Application

Application has just one view, displaying (refreshing automatically thanks to websocket connection) management UI for the device.

Configuration Profiles

It's possible to define multiple .yml files within data/ directory and control profile name with --{profile} program argument.

Consider following configuration files:

$ tree data/
data
├── config.yml
└── config-demo.yml

Then selecting profile name looks following:

config file profile
config.yml
config-demo.yml --demo

Run with Docker

Prerequisites

  1. Run LwM2M server (consider Leshan Demo Server from official repository or check here on how to use Leshan's playground).
  2. Set appropriate configuration in data/config.yml (see data/config-demo.yml if using Leshan's playground). See also chapter about configuration profiles.

No need to compile Angular, as static dist files from webapp are included as static resources in jar.

Start the container

You can use pre-built Docker image - malczuuu/iemu. Consider checking for most recent image tags.

docker run --rm -p 4500:4500 malczuuu/iemu

To run application with demo profile, use following command:

docker run --rm --env APP_ARGS=--demo -p 4500:4500 malczuuu/iemu

To mount your own profiles, use /data volume. Predefined profiles are available in data/ directory for reference.

Technologies

Repository

The repository is a monorepo:

  • root project is a Java backend (Gradle project),
  • webapp/ contains Angular frontend.

Build from source

Expand...

Project uses Java 17, mainly for compatibility reasons. You can change Java version in build.gradle.kts - project uses Foojay plugin to automatically resolve and download JDKs (see settings.gradle.kts). Minimal version for Gradle 9+ is also Java 17.

Run with IDE

Simply locate App class and run it's main method. Setting profile parameter depends on your IDE, but it should be somewhere named "Program Arguments" (not "JVM Options").

Run with Gradle application plugin

Project uses Gradle application plugin. To run application from Gradle, simply use run task.

./gradlew run

To run application with demo profile, use following command.

./gradlew run --args="--demo"

Then, browse client UI or check in your LwM2M server if the client is connected.

Build and run distribution

Run install task to produce build/install/ output. This project does not produce a fat jar, it relies on Gradle application plugin only.

./gradlew install

Then, simply call iemu executable script from bin/ directory. It launches application using jars from lib/ directory.

./build/install/iemu/bin/iemu

To run application with demo profile, use following command.

./build/install/iemu/bin/iemu --demo

For more info about see Building the distribution chapter.

About

Emulator application for an IoT device working with LwM2M

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors