~neon/project-neon/libmm-qt

« back to all changes in this revision

Viewing changes to modemgsmcardinterface.cpp

  • Committer: Jan Grulich
  • Date: 2013-10-06 11:42:12 UTC
  • Revision ID: git-v1:6b330d21e12353005970209902f3e02b2786e265
Rename files to mach classes and dbus interfaces

Update README a little bit

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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>
5
 
 
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.
13
 
 
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.
18
 
 
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/>.
21
 
*/
22
 
 
23
 
#include "modemgsmcardinterface.h"
24
 
#include "modemgsmcardinterface_p.h"
25
 
#include "mmdebug.h"
26
 
 
27
 
ModemSimCardInterfacePrivate::ModemSimCardInterfacePrivate(const QString &path)
28
 
    : modemSimCardIface(MM_DBUS_SERVICE, path, QDBusConnection::systemBus())
29
 
{
30
 
}
31
 
 
32
 
ModemManager::ModemSimCardInterface::ModemSimCardInterface(const QString &path, QObject *parent)
33
 
    : QObject(parent)
34
 
    , d_ptr(new ModemSimCardInterface(path))
35
 
{
36
 
    Q_D(ModemSimCardInterface);
37
 
 
38
 
#if 0
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)));
43
 
#endif
44
 
}
45
 
 
46
 
ModemManager::ModemSimCardInterface::~ModemSimCardInterface()
47
 
{
48
 
}
49
 
 
50
 
#if 0
51
 
void ModemManager::ModemSimCardInterface::propertiesChanged(const QString &interface, const QVariantMap &properties)
52
 
{
53
 
    mmDebug() << interface << properties.keys();
54
 
 
55
 
    if (interface == QString("org.freedesktop.ModemManager.Modem.Gsm.Card")) {
56
 
        QLatin1String supportedBands("SupportedBands");
57
 
        QLatin1String supportedModes("SupportedModes");
58
 
        QLatin1String simIdentifier("SimIdentifier");
59
 
 
60
 
        Q_D(ModemGsmCardInterface);
61
 
 
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);
66
 
        }
67
 
        it = properties.find(supportedModes);
68
 
        if ( it != properties.end()) {
69
 
            d->supportedModes = (ModemManager::ModemInterface::Mode) it->toInt();
70
 
            emit supportedModesChanged(d->supportedModes);
71
 
        }
72
 
        it = properties.find(simIdentifier);
73
 
        if ( it != properties.end()) {
74
 
            d->simIdentifier = it->toString();
75
 
            emit simIdentifierChanged(d->simIdentifier);
76
 
        }
77
 
    }
78
 
}
79
 
#endif
80
 
 
81
 
QString ModemManager::ModemSimCardInterface::simIdentifier() const
82
 
{
83
 
    Q_D(const ModemSimCardInterface);
84
 
    return d->modemSimCardIface.simIdentifier();
85
 
}
86
 
 
87
 
QString ModemManager::ModemSimCardInterface::imsi() const
88
 
{
89
 
    Q_D(const ModemSimCardInterface);
90
 
    return d->modemSimCardIface.imsi();
91
 
}
92
 
 
93
 
QString ModemManager::ModemSimCardInterface::operatorIdentifier() const
94
 
{
95
 
    Q_D(const ModemSimCardInterface);
96
 
    return d->modemSimCardIface.operatorIdentifier();
97
 
}
98
 
 
99
 
QString ModemManager::ModemSimCardInterface::operatorName() const
100
 
{
101
 
    Q_D(const ModemSimCardInterface);
102
 
    return d->modemSimCardIface.operatorName();
103
 
}
104
 
 
105
 
QDBusPendingReply<> ModemManager::ModemSimCardInterface::sendPuk(const QString &puk, const QString &pin)
106
 
{
107
 
    Q_D(ModemSimCardInterface);
108
 
    return d->modemSimCardIface.SendPuk(puk, pin);
109
 
}
110
 
 
111
 
QDBusPendingReply<> ModemManager::ModemSimCardInterface::sendPin(const QString &pin)
112
 
{
113
 
    Q_D(ModemSimCardInterface);
114
 
    return d->modemSimCardIface.SendPin(pin);
115
 
}
116
 
 
117
 
QDBusPendingReply<> ModemManager::ModemSimCardInterface::enablePin(const QString &pin, bool enabled)
118
 
{
119
 
    Q_D(ModemSimCardInterface);
120
 
    return d->modemSimCardIface.EnablePin(pin, enabled);
121
 
}
122
 
 
123
 
QDBusPendingReply<> ModemManager::ModemSimCardInterface::changePin(const QString &oldPin, const QString &newPin)
124
 
{
125
 
    Q_D(ModemSimCardInterface);
126
 
    return d->modemSimCardIface.ChangePin(oldPin, newPin);
127
 
}