1
/* This file is part of the KDE project
2
Copyright (C) 2010 Lamarque Souza <lamarque@gmail.com>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
20
#ifndef SOLID_CONTROL_MODEMINTERFACE_H
21
#define SOLID_CONTROL_MODEMINTERFACE_H
23
#include <QtCore/QObject>
24
#include <QtCore/QVariant>
25
#include <QtDBus/QtDBus>
27
#include <solid/networking.h>
28
#include "solid_control_export.h"
29
#include "networkipv4config.h"
35
class ModemInterfacePrivate;
37
class SOLIDCONTROL_EXPORT ModemInterface: public QObject
40
Q_ENUMS(Type Method AllowedMode AccessTechnology Mode Band)
41
Q_DECLARE_PRIVATE(ModemInterface)
45
UnknownType = 0, /* MM specification does not include this type though. */
51
Ppp = 0, /* Use PPP to get the address. */
52
Static = 1, /* Static configuration, the modem will provide IP information. */
53
Dhcp = 2, /*Use DHCP */
57
/* Describes the device's current access mode preference;
58
* ie the specific technology preferences the device is allowed to use
59
* when connecting to a mobile network. */
61
AnyModeAllowed = 0x0, /* Any mode can be used */
62
Prefer2g, /* Prefer 2G (GPRS or EDGE) */
63
Prefer3g, /* Prefer 3G (UMTS or HSxPA) */
64
UseOnly2g, /* Use only 2G (GPRS or EDGE) */
65
UseOnly3g /* Use only 3G (UMTS or HSxPA) */
68
/* Describes various access technologies that a device uses when connected to a mobile network. */
69
enum AccessTechnology {
70
UnknownTechnology = 0x0, /* The access technology used is unknown */
72
GsmCompact, /* Compact GSM */
74
Edge, /* EDGE (ETSI 27.007: "GSM w/EGPRS") */
75
Umts, /* UMTS (ETSI 27.007: "UTRAN") */
76
Hsdpa, /* HSDPA (ETSI 27.007: "UTRAN w/HSDPA") */
77
Hsupa, /* HSUPA (ETSI 27.007: "UTRAN w/HSUPA") */
78
Hspa /* HSPA (ETSI 27.007: "UTRAN w/HSDPA and HSUPA") */
81
/* A bitfield describing the specifc access modes and technologies supported by a device
82
* and the access technology in-use when connected to a mobile network. */
84
UnknownMode = 0x0, /* Unknown or invalid mode. */
85
AnyMode = 0x1, /* For certain operations, allow the modem to pick any available mode. */
86
GprsMode = 0x2, /* GPRS */
87
EdgeMode = 0x4, /* EDGE */
88
UmtsMode = 0x8, /* UMTS (3G) */
89
HsdpaMode = 0x10, /* HSDPA (3G) */
90
Prefer2gMode = 0x20, /* Prefer 2G (GPRS or EDGE) */
91
Prefer3gMode = 0x40, /* Prefer 3G (UMTS/HSDPA/HSUPA/HSPA) */
92
UseOnly2gMode = 0x80, /* Use only 2G (GPRS or EDGE) */
93
UseOnly3gMode = 0x100, /* Use only 3G (UMTS/HSDPA/HSUPA/HSPA) */
94
HsupaMode = 0x200, /* HSUPA (3G) */
95
HspaMode = 0x400, /* HSPA (3G) */
96
GsmMode = 0x800, /* GSM */
97
GsmCompactMode = 0x1000 /* GSM Compact */
100
/* A bitfield describing the specific radio bands supported by the device
101
* and the radio bands the device is allowed to use when connecting to a mobile network. */
103
UnknownBand = 0x0, /* Unknown or invalid band */
104
AnyBand = 0x1, /* For certain operations allow the modem to select a band automatically. */
105
Egsm = 0x2, /* GSM/GPRS/EDGE 900 MHz */
106
Dcs = 0x4, /* GSM/GPRS/EDGE 1800 MHz */
107
Pcs = 0x8, /* GSM/GPRS/EDGE 1900 MHz */
108
G850 = 0x10, /* GSM/GPRS/EDGE 850 MHz */
109
U2100 = 0x20, /* WCDMA 2100 MHz (Class I) */
110
U1800 = 0x40, /* WCDMA 3GPP 1800 MHz (Class III) */
111
U17IV = 0x80, /* WCDMA 3GPP AWS 1700/2100 MHz (Class IV) */
112
U800 = 0x100, /* WCDMA 3GPP UMTS 800 MHz (Class VI) */
113
U850 = 0x200, /* WCDMA 3GPP UMTS 850 MHz (Class V) */
114
U900 = 0x400, /* WCDMA 3GPP UMTS 900 MHz (Class VIII) */
115
U17IX = 0x800, /* WCDMA 3GPP UMTS 1700 MHz (Class IX) */
116
U19IX = 0x1000 /* WCDMA 3GPP UMTS 1900 MHz (Class II) */
119
enum GsmInterfaceType {
141
QString manufacturer,
147
* Creates a new ModemInterface object.
149
* @param backendObject the modem object provided by the backend
151
explicit ModemInterface(QObject *backendObject);
154
* Constructs a copy of a modem.
156
* @param modem the modem to copy
158
ModemInterface(const ModemInterface &modem);
161
* Destroys a ModemInterface object.
163
virtual ~ModemInterface();
167
void enable(const bool enable) const;
169
void connectModem(const QString & number) const;
171
void connectModem(const QVariantMap & properties) const;
173
void disconnectModem() const;
175
Ip4ConfigType getIp4Config() const;
177
InfoType getInfo() const;
179
QVariantMap getStatus() const;
184
QString device() const;
186
QString masterDevice() const;
188
QString driver() const;
192
bool enabled() const;
194
QString unlockRequired() const;
196
Method ipMethod() const;
198
static QString convertTypeToString(const Type type);
201
* Return a description of the band id.
203
* @param band the band id
205
static QString convertBandToString(const Band band);
207
static QString convertAllowedModeToString(const AllowedMode mode);
210
* Return a description of the access technology used.
212
* @param tech the access technology.
214
static QString convertAccessTechnologyToString(const AccessTechnology tech);
217
void slotDeviceChanged(const QString & device);
219
void slotMasterDeviceChanged(const QString & masterDevice);
221
void slotDriverChanged(const QString & driver);
223
void slotUnlockRequiredChanged(const QString & codeRequired);
225
void deviceChanged(const QString & device);
227
void masterDeviceChanged(const QString & masterDevice);
229
void driverChanged(const QString & driver);
231
void typeChanged(const Solid::Control::ModemInterface::Type type);
233
void enabledChanged(const bool enabled);
235
void unlockRequiredChanged(const QString & codeRequired);
237
void ipMethodChanged(const Solid::Control::ModemInterface::Method ipMethod);
243
ModemInterface(ModemInterfacePrivate &dd, QObject *backendObject);
248
ModemInterface(ModemInterfacePrivate &dd, const ModemInterface &modem);
250
ModemInterfacePrivate *d_ptr;