bjoern.butzin created page: home authored by Björn Butzin's avatar Björn Butzin
......@@ -24,10 +24,10 @@ The following points will be covered by this tutorial:
## 2. Introduction of jCoAP
- WS4D-jCoAP: Java implementation of CoAP
-- http://ws4d.org/
-- https://gitlab.amd.e-technik.uni-rostock.de/ws4d/jcoap
- http://ws4d.org/
- https://gitlab.amd.e-technik.uni-rostock.de/ws4d/jcoap
Task 1 – Sequence Diagram
### Task 1 – Sequence Diagram
Server Side
......@@ -89,22 +89,22 @@ Client Side
1. Create a new resource class TemperatureResource (TemperatureResource.java):
* We could have used the predefined BasicCoapResource
* BasicCoapResource is a resource that just keeps a static `byte[ ]` that is:
** returned on GET requests
** replaced by the payload on PUT requests
** appended with the payload on POST requests
** deleted on DELETE requests
** We do not want a static `byte[ ]`
* returned on GET requests
* replaced by the payload on PUT requests
* appended with the payload on POST requests
* deleted on DELETE requests
* We do not want a static `byte[ ]`
* Instead we want a random number to be returned on a GET
* PUT, POST and DELETE are not used
* ->So we implemented TemperatureResource wich extends BasicCoapResource with:
** A constructor
*** To initialize the resource
*** Disallow POST, PUT and DELETE
** 2 get() Methods
*** Get a list of accepted media types [& query parameters]
*** Returns a `byte[ ]` together with its media type
** And the `getResourceType()` method
*** Wich returns a description string of the resource
* A constructor
* To initialize the resource
* Disallow POST, PUT and DELETE
* 2 get() Methods
* Get a list of accepted media types [& query parameters]
* Returns a `byte[ ]` together with its media type
* And the `getResourceType()` method
* Wich returns a description string of the resource
2. Instantiate a new ResourceServer (Server.java, FIXME 1):
* Need a CoapResourceServer to maintain resources
`CoapResourceServer resourceServer = new CoapResourceServer();`
......
......