Package net.sbbi.upnp

Class DiscoveryAdvertisement

  • All Implemented Interfaces:
    Runnable

    public class DiscoveryAdvertisement
    extends Object
    implements Runnable
    SSDP messages listener Thread, notify registered objects implementing the interface DiscoveryEventHandler when a device joins the networks or leaves it. The listener thread is set to only accept matching device description and broadcast message sender IP to avoid a security flaw with the protocol. If you are not happy with such behaviour you can set the net.sbbi.upnp.ddos.matchip system property to false to avoid this check.
    Version:
    1.0
    Author:
    SuperBonBon
    • Method Detail

      • setDaemon

        public void setDaemon​(boolean daemon)
      • registerEvent

        public void registerEvent​(int notificationEvent,
                                  String nt,
                                  DiscoveryEventHandler eventHandler)
                           throws IOException
        Registers an event category sent by UPNP devices
        Parameters:
        notificationEvent - the event type, either DiscoveryAdvertisement.EVENT_SSDP_ALIVE or DiscoveryAdvertisement.EVENT_SSDP_BYE_BYE
        nt - the type of device advertisement, upnp:rootdevice will return you all advertisement in relation with nt upnp:rootdevice a null value specify that all nt type are wanted
        eventHandler - the events handler, this objet will receive notifications..
        Throws:
        IOException - if an error ocurs when the SSDP events listeners threads starts
      • unRegisterEvent

        public void unRegisterEvent​(int notificationEvent,
                                    String nt,
                                    DiscoveryEventHandler eventHandler)
        Unregisters an event category sent by UPNP devices
        Parameters:
        notificationEvent - the event type, either DiscoveryAdvertisement.EVENT_SSDP_ALIVE or DiscoveryAdvertisement.EVENT_SSDP_BYE_BYE
        nt - the type of device advertisement, upnp:rootdevice will unregister all advertisement in relation with nt upnp:rootdevice a null value specify that all nt type are unregistered
        eventHandler - the events handler that needs to be unregistred.
      • run

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