19 #include <QDomDocument>
66 for (
uint i = 0; i < padding; i++)
68 return QString(
"%0Icon %1 %2x%3^%4 %5")
69 .arg(pad, m_sURL).arg(m_nWidth).arg(m_nHeight)
70 .arg(m_nDepth).arg(m_sMimeType);
90 for (
uint i = 0; i < padding; i++)
93 QString(
"%0Service %1\n"
96 "%0 Control URL: %4\n"
97 "%0 Event Sub URL: %5")
98 .arg(pad, m_sEventSubURL, m_sServiceType, m_sServiceId,
99 m_sSCPDURL, m_sControlURL, m_sEventSubURL);
125 bool m_securityPin {
false };
136 QString GetUDN(
void)
const;
138 void toMap(
InfoMap &map)
const;
140 UPnpService GetService(
const QString &urn,
bool *found =
nullptr)
const;
164 void InternalLoad( QDomNode oNode,
UPnpDevice *pCurDevice );
166 static void ProcessIconList (
const QDomNode& oListNode,
UPnpDevice *pDevice );
167 static void ProcessServiceList(
const QDomNode& oListNode,
UPnpDevice *pDevice );
168 void ProcessDeviceList (
const QDomNode& oListNode,
UPnpDevice *pDevice );
170 void OutputDevice( QTextStream &os,
172 const QString &sUserAgent =
"" );
174 static void SetStrValue (
const QDomNode &n, QString &sValue );
175 static void SetNumValue (
const QDomNode &n,
int &nValue );
176 static void SetBoolValue(
const QDomNode &n,
bool &nValue );
178 static QString FormatValue (
const NameValue &node );
179 static QString FormatValue (
const QString &sName,
const QString &sValue );
180 static QString FormatValue (
const QString &sName,
int nValue );
182 QString GetHostName ()
const;
189 bool Load (
const QString &sFileName );
190 bool Load (
const QDomDocument &xmlDevDesc );
192 void GetValidXML(
const QString &sBaseAddress,
int nPort, QTextStream &os,
const QString &sUserAgent =
"" );
193 QString GetValidXML(
const QString &sBaseAddress,
int nPort );
195 QString FindDeviceUDN(
UPnpDevice *pDevice, QString sST );
197 UPnpDevice *FindDevice(
const QString &sURI );
204 map[
"hostname"] = m_sHostName;
205 m_rootDevice.
toMap(map);
230 delete m_pDeviceDesc;
252 m_sURI (std::move( sURI )),
253 m_sUSN (std::move( sUSN )),
255 m_ttExpires ( ttExpires )
265 auto ttNow = nowAsDuration<std::chrono::microseconds>();
266 return duration_cast<std::chrono::seconds>(m_ttExpires - ttNow);
273 if (m_pDeviceDesc ==
nullptr)
276 return m_pDeviceDesc;
285 if ( pDevice ==
nullptr)
290 if (sName ==
"mythtv: MythTV AV Media Server")
300 if ( pDevice ==
nullptr)
301 return "<Unknown> (" + m_sLocation +
")";
310 map[
"location"] = m_sLocation;
330 return QString(
"\nURI:%1\nUSN:%2\nDeviceXML:%3\n"
331 "Expires:%4\nMythTV PIN:%5")
332 .arg(m_sURI, m_sUSN, m_sLocation,
333 QString::number(ExpiresInSecs().count()),
338 #endif // UPNPDEVICE_H