/
qofonocallforwarding.cpp
163 lines (138 loc) · 4.6 KB
/
qofonocallforwarding.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/****************************************************************************
**
** Copyright (C) 2013-2020 Jolla Ltd.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
****************************************************************************/
#include "dbustypes_p.h"
#include "qofonocallforwarding.h"
#include "ofono_call_forwarding_interface.h"
#define SUPER QOfonoModemInterface
QOfonoCallForwarding::QOfonoCallForwarding(QObject *parent)
: SUPER(OfonoCallForwarding::staticInterfaceName(), parent)
{
}
QOfonoCallForwarding::~QOfonoCallForwarding()
{
}
QDBusAbstractInterface *QOfonoCallForwarding::createDbusInterface(const QString &path)
{
return new OfonoCallForwarding(OFONO_SERVICE, path, OFONO_BUS, this);
}
void QOfonoCallForwarding::connectOfono()
{
resetDbusInterface();
}
void QOfonoCallForwarding::propertyChanged(const QString &property, const QVariant &value)
{
SUPER::propertyChanged(property, value);
if (property == QLatin1String("VoiceUnconditional")) {
Q_EMIT voiceUnconditionalChanged(value.toString());
} else if (property == QLatin1String("VoiceBusy")) {
Q_EMIT voiceBusyChanged(value.toString());
} else if (property == QLatin1String("VoiceNoReply")) {
Q_EMIT voiceNoReplyChanged(value.toString());
} else if (property == QLatin1String("VoiceNoReplyTimeout")) {
Q_EMIT voiceNoReplyTimeoutChanged(value.value<quint16>());
} else if (property == QLatin1String("VoiceNotReachable")) {
Q_EMIT voiceNotReachableChanged(value.toString());
} else if (property == QLatin1String("ForwardingFlagOnSim")) {
Q_EMIT forwardingFlagOnSimChanged(value.toBool());
}
}
QString QOfonoCallForwarding::voiceUnconditional()
{
return getString("VoiceUnconditional");
}
void QOfonoCallForwarding::setVoiceUnconditional(const QString &property)
{
setProperty("VoiceUnconditional", property);
}
QString QOfonoCallForwarding::voiceBusy()
{
return getString("VoiceBusy");
}
void QOfonoCallForwarding::setVoiceBusy(const QString &property)
{
setProperty("VoiceBusy", property);
}
QString QOfonoCallForwarding::voiceNoReply()
{
return getString("VoiceNoReply");
}
void QOfonoCallForwarding::setVoiceNoReply(const QString &property)
{
setProperty("VoiceNoReply", property);
}
quint16 QOfonoCallForwarding::voiceNoReplyTimeout()
{
return getProperty("VoiceNoReplyTimeout").value<quint16>();
}
void QOfonoCallForwarding::setVoiceNoReplyTimeout(ushort timeout)
{
setProperty("VoiceNoReplyTimeout", QVariant::fromValue((quint16)timeout));
}
QString QOfonoCallForwarding::voiceNotReachable()
{
return getString("VoiceNotReachable");
}
void QOfonoCallForwarding::setVoiceNotReachable(const QString &property)
{
setProperty("VoiceNotReachable", property);
}
bool QOfonoCallForwarding::forwardingFlagOnSim()
{
return getBool("ForwardingFlagOnSim");
}
void QOfonoCallForwarding::disableAll(const QString &type)
{
OfonoCallForwarding *iface = (OfonoCallForwarding*)dbusInterface();
if (iface) {
iface->DisableAll(type);
}
}
void QOfonoCallForwarding::getPropertiesFinished(const QVariantMap &properties, const QDBusError *error)
{
SUPER::getPropertiesFinished(properties, error);
if (error) {
Q_EMIT getPropertiesFailed();
}
}
void QOfonoCallForwarding::setPropertyFinished(const QString &property, const QDBusError *error)
{
SUPER::setPropertyFinished(property, error);
if (property == "VoiceUnconditional") {
Q_EMIT voiceUnconditionalComplete(!error);
} else if (property == "VoiceBusy") {
Q_EMIT voiceBusyComplete(!error);
} else if (property == "VoiceNoReply") {
Q_EMIT voiceNoReplyComplete(!error);
} else if (property == "VoiceNoReplyTimeout") {
Q_EMIT voiceNoReplyTimeoutComplete(!error);
} else if (property == "VoiceNotReachable") {
Q_EMIT voiceNotReachableComplete(!error);
}
}
QString QOfonoCallForwarding::modemPath() const
{
return SUPER::modemPath();
}
void QOfonoCallForwarding::setModemPath(const QString &path)
{
SUPER::setModemPath(path);
}
bool QOfonoCallForwarding::isValid() const
{
return SUPER::isValid();
}
bool QOfonoCallForwarding::isReady() const
{
return SUPER::isReady();
}