bjoern.butzin created page: home authored by Björn Butzin's avatar Björn Butzin
......@@ -180,14 +180,8 @@ Client
3. Implement an Air Conditioner Resource with the path “/ACControl”, that can be set to “high”,
“medium”, “low” or “off”
28 <= Temperature -> high
25 <= Temperature < 28 -> medium
21 <= Temperature < 25 -> low
Temperature < 21 -> off
1. Use the eventing mechanism CoAP-Observe (Server.java, TODO 10):
* Mark the TemperatureResource as observable
`resource.setObservable(true);`
* 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) {`
......@@ -199,13 +193,10 @@ Temperature < 21 -> off
* 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
3. Implement an Air Conditioner Resource with the path “/ACControl”, that can be set to “high”,
“medium”, “low” or “off” (Client.java & Server.java, TODO 12-15):
3. Implement an Air Conditioner Resource with the path “/ACControl”, that can be set to “high”, “medium”, “low” or “off” (Client.java & Server.java, TODO 12-15):
* Change exitAfterResponse to false (Client.java, TODO 12)
* Add the observe-option to your CoAP-GET request (Client.java, TODO 13)
`request.setObserveOption(0);`
* add a BasicCoapResource to the ResourceServer (Server.java, TODO 14)
`resourceServer.createResource(newBasicCoapResource(“/ACControl”,”off”,CoapMediaType.text_plain));`
* Add the observe-option to your CoAP-GET request (Client.java, TODO 13) `request.setObserveOption(0);`
* add a BasicCoapResource to the ResourceServer (Server.java, TODO 14) `resourceServer.createResource(newBasicCoapResource(“/ACControl”,”off”,CoapMediaType.text_plain));`
* send PUT request (Client.java, TODO 15)
`CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);`
`request.setUriPath(“/ACControl”);`
......
......