Admin message
Gitlab Update from 18.6.1 to 18.6.2 runs on 2025-12-17
Changes
Page history
bjoern.butzin created page: home
authored
Sep 08, 2016
by
Björn Butzin
Show whitespace changes
Inline
Side-by-side
home.markdown
View page @
3b466d0e
...
...
@@ -15,7 +15,6 @@ The following points will be covered by this tutorial:
*
JAVA SE JDK 1.6+
*
Eclipse IDE for JAVA development
*
Prepared JAVA project files for Hands-on
*
(Copper plugin for Mozilla Firefox)
## 1. Installation of Copper Plugin for Mozilla Firefox
-
https://addons.mozilla.org/de/firefox/addon/copper-270430/
...
...
@@ -63,7 +62,6 @@ Client Side
4.
Add the TemperatureResource to the ResourceServer
5.
Run the ResourceServer
*
ToDo on client side:
1.
Establish a connection to the Server using the ChannelManager
2.
Create a CoapRequest & add some Options
...
...
@@ -98,6 +96,7 @@ Client Side
5.
Run the ResourceServer
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
...
...
@@ -116,9 +115,11 @@ Client Side
*
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();`
3.
Instantiate a new TemperatureResource (Server.java, FIXME 2):
*
Resources are created like normal objects and added to the server
`CoapResource resource = new CoapResource();`
...
...
@@ -129,6 +130,7 @@ Client Side
4.
Add the TemperatureResource to the ResourceServer (Server.java, FIXME 3):
*
Resources are created like normal objects and added to the server
`resourceServer.createResource(resource);`
5.
Run the ResourceServer (Server.java):
`resourceServer.start();`
*
Run Server: Click on Run -> Run in the Menu bar
...
...
@@ -147,7 +149,7 @@ Client
1.
Establish a connection to the Server using the ChannelManager (Client.java, FIXME 4-5):
*
A client must implement CoapClient interface
public class Client implements CoapClient {
`
public class Client implements CoapClient {
`
*
A CoapChannelManager is used to manage different connections and to establish a connection to a server
`channelManager = BasicCoapChannelManager.getInstance();`
`clientChannel = channelManager.connect(CoapClient client,InetAddress serverIP, int serverPort);`
...
...
@@ -160,7 +162,7 @@ public class Client implements CoapClient {
3.
Send the CoapRequest (Client.java, FIXME 6-8):
`clientChannel.sendMessage(request);`
4.
Wait for CoapResponse & Print the CoapResponse on the console
•
A client has some callbacks that are invoked, when the corresponding event occurs
*
A client has some callbacks that are invoked, when the corresponding event occurs
`public void onConnectionFailed(...)`
`public void onResponse(...) // = Unicast`
`public void onMCResponse(...) // MC = Multicast`
...
...
...
...