Class Device
java.lang.Object
org.openremote.agent.protocol.tradfri.device.Device
The class that represents an IKEA TRÃ…DFRI device
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CoapClientA CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway -
Constructor Summary
ConstructorsConstructorDescriptionDevice(String name, Long creationDate, Integer instanceId, DeviceInfo deviceInfo, CoapClient coapClient) Construct the Device class -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventHandler(EventHandler<?> eventHandler) Add an event handler to the devicebooleanDisable observebooleanEnable observe to automagically detect changes to the deviceGet the creation date of the deviceGet the information of the deviceGet the CoAP endpoint of the deviceList<EventHandler<?>>Get a list of event handlers for the deviceGet the instance id of the devicegetName()Get the name of the deviceGet the properties of the devicebooleanisLight()Check if the device is aLightbooleanisPlug()Check if the device is aPlugvoidremoveEventHandler(EventHandler<?> eventHandler) Remove an event handler from the devicevoidsetCreationDate(Long creationDate) Set the creation date of the devicevoidsetInstanceId(Integer instanceId) Set the instance id of the devicevoidSet the name of the devicevoidsetProperties(DeviceProperties properties) Set the properties of the devicetoLight()Convert the device to theLightclasstoPlug()Convert the device to thePlugclass
-
Field Details
-
coapClient
A CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway
-
-
Constructor Details
-
Device
public Device(String name, Long creationDate, Integer instanceId, DeviceInfo deviceInfo, CoapClient coapClient) Construct the Device class- Parameters:
name- The name of the devicecreationDate- The creation date of the deviceinstanceId- The instance id of the devicedeviceInfo- The information of the devicecoapClient- A CoAP client that can be used to communicate with the device using the IKEA TRÃ…DFRI gateway
-
-
Method Details
-
getName
Get the name of the device- Returns:
- The name of the device
-
getCreationDate
Get the creation date of the device- Returns:
- The creation date of the device
-
getInstanceId
Get the instance id of the device- Returns:
- The instance id of the device
-
getDeviceInfo
Get the information of the device- Returns:
- The information of the device
-
setName
Set the name of the device- Parameters:
name- The name of the device
-
setCreationDate
Set the creation date of the device- Parameters:
creationDate- The creation date of the device
-
setInstanceId
Set the instance id of the device- Parameters:
instanceId- The instance id of the device
-
getProperties
Get the properties of the device- Returns:
- The properties of the device
-
setProperties
Set the properties of the device- Parameters:
properties- The properties of the device
-
getEndpoint
Get the CoAP endpoint of the device- Returns:
- The CoAP endpoint of the device
-
enableObserve
public boolean enableObserve()Enable observe to automagically detect changes to the device- Returns:
- True if successfully enabled observe, false if not
-
disableObserve
public boolean disableObserve()Disable observe- Returns:
- True if successfully disabled observe, false if not
-
getEventHandlers
Get a list of event handlers for the device- Returns:
- A list of event handlers for the device
-
addEventHandler
Add an event handler to the device- Parameters:
eventHandler- The event handler to add to the device
-
removeEventHandler
Remove an event handler from the device- Parameters:
eventHandler- The event handler to remove from the device
-
isLight
public boolean isLight()Check if the device is aLight- Returns:
- True if the device is a
Light, false if not
-
toLight
Convert the device to theLightclass- Returns:
- The device as
Light
-
isPlug
public boolean isPlug()Check if the device is aPlug- Returns:
- True if the device is a
Plug, false if not
-
toPlug
Convert the device to thePlugclass- Returns:
- The device as
Plug
-