Changes
Page history
formatting of eclipse import tutorial
authored
May 30, 2017
by
Björn Butzin
Hide whitespace changes
Inline
Side-by-side
home.markdown
View page @
f7defc67
...
...
@@ -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
#### 2. Instantiate a new ResourceServer (Server.java, FIXME 1):
*
Need a CoapResourceServer to maintain resources
```
java
CoapResourceServer
resourceServer
=
new
CoapResourceServer
();
*
Need a CoapResourceServer to maintain resources
```
java
CoapResourceServer
resourceServer
=
new
CoapResourceServer
();
```
#### 3. Instantiate a new TemperatureResource (Server.java, FIXME 2):
*
Resources are created like normal objects and added to the server
```
java
CoapResource
resource
=
new
CoapResource
();
```
java
CoapResource
resource
=
new
CoapResource
();
```
#### 4. Add the TemperatureResource to the ResourceServer (Server.java, FIXME 3):
*
Resources are created like normal objects and added to the server
```
java
resourceServer
.
createResource
(
resource
);
```
java
resourceServer
.
createResource
(
resource
);
```
#### 5. Run the ResourceServer (Server.java FIXME 4):
```
java
resourceServer
.
start
(
port
);
resourceServer
.
start
();
// equals port = CoapConstants.COAP_DEFAULT_PORT
```
java
resourceServer
.
start
(
port
);
resourceServer
.
start
();
// equals port = CoapConstants.COAP_DEFAULT_PORT
```
*
Run Server: Click on
*[Run » Run]*
in the Menu bar
...
...
@@ -146,7 +146,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
public
class
Client
implements
CoapClient
{...}
```
*
A CoapChannelManager is used to manage different connections and to establish a connection to a server
```
java
`
```
java
channelManager
=
BasicCoapChannelManager
.
getInstance
();
clientChannel
=
channelManager
.
connect
(
CoapClient
client
,
InetAddress
serverIP
,
int
serverPort
);
```
...
...
@@ -154,7 +154,7 @@ resourceServer.start(); // equals port = CoapConstants.COAP_DEFAULT_PORT
#### 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
```
java
Boolean
reliable
=
false
;
Boolean
reliable
=
false
;
CoapRequestCode
reqCode
=
CoapRequestCode
.
GET
;
CoapRequest
request
=
clientChannel
.
createRequest
(
reliable
,
reqCode
);
request
.
setUriPath
(
"/temperature"
);
...
...
...
...