... | ... | @@ -131,7 +131,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn |
|
|
* To stop the server, press the red terminate button in the console/task area
|
|
|
* Test it with Copper: `coap://127.0.0.1`
|
|
|
* Stretch goal:
|
|
|
* Create another resource type e.g.: humidity or current Time, use real sensor values if possible
|
|
|
* Create another resource type e.g.: humidity or current time, use real sensor values if possible
|
|
|
* Tip: make a copy of `TemperatureResource.java`
|
|
|
|
|
|
### Client
|
... | ... | @@ -225,13 +225,13 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn |
|
|
* add a BasicCoapResource to the ResourceServer (Server.java, TODO 14)
|
|
|
|
|
|
```java
|
|
|
resourceServer.createResource(newBasicCoapResource(“/ACControl”,”off”,CoapMediaType.text_plain));
|
|
|
resourceServer.createResource(newBasicCoapResource("/ACControl","off",CoapMediaType.text_plain));
|
|
|
```
|
|
|
* send PUT request (Client.java, TODO 15)
|
|
|
|
|
|
```java
|
|
|
CoapRequest request = clientChannel.createRequest(true, CoapRequestCode.PUT);
|
|
|
request.setUriPath(“/ACControl”);
|
|
|
request.setUriPath("/ACControl");
|
|
|
request.setContentType(CoapMediaType.text_plain);
|
|
|
```
|
|
|
Depending on the received temperature, set the payload to high, medium, low or off
|
... | ... | |