Switch to unified view

a/src/ohvolume.cxx b/src/ohvolume.cxx
...
...
25
#include <unordered_map>                // for unordered_map, etc
25
#include <unordered_map>                // for unordered_map, etc
26
#include <utility>                      // for pair
26
#include <utility>                      // for pair
27
#include <vector>                       // for vector
27
#include <vector>                       // for vector
28
28
29
#include "libupnpp/log.hxx"             // for LOGDEB
29
#include "libupnpp/log.hxx"             // for LOGDEB
30
#include "libupnpp/soaphelp.hxx"        // for SoapData, SoapArgs, i2s
30
#include "libupnpp/soaphelp.hxx"        // for SoapOutgoing, SoapIncoming, i2s
31
31
32
#include "upmpd.hxx"                    // for UpMpd
32
#include "upmpd.hxx"                    // for UpMpd
33
#include "upmpdutils.hxx"               // for diffmaps
33
#include "upmpdutils.hxx"               // for diffmaps
34
#include "renderctl.hxx"                // for UpMpdRenderCtl
34
#include "renderctl.hxx"                // for UpMpdRenderCtl
35
35
...
...
99
    }
99
    }
100
100
101
    return true;
101
    return true;
102
}
102
}
103
103
104
int OHVolume::characteristics(const SoapArgs& sc, SoapData& data)
104
int OHVolume::characteristics(const SoapIncoming& sc, SoapOutgoing& data)
105
{
105
{
106
    LOGDEB("OHVolume::charact." << endl);
106
    LOGDEB("OHVolume::charact." << endl);
107
    data.addarg("VolumeMax", "100");
107
    data.addarg("VolumeMax", "100");
108
    data.addarg("VolumeUnity", "100");
108
    data.addarg("VolumeUnity", "100");
109
    data.addarg("VolumeSteps", "100");
109
    data.addarg("VolumeSteps", "100");
...
...
111
    data.addarg("BalanceMax", "0");
111
    data.addarg("BalanceMax", "0");
112
    data.addarg("FadeMax", "0");
112
    data.addarg("FadeMax", "0");
113
    return UPNP_E_SUCCESS;
113
    return UPNP_E_SUCCESS;
114
}
114
}
115
115
116
int OHVolume::setVolume(const SoapArgs& sc, SoapData& data)
116
int OHVolume::setVolume(const SoapIncoming& sc, SoapOutgoing& data)
117
{
117
{
118
    LOGDEB("OHVolume::setVolume" << endl);
118
    LOGDEB("OHVolume::setVolume" << endl);
119
    int volume;
119
    int volume;
120
    if (!sc.getInt("Value", &volume)) {
120
    if (!sc.getInt("Value", &volume)) {
121
        return UPNP_E_INVALID_PARAM;
121
        return UPNP_E_INVALID_PARAM;
...
...
123
    m_ctl->setvolume_i(volume);
123
    m_ctl->setvolume_i(volume);
124
    m_dev->loopWakeup();
124
    m_dev->loopWakeup();
125
    return UPNP_E_SUCCESS;
125
    return UPNP_E_SUCCESS;
126
}
126
}
127
127
128
int OHVolume::setMute(const SoapArgs& sc, SoapData& data)
128
int OHVolume::setMute(const SoapIncoming& sc, SoapOutgoing& data)
129
{
129
{
130
    LOGDEB("OHVolume::setMute" << endl);
130
    LOGDEB("OHVolume::setMute" << endl);
131
    bool mute;
131
    bool mute;
132
    if (!sc.getBool("Value", &mute)) {
132
    if (!sc.getBool("Value", &mute)) {
133
        return UPNP_E_INVALID_PARAM;
133
        return UPNP_E_INVALID_PARAM;
134
    }
134
    }
135
    m_ctl->setmute_i(mute);
135
    m_ctl->setmute_i(mute);
136
    return UPNP_E_SUCCESS;
136
    return UPNP_E_SUCCESS;
137
}
137
}
138
138
139
int OHVolume::volumeInc(const SoapArgs& sc, SoapData& data)
139
int OHVolume::volumeInc(const SoapIncoming& sc, SoapOutgoing& data)
140
{
140
{
141
    LOGDEB("OHVolume::volumeInc" << endl);
141
    LOGDEB("OHVolume::volumeInc" << endl);
142
    int newvol = m_ctl->getvolume_i() + 1;
142
    int newvol = m_ctl->getvolume_i() + 1;
143
    if (newvol > 100)
143
    if (newvol > 100)
144
        newvol = 100;
144
        newvol = 100;
145
    m_ctl->setvolume_i(newvol);
145
    m_ctl->setvolume_i(newvol);
146
    m_dev->loopWakeup();
146
    m_dev->loopWakeup();
147
    return UPNP_E_SUCCESS;
147
    return UPNP_E_SUCCESS;
148
}
148
}
149
149
150
int OHVolume::volumeDec(const SoapArgs& sc, SoapData& data)
150
int OHVolume::volumeDec(const SoapIncoming& sc, SoapOutgoing& data)
151
{
151
{
152
    LOGDEB("OHVolume::volumeDec" << endl);
152
    LOGDEB("OHVolume::volumeDec" << endl);
153
    int newvol = m_ctl->getvolume_i() - 1;
153
    int newvol = m_ctl->getvolume_i() - 1;
154
    if (newvol < 0)
154
    if (newvol < 0)
155
        newvol = 0;
155
        newvol = 0;
156
    m_ctl->setvolume_i(newvol);
156
    m_ctl->setvolume_i(newvol);
157
    m_dev->loopWakeup();
157
    m_dev->loopWakeup();
158
    return UPNP_E_SUCCESS;
158
    return UPNP_E_SUCCESS;
159
}
159
}
160
160
161
int OHVolume::volume(const SoapArgs& sc, SoapData& data)
161
int OHVolume::volume(const SoapIncoming& sc, SoapOutgoing& data)
162
{
162
{
163
    LOGDEB("OHVolume::volume" << endl);
163
    LOGDEB("OHVolume::volume" << endl);
164
    data.addarg("Value", SoapHelp::i2s(m_ctl->getvolume_i()));
164
    data.addarg("Value", SoapHelp::i2s(m_ctl->getvolume_i()));
165
    return UPNP_E_SUCCESS;
165
    return UPNP_E_SUCCESS;
166
}
166
}
167
167
168
int OHVolume::mute(const SoapArgs& sc, SoapData& data)
168
int OHVolume::mute(const SoapIncoming& sc, SoapOutgoing& data)
169
{
169
{
170
    LOGDEB("OHVolume::mute" << endl);
170
    LOGDEB("OHVolume::mute" << endl);
171
    bool mute = m_ctl->getvolume_i() == 0;
171
    bool mute = m_ctl->getvolume_i() == 0;
172
    data.addarg("Value", mute ? "1" : "0");
172
    data.addarg("Value", mute ? "1" : "0");
173
    return UPNP_E_SUCCESS;
173
    return UPNP_E_SUCCESS;
174
}
174
}
175
175
176
int OHVolume::volumeLimit(const SoapArgs& sc, SoapData& data)
176
int OHVolume::volumeLimit(const SoapIncoming& sc, SoapOutgoing& data)
177
{
177
{
178
    LOGDEB("OHVolume::volumeLimit" << endl);
178
    LOGDEB("OHVolume::volumeLimit" << endl);
179
    data.addarg("Value", "100");
179
    data.addarg("Value", "100");
180
    return UPNP_E_SUCCESS;
180
    return UPNP_E_SUCCESS;
181
}
181
}