Package net.sbbi.upnp
Class DiscoveryAdvertisement
- java.lang.Object
-
- net.sbbi.upnp.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
-
-
Field Summary
Fields Modifier and Type Field Description static intEVENT_SSDP_ALIVEstatic intEVENT_SSDP_BYE_BYE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DiscoveryAdvertisementgetInstance()voidregisterEvent(int notificationEvent, String nt, DiscoveryEventHandler eventHandler)Registers an event category sent by UPNP devicesvoidrun()voidsetDaemon(boolean daemon)voidunRegisterEvent(int notificationEvent, String nt, DiscoveryEventHandler eventHandler)Unregisters an event category sent by UPNP devices
-
-
-
Field Detail
-
EVENT_SSDP_ALIVE
public static final int EVENT_SSDP_ALIVE
- See Also:
- Constant Field Values
-
EVENT_SSDP_BYE_BYE
public static final int EVENT_SSDP_BYE_BYE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static final DiscoveryAdvertisement getInstance()
-
setDaemon
public void setDaemon(boolean daemon)
-
registerEvent
public void registerEvent(int notificationEvent, String nt, DiscoveryEventHandler eventHandler) throws IOExceptionRegisters an event category sent by UPNP devices- Parameters:
notificationEvent- the event type, either DiscoveryAdvertisement.EVENT_SSDP_ALIVE or DiscoveryAdvertisement.EVENT_SSDP_BYE_BYEnt- 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 wantedeventHandler- 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_BYEnt- 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 unregisteredeventHandler- the events handler that needs to be unregistred.
-
-