|
a/src/ohtime.cxx |
|
b/src/ohtime.cxx |
|
... |
|
... |
38 |
|
38 |
|
39 |
static const string sTpProduct("urn:av-openhome-org:service:Time:1");
|
39 |
static const string sTpProduct("urn:av-openhome-org:service:Time:1");
|
40 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Time");
|
40 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Time");
|
41 |
|
41 |
|
42 |
OHTime::OHTime(UpMpd *dev)
|
42 |
OHTime::OHTime(UpMpd *dev)
|
43 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev)
|
43 |
: OHService(sTpProduct, sIdProduct, dev)
|
44 |
{
|
44 |
{
|
45 |
dev->addActionMapping(this, "Time", bind(&OHTime::ohtime, this, _1, _2));
|
45 |
dev->addActionMapping(this, "Time", bind(&OHTime::ohtime, this, _1, _2));
|
46 |
}
|
46 |
}
|
47 |
|
47 |
|
48 |
void OHTime::getdata(string& trackcount, string &duration,
|
48 |
void OHTime::getdata(string& trackcount, string &duration,
|
|
... |
|
... |
69 |
st.clear();
|
69 |
st.clear();
|
70 |
getdata(st["TrackCount"], st["Duration"], st["Seconds"]);
|
70 |
getdata(st["TrackCount"], st["Duration"], st["Seconds"]);
|
71 |
return true;
|
71 |
return true;
|
72 |
}
|
72 |
}
|
73 |
|
73 |
|
74 |
bool OHTime::getEventData(bool all, std::vector<std::string>& names,
|
|
|
75 |
std::vector<std::string>& values)
|
|
|
76 |
{
|
|
|
77 |
//LOGDEB("OHTime::getEventData" << endl);
|
|
|
78 |
|
|
|
79 |
unordered_map<string, string> state;
|
|
|
80 |
makestate(state);
|
|
|
81 |
|
|
|
82 |
unordered_map<string, string> changed;
|
|
|
83 |
if (all) {
|
|
|
84 |
changed = state;
|
|
|
85 |
} else {
|
|
|
86 |
changed = diffmaps(m_state, state);
|
|
|
87 |
}
|
|
|
88 |
m_state = state;
|
|
|
89 |
|
|
|
90 |
for (auto it = changed.begin(); it != changed.end(); it++) {
|
|
|
91 |
names.push_back(it->first);
|
|
|
92 |
values.push_back(it->second);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
return true;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
int OHTime::ohtime(const SoapIncoming& sc, SoapOutgoing& data)
|
74 |
int OHTime::ohtime(const SoapIncoming& sc, SoapOutgoing& data)
|
99 |
{
|
75 |
{
|
100 |
LOGDEB("OHTime::ohtime" << endl);
|
76 |
LOGDEB("OHTime::ohtime" << endl);
|
101 |
string trackcount, duration, seconds;
|
77 |
string trackcount, duration, seconds;
|
102 |
getdata(trackcount, duration, seconds);
|
78 |
getdata(trackcount, duration, seconds);
|