bjoern.butzin created page: home authored by Björn Butzin's avatar Björn Butzin
......@@ -190,10 +190,10 @@ Temperature < 21 -> off
`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();
`while (true) {`
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
......@@ -202,16 +202,16 @@ resource.changed();
“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);
`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”);
request.setContentType(CoapMediaType.text_plain);
/*Depending on the received payload high, medium, low, off*/
request.setPayload(“medium”.getBytes());
clientChannel.sendMessage(request);`
`CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);`
`request.setUriPath(“/ACControl”);`
`request.setContentType(CoapMediaType.text_plain);`
`/*Depending on the received payload high, medium, low, off*/`
`request.setPayload(“medium”.getBytes());`
`clientChannel.sendMessage(request);`
28 <= Temperature -> high
25 <= Temperature < 28 -> medium
......
......