formatting of eclipse import tutorial authored by Björn Butzin's avatar Björn Butzin
...@@ -103,27 +103,27 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -103,27 +103,27 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
* Which returns a description string of the resource * Which returns a description string of the resource
#### 2. Instantiate a new ResourceServer (Server.java, FIXME 1): #### 2. Instantiate a new ResourceServer (Server.java, FIXME 1):
* Need a CoapResourceServer to maintain resources * Need a CoapResourceServer to maintain resources
```java ```java
CoapResourceServer resourceServer = new CoapResourceServer(); CoapResourceServer resourceServer = new CoapResourceServer();
``` ```
#### 3. Instantiate a new TemperatureResource (Server.java, FIXME 2): #### 3. Instantiate a new TemperatureResource (Server.java, FIXME 2):
* Resources are created like normal objects and added to the server * Resources are created like normal objects and added to the server
```java ```java
CoapResource resource = new CoapResource(); CoapResource resource = new CoapResource();
``` ```
#### 4. Add the TemperatureResource to the ResourceServer (Server.java, FIXME 3): #### 4. Add the TemperatureResource to the ResourceServer (Server.java, FIXME 3):
* Resources are created like normal objects and added to the server * Resources are created like normal objects and added to the server
```java ```java
resourceServer.createResource(resource); resourceServer.createResource(resource);
``` ```
#### 5. Run the ResourceServer (Server.java FIXME 4): #### 5. Run the ResourceServer (Server.java FIXME 4):
```java ```java
resourceServer.start(port); resourceServer.start(port);
resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
``` ```
* Run Server: Click on *[Run » Run]* in the Menu bar * Run Server: Click on *[Run » Run]* in the Menu bar
...@@ -146,7 +146,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT ...@@ -146,7 +146,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
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 * A CoapChannelManager is used to manage different connections and to establish a connection to a server
```java` ```java
channelManager = BasicCoapChannelManager.getInstance(); channelManager = BasicCoapChannelManager.getInstance();
clientChannel = channelManager.connect(CoapClient client,InetAddress serverIP, int serverPort); clientChannel = channelManager.connect(CoapClient client,InetAddress serverIP, int serverPort);
``` ```
...@@ -154,7 +154,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT ...@@ -154,7 +154,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
#### 2. Create a CoapRequest & add some Options (Client.java, FIXME 7-9): #### 2. Create a CoapRequest & add some Options (Client.java, FIXME 7-9):
* A channel represents a single connection and is used to create and send requests * A channel represents a single connection and is used to create and send requests
```java ```java
Boolean reliable = false; Boolean reliable = false;
CoapRequestCode reqCode = CoapRequestCode.GET; CoapRequestCode reqCode = CoapRequestCode.GET;
CoapRequest request = clientChannel.createRequest(reliable,reqCode); CoapRequest request = clientChannel.createRequest(reliable,reqCode);
request.setUriPath("/temperature"); request.setUriPath("/temperature");
... ...
......