|
a/src/ohproduct.cxx |
|
b/src/ohproduct.cxx |
|
... |
|
... |
55 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
55 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
56 |
m_roomOrName(friendlyname), m_sourceIndex(0), m_standby(false)
|
56 |
m_roomOrName(friendlyname), m_sourceIndex(0), m_standby(false)
|
57 |
{
|
57 |
{
|
58 |
// Playlist must stay first.
|
58 |
// Playlist must stay first.
|
59 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
59 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
|
|
60 |
if (m_dev->m_ohrd) {
|
60 |
o_sources.push_back(pair<string, string>("Radio", "Radio"));
|
61 |
o_sources.push_back(pair<string, string>("Radio", "Radio"));
|
|
|
62 |
}
|
61 |
if (m_dev->m_ohrcv) {
|
63 |
if (m_dev->m_ohrcv) {
|
62 |
o_sources.push_back(pair<string,string>("Receiver", "Receiver"));
|
64 |
o_sources.push_back(pair<string,string>("Receiver", "Receiver"));
|
63 |
if (m_dev->m_sndrcv &&
|
65 |
if (m_dev->m_sndrcv &&
|
64 |
m_dev->m_ohrcv->playMethod() == OHReceiverParams::OHRP_ALSA) {
|
66 |
m_dev->m_ohrcv->playMethod() == OHReceiverParams::OHRP_ALSA) {
|
65 |
// It might be possible to make things work with the MPD
|
67 |
// It might be possible to make things work with the MPD
|
|
... |
|
... |
68 |
// original/saved one, not the current one, which is doing
|
70 |
// original/saved one, not the current one, which is doing
|
69 |
// the playing and sending to the fifo, so we'd need to
|
71 |
// the playing and sending to the fifo, so we'd need to
|
70 |
// tell ohreceiver about using the right one.
|
72 |
// tell ohreceiver about using the right one.
|
71 |
o_sources.push_back(pair<string,string>("Playlist",
|
73 |
o_sources.push_back(pair<string,string>("Playlist",
|
72 |
"SenderReceiverPL"));
|
74 |
"SenderReceiverPL"));
|
|
|
75 |
if (m_dev->m_ohrd) {
|
73 |
o_sources.push_back(pair<string,string>("Radio",
|
76 |
o_sources.push_back(pair<string,string>("Radio",
|
74 |
"SenderReceiverRD"));
|
77 |
"SenderReceiverRD"));
|
|
|
78 |
}
|
75 |
}
|
79 |
}
|
76 |
}
|
80 |
}
|
77 |
|
81 |
|
78 |
for (auto it = o_sources.begin(); it != o_sources.end(); it++) {
|
82 |
for (auto it = o_sources.begin(); it != o_sources.end(); it++) {
|
79 |
string visible = it->first.compare("Receiver") ? "1" : "0";
|
83 |
string visible = it->first.compare("Receiver") ? "1" : "0";
|
|
... |
|
... |
267 |
|
271 |
|
268 |
const MpdStatus& mpds = m_dev->getMpdStatus();
|
272 |
const MpdStatus& mpds = m_dev->getMpdStatus();
|
269 |
int savedms = mpds.songelapsedms;
|
273 |
int savedms = mpds.songelapsedms;
|
270 |
|
274 |
|
271 |
m_dev->m_ohif->setMetatext("");
|
275 |
m_dev->m_ohif->setMetatext("");
|
|
|
276 |
|
272 |
string curnm = o_sources[m_sourceIndex].second;
|
277 |
string curnm = o_sources[m_sourceIndex].second;
|
273 |
if (!curnm.compare("Playlist") && m_dev->m_ohpl) {
|
278 |
if (m_dev->m_ohpl && !curnm.compare("Playlist")) {
|
274 |
m_dev->m_ohpl->iStop();
|
279 |
m_dev->m_ohpl->iStop();
|
275 |
m_dev->m_ohpl->setActive(false);
|
280 |
m_dev->m_ohpl->setActive(false);
|
276 |
} else if (!curnm.compare("Receiver") && m_dev->m_ohrcv) {
|
281 |
} else if (m_dev->m_ohrcv && !curnm.compare("Receiver")) {
|
277 |
m_dev->m_ohrcv->iStop();
|
282 |
m_dev->m_ohrcv->iStop();
|
278 |
m_dev->m_ohrcv->setActive(false);
|
283 |
m_dev->m_ohrcv->setActive(false);
|
279 |
} else if (!curnm.compare("Radio") && m_dev->m_ohrd) {
|
284 |
} else if (m_dev->m_ohrd && !curnm.compare("Radio")) {
|
280 |
m_dev->m_ohrd->iStop();
|
285 |
m_dev->m_ohrd->iStop();
|
281 |
m_dev->m_ohrd->setActive(false);
|
286 |
m_dev->m_ohrd->setActive(false);
|
282 |
} else if (m_dev->m_sndrcv && !curnm.compare("SenderReceiverPL")) {
|
287 |
} else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
|
|
|
288 |
!curnm.compare("SenderReceiverPL")) {
|
283 |
m_dev->m_ohpl->iStop();
|
289 |
m_dev->m_sndrcv->stop();
|
284 |
m_dev->m_ohpl->setActive(false);
|
290 |
m_dev->m_ohpl->setActive(false);
|
285 |
m_dev->m_sndrcv->stop();
|
291 |
} else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
|
286 |
} else if (m_dev->m_sndrcv && !curnm.compare("SenderReceiverRD")) {
|
292 |
!curnm.compare("SenderReceiverRD")) {
|
287 |
m_dev->m_ohrd->iStop();
|
|
|
288 |
m_dev->m_ohrd->setActive(false);
|
293 |
m_dev->m_ohrd->setActive(false);
|
289 |
m_dev->m_sndrcv->stop();
|
294 |
m_dev->m_sndrcv->stop();
|
290 |
}
|
295 |
}
|
291 |
|
296 |
|
292 |
string newnm = o_sources[sindex].second;
|
297 |
string newnm = o_sources[sindex].second;
|
293 |
if (!newnm.compare("Playlist")) {
|
298 |
if (m_dev->m_ohpl && !newnm.compare("Playlist")) {
|
294 |
m_dev->m_ohpl->setActive(true);
|
299 |
m_dev->m_ohpl->setActive(true);
|
|
|
300 |
m_sourceIndex = sindex;
|
295 |
} else if (!newnm.compare("Receiver")) {
|
301 |
} else if (m_dev->m_ohrcv && !newnm.compare("Receiver")) {
|
296 |
m_dev->m_ohrcv->setActive(true);
|
302 |
m_dev->m_ohrcv->setActive(true);
|
|
|
303 |
m_sourceIndex = sindex;
|
297 |
} else if (!newnm.compare("Radio")) {
|
304 |
} else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
|
298 |
m_dev->m_ohrd->setActive(true);
|
305 |
m_dev->m_ohrd->setActive(true);
|
|
|
306 |
m_sourceIndex = sindex;
|
|
|
307 |
} else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
|
299 |
} else if (!newnm.compare("SenderReceiverPL")) {
|
308 |
!newnm.compare("SenderReceiverPL")) {
|
300 |
// Events are generated by playlist
|
309 |
// Events are generated by playlist
|
301 |
m_dev->m_ohpl->setActive(true);
|
310 |
m_dev->m_ohpl->setActive(true);
|
302 |
m_dev->m_sndrcv->start(false, savedms);
|
311 |
m_dev->m_sndrcv->start(false, savedms);
|
|
|
312 |
m_sourceIndex = sindex;
|
|
|
313 |
} else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
|
303 |
} else if (!newnm.compare("SenderReceiverRD")) {
|
314 |
!newnm.compare("SenderReceiverRD")) {
|
304 |
// Events are generated by radio
|
315 |
// Events are generated by radio
|
305 |
m_dev->m_ohrd->setActive(true);
|
316 |
m_dev->m_ohrd->setActive(true);
|
306 |
m_dev->m_sndrcv->start(true, 0);
|
317 |
m_dev->m_sndrcv->start(true, 0);
|
|
|
318 |
m_sourceIndex = sindex;
|
307 |
}
|
319 |
}
|
308 |
|
320 |
|
309 |
m_sourceIndex = sindex;
|
|
|
310 |
m_dev->loopWakeup();
|
321 |
m_dev->loopWakeup();
|
311 |
}
|
322 |
}
|
312 |
return UPNP_E_SUCCESS;
|
323 |
return UPNP_E_SUCCESS;
|
313 |
}
|
324 |
}
|
314 |
|
325 |
|
|
... |
|
... |
357 |
return UPNP_E_INVALID_PARAM;
|
368 |
return UPNP_E_INVALID_PARAM;
|
358 |
}
|
369 |
}
|
359 |
data.addarg("SystemName", m_roomOrName);
|
370 |
data.addarg("SystemName", m_roomOrName);
|
360 |
data.addarg("Type", o_sources[sindex].first);
|
371 |
data.addarg("Type", o_sources[sindex].first);
|
361 |
data.addarg("Name", o_sources[sindex].second);
|
372 |
data.addarg("Name", o_sources[sindex].second);
|
|
|
373 |
string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
|
362 |
data.addarg("Visible", "1");
|
374 |
data.addarg("Visible", visible);
|
363 |
return UPNP_E_SUCCESS;
|
375 |
return UPNP_E_SUCCESS;
|
364 |
}
|
376 |
}
|
365 |
|
377 |
|
366 |
int OHProduct::attributes(const SoapIncoming& sc, SoapOutgoing& data)
|
378 |
int OHProduct::attributes(const SoapIncoming& sc, SoapOutgoing& data)
|
367 |
{
|
379 |
{
|