Class Observer
java.lang.Object
org.openremote.agent.protocol.tradfri.device.Observer
- All Implemented Interfaces:
org.eclipse.californium.core.CoapHandler
- Direct Known Subclasses:
DeviceObserver,GatewayObserver
The class that observes a device to automagically detect changes
-
Constructor Summary
ConstructorsConstructorDescriptionObserver(String endpoint, CoapClient coapClient) Construct the Observer class -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcallEventHandlers(String payload) Call the appropriate event handlersprotected booleancheckChanges(Object oldValue, Object newValue) Check if there is a difference between the old value and the new valuevoidonError()Handles an error from the CoAP clientvoidonLoad(org.eclipse.californium.core.CoapResponse coapResponse) Handles a new response from the CoAP clientbooleanstart()Start observing the endpoint to automagically detect changesbooleanstop()Stop observing the device
-
Constructor Details
-
Observer
Construct the Observer class- Parameters:
endpoint- The endpoint to observecoapClient- A CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway
-
-
Method Details
-
start
public boolean start()Start observing the endpoint to automagically detect changes- Returns:
- True if successfully started observing, false if not
-
stop
public boolean stop()Stop observing the device- Returns:
- True if successfully stopped observing, false if not
-
checkChanges
Check if there is a difference between the old value and the new value- Parameters:
oldValue- The old valuenewValue- The new value- Returns:
- True if there is a difference between the old value and the new value, false if they are the same
-
onLoad
public void onLoad(org.eclipse.californium.core.CoapResponse coapResponse) Handles a new response from the CoAP client- Specified by:
onLoadin interfaceorg.eclipse.californium.core.CoapHandler- Parameters:
coapResponse- The response to the CoAP request
-
onError
public void onError()Handles an error from the CoAP client- Specified by:
onErrorin interfaceorg.eclipse.californium.core.CoapHandler
-
callEventHandlers
Call the appropriate event handlers- Parameters:
payload- The payload text of the CoAP response
-