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.
22
#include "modeminterface.h"
23
#include "modeminterface_p.h"
25
#include "soliddefs_p.h"
26
#include "ifaces/modeminterface.h"
28
Solid::Control::ModemInterface::ModemInterface(QObject *backendObject)
29
: QObject(), d_ptr(new ModemInterfacePrivate(this))
31
Q_D(ModemInterface); d->setBackendObject(backendObject);
34
Solid::Control::ModemInterface::ModemInterface(const ModemInterface &other)
35
: QObject(), d_ptr(new ModemInterfacePrivate(this))
38
d->setBackendObject(other.d_ptr->backendObject());
41
Solid::Control::ModemInterface::ModemInterface(ModemInterfacePrivate &dd, QObject *backendObject)
42
: QObject(), d_ptr(&dd)
44
Q_UNUSED(backendObject);
47
Solid::Control::ModemInterface::ModemInterface(ModemInterfacePrivate &dd, const ModemInterface &other)
53
Solid::Control::ModemInterface::~ModemInterface()
58
QString Solid::Control::ModemInterface::udi() const
60
Q_D(const ModemInterface);
61
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QString(), udi());
64
void Solid::Control::ModemInterface::enable(const bool enable) const
66
Q_D(const ModemInterface);
67
SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), enable(enable));
70
void Solid::Control::ModemInterface::connectModem(const QString & number) const
72
Q_D(const ModemInterface);
73
SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), connectModem(number));
76
void Solid::Control::ModemInterface::connectModem(const QVariantMap & properties) const
78
Q_D(const ModemInterface);
79
SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), connectModem(properties));
82
void Solid::Control::ModemInterface::disconnectModem() const
84
Q_D(const ModemInterface);
85
SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), disconnectModem());
88
Solid::Control::ModemInterface::Ip4ConfigType Solid::Control::ModemInterface::getIp4Config() const
90
Q_D(const ModemInterface);
91
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), Ip4ConfigType(), getIp4Config());
94
Solid::Control::ModemInterface::InfoType Solid::Control::ModemInterface::getInfo() const
96
Q_D(const ModemInterface);
97
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), InfoType(), getInfo());
100
QVariantMap Solid::Control::ModemInterface::getStatus() const
102
Q_D(const ModemInterface);
103
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QVariantMap(), getStatus());
106
QString Solid::Control::ModemInterface::device() const
108
Q_D(const ModemInterface);
109
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QString(), device());
112
QString Solid::Control::ModemInterface::masterDevice() const
114
Q_D(const ModemInterface);
115
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QString(), masterDevice());
118
QString Solid::Control::ModemInterface::driver() const
120
Q_D(const ModemInterface);
121
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QString(), driver());
124
Solid::Control::ModemInterface::Type Solid::Control::ModemInterface::type() const
126
Q_D(const ModemInterface);
127
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), Solid::Control::ModemInterface::UnknownType, type());
130
bool Solid::Control::ModemInterface::enabled() const
132
Q_D(const ModemInterface);
133
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), false, enabled());
136
QString Solid::Control::ModemInterface::unlockRequired() const
138
Q_D(const ModemInterface);
139
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), QString(), unlockRequired());
142
Solid::Control::ModemInterface::Method Solid::Control::ModemInterface::ipMethod() const
144
Q_D(const ModemInterface);
145
return_SOLID_CALL(Ifaces::ModemInterface *, d->backendObject(), UnknownMethod, ipMethod());
148
void Solid::Control::ModemInterface::slotDeviceChanged(const QString & device)
150
emit deviceChanged(device);
153
void Solid::Control::ModemInterface::slotMasterDeviceChanged(const QString & masterDevice)
155
emit masterDeviceChanged(masterDevice);
158
void Solid::Control::ModemInterface::slotDriverChanged(const QString & driver)
160
emit driverChanged(driver);
163
void Solid::Control::ModemInterface::slotUnlockRequiredChanged(const QString & codeRequired)
165
emit unlockRequiredChanged(codeRequired);
168
void Solid::Control::ModemInterfacePrivate::setBackendObject(QObject *object)
170
FrontendObjectPrivate::setBackendObject(object);
173
QObject::connect(object, SIGNAL(deviceChanged(const QString &)),
174
parent(), SLOT(slotDeviceChanged(const QString &)));
175
QObject::connect(object, SIGNAL(masterDeviceChanged(const QString &)),
176
parent(), SLOT(slotMasterDeviceChanged(const QString &)));
177
QObject::connect(object, SIGNAL(driverChanged(const QString &)),
178
parent(), SLOT(slotDriverChanged(const QString &)));
179
QObject::connect(object, SIGNAL(typeChanged(const Solid::Control::ModemInterface::Type)),
180
parent(), SIGNAL(typeChanged(const Solid::Control::ModemInterface::Type)));
181
QObject::connect(object, SIGNAL(enabledChanged(const bool)),
182
parent(), SIGNAL(enabledChanged(const bool)));
183
QObject::connect(object, SIGNAL(unlockRequiredChanged(const QString &)),
184
parent(), SLOT(slotUnlockRequiredChanged(const QString &)));
185
QObject::connect(object, SIGNAL(ipMethodChanged(const Solid::Control::ModemInterface::Method)),
186
parent(), SIGNAL(ipMethodChanged(const Solid::Control::ModemInterface::Method)));
190
QString Solid::Control::ModemInterface::convertTypeToString(const Solid::Control::ModemInterface::Type type)
193
case UnknownType: return i18nc("Unknown cellular type","Unknown");
194
case GsmType: return i18nc("Gsm cellular type","Gsm");
195
case CdmaType: return i18nc("Cdma cellular type","Cdma");
198
return i18nc("Unknown cellular type","Unknown");
201
QString Solid::Control::ModemInterface::convertBandToString(const Solid::Control::ModemInterface::Band band)
204
case UnknownBand: return i18nc("Unknown cellular frequency band","Unknown");
205
case AnyBand: return i18nc("Any cellular frequency band","Any");
206
case Egsm: return i18nc("Cellular frequency band","GSM/GPRS/EDGE 900 MHz");
207
case Dcs: return i18nc("Cellular frequency band","GSM/GPRS/EDGE 1800 MHz");
208
case Pcs: return i18nc("Cellular frequency band","GSM/GPRS/EDGE 1900 MHz");
209
case G850: return i18nc("Cellular frequency band","GSM/GPRS/EDGE 850 MHz");
210
case U2100: return i18nc("Cellular frequency band","WCDMA 2100 MHz (Class I)");
211
case U1800: return i18nc("Cellular frequency band","WCDMA 3GPP 1800 MHz (Class III)");
212
case U17IV: return i18nc("Cellular frequency band","WCDMA 3GPP AWS 1700/2100 MHz (Class IV)");
213
case U800: return i18nc("Cellular frequency band","WCDMA 3GPP UMTS 800 MHz (Class VI)");
214
case U850: return i18nc("Cellular frequency band","WCDMA 3GPP UMTS 850 MHz (Class V)");
215
case U900: return i18nc("Cellular frequency band","WCDMA 3GPP UMTS 900 MHz (Class VIII)");
216
case U17IX: return i18nc("Cellular frequency band","WCDMA 3GPP UMTS 1700 MHz (Class IX)");
217
case U19IX: return i18nc("Cellular frequency band","WCDMA 3GPP UMTS 1900 MHz (Class II)");
220
return i18nc("Unknown cellular frequency band","Unknown");
223
QString Solid::Control::ModemInterface::convertAllowedModeToString(const Solid::Control::ModemInterface::AllowedMode mode)
226
case AnyModeAllowed: return i18nc("Allowed Gsm modes (2G/3G/any)","Any");
227
case Prefer2g: return i18nc("Allowed Gsm modes (2G/3G/any)","Prefer 2G");
228
case Prefer3g: return i18nc("Allowed Gsm modes (2G/3G/any)","Prefer 3G");
229
case UseOnly2g: return i18nc("Allowed Gsm modes (2G/3G/any)","Only 2G");
230
case UseOnly3g: return i18nc("Allowed Gsm modes (2G/3G/any)","Only 3G");
233
return i18nc("Allowed Gsm modes (2G/3G/any)","Any");
236
QString Solid::Control::ModemInterface::convertAccessTechnologyToString(const Solid::Control::ModemInterface::AccessTechnology tech)
239
case UnknownTechnology: return i18nc("Unknown cellular access technology","Unknown");
240
case Gsm: return i18nc("Cellular access technology","GSM");
241
case GsmCompact: return i18nc("Cellular access technology","Compact GSM");
242
case Gprs: return i18nc("Cellular access technology","GPRS");
243
case Edge: return i18nc("Cellular access technology","EDGE");
244
case Umts: return i18nc("Cellular access technology","UMTS");
245
case Hsdpa: return i18nc("Cellular access technology","HSDPA");
246
case Hsupa: return i18nc("Cellular access technology","HSUPA");
247
case Hspa: return i18nc("Cellular access technology","HSPA");
250
return i18nc("Unknown cellular access technology","Unknown");
253
#include "modeminterface.moc"