Skip to content

Commit

Permalink
Merge pull request #79 from amccarthy/master
Browse files Browse the repository at this point in the history
[connectionagent] Add option to keep tech powered when disabling tethering.
  • Loading branch information
Aaron McCarthy committed Jul 14, 2014
2 parents 3e2d644 + d5e7f0e commit df3dbc1
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 141 deletions.
3 changes: 3 additions & 0 deletions connd/com.jollamobile.Connectiond.xml
Expand Up @@ -47,6 +47,9 @@
</method>
<method name="stopTethering">
</method>
<method name="stopTethering">
<arg name="in0" type="b" direction="in"/>
</method>
</interface>
</node>

4 changes: 2 additions & 2 deletions connd/qconnectionagent.cpp
Expand Up @@ -864,7 +864,7 @@ void QConnectionAgent::startTethering(const QString &type)
}
}

void QConnectionAgent::stopTethering()
void QConnectionAgent::stopTethering(bool keepPowered)
{
delayedTethering = false;
QSettings confFile;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion connd/qconnectionagent.h
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions connectionagentplugin/connectionagentplugin.cpp
Expand Up @@ -15,7 +15,7 @@
****************************************************************************/

#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"
#include "connectiond_interface.h"

#include <connman-qt5/networkmanager.h>
#include <connman-qt5/networktechnology.h>
Expand Down Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions connectionagentplugin/connectionagentplugin.h
Expand Up @@ -18,7 +18,7 @@
#define CONNECTIONAGENTPLUGIN_H

#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"
#include "connectiond_interface.h"

class NetworkManager;
class ConnectionAgentPlugin : public QObject
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions connectionagentplugin/connectionagentplugin.pro
Expand Up @@ -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

Expand Down
26 changes: 0 additions & 26 deletions connectionagentplugin/connectionamanagerinterface.cpp

This file was deleted.

96 changes: 0 additions & 96 deletions connectionagentplugin/connectionamanagerinterface.h

This file was deleted.

Expand Up @@ -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/\\\"

Expand Down

0 comments on commit df3dbc1

Please sign in to comment.