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>
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.
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.
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/>.
24
#ifndef MODEMMANAGERQT_MODEMINTERFACE_H
25
#define MODEMMANAGERQT_MODEMINTERFACE_H
27
#include <ModemManager/ModemManager.h>
29
#include "ModemManagerQt-export.h"
33
#include <QSharedPointer>
34
#include <QDBusObjectPath>
36
#include "generic-types.h"
37
#include "interface.h"
39
class ModemInterfacePrivate;
41
namespace ModemManager
43
class MODEMMANAGERQT_EXPORT ModemInterface : public Interface
46
Q_DECLARE_PRIVATE(ModemInterface)
48
Q_FLAGS(MMModemCapability)
49
Q_FLAGS(MMModemAccessTechnology)
51
Q_FLAGS(MMBearerIpFamily)
54
Q_DECLARE_FLAGS(Capabilities, MMModemCapability)
55
Q_DECLARE_FLAGS(AccessTechnologies, MMModemAccessTechnology)
56
Q_DECLARE_FLAGS(ModemModes, MMModemMode)
57
Q_DECLARE_FLAGS(IpBearerFamilies, MMBearerIpFamily)
59
typedef QSharedPointer<ModemInterface> Ptr;
60
typedef QList<Ptr> List;
63
QString apn; // required for 3GPP
64
MMBearerIpFamily ipType;
65
MMBearerAllowedAuth allowedAuth;
69
MMModemCdmaRmProtocol rmProtocol;
70
QString number; // required for POTS
73
explicit ModemInterface( const QString &path, QObject *parent = 0 );
77
bool isEnabled() const;
80
// From org.freedesktop.ModemManager.Modem
82
void enable(bool enable);
84
QStringList listBearers();
85
QString createBearer(const BearerStruct &bearer);
86
void deleteBearer(const QDBusObjectPath &bearer);
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);
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;
126
// From org.freedesktop.ModemManager.Modem.Simple
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
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);
144
// Dictionary of properties.
145
// Each implementation is free to add it's own specific key-value pairs. The predefined
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();
161
void disconnectModem(const QDBusObjectPath &bearer);
162
void disconnectAllModems();
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();
175
void onPropertiesChanged(const QString &ifaceName, const QVariantMap &changedProps, const QStringList &invalidatedProps);
176
void onStateChanged(int oldState, int newState, uint reason);
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)
187
} // namespace ModemManager