Commit d5e7f0ed authored by Aaron McCarthy's avatar Aaron McCarthy

[connectionagent] Add option to keep tech powered when disabling tethering.

It is sometimes desirable to not restore the power state of the
tethering technology. Add an option to allow the caller to request that
the tethering technology stays powered when disabling tethering.

Removed generated file from repository and generate it at build time.
parent 3e2d6445
......@@ -47,6 +47,9 @@
</method>
<method name="stopTethering">
</method>
<method name="stopTethering">
<arg name="in0" type="b" direction="in"/>
</method>
</interface>
</node>
......@@ -864,7 +864,7 @@ void QConnectionAgent::startTethering(const QString &type)
}
}
void QConnectionAgent::stopTethering()
void QConnectionAgent::stopTethering(bool keepPowered)
{
delayedTethering = false;
QSettings confFile;
......@@ -890,7 +890,7 @@ void QConnectionAgent::stopTethering()
}
b = confFile.value("tetheringTechPowered").toBool();
if (!b && tetherTech) {
if (!b && tetherTech && !keepPowered) {
tetherTech->setPowered(false);
}
Q_EMIT tetheringFinished(false);
......
......@@ -77,7 +77,7 @@ public Q_SLOTS:
void connectToType(const QString &type);
void startTethering(const QString &type);
void stopTethering();
void stopTethering(bool keepPowered = false);
private:
explicit QConnectionAgent(QObject *parent = 0);
......
......@@ -15,7 +15,7 @@
****************************************************************************/
#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"
#include "connectiond_interface.h"
#include <connman-qt5/networkmanager.h>
#include <connman-qt5/networktechnology.h>
......@@ -192,7 +192,7 @@ void ConnectionAgentPlugin::onTetheringFinished(bool success)
Q_EMIT tetheringFinished(success);
}
void ConnectionAgentPlugin::stopTethering()
void ConnectionAgentPlugin::stopTethering(bool keepPowered)
{
connManagerInterface->stopTethering();
connManagerInterface->stopTethering(keepPowered);
}
......@@ -18,7 +18,7 @@
#define CONNECTIONAGENTPLUGIN_H
#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"
#include "connectiond_interface.h"
class NetworkManager;
class ConnectionAgentPlugin : public QObject
......@@ -39,7 +39,7 @@ public slots:
void sendConnectReply(const QString &replyMessage, int timeout = 120);
void connectToType(const QString &type);
void startTethering(const QString &type);
void stopTethering();
void stopTethering(bool keepPowered = false);
signals:
void userInputRequested(const QString &servicePath, const QVariantMap &fields);
......
......@@ -5,18 +5,18 @@ CONFIG += qt plugin
uri = com.jolla.connection
#create client
#system(qdbusxml2cpp ../connd/com.jollamobile.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface)
SOURCES += \
connectionagentplugin_plugin.cpp \
connectionagentplugin.cpp \
connectionamanagerinterface.cpp
connectionagentplugin.cpp
HEADERS += \
connectionagentplugin_plugin.h \
connectionagentplugin.h \
connectionamanagerinterface.h
connectionagentplugin.h
DBUS_INTERFACES = connectiond_interface
connectiond_interface.files = ../connd/com.jollamobile.Connectiond.xml
connectiond_interface.header_flags = "-c ConnectionManagerInterface"
connectiond_interface.source_flags = "-c ConnectionManagerInterface"
OTHER_FILES = qmldir
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/com.jollamobile.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface
*
* qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "connectionamanagerinterface.h"
/*
* Implementation of interface class ConnectionManagerInterface
*/
ConnectionManagerInterface::ConnectionManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
ConnectionManagerInterface::~ConnectionManagerInterface()
{
}
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/com.jollamobile.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface
*
* qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef CONNECTIONAMANAGERINTERFACE_H_1366057321
#define CONNECTIONAMANAGERINTERFACE_H_1366057321
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
/*
* Proxy class for interface com.jolla.Connectiond
*/
class ConnectionManagerInterface: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "com.jolla.Connectiond"; }
public:
ConnectionManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
~ConnectionManagerInterface();
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)
inline bool askRoaming() const
{ return qvariant_cast< bool >(property("askRoaming")); }
inline void setAskRoaming(bool value)
{ setProperty("askRoaming", QVariant::fromValue(value)); }
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> connectToType(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QLatin1String("connectToType"), argumentList);
}
inline QDBusPendingReply<> sendConnectReply(const QString &in0, int in1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
return asyncCallWithArgumentList(QLatin1String("sendConnectReply"), argumentList);
}
inline QDBusPendingReply<> sendUserReply(const QVariantMap &input)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(input);
return asyncCallWithArgumentList(QLatin1String("sendUserReply"), argumentList);
}
inline QDBusPendingReply<> startTethering(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QLatin1String("startTethering"), argumentList);
}
inline QDBusPendingReply<> stopTethering()
{
return asyncCall(QLatin1String("stopTethering"));
}
Q_SIGNALS: // SIGNALS
void configurationNeeded(const QString &type);
void connectionRequest();
void connectionState(const QString &state, const QString &type);
void errorReported(const QString &servicePath, const QString &error);
void requestBrowser(const QString &url);
void roamingAskChanged(bool askRoaming);
void userInputCanceled();
void userInputRequested(const QString &service, const QVariantMap &fields);
void tetheringFinished(bool);
};
namespace com {
namespace jolla {
typedef ::ConnectionManagerInterface Connectiond;
}
}
#endif
......@@ -16,12 +16,15 @@ TEMPLATE = app
SOURCES += tst_connectionagent_plugintest.cpp \
../../../connectionagentplugin/connectionagentplugin.cpp \
../../../connectionagentplugin/connectionamanagerinterface.cpp
../../../connectionagentplugin/connectionagentplugin.cpp
HEADERS += \
../../../connectionagentplugin/connectionagentplugin.h \
../../../connectionagentplugin/connectionamanagerinterface.h
../../../connectionagentplugin/connectionagentplugin.h
DBUS_INTERFACES = connectiond_interface
connectiond_interface.files = ../../../connd/com.jollamobile.Connectiond.xml
connectiond_interface.header_flags = "-c ConnectionManagerInterface"
connectiond_interface.source_flags = "-c ConnectionManagerInterface"
DEFINES += SRCDIR=\\\"$$PWD/\\\"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment