Class CoapClient

java.lang.Object
org.openremote.agent.protocol.tradfri.util.CoapClient

public class CoapClient extends Object
The class that is used to communicate with the IKEA TRÅDFRI gateway using the CoAP protocol
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(String endpoint, Class<T> responseType)
    Make a CoAP GET request to the specified endpoint
    Get the credentials used to communicate with the IKEA TRÅDFRI gateway
    long
    Get timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)
    <T> T
    post(String endpoint, Object payload, Class<T> responseType)
    Make a CoAP POST request with a payload to the specified endpoint
    <T> T
    put(String endpoint, Object payload, Class<T> responseType)
    Make a CoAP PUT request with a payload to the specified endpoint
    org.eclipse.californium.core.CoapObserveRelation
    requestObserve(String endpoint, org.eclipse.californium.core.CoapHandler handler)
    Make a CoAP observe request to the specified endpoint
    void
    Change the credentials used to communicate with the IKEA TRÅDFRI gateway
    void
    setTimeout(long timeout)
    Change the timeout for connections between the CoAP client and the IKEA TRÅDFRI gateway (in milliseconds)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CoapClient

      public CoapClient()
  • Method Details

    • getCredentials

      public Credentials 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

      public void setCredentials(Credentials credentials)
      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 to
      handler - 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

      public <T> T get(String endpoint, Class<T> responseType)
      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 to
      responseType - The expected type of response
      Returns:
      The response from the IKEA TRÅDFRI gateway (converted to the expected response type)
    • post

      public <T> T post(String endpoint, Object payload, Class<T> responseType)
      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 to
      payload - The payload to send in the request
      responseType - The expected type of response
      Returns:
      The response from the IKEA TRÅDFRI gateway (converted to the expected response type)
    • put

      public <T> T put(String endpoint, Object payload, Class<T> responseType)
      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 to
      payload - The payload to send in the request
      responseType - The expected type of response
      Returns:
      The response from the IKEA TRÅDFRI gateway (converted to the expected response type)