Commit 448fa79a authored by Jenkins's avatar Jenkins

Updated version 0.95 from 'upstream/0.95'

with Debian dir 3faff19b7e4c9d1c0ee2eb31f55fd6e15a89f0e5
parents f7c2c75a 525d1fcf
build
run
libqofono.pro.user*
*~
*.a
*.la
*.core
*.moc
*.o
*.obj
*.orig
*.swp
*.rej
*.so
*.pbxuser
*.mode1
*.mode1v3
*_pch.h.cpp
*_resource.rc
.#*
*.*#
core
.qmake.cache
.qmake.vars
config.log
*.prl
tags
.DS_Store
*.debug
Makefile*
*.app
*.pro.user
*.qmlproject.user
*.gcov
moc_*.cpp
ui_*.h
qrc_*.cpp
This diff is collapsed.
qofono
======
A library for accessing the ofono daemon, and a declarative plugin for it.
This allows accessing ofono in qtquick and friends.
- audio settings API
- cdma* API
- dundee API
- simtoolkit API
TEMPLATE = subdirs
SUBDIRS += src plugin test ofonotest
OTHER_FILES += \
rpm/libqofono-qt5.spec \
TODO \
README
src.target = src-target
plugin.depends = src-target
test.depends = src-target
ofonotest.depends = src-target
#!/bin/bash
# Determine project name based on current directory
#PROJECT=$(basename $PWD)
PROJECT=libqofono
# NOTE: Don't like this? Then uncomment one of the following as appropriate
#
# Just set it explictly to whatever you like:
# PROJECT=libseaside
#
# Parse it from any Qt *.pro or *.pri files in CWD:
# PROJECT=$(grep -E "TARGET ?= ?" *.pr[io]|cut -d' ' -f3)
while getopts qht: o
do case $o in
h) head=1;;
t) TAG="$OPTARG";;
q) PROJECT=libqofono-qt5;;
?) printf >&2 "Usage: $0 [-h] [-t TAG]\n"
exit 2;;
esac
done
# Grab most recent tag from git unless TAG is set
if [ -z "$TAG" ] ; then
TAG=$(git describe --tags --abbrev=0)
fi
# Parse out just the version number
#PARTS=(${TAG//-/ })
#VERSION=${PARTS[1]}
VERSION=${TAG}
# Set name of toplevel directory for the archive
PREFIX="${PROJECT}-${VERSION}/"
# Set name of resulting release archive file
ARCHIVE=${PROJECT}-${VERSION}.tar.bz2
[ -e ${ARCHIVE} ] && rm -rf ${ARCHIVE} && echo "Removed: ${ARCHIVE}"
if [ ! -z "$head" ] ; then
TAG="HEAD"
fi
git archive --format=tar --prefix=${PREFIX} $TAG | bzip2 -c -- > ${ARCHIVE} && {
echo "Created: ${ARCHIVE}"
} || {
echo "Creation of release archive ${ARCHIVE} failed. Reason unknown."
}
#include <QGuiApplication>
#include <QQmlApplicationEngine>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("/opt/examples/libqofono-qt5/qml/ofonotest/main.qml")));
return app.exec();
}
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=ofonotest
Exec=/opt/ofonotest/bin/ofonotest
Icon=ofonotest64
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
TEMPLATE = app
QT += qml quick
SOURCES += main.cpp
qml.files += \
qml/ofonotest/main.qml
qml.path = /opt/examples/libqofono-qt5/qml/ofonotest/main.qml
target.path = /opt/examples/libqofono-qt5/
INSTALLS += target qml
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=ofonotest
Exec=/usr/bin/invoker --type=d -s /opt/ofonotest/bin/ofonotest
Icon=/usr/share/icons/hicolor/80x80/apps/ofonotest80.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
import QtQuick 2.0
import MeeGo.QOfono 0.2
Rectangle {
width: 480
height: 560
Text {
id: textLine
anchors.centerIn: parent
}
Text {
id: textLine2
anchors.top: textLine.bottom
text: manager.available ? netreg.name : "Ofono not available"
}
MouseArea {
anchors.fill: parent
onClicked: {
context1.active = !context1.active
}
}
OfonoManager {
id: manager
onAvailableChanged: {
console.log("Ofono is " + available)
textLine2.text = manager.available ? netreg.currentOperator["Name"].toString() :"Ofono not available"
}
onModemAdded: {
console.log("modem added "+modem)
}
onModemRemoved: console.log("modem removed")
}
OfonoConnMan {
id: ofono1
Component.onCompleted: {
// console.log(manager.modems)
}
modemPath: manager.modems[0]
}
OfonoModem {
id: modem1
modemPath: manager.modems[0]
}
OfonoContextConnection {
id: context1
contextPath : ofono1.contexts[0]
Component.onCompleted: {
textLine.text = context1.active ? "online" : "offline"
}
onActiveChanged: {
textLine.text = context1.active ? "online" : "offline"
}
}
OfonoNetworkRegistration {
modemPath: manager.modems[0]
id: netreg
Component.onCompleted: {
netreg.scan()
}
onNetworkOperatorsChanged : {
console.log("operators :"+netreg.currentOperator["Name"].toString())
}
}
OfonoNetworkOperator {
id: netop
}
}
Name: ofonotest
Summary: A Mer application implemented in QML
Version: 0.1
Release: 1
Group: Qt/Qt
License: LICENSE
Sources:
- "%{name}-%{version}.tar.bz2"
Description: |
A short description Of the application.
# Qt Applications generally don't use configure and do use qmake
Configure: none
Builder: qmake
# pkgconfigs we depend on to build
PkgConfigBR:
- ""
# Packages we depend on to build
PkgBR:
- ""
# Packages we require to run
Requires:
- ""
Files:
- "/opt"
# This is a spectacle file.
# It is a yaml file that uses specify to manage the spec file used to package the application.
# See https://wiki.merproject.org/wiki/Spectacle for more information
TARGET=QOfonoQtDeclarative
TEMPLATE = lib
QT += dbus
CONFIG += plugin
QT_VERSION=$$[QT_VERSION]
QT += qml
QT -= gui
LIBS += -L../src -lqofono-qt5
SOURCES = \
qofonodeclarativeplugin.cpp \
qofononetworkoperatorlistmodel.cpp \
qofonosimlistmodel.cpp
HEADERS = \
qofonodeclarativeplugin.h \
qofononetworkoperatorlistmodel.h \
qofonosimlistmodel.h
INCLUDEPATH += ../src
OTHER_FILES += \
plugin.json plugins.qmltypes qmldir
equals(QT_MAJOR_VERSION, 4): {
qmldir.path = $$[QT_INSTALL_IMPORTS]/MeeGo/QOfono
target.path = $$[QT_INSTALL_IMPORTS]/MeeGo/QOfono
}
equals(QT_MAJOR_VERSION, 5): {
qmldir.path = $$[QT_INSTALL_QML]/MeeGo/QOfono
target.path = $$[QT_INSTALL_QML]/MeeGo/QOfono
}
qmldir.files += qmldir plugins.qmltypes
INSTALLS += target qmldir
qmltypes.commands = qmlplugindump -nonrelocatable MeeGo.QOfono 0.2 > $$PWD/plugins.qmltypes
QMAKE_EXTRA_TARGETS += qmltypes
This diff is collapsed.
module MeeGo.QOfono
plugin QOfonoQtDeclarative
typeinfo plugins.qmltypes
/****************************************************************************
**
** Copyright (C) 2013-2015 Jolla Ltd.
** Contact: lorn.potter@jollamobile.com
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
****************************************************************************/
#include "qofonodeclarativeplugin.h"
#include "qofonomanager.h"
#include "qofonomodem.h"
#include "qofonoconnectionmanager.h"
#include "qofonoconnectioncontext.h"
#include "qofononetworkregistration.h"
#include "qofononetworkoperator.h"
#include "qofonocellbroadcast.h"
#include "qofonocallbarring.h"
#include "qofonocallforwarding.h"
#include "qofonocallmeter.h"
#include "qofonocallsettings.h"
#include "qofonocallvolume.h"
#include "qofonomessage.h"
#include "qofonomessagemanager.h"
#include "qofonomessagewaiting.h"
#include "qofonosimmanager.h"
#include "qofonophonebook.h"
#include "qofonosmartmessaging.h"
#include "qofonosmartmessagingagent.h"
#include "qofonovoicecall.h"
#include "qofonovoicecallmanager.h"
#include "qofonoradiosettings.h"
#include "qofonosupplementaryservices.h"
#include "qofonophonebook.h"
#include "qofonotexttelephony.h"
#include "qofonohandsfree.h"
#include "qofonohandsfreeaudioagent.h"
#include "qofonohandsfreeaudiocard.h"
#include "qofonohandsfreeaudiomanager.h"
#include "qofonoassistedsatellitenavigation.h"
#include "qofonopositioningrequestagent.h"
#include "qofonolocationreporting.h"
#include "qofononetworkoperatorlistmodel.h"
#include "qofonosimlistmodel.h"
void QOfonoDeclarativePlugin::registerTypes(const char *uri, int major, int minor)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("MeeGo.QOfono"));
qmlRegisterType<QOfonoManager>(uri,major,minor,"OfonoManager");
qmlRegisterType<QOfonoModem>(uri,major,minor,"OfonoModem");
qmlRegisterType<QOfonoConnectionManager>(uri,major,minor,"OfonoConnMan");
qmlRegisterType<QOfonoConnectionContext>(uri,major,minor,"OfonoContextConnection");
qmlRegisterType<QOfonoNetworkRegistration>(uri,major,minor,"OfonoNetworkRegistration");
qmlRegisterType<QOfonoNetworkOperator>(uri,major,minor,"OfonoNetworkOperator");
qmlRegisterType<QOfonoCellBroadcast>(uri,major,minor,"OfonoCellBroadcast");
qmlRegisterType<QOfonoCallBarring>(uri,major,minor,"OfonoCallBarring");
qmlRegisterType<QOfonoCallForwarding>(uri,major,minor,"OfonoCallForwarding");
qmlRegisterType<QOfonoCallSettings>(uri,major,minor,"OfonoCallSettings");
qmlRegisterType<QOfonoCallMeter>(uri,major,minor,"OfonoCallMeter");
qmlRegisterType<QOfonoMessage>(uri,major,minor,"OfonoMessage");
qmlRegisterType<QOfonoMessageManager>(uri,major,minor,"OfonoMessageManager");
qmlRegisterType<QOfonoMessageWaiting>(uri,major,minor,"OfonoMessageWaiting");
qmlRegisterType<QOfonoSimManager>(uri,major,minor,"OfonoSimManager");
qmlRegisterType<QOfonoSmartMessaging>(uri,major,minor,"OfonoSmartMessaging");
qmlRegisterType<QOfonoSmartMessagingAgent>(uri,major,minor,"OfonoSmartMessagingAgent");
qmlRegisterType<QOfonoVoiceCall>(uri,major,minor,"OfonoVoiceCall");
qmlRegisterType<QOfonoVoiceCallManager>(uri,major,minor,"OfonoVoiceCallManager");
qmlRegisterType<QOfonoRadioSettings>(uri,major,minor,"OfonoRadioSettings");
qmlRegisterType<QOfonoSupplementaryServices>(uri,major,minor,"OfonoSupplementaryServices");
qmlRegisterType<QOfonoPhonebook>(uri,major,minor,"OfonoPhonebook");
qmlRegisterType<QOfonoTextTelephony>(uri,major,minor,"OfonoTextTelephony");
qmlRegisterType<QOfonoHandsfree>(uri,major,minor,"OfonoHandsfree");
qmlRegisterType<QOfonoHandsfreeAudioAgent>(uri,major,minor,"OfonoHandsfreeAudioAgent");
qmlRegisterType<QOfonoHandsfreeAudioCard>(uri,major,minor,"OfonoHandsfreeAudioCard");
qmlRegisterType<QOfonoHandsfreeAudioManager>(uri,major,minor,"OfonoHandsfreeAudioManager");
qmlRegisterType<QOfonoAssistedSatelliteNavigation>(uri,major,minor,"OfonoAssistedSatelliteNavigation");
qmlRegisterType<QOfonoPositioningRequestAgent>(uri,major,minor,"OfonoPositioningRequestAgent");
qmlRegisterType<QOfonoLocationReporting>(uri,major,minor,"OfonoLocationReporting");
qmlRegisterType<QOfonoNetworkOperatorListModel>(uri,major,minor,"OfonoNetworkOperatorListModel");
qmlRegisterType<QOfonoSimListModel>(uri,major,minor,"OfonoSimListModel");
}
void QOfonoDeclarativePlugin::registerTypes(const char *uri)
{
registerTypes(uri, 0, 2);
}
/****************************************************************************
**
** Copyright (C) 2013-2014 Jolla Ltd.
** Contact: lorn.potter@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 QOFONODECLARATIVEPLUGIN_H
#define QOFONODECLARATIVEPLUGIN_H
#include "qofono_global.h"
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
class QOFONOSHARED_EXPORT QOfonoDeclarativePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json")
public:
void registerTypes(const char *uri);
static void registerTypes(const char *uri, int major, int minor);
};
#endif // QOFONODECLARATIVEPLUGIN_H
/****************************************************************************
**
** Copyright (C) 2014 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 "qofononetworkoperatorlistmodel.h"
QOfonoNetworkOperatorListModel::QOfonoNetworkOperatorListModel(QObject *parent) :
QAbstractListModel(parent)
{
netreg = new QOfonoNetworkRegistration(this);
onNetworkOperatorsChanged(netreg->networkOperators());
connect(netreg,
SIGNAL(validChanged(bool)),
SIGNAL(validChanged(bool)));
connect(netreg,
SIGNAL(modemPathChanged(QString)),
SIGNAL(modemPathChanged(QString)));
connect(netreg,
SIGNAL(networkOperatorsChanged(QStringList)),
SLOT(onNetworkOperatorsChanged(QStringList)));
}
QString QOfonoNetworkOperatorListModel::modemPath() const
{
return netreg->modemPath();
}
void QOfonoNetworkOperatorListModel::setModemPath(const QString &path)
{
netreg->setModemPath(path);
}
bool QOfonoNetworkOperatorListModel::isValid() const
{
return netreg->isValid();
}
int QOfonoNetworkOperatorListModel::rowCount(const QModelIndex &) const
{
return operators.count();
}
int QOfonoNetworkOperatorListModel::count() const
{
return operators.count();
}
QVariant QOfonoNetworkOperatorListModel::data(const QModelIndex &index, int role) const
{
int row = index.row();
if (row >= 0 && row < operators.count()) {
QOfonoNetworkOperator* op = netreg->networkOperator(operators[row]);
if (op) {
switch (role) {
case PathRole: return op->operatorPath();
case NameRole: return op->name();
case StatusRole: return op->status();
case MccRole: return op->mcc();
case MncRole: return op->mnc();
case TechRole: return op->technologies();
case InfoRole: return op->additionalInfo();
}
}
}
qWarning() << index << role;
return QVariant();
}
QHash<int,QByteArray> QOfonoNetworkOperatorListModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[PathRole] = "operatorPath";
roles[NameRole] = "name";
roles[StatusRole] = "status";
roles[MccRole] = "mcc";
roles[MncRole] = "mnc";
roles[TechRole] = "technologies";
roles[InfoRole] = "additionalInfo";
return roles;
}
void QOfonoNetworkOperatorListModel::operatorPropertyChanged(OperatorRole role)
{
QOfonoNetworkOperator* op = (QOfonoNetworkOperator*)sender();
if (op) {
int row = operators.indexOf(op->operatorPath());
if (row >= 0) {
QModelIndex modelIndex = index(row);
QVector<int> roles;
roles.append(role);
Q_EMIT dataChanged(modelIndex, modelIndex, roles);
}
}
}
void QOfonoNetworkOperatorListModel::onNetworkOperatorsChanged(const QStringList &list)
{
beginResetModel();
const int oldCount = operators.count();
const int n = list.count();
operators = list;
for (int i=0; i<n; i++) {
QOfonoNetworkOperator* op = netreg->networkOperator(list[i]);
if (op) {
op->disconnect(this);
connect(op, SIGNAL(operatorPathChanged(QString)), SLOT(onOperatorPathChanged(QString)));
connect(op, SIGNAL(nameChanged(QString)), SLOT(onOperatorNameChanged(QString)));
connect(op, SIGNAL(statusChanged(QString)), SLOT(onOperatorStatusChanged(QString)));
connect(op, SIGNAL(mccChanged(QString)), SLOT(onOperatorMccChanged(QString)));
connect(op, SIGNAL(mncChanged(QString)), SLOT(onOperatorMncChanged(QString)));
connect(op, SIGNAL(technologiesChanged(QStringList)), SLOT(onOperatorTechChanged(QStringList)));
connect(op, SIGNAL(additionalInfoChanged(QString)), SLOT(onOperatorInfoChanged(QString)));
}
}
if (oldCount != n) {
Q_EMIT countChanged(n);
}
endResetModel();
}
void QOfonoNetworkOperatorListModel::onOperatorPathChanged(const QString &)
{
operatorPropertyChanged(PathRole);
}
void QOfonoNetworkOperatorListModel::onOperatorNameChanged(const QString &)
{
operatorPropertyChanged(NameRole);
}
void QOfonoNetworkOperatorListModel::onOperatorStatusChanged(const QString &)
{
operatorPropertyChanged(StatusRole);
}
void QOfonoNetworkOperatorListModel::onOperatorMccChanged(const QString &)
{
operatorPropertyChanged(MccRole);
}
void QOfonoNetworkOperatorListModel::onOperatorMncChanged(const QString &)
{
operatorPropertyChanged(MncRole);
}
void QOfonoNetworkOperatorListModel::onOperatorTechChanged(const QStringList &)
{
operatorPropertyChanged(TechRole);
}
void QOfonoNetworkOperatorListModel::onOperatorInfoChanged(const QString &)
{
operatorPropertyChanged(InfoRole);
}