... | @@ -189,10 +189,6 @@ Client |
... | @@ -189,10 +189,6 @@ Client |
|
` catch (InterruptedException e) {/*do nothing*/}`
|
|
` catch (InterruptedException e) {/*do nothing*/}`
|
|
` resource.changed();`
|
|
` 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
|
|
|
|
|
|
|
|
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)
|
|
* 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 the observe-option to your CoAP-GET request (Client.java, TODO 13) `request.setObserveOption(0);`
|
... | @@ -201,11 +197,11 @@ Client |
... | @@ -201,11 +197,11 @@ Client |
|
`CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);`
|
|
`CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);`
|
|
`request.setUriPath(“/ACControl”);`
|
|
`request.setUriPath(“/ACControl”);`
|
|
`request.setContentType(CoapMediaType.text_plain);`
|
|
`request.setContentType(CoapMediaType.text_plain);`
|
|
`/*Depending on the received payload high, medium, low, off*/`
|
|
Depending on the received temperature, set the payload to high, medium, low, off
|
|
`request.setPayload(“medium”.getBytes());`
|
|
|
|
`clientChannel.sendMessage(request);`
|
|
|
|
|
|
|
|
28 <= Temperature -> high
|
|
28 <= Temperature -> high
|
|
25 <= Temperature < 28 -> medium
|
|
25 <= Temperature < 28 -> medium
|
|
21 <= Temperature < 25 -> low
|
|
21 <= Temperature < 25 -> low
|
|
Temperature < 21 -> off
|
|
Temperature < 21 -> off
|
|
|
|
`request.setPayload(“medium”.getBytes());`
|
|
|
|
`clientChannel.sendMessage(request);`
|
|
|
|
|