This project contains the programs for the lab session http://www.emse.fr/~picard/cours/iot/application-layer-protocols/
This project contains the boilerplate code for the lab session http://www.emse.fr/~picard/cours/iot/application-layer-protocols/
Group `fr.emse.iotcourse`
Group `fr.emse.iotcourse`:
- module `iot-lab-app` contains the boilerplate code to develop the smart home application;
- module `iot-lab-coap-emulator` contains the emulated CoAP presence and light sensors.
# Setup
The goal of this application is to automatically manage the lighting in an IoT environment based on the readings from an outside light sensor and a presence sensor.
To run your application, you are going to use:
- the Philips Hue light bulb that was allocated to your group in the previous exercises;
- the CoRE Resource Directory used in the previous exercises;
- the CoAP device emulator used in the previous exercises.
The CoRE Resource Directory and the CoAP device emulator run on different machines on the same local network. Therefore, in this application you are using a WoT enviornment deployed on your local network that consists of:
- a Philips Hue light bulb accessed via a bridge;
- a constrained RESTful environment (CoRE) distributed across two machines; the entry point in this environment is the URI of the CoRE Resource Directory.
The boilerplate code handles for you the discovery of resources in the CoRE.
# Task
In this exercise, you are mostly concerned with the `iot-lab-app` module. Your task is to complete all the `TODOs` in the following Java classes:
These is a modular [Maven](http://maven.apache.org/) project.
This is a modular [Maven](http://maven.apache.org/) project.
To run a specific class, you can use the Maven plugin in your favorite java IDE, or run the following command:
To run a specific class, you can use the Maven plugin in your favorite Java IDE, or run the following command:
```
mvn exec:java -Dexec.mainClass="com.example.Main"
```
To run the entire setup on your own:
- to deploy a CoRE Resource Directory, you can use Cf-RD from the [Californium Tools](https://github.com/eclipse/californium.tools) repository;
- to build and run the CoAP device emulator, you can use the following commands inside the `iot-lab-coap-emulator` directory (you will build a stand-alone "fat" jar):
- register the resources to the deployed resource directory, for instance using the [Copper Firefox plugin](https://addons.mozilla.org/en-US/firefox/addon/copper-270430/) or the console client from the [Californium Tools](https://github.com/eclipse/californium.tools) repository (see the [CoRE Resource Directory](https://tools.ietf.org/html/draft-ietf-core-resource-directory-08) working draft for more details on resource registration); *note:* make sure you register the `con` and `rt` attributes.