|
a/libupnpp/device/device.hxx |
|
b/libupnpp/device/device.hxx |
|
... |
|
... |
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#ifndef _DEVICE_H_X_INCLUDED_
|
17 |
#ifndef _DEVICE_H_X_INCLUDED_
|
18 |
#define _DEVICE_H_X_INCLUDED_
|
18 |
#define _DEVICE_H_X_INCLUDED_
|
19 |
|
19 |
|
20 |
#include <unordered_map>
|
20 |
#include <pthread.h> // for pthread_cond_t
|
21 |
#include <functional>
|
21 |
#include <upnp/upnp.h> // for Upnp_EventType, etc
|
22 |
|
22 |
|
23 |
#include "libupnpp/soaphelp.hxx"
|
23 |
#include <functional> // for function
|
24 |
#include "libupnpp/ptmutex.hxx"
|
24 |
#include <string> // for string
|
|
|
25 |
#include <unordered_map> // for unordered_map, etc
|
|
|
26 |
#include <vector> // for vector
|
|
|
27 |
|
|
|
28 |
#include "libupnpp/ptmutex.hxx" // for PTMutexInit
|
|
|
29 |
#include "libupnpp/soaphelp.hxx" // for SoapArgs, SoapData
|
|
|
30 |
|
|
|
31 |
namespace UPnPP { class LibUPnP; }
|
|
|
32 |
namespace UPnPProvider { class UpnpService; }
|
25 |
|
33 |
|
26 |
namespace UPnPProvider {
|
34 |
namespace UPnPProvider {
|
27 |
|
35 |
|
28 |
class UpnpService;
|
|
|
29 |
|
|
|
30 |
typedef function<int (const UPnPP::SoapArgs&, UPnPP::SoapData&)> soapfun;
|
36 |
typedef std::function<int (const UPnPP::SoapArgs&, UPnPP::SoapData&)> soapfun;
|
31 |
|
37 |
|
32 |
/** Define a virtual interface to link libupnp operations to a device
|
38 |
/** Define a virtual interface to link libupnp operations to a device
|
33 |
* implementation
|
39 |
* implementation
|
34 |
*/
|
40 |
*/
|
35 |
class UpnpDevice {
|
41 |
class UpnpDevice {
|
|
... |
|
... |
81 |
// vector for ordered walking while fetching status. Order is
|
87 |
// vector for ordered walking while fetching status. Order is
|
82 |
// determine by addService() call sequence.
|
88 |
// determine by addService() call sequence.
|
83 |
std::unordered_map<std::string, UpnpService*> m_servicemap;
|
89 |
std::unordered_map<std::string, UpnpService*> m_servicemap;
|
84 |
std::vector<std::string> m_serviceids;
|
90 |
std::vector<std::string> m_serviceids;
|
85 |
std::unordered_map<std::string, soapfun> m_calls;
|
91 |
std::unordered_map<std::string, soapfun> m_calls;
|
86 |
unordered_map<string, UpnpService*>::const_iterator findService(const string& serviceid);
|
92 |
std::unordered_map<std::string, UpnpService*>::const_iterator findService(const std::string& serviceid);
|
87 |
|
93 |
|
88 |
bool m_needExit;
|
94 |
bool m_needExit;
|
89 |
/* My device handle */
|
95 |
/* My device handle */
|
90 |
UpnpDevice_Handle m_dvh;
|
96 |
UpnpDevice_Handle m_dvh;
|
91 |
|
97 |
|
|
... |
|
... |
109 |
const std::vector<std::string>& names,
|
115 |
const std::vector<std::string>& names,
|
110 |
const std::vector<std::string>& values);
|
116 |
const std::vector<std::string>& values);
|
111 |
|
117 |
|
112 |
|
118 |
|
113 |
/** Static array of devices for dispatching */
|
119 |
/** Static array of devices for dispatching */
|
114 |
static unordered_map<std::string, UpnpDevice *> o_devices;
|
120 |
static std::unordered_map<std::string, UpnpDevice *> o_devices;
|
115 |
|
121 |
|
116 |
/* Static callback for libupnp. This looks up the appropriate
|
122 |
/* Static callback for libupnp. This looks up the appropriate
|
117 |
* device using the device ID (UDN), the calls its callback
|
123 |
* device using the device ID (UDN), the calls its callback
|
118 |
* method */
|
124 |
* method */
|
119 |
static int sCallBack(Upnp_EventType et, void* evp, void*);
|
125 |
static int sCallBack(Upnp_EventType et, void* evp, void*);
|