Switch to unified view

a/libupnpp/control/renderingcontrol.cxx b/libupnpp/control/renderingcontrol.cxx
...
...
43
}
43
}
44
44
45
void RenderingControl::evtCallback(
45
void RenderingControl::evtCallback(
46
    const std::unordered_map<std::string, std::string>& props)
46
    const std::unordered_map<std::string, std::string>& props)
47
{
47
{
48
    //LOGDEB("RenderingControl::evtCallback:" << endl);
48
    LOGDEB("RenderingControl::evtCallback: m_reporter " << m_reporter << endl);
49
    for (auto& entry: props) {
49
    for (auto& entry: props) {
50
        if (!entry.first.compare("LastChange")) {
50
        if (!entry.first.compare("LastChange")) {
51
            std::unordered_map<std::string, std::string> props1;
51
            std::unordered_map<std::string, std::string> props1;
52
            if (!decodeAVLastChange(entry.second, props1)) {
52
            if (!decodeAVLastChange(entry.second, props1)) {
53
                LOGERR("RenderingControl::evtCallback: bad LastChange value: "
53
                LOGERR("RenderingControl::evtCallback: bad LastChange value: "
54
                       << entry.second << endl);
54
                       << entry.second << endl);
55
                return;
55
                return;
56
            }
56
            }
57
            for (auto& entry1: props1) {
57
            for (auto& entry1: props1) {
58
                //LOGDEB("    " << entry1.first << " -> " << 
58
                LOGDEB1("    " << entry1.first << " -> " << 
59
                //       entry1.second << endl);
59
                        entry1.second << endl);
60
                if (!entry1.first.compare("Volume")) {
60
                if (!entry1.first.compare("Volume")) {
61
                    m_volume = atoi(entry1.second.c_str());
61
                    if (m_reporter) {
62
                        m_reporter->changed(entry1.first.c_str(),
63
                                            atoi(entry1.second.c_str()));
64
                    }
62
                } else if (!entry1.first.compare("Mute")) {
65
                } else if (!entry1.first.compare("Mute")) {
66
                    bool mute;
63
                    stringToBool(entry1.second, &m_mute);
67
                    if (m_reporter && stringToBool(entry1.second, &mute))
68
                        m_reporter->changed(entry1.first.c_str(), mute);
64
                }
69
                }
65
            }
70
            }
66
        } else {
71
        } else {
67
            LOGINF("RenderingControl:event: var not lastchange: "
72
            LOGINF("RenderingControl:event: var not lastchange: "
68
                   << entry.first << " -> " << entry.second << endl;);
73
                   << entry.first << " -> " << entry.second << endl;);
69
        }
74
        }
70
    }
75
    }
71
    LOGDEB("RenderingControl::evtCallback: m_volume " << m_volume << 
72
           " m_mute " << m_mute << endl);
73
}
76
}
74
77
75
void RenderingControl::registerCallback()
78
void RenderingControl::registerCallback()
76
{
79
{
77
    Service::registerCallback(bind(&RenderingControl::evtCallback, this, _1));
80
    Service::registerCallback(bind(&RenderingControl::evtCallback, this, _1));
...
...
80
int RenderingControl::setVolume(int volume, const string& channel)
83
int RenderingControl::setVolume(int volume, const string& channel)
81
{
84
{
82
    SoapEncodeInput args(m_serviceType, "SetVolume");
85
    SoapEncodeInput args(m_serviceType, "SetVolume");
83
    args("Channel", channel)("DesiredVolume", SoapHelp::i2s(volume));
86
    args("Channel", channel)("DesiredVolume", SoapHelp::i2s(volume));
84
    SoapDecodeOutput data;
87
    SoapDecodeOutput data;
85
    int ret = runAction(args, data);
88
    return runAction(args, data);
86
    if (ret != UPNP_E_SUCCESS) {
87
        return ret;
88
    }
89
    return 0;
90
}
89
}
91
90
92
int RenderingControl::getVolume(const string& channel)
91
int RenderingControl::getVolume(const string& channel)
93
{
92
{
94
    SoapEncodeInput args(m_serviceType, "GetVolume");
93
    SoapEncodeInput args(m_serviceType, "GetVolume");
...
...
109
int RenderingControl::setMute(bool mute, const string& channel)
108
int RenderingControl::setMute(bool mute, const string& channel)
110
{
109
{
111
    SoapEncodeInput args(m_serviceType, "SetMute");
110
    SoapEncodeInput args(m_serviceType, "SetMute");
112
    args("Channel", channel)("DesiredMute", SoapHelp::i2s(mute?1:0));
111
    args("Channel", channel)("DesiredMute", SoapHelp::i2s(mute?1:0));
113
    SoapDecodeOutput data;
112
    SoapDecodeOutput data;
114
    int ret = runAction(args, data);
113
    return runAction(args, data);
115
    if (ret != UPNP_E_SUCCESS) {
116
        return ret;
117
    }
118
    return 0;
119
}
114
}
120
115
121
bool RenderingControl::getMute(const string& channel)
116
bool RenderingControl::getMute(const string& channel)
122
{
117
{
123
    SoapEncodeInput args(m_serviceType, "GetMute");
118
    SoapEncodeInput args(m_serviceType, "GetMute");