|
a/libupnpp/device/device.cxx |
|
b/libupnpp/device/device.cxx |
|
... |
|
... |
65 |
}
|
65 |
}
|
66 |
|
66 |
|
67 |
static const int expiretime = 3600;
|
67 |
static const int expiretime = 3600;
|
68 |
|
68 |
|
69 |
UpnpDevice::UpnpDevice(const string& deviceId,
|
69 |
UpnpDevice::UpnpDevice(const string& deviceId,
|
70 |
const unordered_map<string, string>& xmlfiles)
|
70 |
const unordered_map<string, VDirContent>& files)
|
71 |
: m_deviceId(deviceId), m_needExit(false), m_evloopcond(PTHREAD_COND_INITIALIZER)
|
71 |
: m_deviceId(deviceId), m_needExit(false), m_evloopcond(PTHREAD_COND_INITIALIZER)
|
72 |
{
|
72 |
{
|
73 |
//LOGDEB("UpnpDevice::UpnpDevice(" << m_deviceId << ")" << endl);
|
73 |
//LOGDEB("UpnpDevice::UpnpDevice(" << m_deviceId << ")" << endl);
|
74 |
|
74 |
|
75 |
m_lib = LibUPnP::getLibUPnP(true);
|
75 |
m_lib = LibUPnP::getLibUPnP(true);
|
|
... |
|
... |
99 |
if (theVD == 0) {
|
99 |
if (theVD == 0) {
|
100 |
LOGFAT("UpnpDevice::UpnpDevice: can't get VirtualDir" << endl);
|
100 |
LOGFAT("UpnpDevice::UpnpDevice: can't get VirtualDir" << endl);
|
101 |
return;
|
101 |
return;
|
102 |
}
|
102 |
}
|
103 |
|
103 |
|
104 |
unordered_map<string,string>::const_iterator it =
|
104 |
unordered_map<string, VDirContent>::const_iterator it =
|
105 |
xmlfiles.find("description.xml");
|
105 |
files.find("description.xml");
|
106 |
if (it == xmlfiles.end()) {
|
106 |
if (it == files.end()) {
|
107 |
LOGFAT("UpnpDevice::UpnpDevice: no description.xml found in xmlfiles"
|
107 |
LOGFAT("UpnpDevice::UpnpDevice: no description.xml found in xmlfiles"
|
108 |
<< endl);
|
108 |
<< endl);
|
109 |
return;
|
109 |
return;
|
110 |
}
|
110 |
}
|
111 |
|
111 |
|
112 |
const string& description = it->second;
|
112 |
const string& description = it->second.content;
|
113 |
|
113 |
|
114 |
for (it = xmlfiles.begin(); it != xmlfiles.end(); it++) {
|
114 |
for (it = files.begin(); it != files.end(); it++) {
|
115 |
theVD->addFile("/", it->first, it->second, "application/xml");
|
115 |
theVD->addFile("/", it->first, it->second.content, it->second.mimetype);
|
116 |
}
|
116 |
}
|
117 |
|
117 |
|
118 |
// Start up the web server for sending out description files
|
118 |
// Start up the web server for sending out description files
|
119 |
int ret;
|
119 |
int ret;
|
120 |
if ((ret = m_lib->setupWebServer(description, &m_dvh)) != 0) {
|
120 |
if ((ret = m_lib->setupWebServer(description, &m_dvh)) != 0) {
|