|
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),
|
46 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(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",
|
|
... |
|
... |
78 |
}
|
78 |
}
|
79 |
} else {
|
79 |
} else {
|
80 |
if (m_cmd) {
|
80 |
if (m_cmd) {
|
81 |
int status;
|
81 |
int status;
|
82 |
if (m_cmd->maybereap(&status)) {
|
82 |
if (m_cmd->maybereap(&status)) {
|
83 |
LOGDEB("OHReceiver: sc2cmd exited with status " << status << endl);
|
83 |
LOGDEB("OHReceiver: sc2cmd exited with status " << status
|
|
|
84 |
<< endl);
|
84 |
m_cmd = shared_ptr<ExecCmd>(new ExecCmd());
|
85 |
m_cmd = shared_ptr<ExecCmd>(new ExecCmd());
|
85 |
}
|
86 |
}
|
86 |
}
|
87 |
}
|
87 |
}
|
88 |
}
|
88 |
|
89 |
|
|
... |
|
... |
103 |
|
104 |
|
104 |
bool OHReceiver::getEventData(bool all, std::vector<std::string>& names,
|
105 |
bool OHReceiver::getEventData(bool all, std::vector<std::string>& names,
|
105 |
std::vector<std::string>& values)
|
106 |
std::vector<std::string>& values)
|
106 |
{
|
107 |
{
|
107 |
//LOGDEB("OHReceiver::getEventData" << endl);
|
108 |
//LOGDEB("OHReceiver::getEventData" << endl);
|
108 |
|
109 |
if (!m_active)
|
|
|
110 |
return true;
|
|
|
111 |
|
109 |
unordered_map<string, string> state;
|
112 |
unordered_map<string, string> state;
|
110 |
|
113 |
|
111 |
makestate(state);
|
114 |
makestate(state);
|
112 |
|
115 |
|
113 |
unordered_map<string, string> changed;
|
116 |
unordered_map<string, string> changed;
|
|
... |
|
... |
229 |
}
|
232 |
}
|
230 |
|
233 |
|
231 |
int OHReceiver::play(const SoapIncoming& sc, SoapOutgoing& data)
|
234 |
int OHReceiver::play(const SoapIncoming& sc, SoapOutgoing& data)
|
232 |
{
|
235 |
{
|
233 |
LOGDEB("OHReceiver::play" << endl);
|
236 |
LOGDEB("OHReceiver::play" << endl);
|
|
|
237 |
if (!m_active && m_dev->m_ohpr)
|
|
|
238 |
m_dev->m_ohpr->iSetSourceIndexByName("Receiver");
|
234 |
bool ok = iPlay();
|
239 |
bool ok = iPlay();
|
235 |
if (ok && m_dev->m_ohpr)
|
|
|
236 |
m_dev->m_ohpr->iSetSourceIndexByName("Receiver");
|
|
|
237 |
maybeWakeUp(ok);
|
240 |
maybeWakeUp(ok);
|
238 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
241 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
239 |
}
|
242 |
}
|
240 |
|
243 |
|
241 |
bool OHReceiver::iStop()
|
244 |
bool OHReceiver::iStop()
|