[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-logger</param>
<param name="branch">master</param>
- <param name="revision">da5760b</param>
+ <param name="revision">72d852c</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/.gitmodules
^
|
@@ -4,6 +4,9 @@
[submodule "libdbuslog"]
path = logger/src/libdbuslog
url = https://git.merproject.org/mer-core/libdbuslog.git
-[submodule "logger/src/libglibutil"]
+[submodule "libglibutil"]
path = logger/src/libglibutil
url = https://git.merproject.org/mer-core/libglibutil.git
+[submodule "libqofonoext"]
+ path = ofono/src/libqofonoext
+ url = https://git.merproject.org/mer-core/libqofonoext.git
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/logger/include/LoggerMain.h
^
|
@@ -34,10 +34,46 @@
#define LOGGER_MAIN_H
#include <QString>
+#include <QObject>
-namespace Logger {
- int Main(int aArgc, char* aArgv[], const char* aService, QString aPackage,
- QString aQmlPath);
-}
+class QQuickView;
+class QGuiApplication;
+
+class LoggerMain : public QObject {
+ Q_OBJECT
+
+public:
+ LoggerMain(int* aArgc, char** aArgv, const char* aService,
+ QString aPackage, QString aQmlPath);
+ virtual ~LoggerMain();
+
+ int run();
+
+ // Quick way to run the app
+ static int Run(int aArgc, char** aArgv, const char* aService,
+ QString aPackage, QString aQmlPath);
+
+protected:
+ bool saveOutput(const char* aExe, const char* const aArgv[], QString aOut);
+ bool saveOutput(const char* aExe, const char* aArg1, const char* aArg2,
+ QString aOut);
+ bool saveOutput(const char* aExe, const char* aArg1, const char* aArg2,
+ const char* aArg3, const char* aArg4, const char* aArg5,
+ const char* aArg6, QString aOut);
+
+ // These are invoked by run()
+ virtual void loadTranslations();
+ virtual void saveFilesAtStartup(QString aDir);
+ virtual void setupView(QQuickView* aView);
+
+protected:
+ QGuiApplication* iApp;
+ QString iService;
+ QString iPackage;
+ QString iQmlPath;
+ struct dbus_log_client* iClient;
+ QString iFullAppName;
+ QString iTransDir;
+};
#endif // LOGGER_MAIN_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/logger/qml/pages/LogPage.qml
^
|
@@ -37,7 +37,7 @@
SilicaFlickable {
id: page
property var logModel: LogModel
- property string fontFamily: "Monospace"
+ readonly property string fontFamily: "Monospace"
function packAndShare() {
LogSaver.pack()
@@ -56,11 +56,47 @@
}
Component.onCompleted: {
+ // Dynamically bind custom menu item
+ if (customLogMenuItem) {
+ customMenuItem.clicked.connect(customLogMenuItem.clicked)
+ customLogMenuItemTextComponent.createObject(page)
+ customLogMenuItemVisibleComponent.createObject(page)
+ if (customLogMenuItem.active !== undefined) {
+ customLogMenuItemActiveComponent.createObject(page)
+ }
+ }
if (logModel.connected) {
connected()
}
}
+ Component {
+ id: customLogMenuItemTextComponent
+ Binding {
+ target: customMenuItem
+ property: "text"
+ value: customLogMenuItem.text
+ }
+ }
+
+ Component {
+ id: customLogMenuItemVisibleComponent
+ Binding {
+ target: customMenuItem
+ property: "visible"
+ value: customLogMenuItem.visible
+ }
+ }
+
+ Component {
+ id: customLogMenuItemActiveComponent
+ Binding {
+ target: customLogMenuItem
+ property: "active"
+ value: pullDownMenu.active
+ }
+ }
+
Connections {
target: logModel
//% "Log cleared"
@@ -78,6 +114,10 @@
PullDownMenu {
id: pullDownMenu
MenuItem {
+ id: customMenuItem
+ visible: false
+ }
+ MenuItem {
//% "Clear log"
text: qsTrId("logger-logpage-pm-clear-log")
onClicked: logModel.clear()
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/logger/qml/pages/MainPage.qml
^
|
@@ -36,6 +36,7 @@
Page {
id: mainPage
allowedOrientations: window.allowedOrientations
+ property var customLogMenuItem
readonly property var pages: [ logPage, categoryPage ]
readonly property bool swipeHintEnabled: loggerHints.categoryLeftSwipe < loggerHints.categoryLeftSwipeMax
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/logger/src/LoggerEntry.h
^
|
@@ -35,6 +35,7 @@
#include <QString>
#include <QDateTime>
+#include <QMetaType>
#include "dbuslog_message.h"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/logger/src/LoggerMain.cpp
^
|
@@ -49,6 +49,7 @@
#include <fcntl.h>
#include <unistd.h>
+#include <errno.h>
#undef signals
#include "dbuslog_client.h"
@@ -59,71 +60,134 @@
qmlRegisterType<HarbourTransferMethodsModel>(uri, v1, v2, "TransferMethodsModel");
}
-int Logger::Main(int aArgc, char* aArgv[], const char* aService,
- QString aPackage, QString aQmlPath)
+LoggerMain::LoggerMain(int* aArgc, char** aArgv, const char* aService,
+ QString aPackage, QString aQmlPath) :
+ iApp(SailfishApp::application(*aArgc, aArgv)),
+ iService(aService),
+ iPackage(aPackage),
+ iQmlPath(aQmlPath),
+ iClient(dbus_log_client_new(G_BUS_TYPE_SYSTEM, aService, "/",
+ DBUSLOG_CLIENT_FLAG_AUTOSTART)),
+#ifdef OPENREPOS
+ iFullAppName(QString("openrepos-logger-") + aPackage),
+ iTransDir("/usr/share/translations")
+#else
+ iFullAppName(QString("harbour-logger-") + aPackage),
+ iTransDir(SailfishApp::pathTo("translations").toLocalFile())
+#endif
{
- QGuiApplication* app = SailfishApp::application(aArgc, aArgv);
-
QString pluginPrefix(QString("harbour.logger.") + aPackage);
register_types(qPrintable(pluginPrefix));
HarbourTransferMethodInfo::registerTypes();
+}
- // Load translations
+LoggerMain::~LoggerMain()
+{
+ dbus_log_client_unref(iClient);
+ delete iApp;
+}
+
+void LoggerMain::loadTranslations()
+{
QLocale locale;
- QTranslator* translator = new QTranslator(app);
-#ifdef OPENREPOS
- QString fullAppName(QString("openrepos-logger-") + aPackage);
- QString transDir("/usr/share/translations");
-#else
- QString fullAppName(QString("harbour-logger-") + aPackage);
- QString transDir = SailfishApp::pathTo("translations").toLocalFile();
-#endif
- if (translator->load(locale, fullAppName, "-", transDir) ||
- translator->load(fullAppName, transDir)) {
- app->installTranslator(translator);
+ QTranslator* translator = new QTranslator(iApp);
+ if (translator->load(locale, iFullAppName, "-", iTransDir) ||
+ translator->load(iFullAppName, iTransDir)) {
+ iApp->installTranslator(translator);
} else {
- HWARN("Failed to load" << qPrintable(fullAppName) << "translations for" << locale);
- HDEBUG("Translation directory" << transDir);
- HDEBUG("App name" << fullAppName);
+ HWARN("Failed to load" << qPrintable(iFullAppName) << "translations for" << locale);
+ HDEBUG("Translation directory" << iTransDir);
+ HDEBUG("App name" << iFullAppName);
delete translator;
}
- translator = new QTranslator(app);
+ translator = new QTranslator(iApp);
if (HarbourTransferMethodsModel::loadTranslations(translator, locale) ||
HarbourTransferMethodsModel::loadTranslations(translator, QLocale("en_GB"))) {
- app->installTranslator(translator);
+ iApp->installTranslator(translator);
} else {
delete translator;
}
+}
- // Signal handler
- HarbourSigChildHandler* sigChild = HarbourSigChildHandler::install(app);
+bool LoggerMain::saveOutput(const char* aExe, const char* const aArgv[],
+ QString aOut)
+{
+ int fd = open(qPrintable(aOut), O_WRONLY | O_CREAT, 0644);
+ if (fd >= 0) {
+ pid_t pid = fork();
+ if (!pid) {
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDERR_FILENO);
+ execvp(aExe, (char**)aArgv);
+ }
+ close(fd);
+ HDEBUG(pid << qPrintable(aOut));
+ return true;
+ } else {
+ HWARN(qPrintable(aOut) << strerror(errno));
+ return false;
+ }
+}
- // Log client and models
- DBusLogClient* client = dbus_log_client_new(G_BUS_TYPE_SYSTEM,
- aService, "/", DBUSLOG_CLIENT_FLAG_AUTOSTART);
- LoggerSettings* logSettings = new LoggerSettings(fullAppName, app);
- LoggerLogModel* logModel = new LoggerLogModel(logSettings, client, app);
- LoggerCategoryListModel* categoryModel = new LoggerCategoryListModel(client, app);
- LoggerLogSaver* logSaver = new LoggerLogSaver(aPackage, app);
- logSaver->connect(logModel, SIGNAL(entryAdded(LoggerEntry)), SLOT(addEntry(LoggerEntry)));
- logSaver->connect(sigChild, SIGNAL(processDied(int,int)), SLOT(onProcessDied(int,int)));
+bool LoggerMain::saveOutput(const char* aExe, const char* aArg1,
+ const char* aArg2, QString aOut)
+{
+ const char* argv[4];
+ argv[0] = aExe;
+ argv[1] = aArg1;
+ argv[2] = aArg2;
+ argv[3] = NULL;
+ return saveOutput(aExe, argv, aOut);
+}
+bool LoggerMain::saveOutput(const char* aExe, const char* aArg1,
+ const char* aArg2, const char* aArg3, const char* aArg4,
+ const char* aArg5, const char* aArg6, QString aOut)
+{
+ const char* argv[8];
+ argv[0] = aExe;
+ argv[1] = aArg1;
+ argv[2] = aArg2;
+ argv[3] = aArg3;
+ argv[4] = aArg4;
+ argv[5] = aArg5;
+ argv[6] = aArg6;
+ argv[7] = NULL;
+ return saveOutput(aExe, argv, aOut);
+}
+
+void LoggerMain::saveFilesAtStartup(QString aDir)
+{
// Copy OS version
- QString dir(logSaver->dirName());
- QFile::copy("/etc/sailfish-release", dir + "/sailfish-release");
+ QFile::copy("/etc/sailfish-release", aDir + "/sailfish-release");
// And the package version
- QString pkgVersionFile(dir + "/" + aPackage + "-version");
- int pkgVersionFd = open(qPrintable(pkgVersionFile), O_WRONLY | O_CREAT, 0644);
- if (pkgVersionFd >= 0) {
- if (fork() == 0) {
- dup2(pkgVersionFd, STDOUT_FILENO);
- dup2(pkgVersionFd, STDERR_FILENO);
- execlp("rpm", "rpm", "-q", qPrintable(aPackage), NULL);
- }
- close(pkgVersionFd);
- }
+ saveOutput("rpm", "-q", qPrintable(iPackage),
+ aDir + "/" + iPackage + "-version");
+}
+
+void LoggerMain::setupView(QQuickView* aView)
+{
+}
+
+int LoggerMain::run()
+{
+ loadTranslations();
+
+ // Signal handler
+ HarbourSigChildHandler* sigChild = HarbourSigChildHandler::install(iApp);
+
+ // Models and stuff
+ LoggerSettings* logSettings = new LoggerSettings(iFullAppName, iApp);
+ LoggerLogModel* logModel = new LoggerLogModel(logSettings, iClient, iApp);
+ LoggerCategoryListModel* categoryModel = new LoggerCategoryListModel(iClient, iApp);
+ LoggerLogSaver* logSaver = new LoggerLogSaver(iPackage, iApp);
+ logSaver->connect(logModel, SIGNAL(entryAdded(LoggerEntry)), SLOT(addEntry(LoggerEntry)));
+ logSaver->connect(sigChild, SIGNAL(processDied(int,int)), SLOT(onProcessDied(int,int)));
+
+ // Save some files
+ saveFilesAtStartup(logSaver->dirName());
// Create and show the view
QQuickView* view = SailfishApp::createView();
@@ -132,14 +196,23 @@
context->setContextProperty("LogModel", logModel);
context->setContextProperty("LogSaver", logSaver);
context->setContextProperty("CategoryModel", categoryModel);
- context->setContextProperty("AppName", QString(fullAppName));
- view->setSource(SailfishApp::pathTo(aQmlPath));
+ context->setContextProperty("AppName", iFullAppName);
+
+ setupView(view);
+ view->setSource(SailfishApp::pathTo(iQmlPath));
view->showFullScreen();
- int ret = app->exec();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/ofono.pro
^
|
@@ -17,7 +17,7 @@
CONFIG += sailfishapp link_pkgconfig
PKGCONFIG += sailfishapp mlite5 gio-2.0 gio-unix-2.0 glib-2.0
-#QT += dbus
+QT += dbus
WARNINGS = -Wall -Wno-unused-parameter -Wno-deprecated-declarations
QMAKE_CXXFLAGS += $$WARNINGS -Wno-psabi
@@ -35,6 +35,7 @@
# Directories
HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
LOGGER_LIB_DIR = $$_PRO_FILE_PWD_/../logger
+QOFONOEXT_LIB_DIR = $$_PRO_FILE_PWD_/src/libqofonoext
# Libraries
HARBOUR_LIB = $$OUT_PWD/../harbour-lib/libharbour-lib.a
@@ -61,6 +62,29 @@
qml_pages.path = $${TARGET_DATA_DIR}/qml
INSTALLS += qml_pages
+INCLUDEPATH += \
+ src \
+ $${LOGGER_LIB_DIR}/include \
+ $${HARBOUR_LIB_DIR}/include \
+ $${QOFONOEXT_LIB_DIR}/src
+
+HEADERS += \
+ $${QOFONOEXT_LIB_DIR}/src/qofonoextmodemmanager.h
+
+SOURCES += \
+ src/main.cpp \
+ $${QOFONOEXT_LIB_DIR}/src/qofonoext.cpp \
+ $${QOFONOEXT_LIB_DIR}/src/qofonoextmodemmanager.cpp
+
+# D-Bus interfaces
+DBUS_INTERFACES += org_nemomobile_ofono_modem_manager
+org_nemomobile_ofono_modem_manager.files = $${QOFONOEXT_LIB_DIR}/src/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
+
+OTHER_FILES += \
+ $${org_nemomobile_ofono_modem_manager.files}
+
# Settings
app_settings {
settings_json.files = $${LOGGER_LIB_DIR}/settings/$${TARGET}.json
@@ -93,13 +117,6 @@
INSTALLS += $${icon_target}
}
-INCLUDEPATH += \
- src \
- $${LOGGER_LIB_DIR}/include
-
-SOURCES += \
- src/main.cpp
-
# Translations
TRANSLATION_SOURCES = \
$${_PRO_FILE_PWD_}/qml \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/qml/main.qml
^
|
@@ -47,6 +47,27 @@
filter: LogSaver.archiveType
}
allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted
- initialPage: Component { MainPage { } }
+ initialPage: Component {
+ MainPage {
+ customLogMenuItem: MenuItem {
+ id: fixMobileDataMenuItem
+ property bool active
+ //: Pull-down menu item
+ //% "Fix mobile data"
+ text: qsTrId("ofono-logger-pm-fix-mobile-data")
+ onClicked: OfonoLogger.fixMobileData()
+ onActiveChanged: if (!active) visible = OfonoLogger.mobileDataBroken
+ Component.onCompleted: visible = OfonoLogger.mobileDataBroken
+ }
+ Connections {
+ target: OfonoLogger
+ onMobileDataBrokenChanged: {
+ if (!fixMobileDataMenuItem.active) {
+ fixMobileDataMenuItem.visible = OfonoLogger.mobileDataBroken
+ }
+ }
+ }
+ }
+ }
cover: Component { CoverPage { } }
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext
^
|
+(directory)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/.gitignore
^
|
@@ -0,0 +1,4 @@
+*~
+build
+.DS_Store
+*.pro.user
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/README
^
|
@@ -0,0 +1,4 @@
+qofono-ext
+=========
+
+A library for accessing nemomobile specific ofono extensions, and a declarative plugin for it.
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/libqofonoext.pro
^
|
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS += src plugin
+OTHER_FILES += rpm/libqofonoext.spec README
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/plugin.pro
^
|
@@ -0,0 +1,31 @@
+TARGET=qofonoextdeclarative
+TEMPLATE = lib
+CONFIG += plugin link_pkgconfig
+PKGCONFIG += qofono-qt5
+QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
+
+QT_VERSION=$$[QT_VERSION]
+
+QT += qml dbus
+QT -= gui
+LIBS += -L../src -lqofonoext
+
+INCLUDEPATH += ../src
+
+SOURCES = \
+ qofonoextdeclarativeplugin.cpp \
+ qofonoextmodemlistmodel.cpp \
+ qofonoextsimlistmodel.cpp
+
+HEADERS = \
+ qofonoextdeclarativeplugin.h \
+ qofonoextmodemlistmodel.h \
+ qofonoextsimlistmodel.h
+
+OTHER_FILES += qmldir
+
+target.path = $$[QT_INSTALL_QML]/org/nemomobile/ofono
+qmldir.path = $$[QT_INSTALL_QML]/org/nemomobile/ofono
+qmldir.files += qmldir
+
+INSTALLS += target qmldir
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/qmldir
^
|
@@ -0,0 +1,2 @@
+module org.nemomobile.ofono
+plugin qofonoextdeclarative
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextdeclarativeplugin.cpp
^
|
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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
+** 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 "qofonoextdeclarativeplugin.h"
+#include "qofonoextmodemlistmodel.h"
+#include "qofonoextmodemmanager.h"
+#include "qofonoextsiminfo.h"
+#include "qofonoextsimlistmodel.h"
+#include "qofonoextmodemlistmodel.h"
+#include "qofonoextcellinfo.h"
+#include "qofonoextcell.h"
+
+#include <QtQml>
+
+void QOfonoExtDeclarativePlugin::registerTypes(const char* aUri, int aMajor, int aMinor)
+{
+ Q_ASSERT(QLatin1String(aUri) == "org.nemomobile.ofono");
+ qmlRegisterType<QOfonoExtModemManager>(aUri, aMajor, aMinor, "OfonoModemManager");
+ qmlRegisterType<QOfonoExtModemListModel>(aUri, aMajor, aMinor, "OfonoModemListModel");
+ 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)
+{
+ registerTypes(aUri, 1, 0);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextdeclarativeplugin.h
^
|
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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
+** 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 QOFONOEXTDECLARATIVEPLUGIN_H
+#define QOFONOEXTDECLARATIVEPLUGIN_H
+
+#include "qofonoext_types.h"
+
+#include <QQmlExtensionPlugin>
+
+class QOFONOEXT_EXPORT QOfonoExtDeclarativePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ void registerTypes(const char* aUri);
+ static void registerTypes(const char* aUri, int aMajor, int aMinor);
+};
+
+#endif // QOFONOEXTDECLARATIVEPLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextmodemlistmodel.cpp
^
|
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** 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
+** 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 "qofonoextmodemlistmodel.h"
+
+QOfonoExtModemListModel::QOfonoExtModemListModel(QObject* aParent) :
+ QAbstractListModel(aParent),
+ iModemManager(QOfonoExtModemManager::instance()),
+ iAvailableModems(iModemManager->availableModems()),
+ iEnabledModems(iModemManager->enabledModems()),
+ iDefaultVoiceModem(iModemManager->defaultVoiceModem()),
+ iDefaultDataModem(iModemManager->defaultDataModem())
+{
+ connect(iModemManager.data(),
+ SIGNAL(validChanged(bool)),
+ SLOT(onValidChanged(bool)));
+ connect(iModemManager.data(),
+ SIGNAL(availableModemsChanged(QStringList)),
+ SLOT(onAvailableModemsChanged(QStringList)));
+ connect(iModemManager.data(),
+ SIGNAL(enabledModemsChanged(QStringList)),
+ SLOT(onEnabledModemsChanged(QStringList)));
+ connect(iModemManager.data(),
+ SIGNAL(defaultDataModemChanged(QString)),
+ SLOT(onDefaultDataModemChanged(QString)));
+ connect(iModemManager.data(),
+ SIGNAL(defaultVoiceModemChanged(QString)),
+ SLOT(onDefaultVoiceModemChanged(QString)));
+ connect(iModemManager.data(),
+ SIGNAL(presentSimChanged(int,bool)),
+ SLOT(onPresentSimChanged(int,bool)));
+}
+
+bool QOfonoExtModemListModel::valid() const
+{
+ return iModemManager->valid();
+}
+
+int QOfonoExtModemListModel::count() const
+{
+ return iAvailableModems.count();
+}
+
+QHash<int,QByteArray> QOfonoExtModemListModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[PathRole] = "path";
+ roles[EnabledRole] = "enabled";
+ roles[DefaultDataRole] = "defaultForData";
+ roles[DefaultVoiceRole] = "defaultForVoice";
+ roles[SimPresentRole] = "simPresent";
+ roles[IMEIRole] = "imei";
+ return roles;
+}
+
+int QOfonoExtModemListModel::rowCount(const QModelIndex& aParent) const
+{
+ return iAvailableModems.count();
+}
+
+QVariant QOfonoExtModemListModel::data(const QModelIndex& aIndex, int aRole) const
+{
+ const int row = aIndex.row();
+ if (row >= 0 && row < iAvailableModems.count()) {
+ switch (aRole) {
+ case PathRole: return iAvailableModems.at(row);
+ case EnabledRole: return iEnabledModems.contains(iAvailableModems.at(row));
+ case DefaultDataRole: return iAvailableModems.indexOf(iDefaultDataModem) == row;
+ case DefaultVoiceRole: return iAvailableModems.indexOf(iDefaultVoiceModem) == row;
+ case SimPresentRole: return iModemManager->simPresentAt(row);
+ case IMEIRole: return iModemManager->imeiAt(row);
+ }
+ }
+ qWarning() << aIndex << aRole;
+ return QVariant();
+}
+
+bool QOfonoExtModemListModel::setData(const QModelIndex& aIndex, const QVariant& aValue, int aRole)
+{
+ const int row = aIndex.row();
+ if (row >= 0 && row < iAvailableModems.count() && aRole == EnabledRole) {
+ const bool enabled = aValue.toBool();
+ const QString& path(iAvailableModems.at(row));
+ const int index = iEnabledModems.indexOf(path);
+ if (enabled != (index >= 0)) {
+ QStringList enabledModems = iEnabledModems;
+ if (enabled) {
+ enabledModems.append(path);
+ } else {
+ enabledModems.removeAt(index);
+ }
+ iModemManager->setEnabledModems(enabledModems);
+ }
+ return true;
+ }
+ return false;
+}
+
+void QOfonoExtModemListModel::onValidChanged(bool aValid)
+{
+ if (aValid) {
+ beginResetModel();
+ endResetModel();
+ }
+ Q_EMIT validChanged(aValid);
+}
+
+void QOfonoExtModemListModel::onAvailableModemsChanged(QStringList aModems)
+{
+ const bool countHasChanged = iAvailableModems.count() != aModems.count();
+ beginResetModel();
+ iAvailableModems = aModems;
+ endResetModel();
+ if (countHasChanged) {
+ Q_EMIT countChanged(iAvailableModems.count());
+ }
+}
+
+void QOfonoExtModemListModel::onEnabledModemsChanged(QStringList aModems)
+{
+ if (iEnabledModems != aModems) {
+ QStringList prevModems = iEnabledModems;
+ iEnabledModems = aModems;
+ const int n = iAvailableModems.count();
+ QVector<int> role;
+ role.append(EnabledRole);
+ for (int i=0; i<n; i++) {
+ const QString& path(iAvailableModems.at(i));
+ if (prevModems.contains(path) != aModems.contains(path)) {
+ QModelIndex index(createIndex(i, 0));
+ Q_EMIT dataChanged(index, index, role);
+ }
+ }
+ }
+}
+
+void QOfonoExtModemListModel::onDefaultDataModemChanged(QString aModemPath)
+{
+ const int prevIndex = iAvailableModems.indexOf(iDefaultDataModem);
+ iDefaultDataModem = aModemPath;
+ defaultModemChanged(DefaultDataRole, prevIndex, iAvailableModems.indexOf(aModemPath));
+}
+
+void QOfonoExtModemListModel::onDefaultVoiceModemChanged(QString aModemPath)
+{
+ const int prevIndex = iAvailableModems.indexOf(iDefaultVoiceModem);
+ iDefaultVoiceModem = aModemPath;
+ defaultModemChanged(DefaultVoiceRole, prevIndex, iAvailableModems.indexOf(aModemPath));
+}
+
+void QOfonoExtModemListModel::onPresentSimChanged(int aIndex, bool aPresent)
+{
+ QVector<int> role;
+ role.append(SimPresentRole);
+ QModelIndex index(createIndex(aIndex, 0));
+ Q_EMIT dataChanged(index, index, role);
+}
+
+void QOfonoExtModemListModel::defaultModemChanged(Role aRole, int aPrevRow, int aNewRow)
+{
+ if (aPrevRow != aNewRow) {
+ QVector<int> role;
+ role.append(aRole);
+ if (aPrevRow >= 0) {
+ QModelIndex index(createIndex(aPrevRow, 0));
+ Q_EMIT dataChanged(index, index, role);
+ }
+ if (aNewRow >= 0) {
+ QModelIndex index(createIndex(aNewRow, 0));
+ Q_EMIT dataChanged(index, index, role);
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextmodemlistmodel.h
^
|
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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
+** 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 QOFONOEXTMODEMLISTMODEL_H
+#define QOFONOEXTMODEMLISTMODEL_H
+
+#include "qofonoextmodemmanager.h"
+
+#include <QAbstractListModel>
+
+class QOfonoExtModemListModel : 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,
+ EnabledRole,
+ DefaultDataRole,
+ DefaultVoiceRole,
+ SimPresentRole,
+ IMEIRole
+ };
+
+ explicit QOfonoExtModemListModel(QObject* aParent = NULL);
+
+ bool valid() const;
+ int count() const;
+
+ QHash<int,QByteArray> roleNames() const;
+ int rowCount(const QModelIndex& aParent) const;
+ QVariant data(const QModelIndex& aIndex, int aRole) const;
+ bool setData(const QModelIndex& aIndex, const QVariant& aValue, int aRole);
+
+Q_SIGNALS:
+ void validChanged(bool aValid);
+ void countChanged(int aCount);
+
+private Q_SLOTS:
+ void onValidChanged(bool aValid);
+ void onAvailableModemsChanged(QStringList aModems);
+ void onEnabledModemsChanged(QStringList aModems);
+ void onDefaultDataModemChanged(QString aModemPath);
+ void onDefaultVoiceModemChanged(QString aModemPath);
+ void onPresentSimChanged(int aIndex, bool aPresent);
+
+private:
+ void defaultModemChanged(Role aRole, int aPrevRow, int aNewRow);
+
+private:
+ QSharedPointer<QOfonoExtModemManager> iModemManager;
+ QStringList iAvailableModems;
+ QStringList iEnabledModems;
+ QString iDefaultVoiceModem;
+ QString iDefaultDataModem;
+};
+
+#endif // QOFONOEXTMODEMLISTMODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/rpm/libqofonoext.spec
^
|
@@ -0,0 +1,69 @@
+Name: libqofonoext
+
+Summary: A library of Qt bindings for ofono extensions
+Version: 1.0.14
+Release: 1
+Group: System/Libraries
+License: LGPLv2.1
+URL: https://git.merproject.org/mer-core/libqofonoext
+Source0: libqofonoext-%{version}.tar.bz2
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+Requires: libqofono-qt5 >= 0.87
+BuildRequires: pkgconfig(Qt5Core)
+BuildRequires: pkgconfig(Qt5DBus)
+BuildRequires: pkgconfig(Qt5Quick)
+BuildRequires: pkgconfig(qofono-qt5) >= 0.87
+
+%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
+%{!?qtc_make:%define qtc_make make}
+
+%description
+This package contains Qt bindings for ofono extensions
+
+%package declarative
+Summary: Declarative plugin for libqofonoext
+Group: Development/Tools
+Requires: %{name} = %{version}-%{release}
+Requires: %{name} = %{version}
+
+%description declarative
+This package contains declarative plugin for libqofonoext
+
+%package devel
+Summary: Development files for libqofonoext
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: %{name} = %{version}
+
+%description devel
+This package contains the development header files for libqofonoext
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%qtc_qmake5
+%qtc_make %{?_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+%qmake5_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/%{name}.so.*
+
+%files declarative
+%defattr(-,root,root,-)
+%{_libdir}/qt5/qml/org/nemomobile/ofono
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/%{name}.so
+%{_libdir}/pkgconfig/qofonoext.pc
+%{_includedir}/qofonoext/*.h
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/dbus/org.nemomobile.ofono.ModemManager.xml
^
|
@@ -0,0 +1,112 @@
+<!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.ModemManager">
+ <method name="GetAll">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="availableModems" type="ao" direction="out"/>
+ <arg name="enabledModems" type="ao" direction="out"/>
+ <arg name="defaultDataSim" type="s" direction="out"/>
+ <arg name="defaultVoiceSim" type="s" direction="out"/>
+ <arg name="defaultDataModem" type="s" direction="out"/>
+ <arg name="defaultVoiceModem" type="s" direction="out"/>
+ </method>
+ <method name="GetAll2">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="availableModems" type="ao" direction="out"/>
+ <arg name="enabledModems" type="ao" direction="out"/>
+ <arg name="defaultDataSim" type="s" direction="out"/>
+ <arg name="defaultVoiceSim" type="s" direction="out"/>
+ <arg name="defaultDataModem" type="s" direction="out"/>
+ <arg name="defaultVoiceModem" type="s" direction="out"/>
+ <arg name="presentSims" type="ab" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out7" value="QOfonoExtBoolList"/>
+ </method>
+ <method name="GetAll3">
+ <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>
+ <method name="GetAvailableModems">
+ <arg name="modems" type="ao" direction="out"/>
+ </method>
+ <method name="GetEnabledModems">
+ <arg name="modems" type="ao" direction="out"/>
+ </method>
+ <method name="GetPresentSims">
+ <arg name="presentSims" type="ab" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QOfonoExtBoolList"/>
+ </method>
+ <method name="GetIMEI">
+ <arg name="imsi" type="as" direction="out"/>
+ </method>
+ <method name="GetDefaultDataSim">
+ <arg name="imsi" type="s" direction="out"/>
+ </method>
+ <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>
+ <method name="SetDefaultDataSim">
+ <arg name="imsi" type="s" direction="in"/>
+ </method>
+ <method name="SetDefaultVoiceSim">
+ <arg name="imsi" type="s" direction="in"/>
+ </method>
+ <signal name="EnabledModemsChanged">
+ <arg name="modems" type="ao"/>
+ </signal>
+ <signal name="PresentSimsChanged">
+ <arg name="index" type="i"/>
+ <arg name="present" type="b"/>
+ </signal>
+ <signal name="DefaultDataSimChanged">
+ <arg name="imsi" type="s"/>
+ </signal>
+ <signal name="DefaultVoiceSimChanged">
+ <arg name="imsi" type="s"/>
+ </signal>
+ <signal name="DefaultDataModemChanged">
+ <arg name="path" type="s"/>
+ </signal>
+ <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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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;
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/qofonoext.prf
^
|
@@ -0,0 +1,6 @@
+prefix=/usr
+exec_prefix=$${prefix}
+
+DEPENDPATH += $${prefix}/include/qofonoext
+INCLUDEPATH += $${prefix}/include/qofonoext
+LIBS += -L $${exec_prefix}/lib -lqofonoext
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/qofonoext_p.h
^
|
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** 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 QOFONOEXT_PRIVATE_H
+#define QOFONOEXT_PRIVATE_H
+
+#include "qofonoext_types.h"
+
+#include <QtDBus>
+
+#define OFONO_SERVICE "org.ofono"
+#define OFONO_BUS QDBusConnection::systemBus()
+
+typedef QList<bool> QOfonoExtBoolList;
+
+namespace QOfonoExt {
+ bool isTimeout(QDBusError aError);
+}
+
+#endif // QOFONOEXT_PRIVATE_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/qofonoext_types.h
^
|
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** 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 QOFONOEXT_TYPES_H
+#define QOFONOEXT_TYPES_H
+
+#include <QtCore>
+
+#if defined(QOFONOEXT_LIBRARY)
+# define QOFONOEXT_EXPORT Q_DECL_EXPORT
+#else
+# define QOFONOEXT_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // QOFONOEXT_TYPES_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/qofonoextmodemmanager.cpp
^
|
@@ -0,0 +1,585 @@
+/****************************************************************************
+**
+** 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
+** 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 "qofonoextmodemmanager.h"
+#include "qofonoext_p.h"
+
+#include "modemmanager_interface.h"
+
+class QOfonoExtModemManager::Private : public QObject
+{
+ Q_OBJECT
+
+public:
+ static QWeakPointer<QOfonoExtModemManager> sSharedInstance;
+
+ QOfonoExtModemManager* iParent;
+ QOfonoExtModemManagerProxy* iProxy;
+ QStringList iAvailableModems;
+ QStringList iEnabledModems;
+ QString iDefaultVoiceModem;
+ QString iDefaultDataModem;
+ QString iDefaultVoiceSim;
+ QString iDefaultDataSim;
+ QList<bool> iPresentSims;
+ QStringList iIMEIs;
+ QString iMmsSim;
+ QString iMmsModem;
+ int iPresentSimCount;
+ int iActiveSimCount;
+ int iInterfaceVersion;
+ bool iReady;
+ bool iValid;
+
+ Private(QOfonoExtModemManager* aParent);
+
+ static QStringList toStringList(QList<QDBusObjectPath> aList);
+ static QList<QDBusObjectPath> toPathList(QStringList aList);
+
+ 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);
+ void onDefaultDataModemChanged(QString aModemPath);
+ 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;
+
+QStringList QOfonoExtModemManager::Private::toStringList(QList<QDBusObjectPath> aList)
+{
+ QStringList stringList;
+ const int n = aList.count();
+ for (int i=0; i<n; i++) {
+ stringList.append(aList.at(i).path());
+ }
+ return stringList;
+}
+
+QList<QDBusObjectPath> QOfonoExtModemManager::Private::toPathList(QStringList aList)
+{
+ QList<QDBusObjectPath> pathList;
+ const int n = aList.count();
+ for (int i=0; i<n; i++) {
+ pathList.append(QDBusObjectPath(aList.at(i)));
+ }
+ return pathList;
+}
+
+QOfonoExtModemManager::Private::Private(QOfonoExtModemManager* aParent) :
+ QObject(aParent),
+ iParent(aParent),
+ iProxy(NULL),
+ iPresentSimCount(0),
+ iActiveSimCount(0),
+ iInterfaceVersion(0),
+ iReady(false),
+ iValid(false)
+{
+ QDBusServiceWatcher* ofonoWatcher = new QDBusServiceWatcher(OFONO_SERVICE,
+ OFONO_BUS, QDBusServiceWatcher::WatchForRegistration |
+ QDBusServiceWatcher::WatchForUnregistration, this);
+
+ connect(ofonoWatcher, SIGNAL(serviceRegistered(QString)),
+ this, SLOT(onServiceRegistered()));
+ connect(ofonoWatcher, SIGNAL(serviceUnregistered(QString)),
+ this, SLOT(onServiceUnregistered()));
+
+ if (OFONO_BUS.interface()->isServiceRegistered(OFONO_SERVICE)) {
+ onServiceRegistered();
+ }
+}
+
+void QOfonoExtModemManager::Private::onServiceRegistered()
+{
+ const bool wasValid = iValid;
+ if (!iProxy) {
+ iProxy = new QOfonoExtModemManagerProxy(OFONO_SERVICE, "/", OFONO_BUS, this);
+ if (iProxy->isValid()) {
+ iValid = false;
+ connect(iProxy,
+ SIGNAL(EnabledModemsChanged(QList<QDBusObjectPath>)),
+ SLOT(onEnabledModemsChanged(QList<QDBusObjectPath>)));
+ connect(iProxy,
+ SIGNAL(DefaultDataModemChanged(QString)),
+ SLOT(onDefaultDataModemChanged(QString)));
+ connect(iProxy,
+ SIGNAL(DefaultVoiceModemChanged(QString)),
+ SLOT(onDefaultVoiceModemChanged(QString)));
+ connect(iProxy,
+ SIGNAL(DefaultDataSimChanged(QString)),
+ SLOT(onDefaultDataSimChanged(QString)));
+ connect(iProxy,
+ SIGNAL(DefaultVoiceSimChanged(QString)),
+ SLOT(onDefaultVoiceSimChanged(QString)));
+ connect(iProxy,
+ SIGNAL(PresentSimsChanged(int,bool)),
+ SLOT(onPresentSimsChanged(int,bool)));
+ getInterfaceVersion();
+ } else {
+ delete iProxy;
+ iProxy = NULL;
+ }
+ }
+ if (wasValid != iValid) {
+ Q_EMIT iParent->validChanged(iValid);
+ }
+}
+
+void QOfonoExtModemManager::Private::onServiceUnregistered()
+{
+ if (iProxy) {
+ delete iProxy;
+ iProxy = NULL;
+ }
+ if (iValid) {
+ iValid = false;
+ Q_EMIT iParent->validChanged(iValid);
+ }
+}
+
+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);
+ if (reply.isError()) {
+ // Repeat the call on timeout
+ qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getInterfaceVersion();
+ }
+ } else {
+ const int version = reply.value();
+ if (iInterfaceVersion != version) {
+ iInterfaceVersion = version;
+ iParent->interfaceVersionChanged(version);
+ }
+ getAll();
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/qofonoextmodemmanager.h
^
|
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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
+** 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 QOFONOEXTMODEMMANAGER_H
+#define QOFONOEXTMODEMMANAGER_H
+
+#include "qofonoext_types.h"
+
+class QOFONOEXT_EXPORT QOfonoExtModemManager : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
+ Q_PROPERTY(int interfaceVersion READ interfaceVersion NOTIFY interfaceVersionChanged)
+ Q_PROPERTY(QStringList availableModems READ availableModems NOTIFY availableModemsChanged)
+ Q_PROPERTY(QStringList enabledModems READ enabledModems WRITE setEnabledModems NOTIFY enabledModemsChanged)
+ Q_PROPERTY(QString defaultDataModem READ defaultDataModem NOTIFY defaultDataModemChanged)
+ Q_PROPERTY(QString defaultVoiceModem READ defaultVoiceModem NOTIFY defaultVoiceModemChanged)
+ Q_PROPERTY(QString defaultDataSim READ defaultDataSim WRITE setDefaultDataSim NOTIFY defaultDataSimChanged)
+ 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)
+
+public:
+ explicit QOfonoExtModemManager(QObject* aParent = NULL);
+ ~QOfonoExtModemManager();
+
+ bool valid() const;
+ int interfaceVersion() const;
+ QStringList availableModems() const;
+ QStringList enabledModems() const;
+ QString defaultDataModem() const;
+ QString defaultVoiceModem() const;
+ QString defaultDataSim() const;
+ 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;
+
+ Q_INVOKABLE QString imeiAt(int aIndex) const;
+ Q_INVOKABLE bool simPresentAt(int aIndex) const;
+
+ void setEnabledModems(QStringList aModems);
+ void setDefaultDataSim(QString aImsi);
+ void setDefaultVoiceSim(QString aImsi);
+
+ static QSharedPointer<QOfonoExtModemManager> instance();
+
+Q_SIGNALS:
+ void validChanged(bool value);
+ void interfaceVersionChanged(int value);
+ void availableModemsChanged(QStringList value);
+ void enabledModemsChanged(QStringList value);
+ void defaultVoiceModemChanged(QString value);
+ void defaultDataModemChanged(QString value);
+ void defaultVoiceSimChanged(QString value);
+ void defaultDataSimChanged(QString value);
+ void presentSimsChanged(QList<bool> value);
+ void presentSimChanged(int index, bool present);
+ 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;
+ Private* iPrivate;
+};
+
+#endif // QOFONOEXTMODEMMANAGER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/src.pro
^
|
@@ -0,0 +1,84 @@
+TARGET = qofonoext
+CONFIG += create_pc create_prl no_install_prl link_pkgconfig
+PKGCONFIG += qofono-qt5
+
+QT += dbus
+QT -= gui
+QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
+
+include(version.pri)
+
+TEMPLATE = lib
+
+DEFINES += QOFONOEXT_LIBRARY
+
+isEmpty(PREFIX) {
+ PREFIX=/usr
+}
+
+XML_FILES += \
+ dbus/org.nemomobile.ofono.Cell.xml \
+ dbus/org.nemomobile.ofono.CellInfo.xml \
+ dbus/org.nemomobile.ofono.ModemManager.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 \
+ qofonoextsiminfo.cpp
+
+PUBLIC_HEADERS += \
+ qofonoextcell.h \
+ qofonoextcellinfo.h \
+ qofonoextcellwatcher.h \
+ qofonoextmodemmanager.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_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]
+
+headers.files = $$PUBLIC_HEADERS
+headers.path = $$INSTALL_ROOT$$PREFIX/include/qofonoext
+
+pkgconfig.files = qofonoext.pc
+pkgconfig.path = $$[QT_INSTALL_LIBS]/pkgconfig
+
+QMAKE_PKGCONFIG_NAME = $$TARGET
+QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+QMAKE_PKGCONFIG_INCDIR = $$headers.path
+QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings for ofono extensions
+QMAKE_PKGCONFIG_PREFIX = $$PREFIX
+QMAKE_PKGCONFIG_VERSION = $$VERSION
+
+INSTALLS += target headers pkgconfig
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/libqofonoext/src/version.pri
^
|
@@ -0,0 +1 @@
+VERSION = 1.0.14
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/src/main.cpp
^
|
@@ -31,8 +31,149 @@
*/
#include "LoggerMain.h"
+#include "HarbourDebug.h"
+
+#include "qofonoextmodemmanager.h"
+
+#include <QQuickView>
+#include <QQmlContext>
+
+#define OFONO_INTERFACE "org.ofono"
+#define OFONOEXT_INTERFACE "org.nemomobile.ofono"
+#define MODEM_MANAGER_INTERFACE OFONOEXT_INTERFACE ".ModemManager"
+
+#define SUPER LoggerMain
+
+class OfonoLogger: public SUPER {
+ Q_OBJECT
+ Q_PROPERTY(bool mobileDataBroken READ mobileDataBroken NOTIFY mobileDataBrokenChanged)
+ static const QString AUTO;
+public:
+ OfonoLogger(int* aArgc, char** aArgv);
+ bool mobileDataBroken() const;
+ Q_INVOKABLE void fixMobileData();
+
+private:
+ void dumpOfonoInfo(QString aPath, QString aService);
+ void maybeSaveFiles();
+ void saveFiles();
+
+protected:
+ virtual void saveFilesAtStartup(QString aDir);
+ virtual void setupView(QQuickView* aView);
+
+private Q_SLOTS:
+ void updateState();
+
+Q_SIGNALS:
+ void mobileDataBrokenChanged();
+
+private:
+ QString iSaveDir;
+ QOfonoExtModemManager* iModemManager;
+ bool iFilesSaved;
+ bool iMobileDataBroken;
+};
+
+const QString OfonoLogger::AUTO("auto");
+
+OfonoLogger::OfonoLogger(int* aArgc, char** aArgv) :
+ SUPER(aArgc, aArgv, "org.ofono", "ofono", "qml/main.qml"),
+ iModemManager(new QOfonoExtModemManager(this)),
+ iFilesSaved(false),
+ iMobileDataBroken(false)
+{
+ connect(iModemManager, SIGNAL(validChanged(bool)), SLOT(updateState()));
+ connect(iModemManager, SIGNAL(defaultDataSimChanged(QString)), SLOT(updateState()));
+ updateState();
+}
+
+inline bool OfonoLogger::mobileDataBroken() const
+{
+ return iMobileDataBroken;
+}
+
+void OfonoLogger::fixMobileData()
+{
+ HDEBUG("ok");
+ iModemManager->setDefaultDataSim(AUTO);
+}
+
+void OfonoLogger::updateState()
+{
+ maybeSaveFiles();
+ // On a single-SIM phone default data sim should be always set to "auto"
+ // because UI doesn't provide any way to change it.
+ bool broken = iModemManager->valid() &&
+ iModemManager->availableModems().count() == 1 &&
+ iModemManager->defaultDataSim() != AUTO;
+ if (iMobileDataBroken != broken) {
+ iMobileDataBroken = broken;
+ HDEBUG((broken ? "broken" : "ok"));
+ Q_EMIT mobileDataBrokenChanged();
+ }
+}
+
+void OfonoLogger::maybeSaveFiles()
+{
+ if (!iFilesSaved && !iSaveDir.isEmpty() && iModemManager->valid()) {
+ iFilesSaved = true;
+ saveFiles();
+ }
+}
+
+void OfonoLogger::saveFiles()
+{
+ // ModemManager.GetAll
+ const int ver = iModemManager->interfaceVersion();
+ QString dest = QString("--dest=%1").arg(iService);
+ QString call = QString(MODEM_MANAGER_INTERFACE ".GetAll%1").arg(ver);
+ QString fname = call.right(call.length() - sizeof(OFONOEXT_INTERFACE));
+ saveOutput("dbus-send", "--system", "--print-reply", "--type=method_call",
+ qPrintable(dest), "/", qPrintable(call),
+ iSaveDir + "/" + fname +".txt");
+
+ // Ofono information for each modem
+ QStringList modems = iModemManager->availableModems();
+ for (int i=0; i<modems.count(); i++) {
+ QString path(modems.at(i));
+ HDEBUG(path);
+ dumpOfonoInfo(path, "SimManager.GetProperties");
+ dumpOfonoInfo(path, "NetworkRegistration.GetProperties");
+ dumpOfonoInfo(path, "ConnectionManager.GetProperties");
+ }
+}
+
+void OfonoLogger::dumpOfonoInfo(QString aPath, QString aCall)
+{
+ QString suffix = QString(aPath).replace("/", "");
+ QString dest = QString("--dest=%1").arg(iService);
+ QString call = QString(OFONO_INTERFACE ".%1").arg(aCall);
+ saveOutput("dbus-send", "--system", "--print-reply", "--type=method_call",
+ qPrintable(dest), qPrintable(aPath), qPrintable(call),
+ iSaveDir + "/" + aCall + "." + suffix + ".txt");
+}
+
+void OfonoLogger::saveFilesAtStartup(QString aDir)
+{
+ iSaveDir = aDir;
+ maybeSaveFiles();
+ SUPER::saveFilesAtStartup(aDir);
+}
+
+void OfonoLogger::setupView(QQuickView* aView)
+{
+ QQmlContext* context = aView->rootContext();
+ context->setContextProperty("OfonoLogger", this);
+ SUPER::setupView(aView);
+}
Q_DECL_EXPORT int main(int argc, char* argv[])
{
- return Logger::Main(argc, argv, "org.ofono", "ofono", "qml/main.qml");
+ OfonoLogger* logger = new OfonoLogger(&argc, argv);
+ int ret = logger->run();
+ delete logger;
+ return ret;
}
+
+#include "main.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/translations/harbour-logger-ofono-ru.ts
^
|
@@ -11,6 +11,11 @@
<source>Swipe left to configure log categories</source>
<translation>Там справа что-то есть</translation>
</message>
+ <message id="ofono-logger-pm-fix-mobile-data">
+ <source>Fix mobile data</source>
+ <extracomment>Pull-down menu item</extracomment>
+ <translation>Починить мобильные данные</translation>
+ </message>
<message id="logger-logpage-pm-clear-log">
<source>Clear log</source>
<translation>Очистить журнал</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.5.tar.bz2/ofono/translations/harbour-logger-ofono.ts
^
|
@@ -11,6 +11,11 @@
<source>Swipe left to configure log categories</source>
<translation>Swipe left to configure log categories</translation>
</message>
+ <message id="ofono-logger-pm-fix-mobile-data">
+ <source>Fix mobile data</source>
+ <extracomment>Pull-down menu item</extracomment>
+ <translation>Fix mobile data</translation>
+ </message>
<message id="logger-logpage-pm-clear-log">
<source>Clear log</source>
<translation>Clear log</translation>
|