... | ... | @@ -186,15 +186,16 @@ Client |
|
|
Temperature < 21 -> off
|
|
|
|
|
|
1. Use the eventing mechanism CoAP-Observe (Server.java, TODO 10):
|
|
|
• Mark the TemperatureResource as observable
|
|
|
* Mark the TemperatureResource as observable
|
|
|
`resource.setObservable(true);`
|
|
|
2. Let server notify clients every 5 s about changed TemperatureResource (Server.java, TODO 11):
|
|
|
* indicate a change for resource every 5 seconds
|
|
|
`while (true) {`
|
|
|
try {Thread.sleep(5000);}`
|
|
|
catch (InterruptedException e) {/*do nothing*/}`
|
|
|
resource.changed();`
|
|
|
}`
|
|
|
` try {Thread.sleep(5000);}`
|
|
|
` catch (InterruptedException e) {/*do nothing*/}`
|
|
|
` resource.changed();`
|
|
|
`}`
|
|
|
|
|
|
* Use the „Tasks“ view of Eclipse to find the right places
|
|
|
* Solve only TODO 10-15 as described by the following instructions - ignore other TODOs or FIXMEs
|
|
|
|
... | ... | |