|
a/libupnpp/device.cxx |
|
b/libupnpp/device.cxx |
|
... |
|
... |
169 |
{
|
169 |
{
|
170 |
struct Upnp_Action_Request *act = (struct Upnp_Action_Request *)evp;
|
170 |
struct Upnp_Action_Request *act = (struct Upnp_Action_Request *)evp;
|
171 |
LOGDEB("UPNP_CONTROL_ACTION_REQUEST: " << act->ActionName <<
|
171 |
LOGDEB("UPNP_CONTROL_ACTION_REQUEST: " << act->ActionName <<
|
172 |
". Params: " << ixmlPrintDocument(act->ActionRequest) << endl);
|
172 |
". Params: " << ixmlPrintDocument(act->ActionRequest) << endl);
|
173 |
|
173 |
|
174 |
unordered_map<string, string>::const_iterator servit =
|
174 |
unordered_map<string, UpnpService*>::const_iterator servit =
|
175 |
m_serviceTypes.find(act->ServiceID);
|
175 |
m_services.find(act->ServiceID);
|
176 |
if (servit == m_serviceTypes.end()) {
|
176 |
if (servit == m_services.end()) {
|
177 |
LOGERR("Bad serviceID" << endl);
|
177 |
LOGERR("Bad serviceID" << endl);
|
178 |
return UPNP_E_INVALID_PARAM;
|
178 |
return UPNP_E_INVALID_PARAM;
|
179 |
}
|
179 |
}
|
180 |
const string& servicetype = servit->second;
|
180 |
const string& servicetype = servit->second->getServiceType();
|
181 |
|
181 |
|
182 |
unordered_map<string, soapfun>::iterator callit =
|
182 |
unordered_map<string, soapfun>::iterator callit =
|
183 |
m_calls.find(act->ActionName);
|
183 |
m_calls.find(act->ActionName);
|
184 |
if (callit == m_calls.end()) {
|
184 |
if (callit == m_calls.end()) {
|
185 |
LOGINF("No such action: " << act->ActionName << endl);
|
185 |
LOGINF("No such action: " << act->ActionName << endl);
|
|
... |
|
... |
225 |
{
|
225 |
{
|
226 |
struct Upnp_Subscription_Request *act =
|
226 |
struct Upnp_Subscription_Request *act =
|
227 |
(struct Upnp_Subscription_Request*)evp;
|
227 |
(struct Upnp_Subscription_Request*)evp;
|
228 |
LOGDEB("UPNP_EVENT_SUBSCRIPTION_REQUEST: " << act->ServiceId << endl);
|
228 |
LOGDEB("UPNP_EVENT_SUBSCRIPTION_REQUEST: " << act->ServiceId << endl);
|
229 |
|
229 |
|
|
|
230 |
unordered_map<string, UpnpService*>::const_iterator servit =
|
|
|
231 |
m_services.find(act->ServiceId);
|
|
|
232 |
if (servit == m_services.end()) {
|
|
|
233 |
LOGERR("Bad serviceID" << endl);
|
|
|
234 |
return UPNP_E_INVALID_PARAM;
|
|
|
235 |
}
|
|
|
236 |
|
230 |
vector<string> names, values, qvalues;
|
237 |
vector<string> names, values, qvalues;
|
231 |
if (!getEventData(true, act->ServiceId, names, values)) {
|
238 |
if (!servit->second->getEventData(true, names, values)) {
|
232 |
break;
|
239 |
break;
|
233 |
}
|
240 |
}
|
234 |
vector<const char *> cnames, cvalues;
|
241 |
vector<const char *> cnames, cvalues;
|
235 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
242 |
vectorstoargslists(names, values, qvalues, cnames, cvalues);
|
236 |
int ret =
|
243 |
int ret =
|
|
... |
|
... |
252 |
return UPNP_E_INVALID_PARAM;
|
259 |
return UPNP_E_INVALID_PARAM;
|
253 |
}
|
260 |
}
|
254 |
return UPNP_E_INVALID_PARAM;
|
261 |
return UPNP_E_INVALID_PARAM;
|
255 |
}
|
262 |
}
|
256 |
|
263 |
|
257 |
void UpnpDevice::addServiceType(const std::string& serviceId,
|
264 |
void UpnpDevice::addService(UpnpService *serv, const std::string& serviceId)
|
258 |
const std::string& serviceType)
|
|
|
259 |
{
|
265 |
{
|
260 |
//LOGDEB("UpnpDevice::addServiceType: [" <<
|
|
|
261 |
// serviceId << "] -> [" << serviceType << endl);
|
|
|
262 |
m_serviceTypes[serviceId] = serviceType;
|
266 |
m_services[serviceId] = serv;
|
263 |
}
|
267 |
}
|
264 |
|
268 |
|
265 |
void UpnpDevice::addActionMapping(const std::string& actName, soapfun fun)
|
269 |
void UpnpDevice::addActionMapping(const std::string& actName, soapfun fun)
|
266 |
{
|
270 |
{
|
267 |
// LOGDEB("UpnpDevice::addActionMapping:" << actName << endl);
|
271 |
// LOGDEB("UpnpDevice::addActionMapping:" << actName << endl);
|
|
... |
|
... |
372 |
|
376 |
|
373 |
count++;
|
377 |
count++;
|
374 |
bool all = count && ((count % nloopstofull) == 0);
|
378 |
bool all = count && ((count % nloopstofull) == 0);
|
375 |
//LOGDEB("UpnpDevice::eventloop count "<<count<<" all "<<all<<endl);
|
379 |
//LOGDEB("UpnpDevice::eventloop count "<<count<<" all "<<all<<endl);
|
376 |
|
380 |
|
377 |
for (unordered_map<string, string>::const_iterator it =
|
381 |
for (unordered_map<string, UpnpService*>::const_iterator it =
|
378 |
m_serviceTypes.begin(); it != m_serviceTypes.end(); it++) {
|
382 |
m_services.begin(); it != m_services.end(); it++) {
|
379 |
vector<string> names, values;
|
383 |
vector<string> names, values;
|
380 |
if (!getEventData(all, it->first, names, values) || names.empty()) {
|
384 |
if (!it->second->getEventData(all, names, values) ||
|
|
|
385 |
names.empty()) {
|
381 |
continue;
|
386 |
continue;
|
382 |
}
|
387 |
}
|
383 |
notifyEvent(it->first, names, values);
|
388 |
notifyEvent(it->first, names, values);
|
384 |
}
|
389 |
}
|
385 |
}
|
390 |
}
|