public abstract class UDClient extends java.lang.Object implements IModelChangeListener
UD_BATCH_MODE_CHANGED_ACTION, UD_BATTERY_DEVICE_WRITE_MODE_CHANGED_ACTION, UD_CLIENT_HEART_BEAT_EVENT, UD_DEVICE_SPECIFIC_EVENT, UD_DISCOVERING_NODES_ACTION, UD_DISCOVERING_NODES_COMPLETE_ACTION, UD_FOLDER_ADDED_ACTION, UD_FOLDER_REMOVED_ACTION, UD_FOLDER_RENAMED_ACTION, UD_GROUP_ADDED_ACTION, UD_GROUP_REMOVED_ACTION, UD_GROUP_RENAMED_ACTION, UD_INTERNET_ACCESS_DISABLED_ACTION, UD_INTERNET_ACCESS_ENABLED_ACTION, UD_INTERNET_ACCESS_EVENT, UD_INTERNET_ACCESS_FAILED_ACTION, UD_LINKER_EVENT, UD_LINKER_EVENT_CLEAR, UD_LINKER_EVENT_DEVICE_STATUS, UD_NETWORK_RENAMED_ACTION, UD_NODE_ADDED_ACTION, UD_NODE_CHANGE_LINK_ACTION, UD_NODE_CLEAR_ERROR_ACTION, UD_NODE_DEVICE_ID_CHANGED, UD_NODE_DEVICE_PROPERTY_CHANGED, UD_NODE_ENABLED_ACTION, UD_NODE_HAS_PENDING_DEVICE_WRITES_ACTION, UD_NODE_IN_ERROR_ACTION, UD_NODE_MOVED_ACTION, UD_NODE_PARENT_CHANGED_ACTION, UD_NODE_POWER_INFO_CHANGED_ACTION, UD_NODE_REMOVED_ACTION, UD_NODE_REMOVED_FROM_GROUP_ACTION, UD_NODE_RENAMED_ACTION, UD_NODE_REVISED_ACTION, UD_NODE_SUPPORTED_TYPE_INFO_CHANGED, UD_NODE_WRITING_TO_DEVICE_ACTION, UD_NODES_UPDATED_EVENT, UD_NOTIFICATION_SETTINGS_UPDATED_ACTION, UD_NTP_COMM_FAILED_ACTION, UD_NTP_SETTINGS_UPDATED_ACTION, UD_PROGRESS_EVENT_UPDATE, UD_PROGRESS_UPDATED_EVENT, UD_SYS_CONFIG_UPDATED_EVENT, UD_SYSTEM_BUSY_EVENT, UD_SYSTEM_IS_BUSY_ACTION, UD_SYSTEM_IS_IDLE_ACTION, UD_SYSTEM_IS_IN_SAFE_MODE_ACTION, UD_SYSTEM_IS_NOT_BUSY_ACTION, UD_TIME_CHANGED_ACTION, UD_TIME_CONFIG_CHANGED_ACTION, UD_TRIGGER_EVENT_GET_STATUS, UD_TRIGGER_EVENT_INFO_STRING, UD_TRIGGER_EVENT_KEY_CHANGED, UD_TRIGGER_EVENT_LEARN_IR, UD_TRIGGER_EVENT_SCHEDULE, UD_TRIGGER_EVENT_STATUS, UD_TRIGGER_EVENT_VAR_INIT, UD_TRIGGER_EVENT_VAR_STATUS, UD_TRIGGER_UPDATED_EVENT
Constructor and Description |
---|
UDClient() |
Modifier and Type | Method and Description |
---|---|
void |
addUDErrorListener(ErrorEventListener listener)
Adds an error listener to be notified of all the errors generated either
by the client or by ISY
|
void |
addUDModelChangeListener(IModelChangeListener listener)
Adds a model change listener which is notified of all the events
in ISY
|
boolean |
authenticate(java.lang.String userid,
java.lang.String pwd)
Authenticates a user
|
protected void |
cleanUp()
Override this function if you have any cleanup routines that
need to be done
|
java.util.Hashtable<java.lang.String,UDControl> |
getControls()
Returns a
Hashtable of all the UDControl
(controls) as configured in the system |
UDProxyDevice |
getDevice()
Returns the
UDProxyDevice device object which represents
ISY and its services in its entirety. |
java.util.Hashtable<java.lang.String,UDGroup> |
getGroups()
Returns a
Hashtable scenes/groups as configured in
the system |
java.util.Hashtable<java.lang.String,UDNode> |
getNodes()
Returns a
Hashtable of all the nodes (linked devices)
as configured in the system |
boolean |
isStarted()
Whether or not UDClient has started
|
void |
onNewDevice(UDProxyDevice device)
This method is called back by UDI Network Services when a new device
is announced based on the device-type as set in the
start
method |
abstract void |
onNewDeviceAnnounced(UDProxyDevice device)
Is called back when a new device is announced based on the
device-type as set in the
start(String) method |
void |
removeUDErrorListener(ErrorEventListener listener)
Removes a previously added error listener
|
void |
removeUDModelChangeListener(IModelChangeListener listener)
Removes a previously added model change listener
|
protected void |
setStarted(boolean started)
Indicates that this client has successfully been started
|
void |
start(java.lang.String deviceType)
Starts the UDclient based on the device type
|
void |
stop()
Stops the UDclient.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onDeviceOffLine, onDeviceOnLine, onDeviceSpecific, onDiscoveringNodes, onFolderRemoved, onFolderRenamed, onGroupRemoved, onGroupRenamed, onInternetAccessUpdated, onLinkerEvent, onModelChanged, onNetworkRenamed, onNewFolder, onNewGroup, onNewNode, onNodeDeviceIdChanged, onNodeDevicePropertiesRefreshed, onNodeDevicePropertiesRefreshedComplete, onNodeDevicePropertyChanged, onNodeDiscoveryStopped, onNodeEnabled, onNodeError, onNodeErrorCleared, onNodeHasPendingDeviceWrites, onNodeIsWritingToDevice, onNodeMoved, onNodeParentChanged, onNodePowerInfoChanged, onNodeRemoved, onNodeRemovedFromGroup, onNodeRenamed, onNodeRevised, onNodeSupportedTypeInfoChanged, onNodeToGroupRoleChanged, onProgress, onSystemConfigChanged, onSystemStatus, onTriggerStatus
public void start(java.lang.String deviceType)
Calling the start(String)
method instructs the UDClient Network
Services to start looking for, and issue search requests, for the
specific device type passed in as the paramter.
deviceType
- ; the uniquely identifiable type of deviceprotected void cleanUp()
public void stop()
Calling the stop()
method instructs the UDClient Network
Services to stop, all active subscriptions are canceled, and all
resources cleared
public UDProxyDevice getDevice()
UDProxyDevice
device object which represents
ISY and its services in its entirety.
UDProxyDevice
is a proxy to ISY and, as such, all ISY services are
encapsulated in this class.
public void addUDModelChangeListener(IModelChangeListener listener)
listener
- - a model change listener to be addedIModelChangeListener
public void removeUDModelChangeListener(IModelChangeListener listener)
listener
- - the model change listener to be removedIModelChangeListener
public void addUDErrorListener(ErrorEventListener listener)
listener
- - an error listener to be addedErrorEventListener
public void removeUDErrorListener(ErrorEventListener listener)
listener
- - the error listener to be removedErrorEventListener
public boolean authenticate(java.lang.String userid, java.lang.String pwd) throws NoDeviceException
userid
- - the user idpwd
- - the passwordNoDeviceException
- - Device is not foundpublic final void onNewDevice(UDProxyDevice device)
start
method
Subclasses may not override onNewDevice(UDProxyDevice)
method as the discovered
device (ISY) can be retrieved by getDevice()
method. In case the
subclass needs to be notified of a new device, it should override the onNewDeviceAnnounced(UDProxyDevice)
method
onNewDevice
in interface IModelChangeListener
device
- - The ISY on the networkgetDevice()
,
onNewDeviceAnnounced(com.universaldevices.upnp.UDProxyDevice)
public abstract void onNewDeviceAnnounced(UDProxyDevice device)
start(String)
method
Subclasses must override onNewDeviceAnnounced(UDProxyDevice)
in order to be notified of a new device
device
- - The ISY on the networkgetDevice()
,
onNewDevice(UDProxyDevice)
public java.util.Hashtable<java.lang.String,UDGroup> getGroups() throws NoDeviceException
Hashtable
scenes/groups as configured in
the systemNoDeviceException
- - Device is not foundUDGroup
,
UDNode
public java.util.Hashtable<java.lang.String,UDNode> getNodes() throws NoDeviceException
Hashtable
of all the nodes (linked devices)
as configured in the systemNoDeviceException
- - Device is not foundUDGroup
,
UDNode
public java.util.Hashtable<java.lang.String,UDControl> getControls() throws NoDeviceException
Hashtable
of all the UDControl
(controls) as configured in the system
Controls are "things" that either control or maintain the state of a device such as Power, Status, SetPoint, etc..
NoDeviceException
- - Device is not foundUDControl
public boolean isStarted()
protected void setStarted(boolean started)
Subclasses may have different methods of starting the client and, as such, they may use this method to indicate that the client has successfully started
started
- - whether or not the client started