README.md 2.87 KB
Newer Older
andrei's avatar
andrei committed
1
# IoT Course: Lab 2016-10-06
2

andrei's avatar
andrei committed
3
This project contains the boilerplate code for the lab session http://www.emse.fr/~picard/cours/iot/application-layer-protocols/
4

andrei's avatar
andrei committed
5
Group `fr.emse.iotcourse`:
6 7 8 9

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

andrei's avatar
andrei committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# 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:
- `fr.emse.ci.iotcourse.MyIoTApp`
- `fr.emse.ci.iotcourse.env.PhilipsHueLightBulb`
- `fr.emse.ci.iotcourse.control.SmartLightingController`

We recommend that you proceed in the above order.
33 34 35

# Get started

andrei's avatar
andrei committed
36
This is a modular [Maven](http://maven.apache.org/) project.
37

andrei's avatar
andrei committed
38
To run a specific class, you can use the Maven plugin in your favorite Java IDE, or run the following command:
39 40 41 42 43

```
mvn exec:java -Dexec.mainClass="com.example.Main"
``` 

andrei's avatar
andrei committed
44 45 46 47 48 49 50 51 52 53 54
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):

```
mvn clean compile assembly:single
java -jar target/iot-b-coap-emulator-1.0-SNAPSHOT-jar-with-dependencies.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.

55 56 57 58
# Contact

- andrei.ciortea@emse.fr
- maxime.lefrancois@emse.fr