|
a/libupnpp/control/renderingcontrol.cxx |
|
b/libupnpp/control/renderingcontrol.cxx |
|
... |
|
... |
16 |
*/
|
16 |
*/
|
17 |
|
17 |
|
18 |
#include <string>
|
18 |
#include <string>
|
19 |
using namespace std;
|
19 |
using namespace std;
|
20 |
|
20 |
|
|
|
21 |
#include <upnp/upnp.h>
|
|
|
22 |
|
|
|
23 |
#include "libupnpp/soaphelp.hxx"
|
|
|
24 |
#include "libupnpp/log.hxx"
|
21 |
#include "libupnpp/control/renderingcontrol.hxx"
|
25 |
#include "libupnpp/control/renderingcontrol.hxx"
|
22 |
|
26 |
|
23 |
namespace UPnPClient {
|
27 |
namespace UPnPClient {
|
24 |
|
28 |
|
25 |
const string
|
29 |
const string
|
|
... |
|
... |
32 |
const string::size_type sz(SType.size()-2);
|
36 |
const string::size_type sz(SType.size()-2);
|
33 |
return !SType.compare(0, sz, st, 0, sz);
|
37 |
return !SType.compare(0, sz, st, 0, sz);
|
34 |
}
|
38 |
}
|
35 |
|
39 |
|
36 |
|
40 |
|
|
|
41 |
|
|
|
42 |
int RenderingControl::setVolume(int volume, const string& channel)
|
|
|
43 |
{
|
|
|
44 |
SoapEncodeInput args(m_serviceType, "SetVolume");
|
|
|
45 |
args("Channel", channel)("DesiredVolume", SoapEncodeInput::i2s(volume));
|
|
|
46 |
SoapDecodeOutput data;
|
|
|
47 |
int ret = runAction(args, data);
|
|
|
48 |
if (ret != UPNP_E_SUCCESS) {
|
|
|
49 |
return ret;
|
|
|
50 |
}
|
|
|
51 |
return 0;
|
37 |
};
|
52 |
}
|
|
|
53 |
|
|
|
54 |
int RenderingControl::getVolume(const string& channel)
|
|
|
55 |
{
|
|
|
56 |
SoapEncodeInput args(m_serviceType, "GetVolume");
|
|
|
57 |
args("Channel", channel);
|
|
|
58 |
SoapDecodeOutput data;
|
|
|
59 |
int ret = runAction(args, data);
|
|
|
60 |
if (ret != UPNP_E_SUCCESS) {
|
|
|
61 |
return ret;
|
|
|
62 |
}
|
|
|
63 |
int volume;
|
|
|
64 |
if (!data.getInt("CurrentVolume", &volume)) {
|
|
|
65 |
LOGERR("RenderingControl:getVolume: missing CurrentVolume in response"
|
|
|
66 |
<< endl);
|
|
|
67 |
return UPNP_E_BAD_RESPONSE;
|
|
|
68 |
}
|
|
|
69 |
return volume;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
} // End namespace UPnPClient
|
|
|
82 |
|