Class CoapClient
java.lang.Object
org.openremote.agent.protocol.tradfri.util.CoapClient
The class that is used to communicate with the IKEA TRÅDFRI gateway using the CoAP protocol
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
Make a CoAP GET request to the specified endpointGet the credentials used to communicate with the IKEA TRÅDFRI gatewaylong
Get timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)<T> T
Make a CoAP POST request with a payload to the specified endpoint<T> T
Make a CoAP PUT request with a payload to the specified endpointorg.eclipse.californium.core.CoapObserveRelation
requestObserve
(String endpoint, org.eclipse.californium.core.CoapHandler handler) Make a CoAP observe request to the specified endpointvoid
setCredentials
(Credentials credentials) Change the credentials used to communicate with the IKEA TRÅDFRI gatewayvoid
setTimeout
(long timeout) Change the timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)
-
Constructor Details
-
CoapClient
public CoapClient()
-
-
Method Details
-
getCredentials
Get the credentials used to communicate with the IKEA TRÅDFRI gateway- Returns:
- The credentials that can be used to authenticate to the IKEA TRÅDFRI gateway
-
setCredentials
Change the credentials used to communicate with the IKEA TRÅDFRI gateway- Parameters:
credentials
- The new credentials that can be used to authenticate to the IKEA TRÅDFRI gateway
-
getTimeout
public long getTimeout()Get timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)- Returns:
- The timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)
-
setTimeout
public void setTimeout(long timeout) Change the timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)- Parameters:
timeout
- The new timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)
-
requestObserve
public org.eclipse.californium.core.CoapObserveRelation requestObserve(String endpoint, org.eclipse.californium.core.CoapHandler handler) Make a CoAP observe request to the specified endpoint- Parameters:
endpoint
- The endpoint to make a request tohandler
- The handler to handle the responses from the observe request- Returns:
- The observe relation that represents the connection to the IKEA TRÅDFRI gateway
-
get
Make a CoAP GET request to the specified endpoint- Type Parameters:
T
- The expected type of response- Parameters:
endpoint
- The endpoint to make a request toresponseType
- The expected type of response- Returns:
- The response from the IKEA TRÅDFRI gateway (converted to the expected response type)
-
post
Make a CoAP POST request with a payload to the specified endpoint- Type Parameters:
T
- The expected type of response- Parameters:
endpoint
- The endpoint to make a request topayload
- The payload to send in the requestresponseType
- The expected type of response- Returns:
- The response from the IKEA TRÅDFRI gateway (converted to the expected response type)
-
put
Make a CoAP PUT request with a payload to the specified endpoint- Type Parameters:
T
- The expected type of response- Parameters:
endpoint
- The endpoint to make a request topayload
- The payload to send in the requestresponseType
- The expected type of response- Returns:
- The response from the IKEA TRÅDFRI gateway (converted to the expected response type)
-