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> TMake a CoAP GET request to the specified endpointGet the credentials used to communicate with the IKEA TRÃ…DFRI gatewaylongGet timeout for connections between the CoAP client and the IKEA TRÃ…DFRI gateway (in milliseconds)<T> TMake a CoAP POST request with a payload to the specified endpoint<T> TMake a CoAP PUT request with a payload to the specified endpointorg.eclipse.californium.core.CoapObserveRelationrequestObserve(String endpoint, org.eclipse.californium.core.CoapHandler handler) Make a CoAP observe request to the specified endpointvoidsetCredentials(Credentials credentials) Change the credentials used to communicate with the IKEA TRÃ…DFRI gatewayvoidsetTimeout(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)
-