|
a/src/ohproduct.cxx |
|
b/src/ohproduct.cxx |
|
... |
|
... |
56 |
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
|
56 |
static string scripts_dir("/usr/share/upmpdcli/src_scripts");
|
57 |
|
57 |
|
58 |
// (Type, Name) list
|
58 |
// (Type, Name) list
|
59 |
static vector<pair<string, string> > o_sources;
|
59 |
static vector<pair<string, string> > o_sources;
|
60 |
|
60 |
|
61 |
OHProduct::OHProduct(UpMpd *dev, const string& friendlyname)
|
61 |
OHProduct::OHProduct(UpMpd *dev, ohProductDesc_t& ohProductDesc)
|
62 |
: OHService(sTpProduct, sIdProduct, dev),
|
62 |
: OHService(sTpProduct, sIdProduct, dev),
|
63 |
m_roomOrName(friendlyname), m_sourceIndex(0), m_standby(false)
|
63 |
m_ohProductDesc(ohProductDesc), m_sourceIndex(0), m_standby(false)
|
64 |
{
|
64 |
{
|
65 |
// Playlist must stay first.
|
65 |
// Playlist must stay first.
|
66 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
66 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
67 |
if (m_dev->m_ohrd) {
|
67 |
if (m_dev->m_ohrd) {
|
68 |
o_sources.push_back(pair<string, string>("Radio", "Radio"));
|
68 |
o_sources.push_back(pair<string, string>("Radio", "Radio"));
|
|
... |
|
... |
129 |
|
129 |
|
130 |
OHProduct::~OHProduct()
|
130 |
OHProduct::~OHProduct()
|
131 |
{
|
131 |
{
|
132 |
}
|
132 |
}
|
133 |
|
133 |
|
134 |
static const string csversion(UPMPDCLI_PACKAGE_VERSION);
|
|
|
135 |
static const string csmanname("UpMPDCli heavy industries Co.");
|
|
|
136 |
static const string csmaninfo("Such nice guys and gals");
|
|
|
137 |
static const string csmanurl("http://www.lesbonscomptes.com/upmpdcli");
|
|
|
138 |
static const string csmodname("UpMPDCli UPnP-MPD gateway");
|
|
|
139 |
static const string csmodurl("http://www.lesbonscomptes.com/upmpdcli");
|
|
|
140 |
static const string csprodname("Upmpdcli");
|
|
|
141 |
|
|
|
142 |
bool OHProduct::makestate(unordered_map<string, string> &st)
|
134 |
bool OHProduct::makestate(unordered_map<string, string> &st)
|
143 |
{
|
135 |
{
|
144 |
st.clear();
|
136 |
st.clear();
|
145 |
|
137 |
|
146 |
st["ManufacturerName"] = csmanname;
|
138 |
st["ManufacturerName"] = m_ohProductDesc.manufacturer.name;
|
147 |
st["ManufacturerInfo"] = csmaninfo;
|
139 |
st["ManufacturerInfo"] = m_ohProductDesc.manufacturer.info;
|
148 |
st["ManufacturerUrl"] = csmanurl;
|
140 |
st["ManufacturerUrl"] = m_ohProductDesc.manufacturer.url;
|
149 |
st["ManufacturerImageUri"] = "";
|
141 |
st["ManufacturerImageUri"] = m_ohProductDesc.manufacturer.imageUri;
|
150 |
st["ModelName"] = csmodname;
|
142 |
st["ModelName"] = m_ohProductDesc.model.name;
|
151 |
st["ModelInfo"] = csversion;
|
143 |
st["ModelInfo"] = m_ohProductDesc.model.info;
|
152 |
st["ModelUrl"] = csmodurl;
|
144 |
st["ModelUrl"] = m_ohProductDesc.model.url;
|
153 |
st["ModelImageUri"] = "";
|
145 |
st["ModelImageUri"] = m_ohProductDesc.model.imageUri;
|
154 |
st["ProductRoom"] = m_roomOrName;
|
146 |
st["ProductRoom"] = m_ohProductDesc.room;
|
155 |
st["ProductName"] = csprodname;
|
147 |
st["ProductName"] = m_ohProductDesc.product.name;
|
156 |
st["ProductInfo"] = csversion;
|
148 |
st["ProductInfo"] = m_ohProductDesc.product.info;
|
157 |
st["ProductUrl"] = "";
|
149 |
st["ProductUrl"] = m_ohProductDesc.product.url;
|
158 |
st["ProductImageUri"] = "";
|
150 |
st["ProductImageUri"] = m_ohProductDesc.product.imageUri;
|
159 |
st["Standby"] = m_standby ? "1" : "0";
|
151 |
st["Standby"] = m_standby ? "1" : "0";
|
160 |
st["SourceCount"] = SoapHelp::i2s(o_sources.size());
|
152 |
st["SourceCount"] = SoapHelp::i2s(o_sources.size());
|
161 |
st["SourceXml"] = csxml;
|
153 |
st["SourceXml"] = csxml;
|
162 |
st["SourceIndex"] = SoapHelp::i2s(m_sourceIndex);
|
154 |
st["SourceIndex"] = SoapHelp::i2s(m_sourceIndex);
|
163 |
st["Attributes"] = csattrs;
|
155 |
st["Attributes"] = csattrs;
|
|
... |
|
... |
166 |
}
|
158 |
}
|
167 |
|
159 |
|
168 |
int OHProduct::manufacturer(const SoapIncoming& sc, SoapOutgoing& data)
|
160 |
int OHProduct::manufacturer(const SoapIncoming& sc, SoapOutgoing& data)
|
169 |
{
|
161 |
{
|
170 |
LOGDEB("OHProduct::manufacturer" << endl);
|
162 |
LOGDEB("OHProduct::manufacturer" << endl);
|
171 |
data.addarg("Name", csmanname);
|
163 |
data.addarg("Name", m_ohProductDesc.manufacturer.name);
|
172 |
data.addarg("Info", csmaninfo);
|
164 |
data.addarg("Info", m_ohProductDesc.manufacturer.info);
|
173 |
data.addarg("Url", csmanurl);
|
165 |
data.addarg("Url", m_ohProductDesc.manufacturer.url);
|
174 |
data.addarg("ImageUri", "");
|
166 |
data.addarg("ImageUri", m_ohProductDesc.manufacturer.imageUri);
|
175 |
return UPNP_E_SUCCESS;
|
167 |
return UPNP_E_SUCCESS;
|
176 |
}
|
168 |
}
|
177 |
|
169 |
|
178 |
int OHProduct::model(const SoapIncoming& sc, SoapOutgoing& data)
|
170 |
int OHProduct::model(const SoapIncoming& sc, SoapOutgoing& data)
|
179 |
{
|
171 |
{
|
180 |
LOGDEB("OHProduct::model" << endl);
|
172 |
LOGDEB("OHProduct::model" << endl);
|
181 |
data.addarg("Name", csmodname);
|
173 |
data.addarg("Name", m_ohProductDesc.model.name);
|
182 |
data.addarg("Info", csversion);
|
174 |
data.addarg("Info", m_ohProductDesc.model.info);
|
183 |
data.addarg("Url", csmodurl);
|
175 |
data.addarg("Url", m_ohProductDesc.model.url);
|
184 |
data.addarg("ImageUri", "");
|
176 |
data.addarg("ImageUri", m_ohProductDesc.model.imageUri);
|
185 |
return UPNP_E_SUCCESS;
|
177 |
return UPNP_E_SUCCESS;
|
186 |
}
|
178 |
}
|
187 |
|
179 |
|
188 |
int OHProduct::product(const SoapIncoming& sc, SoapOutgoing& data)
|
180 |
int OHProduct::product(const SoapIncoming& sc, SoapOutgoing& data)
|
189 |
{
|
181 |
{
|
190 |
LOGDEB("OHProduct::product" << endl);
|
182 |
LOGDEB("OHProduct::product" << endl);
|
191 |
data.addarg("Room", m_roomOrName);
|
183 |
data.addarg("Room", m_ohProductDesc.room);
|
192 |
data.addarg("Name", csprodname);
|
184 |
data.addarg("Name", m_ohProductDesc.product.name);
|
193 |
data.addarg("Info", csversion);
|
185 |
data.addarg("Info", m_ohProductDesc.product.info);
|
194 |
data.addarg("Url", "");
|
186 |
data.addarg("Url", m_ohProductDesc.product.url);
|
195 |
data.addarg("ImageUri", "");
|
187 |
data.addarg("ImageUri", m_ohProductDesc.product.imageUri);
|
196 |
return UPNP_E_SUCCESS;
|
188 |
return UPNP_E_SUCCESS;
|
197 |
}
|
189 |
}
|
198 |
|
190 |
|
199 |
int OHProduct::standby(const SoapIncoming& sc, SoapOutgoing& data)
|
191 |
int OHProduct::standby(const SoapIncoming& sc, SoapOutgoing& data)
|
200 |
{
|
192 |
{
|
|
... |
|
... |
358 |
LOGDEB("OHProduct::source: " << sindex << endl);
|
350 |
LOGDEB("OHProduct::source: " << sindex << endl);
|
359 |
if (sindex < 0 || sindex >= int(o_sources.size())) {
|
351 |
if (sindex < 0 || sindex >= int(o_sources.size())) {
|
360 |
LOGERR("OHProduct::source: bad index: " << sindex << endl);
|
352 |
LOGERR("OHProduct::source: bad index: " << sindex << endl);
|
361 |
return UPNP_E_INVALID_PARAM;
|
353 |
return UPNP_E_INVALID_PARAM;
|
362 |
}
|
354 |
}
|
363 |
data.addarg("SystemName", m_roomOrName);
|
355 |
data.addarg("SystemName", m_ohProductDesc.room);
|
364 |
data.addarg("Type", o_sources[sindex].first);
|
356 |
data.addarg("Type", o_sources[sindex].first);
|
365 |
data.addarg("Name", o_sources[sindex].second);
|
357 |
data.addarg("Name", o_sources[sindex].second);
|
366 |
string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
|
358 |
string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
|
367 |
data.addarg("Visible", visible);
|
359 |
data.addarg("Visible", visible);
|
368 |
return UPNP_E_SUCCESS;
|
360 |
return UPNP_E_SUCCESS;
|