Switch to unified view

a/upmpd/ohproduct.cxx b/upmpd/ohproduct.cxx
...
...
44
static const string sIdProduct("urn:av-openhome-org:serviceId:Product");
44
static const string sIdProduct("urn:av-openhome-org:serviceId:Product");
45
45
46
OHProduct::OHProduct(UpMpd *dev)
46
OHProduct::OHProduct(UpMpd *dev)
47
    : UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev)
47
    : UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev)
48
{
48
{
49
    dev->addActionMapping("Manufacturer", bind(&OHProduct::manufacturer,
49
    dev->addActionMapping(this, "Manufacturer", 
50
                                               this, _1, _2));
50
                          bind(&OHProduct::manufacturer, this, _1, _2));
51
    dev->addActionMapping("Model", bind(&OHProduct::model, this, _1, _2));
51
    dev->addActionMapping(this, "Model", bind(&OHProduct::model, this, _1, _2));
52
    dev->addActionMapping("Product", bind(&OHProduct::product, this, _1, _2));
52
    dev->addActionMapping(this, "Product", 
53
    dev->addActionMapping("Standby", bind(&OHProduct::standby, this, _1, _2));
53
                          bind(&OHProduct::product, this, _1, _2));
54
    dev->addActionMapping("SetStandby", bind(&OHProduct::setStandby, 
54
    dev->addActionMapping(this, "Standby", 
55
                                             this, _1, _2));
55
                          bind(&OHProduct::standby, this, _1, _2));
56
    dev->addActionMapping("SourceCount", bind(&OHProduct::sourceCount, 
56
    dev->addActionMapping(this, "SetStandby", 
57
                                              this, _1, _2));
57
                          bind(&OHProduct::setStandby, this, _1, _2));
58
    dev->addActionMapping("SourceXml", bind(&OHProduct::sourceXML, 
58
    dev->addActionMapping(this, "SourceCount", 
59
                                            this, _1, _2));
59
                          bind(&OHProduct::sourceCount, this, _1, _2));
60
    dev->addActionMapping("SourceIndex", bind(&OHProduct::sourceIndex, 
60
    dev->addActionMapping(this, "SourceXml", 
61
                                            this, _1, _2));
61
                          bind(&OHProduct::sourceXML, this, _1, _2));
62
    dev->addActionMapping(this, "SourceIndex", 
63
                          bind(&OHProduct::sourceIndex, this, _1, _2));
62
    dev->addActionMapping("SetSourceIndex", 
64
    dev->addActionMapping(this, "SetSourceIndex", 
63
                          bind(&OHProduct::setSourceIndex, this, _1, _2));
65
                          bind(&OHProduct::setSourceIndex, this, _1, _2));
64
    dev->addActionMapping("SetSourceIndexByName", 
66
    dev->addActionMapping(this, "SetSourceIndexByName", 
65
                          bind(&OHProduct::setSourceIndexByName, this, _1, _2));
67
                          bind(&OHProduct::setSourceIndexByName, this, _1, _2));
66
    dev->addActionMapping("Source", 
68
    dev->addActionMapping(this, "Source", 
67
                          bind(&OHProduct::source, this, _1, _2));
69
                          bind(&OHProduct::source, this, _1, _2));
68
    dev->addActionMapping("Attributes", 
70
    dev->addActionMapping(this, "Attributes", 
69
                          bind(&OHProduct::attributes, this, _1, _2));
71
                          bind(&OHProduct::attributes, this, _1, _2));
70
    dev->addActionMapping("SourceXmlChangeCount", 
72
    dev->addActionMapping(this, "SourceXmlChangeCount", 
71
                          bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
73
                          bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
72
}
74
}
73
75
74
static const string csxml(
76
static const string csxml(
75
    "<SourceList>"
77
    "<SourceList>"
...
...
81
    "</SourceList>"
83
    "</SourceList>"
82
    );
84
    );
83
85
84
static const string csattrs("Info Time Volume");
86
static const string csattrs("Info Time Volume");
85
static const string csversion("1.0");
87
static const string csversion("1.0");
86
88
static const string csmanname("UpMPDCli heavy industries Co.");
89
static const string csmaninfo("Such nice guys and gals");
90
static const string csmanurl("http://www.lesbonscomptes.com/upmpdcli");
91
static const string csmodname("UpMPDCli UPnP-MPD gateway");
92
static const string csmodurl("http://www.lesbonscomptes.com/upmpdcli");
93
static const string csprodroom("Bureau");
94
static const string csprodname("Upmpdcli");
87
bool OHProduct::getEventData(bool all, std::vector<std::string>& names, 
95
bool OHProduct::getEventData(bool all, std::vector<std::string>& names, 
88
                             std::vector<std::string>& values)
96
                             std::vector<std::string>& values)
89
{
97
{
90
    //LOGDEB("OHProduct::getEventData" << endl);
98
    //LOGDEB("OHProduct::getEventData" << endl);
91
    // Our data never changes, so if this is not an unconditional
99
    // Our data never changes, so if this is not an unconditional
92
    // request, we return nothing.
100
    // request, we return nothing.
93
    if (all) {
101
    if (all) {
94
        names.push_back("ManufacturerName");
102
        names.push_back("ManufacturerName"); values.push_back(csmanname);
95
        values.push_back("UpMPDCli heavy industries Co.");
96
        names.push_back("ManufacturerInfo");
103
        names.push_back("ManufacturerInfo"); values.push_back(csmaninfo);
97
        values.push_back("Such nice guys and gals");
98
        names.push_back("ManufacturerUrl");
104
        names.push_back("ManufacturerUrl");  values.push_back(csmanurl);
99
        values.push_back("http://www.lesbonscomptes.com/upmpdcli");
100
        names.push_back("ManufacturerImageUri");
105
        names.push_back("ManufacturerImageUri"); values.push_back("");
101
        values.push_back("");
106
        names.push_back("ModelName"); values.push_back(csmodname);
102
        names.push_back("ModelName");
107
        names.push_back("ModelInfo"); values.push_back(csversion);
103
        values.push_back("UpMPDCli UPnP-MPD gateway");
108
        names.push_back("ModelUrl");  values.push_back(csmodurl);
104
        names.push_back("ModelInfo");
105
        values.push_back(csversion);
106
        names.push_back("ModelUrl");
107
        values.push_back("");
108
        names.push_back("ModelImageUri");
109
        names.push_back("ModelImageUri"); values.push_back("");
109
        values.push_back("");
110
        names.push_back("ProductRoom"); values.push_back(csprodroom);
110
        names.push_back("ProductRoom");
111
        names.push_back("ProductName"); values.push_back(csprodname);
111
        values.push_back("");
112
        names.push_back("ProductInfo"); values.push_back(csversion);
112
        names.push_back("ProductName");
113
        values.push_back("");
114
        names.push_back("ProductInfo");
115
        values.push_back("");
116
        names.push_back("ProductUrl");
113
        names.push_back("ProductUrl"); values.push_back("");
117
        values.push_back("");
118
        names.push_back("ProductImageUri");
114
        names.push_back("ProductImageUri"); values.push_back("");
119
        values.push_back("");
120
        names.push_back("Standby");
115
        names.push_back("Standby"); values.push_back("0");
121
        values.push_back("0");
122
        names.push_back("SourceCount");
116
        names.push_back("SourceCount"); values.push_back("1");
123
        values.push_back("1");
124
        names.push_back("SourceXml");
117
        names.push_back("SourceXml"); values.push_back(csxml);
125
        values.push_back(csxml);
126
        names.push_back("SourceIndex");
118
        names.push_back("SourceIndex"); values.push_back("0");
127
        values.push_back("0");
128
        names.push_back("Attributes");
119
        names.push_back("Attributes");values.push_back(csattrs);
129
        values.push_back(csattrs);
130
    }
120
    }
131
    return true;
121
    return true;
132
}
122
}
133
123
134
int OHProduct::manufacturer(const SoapArgs& sc, SoapData& data)
124
int OHProduct::manufacturer(const SoapArgs& sc, SoapData& data)
135
{
125
{
136
    LOGDEB("OHProduct::manufacturer" << endl);
126
    LOGDEB("OHProduct::manufacturer" << endl);
137
    data.addarg("Name", "UpMPDCli HEAVY Industries");
127
    data.addarg("Name", csmanname);
138
    data.addarg("Info", "Such nice guys and gals");
128
    data.addarg("Info", csmaninfo);
139
    data.addarg("Url", "http://www.lesbonscomptes.com/upmpdcli");
129
    data.addarg("Url", csmanurl);
140
    data.addarg("ImageUri", "");
130
    data.addarg("ImageUri", "");
141
    return UPNP_E_SUCCESS;
131
    return UPNP_E_SUCCESS;
142
}
132
}
143
133
144
int OHProduct::model(const SoapArgs& sc, SoapData& data)
134
int OHProduct::model(const SoapArgs& sc, SoapData& data)
145
{
135
{
146
    LOGDEB("OHProduct::model" << endl);
136
    LOGDEB("OHProduct::model" << endl);
147
    data.addarg("Name", "UpMPDCli UPnP-MPD gateway");
137
    data.addarg("Name", csmodname);
148
    data.addarg("Info", csversion);
138
    data.addarg("Info", csversion);
149
    data.addarg("Url", "http://www.lesbonscomptes.com/upmpdcli");
139
    data.addarg("Url", csmodurl);
150
    data.addarg("ImageUri", "");
140
    data.addarg("ImageUri", "");
151
    return UPNP_E_SUCCESS;
141
    return UPNP_E_SUCCESS;
152
}
142
}
153
143
154
int OHProduct::product(const SoapArgs& sc, SoapData& data)
144
int OHProduct::product(const SoapArgs& sc, SoapData& data)
155
{
145
{
156
    LOGDEB("OHProduct::product" << endl);
146
    LOGDEB("OHProduct::product" << endl);
157
    data.addarg("Room", "");
147
    data.addarg("Room", csprodroom);
158
    data.addarg("Name", "");
148
    data.addarg("Name", csprodname);
159
    data.addarg("Info", csversion);
149
    data.addarg("Info", csversion);
160
    data.addarg("Url", "");
150
    data.addarg("Url", "");
161
    data.addarg("ImageUri", "");
151
    data.addarg("ImageUri", "");
162
    return UPNP_E_SUCCESS;
152
    return UPNP_E_SUCCESS;
163
}
153
}
...
...
230
    LOGDEB("OHProduct::source" << endl);
220
    LOGDEB("OHProduct::source" << endl);
231
    int sindex;
221
    int sindex;
232
    if (!sc.getInt("Index", &sindex)) {
222
    if (!sc.getInt("Index", &sindex)) {
233
        return UPNP_E_INVALID_PARAM;
223
        return UPNP_E_INVALID_PARAM;
234
    }
224
    }
235
    LOGDEB("OHProduct::setSourceIndex: " << sindex << endl);
225
    LOGDEB("OHProduct::source: " << sindex << endl);
236
    if (sindex != 0) {
226
    if (sindex != 0) {
237
        return UPNP_E_INVALID_PARAM;
227
        return UPNP_E_INVALID_PARAM;
238
    }
228
    }
239
    data.addarg("SystemName", "Default");
229
    data.addarg("SystemName", csprodroom);
240
    data.addarg("Type", "PlayList");
230
    data.addarg("Type", "Playlist");
241
    data.addarg("Name", "PlayList");
231
    data.addarg("Name", "PlayList");
242
    data.addarg("Visible", "1");
232
    data.addarg("Visible", "1");
243
    return UPNP_E_SUCCESS;
233
    return UPNP_E_SUCCESS;
244
}
234
}
245
235