Package net.sbbi.upnp

Class 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 Detail

      • 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 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:
        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 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:
        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 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:
        IOException - if some IOException error happens during coms with the device
      • run

        public void run()
        Specified by:
        run in interface Runnable