|
a/src/ohreceiver.cxx |
|
b/src/ohreceiver.cxx |
|
... |
|
... |
28 |
#include <vector> // for vector
|
28 |
#include <vector> // for vector
|
29 |
|
29 |
|
30 |
#include "libupnpp/log.hxx" // for LOGDEB, LOGERR
|
30 |
#include "libupnpp/log.hxx" // for LOGDEB, LOGERR
|
31 |
#include "libupnpp/soaphelp.hxx" // for SoapIncoming, SoapOutgoing, i2s, etc
|
31 |
#include "libupnpp/soaphelp.hxx" // for SoapIncoming, SoapOutgoing, i2s, etc
|
32 |
|
32 |
|
|
|
33 |
#include "conftree.h"
|
33 |
#include "mpdcli.hxx" // for MpdStatus, UpSong, MPDCli, etc
|
34 |
#include "mpdcli.hxx" // for MpdStatus, UpSong, MPDCli, etc
|
34 |
#include "upmpd.hxx" // for UpMpd, etc
|
35 |
#include "upmpd.hxx" // for UpMpd, etc
|
35 |
#include "upmpdutils.hxx" // for didlmake, diffmaps, etc
|
36 |
#include "upmpdutils.hxx" // for didlmake, diffmaps, etc
|
36 |
#include "ohplaylist.hxx"
|
37 |
#include "ohplaylist.hxx"
|
37 |
#include "ohproduct.hxx"
|
38 |
#include "ohproduct.hxx"
|
|
... |
|
... |
59 |
dev->addActionMapping(this, "TransportState",
|
60 |
dev->addActionMapping(this, "TransportState",
|
60 |
bind(&OHReceiver::transportState, this, _1, _2));
|
61 |
bind(&OHReceiver::transportState, this, _1, _2));
|
61 |
|
62 |
|
62 |
m_httpuri = "http://localhost:"+ SoapHelp::i2s(m_httpport) +
|
63 |
m_httpuri = "http://localhost:"+ SoapHelp::i2s(m_httpport) +
|
63 |
"/Songcast.wav";
|
64 |
"/Songcast.wav";
|
|
|
65 |
|
|
|
66 |
if (!parms.screceiverstatefile.empty()) {
|
|
|
67 |
m_conf = new ConfSimple(parms.screceiverstatefile.c_str());
|
|
|
68 |
if (!m_conf->ok()) {
|
|
|
69 |
LOGERR("OHReceiver: failed initializing from " <<
|
|
|
70 |
parms.screceiverstatefile << endl);
|
|
|
71 |
} else {
|
|
|
72 |
setSenderFromConf();
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
void OHReceiver::setSenderFromConf()
|
|
|
78 |
{
|
|
|
79 |
m_conf->get("scsenderuri", m_uri);
|
|
|
80 |
m_conf->get("scsendermetadata", m_metadata);
|
|
|
81 |
LOGDEB("OHReceiver: scsenderuri: " << m_uri << endl);
|
|
|
82 |
LOGDEB("OHReceiver: scsendermetadata: " << m_metadata << endl);
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
void OHReceiver::writeSenderToConf()
|
|
|
86 |
{
|
|
|
87 |
bool ok;
|
|
|
88 |
ok = m_conf->set("scsenderuri", m_uri);
|
|
|
89 |
if (!ok)
|
|
|
90 |
LOGERR("OHReceiver: failed writing uri to conf." << endl);
|
|
|
91 |
ok = m_conf->set("scsendermetadata", m_metadata);
|
|
|
92 |
if (!ok)
|
|
|
93 |
LOGERR("OHReceiver: failed writing metadata to conf." << endl);
|
64 |
}
|
94 |
}
|
65 |
|
95 |
|
66 |
static const string o_protocolinfo("ohz:*:*:*,ohm:*:*:*,ohu:*.*.*");
|
96 |
static const string o_protocolinfo("ohz:*:*:*,ohm:*:*:*,ohu:*.*.*");
|
67 |
|
97 |
|
68 |
bool OHReceiver::makestate(unordered_map<string, string> &st)
|
98 |
bool OHReceiver::makestate(unordered_map<string, string> &st)
|
|
... |
|
... |
277 |
if (m_uri.compare(uri) || m_metadata.compare(metadata)) {
|
307 |
if (m_uri.compare(uri) || m_metadata.compare(metadata)) {
|
278 |
if (m_cmd)
|
308 |
if (m_cmd)
|
279 |
iStop();
|
309 |
iStop();
|
280 |
m_uri = uri;
|
310 |
m_uri = uri;
|
281 |
m_metadata = metadata;
|
311 |
m_metadata = metadata;
|
|
|
312 |
if (m_conf->ok())
|
|
|
313 |
writeSenderToConf();
|
282 |
LOGDEB("OHReceiver::setSender: uri [" << m_uri << "] meta [" <<
|
314 |
LOGDEB("OHReceiver::setSender: uri [" << m_uri << "] meta [" <<
|
283 |
m_metadata << "]" << endl);
|
315 |
m_metadata << "]" << endl);
|
284 |
}
|
316 |
}
|
285 |
return true;
|
317 |
return true;
|
286 |
}
|
318 |
}
|