Switch to unified view

a/src/ohproduct.cxx b/src/ohproduct.cxx
...
...
48
static void listScripts(vector<pair<string, string> >& sources);
48
static void listScripts(vector<pair<string, string> >& sources);
49
49
50
static const string sTpProduct("urn:av-openhome-org:service:Product:");
50
static const string sTpProduct("urn:av-openhome-org:service:Product:");
51
static const string sIdProduct("urn:av-openhome-org:serviceId:Product");
51
static const string sIdProduct("urn:av-openhome-org:serviceId:Product");
52
52
53
static const string cstr_stsrcnmkey("ohproduct.sourceName");
54
53
static string csxml("<SourceList>\n");
55
static string csxml("<SourceList>\n");
54
static string csattrs("Info Time Volume");
56
static string csattrs("Info Time Volume");
55
57
56
// This can be replaced by config data in listScripts()
58
// This can be replaced by config data in listScripts()
57
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
59
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
...
...
61
63
62
static const string SndRcvPLName("PL-to-Songcast");
64
static const string SndRcvPLName("PL-to-Songcast");
63
static const string SndRcvRDName("RD-to-Songcast");
65
static const string SndRcvRDName("RD-to-Songcast");
64
66
65
OHProduct::OHProduct(UpMpd *dev, ohProductDesc_t& ohProductDesc, int version)
67
OHProduct::OHProduct(UpMpd *dev, ohProductDesc_t& ohProductDesc, int version)
66
    : OHService(sTpProduct + SoapHelp::i2s(version), sIdProduct, "OHProduct.xml",
68
    : OHService(sTpProduct + SoapHelp::i2s(version), sIdProduct,
67
                dev),
69
                "OHProduct.xml", dev),
68
      m_ohProductDesc(ohProductDesc), m_sourceIndex(0), m_standby(false)
70
      m_ohProductDesc(ohProductDesc), m_sourceIndex(0), m_standby(false)
69
{
71
{
70
    // Playlist must stay first.
72
    // Playlist must stay first.
71
    o_sources.push_back(pair<string,string>("Playlist","Playlist"));
73
    o_sources.push_back(pair<string,string>("Playlist","Playlist"));
72
    if (m_dev->m_ohrd) {
74
    if (m_dev->m_ohrd) {
...
...
151
                          bind(&OHProduct::source, this, _1, _2));
153
                          bind(&OHProduct::source, this, _1, _2));
152
    dev->addActionMapping(this, "Attributes", 
154
    dev->addActionMapping(this, "Attributes", 
153
                          bind(&OHProduct::attributes, this, _1, _2));
155
                          bind(&OHProduct::attributes, this, _1, _2));
154
    dev->addActionMapping(this, "SourceXmlChangeCount", 
156
    dev->addActionMapping(this, "SourceXmlChangeCount", 
155
                          bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
157
                          bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
158
159
    if (g_state) {
160
        string savedsrc;
161
        if (!g_state->get(cstr_stsrcnmkey, savedsrc)) {
162
            savedsrc = "Playlist";
163
        }
164
        if (savedsrc.compare("Playlist")) {
165
            if (iSetSourceIndexByName(savedsrc) != UPNP_E_SUCCESS) {
166
                g_state->set(cstr_stsrcnmkey, "Playlist");
167
            }
168
        }
169
    }
156
}
170
}
157
171
158
OHProduct::~OHProduct()
172
OHProduct::~OHProduct()
159
{
173
{
160
}
174
}
...
...
340
        string spath = path_cat(scripts_dir, sname);
354
        string spath = path_cat(scripts_dir, sname);
341
        ok = m_dev->m_sndrcv->start(spath);
355
        ok = m_dev->m_sndrcv->start(spath);
342
    }
356
    }
343
    m_sourceIndex = sindex;
357
    m_sourceIndex = sindex;
344
358
359
    if (g_state) {
360
        g_state->set(cstr_stsrcnmkey, newnm);
361
    }
345
    m_dev->loopWakeup();
362
    m_dev->loopWakeup();
346
363
347
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
364
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
348
}
365
}
349
366