Browse files

Convert UPnpDeviceDesc::Retrieve() to use MythDownloadManager.

  • Loading branch information...
1 parent 87da807 commit 7d705f1c8f391e612883155ffea4a5e98d92d2c4 @daniel-kristjansson daniel-kristjansson committed Dec 21, 2012
View
4 mythtv/libs/libmyth/backendselect.cpp
@@ -137,7 +137,7 @@ void BackendSelection::AddItem(DeviceLocation *dev)
m_mutex.unlock();
InfoMap infomap;
- dev->GetDeviceDetail(infomap, true);
+ dev->GetDeviceDetail(infomap);
// We only want the version number, not the library version info
infomap["version"] = infomap["modelnumber"].section('.', 0, 1);
@@ -184,7 +184,7 @@ bool BackendSelection::ConnectBackend(DeviceLocation *dev)
stat = client.GetConnectionInfo(m_pinCode, m_DBparams, message);
- QString backendName = dev->GetFriendlyName(true);
+ QString backendName = dev->GetFriendlyName();
if (backendName == "<Unknown>")
backendName = dev->m_sLocation;
View
4 mythtv/libs/libmythupnp/upnp.cpp
@@ -167,9 +167,9 @@ void UPnp::CleanUp()
//
//////////////////////////////////////////////////////////////////////////////
-UPnpDeviceDesc *UPnp::GetDeviceDesc( QString &sURL, bool bInQtThread )
+UPnpDeviceDesc *UPnp::GetDeviceDesc( QString &sURL )
{
- return UPnpDeviceDesc::Retrieve( sURL, bInQtThread );
+ return UPnpDeviceDesc::Retrieve( sURL );
}
//////////////////////////////////////////////////////////////////////////////
View
2 mythtv/libs/libmythupnp/upnp.h
@@ -124,7 +124,7 @@ class UPNP_PUBLIC UPnp
HttpServer *GetHttpServer() { return m_pHttpServer; }
- static UPnpDeviceDesc *GetDeviceDesc( QString &sURL, bool bInQtThread = true);
+ static UPnpDeviceDesc *GetDeviceDesc( QString &sURL );
static QString GetResultDesc( UPnPResultCode eCode );
static void FormatErrorResponse( HTTPRequest *pRequest,
View
19 mythtv/libs/libmythupnp/upnpdevice.cpp
@@ -12,7 +12,7 @@
#include "upnp.h"
#include "upnpdevice.h"
-#include "httpcomms.h"
+#include "mythdownloadmanager.h"
#include "mythlogging.h"
#include "mythversion.h" // for MYTH_BINARY_VERSION
@@ -635,22 +635,17 @@ UPnpDevice *UPnpDeviceDesc::FindDevice( UPnpDevice *pDevice,
//
/////////////////////////////////////////////////////////////////////////////
-UPnpDeviceDesc *UPnpDeviceDesc::Retrieve( QString &sURL, bool bInQtThread )
+UPnpDeviceDesc *UPnpDeviceDesc::Retrieve( QString &sURL )
{
UPnpDeviceDesc *pDevice = NULL;
- LOG(VB_UPNP, LOG_DEBUG, QString("UPnpDeviceDesc::Retrieve( %1, %2 )")
- .arg(sURL) .arg(bInQtThread));
+ LOG(VB_UPNP, LOG_DEBUG, QString("UPnpDeviceDesc::Retrieve( %1 )")
+ .arg(sURL));
- QString sXml = HttpComms::getHttp( sURL,
- 10000, // ms
- 3, // retries
- 0, // redirects
- false, // allow gzip
- NULL, // login
- bInQtThread );
+ QString sXml;
+ bool ok = GetMythDownloadManager()->download(sURL, sXml);
- if (sXml.startsWith( QString("<?xml") ))
+ if (ok && sXml.startsWith( QString("<?xml") ))
{
QString sErrorMsg;
View
23 mythtv/libs/libmythupnp/upnpdevice.h
@@ -185,7 +185,7 @@ class UPNP_PUBLIC UPnpDeviceDesc
UPnpDevice *FindDevice( const QString &sURI );
static UPnpDevice *FindDevice( UPnpDevice *pDevice, const QString &sURI );
- static UPnpDeviceDesc *Retrieve ( QString &sURL, bool bInQtThread = true );
+ static UPnpDeviceDesc *Retrieve ( QString &sURL );
void toMap(QHash<QString, QString> &map)
{
@@ -260,19 +260,19 @@ class UPNP_PUBLIC DeviceLocation : public ReferenceCounter
// ==================================================================
- UPnpDeviceDesc *GetDeviceDesc( bool bInQtThread = true )
+ UPnpDeviceDesc *GetDeviceDesc(void)
{
if (m_pDeviceDesc == NULL)
- m_pDeviceDesc = UPnpDeviceDesc::Retrieve( m_sLocation, bInQtThread );
+ m_pDeviceDesc = UPnpDeviceDesc::Retrieve( m_sLocation );
return m_pDeviceDesc;
}
// ==================================================================
- QString GetFriendlyName( bool bInQtThread = true )
+ QString GetFriendlyName(void)
{
- UPnpDeviceDesc *pDevice = GetDeviceDesc( bInQtThread );
+ UPnpDeviceDesc *pDevice = GetDeviceDesc();
if ( pDevice == NULL)
return "<Unknown>";
@@ -285,9 +285,9 @@ class UPNP_PUBLIC DeviceLocation : public ReferenceCounter
return sName;
}
- QString GetNameAndDetails( bool bInQtThread = true )
+ QString GetNameAndDetails(void)
{
- UPnpDeviceDesc *pDevice = GetDeviceDesc( bInQtThread );
+ UPnpDeviceDesc *pDevice = GetDeviceDesc();
if ( pDevice == NULL)
return "<Unknown> (" + m_sLocation + ")";
@@ -297,21 +297,20 @@ class UPNP_PUBLIC DeviceLocation : public ReferenceCounter
+ pDevice->m_rootDevice.m_sUDN;
}
- void GetDeviceDetail(QHash<QString, QString> &map,
- bool bInQtThread = true)
+ void GetDeviceDetail(QHash<QString, QString> &map)
{
map["location"] = m_sLocation;
- UPnpDeviceDesc *pDevice = GetDeviceDesc(bInQtThread);
+ UPnpDeviceDesc *pDevice = GetDeviceDesc();
if (!pDevice)
return;
pDevice->toMap(map);
}
- bool NeedSecurityPin( bool bInQtThread = true )
+ bool NeedSecurityPin(void)
{
- UPnpDeviceDesc *pDevice = GetDeviceDesc(bInQtThread);
+ UPnpDeviceDesc *pDevice = GetDeviceDesc();
if (!pDevice)
return false;

0 comments on commit 7d705f1

Please sign in to comment.