|
a/src/ohreceiver.cxx |
|
b/src/ohreceiver.cxx |
|
... |
|
... |
41 |
|
41 |
|
42 |
static const string sTpProduct("urn:av-openhome-org:service:Receiver:1");
|
42 |
static const string sTpProduct("urn:av-openhome-org:service:Receiver:1");
|
43 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Receiver");
|
43 |
static const string sIdProduct("urn:av-openhome-org:serviceId:Receiver");
|
44 |
|
44 |
|
45 |
OHReceiver::OHReceiver(UpMpd *dev, const OHReceiverParams& parms)
|
45 |
OHReceiver::OHReceiver(UpMpd *dev, const OHReceiverParams& parms)
|
46 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev), m_active(false),
|
46 |
: OHService(sTpProduct, sIdProduct, dev), m_active(false),
|
47 |
m_httpport(parms.httpport), m_sc2mpdpath(parms.sc2mpdpath), m_pm(parms.pm)
|
47 |
m_httpport(parms.httpport), m_sc2mpdpath(parms.sc2mpdpath), m_pm(parms.pm)
|
48 |
{
|
48 |
{
|
49 |
dev->addActionMapping(this, "Play",
|
49 |
dev->addActionMapping(this, "Play",
|
50 |
bind(&OHReceiver::play, this, _1, _2));
|
50 |
bind(&OHReceiver::play, this, _1, _2));
|
51 |
dev->addActionMapping(this, "Stop",
|
51 |
dev->addActionMapping(this, "Stop",
|
|
... |
|
... |
97 |
if (m_cmd)
|
97 |
if (m_cmd)
|
98 |
st["TransportState"] = "Playing";
|
98 |
st["TransportState"] = "Playing";
|
99 |
else
|
99 |
else
|
100 |
st["TransportState"] = "Stopped";
|
100 |
st["TransportState"] = "Stopped";
|
101 |
st["ProtocolInfo"] = o_protocolinfo;
|
101 |
st["ProtocolInfo"] = o_protocolinfo;
|
102 |
return true;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
bool OHReceiver::getEventData(bool all, std::vector<std::string>& names,
|
|
|
106 |
std::vector<std::string>& values)
|
|
|
107 |
{
|
|
|
108 |
//LOGDEB("OHReceiver::getEventData" << endl);
|
|
|
109 |
|
|
|
110 |
unordered_map<string, string> state;
|
|
|
111 |
|
|
|
112 |
makestate(state);
|
|
|
113 |
|
|
|
114 |
unordered_map<string, string> changed;
|
|
|
115 |
if (all) {
|
|
|
116 |
changed = state;
|
|
|
117 |
} else {
|
|
|
118 |
changed = diffmaps(m_state, state);
|
|
|
119 |
}
|
|
|
120 |
m_state = state;
|
|
|
121 |
|
|
|
122 |
for (auto it = changed.begin(); it != changed.end(); it++) {
|
|
|
123 |
//LOGDEB("OHReceiver::getEventData: changed: " << it->first <<
|
|
|
124 |
// " = " << it->second << endl);
|
|
|
125 |
names.push_back(it->first);
|
|
|
126 |
values.push_back(it->second);
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
return true;
|
102 |
return true;
|
130 |
}
|
103 |
}
|
131 |
|
104 |
|
132 |
void OHReceiver::maybeWakeUp(bool ok)
|
105 |
void OHReceiver::maybeWakeUp(bool ok)
|
133 |
{
|
106 |
{
|