From 74a1d215b3411cb017f592ce302c1d28e58714a9 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 24 Nov 2015 11:59:15 +0200 Subject: [PATCH] [ssu] Return constant IMEI list that isn't dependent on active modems. Contributes to JB#33484 --- doc/src/rndssu_clientprotocol.dox | 2 +- libssu/ssudeviceinfo.cpp | 31 ++++++------------------------- libssu/ssudeviceinfo.h | 3 +-- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/doc/src/rndssu_clientprotocol.dox b/doc/src/rndssu_clientprotocol.dox index 741f6a5..e820db1 100644 --- a/doc/src/rndssu_clientprotocol.dox +++ b/doc/src/rndssu_clientprotocol.dox @@ -4,7 +4,7 @@ This page contains the protocol definition used between a ssu client on a device and a ssu server. The client-side of this protocol is implemented in libssu and the ssu CLI. The server side heavily depends on the available infrastructure, and is not available in public. See \ref rndssu_implementation_notes "the implementation notes for RnD ssu" for additional details required to implement a ssu server. -$DEVICEID in the following examples is a variable filled by the ssu client before making the request, replaced by the devices IMEI (QSystemDeviceInfo::imei()), or a unique device ID (QSystemDeviceInfo::uniqueDeviceID()), if the IMEI is not available (netbooks, SDK, ...) +$DEVICEID in the following examples is a variable filled by the ssu client before making the request, replaced by the devices IMEI (from oFono ModemManager API), or WLAN mac address or device uid fallback code similar to QDeviceInfo::uniqueDeviceID(), if the IMEI is not available (netbooks, SDK, ...) @section registration Device registration diff --git a/libssu/ssudeviceinfo.cpp b/libssu/ssudeviceinfo.cpp index 201161c..311d5a0 100644 --- a/libssu/ssudeviceinfo.cpp +++ b/libssu/ssudeviceinfo.cpp @@ -251,31 +251,12 @@ ofonoGetImeis() QStringList result; QDBusMessage reply = QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall("org.ofono", "/", - "org.ofono.Manager", "GetModems")); - - foreach (const QVariant &v, reply.arguments()) { - if (v.canConvert()) { - const QDBusArgument arg = v.value(); - if (arg.currentType() == QDBusArgument::ArrayType) { - arg.beginArray(); - while (!arg.atEnd()) { - if (arg.currentType() == QDBusArgument::StructureType) { - QString path; - QVariantMap props; - - arg.beginStructure(); - arg >> path >> props; - arg.endStructure(); - - if (props.contains("Serial")) { - result << props["Serial"].toString(); - } - } - } - arg.endArray(); - } - } + QDBusMessage::createMethodCall("org.ofono", "/", + "org.nemomobile.ofono.ModemManager", "GetIMEI")); + + QList arguments = reply.arguments(); + if (arguments.count() > 0) { + result = arguments.at(0).toStringList(); } return result; diff --git a/libssu/ssudeviceinfo.h b/libssu/ssudeviceinfo.h index d5c0c71..77039de 100644 --- a/libssu/ssudeviceinfo.h +++ b/libssu/ssudeviceinfo.h @@ -55,8 +55,7 @@ class SsuDeviceInfo: public QObject { Q_INVOKABLE QString deviceModel(); /** * Calculate the device ID used in ssu requests - * @return QSystemDeviceInfo::imei(), if available, or QNetworkInfo::macAddress(QNetworkInfo::WlanMode, 0), - * if available, or QSystemDeviceInfo::uniqueDeviceID() + * @return The first imei from oFono ModemManager API, if available, or WLAN mac address, or device uid fallback code similar to QDeviceInfo::uniqueDeviceID() */ Q_INVOKABLE QString deviceUid(); /**