|
a/src/ohvolume.cxx |
|
b/src/ohvolume.cxx |
|
... |
|
... |
40 |
|
40 |
|
41 |
static const string sTpProduct("urn:av-openhome-org:service:Volume:1");
|
41 |
static const string sTpProduct("urn:av-openhome-org:service:Volume:1");
|
42 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Volume");
|
42 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Volume");
|
43 |
|
43 |
|
44 |
OHVolume::OHVolume(UpMpd *dev)
|
44 |
OHVolume::OHVolume(UpMpd *dev)
|
45 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev)
|
45 |
: OHService(sTpProduct, sIdProduct, dev)
|
46 |
{
|
46 |
{
|
47 |
dev->addActionMapping(this,"Characteristics",
|
47 |
dev->addActionMapping(this,"Characteristics",
|
48 |
bind(&OHVolume::characteristics, this, _1, _2));
|
48 |
bind(&OHVolume::characteristics, this, _1, _2));
|
49 |
dev->addActionMapping(this,"SetVolume",
|
49 |
dev->addActionMapping(this,"SetVolume",
|
50 |
bind(&OHVolume::setVolume, this, _1, _2));
|
50 |
bind(&OHVolume::setVolume, this, _1, _2));
|
|
... |
|
... |
76 |
st["Fade"] = "0";
|
76 |
st["Fade"] = "0";
|
77 |
st["FadeMax"] = "0";
|
77 |
st["FadeMax"] = "0";
|
78 |
int volume = m_dev->m_rdctl->getvolume_i();
|
78 |
int volume = m_dev->m_rdctl->getvolume_i();
|
79 |
st["Volume"] = SoapHelp::i2s(volume);
|
79 |
st["Volume"] = SoapHelp::i2s(volume);
|
80 |
st["Mute"] = volume == 0 ? "1" : "0";
|
80 |
st["Mute"] = volume == 0 ? "1" : "0";
|
81 |
return true;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
bool OHVolume::getEventData(bool all, std::vector<std::string>& names,
|
|
|
85 |
std::vector<std::string>& values)
|
|
|
86 |
{
|
|
|
87 |
//LOGDEB("OHVolume::getEventData" << endl);
|
|
|
88 |
|
|
|
89 |
unordered_map<string, string> state, changed;
|
|
|
90 |
makestate(state);
|
|
|
91 |
if (all) {
|
|
|
92 |
changed = state;
|
|
|
93 |
} else {
|
|
|
94 |
changed = diffmaps(m_state, state);
|
|
|
95 |
}
|
|
|
96 |
m_state = state;
|
|
|
97 |
|
|
|
98 |
for (auto it = changed.begin(); it != changed.end(); it++) {
|
|
|
99 |
names.push_back(it->first);
|
|
|
100 |
values.push_back(it->second);
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
return true;
|
81 |
return true;
|
104 |
}
|
82 |
}
|
105 |
|
83 |
|
106 |
int OHVolume::characteristics(const SoapIncoming& sc, SoapOutgoing& data)
|
84 |
int OHVolume::characteristics(const SoapIncoming& sc, SoapOutgoing& data)
|
107 |
{
|
85 |
{
|