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 }
NameValue
Definition: upnputil.h:40
upnpdevice.h
UPnPFeature::m_name
QString m_name
Definition: upnpserviceimpl.h:61
UPnPFeatureList::~UPnPFeatureList
~UPnPFeatureList()
Definition: upnpserviceimpl.cpp:30
UPnpDevice::m_listServices
UPnpServiceList m_listServices
Definition: upnpdevice.h:126
UPnPFeatureList::AddFeature
void AddFeature(UPnPFeature *feature)
Definition: upnpserviceimpl.cpp:36
UPnpServiceImpl::GetServiceControlURL
virtual QString GetServiceControlURL(void)=0
Provices the base URL for control commands.
UPnpServiceImpl::GetServiceEventURL
virtual QString GetServiceEventURL(void)
Provides the URL of the event portion of the service.
Definition: upnpserviceimpl.h:47
UPnpServiceImpl::RegisterService
void RegisterService(UPnpDevice *device)
Creates a UPnpService and adds it to the UPnpDevice's list of services.
Definition: upnpserviceimpl.cpp:5
feature
static const std::array< featureStruct, 7 > feature
Definition: audiooutputsettings.cpp:435
UPnPFeatureList::AddAttribute
void AddAttribute(const NameValue &attribute)
Definition: upnpserviceimpl.cpp:41
UPnpDevice
Definition: upnpdevice.h:102
UPnPFeatureList::m_features
QList< UPnPFeature * > m_features
Definition: upnpserviceimpl.h:77
UPnpServiceImpl::GetServiceId
virtual QString GetServiceId(void)=0
Provides the device specific urn.
UPnpService
Definition: upnpdevice.h:73
UPnPFeatureList::m_attributes
NameValues m_attributes
Definition: upnpserviceimpl.h:76
UPnpServiceImpl::GetServiceDescURL
virtual QString GetServiceDescURL(void)=0
Provices the URL of the service description XML.
UPnPFeature::toXML
QString toXML()
Definition: upnpserviceimpl.cpp:21
UPnPFeature
Definition: upnpserviceimpl.h:50
UPnpServiceImpl::GetServiceType
virtual QString GetServiceType(void)=0
Provices the schema urn.
upnpserviceimpl.h
UPnPFeatureList::toXML
QString toXML()
Definition: upnpserviceimpl.cpp:46
UPnPFeature::CreateXML
virtual QString CreateXML()=0
UPnPFeature::m_version
int m_version
Definition: upnpserviceimpl.h:62