bjoern.butzin created page: home authored by Björn Butzin's avatar Björn Butzin
...@@ -39,7 +39,7 @@ Client Side ...@@ -39,7 +39,7 @@ Client Side
**TemperatureResource:** individual resource, inherits from BasicCoapResource **TemperatureResource:** individual resource, inherits from BasicCoapResource
**BasicCoapResource:** already implemented resource with basic functionality, implements CoapResource (interface) **BasicCoapResource:** already implemented resource with basic functionality, implements CoapResource (interface)
**CoapResource (interface):** describes interfaces that must be supported by each resource. **CoapResource (interface):** describes interfaces that must be supported by each resource.
**CoapResourceServer:** manages a list of resources, enables access of these resources from outside, implements CoapServer (interface), uses ChannelManager for connection management. **CoapResourceServer:** manages a list of resources, enables access of these resources from outside, implements CoapServer (interface)
**CoapServer (interface):** describes interfaces that must be supported by a resource server **CoapServer (interface):** describes interfaces that must be supported by a resource server
**ChannelManager:** manages channels **ChannelManager:** manages channels
**Channel:** one channel represents a connection to one client **Channel:** one channel represents a connection to one client
...@@ -106,8 +106,7 @@ You can find the required files in our repository at [file](ws4d/jcoap/tree/mast ...@@ -106,8 +106,7 @@ You can find the required files in our repository at [file](ws4d/jcoap/tree/mast
* ->So we implemented TemperatureResource wich extends BasicCoapResource with: * ->So we implemented TemperatureResource wich extends BasicCoapResource with:
* A constructor to initialize the resource and disallow POST, PUT and DELETE requests * A constructor to initialize the resource and disallow POST, PUT and DELETE requests
* Two get() Methods: * Two get() Methods:
* Get a list of accepted media types [& query parameters] * Get a list of accepted media types [& query parameters] which returns a `byte[ ]` together with its media type
* Returns a `byte[ ]` together with its media type
* And the `getResourceType()` method * And the `getResourceType()` method
* Wich returns a description string of the resource * Wich returns a description string of the resource
...@@ -199,10 +198,10 @@ You can find the required files in our repository at [file](ws4d/jcoap/tree/mast ...@@ -199,10 +198,10 @@ You can find the required files in our repository at [file](ws4d/jcoap/tree/mast
`request.setUriPath(“/ACControl”);` `request.setUriPath(“/ACControl”);`
`request.setContentType(CoapMediaType.text_plain);` `request.setContentType(CoapMediaType.text_plain);`
Depending on the received temperature, set the payload to high, medium, low or off Depending on the received temperature, set the payload to high, medium, low or off
28 <= Temperature -> high high -> 28 <= Temperature
25 <= Temperature < 28 -> medium medium -> 25 <= Temperature < 28
21 <= Temperature < 25 -> low low -> 21 <= Temperature < 25
Temperature < 21 -> off off ->Temperature < 21
`request.setPayload(“medium”.getBytes());` `request.setPayload(“medium”.getBytes());`
`clientChannel.sendMessage(request);` `clientChannel.sendMessage(request);`