MythTV master
upnpserviceimpl.cpp
Go to the documentation of this file.
1#include "upnpserviceimpl.h"
2#include "upnpdevice.h"
3
6{
7 if (pDevice != nullptr)
8 {
9 auto *pService = new UPnpService();
10
11 pService->m_sServiceType = GetServiceType();
12 pService->m_sServiceId = GetServiceId();
13 pService->m_sSCPDURL = GetServiceDescURL();
14 pService->m_sControlURL = GetServiceControlURL();
15 pService->m_sEventSubURL = GetServiceEventURL();
16
17 pDevice->m_listServices.push_back(pService);
18 }
19}
20
22{
23 QString xml;
24 xml = "<Feature name=\"" + m_name + "\" version=\"" + QString::number(m_version) + "\">\r\n";
25 xml += CreateXML();
26 xml += "</Feature>\r\n";
27 return xml;
28}
29
31{
32 while (!m_features.isEmpty())
33 delete m_features.takeFirst();
34}
35
37{
38 m_features.append(feature);
39}
40
42{
43 m_attributes.append(attribute);
44}
45
47{
48 QString xml;
49
50 xml = "<Features ";
51 NameValues::iterator ait;
52 for (ait = m_attributes.begin(); ait != m_attributes.end(); ++ait)
53 {
54 xml += QString(" %1=\"%2\"").arg((*ait).m_sName, (*ait).m_sValue);
55 }
56 xml += ">\r\n";
57 QList<UPnPFeature*>::iterator fit;
58 for (fit = m_features.begin(); fit != m_features.end(); ++fit)
59 {
60 xml += " " + (*fit)->toXML();
61 }
62 xml += "</Features>\r\n";
63 return xml;
64}
static const std::array< featureStruct, 7 > feature
void AddFeature(UPnPFeature *feature)
QList< UPnPFeature * > m_features
void AddAttribute(const NameValue &attribute)
NameValues m_attributes
virtual QString CreateXML()=0
QString m_name
QString toXML()
UPnpServiceList m_listServices
Definition: upnpdevice.h:129
virtual QString GetServiceId(void)=0
Provides the device specific urn.
void RegisterService(UPnpDevice *device)
Creates a UPnpService and adds it to the UPnpDevice's list of services.
virtual QString GetServiceControlURL(void)=0
Provices the base URL for control commands.
virtual QString GetServiceType(void)=0
Provices the schema urn.
virtual QString GetServiceEventURL(void)
Provides the URL of the event portion of the service.
virtual QString GetServiceDescURL(void)=0
Provices the URL of the service description XML.