|
a/libupnpp/device/device.cxx |
|
b/libupnpp/device/device.cxx |
|
... |
|
... |
104 |
for (it = xmlfiles.begin(); it != xmlfiles.end(); it++) {
|
104 |
for (it = xmlfiles.begin(); it != xmlfiles.end(); it++) {
|
105 |
theVD->addFile("/", it->first, it->second, "application/xml");
|
105 |
theVD->addFile("/", it->first, it->second, "application/xml");
|
106 |
}
|
106 |
}
|
107 |
|
107 |
|
108 |
// Start up the web server for sending out description files
|
108 |
// Start up the web server for sending out description files
|
109 |
m_lib->setupWebServer(description);
|
109 |
int ret;
|
|
|
110 |
if ((ret = m_lib->setupWebServer(description, &m_dvh)) != 0) {
|
|
|
111 |
LOGFAT("UpnpDevice: libupnp can't start service. Err " << ret << endl);
|
|
|
112 |
}
|
110 |
|
113 |
|
111 |
UpnpSendAdvertisement(m_lib->getdvh(), expiretime);
|
114 |
if ((ret = UpnpSendAdvertisement(m_dvh, expiretime)) != 0) {
|
|
|
115 |
LOGERR("UpnpDevice: UpnpSendAdvertisement error: " << ret << endl);
|
|
|
116 |
}
|
112 |
|
117 |
|
113 |
o_devices[m_deviceId] = this;
|
118 |
o_devices[m_deviceId] = this;
|
114 |
}
|
119 |
}
|
115 |
|
120 |
|
116 |
UpnpDevice::~UpnpDevice()
|
121 |
UpnpDevice::~UpnpDevice()
|
117 |
{
|
122 |
{
|
118 |
UpnpUnRegisterRootDevice (m_lib->getdvh());
|
123 |
UpnpUnRegisterRootDevice(m_dvh);
|
119 |
}
|
124 |
}
|
120 |
|
125 |
|
121 |
static PTMutexInit cblock;
|
126 |
static PTMutexInit cblock;
|
122 |
|
127 |
|
123 |
// Main libupnp callback: use the device id and call the right device
|
128 |
// Main libupnp callback: use the device id and call the right device
|
|
... |
|
... |
241 |
break;
|
246 |
break;
|
242 |
}
|
247 |
}
|
243 |
vector<const char *> cnames, cvalues;
|
248 |
vector<const char *> cnames, cvalues;
|
244 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
249 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
245 |
int ret =
|
250 |
int ret =
|
246 |
UpnpAcceptSubscription(m_lib->getdvh(), act->UDN, act->ServiceId,
|
251 |
UpnpAcceptSubscription(m_dvh, act->UDN, act->ServiceId,
|
247 |
&cnames[0], &cvalues[0],
|
252 |
&cnames[0], &cvalues[0],
|
248 |
int(cnames.size()), act->Sid);
|
253 |
int(cnames.size()), act->Sid);
|
249 |
if (ret != UPNP_E_SUCCESS) {
|
254 |
if (ret != UPNP_E_SUCCESS) {
|
250 |
LOGERR("UpnpDevice::callBack: UpnpAcceptSubscription failed: "
|
255 |
LOGERR("UpnpDevice::callBack: UpnpAcceptSubscription failed: "
|
251 |
<< ret << endl);
|
256 |
<< ret << endl);
|
|
... |
|
... |
287 |
return;
|
292 |
return;
|
288 |
vector<const char *> cnames, cvalues;
|
293 |
vector<const char *> cnames, cvalues;
|
289 |
vector<string> qvalues;
|
294 |
vector<string> qvalues;
|
290 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
295 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
291 |
|
296 |
|
292 |
int ret = UpnpNotify(m_lib->getdvh(), m_deviceId.c_str(),
|
297 |
int ret = UpnpNotify(m_dvh, m_deviceId.c_str(),
|
293 |
serviceId.c_str(), &cnames[0], &cvalues[0],
|
298 |
serviceId.c_str(), &cnames[0], &cvalues[0],
|
294 |
int(cnames.size()));
|
299 |
int(cnames.size()));
|
295 |
if (ret != UPNP_E_SUCCESS) {
|
300 |
if (ret != UPNP_E_SUCCESS) {
|
296 |
LOGERR("UpnpDevice::notifyEvent: UpnpNotify failed: " << ret << endl);
|
301 |
LOGERR("UpnpDevice::notifyEvent: UpnpNotify failed: " << ret << endl);
|
297 |
}
|
302 |
}
|