net.sbbi.upnp
Class ServicesEventing

java.lang.Object
  extended bynet.sbbi.upnp.ServicesEventing
All Implemented Interfaces:
java.lang.Runnable

public class ServicesEventing
extends java.lang.Object
implements java.lang.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
static ServicesEventing getInstance()
           
 int register(UPNPService service, ServiceEventHandler handler, int subscriptionDuration)
          Register state variable events notification for a device service
 ServiceEventSubscription registerEvent(UPNPService service, ServiceEventHandler handler, int subscriptionDuration)
          Register state variable events notification for a device service
 void run()
           
 void setDaemon(boolean daemon)
          Set the listeniner thread as a daemon, default to true.
 void setDaemonPort(int daemonPort)
          Sets the listener thread port, default to 9999.
 boolean unRegister(UPNPService service, ServiceEventHandler handler)
          Unregisters events notifications from a service
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.io.IOException
Register state variable events notification for a device service

Parameters:
service - the service to register with
handler - the registrant object
subscriptionDuration - 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:
java.io.IOException - if some IOException error happens during coms with the device

registerEvent

public ServiceEventSubscription registerEvent(UPNPService service,
                                              ServiceEventHandler handler,
                                              int subscriptionDuration)
                                       throws java.io.IOException
Register state variable events notification for a device service

Parameters:
service - the service to register with
handler - the registrant object
subscriptionDuration - 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:
java.io.IOException - if some IOException error happens during coms with the device

unRegister

public boolean unRegister(UPNPService service,
                          ServiceEventHandler handler)
                   throws java.io.IOException
Unregisters events notifications from a service

Parameters:
service - the service that need to be unregistered
handler - the handler that registered for this service
Returns:
true if unregistered false otherwise ( the given handler never registred for the given service )
Throws:
java.io.IOException - if some IOException error happens during coms with the device

run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2005 SuperBonBon Industries. All Rights Reserved.