Package net.sbbi.upnp
Class ServicesEventing
- java.lang.Object
-
- net.sbbi.upnp.ServicesEventing
-
- All Implemented Interfaces:
Runnable
public class ServicesEventing extends Object implements Runnable
This class can be used with the ServiceEventHandler interface to recieve notifications about state variables changes on a given UPNP service.- Version:
- 1.0
- Author:
- SuperBonBon
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServicesEventinggetInstance()intregister(UPNPService service, ServiceEventHandler handler, int subscriptionDuration)Register state variable events notification for a device serviceServiceEventSubscriptionregisterEvent(UPNPService service, ServiceEventHandler handler, int subscriptionDuration)Register state variable events notification for a device servicevoidrun()voidsetDaemon(boolean daemon)Set the listeniner thread as a daemon, default to true.voidsetDaemonPort(int daemonPort)Sets the listener thread port, default to 9999.booleanunRegister(UPNPService service, ServiceEventHandler handler)Unregisters events notifications from a service
-
-
-
Method Detail
-
getInstance
public static final ServicesEventing getInstance()
-
setDaemon
public void setDaemon(boolean daemon)
Set the listeniner thread as a daemon, default to true. Only works when no more objects are registered.- Parameters:
daemon- the new thread type.
-
setDaemonPort
public void setDaemonPort(int daemonPort)
Sets the listener thread port, default to 9999. Only works when no more objects are registered.- Parameters:
daemonPort- the new listening port
-
register
public int register(UPNPService service, ServiceEventHandler handler, int subscriptionDuration) throws IOException
Register state variable events notification for a device service- Parameters:
service- the service to register withhandler- the registrant objectsubscriptionDuration- subscription time in seconds, -1 for infinite time- Returns:
- the subscription duration returned by the device, 0 for an infinite duration or -1 if no subscription done
- Throws:
IOException- if some IOException error happens during coms with the device
-
registerEvent
public ServiceEventSubscription registerEvent(UPNPService service, ServiceEventHandler handler, int subscriptionDuration) throws IOException
Register state variable events notification for a device service- Parameters:
service- the service to register withhandler- the registrant objectsubscriptionDuration- subscription time in seconds, -1 for infinite time- Returns:
- an ServiceEventSubscription object instance containing all the required info or null if no subscription done
- Throws:
IOException- if some IOException error happens during coms with the device
-
unRegister
public boolean unRegister(UPNPService service, ServiceEventHandler handler) throws IOException
Unregisters events notifications from a service- Parameters:
service- the service that need to be unregisteredhandler- the handler that registered for this service- Returns:
- true if unregistered false otherwise ( the given handler never registred for the given service )
- Throws:
IOException- if some IOException error happens during coms with the device
-
-