2
Copyright 2008 Will Stephenson <wstephenson@kde.org>
3
Copyright 2010 Lamarque Souza <lamarque@gmail.com>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of
7
the License or (at your option) version 3 or any later version
8
accepted by the membership of KDE e.V. (or its successor approved
9
by the membership of KDE e.V.), which shall act as a proxy
10
defined in Section 14 of version 3 of the license.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "modemgsmussdinterface.h"
23
#include "modemgsmussdinterface_p.h"
27
MMModemGsmUssdInterfacePrivate::MMModemGsmUssdInterfacePrivate(const QString &path, QObject *owner)
28
: MMModemInterfacePrivate(path, owner), modemGsmUssdIface(MMModemManager::DBUS_SERVICE, path, QDBusConnection::systemBus())
32
MMModemGsmUssdInterface::MMModemGsmUssdInterface(const QString & path, MMModemManager * manager, QObject * parent)
33
: MMModemInterface(*new MMModemGsmUssdInterfacePrivate(path, this), manager, parent)
35
Q_D(MMModemGsmUssdInterface);
37
d->modemGsmUssdIface.connection().connect(MMModemManager::DBUS_SERVICE,
38
path, QLatin1String("org.freedesktop.DBus.Properties"),
39
QLatin1String("MmPropertiesChanged"), QLatin1String("sa{sv}"),
40
this, SLOT(propertiesChanged(const QString &,const QVariantMap &)));
43
MMModemGsmUssdInterface::~MMModemGsmUssdInterface()
48
void MMModemGsmUssdInterface::propertiesChanged(const QString & interface, const QVariantMap & properties)
50
kDebug(1441) << interface << properties.keys();
52
if (interface == QString("org.freedesktop.ModemManager.Modem.Gsm.Ussd")) {
53
QLatin1String state("State");
54
QLatin1String networkNotification("NetworkNotification");
55
QLatin1String networkRequest("NetworkRequest");
57
QVariantMap::const_iterator it = properties.find(state);
58
if ( it != properties.end()) {
59
emit stateChanged(it->toString());
61
it = properties.find(networkNotification);
62
if ( it != properties.end()) {
63
emit networkNotificationChanged(it->toString());
65
it = properties.find(networkRequest);
66
if ( it != properties.end()) {
67
emit networkRequestChanged(it->toString());
72
QString MMModemGsmUssdInterface::initiate(const QString & command)
74
Q_D(MMModemGsmUssdInterface);
75
QDBusReply<QString> reply = d->modemGsmUssdIface.Initiate(command);
77
if (reply.isValid()) {
83
void MMModemGsmUssdInterface::respond(const QString response)
85
Q_D(MMModemGsmUssdInterface);
86
d->modemGsmUssdIface.Respond(response);
89
void MMModemGsmUssdInterface::cancel()
91
Q_D(MMModemGsmUssdInterface);
92
d->modemGsmUssdIface.Cancel();
95
QString MMModemGsmUssdInterface::getState()
97
Q_D(const MMModemGsmUssdInterface);
98
return d->modemGsmUssdIface.state();
101
QString MMModemGsmUssdInterface::getNetworkNotification()
103
Q_D(const MMModemGsmUssdInterface);
104
return d->modemGsmUssdIface.networkNotification();
107
QString MMModemGsmUssdInterface::getNetworkRequest()
109
Q_D(const MMModemGsmUssdInterface);
110
return d->modemGsmUssdIface.networkRequest();
113
#include "modemgsmussdinterface.moc"