|
1 | | -# light-controller |
2 | | -Light controller application for Creator Ci40 platform |
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | +# Motion-Led Controller application |
| 5 | + |
| 6 | +## Overview |
| 7 | +Motion led controller application runs on Ci40 board. One MikroE board acts as awalwm2m client having a clicker which detects motion. Controller application acts as awalwm2m server and observes any changes in lwm2m object registered by client on server, and whenever there is a change, controller gets a notification for the same, and glow led for 5 seconds. |
| 8 | + |
| 9 | +| Object Name | Object ID | Resource Name | Resource ID | |
| 10 | +| :---- | :--------------| :------------- | :-----------| |
| 11 | +| "Presence Sensor" | 3302 | "IlluminanceSensor" | 5501 | |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | +Prior to running motion led controller application, make sure that: |
| 15 | +- Awalwm2m server daemon(awa_serverd) is running. |
| 16 | +- Awalwm2m bootstrap daemon(awa_bootstrapd) is running. |
| 17 | + |
| 18 | +**NOTE:** Please do "ps" on console to see "specific" process is running or not. |
| 19 | + |
| 20 | +## Application flow diagram |
| 21 | + |
| 22 | + |
| 23 | +## API guide |
| 24 | + |
| 25 | +Motion-Led Controller documentation is available as a Doxygen presentation which is generated via the following process. |
| 26 | + |
| 27 | + 1. Install [Doxygen ](http://www.stack.nl/~dimitri/doxygen/download.html): ```` sudo apt-get install doxygen```` |
| 28 | + 2. Generate the documentation: |
| 29 | + |
| 30 | + $ motion-led-controller: mkdir build |
| 31 | + $ motion-led-controller/build: cd build |
| 32 | + $ motion-led-controller/build: cmake ../docs |
| 33 | + $ motion-led-controller/build: make docs |
| 34 | + |
| 35 | +The output can be found in the build/html directory and viewed by opening index.html with your web browser. |
| 36 | + |
| 37 | +## Running Application on Ci40 board |
| 38 | +Motion-Led Controller Application is getting started as a daemon. Although we could also start it from the command line as : |
| 39 | + |
| 40 | +*$ motion_led_controller_appd* |
| 41 | + |
| 42 | +Output looks something similar to this : |
| 43 | +``` |
| 44 | +Motion-Led Controller Application |
| 45 | +
|
| 46 | +------------------------ |
| 47 | +
|
| 48 | +
|
| 49 | +Establish server session for port:54321 and address:127.0.0.1 |
| 50 | +
|
| 51 | +Server session established |
| 52 | +
|
| 53 | +
|
| 54 | +Defining IlluminanceSensor[3302] object on awalwm2m server |
| 55 | +
|
| 56 | +Waiting for constrained device 'MotionSensorDevice' to be up |
| 57 | +
|
| 58 | +Constrained device MotionSensorDevice registered |
| 59 | +
|
| 60 | +Successfully added observe operation for sensor object[3302/0/5501] |
| 61 | +
|
| 62 | +
|
| 63 | +Received observe callback for sensor object[3302/0/5501] with value 1 |
| 64 | +
|
| 65 | +Sensor state has changed |
| 66 | +
|
| 67 | +Turn ON led on Ci40 board |
| 68 | +
|
| 69 | +Turn OFF led on Ci40 board |
| 70 | +
|
| 71 | +Received observe callback for sensor object[3302/0/5501] with value 2 |
| 72 | +
|
| 73 | +Sensor state has changed |
| 74 | +
|
| 75 | +Turn ON led on Ci40 board |
| 76 | +
|
| 77 | +Turn OFF led on Ci40 board |
| 78 | +``` |
0 commit comments