Switch to unified view

a/src/ohvolume.cxx b/src/ohvolume.cxx
...
...
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
17
18
#include "ohvolume.hxx"
18
#include "ohvolume.hxx"
19
19
20
#include <upnp/upnp.h>                  // for UPNP_E_SUCCESS, etc
20
#include <upnp/upnp.h>
21
21
22
#include <functional>                   // for _Bind, bind, _1, _2
22
#include <functional>
23
#include <iostream>                     // for endl
23
#include <iostream>
24
#include <string>                       // for string
24
#include <string>
25
#include <unordered_map>                // for unordered_map, etc
25
#include <unordered_map>
26
#include <utility>                      // for pair
26
#include <utility>
27
#include <vector>                       // for vector
27
#include <vector>
28
28
29
#include "libupnpp/log.hxx"             // for LOGDEB
29
#include "libupnpp/log.hxx"
30
#include "libupnpp/soaphelp.hxx"        // for SoapOutgoing, SoapIncoming, i2s
30
#include "libupnpp/soaphelp.hxx"
31
31
32
#include "upmpd.hxx"                    // for UpMpd
32
#include "upmpd.hxx"
33
#include "upmpdutils.hxx"               // for diffmaps
33
#include "upmpdutils.hxx"
34
#include "renderctl.hxx"                // for UpMpdRenderCtl
34
#include "renderctl.hxx"
35
35
36
using namespace std;
36
using namespace std;
37
using namespace std::placeholders;
37
using namespace std::placeholders;
38
38
39
static const string millidbperstep("500");
39
static const string millidbperstep("500");
...
...
58
                          bind(&OHVolume::volumeLimit, this, _1, _2));
58
                          bind(&OHVolume::volumeLimit, this, _1, _2));
59
    dev->addActionMapping(this,"Mute", 
59
    dev->addActionMapping(this,"Mute", 
60
                          bind(&OHVolume::mute, this, _1, _2));
60
                          bind(&OHVolume::mute, this, _1, _2));
61
    dev->addActionMapping(this,"SetMute", 
61
    dev->addActionMapping(this,"SetMute", 
62
                          bind(&OHVolume::setMute, this, _1, _2));
62
                          bind(&OHVolume::setMute, this, _1, _2));
63
    dev->addActionMapping(this,"SetBalance", 
64
                          bind(&OHVolume::setBalance, this, _1, _2));
65
    dev->addActionMapping(this,"Balance", 
66
                          bind(&OHVolume::balance, this, _1, _2));
67
    dev->addActionMapping(this,"BalanceInc", 
68
                          bind(&OHVolume::balanceInc, this, _1, _2));
69
    dev->addActionMapping(this,"BalanceDec", 
70
                          bind(&OHVolume::balanceDec, this, _1, _2));
71
    dev->addActionMapping(this,"SetFade", 
72
                          bind(&OHVolume::setFade, this, _1, _2));
73
    dev->addActionMapping(this,"Fade", 
74
                          bind(&OHVolume::fade, this, _1, _2));
75
    dev->addActionMapping(this,"FadeInc", 
76
                          bind(&OHVolume::fadeInc, this, _1, _2));
77
    dev->addActionMapping(this,"FadeDec", 
78
                          bind(&OHVolume::fadeDec, this, _1, _2));
79
63
}
80
}
64
81
65
bool OHVolume::makestate(unordered_map<string, string> &st)
82
bool OHVolume::makestate(unordered_map<string, string> &st)
66
{
83
{
67
    st.clear();
84
    st.clear();
68
85
69
    st["VolumeMax"] = "100";
86
    st["VolumeMax"] = "100";
70
    st["VolumeLimit"] = "100";
87
    st["VolumeLimit"] = "100";
71
    st["VolumeUnity"] = "100";
88
    st["VolumeUnity"] = "100";
72
    st["VolumeSteps"] = "100";
89
    st["VolumeSteps"] = "100";
73
    st["VolumeMilliDbPerSteps"] = millidbperstep;
90
    st["VolumeMilliDbPerStep"] = millidbperstep;
74
    st["Balance"] = "0";
91
    st["Balance"] = "0";
75
    st["BalanceMax"] = "0";
92
    st["BalanceMax"] = "0";
76
    st["Fade"] = "0";
93
    st["Fade"] = "0";
77
    st["FadeMax"] = "0";
94
    st["FadeMax"] = "0";
78
    int volume = m_dev->m_rdctl->getvolume_i();
95
    int volume = m_dev->m_rdctl->getvolume_i();
...
...
157
{
174
{
158
    LOGDEB("OHVolume::volumeLimit" << endl);
175
    LOGDEB("OHVolume::volumeLimit" << endl);
159
    data.addarg("Value", "100");
176
    data.addarg("Value", "100");
160
    return UPNP_E_SUCCESS;
177
    return UPNP_E_SUCCESS;
161
}
178
}
179
180
int OHVolume::balance(const SoapIncoming& sc, SoapOutgoing& data)
181
{
182
    LOGDEB("OHVolume::balance" << endl);
183
    data.addarg("Value", SoapHelp::i2s(0));
184
    return UPNP_E_SUCCESS;
185
}
186
187
int OHVolume::setBalance(const SoapIncoming& sc, SoapOutgoing& data)
188
{
189
    LOGDEB("OHVolume::setBalance" << endl);
190
    int balance;
191
    if (!sc.get("Value", &balance) || balance != 0) {
192
        return UPNP_E_INVALID_PARAM;
193
    }
194
    return UPNP_E_SUCCESS;
195
}
196
197
int OHVolume::balanceInc(const SoapIncoming& sc, SoapOutgoing& data)
198
{
199
    LOGDEB("OHVolume::balanceInc" << endl);
200
    return UPNP_E_SUCCESS;
201
}
202
203
int OHVolume::balanceDec(const SoapIncoming& sc, SoapOutgoing& data)
204
{
205
    LOGDEB("OHVolume::balanceDec" << endl);
206
    return UPNP_E_SUCCESS;
207
}
208
209
210
int OHVolume::fade(const SoapIncoming& sc, SoapOutgoing& data)
211
{
212
    LOGDEB("OHVolume::fade" << endl);
213
    data.addarg("Value", SoapHelp::i2s(0));
214
    return UPNP_E_SUCCESS;
215
}
216
217
int OHVolume::setFade(const SoapIncoming& sc, SoapOutgoing& data)
218
{
219
    LOGDEB("OHVolume::setFade" << endl);
220
    int fade;
221
    if (!sc.get("Value", &fade) || fade != 0) {
222
        return UPNP_E_INVALID_PARAM;
223
    }
224
    return UPNP_E_SUCCESS;
225
}
226
227
int OHVolume::fadeInc(const SoapIncoming& sc, SoapOutgoing& data)
228
{
229
    LOGDEB("OHVolume::fadeInc" << endl);
230
    return UPNP_E_SUCCESS;
231
}
232
233
int OHVolume::fadeDec(const SoapIncoming& sc, SoapOutgoing& data)
234
{
235
    LOGDEB("OHVolume::fadeDec" << endl);
236
    return UPNP_E_SUCCESS;
237
}