~neon/project-neon/libmm-qt

« back to all changes in this revision

Viewing changes to modeminterface.h

  • 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 Lamarque Souza <lamarque@kde.org>
4
 
Copyright 2013 Daniel Nicoletti <dantti12@gmail.com>
5
 
Copyright 2013 Lukas Tinkl <ltinkl@redhat.com>
6
 
 
7
 
This library is free software; you can redistribute it and/or
8
 
modify it under the terms of the GNU Lesser General Public
9
 
License as published by the Free Software Foundation; either
10
 
version 2.1 of the License, or (at your option) version 3, or any
11
 
later version accepted by the membership of KDE e.V. (or its
12
 
successor approved by the membership of KDE e.V.), which shall
13
 
act as a proxy defined in Section 6 of version 3 of the license.
14
 
 
15
 
This library is distributed in the hope that it will be useful,
16
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
 
Lesser General Public License for more details.
19
 
 
20
 
You should have received a copy of the GNU Lesser General Public
21
 
License along with this library.  If not, see <http://www.gnu.org/licenses/>.
22
 
*/
23
 
 
24
 
#ifndef MODEMMANAGERQT_MODEMINTERFACE_H
25
 
#define MODEMMANAGERQT_MODEMINTERFACE_H
26
 
 
27
 
#include <ModemManager/ModemManager.h>
28
 
 
29
 
#include "ModemManagerQt-export.h"
30
 
 
31
 
#include <QObject>
32
 
#include <QVariant>
33
 
#include <QSharedPointer>
34
 
#include <QDBusObjectPath>
35
 
 
36
 
#include "generic-types.h"
37
 
#include "interface.h"
38
 
 
39
 
class ModemInterfacePrivate;
40
 
 
41
 
namespace ModemManager
42
 
