formatting of eclipse import tutorial authored by Björn Butzin's avatar Björn Butzin
...@@ -79,7 +79,8 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -79,7 +79,8 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
2. Instantiate a new ResourceServer 2. Instantiate a new ResourceServer
3. Instantiate a new TemperatureResource 3. Instantiate a new TemperatureResource
4. Add the TemperatureResource to the ResourceServer 4. Add the TemperatureResource to the ResourceServer
5. Run the ResourceServer 5. Start the ResourceServer
6. Test
#### 1. Create a new resource class TemperatureResource (TemperatureResource.java): #### 1. Create a new resource class TemperatureResource (TemperatureResource.java):
* We could have used the predefined `BasicCoapResource` * We could have used the predefined `BasicCoapResource`
...@@ -120,13 +121,14 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -120,13 +121,14 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
resourceServer.createResource(resource); resourceServer.createResource(resource);
``` ```
#### 5. Run the ResourceServer (Server.java FIXME 4): #### 5. Start 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
``` ```
#### 6. Test:
* Run Server: Click on *[Run » Run]* in the Menu bar * Run Server: Click on *[Run » Run]* in the Menu bar
* To stop the server, press the red terminate button in the console/task area * To stop the server, press the red terminate button in the console/task area
* Test it with Copper: `coap://127.0.0.1` * Test it with Copper: `coap://127.0.0.1`
...@@ -138,8 +140,8 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -138,8 +140,8 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
1. Establish a connection to the Server using the ChannelManager 1. Establish a connection to the Server using the ChannelManager
2. Create a CoapRequest & add some Options 2. Create a CoapRequest & add some Options
3. Send the CoapRequest 3. Send the CoapRequest
4. Wait for CoapResponse 4. Wait for CoapResponse & Print the CoapResponse on the console (already done in our example)
5. Print the CoapResponse on the console (already done in our example) 5. Test
#### 1. Establish a connection to the Server using the ChannelManager (Client.java, FIXME 5-6): #### 1. Establish a connection to the Server using the ChannelManager (Client.java, FIXME 5-6):
* A client must implement CoapClient interface * A client must implement CoapClient interface
...@@ -170,7 +172,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -170,7 +172,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
clientChannel.sendMessage(request); clientChannel.sendMessage(request);
``` ```
#### 4. Wait for CoapResponse & Print the CoapResponse on the console #### 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
```java ```java
...@@ -179,6 +181,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn ...@@ -179,6 +181,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn
public void onMCResponse(...); // MC = Multicast public void onMCResponse(...); // MC = Multicast
``` ```
#### 5. Test:
* Run Server: select Server.java and click on *[Run » Run]* in the Menu bar * Run Server: select Server.java and click on *[Run » Run]* in the Menu bar
* Run Client: select Client.java and click on *[Run » Run]* in the Menu bar * Run Client: select Client.java and click on *[Run » Run]* in the Menu bar
* Stretch goal: * Stretch goal:
... ...
......