Switch to unified view

a/src/ohproduct.cxx b/src/ohproduct.cxx
...
...
93
            listScripts(o_sources);
93
            listScripts(o_sources);
94
        }
94
        }
95
    }
95
    }
96
96
97
97
98
    for (auto it = o_sources.begin(); it != o_sources.end(); it++) {
98
    for (const auto& entry : o_sources) {
99
        // Receiver needs to be visible for Kazoo to use it. As a
99
        // Receiver needs to be visible for Kazoo to use it. As a
100
        // consequence, Receiver appears in older upplay versions
100
        // consequence, Receiver appears in older upplay versions
101
        // source lists. Newer versions filters it out because you
101
        // source lists. Newer versions filters it out because you
102
        // can't do anything useful by selecting the receiver source
102
        // can't do anything useful by selecting the receiver source
103
        // (no way to specify the sender), so it is confusing
103
        // (no way to specify the sender), so it is confusing
104
        string visible = "1";//it->first.compare("Receiver") ? "1" : "0";
104
        string visible = "1";//entry.first.compare("Receiver") ? "1" : "0";
105
        csxml += string(" <Source>\n") +
105
        csxml += string(" <Source>\n") +
106
            "  <Name>" + it->second + "</Name>\n" +
106
            "  <Name>" + entry.second + "</Name>\n" +
107
            "  <Type>" + it->first + "</Type>\n" +
107
            "  <Type>" + entry.first + "</Type>\n" +
108
            "  <Visible>" + visible + "</Visible>\n" +
108
            "  <Visible>" + visible + "</Visible>\n" +
109
            "  <SystemName>" + entry.second + "</SystemName>\n" +
109
            "  </Source>\n";
110
            "  </Source>\n";
110
    }
111
    }
111
    csxml += string("</SourceList>\n");
112
    csxml += string("</SourceList>\n");
112
    LOGDEB("OHProduct::OHProduct: sources: " << csxml << endl);
113
    LOGDEB("OHProduct::OHProduct: sources: " << csxml << endl);
113
114
...
...
137
                          bind(&OHProduct::sourceIndex, this, _1, _2));
138
                          bind(&OHProduct::sourceIndex, this, _1, _2));
138
    dev->addActionMapping(this, "SetSourceIndex", 
139
    dev->addActionMapping(this, "SetSourceIndex", 
139
                          bind(&OHProduct::setSourceIndex, this, _1, _2));
140
                          bind(&OHProduct::setSourceIndex, this, _1, _2));
140
    dev->addActionMapping(this, "SetSourceIndexByName", 
141
    dev->addActionMapping(this, "SetSourceIndexByName", 
141
                          bind(&OHProduct::setSourceIndexByName, this, _1, _2));
142
                          bind(&OHProduct::setSourceIndexByName, this, _1, _2));
143
    dev->addActionMapping(this, "SetSourceBySystemName", 
144
                          bind(&OHProduct::setSourceBySystemName,this, _1, _2));
142
    dev->addActionMapping(this, "Source", 
145
    dev->addActionMapping(this, "Source", 
143
                          bind(&OHProduct::source, this, _1, _2));
146
                          bind(&OHProduct::source, this, _1, _2));
144
    dev->addActionMapping(this, "Attributes", 
147
    dev->addActionMapping(this, "Attributes", 
145
                          bind(&OHProduct::attributes, this, _1, _2));
148
                          bind(&OHProduct::attributes, this, _1, _2));
146
    dev->addActionMapping(this, "SourceXmlChangeCount", 
149
    dev->addActionMapping(this, "SourceXmlChangeCount", 
...
...
360
    return UPNP_E_INVALID_PARAM;
363
    return UPNP_E_INVALID_PARAM;
361
}
364
}
362
365
363
int OHProduct::setSourceIndexByName(const SoapIncoming& sc, SoapOutgoing& data)
366
int OHProduct::setSourceIndexByName(const SoapIncoming& sc, SoapOutgoing& data)
364
{
367
{
365
366
    string name;
368
    string name;
367
    if (!sc.get("Value", &name)) {
369
    if (!sc.get("Value", &name)) {
368
        LOGERR("OHProduct::setSourceIndexByName: no Value" << endl);
370
        LOGERR("OHProduct::setSourceIndexByName: no Value" << endl);
369
        return UPNP_E_INVALID_PARAM;
371
        return UPNP_E_INVALID_PARAM;
370
    }
372
    }
371
    return iSetSourceIndexByName(name);
373
    return iSetSourceIndexByName(name);
372
}
374
}
373
375
376
int OHProduct::setSourceBySystemName(const SoapIncoming& sc,
377
                                     SoapOutgoing& data)
378
{
379
    string name;
380
    if (!sc.get("Value", &name)) {
381
        LOGERR("OHProduct::setSourceBySystemName: no Value" << endl);
382
        return UPNP_E_INVALID_PARAM;
383
    }
384
    return iSetSourceIndexByName(name);
385
}
386
374
int OHProduct::source(const SoapIncoming& sc, SoapOutgoing& data)
387
int OHProduct::source(const SoapIncoming& sc, SoapOutgoing& data)
375
{
388
{
376
    LOGDEB("OHProduct::source" << endl);
389
    LOGDEB("OHProduct::source" << endl);
377
    int sindex;
390
    int sindex;
378
    if (!sc.get("Index", &sindex)) {
391
    if (!sc.get("Index", &sindex)) {
...
...
381
    LOGDEB("OHProduct::source: " << sindex << endl);
394
    LOGDEB("OHProduct::source: " << sindex << endl);
382
    if (sindex < 0 || sindex >= int(o_sources.size())) {
395
    if (sindex < 0 || sindex >= int(o_sources.size())) {
383
        LOGERR("OHProduct::source: bad index: " << sindex << endl);
396
        LOGERR("OHProduct::source: bad index: " << sindex << endl);
384
        return UPNP_E_INVALID_PARAM;
397
        return UPNP_E_INVALID_PARAM;
385
    }
398
    }
386
    data.addarg("SystemName", m_ohProductDesc.room);
399
    data.addarg("SystemName", o_sources[sindex].second);
387
    data.addarg("Type", o_sources[sindex].first);
400
    data.addarg("Type", o_sources[sindex].first);
388
    data.addarg("Name", o_sources[sindex].second);
401
    data.addarg("Name", o_sources[sindex].second);
389
    string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
402
    string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
390
    data.addarg("Visible", visible);
403
    data.addarg("Visible", visible);
391
    return UPNP_E_SUCCESS;
404
    return UPNP_E_SUCCESS;