|
a/libupnpp/control/service.hxx |
|
b/libupnpp/control/service.hxx |
|
... |
|
... |
21 |
#include <functional>
|
21 |
#include <functional>
|
22 |
#include <unordered_map>
|
22 |
#include <unordered_map>
|
23 |
|
23 |
|
24 |
#include <upnp/upnp.h>
|
24 |
#include <upnp/upnp.h>
|
25 |
|
25 |
|
|
|
26 |
#include "libupnpp/log.hxx"
|
26 |
#include "libupnpp/soaphelp.hxx"
|
27 |
#include "libupnpp/soaphelp.hxx"
|
27 |
#include "libupnpp/control/description.hxx"
|
28 |
#include "libupnpp/control/description.hxx"
|
28 |
#include "libupnpp/control/cdircontent.hxx"
|
29 |
#include "libupnpp/control/cdircontent.hxx"
|
29 |
|
30 |
|
30 |
namespace UPnPClient {
|
31 |
namespace UPnPClient {
|
|
... |
|
... |
108 |
std::string m_deviceId;
|
109 |
std::string m_deviceId;
|
109 |
std::string m_friendlyName;
|
110 |
std::string m_friendlyName;
|
110 |
std::string m_manufacturer;
|
111 |
std::string m_manufacturer;
|
111 |
std::string m_modelName;
|
112 |
std::string m_modelName;
|
112 |
|
113 |
|
|
|
114 |
int runTrivialAction(const std::string& nm) {
|
|
|
115 |
SoapEncodeInput args(m_serviceType, nm);
|
|
|
116 |
SoapDecodeOutput data;
|
|
|
117 |
return runAction(args, data);
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
template <class T> int runSimpleGet(const std::string& actnm,
|
|
|
121 |
const std::string& valnm,
|
|
|
122 |
T *valuep) {
|
|
|
123 |
SoapEncodeInput args(m_serviceType, actnm);
|
|
|
124 |
SoapDecodeOutput data;
|
|
|
125 |
int ret = runAction(args, data);
|
|
|
126 |
if (ret != UPNP_E_SUCCESS) {
|
|
|
127 |
return ret;
|
|
|
128 |
}
|
|
|
129 |
if (!data.get(valnm.c_str(), valuep)) {
|
|
|
130 |
LOGERR("Service::runSimpleAction: " << actnm <<
|
|
|
131 |
" missing " << valnm << " in response" << endl);
|
|
|
132 |
return UPNP_E_BAD_RESPONSE;
|
|
|
133 |
}
|
|
|
134 |
return 0;
|
|
|
135 |
}
|
|
|
136 |
template <class T> int runSimpleAction(const std::string& actnm,
|
|
|
137 |
const std::string& valnm,
|
|
|
138 |
T value) {
|
|
|
139 |
SoapEncodeInput args(m_serviceType, actnm);
|
|
|
140 |
args(valnm, SoapHelp::val2s(value));
|
|
|
141 |
SoapDecodeOutput data;
|
|
|
142 |
return runAction(args, data);
|
|
|
143 |
}
|
|
|
144 |
|
113 |
private:
|
145 |
private:
|
114 |
/** Only actually does something on the first call, to register our
|
146 |
/** Only actually does something on the first call, to register our
|
115 |
* (static) library callback */
|
147 |
* (static) library callback */
|
116 |
static bool initEvents();
|
148 |
static bool initEvents();
|
117 |
/** The static event callback given to libupnp */
|
149 |
/** The static event callback given to libupnp */
|