org.ocap.hn
Class NetManager

java.lang.Object
  extended by org.ocap.hn.NetManager

public abstract class NetManager
extends Object

The NetManager is a singleton class that registers all the Devices and NetModules within a home network. It maintains an implementation dependent database of devices and NetModules.

The NetManager may be used to retrieve list of NetModule and Device in the network. The application can filter the list by specifying a name or by applying filtering rules. For example, "modelNumber = h6315, location = LivingRoom". Application can monitor availability of NetModules by registering as a listener to NetManager instance.


Constructor Summary
NetManager()
           
 
Method Summary
abstract  void addDeviceEventListener(DeviceEventListener listener)
          Adds a Device event listener to NetManager.
abstract  void addNetModuleEventListener(NetModuleEventListener listener)
          Adds a NetModule event listener to NetManager.
abstract  Device getDevice(String name)
          Returns device by name, for example, "BallRoom:DVD_PLAYER1".
abstract  NetList getDeviceList(PropertyFilter filter)
          Returns devices that match all properties set by a given filter.
static NetManager getInstance()
          Returns the singleton NetManager.
abstract  NetModule getNetModule(String deviceName, String moduleID)
          Returns NetModule by device and module ID.
abstract  NetList getNetModuleList(PropertyFilter filter)
          Returns NetModules that match all properties set by a given filter.
abstract  void removeDeviceEventListener(DeviceEventListener listener)
          Removes a Device event listener from NetManager.
abstract  void removeNetModuleEventListener(NetModuleEventListener listener)
          Removes a NetModule event listener from NetManager.
abstract  void updateDeviceList()
          Requests that the NetManager proactively refresh its local database of connected devices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetManager

public NetManager()
Method Detail

getInstance

public static NetManager getInstance()
Returns the singleton NetManager. This is the entry point for home network. If the calling application is unsigned, this method SHALL return null.

Returns:
Singleton instance of NetManager or null if the calling application is unsigned.

getNetModuleList

public abstract NetList getNetModuleList(PropertyFilter filter)
Returns NetModules that match all properties set by a given filter. Passing a null filter will return a NetList with all known NetModules.

Parameters:
filter - Filter to select out NetModules from all available NetModules
Returns:
List of NetModules satisfying filter

getNetModule

public abstract NetModule getNetModule(String deviceName,
                                       String moduleID)
Returns NetModule by device and module ID.

Parameters:
deviceName - name of the device hosting the module to retrieve
moduleID - Device unique module ID
Returns:
NetModule with the specified identifier

getDeviceList

public abstract NetList getDeviceList(PropertyFilter filter)
Returns devices that match all properties set by a given filter. All known devices and sub-devices are passed through the given filter. Passing a null filter will return a NetList with all known devices and sub-devices.

Parameters:
filter - Filter to select out devices from all connected devices
Returns:
List of devices satisfying filter

getDevice

public abstract Device getDevice(String name)
Returns device by name, for example, "BallRoom:DVD_PLAYER1". If multiple devices have the same name, then the value returned by this method is implementation specific.

Parameters:
name - Device name
Returns:
Device matching the specified name

addNetModuleEventListener

public abstract void addNetModuleEventListener(NetModuleEventListener listener)
Adds a NetModule event listener to NetManager. Listener will receive a NetModuleEvent when a new NetModule is registered or an old NetModule is removed from home network. If listener is already registered, no action is performed.

Parameters:
listener - Listener which listens to NetModule change events on home network
See Also:
removeNetModuleEventListener(org.ocap.hn.NetModuleEventListener)

removeNetModuleEventListener

public abstract void removeNetModuleEventListener(NetModuleEventListener listener)
Removes a NetModule event listener from NetManager. If the listener is not registered yet, no action is performed.

Parameters:
listener - Listener which listens to NetModule change events on home network
See Also:
addNetModuleEventListener(org.ocap.hn.NetModuleEventListener)

addDeviceEventListener

public abstract void addDeviceEventListener(DeviceEventListener listener)
Adds a Device event listener to NetManager. Listener will receive a DeviceEvent when a new Device is registered, an existing Device is removed from home network, or a Device's internal state has changed. If the listener passed in is already registered, no action is performed. When a device listener is registered, the implementation SHALL NOT generate DEVICE_ADDED events for devices previously discovered by the implementation.

Parameters:
listener - Listener which listens to Device change events on the home network
See Also:
removeDeviceEventListener(org.ocap.hn.DeviceEventListener)

removeDeviceEventListener

public abstract void removeDeviceEventListener(DeviceEventListener listener)
Removes a Device event listener from NetManager. If the listener is not registered yet, no action is performed.

Parameters:
listener - Listener which listens to Device change events on home network
See Also:
addDeviceEventListener(org.ocap.hn.DeviceEventListener)

updateDeviceList

public abstract void updateDeviceList()
Requests that the NetManager proactively refresh its local database of connected devices. This operation will be performed asynchronously. Any listeners registered with the NetManager changes to connected Devices or NetModules will be notified of any changes discovered during this process.



Copyright © 2011. All Rights Reserved.