{
43
 
class MODEMMANAGERQT_EXPORT ModemInterface : public Interface
44
 
{
45
 
    Q_OBJECT
46
 
    Q_DECLARE_PRIVATE(ModemInterface)
47
 
 
48
 
    Q_FLAGS(MMModemCapability)
49
 
    Q_FLAGS(MMModemAccessTechnology)
50
 
    Q_FLAGS(MMModemMode)
51
 
    Q_FLAGS(MMBearerIpFamily)
52
 
 
53
 
public:
54
 
    Q_DECLARE_FLAGS(Capabilities, MMModemCapability)
55
 
    Q_DECLARE_FLAGS(AccessTechnologies, MMModemAccessTechnology)
56
 
    Q_DECLARE_FLAGS(ModemModes, MMModemMode)
57
 
    Q_DECLARE_FLAGS(IpBearerFamilies, MMBearerIpFamily)
58
 
 
59
 
    typedef QSharedPointer<ModemInterface> Ptr;
60
 
    typedef QList<Ptr> List;
61
 
 
62
 
    struct BearerStruct {
63
 
        QString apn; // required for 3GPP
64
 
        MMBearerIpFamily ipType;
65
 
        MMBearerAllowedAuth allowedAuth;
66
 
        QString user;
67
 
        QString password;
68
 
        bool allowRoaming;
69
 
        MMModemCdmaRmProtocol rmProtocol;
70
 
        QString number; // required for POTS
71
 
    };
72
 
 
73
 
    explicit ModemInterface( const QString &path, QObject *parent = 0 );
74
 
    ~ModemInterface();
75
 
 
76
 
    QString uni() const;
77
 
    bool isEnabled() const;
78
 
    bool isValid() const;
79
 
 
80
 
    // From org.freedesktop.ModemManager.Modem
81
 
    // methods
82
 
    void enable(bool enable);
83
 
 
84
 
    QStringList listBearers();
85
 
    QString createBearer(const BearerStruct &bearer);
86
 
    void deleteBearer(const QDBusObjectPath &bearer);
87
 
 
88
 
    void reset();
89
 
    void factoryReset(const QString &code);
90
 
    void setPowerState(MMModemPowerState state);
91
 
    void setCurrentCapabilities(Capabilities caps);
92
 
    void setCurrentModes(const CurrentModesType &mode);
93
 
    void setCurrentBands(const QList<MMModemBand> &bands);
94
 
    QString command(const QString &cmd, uint timeout);
95
 
 
96
 
    // properties
97
 
    QString simPath() const;
98
 
    QList<MMModemCapability> supportedCapabilities() const;
99
 
    Capabilities currentCapabilities() const;
100
 
    uint maxBearers() const;
101
 
    uint maxActiveBearers() const;
102
 
    QString manufacturer() const;
103
 
    QString model() const;
104
 
    QString revision() const;
105
 
    QString deviceIdentifier() const;
106
 
    QString device() const;
107
 
    QStringList drivers() const;
108
 
    QString plugin() const;
109
 
    QString primaryPort() const;
110
 
    QString equipmentIdentifier() const;
111
 
    MMModemLock unlockRequired() const;
112
 
    UnlockRetriesMap unlockRetries() const;
113
 
    MMModemState state() const;
114
 
    MMModemStateFailedReason stateFailedReason() const;
115
 
    AccessTechnologies accessTechnologies() const;
116
 
    SignalQualityPair signalQuality() const;
117
 
    QStringList ownNumbers() const;
118
 
    MMModemPowerState powerState() const;
119
 
    SupportedModesType supportedModes() const;
120
 
    CurrentModesType currentModes() const;
121
 
    QList<MMModemBand> supportedBands() const;
122
 
    QList<MMModemBand> currentBands() const;
123
 
    IpBearerFamilies supportedIpFamilies() const;
124
 
 
125
 
 
126
 
    // From org.freedesktop.ModemManager.Modem.Simple
127
 
 
128
 
    //  Dictionary of properties needed to get the modem connected.
129
 
    //  Each implementation is free to add its own specific key-value pairs. The predefined
130
 
    //  common ones are:
131
 
    //
132
 
    //  "pin": SIM-PIN unlock code, given as a string value (signature "s").
133
 
    //  "operator-id": ETSI MCC-MNC of a network to force registration with, given as a string value (signature "s").
134
 
    //  "apn": For GSM/UMTS and LTE devices the APN to use, given as a string value (signature "s").
135
 
    //  "ip-type": For GSM/UMTS and LTE devices the IP addressing type to use, given as a MMBearerIpFamily value (signature "u").
136
 
    //  "allowed-auth": The authentication method to use, given as a MMBearerAllowedAuth value (signature "u"). Optional in 3GPP.
137
 
    //  "user": User name (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP.
138
 
    //  "password": Password (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP.
139
 
    //  "number": For POTS devices the number to dial,, given as a string value (signature "s").
140
 
    //  "allow-roaming": FALSE to allow only connections to home networks, given as a boolean value (signature "b").
141
 
    //  "rm-protocol": For CDMA devices, the protocol of the Rm interface, given as a MMModemCdmaRmProtocol value (signature "u").
142
 
    QDBusObjectPath connectModem(const QVariantMap &properties);
143
 
 
144
 
    //  Dictionary of properties.
145
 
    //  Each implementation is free to add it's own specific key-value pairs. The predefined
146
 
    //  common ones are:
147
 
    //
148
 
    //  "state": A MMModemState value specifying the overall state of the modem, given as an unsigned integer value (signature "u").
149
 
    //  "signal-quality": Signal quality value, given only when registered, as an unsigned integer value (signature "u").
150
 
    //  "current-bands": List of MMModemBand values, given only when registered, as a list of unsigned integer values (signature "au").
151
 
    //  "access-technology": A MMModemAccessTechnology value, given only when registered, as an unsigned integer value (signature "u").
152
 
    //  "m3gpp-registration-state":A MMModem3gppRegistrationState value specifying the state of the registration, given only when registered in a 3GPP network, as an unsigned integer value (signature "u").
153
 
    //  "m3gpp-operator-code":Operator MCC-MNC, given only when registered in a 3GPP network, as a string value (signature "s").
154
 
    //  "m3gpp-operator-name":Operator name, given only when registered in a 3GPP network, as a string value (signature "s").
155
 
    //  "cdma-cdma1x-registration-state":A MMModemCdmaRegistrationState value specifying the state of the registration, given only when registered in a CDMA1x network, as an unsigned integer value (signature "u").
156
 
    //  "cdma-evdo-registration-state":A MMModemCdmaRegistrationState value specifying the state of the registration, given only when registered in a EV-DO network, as an unsigned integer value (signature "u").
157
 
    //  "cdma-sid":The System Identifier of the serving network, if registered in a CDMA1x network and if known. Given as an unsigned integer value (signature "u").
158
 
    //  "cdma-nid":The Network Identifier of the serving network, if registered in a CDMA1x network and if known. Given as an unsigned integer value (signature "u").
159
 
    QVariantMap status();
160
 
 
161
 
    void disconnectModem(const QDBusObjectPath &bearer);
162
 
    void disconnectAllModems();
163
 
 
164
 
Q_SIGNALS:
165
 
    void deviceChanged(const QString &device);
166
 
    void driversChanged(const QStringList &drivers);
167
 
    void enabledChanged(bool enabled);
168
 
    void unlockRequiredChanged(MMModemLock lock);
169
 
    void stateChanged(MMModemState oldState, MMModemState newState, MMModemStateChangeReason reason);
170
 
    void signalQualityChanged(uint percentStrength);
171
 
    void accessTechnologyChanged(ModemManager::ModemInterface::AccessTechnologies tech);
172
 
    void currentModesChanged();
173
 
 
174
 
private Q_SLOTS:
175
 
    void onPropertiesChanged(const QString &ifaceName, const QVariantMap &changedProps, const QStringList &invalidatedProps);
176
 
    void onStateChanged(int oldState, int newState, uint reason);
177
 
 
178
 
private:
179
 
    void init();
180
 
};
181
 
 
182
 
Q_DECLARE_OPERATORS_FOR_FLAGS(ModemInterface::Capabilities)
183
 
Q_DECLARE_OPERATORS_FOR_FLAGS(ModemInterface::AccessTechnologies)
184
 
Q_DECLARE_OPERATORS_FOR_FLAGS(ModemInterface::ModemModes)
185
 
Q_DECLARE_OPERATORS_FOR_FLAGS(ModemInterface::IpBearerFamilies)
186
 
 
187
 
} // namespace ModemManager
188
 
 
189
 
#endif