1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSystems module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #include "qofonowrapper_p.h"
43
44 #include <QtCore/qmetaobject.h>
45 #include <QtDBus/qdbusconnection.h>
46 #include <QtDBus/qdbusconnectioninterface.h>
47 #include <QtDBus/qdbusmetatype.h>
48 #include <QtDBus/qdbusreply.h>
49
50 #if !defined(QT_NO_OFONO)
51
52 QT_BEGIN_NAMESPACE
53
54 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_SERVICE, (QLatin1String("org.ofono")))
55 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_MANAGER_INTERFACE, (QLatin1String("org.ofono.Manager")))
56 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_MANAGER_PATH, (QLatin1String("/")))
57 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_MODEM_INTERFACE, (QLatin1String("org.ofono.Modem")))
58 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_NETWORK_REGISTRATION_INTERFACE, (QLatin1String("org.ofono.NetworkRegistration")))
59 Q_GLOBAL_STATIC_WITH_ARGS(const QString, OFONO_SIM_MANAGER_INTERFACE, (QLatin1String("org.ofono.SimManager")))
60
61 struct QOfonoProperty
62 {
63 QDBusObjectPath path;
64 QVariantMap properties;
65 };
66 Q_DECLARE_METATYPE(QOfonoProperty)
67
68 typedef QList<QOfonoProperty> QOfonoPropertyMap;
69 Q_DECLARE_METATYPE(QOfonoPropertyMap)
70
71 QDBusArgument &operator<<(QDBusArgument &argument, const QOfonoProperty &prop)
72 {
73 argument.beginStructure();
74 argument << prop.path << prop.properties;
75 argument.endStructure();
76 return argument;
77 }
78
operator >>(const QDBusArgument & argument,QOfonoProperty & prop)79 const QDBusArgument &operator>>(const QDBusArgument &argument, QOfonoProperty &prop)
80 {
81 argument.beginStructure();
82 argument >> prop.path >> prop.properties;
83 argument.endStructure();
84 return argument;
85 }
86
87 /*!
88 \internal
89 \class QOfonoWrapper
90 \brief QOfonoWrapper is a wrapper for OFONO DBus APIs.
91 */
92
93 int QOfonoWrapper::available = -1;
94
QOfonoWrapper(QObject * parent)95 QOfonoWrapper::QOfonoWrapper(QObject *parent)
96 : QObject(parent)
97 , watchAllModems(false)
98 , watchProperties(false)
99 {
100 qDBusRegisterMetaType<QOfonoProperty>();
101 qDBusRegisterMetaType<QOfonoPropertyMap>();
102 }
103
104 /*!
105 \internal
106
107 Returns true if OFONO is available, or false otherwise.
108
109 Note that it only does the real checking when called for the first time, which might cost some
110 time.
111 */
isOfonoAvailable()112 bool QOfonoWrapper::isOfonoAvailable()
113 {
114 // -1: Don't know if OFONO is available or not.
115 // 0: OFONO is not available.
116 // 1: OFONO is available.
117 if (-1 == available) {
118 if (QDBusConnection::systemBus().isConnected()) {
119 QDBusReply<bool> reply = QDBusConnection::systemBus().interface()->isServiceRegistered(*OFONO_SERVICE());
120 if (reply.isValid())
121 available = reply.value();
122 else
123 available = 0;
124 }
125 }
126
127 return available;
128 }
129
130 // Manager Interface
allModems()131 QStringList QOfonoWrapper::allModems()
132 {
133 if (watchAllModems)
134 return allModemPaths;
135 else
136 return getAllModems();
137 }
138
139 // Network Registration Interface
signalStrength(const QString & modemPath)140 int QOfonoWrapper::signalStrength(const QString &modemPath)
141 {
142 if (watchProperties)
143 return signalStrengths.value(modemPath);
144 else
145 return getSignalStrength(modemPath);
146 }
147
currentCellDataTechnology(const QString & modemPath)148 QNetworkInfo::CellDataTechnology QOfonoWrapper::currentCellDataTechnology(const QString &modemPath)
149 {
150 if (watchProperties)
151 return currentCellDataTechnologies.value(modemPath);
152 else
153 return getCurrentCellDataTechnology(modemPath);
154 }
155
networkStatus(const QString & modemPath)156 QNetworkInfo::NetworkStatus QOfonoWrapper::networkStatus(const QString &modemPath)
157 {
158 if (watchProperties)
159 return networkStatuses.value(modemPath);
160 else
161 return getNetworkStatus(modemPath);
162 }
163
cellId(const QString & modemPath)164 QString QOfonoWrapper::cellId(const QString &modemPath)
165 {
166 if (watchProperties)
167 return cellIds.value(modemPath);
168 else
169 return getCellId(modemPath);
170 }
171
currentMcc(const QString & modemPath)172 QString QOfonoWrapper::currentMcc(const QString &modemPath)
173 {
174 if (watchProperties)
175 return currentMccs.value(modemPath);
176 else
177 return getCurrentMcc(modemPath);
178 }
179
currentMnc(const QString & modemPath)180 QString QOfonoWrapper::currentMnc(const QString &modemPath)
181 {
182 if (watchProperties)
183 return currentMncs.value(modemPath);
184 else
185 return getCurrentMnc(modemPath);
186 }
187
lac(const QString & modemPath)188 QString QOfonoWrapper::lac(const QString &modemPath)
189 {
190 if (watchProperties)
191 return lacs.value(modemPath);
192 else
193 return getLac(modemPath);
194 }
195
operatorName(const QString & modemPath)196 QString QOfonoWrapper::operatorName(const QString &modemPath)
197 {
198 if (watchProperties)
199 return operatorNames.value(modemPath);
200 else
201 return getOperatorName(modemPath);
202 }
203
networkMode(const QString & modemPath)204 QNetworkInfo::NetworkMode QOfonoWrapper::networkMode(const QString& modemPath)
205 {
206 return technologyToMode(currentTechnology(modemPath));
207 }
208
209 // SIM Manager Interface
homeMcc(const QString & modemPath)210 QString QOfonoWrapper::homeMcc(const QString &modemPath)
211 {
212 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
213 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_SIM_MANAGER_INTERFACE(), QStringLiteral("GetProperties")));
214
215 return reply.value().value(QStringLiteral("MobileCountryCode")).toString();
216 }
217
homeMnc(const QString & modemPath)218 QString QOfonoWrapper::homeMnc(const QString &modemPath)
219 {
220 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
221 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_SIM_MANAGER_INTERFACE(), QStringLiteral("GetProperties")));
222
223 return reply.value().value(QStringLiteral("MobileNetworkCode")).toString();
224 }
225
imsi(const QString & modemPath)226 QString QOfonoWrapper::imsi(const QString &modemPath)
227 {
228 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
229 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_SIM_MANAGER_INTERFACE(), QStringLiteral("GetProperties")));
230
231 return reply.value().value(QStringLiteral("SubscriberIdentity")).toString();
232 }
233
234 // Modem Interface
imei(const QString & modemPath)235 QString QOfonoWrapper::imei(const QString &modemPath)
236 {
237 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
238 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_MODEM_INTERFACE(), QStringLiteral("GetProperties")));
239
240 return reply.value().value(QStringLiteral("Serial")).toString();
241 }
242
connectNotify(const QMetaMethod & signal)243 void QOfonoWrapper::connectNotify(const QMetaMethod &signal)
244 {
245 static const QMetaMethod cellIdChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::cellIdChanged);
246 static const QMetaMethod currentCellDataTechnologyChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentCellDataTechnologyChanged);
247 static const QMetaMethod currentMobileCountryCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentMobileCountryCodeChanged);
248 static const QMetaMethod currentMobileNetworkCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentMobileNetworkCodeChanged);
249 static const QMetaMethod currentNetworkModeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentNetworkModeChanged);
250 static const QMetaMethod locationAreaCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::locationAreaCodeChanged);
251 static const QMetaMethod networkInterfaceCountChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkInterfaceCountChanged);
252 static const QMetaMethod networkNameChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkNameChanged);
253 static const QMetaMethod networkSignalStrengthChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkSignalStrengthChanged);
254 static const QMetaMethod networkStatusChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkStatusChanged);
255
256 if (signal == networkInterfaceCountChangedSignal) {
257 allModemPaths = getAllModems();
258 QDBusConnection::systemBus().connect(*OFONO_SERVICE(), *OFONO_MANAGER_PATH(), *OFONO_MANAGER_INTERFACE(),
259 QStringLiteral("ModemAdded"),
260 this, SLOT(onOfonoModemAdded(QDBusObjectPath)));
261 QDBusConnection::systemBus().connect(*OFONO_SERVICE(), *OFONO_MANAGER_PATH(), *OFONO_MANAGER_INTERFACE(),
262 QStringLiteral("ModemRemoved"),
263 this, SLOT(onOfonoModemRemoved(QDBusObjectPath)));
264 watchAllModems = true;
265 } else if (signal == currentMobileCountryCodeChangedSignal
266 || signal == currentMobileNetworkCodeChangedSignal
267 || signal == currentNetworkModeChangedSignal
268 || signal == cellIdChangedSignal
269 || signal == currentCellDataTechnologyChangedSignal
270 || signal == locationAreaCodeChangedSignal
271 || signal == networkNameChangedSignal
272 || signal == networkSignalStrengthChangedSignal
273 || signal == networkStatusChangedSignal) {
274 signalStrengths.clear();
275 currentCellDataTechnologies.clear();
276 networkStatuses.clear();
277 cellIds.clear();
278 currentMccs.clear();
279 currentMncs.clear();
280 lacs.clear();
281 operatorNames.clear();
282 QStringList modems = allModems();
283 foreach (const QString &modem, modems) {
284 signalStrengths[modem] = getSignalStrength(modem);
285 currentCellDataTechnologies[modem] = getCurrentCellDataTechnology(modem);
286 networkStatuses[modem] = getNetworkStatus(modem);
287 cellIds[modem] = getCellId(modem);
288 currentMccs[modem] = getCurrentMcc(modem);
289 currentMncs[modem] = getCurrentMnc(modem);
290 lacs[modem] = getLac(modem);
291 operatorNames[modem] = getOperatorName(modem);
292 QDBusConnection::systemBus().connect(*OFONO_SERVICE(),
293 modem,
294 *OFONO_NETWORK_REGISTRATION_INTERFACE(),
295 QStringLiteral("PropertyChanged"),
296 this, SLOT(onOfonoPropertyChanged(QString,QDBusVariant)));
297 }
298 watchProperties = true;
299 }
300 }
301
disconnectNotify(const QMetaMethod & signal)302 void QOfonoWrapper::disconnectNotify(const QMetaMethod &signal)
303 {
304 static const QMetaMethod cellIdChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::cellIdChanged);
305 static const QMetaMethod currentCellDataTechnologyChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentCellDataTechnologyChanged);
306 static const QMetaMethod currentMobileCountryCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentMobileCountryCodeChanged);
307 static const QMetaMethod currentMobileNetworkCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentMobileNetworkCodeChanged);
308 static const QMetaMethod currentNetworkModeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::currentNetworkModeChanged);
309 static const QMetaMethod locationAreaCodeChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::locationAreaCodeChanged);
310 static const QMetaMethod networkInterfaceCountChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkInterfaceCountChanged);
311 static const QMetaMethod networkNameChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkNameChanged);
312 static const QMetaMethod networkSignalStrengthChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkSignalStrengthChanged);
313 static const QMetaMethod networkStatusChangedSignal = QMetaMethod::fromSignal(&QOfonoWrapper::networkStatusChanged);
314
315 if (signal == networkInterfaceCountChangedSignal) {
316 QDBusConnection::systemBus().disconnect(*OFONO_SERVICE(), *OFONO_MANAGER_PATH(), *OFONO_MANAGER_INTERFACE(),
317 QStringLiteral("ModemAdded"),
318 this, SLOT(onOfonoModemAdded(QDBusObjectPath)));
319 QDBusConnection::systemBus().disconnect(*OFONO_SERVICE(), *OFONO_MANAGER_PATH(), *OFONO_MANAGER_INTERFACE(),
320 QStringLiteral("ModemRemoved"),
321 this, SLOT(onOfonoModemRemoved(QDBusObjectPath)));
322 watchAllModems = false;
323 } else if (signal == currentMobileCountryCodeChangedSignal
324 || signal == currentMobileNetworkCodeChangedSignal
325 || signal == currentNetworkModeChangedSignal
326 || signal == cellIdChangedSignal
327 || signal == currentCellDataTechnologyChangedSignal
328 || signal == locationAreaCodeChangedSignal
329 || signal == networkNameChangedSignal
330 || signal == networkSignalStrengthChangedSignal
331 || signal == networkStatusChangedSignal) {
332 QStringList modems = allModems();
333 foreach (const QString &modem, modems) {
334 QDBusConnection::systemBus().disconnect(*OFONO_SERVICE(),
335 modem,
336 *OFONO_NETWORK_REGISTRATION_INTERFACE(),
337 QStringLiteral("PropertyChanged"),
338 this, SLOT(onOfonoPropertyChanged(QString,QDBusVariant)));
339 }
340 }
341 }
342
onOfonoModemAdded(const QDBusObjectPath & path)343 void QOfonoWrapper::onOfonoModemAdded(const QDBusObjectPath &path)
344 {
345 allModemPaths.append(path.path());
346 emit networkInterfaceCountChanged(QNetworkInfo::GsmMode, allModemPaths.size());
347 emit networkInterfaceCountChanged(QNetworkInfo::CdmaMode, allModemPaths.size());
348 emit networkInterfaceCountChanged(QNetworkInfo::WcdmaMode, allModemPaths.size());
349 emit networkInterfaceCountChanged(QNetworkInfo::LteMode, allModemPaths.size());
350 }
351
onOfonoModemRemoved(const QDBusObjectPath & path)352 void QOfonoWrapper::onOfonoModemRemoved(const QDBusObjectPath &path)
353 {
354 allModemPaths.removeOne(path.path());
355 emit networkInterfaceCountChanged(QNetworkInfo::GsmMode, allModemPaths.size());
356 emit networkInterfaceCountChanged(QNetworkInfo::CdmaMode, allModemPaths.size());
357 emit networkInterfaceCountChanged(QNetworkInfo::WcdmaMode, allModemPaths.size());
358 emit networkInterfaceCountChanged(QNetworkInfo::LteMode, allModemPaths.size());
359 }
360
onOfonoPropertyChanged(const QString & property,const QDBusVariant & value)361 void QOfonoWrapper::onOfonoPropertyChanged(const QString &property, const QDBusVariant &value)
362 {
363 if (!calledFromDBus())
364 return;
365
366 int interface = allModems().indexOf(message().path());
367
368 if (property == QStringLiteral("MobileCountryCode"))
369 emit currentMobileCountryCodeChanged(interface, value.variant().toString());
370 else if (property == QStringLiteral("MobileNetworkCode"))
371 emit currentMobileNetworkCodeChanged(interface, value.variant().toString());
372 else if (property == QStringLiteral("CellId"))
373 emit cellIdChanged(interface, value.variant().toString());
374 else if (property == QStringLiteral("Technology"))
375 emit currentCellDataTechnologyChanged(interface, technologyStringToEnum(value.variant().toString()));
376 else if (property == QStringLiteral("LocationAreaCode"))
377 emit locationAreaCodeChanged(interface, value.variant().toString());
378 else if (property == QStringLiteral("Name"))
379 emit networkNameChanged(technologyToMode(currentTechnology(message().path())), interface, value.variant().toString());
380 else if (property == QStringLiteral("Strength"))
381 emit networkSignalStrengthChanged(technologyToMode(currentTechnology(message().path())), interface, value.variant().toInt());
382 else if (property == QStringLiteral("Status"))
383 emit networkStatusChanged(technologyToMode(currentTechnology(message().path())), interface, statusStringToEnum(value.variant().toString()));
384 }
385
technologyStringToEnum(const QString & technology)386 QNetworkInfo::CellDataTechnology QOfonoWrapper::technologyStringToEnum(const QString &technology)
387 {
388 if (technology == QStringLiteral("edge"))
389 return QNetworkInfo::EdgeDataTechnology;
390 else if (technology == QStringLiteral("umts"))
391 return QNetworkInfo::UmtsDataTechnology;
392 else if (technology == QStringLiteral("hspa"))
393 return QNetworkInfo::HspaDataTechnology;
394 else
395 return QNetworkInfo::UnknownDataTechnology;
396 }
397
technologyToMode(const QString & technology)398 QNetworkInfo::NetworkMode QOfonoWrapper::technologyToMode(const QString &technology)
399 {
400 if (technology == QStringLiteral("lte")) {
401 return QNetworkInfo::LteMode;
402 } else if (technology == QStringLiteral("hspa")) {
403 return QNetworkInfo::WcdmaMode;
404 } else if (technology == QStringLiteral("gsm")
405 || technology == QStringLiteral("edge")
406 || technology == QStringLiteral("umts")) {
407 return QNetworkInfo::GsmMode;
408 } else {
409 return QNetworkInfo::CdmaMode;
410 }
411 }
412
statusStringToEnum(const QString & status)413 QNetworkInfo::NetworkStatus QOfonoWrapper::statusStringToEnum(const QString &status)
414 {
415 if (status == QStringLiteral("unregistered"))
416 return QNetworkInfo::NoNetworkAvailable;
417 else if (status == QStringLiteral("registered"))
418 return QNetworkInfo::HomeNetwork;
419 else if (status == QStringLiteral("searching"))
420 return QNetworkInfo::Searching;
421 else if (status == QStringLiteral("denied"))
422 return QNetworkInfo::Denied;
423 else if (status == QStringLiteral("roaming"))
424 return QNetworkInfo::Roaming;
425 else
426 return QNetworkInfo::UnknownStatus;
427 }
428
currentTechnology(const QString & modemPath)429 QString QOfonoWrapper::currentTechnology(const QString &modemPath)
430 {
431 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
432 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
433
434 return reply.value().value(QStringLiteral("Technology")).toString();
435 }
436
437 // Manager Interface
getAllModems()438 QStringList QOfonoWrapper::getAllModems()
439 {
440 QDBusReply<QOfonoPropertyMap> reply = QDBusConnection::systemBus().call(
441 QDBusMessage::createMethodCall(*OFONO_SERVICE(), *OFONO_MANAGER_PATH(), *OFONO_MANAGER_INTERFACE(), QStringLiteral("GetModems")));
442
443 QStringList modems;
444 if (reply.isValid()) {
445 foreach (const QOfonoProperty &property, reply.value())
446 modems << property.path.path();
447 }
448 return modems;
449 }
450
451 // Network Registration Interface
getSignalStrength(const QString & modemPath)452 int QOfonoWrapper::getSignalStrength(const QString &modemPath)
453 {
454 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
455 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
456
457 return reply.value().value(QStringLiteral("Strength")).toInt();
458 }
459
getCurrentCellDataTechnology(const QString & modemPath)460 QNetworkInfo::CellDataTechnology QOfonoWrapper::getCurrentCellDataTechnology(const QString &modemPath)
461 {
462 return technologyStringToEnum(currentTechnology(modemPath));
463 }
464
getNetworkStatus(const QString & modemPath)465 QNetworkInfo::NetworkStatus QOfonoWrapper::getNetworkStatus(const QString &modemPath)
466 {
467 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
468 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
469
470 return statusStringToEnum(reply.value().value(QStringLiteral("Status")).toString());
471 }
472
getCellId(const QString & modemPath)473 QString QOfonoWrapper::getCellId(const QString &modemPath)
474 {
475 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
476 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
477
478 return reply.value().value(QStringLiteral("CellId")).toString();
479 }
480
getCurrentMcc(const QString & modemPath)481 QString QOfonoWrapper::getCurrentMcc(const QString &modemPath)
482 {
483 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
484 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
485
486 return reply.value().value(QStringLiteral("MobileCountryCode")).toString();
487 }
488
getCurrentMnc(const QString & modemPath)489 QString QOfonoWrapper::getCurrentMnc(const QString &modemPath)
490 {
491 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
492 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
493
494 return reply.value().value(QStringLiteral("MobileNetworkCode")).toString();
495 }
496
getLac(const QString & modemPath)497 QString QOfonoWrapper::getLac(const QString &modemPath)
498 {
499 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
500 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
501
502 return reply.value().value(QStringLiteral("LocationAreaCode")).toString();
503 }
504
getOperatorName(const QString & modemPath)505 QString QOfonoWrapper::getOperatorName(const QString &modemPath)
506 {
507 QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(
508 QDBusMessage::createMethodCall(*OFONO_SERVICE(), modemPath, *OFONO_NETWORK_REGISTRATION_INTERFACE(), QStringLiteral("GetProperties")));
509
510 return reply.value().value(QStringLiteral("Name")).toString();
511 }
512
513 QT_END_NAMESPACE
514
515 #endif // QT_NO_OFONO
516