[-]
[+]
|
Changed |
_service:tar_git:libqofonoext.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://git.merproject.org/mer-core/libqofonoext.git</param>
<param name="branch">master</param>
- <param name="revision">6bbcc957fb44008fcad81c6f2606033e14c44f31</param>
+ <param name="revision">HEAD</param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/plugin.pro
^
|
@@ -1,11 +1,12 @@
TARGET=qofonoextdeclarative
TEMPLATE = lib
-CONFIG += plugin
+CONFIG += plugin link_pkgconfig
+PKGCONFIG += qofono-qt5
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
QT_VERSION=$$[QT_VERSION]
-QT += qml
+QT += qml dbus
QT -= gui
LIBS += -L../src -lqofonoext
@@ -13,11 +14,13 @@
SOURCES = \
qofonoextdeclarativeplugin.cpp \
- qofonoextmodemlistmodel.cpp
+ qofonoextmodemlistmodel.cpp \
+ qofonoextsimlistmodel.cpp
HEADERS = \
qofonoextdeclarativeplugin.h \
- qofonoextmodemlistmodel.h
+ qofonoextmodemlistmodel.h \
+ qofonoextsimlistmodel.h
OTHER_FILES += qmldir
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextdeclarativeplugin.cpp
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monichi@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -16,7 +16,11 @@
#include "qofonoextdeclarativeplugin.h"
#include "qofonoextmodemlistmodel.h"
#include "qofonoextmodemmanager.h"
-#include "qofonoextsimsettings.h"
+#include "qofonoextsiminfo.h"
+#include "qofonoextsimlistmodel.h"
+#include "qofonoextmodemlistmodel.h"
+#include "qofonoextcellinfo.h"
+#include "qofonoextcell.h"
#include <QtQml>
@@ -25,7 +29,10 @@
Q_ASSERT(QLatin1String(aUri) == "org.nemomobile.ofono");
qmlRegisterType<QOfonoExtModemManager>(aUri, aMajor, aMinor, "OfonoModemManager");
qmlRegisterType<QOfonoExtModemListModel>(aUri, aMajor, aMinor, "OfonoModemListModel");
- qmlRegisterType<QOfonoExtSimSettings>(aUri, aMajor, aMinor, "OfonoSimSettings");
+ qmlRegisterType<QOfonoExtSimInfo>(aUri, aMajor, aMinor, "OfonoSimInfo");
+ qmlRegisterType<QOfonoExtSimListModel>(aUri, aMajor, aMinor, "OfonoExtSimListModel");
+ qmlRegisterType<QOfonoExtCellInfo>(aUri, aMajor, aMinor, "OfonoExtCellInfo");
+ qmlRegisterType<QOfonoExtCell>(aUri, aMajor, aMinor, "OfonoExtCell");
}
void QOfonoExtDeclarativePlugin::registerTypes(const char* aUri)
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextdeclarativeplugin.h
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monichi@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextmodemlistmodel.cpp
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monichi@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextmodemlistmodel.h
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monichi@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextsimlistmodel.cpp
^
|
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: slava.monich@jolla.com
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoextsimlistmodel.h"
+#include <QQmlEngine>
+
+class QOfonoExtSimListModel::SimData : public QObject {
+public:
+ friend class QOfonoExtSimListModel;
+ Q_OBJECT
+
+ SimData(QOfonoExtSimListModel* aParent,
+ QOfonoSimManager::SharedPointer aSimManager,
+ int aIndex = -1);
+
+private Q_SLOTS:
+ void onValidChanged();
+ void onPresentSimListChanged();
+ void onSubscriberIdentityChanged();
+ void onMobileCountryCodeChanged();
+ void onMobileNetworkCodeChanged();
+ void onServiceProviderNameChanged();
+ void onSubscriberNumbersChanged();
+ void onServiceNumbersChanged();
+ void onPinRequiredChanged();
+ void onLockedPinsChanged();
+ void onCardIdentifierChanged();
+ void onPreferredLanguagesChanged();
+ void onPinRetriesChanged();
+ void onFixedDialingChanged();
+ void onBarredDialingChanged();
+
+private:
+ void propertyChanged(Role role);
+
+public:
+ QOfonoExtSimListModel* iParent;
+ QOfonoSimManager::SharedPointer iSim;
+ QOfonoExtSimInfo* iCache;
+ int iIndex;
+};
+
+QOfonoExtSimListModel::SimData::SimData(QOfonoExtSimListModel* aParent,
+ QOfonoSimManager::SharedPointer aSimManager, int aIndex) :
+ QObject(aParent),
+ iParent(aParent),
+ iSim(aSimManager),
+ iCache(new QOfonoExtSimInfo(this)),
+ iIndex(aIndex)
+{
+ QOfonoSimManager* sim = iSim.data();
+ QQmlEngine::setObjectOwnership(iCache, QQmlEngine::CppOwnership);
+ iCache->setModemPath(sim->modemPath());
+ connect(iCache,
+ SIGNAL(validChanged(bool)),
+ SLOT(onValidChanged()));
+ connect(iCache,
+ SIGNAL(subscriberIdentityChanged(QString)),
+ SLOT(onSubscriberIdentityChanged()));
+ connect(iCache,
+ SIGNAL(serviceProviderNameChanged(QString)),
+ SLOT(onServiceProviderNameChanged()));
+ iParent->connect(iCache,
+ SIGNAL(validChanged(bool)),
+ SLOT(onValidChanged()));
+
+ connect(sim,
+ SIGNAL(mobileCountryCodeChanged(QString)),
+ SLOT(onMobileCountryCodeChanged()));
+ connect(sim,
+ SIGNAL(mobileNetworkCodeChanged(QString)),
+ SLOT(onMobileNetworkCodeChanged()));
+ connect(sim,
+ SIGNAL(subscriberNumbersChanged(QStringList)),
+ SLOT(onSubscriberNumbersChanged()));
+ connect(sim,
+ SIGNAL(serviceNumbersChanged(QVariantMap)),
+ SLOT(onServiceNumbersChanged()));
+ connect(sim,
+ SIGNAL(pinRequiredChanged(int)),
+ SLOT(onPinRequiredChanged()));
+ connect(sim,
+ SIGNAL(lockedPinsChanged(QVariantList)),
+ SLOT(onLockedPinsChanged()));
+ connect(sim,
+ SIGNAL(cardIdentifierChanged(QString)),
+ SLOT(onCardIdentifierChanged()));
+ connect(sim,
+ SIGNAL(preferredLanguagesChanged(QStringList)),
+ SLOT(onPreferredLanguagesChanged()));
+ connect(sim,
+ SIGNAL(pinRetriesChanged(QVariantMap)),
+ SLOT(onPinRetriesChanged()));
+ connect(sim,
+ SIGNAL(fixedDialingChanged(bool)),
+ SLOT(onFixedDialingChanged()));
+ connect(sim,
+ SIGNAL(barredDialingChanged(bool)),
+ SLOT(onBarredDialingChanged()));
+}
+
+void QOfonoExtSimListModel::SimData::propertyChanged(Role role)
+{
+ if (iIndex >= 0) {
+ QModelIndex modelIndex = iParent->index(iIndex);
+ QVector<int> roles;
+ roles.append(role);
+ Q_EMIT iParent->dataChanged(modelIndex, modelIndex, roles);
+ }
+}
+
+void QOfonoExtSimListModel::SimData::onValidChanged()
+{
+ propertyChanged(ValidRole);
+}
+
+void QOfonoExtSimListModel::SimData::onSubscriberIdentityChanged()
+{
+ propertyChanged(SubscriberIdentityRole);
+}
+
+void QOfonoExtSimListModel::SimData::onMobileCountryCodeChanged()
+{
+ propertyChanged(MobileCountryCodeRole);
+}
+
+void QOfonoExtSimListModel::SimData::onMobileNetworkCodeChanged()
+{
+ propertyChanged(MobileNetworkCodeRole);
+}
+
+void QOfonoExtSimListModel::SimData::onServiceProviderNameChanged()
+{
+ propertyChanged(ServiceProviderNameRole);
+}
+
+void QOfonoExtSimListModel::SimData::onSubscriberNumbersChanged()
+{
+ propertyChanged(SubscriberNumbersRole);
+}
+
+void QOfonoExtSimListModel::SimData::onServiceNumbersChanged()
+{
+ propertyChanged(ServiceNumbersRole);
+}
+
+void QOfonoExtSimListModel::SimData::onPinRequiredChanged()
+{
+ propertyChanged(PinRequiredRole);
+}
+
+void QOfonoExtSimListModel::SimData::onLockedPinsChanged()
+{
+ propertyChanged(LockedPinsRole);
+}
+
+void QOfonoExtSimListModel::SimData::onCardIdentifierChanged()
+{
+ propertyChanged(CardIdentifierRole);
+}
+
+void QOfonoExtSimListModel::SimData::onPreferredLanguagesChanged()
+{
+ propertyChanged(PreferredLanguagesRole);
+}
+
+void QOfonoExtSimListModel::SimData::onPinRetriesChanged()
+{
+ propertyChanged(PinRetriesRole);
+}
+
+void QOfonoExtSimListModel::SimData::onFixedDialingChanged()
+{
+ propertyChanged(FixedDialingRole);
+}
+
+void QOfonoExtSimListModel::SimData::onBarredDialingChanged()
+{
+ propertyChanged(BarredDialingRole);
+}
+
+// ==========================================================================
+// QOfonoExtSimListModel
+// ==========================================================================
+
+QOfonoExtSimListModel::QOfonoExtSimListModel(QObject *aParent) :
+ QAbstractListModel(aParent),
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/plugin/qofonoextsimlistmodel.h
^
|
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: slava.monich@jolla.com
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#ifndef QOFONOEXTSIMLISTMODEL_H
+#define QOFONOEXTSIMLISTMODEL_H
+
+#include "qofonosimwatcher.h"
+#include "qofonoextsiminfo.h"
+
+class QOfonoExtSimListModel : public QAbstractListModel {
+ Q_OBJECT
+ Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+
+public:
+ enum Role {
+ PathRole = Qt::UserRole + 1,
+ ValidRole,
+ SubscriberIdentityRole,
+ MobileCountryCodeRole,
+ MobileNetworkCodeRole,
+ ServiceProviderNameRole,
+ SubscriberNumbersRole,
+ ServiceNumbersRole,
+ PinRequiredRole,
+ LockedPinsRole,
+ CardIdentifierRole,
+ PreferredLanguagesRole,
+ PinRetriesRole,
+ FixedDialingRole,
+ BarredDialingRole
+ };
+
+ explicit QOfonoExtSimListModel(QObject* aParent = NULL);
+
+ bool valid() const;
+ int count() const;
+
+protected:
+ QHash<int,QByteArray> roleNames() const;
+ int rowCount(const QModelIndex& aParent) const;
+ QVariant data(const QModelIndex& aIndex, int aRole) const;
+
+Q_SIGNALS:
+ void validChanged();
+ void countChanged();
+ void simAdded(QOfonoExtSimInfo* sim);
+ void simRemoved(QString path);
+
+private Q_SLOTS:
+ void onPresentSimListChanged();
+ void onValidChanged();
+
+private:
+ bool isValid() const;
+
+private:
+ class SimData;
+ QOfonoSimWatcher* iSimWatcher;
+ QList<SimData*> iSimList;
+ bool iValid;
+};
+
+#endif // QOFONOEXTSIMLISTMODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/dbus/org.nemomobile.ofono.Cell.xml
^
|
@@ -0,0 +1,34 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.nemomobile.ofono.Cell">
+ <method name="GetAll">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="type" type="s" direction="out"/>
+ <arg name="registered" type="b" direction="out"/>
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out3" value="QVariantMap"/>
+ </method>
+ <method name="GetInterfaceVersion">
+ <arg name="version" type="i" direction="out"/>
+ </method>
+ <method name="GetType">
+ <arg name="type" type="s" direction="out"/>
+ </method>
+ <method name="GetRegistered">
+ <arg name="registered" type="b" direction="out"/>
+ </method>
+ <method name="GetProperties">
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ </method>
+ <signal name="RegisteredChanged">
+ <arg name="registered" type="b"/>
+ </signal>
+ <signal name="PropertyChanged">
+ <arg name="name" type="s"/>
+ <arg name="value" type="v"/>
+ </signal>
+ <signal name="Removed"/>
+ </interface>
+</node>
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/dbus/org.nemomobile.ofono.CellInfo.xml
^
|
@@ -0,0 +1,15 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.nemomobile.ofono.CellInfo">
+ <method name="GetCells">
+ <arg name="paths" type="ao" direction="out"/>
+ </method>
+ <signal name="CellsAdded">
+ <arg name="paths" type="ao"/>
+ </signal>
+ <signal name="CellsRemoved">
+ <arg name="paths" type="ao"/>
+ </signal>
+ </interface>
+</node>
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/dbus/org.nemomobile.ofono.ModemManager.xml
^
|
@@ -26,6 +26,14 @@
<arg name="version" type="i" direction="out"/>
<arg name="otherValues" type="aoaossssabas" direction="out"/>
</method>
+ <method name="GetAll4">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="otherValues" type="aoaossssabasss" direction="out"/>
+ </method>
+ <method name="GetAll5">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="otherValues" type="aoaossssabasssb" direction="out"/>
+ </method>
<method name="GetInterfaceVersion">
<arg name="version" type="i" direction="out"/>
</method>
@@ -48,12 +56,21 @@
<method name="GetDefaultVoiceSim">
<arg name="imsi" type="s" direction="out"/>
</method>
+ <method name="GetMmsSim">
+ <arg name="imsi" type="s" direction="out"/>
+ </method>
<method name="GetDefaultDataModem">
<arg name="path" type="s" direction="out"/>
</method>
<method name="GetDefaultVoiceModem">
<arg name="path" type="s" direction="out"/>
</method>
+ <method name="GetMmsModem">
+ <arg name="path" type="s" direction="out"/>
+ </method>
+ <method name="GetReady">
+ <arg name="ready" type="b" direction="out"/>
+ </method>
<method name="SetEnabledModems">
<arg name="modems" type="ao" direction="in"/>
</method>
@@ -82,5 +99,14 @@
<signal name="DefaultVoiceModemChanged">
<arg name="path" type="s"/>
</signal>
+ <signal name="MmsSimChanged">
+ <arg name="imsi" type="s"/>
+ </signal>
+ <signal name="MmsModemChanged">
+ <arg name="path" type="s"/>
+ </signal>
+ <signal name="ReadyChanged">
+ <arg name="ready" type="b"/>
+ </signal>
</interface>
</node>
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/dbus/org.nemomobile.ofono.SimInfo.xml
^
|
@@ -0,0 +1,33 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.nemomobile.ofono.SimInfo">
+ <method name="GetAll">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="iccid" type="s" direction="out"/>
+ <arg name="imsi" type="s" direction="out"/>
+ <arg name="spn" type="s" direction="out"/>
+ </method>
+ <method name="GetInterfaceVersion">
+ <arg name="version" type="i" direction="out"/>
+ </method>
+ <method name="GetCardIdentifier">
+ <arg name="iccid" type="s" direction="out"/>
+ </method>
+ <method name="GetSubscriberIdentity">
+ <arg name="imsi" type="s" direction="out"/>
+ </method>
+ <method name="GetServiceProviderName">
+ <arg name="spn" type="s" direction="out"/>
+ </method>
+ <signal name="CardIdentifierChanged">
+ <arg name="iccid" type="s"/>
+ </signal>
+ <signal name="SubscriberIdentityChanged">
+ <arg name="imsi" type="s"/>
+ </signal>
+ <signal name="ServiceProviderNameChanged">
+ <arg name="spn" type="s"/>
+ </signal>
+ </interface>
+</node>
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoext.cpp
^
|
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoext_p.h"
+
+bool QOfonoExt::isTimeout(QDBusError aError)
+{
+ switch (aError.type()) {
+ case QDBusError::NoReply:
+ case QDBusError::Timeout:
+ case QDBusError::TimedOut:
+ return true;
+ default:
+ return false;
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoext_p.h
^
|
@@ -25,4 +25,8 @@
typedef QList<bool> QOfonoExtBoolList;
+namespace QOfonoExt {
+ bool isTimeout(QDBusError aError);
+}
+
#endif // QOFONOEXT_PRIVATE_H
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcell.cpp
^
|
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoextcell.h"
+#include "qofonoextcellinfo.h"
+#include "qofonoext_p.h"
+
+#include "cell_interface.h"
+
+static const QString kTypeGsm("gsm");
+static const QString kTypeWcdma("wcdma");
+static const QString kTypeLte("lte");
+
+#define CELL_PROPERTIES(p) \
+ p(mcc) p(mnc) p(signalStrength) p(lac) p(cid) p(bitErrorRate) p(psc) \
+ p(ci) p(pci) p(tac) p(rsrp) p(rsrq) p(rssnr) p(cqi) p(timingAdvance)
+
+class QOfonoExtCell::Private : public QOfonoExtCellProxy
+{
+ Q_OBJECT
+
+public:
+ enum Property {
+ PropertyUnknown = -1,
+ #define Property_(x) Property_##x,
+ CELL_PROPERTIES(Property_)
+ PropertyCount
+ };
+
+ struct PropertyDesc {
+ QString name;
+ void (QOfonoExtCell::*signal)();
+ };
+
+ static const PropertyDesc Properties[PropertyCount];
+
+ Private(QString aPath, QOfonoExtCell* aParent);
+ static int value(Private* aThis, Property aProperty);
+ static Type typeFromString(QString aType);
+ static Property propertyFromString(QString aProperty);
+
+private:
+ void getAll();
+
+private Q_SLOTS:
+ void onCellsChanged();
+ void onGetAllFinished(QDBusPendingCallWatcher* aWatcher);
+ void onPropertyChanged(QString aName, QDBusVariant aValue);
+ void onRegisteredChanged(bool aRegistered);
+
+public:
+ bool iValid;
+ bool iFixedPath;
+ bool iRegistered;
+ int iProperties[PropertyCount];
+ QOfonoExtCell::Type iType;
+
+private:
+ QOfonoExtCell* iParent;
+ QDBusPendingCallWatcher* iPendingGetAll;
+ QSharedPointer<QOfonoExtCellInfo> iCellInfo;
+};
+
+const QOfonoExtCell::Private::PropertyDesc QOfonoExtCell::Private::Properties[] = {
+ #define PropertyDesc_(x) {QString(#x), &QOfonoExtCell::x##Changed},
+ CELL_PROPERTIES(PropertyDesc_)
+};
+
+QOfonoExtCell::Private::Private(QString aPath, QOfonoExtCell* aParent) :
+ QOfonoExtCellProxy(OFONO_SERVICE, aPath, OFONO_BUS, aParent),
+ iValid(false),
+ iFixedPath(false),
+ iRegistered(false),
+ iType(UNKNOWN),
+ iParent(aParent),
+ iPendingGetAll(NULL)
+{
+ // Extract modem path from the cell path, e.g. "/ril_0/cell_0" => "/ril_0"
+ iCellInfo = QOfonoExtCellInfo::instance(aPath.left(aPath.lastIndexOf('/')));
+ memset(iProperties, -1, sizeof(iProperties));
+ connect(this, SIGNAL(Removed()),
+ aParent, SIGNAL(removed()));
+ connect(this,
+ SIGNAL(PropertyChanged(QString,QDBusVariant)),
+ SLOT(onPropertyChanged(QString,QDBusVariant)));
+ connect(this,
+ SIGNAL(RegisteredChanged(bool)),
+ SLOT(onRegisteredChanged(bool)));
+ connect(iCellInfo.data(),
+ SIGNAL(cellsChanged()),
+ SLOT(onCellsChanged()));
+ connect(iCellInfo.data(),
+ SIGNAL(validChanged()),
+ SLOT(onCellsChanged()));
+ onCellsChanged();
+}
+
+QOfonoExtCell::Type QOfonoExtCell::Private::typeFromString(QString aType)
+{
+ return (aType == kTypeGsm) ? GSM :
+ (aType == kTypeLte) ? LTE :
+ (aType == kTypeWcdma) ? WCDMA :
+ UNKNOWN;
+}
+
+QOfonoExtCell::Private::Property QOfonoExtCell::Private::propertyFromString(QString aProperty)
+{
+ for (int i=PropertyUnknown+1; i<PropertyCount; i++) {
+ if (Properties[i].name == aProperty) {
+ return (Property)i;
+ }
+ }
+ return PropertyUnknown;
+}
+
+int QOfonoExtCell::Private::value(Private* aThis, QOfonoExtCell::Private::Property aProperty)
+{
+ return aThis ? aThis->iProperties[aProperty] : -1;
+}
+
+void QOfonoExtCell::Private::onCellsChanged()
+{
+ bool pathValid = iCellInfo->valid() && iCellInfo->cells().contains(path());
+ if (pathValid) {
+ if (!iValid && !iPendingGetAll) {
+ getAll();
+ }
+ } else {
+ if (iPendingGetAll) {
+ delete iPendingGetAll;
+ iPendingGetAll = NULL;
+ }
+ if (iValid) {
+ iValid = false;
+ Q_EMIT iParent->validChanged();
+ }
+ }
+}
+
+void QOfonoExtCell::Private::getAll()
+{
+ delete iPendingGetAll;
+ iPendingGetAll = new QDBusPendingCallWatcher(GetAll(), this);
+ connect(iPendingGetAll,
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
+}
+
+void QOfonoExtCell::Private::onGetAllFinished(QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply <
+ int, // 0. version
+ QString, // 1. type
+ bool, // 2. registered
+ QVariantMap> // 3. properties
+ reply(*aWatcher);
+ iPendingGetAll = NULL;
+ if (reply.isError()) {
+ // Repeat the call on timeout
+ qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getAll();
+ }
+ } else {
+ const bool wasRegistered = iRegistered;
+ const Type prevType = iType;
+ iType = typeFromString(reply.argumentAt<1>());
+ iRegistered = reply.argumentAt<2>();
+
+ // Unpack properties (they are all integers)
+ int prevProps[PropertyCount];
+ memcpy(prevProps, iProperties, sizeof(iProperties));
+ memset(iProperties, -1, sizeof(iProperties));
+ QVariantMap variants = reply.argumentAt<3>();
+ QStringList keys = variants.keys();
+ for (int i=0; i<keys.count(); i++) {
+ QString key = keys.at(i);
+ QVariant value = variants.value(key);
+ bool ok = false;
+ int intValue = value.toInt(&ok);
+ if (ok) {
+ Property p = propertyFromString(key);
+ if (p != PropertyUnknown) {
+ iProperties[p] = intValue;
+ }
+ }
+ }
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcell.h
^
|
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#ifndef QOFONOEXTCELL_H
+#define QOFONOEXTCELL_H
+
+#include "qofonoext_types.h"
+
+class QOFONOEXT_EXPORT QOfonoExtCell : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
+ Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
+ Q_PROPERTY(Type type READ type NOTIFY typeChanged)
+ Q_PROPERTY(bool registered READ registered NOTIFY registeredChanged)
+ Q_PROPERTY(int mcc READ mcc NOTIFY mccChanged)
+ Q_PROPERTY(int mnc READ mnc NOTIFY mncChanged)
+ Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged)
+ Q_PROPERTY(int lac READ lac NOTIFY lacChanged)
+ Q_PROPERTY(int cid READ cid NOTIFY cidChanged)
+ Q_PROPERTY(int bitErrorRate READ bitErrorRate NOTIFY bitErrorRateChanged)
+ Q_PROPERTY(int psc READ psc NOTIFY pscChanged)
+ Q_PROPERTY(int ci READ ci NOTIFY ciChanged)
+ Q_PROPERTY(int pci READ pci NOTIFY pciChanged)
+ Q_PROPERTY(int tac READ tac NOTIFY tacChanged)
+ Q_PROPERTY(int rsrp READ rsrp NOTIFY rsrpChanged)
+ Q_PROPERTY(int rsrq READ rsrq NOTIFY rsrqChanged)
+ Q_PROPERTY(int rssnr READ rssnr NOTIFY rssnrChanged)
+ Q_PROPERTY(int cqi READ cqi NOTIFY cqiChanged)
+ Q_PROPERTY(int timingAdvance READ timingAdvance NOTIFY timingAdvanceChanged)
+ Q_ENUMS(Type)
+
+public:
+ enum Type {
+ UNKNOWN,
+ GSM,
+ WCDMA,
+ LTE
+ };
+
+ explicit QOfonoExtCell(QObject* aParent = NULL);
+ QOfonoExtCell(QString aPath);
+ ~QOfonoExtCell();
+
+ QString path() const;
+ void setPath(QString aPath);
+
+ bool valid() const;
+ Type type() const;
+ bool registered() const;
+
+ // All types:
+ int mcc() const;
+ int mnc() const;
+ int signalStrength() const;
+
+ // GSM and WCDMA:
+ int lac() const;
+ int cid() const;
+ int bitErrorRate() const;
+
+ // WCDMA:
+ int psc() const;
+
+ // LTE:
+ int ci() const;
+ int pci() const;
+ int tac() const;
+ int rsrp() const;
+ int rsrq() const;
+ int rssnr() const;
+ int cqi() const;
+ int timingAdvance() const;
+
+Q_SIGNALS:
+ void validChanged();
+ void pathChanged();
+ void typeChanged();
+ void registeredChanged();
+ void mccChanged();
+ void mncChanged();
+ void signalStrengthChanged();
+ void lacChanged();
+ void cidChanged();
+ void bitErrorRateChanged();
+ void pscChanged();
+ void ciChanged();
+ void pciChanged();
+ void tacChanged();
+ void rsrpChanged();
+ void rsrqChanged();
+ void rssnrChanged();
+ void cqiChanged();
+ void timingAdvanceChanged();
+ void propertyChanged(QString name, int value);
+ void removed();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // QOFONOEXTCELL_H
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcellinfo.cpp
^
|
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoextcellinfo.h"
+#include "qofonoext_p.h"
+
+#include "cellinfo_interface.h"
+
+#include <qofonomodem.h>
+
+typedef QMap<QString,QWeakPointer<QOfonoExtCellInfo> > QOfonoExtCellInfoMap;
+Q_GLOBAL_STATIC(QOfonoExtCellInfoMap, sharedInstances)
+
+class QOfonoExtCellInfo::Private : public QObject
+{
+ Q_OBJECT
+
+public:
+ Private(QOfonoExtCellInfo* aParent);
+ QString modemPath() const;
+ void setModemPath(QString aPath);
+
+private:
+ void getCells();
+ void invalidate();
+
+private Q_SLOTS:
+ void checkInterfacePresence();
+ void onGetCellsFinished(QDBusPendingCallWatcher* aWatcher);
+ void onCellsAdded(QList<QDBusObjectPath> aCells);
+ void onCellsRemoved(QList<QDBusObjectPath> aCells);
+
+public:
+ bool iValid;
+ bool iFixedPath;
+ QStringList iCells;
+
+private:
+ QOfonoExtCellInfo* iParent;
+ QOfonoExtCellInfoProxy* iProxy;
+ QSharedPointer<QOfonoModem> iModem;
+ QString iInterfaceName;
+};
+
+QOfonoExtCellInfo::Private::Private(QOfonoExtCellInfo* aParent) :
+ QObject(aParent),
+ iValid(false),
+ iFixedPath(false),
+ iParent(aParent),
+ iProxy(NULL),
+ iInterfaceName(QOfonoExtCellInfoProxy::staticInterfaceName())
+{
+}
+
+QString QOfonoExtCellInfo::Private::modemPath() const
+{
+ return iModem.isNull() ? QString() : iModem->objectPath();
+}
+
+void QOfonoExtCellInfo::Private::setModemPath(QString aPath)
+{
+ // Caller has checked the the path has actually changed
+ invalidate();
+ if (aPath.isEmpty()) {
+ iModem.clear();
+ } else {
+ if (iModem) iModem->disconnect(this);
+ iModem = QOfonoModem::instance(aPath);
+ connect(iModem.data(),
+ SIGNAL(validChanged(bool)),
+ SLOT(checkInterfacePresence()));
+ connect(iModem.data(),
+ SIGNAL(interfacesChanged(QStringList)),
+ SLOT(checkInterfacePresence()));
+ checkInterfacePresence();
+ }
+}
+
+void QOfonoExtCellInfo::Private::getCells()
+{
+ connect(new QDBusPendingCallWatcher(iProxy->GetCells(), iProxy),
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetCellsFinished(QDBusPendingCallWatcher*)));
+}
+
+void QOfonoExtCellInfo::Private::checkInterfacePresence()
+{
+ if (iModem && iModem->isValid() &&
+ iModem->interfaces().contains(iInterfaceName)) {
+ if (!iProxy) {
+ iProxy = new QOfonoExtCellInfoProxy(OFONO_SERVICE, iModem->objectPath(), OFONO_BUS, this);
+ if (iProxy->isValid()) {
+ connect(iProxy,
+ SIGNAL(CellsAdded(QList<QDBusObjectPath>)),
+ SLOT(onCellsAdded(QList<QDBusObjectPath>)));
+ connect(iProxy,
+ SIGNAL(CellsRemoved(QList<QDBusObjectPath>)),
+ SLOT(onCellsRemoved(QList<QDBusObjectPath>)));
+ getCells();
+ } else {
+ invalidate();
+ }
+ }
+ } else {
+ invalidate();
+ }
+}
+
+void QOfonoExtCellInfo::Private::invalidate()
+{
+ if (iProxy) {
+ delete iProxy;
+ iProxy = NULL;
+ }
+ if (iValid) {
+ iValid = false;
+ Q_EMIT iParent->validChanged();
+ }
+}
+
+void QOfonoExtCellInfo::Private::onGetCellsFinished(QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QList<QDBusObjectPath> > reply(*aWatcher);
+ if (reply.isError()) {
+ // Repeat the call on timeout
+ qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getCells();
+ }
+ } else {
+ QList<QDBusObjectPath> pathList = reply.value();
+ QStringList list;
+ for (int i=0; i<pathList.count(); i++) {
+ list.append(pathList.at(i).path());
+ }
+ list.sort();
+ if (iCells != list) {
+ iCells = list;
+ Q_EMIT iParent->cellsChanged();
+ }
+ if (!iValid) {
+ iValid = true;
+ Q_EMIT iParent->validChanged();
+ }
+ }
+ aWatcher->deleteLater();
+}
+
+void QOfonoExtCellInfo::Private::onCellsAdded(QList<QDBusObjectPath> aCells)
+{
+ QStringList cells;
+ for (int i=0; i<aCells.count(); i++) {
+ QString path = aCells.at(i).path();
+ if (!iCells.contains(path)) {
+ iCells.append(path);
+ cells.append(path);
+ }
+ }
+ if (!cells.isEmpty()) {
+ iCells.sort();
+ Q_EMIT iParent->cellsAdded(cells);
+ Q_EMIT iParent->cellsChanged();
+ }
+}
+
+void QOfonoExtCellInfo::Private::onCellsRemoved(QList<QDBusObjectPath> aCells)
+{
+ QStringList cells;
+ for (int i=0; i<aCells.count(); i++) {
+ QString path = aCells.at(i).path();
+ if (iCells.removeOne(path)) {
+ cells.append(path);
+ }
+ }
+ if (!cells.isEmpty()) {
+ Q_EMIT iParent->cellsRemoved(cells);
+ Q_EMIT iParent->cellsChanged();
+ }
+}
+
+// ==========================================================================
+// QOfonoExtCellInfo
+// ==========================================================================
+
+QOfonoExtCellInfo::QOfonoExtCellInfo(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcellinfo.h
^
|
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#ifndef QOFONOEXTCELLINFO_H
+#define QOFONOEXTCELLINFO_H
+
+#include "qofonoext_types.h"
+
+class QOFONOEXT_EXPORT QOfonoExtCellInfo : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString modemPath READ modemPath WRITE setModemPath NOTIFY modemPathChanged)
+ Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
+ Q_PROPERTY(QStringList cells READ cells NOTIFY cellsChanged)
+
+public:
+ explicit QOfonoExtCellInfo(QObject* aParent = NULL);
+ ~QOfonoExtCellInfo();
+
+ // Shared instance(s) for C++ use
+ static QSharedPointer<QOfonoExtCellInfo> instance(QString aModemPath);
+
+ QString modemPath() const;
+ void setModemPath(QString aModemPath);
+
+ bool valid() const;
+ QStringList cells() const;
+
+Q_SIGNALS:
+ void validChanged();
+ void modemPathChanged();
+ void cellsChanged();
+ void cellsAdded(QStringList cells);
+ void cellsRemoved(QStringList cells);
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // QOFONOEXTCELLINFO_H
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcellwatcher.cpp
^
|
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoextcellwatcher.h"
+#include "qofonoextcellinfo.h"
+#include "qofonomanager.h"
+
+class QOfonoExtCellWatcher::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(QOfonoExtCellWatcher* aParent);
+
+ QOfonoExtCellWatcher* iParent;
+ QSharedPointer<QOfonoManager> iOfonoManager;
+ QList<QSharedPointer<QOfonoExtCellInfo> > iCellInfoList;
+ QList<QSharedPointer<QOfonoExtCell> > iValidCells;
+ QMap<QString, QSharedPointer<QOfonoExtCell> > iKnownCells;
+
+private:
+ void updateCellInfo();
+ QStringList updateKnownCells();
+
+public Q_SLOTS:
+ void updateValidCells();
+};
+
+QOfonoExtCellWatcher::Private::Private(QOfonoExtCellWatcher* aParent) :
+ QObject(aParent),
+ iParent(aParent),
+ iOfonoManager(QOfonoManager::instance())
+{
+ connect(iOfonoManager.data(),
+ SIGNAL(availableChanged(bool)),
+ SLOT(updateValidCells()));
+ connect(iOfonoManager.data(),
+ SIGNAL(modemsChanged(QStringList)),
+ SLOT(updateValidCells()));
+ updateValidCells();
+}
+
+void QOfonoExtCellWatcher::Private::updateCellInfo()
+{
+ int i;
+ QStringList modems;
+ if (iOfonoManager->available()) {
+ modems = iOfonoManager->modems();
+ }
+ modems.sort();
+ bool changed = true;
+ if (modems.count() == iCellInfoList.count()) {
+ changed = false;
+ for (i=0; i<modems.count(); i++) {
+ if (iCellInfoList.at(i)->modemPath() != modems.at(i)) {
+ changed = true;
+ break;
+ }
+ }
+ }
+ if (changed) {
+ QList<QSharedPointer<QOfonoExtCellInfo> > bak(iCellInfoList);
+ for (i=0; i<iCellInfoList.count(); i++) {
+ iCellInfoList.at(i)->disconnect(this);
+ }
+ iCellInfoList.clear();
+ for (i=0; i<modems.count(); i++) {
+ QSharedPointer<QOfonoExtCellInfo> cellInfo =
+ QOfonoExtCellInfo::instance(modems.at(i));
+ iCellInfoList.append(cellInfo);
+ connect(cellInfo.data(),
+ SIGNAL(cellsChanged()),
+ SLOT(updateValidCells()));
+ }
+ }
+}
+
+QStringList QOfonoExtCellWatcher::Private::updateKnownCells()
+{
+ updateCellInfo();
+
+ QStringList allCells;
+ int i;
+ for (i=0; i<iCellInfoList.count(); i++) {
+ allCells.append(iCellInfoList.at(i)->cells());
+ }
+
+ QStringList knownCells(iKnownCells.keys());
+ allCells.sort();
+ knownCells.sort();
+ if (allCells != knownCells) {
+ QMap<QString, QSharedPointer<QOfonoExtCell> > bak(iKnownCells);
+ iKnownCells.clear();
+ for (i=0; i<allCells.count(); i++) {
+ QString path(allCells.at(i));
+ QSharedPointer<QOfonoExtCell> cell = bak.value(path);
+ if (cell.isNull()) {
+ cell = QSharedPointer<QOfonoExtCell>(new QOfonoExtCell(path), &QObject::deleteLater);
+ }
+ iKnownCells.insert(path, cell);
+ if (!bak.remove(path)) {
+ // This is the first time we are seeing this cell
+ connect(cell.data(),
+ SIGNAL(validChanged()),
+ SLOT(updateValidCells()));
+ }
+ }
+ // Disconnect those cells that we no longer need
+ QList<QSharedPointer<QOfonoExtCell> > leftover = bak.values();
+ for (i=0; i<leftover.count(); i++) {
+ leftover.at(i)->disconnect(this);
+ }
+ }
+
+ return allCells;
+}
+
+void QOfonoExtCellWatcher::Private::updateValidCells()
+{
+ QStringList knownCells = updateKnownCells();
+ QStringList validCells;
+ int i;
+ for (i=0; i<knownCells.count(); i++) {
+ QString path(knownCells.at(i));
+ QSharedPointer<QOfonoExtCell> cell = iKnownCells.value(path);
+ if (cell->valid()) {
+ validCells.append(path);
+ }
+ }
+
+ bool changed = true;
+ if (validCells.count() == iValidCells.count()) {
+ changed = false;
+ for (i=0; i<validCells.count(); i++) {
+ if (iValidCells.at(i)->path() != validCells.at(i)) {
+ changed = true;
+ break;
+ }
+ }
+ }
+
+ if (changed && validCells.count() == knownCells.count()) {
+ iValidCells.clear();
+ for (i=0; i<validCells.count(); i++) {
+ iValidCells.append(iKnownCells.value(validCells.at(i)));
+ }
+ if (iParent) {
+ Q_EMIT iParent->cellsChanged();
+ }
+ }
+}
+
+QOfonoExtCellWatcher::QOfonoExtCellWatcher(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+QOfonoExtCellWatcher::~QOfonoExtCellWatcher()
+{
+ iPrivate->iParent = NULL;
+ iPrivate->deleteLater();
+}
+
+QList<QSharedPointer<QOfonoExtCell> > QOfonoExtCellWatcher::cells() const
+{
+ return iPrivate->iValidCells;
+}
+
+#include "qofonoextcellwatcher.moc"
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextcellwatcher.h
^
|
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#ifndef QOFONOEXTCELLWATCHER_H
+#define QOFONOEXTCELLWATCHER_H
+
+#include "qofonoextcell.h"
+
+// Watches available cells from all modems
+class QOFONOEXT_EXPORT QOfonoExtCellWatcher : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QOfonoExtCellWatcher(QObject* aParent = NULL);
+ ~QOfonoExtCellWatcher();
+
+ QList<QSharedPointer<QOfonoExtCell> > cells() const;
+
+Q_SIGNALS:
+ void cellsChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // QOFONOEXTCELLWATCHER_H
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextmodemmanager.cpp
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monich@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -35,8 +35,12 @@
QString iDefaultDataSim;
QList<bool> iPresentSims;
QStringList iIMEIs;
+ QString iMmsSim;
+ QString iMmsModem;
int iPresentSimCount;
int iActiveSimCount;
+ int iInterfaceVersion;
+ bool iReady;
bool iValid;
Private(QOfonoExtModemManager* aParent);
@@ -46,10 +50,13 @@
void presentSimsChanged(QList<bool> aOldList);
void updateSimCounts();
+ void getAll();
+ void getInterfaceVersion();
private Q_SLOTS:
void onServiceRegistered();
void onServiceUnregistered();
+ void onGetInterfaceVersionFinished(QDBusPendingCallWatcher* aWatcher);
void onGetAllFinished(QDBusPendingCallWatcher* aWatcher);
void onEnabledModemsChanged(QList<QDBusObjectPath> aModems);
void onDefaultVoiceModemChanged(QString aModemPath);
@@ -57,6 +64,9 @@
void onDefaultVoiceSimChanged(QString aImsi);
void onDefaultDataSimChanged(QString aImsi);
void onPresentSimsChanged(int aIndex, bool aPresent);
+ void onMmsSimChanged(QString aImsi);
+ void onMmsModemChanged(QString aModemPath);
+ void onReadyChanged(bool aReady);
};
QWeakPointer<QOfonoExtModemManager> QOfonoExtModemManager::Private::sSharedInstance;
@@ -87,6 +97,8 @@
iProxy(NULL),
iPresentSimCount(0),
iActiveSimCount(0),
+ iInterfaceVersion(0),
+ iReady(false),
iValid(false)
{
QDBusServiceWatcher* ofonoWatcher = new QDBusServiceWatcher(OFONO_SERVICE,
@@ -110,9 +122,6 @@
iProxy = new QOfonoExtModemManagerProxy(OFONO_SERVICE, "/", OFONO_BUS, this);
if (iProxy->isValid()) {
iValid = false;
- connect(new QDBusPendingCallWatcher(iProxy->GetAll3(), iProxy),
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
connect(iProxy,
SIGNAL(EnabledModemsChanged(QList<QDBusObjectPath>)),
SLOT(onEnabledModemsChanged(QList<QDBusObjectPath>)));
@@ -131,6 +140,7 @@
connect(iProxy,
SIGNAL(PresentSimsChanged(int,bool)),
SLOT(onPresentSimsChanged(int,bool)));
+ getInterfaceVersion();
} else {
delete iProxy;
iProxy = NULL;
@@ -143,14 +153,48 @@
void QOfonoExtModemManager::Private::onServiceUnregistered()
{
+ if (iProxy) {
+ delete iProxy;
+ iProxy = NULL;
+ }
if (iValid) {
iValid = false;
Q_EMIT iParent->validChanged(iValid);
}
- if (iProxy) {
- delete iProxy;
- iProxy = NULL;
+}
+
+void QOfonoExtModemManager::Private::getInterfaceVersion()
+{
+ connect(new QDBusPendingCallWatcher(iProxy->GetInterfaceVersion(), iProxy),
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetInterfaceVersionFinished(QDBusPendingCallWatcher*)));
+}
+
+void QOfonoExtModemManager::Private::getAll()
+{
+ connect(new QDBusPendingCallWatcher(
+ (iInterfaceVersion == 2) ? QDBusPendingCall(iProxy->GetAll2()) :
+ (iInterfaceVersion == 3) ? QDBusPendingCall(iProxy->GetAll3()) :
+ (iInterfaceVersion == 4) ? QDBusPendingCall(iProxy->GetAll4()) :
+ QDBusPendingCall(iProxy->GetAll5()), iProxy),
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
+}
+
+void QOfonoExtModemManager::Private::onGetInterfaceVersionFinished(QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<int> reply(*aWatcher);
+ iInterfaceVersion = reply.argumentAt<0>();
+ if (reply.isError()) {
+ // Repeat the call on timeout
+ qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getInterfaceVersion();
+ }
+ } else {
+ getAll();
}
+ aWatcher->deleteLater();
}
void QOfonoExtModemManager::Private::onGetAllFinished(QDBusPendingCallWatcher* aWatcher)
@@ -165,8 +209,13 @@
QList<bool> > // PresentSims
reply(*aWatcher);
if (reply.isError()) {
+ // Repeat the call on timeout
qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getAll();
+ }
} else {
+ const int version = reply.argumentAt<0>();
QStringList list = toStringList(reply.argumentAt<1>());
if (iAvailableModems != list) {
iAvailableModems = list;
@@ -202,11 +251,52 @@
iPresentSims = reply.argumentAt<7>();
presentSimsChanged(oldList);
- // QDBusPendingReply template doesn't support more than 8 arguments
- list = reply.argumentAt(8).toStringList();
- if (iIMEIs != list) {
- iIMEIs = list;
- Q_EMIT iParent->imeiCodesChanged(iIMEIs);
+ if (version >= 3) {
+ // 8: imei
+ list = reply.argumentAt(8).toStringList();
+ if (iIMEIs != list) {
+ iIMEIs = list;
+ Q_EMIT iParent->imeiCodesChanged(iIMEIs);
+ }
+ }
+
+ if (version >= 4) {
+ // 9: mmsSim
+ // 10: mmsModem
+ imsi = reply.argumentAt(9).toString();
+ if (iMmsSim != imsi) {
+ iMmsSim = imsi;
+ Q_EMIT iParent->mmsSimChanged(iMmsSim);
+ }
+
+ path = reply.argumentAt(10).toString();
+ if (iMmsModem != path) {
+ iMmsModem = path;
+ Q_EMIT iParent->mmsModemChanged(iMmsModem);
+ }
+
+ connect(iProxy,
+ SIGNAL(MmsSimChanged(QString)),
+ SLOT(onMmsSimChanged(QString)));
+ connect(iProxy,
+ SIGNAL(MmsModemChanged(QString)),
+ SLOT(onMmsModemChanged(QString)));
+ }
+
+ const bool wasReady = iReady;
+ if (version >= 5) {
+ // 11: ready
+ iReady = reply.argumentAt(11).toBool();
+ connect(iProxy,
+ SIGNAL(ReadyChanged(bool)),
+ SLOT(onReadyChanged(bool)));
+ } else {
+ // Old ofono is always ready :)
+ iReady = true;
+ }
+
+ if (iReady != wasReady) {
+ Q_EMIT iParent->readyChanged(iReady);
}
if (!iValid) {
@@ -311,6 +401,30 @@
}
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextmodemmanager.h
^
|
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monich@jolla.com
+** Copyright (C) 2015-2016 Jolla Ltd.
+** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -30,6 +30,9 @@
Q_PROPERTY(QString defaultVoiceSim READ defaultVoiceSim WRITE setDefaultVoiceSim NOTIFY defaultVoiceSimChanged)
Q_PROPERTY(QList<bool> presentSims READ presentSims NOTIFY presentSimsChanged)
Q_PROPERTY(QStringList imeiCodes READ imeiCodes NOTIFY imeiCodesChanged)
+ Q_PROPERTY(QString mmsSim READ mmsSim NOTIFY mmsSimChanged)
+ Q_PROPERTY(QString mmsModem READ mmsModem NOTIFY mmsModemChanged)
+ Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
Q_PROPERTY(int presentSimCount READ presentSimCount NOTIFY presentSimCountChanged)
Q_PROPERTY(int activeSimCount READ activeSimCount NOTIFY activeSimCountChanged)
@@ -46,6 +49,9 @@
QString defaultVoiceSim() const;
QList<bool> presentSims() const;
QStringList imeiCodes() const;
+ QString mmsSim() const;
+ QString mmsModem() const;
+ bool ready() const;
int presentSimCount() const;
int activeSimCount() const;
@@ -71,6 +77,9 @@
void presentSimCountChanged(int value);
void activeSimCountChanged(int value);
void imeiCodesChanged(QStringList value);
+ void mmsSimChanged(QString value);
+ void mmsModemChanged(QString value);
+ void readyChanged(bool value);
private:
class Private;
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextsiminfo.cpp
^
|
@@ -0,0 +1,227 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: slava.monich@jolla.com
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#include "qofonoextsiminfo.h"
+#include "qofonoext_p.h"
+
+#include "siminfo_interface.h"
+
+#include <qofonomodem.h>
+
+class QOfonoExtSimInfo::Private : public QObject
+{
+ Q_OBJECT
+
+public:
+ QOfonoExtSimInfo* iParent;
+ QOfonoExtSimInfoProxy* iProxy;
+ QSharedPointer<QOfonoModem> iModem;
+ QString iInterfaceName;
+ bool iValid;
+ QString iModemPath;
+ QString iCardIdentifier;
+ QString iSubscriberIdentity;
+ QString iServiceProviderName;
+
+ Private(QOfonoExtSimInfo* aParent);
+
+ QString modemPath() const;
+ void setModemPath(QString aPath);
+ void invalidate();
+
+private Q_SLOTS:
+ void checkInterfacePresence();
+ void onGetAllFinished(QDBusPendingCallWatcher* aWatcher);
+ void onCardIdentifierChanged(QString aCardIdentifier);
+ void onSubscriberIdentityChanged(QString aSubscriberIdentity);
+ void onServiceProviderNameChanged(QString aServiceProviderName);
+};
+
+QOfonoExtSimInfo::Private::Private(QOfonoExtSimInfo* aParent) :
+ QObject(aParent),
+ iParent(aParent),
+ iProxy(NULL),
+ iInterfaceName(QOfonoExtSimInfoProxy::staticInterfaceName()),
+ iValid(false)
+{
+}
+
+QString QOfonoExtSimInfo::Private::modemPath() const
+{
+ return iModem.isNull() ? QString() : iModem->objectPath();
+}
+
+void QOfonoExtSimInfo::Private::setModemPath(QString aPath)
+{
+ if (aPath != modemPath()) {
+ invalidate();
+ if (aPath.isEmpty()) {
+ iModem.clear();
+ } else {
+ if (iModem) iModem->disconnect(this);
+ iModem = QOfonoModem::instance(aPath);
+ connect(iModem.data(),
+ SIGNAL(validChanged(bool)),
+ SLOT(checkInterfacePresence()));
+ connect(iModem.data(),
+ SIGNAL(interfacesChanged(QStringList)),
+ SLOT(checkInterfacePresence()));
+ checkInterfacePresence();
+ }
+ }
+}
+
+void QOfonoExtSimInfo::Private::checkInterfacePresence()
+{
+ if (iModem && iModem->isValid() &&
+ iModem->interfaces().contains(iInterfaceName)) {
+ if (!iProxy) {
+ iProxy = new QOfonoExtSimInfoProxy(OFONO_SERVICE, iModem->objectPath(), OFONO_BUS, this);
+ if (iProxy->isValid()) {
+ connect(new QDBusPendingCallWatcher(iProxy->GetAll(), iProxy),
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
+ connect(iProxy,
+ SIGNAL(CardIdentifierChanged(QString)),
+ SLOT(onCardIdentifierChanged(QString)));
+ connect(iProxy,
+ SIGNAL(SubscriberIdentityChanged(QString)),
+ SLOT(onSubscriberIdentityChanged(QString)));
+ connect(iProxy,
+ SIGNAL(ServiceProviderNameChanged(QString)),
+ SLOT(onServiceProviderNameChanged(QString)));
+ } else {
+ invalidate();
+ }
+ }
+ } else {
+ invalidate();
+ }
+}
+
+void QOfonoExtSimInfo::Private::invalidate()
+{
+ if (iProxy) {
+ delete iProxy;
+ iProxy = NULL;
+ }
+ if (iValid) {
+ iValid = false;
+ Q_EMIT iParent->validChanged(false);
+ }
+}
+
+void QOfonoExtSimInfo::Private::onGetAllFinished(QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<int, // InterfaceVersion
+ QString, // CardIdentifier
+ QString, // SubscriberIdentity
+ QString> // ServiceProviderName
+ reply(*aWatcher);
+ if (reply.isError()) {
+ qWarning() << reply.error();
+ } else {
+ QString iccid = reply.argumentAt<1>();
+ if (iCardIdentifier != iccid) {
+ iCardIdentifier = iccid;
+ Q_EMIT iParent->cardIdentifierChanged(iccid);
+ }
+ QString imsi = reply.argumentAt<2>();
+ if (iSubscriberIdentity != imsi) {
+ iSubscriberIdentity = imsi;
+ Q_EMIT iParent->subscriberIdentityChanged(imsi);
+ }
+ QString spn = reply.argumentAt<3>();
+ if (iServiceProviderName != spn) {
+ iServiceProviderName = spn;
+ Q_EMIT iParent->serviceProviderNameChanged(spn);
+ }
+ if (!iValid) {
+ iValid = true;
+ Q_EMIT iParent->validChanged(iValid);
+ }
+ }
+ aWatcher->deleteLater();
+}
+
+void QOfonoExtSimInfo::Private::onCardIdentifierChanged(QString aValue)
+{
+ if (iCardIdentifier != aValue) {
+ iCardIdentifier = aValue;
+ Q_EMIT iParent->cardIdentifierChanged(aValue);
+ }
+}
+
+void QOfonoExtSimInfo::Private::onSubscriberIdentityChanged(QString aValue)
+{
+ if (iSubscriberIdentity != aValue) {
+ iSubscriberIdentity = aValue;
+ Q_EMIT iParent->subscriberIdentityChanged(aValue);
+ }
+}
+
+void QOfonoExtSimInfo::Private::onServiceProviderNameChanged(QString aValue)
+{
+ if (iServiceProviderName != aValue) {
+ iServiceProviderName = aValue;
+ Q_EMIT iParent->serviceProviderNameChanged(aValue);
+ }
+}
+
+// ==========================================================================
+// QOfonoExtSimInfo
+// ==========================================================================
+
+QOfonoExtSimInfo::QOfonoExtSimInfo(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+QOfonoExtSimInfo::~QOfonoExtSimInfo()
+{
+}
+
+bool QOfonoExtSimInfo::valid() const
+{
+ return iPrivate->iValid;
|
[-]
[+]
|
Added |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/qofonoextsiminfo.h
^
|
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: slava.monich@jolla.com
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+****************************************************************************/
+
+#ifndef QOFONOEXTSIMINFO_H
+#define QOFONOEXTSIMINFO_H
+
+#include "qofonoext_types.h"
+
+class QOFONOEXT_EXPORT QOfonoExtSimInfo : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
+ Q_PROPERTY(QString modemPath READ modemPath WRITE setModemPath NOTIFY modemPathChanged)
+ Q_PROPERTY(QString cardIdentifier READ cardIdentifier NOTIFY cardIdentifierChanged)
+ Q_PROPERTY(QString subscriberIdentity READ subscriberIdentity NOTIFY subscriberIdentityChanged)
+ Q_PROPERTY(QString serviceProviderName READ serviceProviderName NOTIFY serviceProviderNameChanged)
+
+public:
+ explicit QOfonoExtSimInfo(QObject* aParent = NULL);
+ ~QOfonoExtSimInfo();
+
+ bool valid() const;
+ QString modemPath() const;
+ QString cardIdentifier() const;
+ QString subscriberIdentity() const;
+ QString serviceProviderName() const;
+
+ void setModemPath(QString aPath);
+
+Q_SIGNALS:
+ void validChanged(bool value);
+ void modemPathChanged(QString value);
+ void cardIdentifierChanged(QString value);
+ void subscriberIdentityChanged(QString value);
+ void serviceProviderNameChanged(QString value);
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // QOFONOEXTSIMINFO_H
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/src.pro
^
|
@@ -17,35 +17,54 @@
}
XML_FILES += \
+ dbus/org.nemomobile.ofono.Cell.xml \
+ dbus/org.nemomobile.ofono.CellInfo.xml \
dbus/org.nemomobile.ofono.ModemManager.xml \
- dbus/org.nemomobile.ofono.SimSettings.xml
+ dbus/org.nemomobile.ofono.SimInfo.xml
OTHER_FILES += $$XML_FILES\
qofonoext.prf \
version.pri
SOURCES += \
+ qofonoext.cpp \
+ qofonoextcell.cpp \
+ qofonoextcellinfo.cpp \
+ qofonoextcellwatcher.cpp \
qofonoextmodemmanager.cpp \
- qofonoextsimsettings.cpp
+ qofonoextsiminfo.cpp
PUBLIC_HEADERS += \
+ qofonoextcell.h \
+ qofonoextcellinfo.h \
+ qofonoextcellwatcher.h \
qofonoextmodemmanager.h \
- qofonoextsimsettings.h \
+ qofonoextsiminfo.h \
qofonoext_types.h
HEADERS += \
$$PUBLIC_HEADERS \
qofonoext_p.h
+DBUS_INTERFACES += org_nemomobile_ofono_cell
+org_nemomobile_ofono_cell.files = dbus/org.nemomobile.ofono.Cell.xml
+org_nemomobile_ofono_cell.header_flags = -N -c QOfonoExtCellProxy
+org_nemomobile_ofono_cell.source_flags = -N -c QOfonoExtCellProxy
+
+DBUS_INTERFACES += org_nemomobile_ofono_cell_info
+org_nemomobile_ofono_cell_info.files = dbus/org.nemomobile.ofono.CellInfo.xml
+org_nemomobile_ofono_cell_info.header_flags = -N -c QOfonoExtCellInfoProxy
+org_nemomobile_ofono_cell_info.source_flags = -N -c QOfonoExtCellInfoProxy
+
DBUS_INTERFACES += org_nemomobile_ofono_modem_manager
org_nemomobile_ofono_modem_manager.files = dbus/org.nemomobile.ofono.ModemManager.xml
org_nemomobile_ofono_modem_manager.header_flags = -N -c QOfonoExtModemManagerProxy -i qofonoext_p.h
org_nemomobile_ofono_modem_manager.source_flags = -N -c QOfonoExtModemManagerProxy
-DBUS_INTERFACES += org_nemomobile_ofono_sim_settings
-org_nemomobile_ofono_sim_settings.files = dbus/org.nemomobile.ofono.SimSettings.xml
-org_nemomobile_ofono_sim_settings.header_flags = -N -c QOfonoExtSimSettingsProxy
-org_nemomobile_ofono_sim_settings.source_flags = -N -c QOfonoExtSimSettingsProxy
+DBUS_INTERFACES += org_nemomobile_ofono_sim_info
+org_nemomobile_ofono_sim_info.files = dbus/org.nemomobile.ofono.SimInfo.xml
+org_nemomobile_ofono_sim_info.header_flags = -N -c QOfonoExtSimInfoProxy
+org_nemomobile_ofono_sim_info.source_flags = -N -c QOfonoExtSimInfoProxy
target.path = $$[QT_INSTALL_LIBS]
@@ -58,7 +77,7 @@
QMAKE_PKGCONFIG_NAME = $$TARGET
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_INCDIR = $$headers.path
-QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings got ofono extensions
+QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings for ofono extensions
QMAKE_PKGCONFIG_PREFIX = $$PREFIX
QMAKE_PKGCONFIG_VERSION = $$VERSION
|
[-]
[+]
|
Changed |
_service:tar_git:libqofonoext-1.0.13.tar.bz2/src/version.pri
^
|
@@ -1 +1 @@
-VERSION = 1.0.5
+VERSION = 1.0.13
|
[-]
[+]
|
Deleted |
_service:tar_git:libqofonoext-1.0.5.tar.bz2/src/dbus/org.nemomobile.ofono.SimSettings.xml
^
|
@@ -1,27 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.nemomobile.ofono.SimSettings">
- <method name="GetAll">
- <arg name="settings" type="ibs" direction="out"/>
- </method>
- <method name="GetInterfaceVersion">
- <arg name="version" type="i" direction="out"/>
- </method>
- <method name="GetEnable4G">
- <arg name="enable" type="b" direction="out"/>
- </method>
- <method name="GetDisplayName">
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="SetDisplayName">
- <arg name="name" type="s" direction="in"/>
- </method>
- <signal name="DisplayNameChanged">
- <arg name="name" type="s"/>
- </signal>
- <signal name="Enable4GChanged">
- <arg name="enabled" type="b"/>
- </signal>
- </interface>
-</node>
|
[-]
[+]
|
Deleted |
_service:tar_git:libqofonoext-1.0.5.tar.bz2/src/qofonoextsimsettings.cpp
^
|
@@ -1,219 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monich@jollamobile.com
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-****************************************************************************/
-
-#include "qofonoextsimsettings.h"
-#include "qofonoext_p.h"
-
-#include "simsettings_interface.h"
-
-#include <qofonomodem.h>
-
-class QOfonoExtSimSettings::Private : public QObject
-{
- Q_OBJECT
-
-public:
- QOfonoExtSimSettings* iParent;
- QOfonoExtSimSettingsProxy* iProxy;
- QSharedPointer<QOfonoModem> iModem;
- QString iInterfaceName;
- bool iValid;
- bool iEnable4G;
- QString iModemPath;
- QString iDisplayName;
-
- Private(QOfonoExtSimSettings* aParent);
-
- QString modemPath() const;
- void setModemPath(QString aPath);
- void setDisplayName(QString aName);
- void invalidate();
-
-private Q_SLOTS:
- void checkInterfacePresence();
- void onGetAllFinished(QDBusPendingCallWatcher* aWatcher);
- void onDisplayNameChanged(QString aName);
- void onEnable4GChanged(bool aEnable);
-};
-
-QOfonoExtSimSettings::Private::Private(QOfonoExtSimSettings* aParent) :
- QObject(aParent),
- iParent(aParent),
- iProxy(NULL),
- iInterfaceName(QOfonoExtSimSettingsProxy::staticInterfaceName()),
- iValid(false)
-{
-}
-
-QString QOfonoExtSimSettings::Private::modemPath() const
-{
- return iModem.isNull() ? QString() : iModem->objectPath();
-}
-
-void QOfonoExtSimSettings::Private::setModemPath(QString aPath)
-{
- if (aPath != modemPath()) {
- invalidate();
- if (aPath.isEmpty()) {
- iModem.clear();
- } else {
- if (iModem) iModem->disconnect(this);
- iModem = QOfonoModem::instance(aPath);
- connect(iModem.data(),
- SIGNAL(validChanged(bool)),
- SLOT(checkInterfacePresence()));
- connect(iModem.data(),
- SIGNAL(interfacesChanged(QStringList)),
- SLOT(checkInterfacePresence()));
- checkInterfacePresence();
- }
- }
-}
-
-void QOfonoExtSimSettings::Private::checkInterfacePresence()
-{
- if (iModem && iModem->isValid() &&
- iModem->interfaces().contains(iInterfaceName)) {
- if (!iProxy) {
- iProxy = new QOfonoExtSimSettingsProxy(OFONO_SERVICE, iModem->objectPath(), OFONO_BUS, this);
- if (iProxy->isValid()) {
- connect(new QDBusPendingCallWatcher(iProxy->GetAll(), iProxy),
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
- connect(iProxy,
- SIGNAL(Enable4GChanged(bool)),
- SLOT(onEnable4GChanged(bool)));
- connect(iProxy,
- SIGNAL(DisplayNameChanged(QString)),
- SLOT(onDisplayNameChanged(QString)));
- } else {
- invalidate();
- }
- }
- } else {
- invalidate();
- }
-}
-
-void QOfonoExtSimSettings::Private::invalidate()
-{
- if (iProxy) {
- delete iProxy;
- iProxy = NULL;
- }
- if (iValid) {
- iValid = false;
- Q_EMIT iParent->validChanged(false);
- }
-}
-
-void QOfonoExtSimSettings::Private::setDisplayName(QString aName)
-{
- if (iProxy) {
- iProxy->SetDisplayName(aName);
- }
- // Optimistically cache the changes
- if (iDisplayName != aName) {
- iDisplayName = aName;
- Q_EMIT iParent->displayNameChanged(aName);
- }
-}
-
-void QOfonoExtSimSettings::Private::onGetAllFinished(QDBusPendingCallWatcher* aWatcher)
-{
- QDBusPendingReply<int, // InterfaceVersion
- bool, // Enable4G
- QString> // DisplayName
- reply(*aWatcher);
- if (reply.isError()) {
- qWarning() << reply.error();
- } else {
- bool enable4G = reply.argumentAt<1>();
- if (iEnable4G != enable4G) {
- iEnable4G = enable4G;
- Q_EMIT iParent->enable4GChanged(enable4G);
- }
- QString name = reply.argumentAt<2>();
- if (iDisplayName != name) {
- iDisplayName = name;
- Q_EMIT iParent->displayNameChanged(name);
- }
- if (!iValid) {
- iValid = true;
- Q_EMIT iParent->validChanged(iValid);
- }
- }
- aWatcher->deleteLater();
-}
-
-void QOfonoExtSimSettings::Private::onDisplayNameChanged(QString aName)
-{
- if (iDisplayName != aName) {
- iDisplayName = aName;
- Q_EMIT iParent->displayNameChanged(aName);
- }
-}
-
-void QOfonoExtSimSettings::Private::onEnable4GChanged(bool aEnable)
-{
- iEnable4G = aEnable;
- Q_EMIT iParent->enable4GChanged(aEnable);
-}
-
-// ==========================================================================
-// QOfonoExtSimSettings
-// ==========================================================================
-
-QOfonoExtSimSettings::QOfonoExtSimSettings(QObject* aParent) :
- QObject(aParent),
- iPrivate(new Private(this))
-{
-}
-
-QOfonoExtSimSettings::~QOfonoExtSimSettings()
-{
-}
-
-bool QOfonoExtSimSettings::valid() const
-{
- return iPrivate->iValid;
-}
-
-bool QOfonoExtSimSettings::enable4G() const
-{
- return iPrivate->iEnable4G;
-}
-
-QString QOfonoExtSimSettings::modemPath() const
|
[-]
[+]
|
Deleted |
_service:tar_git:libqofonoext-1.0.5.tar.bz2/src/qofonoextsimsettings.h
^
|
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd.
-** Contact: slava.monich@jollamobile.com
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-****************************************************************************/
-
-#ifndef QOFONOEXTSIMSETTINGS_H
-#define QOFONOEXTSIMSETTINGS_H
-
-#include "qofonoext_types.h"
-
-class QOFONOEXT_EXPORT QOfonoExtSimSettings : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
- Q_PROPERTY(bool enable4G READ enable4G NOTIFY enable4GChanged)
- Q_PROPERTY(QString modemPath READ modemPath WRITE setModemPath NOTIFY modemPathChanged)
- Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
-
-public:
- explicit QOfonoExtSimSettings(QObject* aParent = NULL);
- ~QOfonoExtSimSettings();
-
- bool valid() const;
- bool enable4G() const;
- QString modemPath() const;
- QString displayName() const;
-
- void setModemPath(QString aPath);
- void setDisplayName(QString aName);
-
-Q_SIGNALS:
- void validChanged(bool value);
- void enable4GChanged(bool value);
- void modemPathChanged(QString value);
- void displayNameChanged(QString value);
-
-private:
- class Private;
- Private* iPrivate;
-};
-
-#endif // QOFONOEXTSIMSETTINGS_H
|