... | ... | @@ -79,7 +79,8 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn |
|
|
2. Instantiate a new ResourceServer
|
|
|
3. Instantiate a new TemperatureResource
|
|
|
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):
|
|
|
* 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 |
|
|
resourceServer.createResource(resource);
|
|
|
```
|
|
|
|
|
|
#### 5. Run the ResourceServer (Server.java FIXME 4):
|
|
|
#### 5. Start the ResourceServer (Server.java FIXME 4):
|
|
|
|
|
|
```java
|
|
|
resourceServer.start(port);
|
|
|
resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
|
|
|
```
|
|
|
|
|
|
#### 6. Test:
|
|
|
* Run Server: Click on *[Run » Run]* in the Menu bar
|
|
|
* To stop the server, press the red terminate button in the console/task area
|
|
|
* 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 |
|
|
1. Establish a connection to the Server using the ChannelManager
|
|
|
2. Create a CoapRequest & add some Options
|
|
|
3. Send the CoapRequest
|
|
|
4. Wait for CoapResponse
|
|
|
5. Print the CoapResponse on the console (already done in our example)
|
|
|
4. Wait for CoapResponse & 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):
|
|
|
* 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 |
|
|
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
|
|
|
|
|
|
```java
|
... | ... | @@ -179,6 +181,7 @@ You can find the required files in our repository at [https://gitlab.amd.e-techn |
|
|
public void onMCResponse(...); // MC = Multicast
|
|
|
```
|
|
|
|
|
|
#### 5. Test:
|
|
|
* 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
|
|
|
* Stretch goal:
|
... | ... | |