|
a/src/ohproduct.cxx |
|
b/src/ohproduct.cxx |
|
... |
|
... |
45 |
|
45 |
|
46 |
OHProduct::OHProduct(UpMpd *dev, const string& friendlyname, bool hasRcv)
|
46 |
OHProduct::OHProduct(UpMpd *dev, const string& friendlyname, bool hasRcv)
|
47 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
47 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
48 |
m_roomOrName(friendlyname), m_sourceIndex(0)
|
48 |
m_roomOrName(friendlyname), m_sourceIndex(0)
|
49 |
{
|
49 |
{
|
|
|
50 |
// Playlist must stay first.
|
50 |
o_sources.push_back("Playlist");
|
51 |
o_sources.push_back("Playlist");
|
51 |
//o_sources.push_back("UpnpAv");
|
52 |
//o_sources.push_back("UpnpAv");
|
52 |
if (hasRcv)
|
53 |
if (hasRcv)
|
53 |
o_sources.push_back("Receiver");
|
54 |
o_sources.push_back("Receiver");
|
54 |
|
55 |
|
|
... |
|
... |
197 |
LOGDEB("OHProduct::sourceIndex" << endl);
|
198 |
LOGDEB("OHProduct::sourceIndex" << endl);
|
198 |
data.addarg("Value", SoapHelp::i2s(m_sourceIndex));
|
199 |
data.addarg("Value", SoapHelp::i2s(m_sourceIndex));
|
199 |
return UPNP_E_SUCCESS;
|
200 |
return UPNP_E_SUCCESS;
|
200 |
}
|
201 |
}
|
201 |
|
202 |
|
|
|
203 |
int OHProduct::iSetSourceIndex(int sindex)
|
|
|
204 |
{
|
|
|
205 |
LOGDEB("OHProduct::setSourceIndex: " << sindex << endl);
|
|
|
206 |
if (sindex < 0 || sindex >= int(o_sources.size())) {
|
|
|
207 |
LOGERR("OHProduct::setSourceIndex: bad index: " << sindex << endl);
|
|
|
208 |
return UPNP_E_INVALID_PARAM;
|
|
|
209 |
}
|
|
|
210 |
m_sourceIndex = sindex;
|
|
|
211 |
m_dev->loopWakeup();
|
|
|
212 |
return UPNP_E_SUCCESS;
|
|
|
213 |
}
|
202 |
int OHProduct::setSourceIndex(const SoapIncoming& sc, SoapOutgoing& data)
|
214 |
int OHProduct::setSourceIndex(const SoapIncoming& sc, SoapOutgoing&)
|
203 |
{
|
215 |
{
|
204 |
LOGDEB("OHProduct::setSourceIndex" << endl);
|
216 |
LOGDEB("OHProduct::setSourceIndex" << endl);
|
205 |
int sindex;
|
217 |
int sindex;
|
206 |
if (!sc.get("Value", &sindex)) {
|
218 |
if (!sc.get("Value", &sindex)) {
|
207 |
return UPNP_E_INVALID_PARAM;
|
219 |
return UPNP_E_INVALID_PARAM;
|
208 |
}
|
220 |
}
|
209 |
LOGDEB("OHProduct::setSourceIndex: " << sindex << endl);
|
221 |
return iSetSourceIndex(sindex);
|
210 |
if (sindex < 0 || sindex >= int(o_sources.size())) {
|
|
|
211 |
LOGERR("OHProduct::setSourceIndex: bad index: " << sindex << endl);
|
|
|
212 |
return UPNP_E_INVALID_PARAM;
|
|
|
213 |
}
|
|
|
214 |
m_sourceIndex = sindex;
|
|
|
215 |
m_dev->loopWakeup();
|
|
|
216 |
return UPNP_E_SUCCESS;
|
|
|
217 |
}
|
222 |
}
|
218 |
|
223 |
|
219 |
int OHProduct::setSourceIndexByName(const SoapIncoming& sc, SoapOutgoing& data)
|
224 |
int OHProduct::setSourceIndexByName(const SoapIncoming& sc, SoapOutgoing& data)
|
220 |
{
|
225 |
{
|
221 |
LOGDEB("OHProduct::setSourceIndexByName" << endl);
|
226 |
LOGDEB("OHProduct::setSourceIndexByName" << endl);
|