... | ... | @@ -177,10 +177,12 @@ public class Client implements CoapClient { |
|
|
2. Let the server notify clients every 5 seconds about a changed TemperatureResource
|
|
|
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
|
|
|
|
|
|
| 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);`
|
... | ... | @@ -209,7 +211,7 @@ request.setContentType(CoapMediaType.text_plain); |
|
|
request.setPayload(“medium”.getBytes());
|
|
|
clientChannel.sendMessage(request);`
|
|
|
|
|
|
|28 <= Temperature | -> high |
|
|
|
|25 <= Temperature < 28 | -> medium |
|
|
|
|21 <= Temperature < 25 | -> low |
|
|
|
|Temperature < 21 | -> off | |
|
|
\ No newline at end of file |
|
|
| 28 <= Temperature | -> high |
|
|
|
| 25 <= Temperature < 28 | -> medium |
|
|
|
| 21 <= Temperature < 25 | -> low |
|
|
|
| Temperature < 21 | -> off | |
|
|
\ No newline at end of file |