public abstract class VirtualDevice extends AbstractVirtualDevice<VirtualDevice>
Modifier and Type | Class and Description |
---|---|
static interface |
VirtualDevice.AlertCallback
A callback interface for receiving notification of an Alert.
|
static class |
VirtualDevice.AlertEvent
An event passed to the
AlertCallback . |
static interface |
VirtualDevice.DataCallback
A callback interface for receiving notification of custom data.
|
static class |
VirtualDevice.DataEvent
An event passed to the
DataCallback . |
AbstractVirtualDevice.ChangeCallback<V>, AbstractVirtualDevice.ChangeEvent<V>, AbstractVirtualDevice.ErrorCallback<V>, AbstractVirtualDevice.ErrorEvent<V>, AbstractVirtualDevice.Event<V>, AbstractVirtualDevice.NamedValue<T>
Modifier and Type | Method and Description |
---|---|
abstract void |
call(java.lang.String actionName)
Deprecated.
|
abstract <T> void |
call(java.lang.String actionName,
T data)
Deprecated.
This method does not support multiple arguments. Use
createAction(String) |
abstract Action |
createAction(java.lang.String actionName)
Create an Action for this VirtualDevice.
|
abstract void |
setOnAlert(java.lang.String formatURN,
VirtualDevice.AlertCallback callback)
Set a callback that is invoked when an alert for the given format URN is
received.
|
abstract void |
setOnAlert(VirtualDevice.AlertCallback callback)
Set a callback that is invoked when any alert in the device model is
received.
|
abstract void |
setOnData(java.lang.String formatURN,
VirtualDevice.DataCallback callback)
Set a callback that is invoked when custom data for the given
format URN is received.
|
abstract void |
setOnData(VirtualDevice.DataCallback callback)
Set a callback that is invoked when any custom data in the device model
is received.
|
finish, get, getDeviceModel, getEndpointId, getLastKnown, set, setOnChange, setOnChange, setOnError, setOnError, update
@Deprecated public abstract <T> void call(java.lang.String actionName, T data)
createAction(String)
T
- the data typeactionName
- The name of the actiondata
- The data to send to the action@Deprecated public abstract void call(java.lang.String actionName)
createAction(String)
actionName
- The name of the actionpublic abstract void setOnAlert(java.lang.String formatURN, VirtualDevice.AlertCallback callback)
Note that it is possible to set a callback for a specific alert and
to set a callback for all alerts via setOnAlert(VirtualDevice.AlertCallback)
.
If there is a callback for the specific alert and for all alerts,
both callbacks will be invoked.
formatURN
- The alert format URN from the device modelcallback
- a callback to invoke when an alert is received with the
format URN, if null
, the existing callback will be removedsetOnAlert(VirtualDevice.AlertCallback)
public abstract void setOnAlert(VirtualDevice.AlertCallback callback)
Note that it is possible to set a callback for a specific alert
via setOnAlert(String, VirtualDevice.AlertCallback)
.
If there is a callback for the specific alert and for all alerts,
both callbacks will be invoked.
callback
- a callback to invoke when an alert is received,
if null
, the existing callback will be removedsetOnAlert(VirtualDevice.AlertCallback)
public abstract void setOnData(java.lang.String formatURN, VirtualDevice.DataCallback callback)
Note that it is possible to set a callback for a specific data format and
to set a callback for all formats via setOnData(VirtualDevice.DataCallback)
.
If there is a callback for the specific data and for all formats,
both callbacks will be invoked.
formatURN
- The data format URN from the device modelcallback
- a callback to invoke when custom data is received with
the format URN, if null
, the existing callback will be removedsetOnData(VirtualDevice.DataCallback)
public abstract void setOnData(VirtualDevice.DataCallback callback)
Note that it is possible to set a callback for a specific data format
via setOnData(String, VirtualDevice.DataCallback)
.
If there is a callback for the specific data and for all formats,
both callbacks will be invoked.
callback
- a callback to invoke when custom data is received,
if null
, the existing callback will be removedsetOnData(VirtualDevice.DataCallback)
public abstract Action createAction(java.lang.String actionName)
actionName
- the name of the action.