debian/0000755000000000000000000000000012762041147007172 5ustar debian/source/0000755000000000000000000000000012762041145010470 5ustar debian/source/format0000644000000000000000000000001412762041145011676 0ustar 3.0 (quilt) debian/libqofono-qt5-0.install0000644000000000000000000000002712762041145013413 0ustar usr/lib/*/*ofono*.so.* debian/libqofono-dev.install0000644000000000000000000000011312762041145013317 0ustar usr/include usr/share/qt5/mkspecs usr/lib/*/pkgconfig usr/lib/*/*ofono*.so debian/qml-module-ofono.install0000644000000000000000000000001612762041145013747 0ustar usr/lib/*/qt5 debian/rules0000755000000000000000000000053512762041145010253 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # FIXME: disable tests for now. These require ofono to be running and probably # need more love before they can be ran during build-time (LP: #1334652) override_dh_auto_test: # LD_LIBRARY_PATH=../../../src dh_auto_test %: dh $@ --list-missing debian/changelog0000644000000000000000000001003412762041147011042 0ustar libqofono (0.90+16.10.20160901-0ubuntu1) yakkety; urgency=medium * New upstream release * debian/control - Dropped recommends for ofono to a suggests - Renamed QML module to follow qml-module-ofono naming (LP: #1342031) -- Ken VanDine Thu, 01 Sep 2016 14:59:50 +0000 libqofono (0.82+16.04.20160127-0ubuntu1) xenial; urgency=medium * Make ofono dependency optional (LP: #1521142) -- Pete Woods Wed, 27 Jan 2016 14:19:53 +0000 libqofono (0.82+15.10.20150925-0ubuntu1) wily; urgency=medium * libqofono-dev should depend on libqofono-qt5-0 (= ${binary:Version} -- Ken VanDine Fri, 25 Sep 2015 13:57:19 +0000 libqofono (0.82+15.10.20150911-0ubuntu1) wily; urgency=medium [ Ken VanDine ] * New upstream release. * -debian/patches/expose_modem_tech.patch - Dropped, upstream now provides availableTechnologies * debian/control - Bumped ofono depends to 1.16 for availableTechnologies * added packaging added: .bzr-builddeb/ .bzr-builddeb/default.conf debian/ debian/changelog debian/compat debian/control debian/copyright debian/libqofono-dev.install debian/libqofono-qt5- 0.install debian/patches/ debian/patches/connman-resetcontexts.patch debian/patches/context-preferred.patch debian/patches/mtk_settings_binding.patch debian/patches/series debian/qtdeclarative5-ofono0.2.install debian/rules debian/source/ debian/source/format -- Tony Espy Fri, 11 Sep 2015 12:50:11 +0000 libqofono (0.79-0ubuntu2~gcc5.1) wily; urgency=medium * No-change test rebuild for g++5 ABI transition -- Steve Langasek Fri, 17 Jul 2015 22:20:07 +0000 libqofono (0.79-0ubuntu1) wily; urgency=medium * New upstream release. * debian/patchescontext-preferred.patch debian/patches/connman-resetcontexts.patch debian/patches/mtk_settings_binding.patch debian/patches/expose_modem_tech.patch: Updated -- Ken VanDine Fri, 26 Jun 2015 10:16:02 -0400 libqofono (0.70-0ubuntu4) wily; urgency=medium [ Jonas Drange ] * debian/patches/connman-resetcontexts.patch - Added bindings to Ofono's reset context API (LP: #1338758) -- Ken VanDine Thu, 21 May 2015 16:16:51 -0400 libqofono (0.70-0ubuntu3) vivid; urgency=medium * debian/patches/context-preferred.patch - Added bindings to the Ofono ConnectionContext's "Preferred" property, patch thanks to Jonas Drange * debian/control - depend on ofono >= 1.12.bzr6892+15.04.20150407, required for the preferred property -- Ken VanDine Wed, 22 Apr 2015 10:58:17 -0400 libqofono (0.70-0ubuntu2) vivid; urgency=medium * debian/control - fixed typo in breaks -- Ken VanDine Wed, 14 Jan 2015 09:36:03 -0500 libqofono (0.70-0ubuntu1) vivid; urgency=medium * New upstream release. * Dropped patches applied upstream, service_numbers.patch and fix_multiarch.patch * Refreshed expose_modem_tech.patch and mtk_settings_binding.patch -- Ken VanDine Mon, 12 Jan 2015 11:32:24 -0500 libqofono (0.53-0ubuntu3) vivid; urgency=medium * debian/patches/mtk_settings_binding.patch - add mtk (mediatek) settings binding which allows consumer to set which modem to allow 3G communication (LP: #1373388) -- Ken VanDine Fri, 21 Nov 2014 10:07:54 -0500 libqofono (0.53-0ubuntu2) utopic; urgency=medium * debian/patches/expose_modem_tech.patch - radiosettings: expose modemtechnologies (LP: #1346790) -- Ken VanDine Wed, 20 Aug 2014 11:17:52 -0400 libqofono (0.53-0ubuntu1) utopic; urgency=low [ Ken VanDine ] * New package [ Ɓukasz 'sil2100' Zemczak ] * debian/patches/fix_multiarch.patch: - Fix qmake files to enable proper multiarch support during package build. * Prepare proper copyright information -- Ken VanDine Wed, 18 Jun 2014 13:02:42 -0400 debian/control0000644000000000000000000000274112762041145010577 0ustar Source: libqofono Section: libs Priority: extra Maintainer: Ken VanDine Build-Depends: debhelper (>= 9), pkg-config, qt5-default, qtbase5-dev, qtdeclarative5-dev, qml-module-qtquick2, libqt5xmlpatterns5-dev, Standards-Version: 3.9.5 Homepage: https://github.com/nemomobile/libqofono Package: libqofono-qt5-0 Architecture: any Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Suggests: ofono (>= 1.16), Description: Qt library for Ofono A library for accessing the ofono daemon, and a declarative plugin for it. This allows accessing ofono in qtquick and friends. Package: libqofono-dev Section: libdevel Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libqofono-qt5-0 (= ${binary:Version}), Description: Qt library for Ofono A library for accessing the ofono daemon, and a declarative plugin for it. This allows accessing ofono in qtquick and friends. Package: qml-module-ofono Architecture: any Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Breaks: ubuntu-system-settings (<< 0.3+15.04.20150114), qtdeclarative5-ofono0.2, Replaces: qtdeclarative5-ofono0.2 Description: QML bindings for libqofono A library for accessing the ofono daemon, and a declarative plugin for it. This allows accessing ofono in qtquick and friends. debian/copyright0000644000000000000000000000222212762041145011121 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: libqofono Source: https://github.com/nemomobile/libqofono Files: * Copyright: 2013 Jolla Ltd. License: LGPL-2.1 Files: src/dbus/* Copyright: 2012 Nokia Corporation and/or its subsidiary(-ies) License: LGPL-2.1 Files: test/auto/tests/* Copyright: 2010-2011 Nokia Corporation and/or its subsidiary(-ies) License: LGPL-2.1 License: LGPL-2.1 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . . On Debian systems, the complete text of the GNU Lesser General Public License version 2.1 can be found in `/usr/share/common-licenses/LGPL-2.1'. debian/compat0000644000000000000000000000000212762041145010366 0ustar 9 debian/patches/0000755000000000000000000000000012762041145010617 5ustar debian/patches/context-preferred.patch0000644000000000000000000001034112762041145015277 0ustar Index: libqofono-ubuntu/src/qofonoconnectioncontext.cpp =================================================================== --- libqofono-ubuntu.orig/src/qofonoconnectioncontext.cpp +++ libqofono-ubuntu/src/qofonoconnectioncontext.cpp @@ -117,6 +117,8 @@ void QOfonoConnectionContext::propertyCh SUPER::propertyChanged(property, value); if (property == QLatin1String("Active")) { Q_EMIT activeChanged(value.value()); + } else if (property == QLatin1String("Preferred")) { + Q_EMIT preferredChanged(value.value()); } else if (property == QLatin1String("Name")) { Q_EMIT nameChanged(value.value()); } else if (property == QLatin1String("AccessPointName")) { @@ -147,6 +149,11 @@ bool QOfonoConnectionContext::active() c return getBool("Active"); } +bool QOfonoConnectionContext::preferred() const +{ + return getBool("Preferred"); +} + QString QOfonoConnectionContext::accessPointName() const { return getString("AccessPointName"); @@ -211,6 +218,11 @@ void QOfonoConnectionContext::setActive( setProperty("Active", value); } +void QOfonoConnectionContext::setPreferred(const bool value) +{ + setProperty("Preferred", value); +} + void QOfonoConnectionContext::setAccessPointName(const QString &value) { setProperty("AccessPointName", value); Index: libqofono-ubuntu/src/qofonoconnectioncontext.h =================================================================== --- libqofono-ubuntu.orig/src/qofonoconnectioncontext.h +++ libqofono-ubuntu/src/qofonoconnectioncontext.h @@ -28,6 +28,7 @@ class QOFONOSHARED_EXPORT QOfonoConnecti { Q_OBJECT Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) + Q_PROPERTY(bool preferred READ preferred WRITE setPreferred NOTIFY preferredChanged) Q_PROPERTY(bool provisioning READ provisioning NOTIFY provisioningChanged) Q_PROPERTY(QString accessPointName READ accessPointName WRITE setAccessPointName NOTIFY accessPointNameChanged) Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) @@ -56,6 +57,9 @@ public: bool provisioning() const; + bool preferred() const; + void setPreferred(bool); + QString accessPointName() const; void setAccessPointName(const QString &); @@ -104,6 +108,7 @@ public: Q_SIGNALS: void disconnectRequested(); void activeChanged(bool active); + void preferredChanged(bool preferred); void provisioningChanged(bool provisioning); void accessPointNameChanged(const QString &apn); void nameChanged(const QString &name); Index: libqofono-ubuntu/test/auto/tests/tst_qofonoconnmancontext.cpp =================================================================== --- libqofono-ubuntu.orig/test/auto/tests/tst_qofonoconnmancontext.cpp +++ libqofono-ubuntu/test/auto/tests/tst_qofonoconnmancontext.cpp @@ -61,6 +61,7 @@ private slots: QTRY_COMPARE(context->isValid(), true); QSignalSpy active(context, SIGNAL(activeChanged(bool))); + QSignalSpy preferred(context, SIGNAL(preferredChanged(bool))); QSignalSpy apn(context,SIGNAL(accessPointNameChanged(QString))); QSignalSpy name(context, SIGNAL(nameChanged(QString))); QSignalSpy type (context, SIGNAL(typeChanged(QString))); @@ -93,6 +94,10 @@ private slots: QTRY_COMPARE(active.count(), 1); QCOMPARE(active.takeFirst().at(0).toBool(), true); + context->setPreferred(true); + QTRY_COMPARE(preferred.count(), 1); + QCOMPARE(preferred.takeFirst().at(0).toBool(), true); + QTRY_COMPARE(sett6.count(), 1); QCOMPARE(sett6.takeFirst().at(0).toMap()["Interface"].value().left(5), QString("dummy")); // "dummy" plus number @@ -109,11 +114,16 @@ private slots: QCOMPARE(sett.count(), 0); QCOMPARE(proto.count(), 0); QCOMPARE(active.count(), 0); + QCOMPARE(preferred.count(), 0); context->setActive(false); QTRY_COMPARE(active.count(), 1); QCOMPARE(active.takeFirst().at(0).toBool(), false); + context->setPreferred(false); + QTRY_COMPARE(preferred.count(), 1); + QCOMPARE(preferred.takeFirst().at(0).toBool(), false); + delete context; m->removeContext(contextid); debian/patches/mtk_settings_binding.patch0000644000000000000000000003442612762041145016056 0ustar commit 8f71ba98d1ac5dcbdb0f7e191f8bf8f72a925898 Author: Jonas G. Drange Date: Thu Nov 20 17:01:17 CET 2014 add mtk (mediatek) settings binding which allows consumer to set which modem to allow 3G communication Index: libqofono-ubuntu/plugin/qofonodeclarativeplugin.cpp =================================================================== --- libqofono-ubuntu.orig/plugin/qofonodeclarativeplugin.cpp +++ libqofono-ubuntu/plugin/qofonodeclarativeplugin.cpp @@ -34,6 +34,7 @@ #include "qofonomessage.h" #include "qofonomessagemanager.h" #include "qofonomessagewaiting.h" +#include "qofonomtksettings.h" #include "qofonosimmanager.h" @@ -87,6 +88,7 @@ void QOfonoDeclarativePlugin::registerTy qmlRegisterType(uri,major,minor,"OfonoMessage"); qmlRegisterType(uri,major,minor,"OfonoMessageManager"); qmlRegisterType(uri,major,minor,"OfonoMessageWaiting"); + qmlRegisterType(uri,0,2,"OfonoMtkSettings"); qmlRegisterType(uri,major,minor,"OfonoSimManager"); Index: libqofono-ubuntu/src/dbus/ofono_mtk_settings.xml =================================================================== --- /dev/null +++ libqofono-ubuntu/src/dbus/ofono_mtk_settings.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + Index: libqofono-ubuntu/src/dbus/ofonomtksettings.cpp =================================================================== --- /dev/null +++ libqofono-ubuntu/src/dbus/ofonomtksettings.cpp @@ -0,0 +1,26 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp -c OfonoMtkSettings -p ofonomtksettings -N ofono_mtk_settings.xml + * + * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#include "ofonomtksettings.h" + +/* + * Implementation of interface class OfonoMtkSettings + */ + +OfonoMtkSettings::OfonoMtkSettings(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +OfonoMtkSettings::~OfonoMtkSettings() +{ +} + Index: libqofono-ubuntu/src/dbus/ofonomtksettings.h =================================================================== --- /dev/null +++ libqofono-ubuntu/src/dbus/ofonomtksettings.h @@ -0,0 +1,56 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp -c OfonoMtkSettings -p ofonomtksettings -N ofono_mtk_settings.xml + * + * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#ifndef OFONOMTKSETTINGS_H_1416404986 +#define OFONOMTKSETTINGS_H_1416404986 + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Proxy class for interface org.ofono.MtkSettings + */ +class OfonoMtkSettings: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "org.ofono.MtkSettings"; } + +public: + OfonoMtkSettings(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~OfonoMtkSettings(); + +public Q_SLOTS: // METHODS + inline QDBusPendingReply GetProperties() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList); + } + + inline QDBusPendingReply<> SetProperty(const QString &in0, const QDBusVariant &in1) + { + QList argumentList; + argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1); + return asyncCallWithArgumentList(QLatin1String("SetProperty"), argumentList); + } + +Q_SIGNALS: // SIGNALS + void PropertyChanged(const QString &in0, const QDBusVariant &in1); +}; + +#endif Index: libqofono-ubuntu/src/qofonomtksettings.cpp =================================================================== --- /dev/null +++ libqofono-ubuntu/src/qofonomtksettings.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Canonical Ltd. +** Contact: jonas.drange@canonical.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 "qofonomtksettings.h" +#include "dbus/ofonomtksettings.h" + +class QOfonoMtkSettingsPrivate +{ +public: + QOfonoMtkSettingsPrivate(); + QString modemPath; + OfonoMtkSettings *mtkSettings; + QVariantMap properties; + +}; + +QOfonoMtkSettingsPrivate::QOfonoMtkSettingsPrivate() : + modemPath(QString()) + , mtkSettings(0) +{ +} + +QOfonoMtkSettings::QOfonoMtkSettings(QObject *parent) : + QObject(parent) + , d_ptr(new QOfonoMtkSettingsPrivate) +{ +} + +QOfonoMtkSettings::~QOfonoMtkSettings() +{ + delete d_ptr; +} + +void QOfonoMtkSettings::setModemPath(const QString &path) +{ + if (path == d_ptr->modemPath || + path.isEmpty()) + return; + + QStringList removedProperties = d_ptr->properties.keys(); + + delete d_ptr->mtkSettings; + d_ptr->mtkSettings = new OfonoMtkSettings("org.ofono", path, QDBusConnection::systemBus(),this); + + if (d_ptr->mtkSettings->isValid()) { + d_ptr->modemPath = path; + + connect(d_ptr->mtkSettings,SIGNAL(PropertyChanged(QString,QDBusVariant)), + this,SLOT(propertyChanged(QString,QDBusVariant))); + + QVariantMap properties = d_ptr->mtkSettings->GetProperties().value(); + for (QVariantMap::ConstIterator it = properties.constBegin(); + it != properties.constEnd(); ++it) { + updateProperty(it.key(), it.value()); + removedProperties.removeOne(it.key()); + } + + Q_EMIT modemPathChanged(path); + } + + foreach (const QString &p, removedProperties) + updateProperty(p, QVariant()); +} + +QString QOfonoMtkSettings::modemPath() const +{ + return d_ptr->modemPath; +} + + +void QOfonoMtkSettings::propertyChanged(const QString& property, const QDBusVariant& dbusvalue) +{ + updateProperty(property, dbusvalue.variant()); +} + +void QOfonoMtkSettings::updateProperty(const QString &property, const QVariant &value) +{ + if (d_ptr->properties.value(property) == value) + return; + + if (value.isValid()) + d_ptr->properties.insert(property, value); + else + d_ptr->properties.remove(property); + + if (property == QLatin1String("Has3G")) { + Q_EMIT has3GChanged(value.value()); + } +} + +bool QOfonoMtkSettings::has3G() const +{ + return d_ptr->properties["Has3G"].value(); +} + +void QOfonoMtkSettings::setHas3G(bool has3G) +{ + // We do not allow this property to be set to false + if (!has3G) + return; + + if (d_ptr->mtkSettings) + d_ptr->mtkSettings->SetProperty("Has3G", QDBusVariant(has3G)); +} + +bool QOfonoMtkSettings::isValid() const +{ + return d_ptr->mtkSettings->isValid(); +} Index: libqofono-ubuntu/src/qofonomtksettings.h =================================================================== --- /dev/null +++ libqofono-ubuntu/src/qofonomtksettings.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Canonical Ltd. +** Contact: jonas.drange@canonical.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 QOFONOMtkSettings_H +#define QOFONOMtkSettings_H + +#include +#include + +#include "qofono_global.h" +//! This class is used to access ofono mtk (MediaTek) settings API +/*! + * The API is documented in + * https://github.com/rilmodem/ofono/blob/master/doc/mtk-settings-api.txt + */ + +class QOfonoMtkSettingsPrivate; +class QOFONOSHARED_EXPORT QOfonoMtkSettings : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString modemPath READ modemPath WRITE setModemPath NOTIFY modemPathChanged) + Q_PROPERTY(bool has3G READ has3G WRITE setHas3G NOTIFY has3GChanged) + +public: + explicit QOfonoMtkSettings(QObject *parent = 0); + ~QOfonoMtkSettings(); + + QString modemPath() const; + void setModemPath(const QString &path); + + bool has3G() const; + void setHas3G(bool has3G); + + bool isValid() const; +Q_SIGNALS: + void has3GChanged(bool has3G); + void modemPathChanged(const QString &path); + +public slots: + +private: + void updateProperty(const QString &property, const QVariant &value); + + QOfonoMtkSettingsPrivate *d_ptr; +private slots: + void propertyChanged(const QString &property,const QDBusVariant &value); +}; + +#endif // QOFONOMtkSettings_H Index: libqofono-ubuntu/src/src.pro =================================================================== --- libqofono-ubuntu.orig/src/src.pro +++ libqofono-ubuntu/src/src.pro @@ -48,6 +48,7 @@ XML_FILES += \ dbus/ofono_message_manager.xml \ dbus/ofono_messagewaiting.xml \ dbus/ofono_modem.xml \ + dbus/ofono_mtk_settings.xml \ dbus/ofono_network_operator.xml \ dbus/ofono_network_registration.xml \ dbus/ofono_phonebook.xml \ @@ -93,6 +94,7 @@ SOURCES += \ qofonomessage.cpp \ qofonomessagemanager.cpp \ qofonomessagewaiting.cpp \ + qofonomtksettings.cpp \ qofonosimmanager.cpp \ qofonosimwatcher.cpp \ qofonophonebook.cpp \ @@ -133,6 +135,7 @@ PUBLIC_HEADERS += \ qofonomessage.h \ qofonomessagemanager.h \ qofonomessagewaiting.h \ + qofonomtksettings.h \ qofonosimmanager.h \ qofonosimwatcher.h \ qofonophonebook.h \ @@ -261,6 +264,11 @@ ofono_modem.files = dbus/ofono_modem.xml ofono_modem.header_flags = -N -c OfonoModem ofono_modem.source_flags = -N -c OfonoModem +DBUS_INTERFACES += ofono_mtk_settings +ofono_mtk_settings.files = dbus/ofono_mtk_settings.xml +ofono_mtk_settings.header_flags = -N -c OfonoMtkSettings +ofono_mtk_settings.source_flags = -N -c OfonoMtkSettings + DBUS_INTERFACES += ofono_network_operator ofono_network_operator.files = dbus/ofono_network_operator.xml ofono_network_operator.header_flags = -N -c OfonoNetworkOperator Index: libqofono-ubuntu/test/auto/tests/tests.pro =================================================================== --- libqofono-ubuntu.orig/test/auto/tests/tests.pro +++ libqofono-ubuntu/test/auto/tests/tests.pro @@ -11,6 +11,7 @@ SUBDIRS += \ tst_qofonosimmanager.pro \ tst_qofonomessagewaiting.pro \ tst_qofonomessagemanager.pro \ + tst_qofonomtksettings.pro \ tst_qofonoradiosettings.pro \ tst_qofonocallbarring.pro \ tst_qofonocallforwarding.pro \ Index: libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.cpp =================================================================== --- /dev/null +++ libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.cpp @@ -0,0 +1,61 @@ +/* + * + * Copyright (C) 2014 Canonical Ltd. + * Contact: Jonas G. Drange + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include + +#include "../../../src/qofonomtksettings.h" + +#include + +class TestQOfonoMtkSettings : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase() + { + m = new QOfonoMtkSettings(this); + m->setModemPath("/phonesim"); + QCOMPARE(m->isValid(), true); + + QEXPECT_FAIL("", "mtk settings is not supported by phonesim", Abort); + QVERIFY(false); + } + + void testQOfonoMtkSettings() + { + QSignalSpy has3G(m, SIGNAL(has3GChanged(bool))); + + qDebug() << "has3G():" << m->has3G(); + } + + void cleanupTestCase() + { + + } + +private: + QOfonoMtkSettings *m; +}; + +QTEST_MAIN(TestQOfonoMtkSettings) +#include "tst_qofonomtksettings.moc" Index: libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.pro =================================================================== --- /dev/null +++ libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.pro @@ -0,0 +1,2 @@ +include(testcase.pri) +SOURCES += tst_qofonomtksettings.cpp debian/patches/connman-resetcontexts.patch0000644000000000000000000000721612762041145016207 0ustar Index: libqofono-ubuntu/src/dbus/ofono_connection_manager.xml =================================================================== --- libqofono-ubuntu.orig/src/dbus/ofono_connection_manager.xml +++ libqofono-ubuntu/src/dbus/ofono_connection_manager.xml @@ -18,6 +18,7 @@ + Index: libqofono-ubuntu/src/qofonoconnectionmanager.cpp =================================================================== --- libqofono-ubuntu.orig/src/qofonoconnectionmanager.cpp +++ libqofono-ubuntu/src/qofonoconnectionmanager.cpp @@ -143,6 +143,21 @@ void QOfonoConnectionManager::removeCont } } +void QOfonoConnectionManager::resetContexts() +{ + OfonoConnectionManager *iface = (OfonoConnectionManager*)dbusInterface(); + if (iface) { + QDBusPendingReply<> deactivate = iface->DeactivateAll(); + deactivate.waitForFinished(); + QDBusPendingReply<> reset = iface->ResetContexts(); + reset.waitForFinished(); + if (reset.isError()) { + qDebug() << reset.error(); + Q_EMIT reportError(reset.error().message()); + } + } +} + bool QOfonoConnectionManager::attached() const { return getBool("Attached"); Index: libqofono-ubuntu/src/qofonoconnectionmanager.h =================================================================== --- libqofono-ubuntu.orig/src/qofonoconnectionmanager.h +++ libqofono-ubuntu/src/qofonoconnectionmanager.h @@ -79,6 +79,7 @@ public slots: void deactivateAll(); void addContext(const QString &type); void removeContext(const QString &path); + void resetContexts(); private slots: void onAddContextFinished(QDBusPendingCallWatcher *watch); Index: libqofono-ubuntu/test/auto/tests/tst_qofonoconnman.cpp =================================================================== --- libqofono-ubuntu.orig/test/auto/tests/tst_qofonoconnman.cpp +++ libqofono-ubuntu/test/auto/tests/tst_qofonoconnman.cpp @@ -107,8 +107,45 @@ private slots: QCOMPARE(rem.count(), 0); } + void testResetContexts() + { + Q_FOREACH (QString context, m->contexts()) { + m->removeContext(context); + } + QTRY_VERIFY(m->contexts().isEmpty()); + + QSignalSpy pow(m, SIGNAL(poweredChanged(bool))); + QSignalSpy add(m, SIGNAL(contextAdded(QString))); + QSignalSpy rem(m, SIGNAL(contextRemoved(QString))); + + // Add new context. + m->addContext(QString("internet")); + QTRY_COMPARE(add.count(), 1); + QString path = add.takeFirst().at(0).toString(); + QOfonoConnectionContext* contextInternet = new QOfonoConnectionContext(this); + contextInternet->setContextPath(path); + + // We activate context to make sure connman is deactivating on reset. + contextInternet->setActive(true); + QTRY_VERIFY(contextInternet->active()); + + // Connman needs to be powered down before calling reset. + m->setPowered(false); + QTRY_COMPARE(pow.count(), 1); + QCOMPARE(pow.takeFirst().at(0).toBool(), false); + QCOMPARE(m->powered(), false); + + m->resetContexts(); + QTRY_COMPARE(rem.count(), 1); + } + void cleanupTestCase() { + QSignalSpy pow(m, SIGNAL(poweredChanged(bool))); + m->setPowered(true); + QTRY_COMPARE(pow.count(), 1); + QCOMPARE(pow.takeFirst().at(0).toBool(), true); + QCOMPARE(m->powered(), true); } private: debian/patches/series0000644000000000000000000000011712762041145012033 0ustar context-preferred.patch connman-resetcontexts.patch mtk_settings_binding.patch