2
Copyright 2008,2011 Will Stephenson <wstephenson@kde.org>
3
Copyright 2010-2011 Lamarque Souza <lamarque@kde.org>
4
Copyright 2013 Lukas Tinkl <ltinkl@redhat.com>
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) version 3, or any
10
later version accepted by the membership of KDE e.V. (or its
11
successor approved by the membership of KDE e.V.), which shall
12
act as a proxy defined in Section 6 of version 3 of the license.
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library. If not, see <http://www.gnu.org/licenses/>.
23
#include "modemgsmcardinterface.h"
24
#include "modemgsmcardinterface_p.h"
27
ModemSimCardInterfacePrivate::ModemSimCardInterfacePrivate(const QString &path)
28
: modemSimCardIface(MM_DBUS_SERVICE, path, QDBusConnection::systemBus())
32
ModemManager::ModemSimCardInterface::ModemSimCardInterface(const QString &path, QObject *parent)
34
, d_ptr(new ModemSimCardInterface(path))
36
Q_D(ModemSimCardInterface);
39
d->modemSimCardIface.connection().connect(ModemManager::DBUS_SERVICE,
40
path, QLatin1String("org.freedesktop.DBus.Properties"),
41
QLatin1String("MmPropertiesChanged"), QLatin1String("sa{sv}"),
42
this, SLOT(propertiesChanged(QString,QVariantMap)));
46
ModemManager::ModemSimCardInterface::~ModemSimCardInterface()
51
void ModemManager::ModemSimCardInterface::propertiesChanged(const QString &interface, const QVariantMap &properties)
53
mmDebug() << interface << properties.keys();
55
if (interface == QString("org.freedesktop.ModemManager.Modem.Gsm.Card")) {
56
QLatin1String supportedBands("SupportedBands");
57
QLatin1String supportedModes("SupportedModes");
58
QLatin1String simIdentifier("SimIdentifier");
60
Q_D(ModemGsmCardInterface);
62
QVariantMap::const_iterator it = properties.find(supportedBands);
63
if ( it != properties.end()) {
64
d->supportedBands = (ModemManager::ModemInterface::Band) it->toInt();
65
emit supportedBandsChanged(d->supportedBands);
67
it = properties.find(supportedModes);
68
if ( it != properties.end()) {
69
d->supportedModes = (ModemManager::ModemInterface::Mode) it->toInt();
70
emit supportedModesChanged(d->supportedModes);
72
it = properties.find(simIdentifier);
73
if ( it != properties.end()) {
74
d->simIdentifier = it->toString();
75
emit simIdentifierChanged(d->simIdentifier);
81
QString ModemManager::ModemSimCardInterface::simIdentifier() const
83
Q_D(const ModemSimCardInterface);
84
return d->modemSimCardIface.simIdentifier();
87
QString ModemManager::ModemSimCardInterface::imsi() const
89
Q_D(const ModemSimCardInterface);
90
return d->modemSimCardIface.imsi();
93
QString ModemManager::ModemSimCardInterface::operatorIdentifier() const
95
Q_D(const ModemSimCardInterface);
96
return d->modemSimCardIface.operatorIdentifier();
99
QString ModemManager::ModemSimCardInterface::operatorName() const
101
Q_D(const ModemSimCardInterface);
102
return d->modemSimCardIface.operatorName();
105
QDBusPendingReply<> ModemManager::ModemSimCardInterface::sendPuk(const QString &puk, const QString &pin)
107
Q_D(ModemSimCardInterface);
108
return d->modemSimCardIface.SendPuk(puk, pin);
111
QDBusPendingReply<> ModemManager::ModemSimCardInterface::sendPin(const QString &pin)
113
Q_D(ModemSimCardInterface);
114
return d->modemSimCardIface.SendPin(pin);
117
QDBusPendingReply<> ModemManager::ModemSimCardInterface::enablePin(const QString &pin, bool enabled)
119
Q_D(ModemSimCardInterface);
120
return d->modemSimCardIface.EnablePin(pin, enabled);
123
QDBusPendingReply<> ModemManager::ModemSimCardInterface::changePin(const QString &oldPin, const QString &newPin)
125
Q_D(ModemSimCardInterface);
126
return d->modemSimCardIface.ChangePin(oldPin, newPin);