Package com.biglybt.net.upnp.impl
Class UPnPImpl
- java.lang.Object
-
- com.biglybt.pif.utils.resourcedownloader.ResourceDownloaderAdapter
-
- com.biglybt.net.upnp.impl.UPnPImpl
-
- All Implemented Interfaces:
SSDPIGDListener
,UPnP
,ResourceDownloaderListener
public class UPnPImpl extends ResourceDownloaderAdapter implements UPnP, SSDPIGDListener
-
-
Field Summary
Fields Modifier and Type Field Description private UPnPAdapter
adapter
private AsyncDispatcher
async_dispatcher
private static AEMonitor
class_mon
private ThreadPool
device_dispatcher
private java.util.Set
device_dispatcher_pending
private int
direct_calls_ok
private java.util.Map<java.lang.String,long[]>
failed_urls
private int
http_calls_ok
private java.util.List
log_alert_history
private java.util.List
log_history
private java.util.List
log_listeners
static java.lang.String
NL
private java.util.List<UPnPListener>
rd_listeners
private AEMonitor
rd_listeners_mon
private java.util.Map<java.lang.String,UPnPRootDeviceImpl>
root_locations
private static UPnPImpl
singleton
private SSDPIGD
ssdp
protected AEMonitor
this_mon
private int
trace_index
-
Constructor Summary
Constructors Modifier Constructor Description protected
UPnPImpl(UPnPAdapter _adapter, java.lang.String[] _selected_interfaces)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLogListener(UPnPLogListener l)
void
addRootDeviceListener(UPnPListener l)
SimpleXMLParserDocument
downloadXML(UPnPDeviceImpl device, java.net.URL url)
SimpleXMLParserDocument
downloadXML(UPnPRootDeviceImpl root, java.net.URL url)
protected SimpleXMLParserDocument
downloadXMLSupport(java.lang.String friendly_name, java.net.URL url)
void
failed(ResourceDownloader downloader, ResourceDownloaderException e)
protected boolean
forceDirect()
UPnPAdapter
getAdapter()
UPnPRootDevice[]
getRootDevices()
static UPnP
getSingleton(UPnPAdapter adapter, java.lang.String[] selected_interfaces)
UPnPSSDP
getSSDP()
protected java.io.File
getTraceFile()
void
injectDiscoveryCache(java.util.Map cache)
void
interfaceChanged(java.net.NetworkInterface network_interface)
void
log(java.lang.String str)
Logs a message to all registered log listenersvoid
log(java.lang.Throwable e)
void
logAlert(java.lang.String str, boolean error, int type)
SimpleXMLParserDocument
parseXML(java.io.InputStream _is)
SimpleXMLParserDocument
performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.String request)
SimpleXMLParserDocument
performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.String request, boolean use_http_connection)
The use_http_connection flag is set to false sometimes to avoid using the URLConnection library for some dopey UPnP routers.void
removeLogListener(UPnPLogListener l)
void
removeRootDeviceListener(UPnPListener l)
void
reportActivity(ResourceDownloader downloader, java.lang.String activity)
void
reset()
resets by removing all root devices and then rediscovering themvoid
rootAlive(java.lang.String usn, java.net.URL location)
void
rootDiscovered(java.net.NetworkInterface network_interface, java.net.InetAddress local_address, java.lang.String usn, java.net.URL location)
void
rootLost(java.net.InetAddress local_address, java.lang.String usn)
void
search()
scan for newvoid
search(java.lang.String[] STs)
-
Methods inherited from class com.biglybt.pif.utils.resourcedownloader.ResourceDownloaderAdapter
completed, reportAmountComplete, reportPercentComplete
-
-
-
-
Field Detail
-
NL
public static final java.lang.String NL
- See Also:
- Constant Field Values
-
singleton
private static UPnPImpl singleton
-
class_mon
private static AEMonitor class_mon
-
adapter
private UPnPAdapter adapter
-
ssdp
private SSDPIGD ssdp
-
root_locations
private java.util.Map<java.lang.String,UPnPRootDeviceImpl> root_locations
-
log_listeners
private java.util.List log_listeners
-
log_history
private java.util.List log_history
-
log_alert_history
private java.util.List log_alert_history
-
rd_listeners
private java.util.List<UPnPListener> rd_listeners
-
rd_listeners_mon
private AEMonitor rd_listeners_mon
-
http_calls_ok
private int http_calls_ok
-
direct_calls_ok
private int direct_calls_ok
-
trace_index
private int trace_index
-
async_dispatcher
private AsyncDispatcher async_dispatcher
-
device_dispatcher
private ThreadPool device_dispatcher
-
device_dispatcher_pending
private java.util.Set device_dispatcher_pending
-
failed_urls
private java.util.Map<java.lang.String,long[]> failed_urls
-
this_mon
protected AEMonitor this_mon
-
-
Constructor Detail
-
UPnPImpl
protected UPnPImpl(UPnPAdapter _adapter, java.lang.String[] _selected_interfaces) throws UPnPException
- Throws:
UPnPException
-
-
Method Detail
-
getSingleton
public static UPnP getSingleton(UPnPAdapter adapter, java.lang.String[] selected_interfaces) throws UPnPException
- Throws:
UPnPException
-
injectDiscoveryCache
public void injectDiscoveryCache(java.util.Map cache)
- Specified by:
injectDiscoveryCache
in interfaceUPnP
-
rootDiscovered
public void rootDiscovered(java.net.NetworkInterface network_interface, java.net.InetAddress local_address, java.lang.String usn, java.net.URL location)
- Specified by:
rootDiscovered
in interfaceSSDPIGDListener
-
rootAlive
public void rootAlive(java.lang.String usn, java.net.URL location)
- Specified by:
rootAlive
in interfaceSSDPIGDListener
-
rootLost
public void rootLost(java.net.InetAddress local_address, java.lang.String usn)
- Specified by:
rootLost
in interfaceSSDPIGDListener
-
interfaceChanged
public void interfaceChanged(java.net.NetworkInterface network_interface)
- Specified by:
interfaceChanged
in interfaceSSDPIGDListener
-
search
public void search()
Description copied from interface:UPnP
scan for new
-
reset
public void reset()
Description copied from interface:UPnP
resets by removing all root devices and then rediscovering them
-
parseXML
public SimpleXMLParserDocument parseXML(java.io.InputStream _is) throws SimpleXMLParserDocumentException, java.io.IOException
- Throws:
SimpleXMLParserDocumentException
java.io.IOException
-
downloadXML
public SimpleXMLParserDocument downloadXML(UPnPRootDeviceImpl root, java.net.URL url) throws UPnPException
- Throws:
UPnPException
-
downloadXML
public SimpleXMLParserDocument downloadXML(UPnPDeviceImpl device, java.net.URL url) throws UPnPException
- Throws:
UPnPException
-
downloadXMLSupport
protected SimpleXMLParserDocument downloadXMLSupport(java.lang.String friendly_name, java.net.URL url) throws UPnPException
- Throws:
UPnPException
-
forceDirect
protected boolean forceDirect()
-
performSOAPRequest
public SimpleXMLParserDocument performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.String request) throws SimpleXMLParserDocumentException, UPnPException, java.io.IOException
- Throws:
SimpleXMLParserDocumentException
UPnPException
java.io.IOException
-
performSOAPRequest
public SimpleXMLParserDocument performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.String request, boolean use_http_connection) throws SimpleXMLParserDocumentException, UPnPException, java.io.IOException
The use_http_connection flag is set to false sometimes to avoid using the URLConnection library for some dopey UPnP routers.- Throws:
SimpleXMLParserDocumentException
UPnPException
java.io.IOException
-
getTraceFile
protected java.io.File getTraceFile()
-
getAdapter
public UPnPAdapter getAdapter()
-
reportActivity
public void reportActivity(ResourceDownloader downloader, java.lang.String activity)
- Specified by:
reportActivity
in interfaceResourceDownloaderListener
- Overrides:
reportActivity
in classResourceDownloaderAdapter
-
failed
public void failed(ResourceDownloader downloader, ResourceDownloaderException e)
- Specified by:
failed
in interfaceResourceDownloaderListener
- Overrides:
failed
in classResourceDownloaderAdapter
-
log
public void log(java.lang.Throwable e)
-
log
public void log(java.lang.String str)
Description copied from interface:UPnP
Logs a message to all registered log listeners
-
logAlert
public void logAlert(java.lang.String str, boolean error, int type)
-
addLogListener
public void addLogListener(UPnPLogListener l)
- Specified by:
addLogListener
in interfaceUPnP
-
removeLogListener
public void removeLogListener(UPnPLogListener l)
- Specified by:
removeLogListener
in interfaceUPnP
-
getRootDevices
public UPnPRootDevice[] getRootDevices()
- Specified by:
getRootDevices
in interfaceUPnP
-
addRootDeviceListener
public void addRootDeviceListener(UPnPListener l)
- Specified by:
addRootDeviceListener
in interfaceUPnP
-
removeRootDeviceListener
public void removeRootDeviceListener(UPnPListener l)
- Specified by:
removeRootDeviceListener
in interfaceUPnP
-
-