|
a/libupnpp/control/service.cxx |
|
b/libupnpp/control/service.cxx |
|
... |
|
... |
45 |
if (*rspp) ixmlDocument_free(*rspp);
|
45 |
if (*rspp) ixmlDocument_free(*rspp);
|
46 |
}
|
46 |
}
|
47 |
};
|
47 |
};
|
48 |
|
48 |
|
49 |
Service::Service(const UPnPDeviceDesc& device,
|
49 |
Service::Service(const UPnPDeviceDesc& device,
|
50 |
const UPnPServiceDesc& service)
|
50 |
const UPnPServiceDesc& service, bool doSubscribe)
|
51 |
: m_reporter(0),
|
51 |
: m_reporter(0),
|
52 |
m_actionURL(caturl(device.URLBase, service.controlURL)),
|
52 |
m_actionURL(caturl(device.URLBase, service.controlURL)),
|
53 |
m_eventURL(caturl(device.URLBase, service.eventSubURL)),
|
53 |
m_eventURL(caturl(device.URLBase, service.eventSubURL)),
|
54 |
m_serviceType(service.serviceType),
|
54 |
m_serviceType(service.serviceType),
|
55 |
m_deviceId(device.UDN),
|
55 |
m_deviceId(device.UDN),
|
56 |
m_friendlyName(device.friendlyName),
|
56 |
m_friendlyName(device.friendlyName),
|
57 |
m_manufacturer(device.manufacturer),
|
57 |
m_manufacturer(device.manufacturer),
|
58 |
m_modelName(device.modelName)
|
58 |
m_modelName(device.modelName)
|
59 |
{
|
59 |
{
|
|
|
60 |
// Only does anything the first time
|
60 |
initEvents();
|
61 |
initEvents();
|
|
|
62 |
if (doSubscribe)
|
61 |
subscribe();
|
63 |
subscribe();
|
62 |
}
|
64 |
}
|
|
|
65 |
|
63 |
Service::~Service()
|
66 |
Service::~Service()
|
64 |
{
|
67 |
{
|
65 |
LOGDEB("Service::~Service: unregister " << m_SID << endl);
|
68 |
LOGDEB("Service::~Service: unregister " << m_SID << endl);
|
66 |
unSubscribe();
|
69 |
unSubscribe();
|
67 |
o_calls.erase(m_SID);
|
70 |
o_calls.erase(m_SID);
|
|
... |
|
... |
159 |
}
|
162 |
}
|
160 |
|
163 |
|
161 |
return UPNP_E_SUCCESS;
|
164 |
return UPNP_E_SUCCESS;
|
162 |
}
|
165 |
}
|
163 |
|
166 |
|
|
|
167 |
// This is called once per process.
|
164 |
bool Service::initEvents()
|
168 |
bool Service::initEvents()
|
165 |
{
|
169 |
{
|
166 |
LOGDEB("Service::initEvents" << endl);
|
170 |
LOGDEB("Service::initEvents" << endl);
|
167 |
|
171 |
|
168 |
PTMutexLocker lock(cblock);
|
172 |
PTMutexLocker lock(cblock);
|