... | @@ -63,6 +63,7 @@ Client Side |
... | @@ -63,6 +63,7 @@ Client Side |
|
4. Add the TemperatureResource to the ResourceServer
|
|
4. Add the TemperatureResource to the ResourceServer
|
|
5. Run the ResourceServer
|
|
5. Run the ResourceServer
|
|
|
|
|
|
|
|
|
|
* ToDo on client side:
|
|
* ToDo on client side:
|
|
1. Establish a connection to the Server using the ChannelManager
|
|
1. Establish a connection to the Server using the ChannelManager
|
|
2. Create a CoapRequest & add some Options
|
|
2. Create a CoapRequest & add some Options
|
... | @@ -70,7 +71,6 @@ Client Side |
... | @@ -70,7 +71,6 @@ Client Side |
|
4. Wait for CoapResponse
|
|
4. Wait for CoapResponse
|
|
5. Print the CoapResponse on the console
|
|
5. Print the CoapResponse on the console
|
|
|
|
|
|
|
|
|
|
## 3. Import of prepared project into Eclipse
|
|
## 3. Import of prepared project into Eclipse
|
|
1. File > Import
|
|
1. File > Import
|
|
2. General > Existing Projects ...
|
|
2. General > Existing Projects ...
|
... | @@ -202,14 +202,14 @@ request.setObserveOption(0); |
... | @@ -202,14 +202,14 @@ request.setObserveOption(0); |
|
* add a BasicCoapResource to the ResourceServer (Server.java, TODO 14)
|
|
* add a BasicCoapResource to the ResourceServer (Server.java, TODO 14)
|
|
resourceServer.createResource( newBasicCoapResource(“/ACControl”,”off”,CoapMediaType.text_plain));
|
|
resourceServer.createResource( newBasicCoapResource(“/ACControl”,”off”,CoapMediaType.text_plain));
|
|
* send PUT request (Client.java, TODO 15)
|
|
* send PUT request (Client.java, TODO 15)
|
|
`CoapRequest request = clientChannel.
|
|
`CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);
|
|
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 payload high, medium, low, off*/
|
|
request.setPayload(“medium”.getBytes());
|
|
request.setPayload(“medium”.getBytes());
|
|
clientChannel.sendMessage(request);`
|
|
clientChannel.sendMessage(request);`
|
|
* 28 <= Temperature -> high
|
|
|
|
* 25 <= Temperature < 28 -> medium
|
|
28 <= Temperature -> high
|
|
* 21 <= Temperature < 25 -> low
|
|
25 <= Temperature < 28 -> medium
|
|
* Temperature < 21 -> off |
|
21 <= Temperature < 25 -> low
|
|
\ No newline at end of file |
|
Temperature < 21 -> off |
|
|
|
\ No newline at end of file |