24 #include <QHostAddress> 25 #include <QXmlStreamWriter> 53 if (Request.
GetMethod().toLower() == QStringLiteral(
"description"))
55 QHostAddress base(LocalAddress);
58 QXmlStreamWriter xml(&result);
59 xml.writeStartDocument(QStringLiteral(
"1.0"));
60 xml.writeStartElement(QStringLiteral(
"root"));
61 xml.writeAttribute(QStringLiteral(
"xmlns"), QStringLiteral(
"urn:schemas-upnp-org:device-1-0"));
63 xml.writeTextElement(QStringLiteral(
"URLBase"), url);
64 xml.writeStartElement(QStringLiteral(
"specVersion"));
65 xml.writeTextElement(QStringLiteral(
"major"), QStringLiteral(
"1"));
66 xml.writeTextElement(QStringLiteral(
"minor"), QStringLiteral(
"0"));
67 xml.writeEndElement();
69 xml.writeStartElement(QStringLiteral(
"device"));
72 xml.writeTextElement(QStringLiteral(
"friendlyName"), QStringLiteral(
"Torc"));
73 xml.writeTextElement(QStringLiteral(
"manufacturer"), QStringLiteral(
"Torc"));
74 xml.writeTextElement(QStringLiteral(
"modelName"), QStringLiteral(
"Torc v1.0"));
75 xml.writeTextElement(QStringLiteral(
"UDN"), QStringLiteral(
"uuid:%1").arg(
gLocalContext->
GetUuid()));
77 xml.writeStartElement(QStringLiteral(
"iconList"));
78 xml.writeStartElement(QStringLiteral(
"icon"));
79 xml.writeTextElement(QStringLiteral(
"mimetype"), QStringLiteral(
"image/png"));
80 xml.writeTextElement(QStringLiteral(
"width"), QStringLiteral(
"36"));
81 xml.writeTextElement(QStringLiteral(
"height"), QStringLiteral(
"36"));
82 xml.writeTextElement(QStringLiteral(
"depth"), QStringLiteral(
"32"));
83 xml.writeTextElement(QStringLiteral(
"url"), QStringLiteral(
"img/android-icon-36x36.png"));
84 xml.writeEndElement();
85 xml.writeEndElement();
87 xml.writeEndElement();
88 xml.writeEndElement();
89 xml.writeEndDocument();
A class to encapsulate an incoming HTTP request.
HTTPRequestType GetHTTPRequestType(void) const
TorcLocalContext * gLocalContext
Base HTTP response handler class.
QString GetUuid(void) const
static QString IPAddressToLiteral(const QHostAddress &Address, int Port, bool UseLocalhost=true)
Convert an IP address to a string literal.
static void HandleOptions(TorcHTTPRequest &Request, int Allowed)
void SetResponseContent(const QByteArray &Content)
QString GetMethod(void) const
void SetAllowGZip(bool Allowed)
Allow gzip compression for the contents of this request.
void ProcessHTTPRequest(const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
#define TORC_ROOT_UPNP_DEVICE
void SetStatus(HTTPStatus Status)
void SetResponseType(HTTPResponseType Type)