19 #include <QDomDocument>
63 for (
uint i = 0; i < padding; i++)
65 return QString(
"%0Icon %1 %2x%3^%4 %5")
66 .arg(pad, m_sURL).arg(m_nWidth).arg(m_nHeight)
67 .arg(m_nDepth).arg(m_sMimeType);
87 for (
uint i = 0; i < padding; i++)
90 QString(
"%0Service %1\n"
93 "%0 Control URL: %4\n"
94 "%0 Event Sub URL: %5")
95 .arg(pad, m_sEventSubURL, m_sServiceType, m_sServiceId,
96 m_sSCPDURL, m_sControlURL, m_sEventSubURL);
122 bool m_securityPin {
false };
133 QString GetUDN(
void)
const;
135 void toMap(
InfoMap &map)
const;
137 UPnpService GetService(
const QString &urn,
bool *found =
nullptr)
const;
161 void InternalLoad( QDomNode oNode,
UPnpDevice *pCurDevice );
163 static void ProcessIconList (
const QDomNode& oListNode,
UPnpDevice *pDevice );
164 static void ProcessServiceList(
const QDomNode& oListNode,
UPnpDevice *pDevice );
165 void ProcessDeviceList (
const QDomNode& oListNode,
UPnpDevice *pDevice );
167 void OutputDevice( QTextStream &os,
169 const QString &sUserAgent =
"" );
171 static void SetStrValue (
const QDomNode &n, QString &sValue );
172 static void SetNumValue (
const QDomNode &n,
int &nValue );
173 static void SetBoolValue(
const QDomNode &n,
bool &nValue );
175 static QString FormatValue (
const NameValue &node );
176 static QString FormatValue (
const QString &sName,
const QString &sValue );
177 static QString FormatValue (
const QString &sName,
int nValue );
179 QString GetHostName ()
const;
186 bool Load (
const QString &sFileName );
187 bool Load (
const QDomDocument &xmlDevDesc );
189 void GetValidXML(
const QString &sBaseAddress,
int nPort, QTextStream &os,
const QString &sUserAgent =
"" );
190 QString GetValidXML(
const QString &sBaseAddress,
int nPort );
192 QString FindDeviceUDN(
UPnpDevice *pDevice, QString sST );
194 UPnpDevice *FindDevice(
const QString &sURI );
201 map[
"hostname"] = m_sHostName;
202 m_rootDevice.
toMap(map);
227 delete m_pDeviceDesc;
249 m_sURI (std::move( sURI )),
250 m_sUSN (std::move( sUSN )),
252 m_ttExpires ( ttExpires )
262 auto ttNow = nowAsDuration<std::chrono::microseconds>();
263 return duration_cast<std::chrono::seconds>(m_ttExpires - ttNow);
270 if (m_pDeviceDesc ==
nullptr)
273 return m_pDeviceDesc;
282 if ( pDevice ==
nullptr)
287 if (sName ==
"mythtv: MythTV AV Media Server")
297 if ( pDevice ==
nullptr)
298 return "<Unknown> (" + m_sLocation +
")";
307 map[
"location"] = m_sLocation;
327 return QString(
"\nURI:%1\nUSN:%2\nDeviceXML:%3\n"
328 "Expires:%4\nMythTV PIN:%5")
329 .arg(m_sURI, m_sUSN, m_sLocation,
330 QString::number(ExpiresInSecs().count()),
335 #endif // UPNPDEVICE_H