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 "modemgsmcardinterface.h"
23
#include "modemgsmcardinterface_p.h"
27
MMModemGsmCardInterfacePrivate::MMModemGsmCardInterfacePrivate(const QString &path, QObject *owner)
28
: MMModemInterfacePrivate(path, owner), modemGsmCardIface(MMModemManager::DBUS_SERVICE, path, QDBusConnection::systemBus())
32
MMModemGsmCardInterface::MMModemGsmCardInterface(const QString & path, MMModemManager * manager, QObject * parent)
33
: MMModemInterface(*new MMModemGsmCardInterfacePrivate(path, this), manager, parent)
35
Q_D(MMModemGsmCardInterface);
37
d->modemGsmCardIface.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
MMModemGsmCardInterface::~MMModemGsmCardInterface()
48
void MMModemGsmCardInterface::propertiesChanged(const QString & interface, const QVariantMap & properties)
50
kDebug(1441) << interface << properties.keys();
52
if (interface == QString("org.freedesktop.ModemManager.Modem.Gsm.Card")) {
53
QLatin1String supportedBands("SupportedBands");
54
QLatin1String supportedModes("SupportedModes");
56
QVariantMap::const_iterator it = properties.find(supportedBands);
57
if ( it != properties.end()) {
58
emit supportedBandsChanged((Solid::Control::ModemInterface::Band) it->toInt());
60
it = properties.find(supportedModes);
61
if ( it != properties.end()) {
62
emit supportedModesChanged((Solid::Control::ModemInterface::Mode) it->toInt());
67
QString MMModemGsmCardInterface::getImei()
69
Q_D(MMModemGsmCardInterface);
70
QDBusReply<QString> imei = d->modemGsmCardIface.GetImei();
79
QString MMModemGsmCardInterface::getImsi()
81
Q_D(MMModemGsmCardInterface);
82
QDBusReply<QString> imsi = d->modemGsmCardIface.GetImsi();
91
QDBusPendingReply<> MMModemGsmCardInterface::sendPuk(const QString & puk, const QString & pin)
93
Q_D(MMModemGsmCardInterface);
94
return d->modemGsmCardIface.SendPuk(puk, pin);
97
QDBusPendingReply<> MMModemGsmCardInterface::sendPin(const QString & pin)
99
Q_D(MMModemGsmCardInterface);
100
return d->modemGsmCardIface.SendPin(pin);
103
QDBusPendingReply<> MMModemGsmCardInterface::enablePin(const QString & pin, const bool enabled)
105
Q_D(MMModemGsmCardInterface);
106
return d->modemGsmCardIface.EnablePin(pin, enabled);
109
QDBusPendingReply<> MMModemGsmCardInterface::changePin(const QString & oldPin, const QString & newPin)
111
Q_D(MMModemGsmCardInterface);
112
return d->modemGsmCardIface.ChangePin(oldPin, newPin);
115
Solid::Control::ModemInterface::Band MMModemGsmCardInterface::getSupportedBands() const
117
Q_D(const MMModemGsmCardInterface);
118
return (Solid::Control::ModemInterface::Band) d->modemGsmCardIface.supportedBands();
121
Solid::Control::ModemInterface::Mode MMModemGsmCardInterface::getSupportedModes() const
123
Q_D(const MMModemGsmCardInterface);
124
return (Solid::Control::ModemInterface::Mode) d->modemGsmCardIface.supportedModes();
127
#include "modemgsmcardinterface.moc"