diff --git a/connd/connd.pro b/connd/connd.pro index 1836b79..3fd3739 100644 --- a/connd/connd.pro +++ b/connd/connd.pro @@ -23,12 +23,10 @@ connadaptor.header_flags = -c ConnAdaptor connadaptor.source_flags = -c ConnAdaptor SOURCES += main.cpp \ - qconnectionagent.cpp \ - wakeupwatcher.cpp + qconnectionagent.cpp HEADERS += \ - qconnectionagent.h \ - wakeupwatcher.h + qconnectionagent.h target.path = /usr/bin INSTALLS += target diff --git a/connd/qconnectionagent.cpp b/connd/qconnectionagent.cpp index a13a79d..f208b42 100644 --- a/connd/qconnectionagent.cpp +++ b/connd/qconnectionagent.cpp @@ -16,13 +16,11 @@ #include "qconnectionagent.h" #include "connectiond_adaptor.h" -#include "wakeupwatcher.h" #include #include #include #include -#include #include @@ -85,9 +83,6 @@ QConnectionAgent::QConnectionAgent(QObject *parent) : //ethernet,bluetooth,cellular,wifi is default techPreferenceList << "bluetooth" << "wifi" << "cellular" << "ethernet"; - mceWatch = new WakeupWatcher(this); - connect(mceWatch,SIGNAL(displayStateChanged(QString)),this,SLOT(displayStateChanged(QString))); - connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman"); scanTimer = new QTimer(this); @@ -561,16 +556,6 @@ void QConnectionAgent::flightModeDialogSuppressionTimeout() flightModeSuppression = false; } -void QConnectionAgent::displayStateChanged(const QString &state) -{ - if (state == "on") { - NetworkTechnology *wifiTech = netman->getTechnology("wifi"); - if (wifiTech && wifiTech->powered() && !wifiTech->connected() && !wifiTech->tethering()) { - wifiTech->scan(); - } - } -} - void QConnectionAgent::serviceAutoconnectChanged(bool on) { NetworkService *service = qobject_cast(sender()); diff --git a/connd/qconnectionagent.h b/connd/qconnectionagent.h index 04acfa3..f10abba 100644 --- a/connd/qconnectionagent.h +++ b/connd/qconnectionagent.h @@ -17,23 +17,14 @@ #define QCONNECTIONAGENT_H #include -#include #include #include -#include -#include -#include -#include -#include #include class UserAgent; -class SessionAgent; - class NetworkManager; class NetworkService; class NetworkTechnology; -class WakeupWatcher; class QTimer; class QConnectionAgent : public QObject @@ -120,14 +111,9 @@ public Q_SLOTS: void removeAllTypes(const QString &type); UserAgent *ua; - NetworkManager *netman; - SessionAgent *sessionAgent; - QString currentNetworkState; - ServiceList orderedServicesList; - QStringList techPreferenceList; bool isEthernet; bool connmanAvailable; @@ -135,7 +121,6 @@ public Q_SLOTS: NetworkTechnology *tetheringWifiTech; bool tetheringEnabled; bool flightModeSuppression; - WakeupWatcher *mceWatch; uint scanTimeoutInterval; QTimer *scanTimer; @@ -160,8 +145,6 @@ private slots: void offlineModeChanged(bool); void flightModeDialogSuppressionTimeout(); - void displayStateChanged(const QString &); - void serviceAutoconnectChanged(bool); void scanTimeout(); void techTetheringChanged(bool b); diff --git a/connd/wakeupwatcher.cpp b/connd/wakeupwatcher.cpp deleted file mode 100644 index 9f6cef8..0000000 --- a/connd/wakeupwatcher.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Jolla Ltd -** Contact: lorn.potter@gmail.com -** -** -** GNU Lesser General Public License Usage -** 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 -#include - -#include "wakeupwatcher.h" - -#define MCE_SERVICE "com.nokia.mce" -#define MCE_SIGNAL_PATH "/com/nokia/mce/signal" -#define MCE_SIGNAL_INTERFACE "com.nokia.mce.signal" -#define MCE_PSM_STATE_IND "psm_state_ind" -#define MCE_DISPLAY_IND "display_status_ind" - -#define MCE_REQUEST_PATH "/com/nokia/mce/request" -#define MCE_REQUEST_INTERFACE "com.nokia.mce.request" -#define MCE_DISPLAY_STATUS_GET "get_display_status" -#define MCE_PSM_STATE_GET "get_psm_state" - - -WakeupWatcher::WakeupWatcher(QObject *parent) : - QObject(parent), - currentPowerSave(false) -{ - mceInterface = new QDBusInterface(MCE_SERVICE, - MCE_SIGNAL_PATH, - MCE_SIGNAL_INTERFACE, - QDBusConnection::systemBus(), - parent); - - mceInterface->connection().connect(MCE_SERVICE, - MCE_SIGNAL_PATH, - MCE_SIGNAL_INTERFACE, - MCE_PSM_STATE_IND, - this, - SLOT(mceSleepStateChanged(bool))); - - mceInterface->connection().connect(MCE_SERVICE, - MCE_SIGNAL_PATH, - MCE_SIGNAL_INTERFACE, - MCE_DISPLAY_IND, - this, - SLOT(mceDisplayStateChanged(const QString))); - - QDBusPendingReply displayStateReply = QDBusConnection::systemBus().call( - QDBusMessage::createMethodCall(MCE_SERVICE, - MCE_REQUEST_PATH, - MCE_REQUEST_INTERFACE, - MCE_DISPLAY_STATUS_GET)); - displayStateReply.waitForFinished(); - if (displayStateReply.isValid()) { - currentDisplayState = displayStateReply.value(); - } -} - -void WakeupWatcher::mceDisplayStateChanged(const QString &state) -{ - if (state != currentDisplayState) { - currentDisplayState = state; - emit displayStateChanged(currentDisplayState); - } -} - -void WakeupWatcher::mceSleepStateChanged(bool mode) -{ - if (mode != currentPowerSave) { - currentPowerSave = mode; - emit sleepStateChanged(currentPowerSave); - } -} diff --git a/connd/wakeupwatcher.h b/connd/wakeupwatcher.h deleted file mode 100644 index 5fca3cf..0000000 --- a/connd/wakeupwatcher.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Jolla Ltd -** Contact: lorn.potter@gmail.com -** -** -** GNU Lesser General Public License Usage -** 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 WAKEUPWATCHER_H -#define WAKEUPWATCHER_H - -#include -#include - -class WakeupWatcher : public QObject -{ - Q_OBJECT -public: - explicit WakeupWatcher(QObject *parent = 0); - -signals: - void displayStateChanged(const QString&); - void sleepStateChanged(bool); - -private slots: - void mceDisplayStateChanged(const QString &state); - void mceSleepStateChanged(bool mode); - -private: - QDBusInterface *mceInterface; - QString currentDisplayState; - bool currentPowerSave; -}; - -#endif // WAKEUPWATCHER_H diff --git a/test/auto/tst_connectionagent/tst_connectionagent.pro b/test/auto/tst_connectionagent/tst_connectionagent.pro index a228fad..805cae1 100644 --- a/test/auto/tst_connectionagent/tst_connectionagent.pro +++ b/test/auto/tst_connectionagent/tst_connectionagent.pro @@ -11,12 +11,10 @@ DEFINES += SRCDIR=\\\"$$PWD/\\\" SOURCES += tst_connectionagent.cpp \ ../../../connd/qconnectionagent.cpp \ - ../../../connd/connectiond_adaptor.cpp \ - ../../../connd/wakeupwatcher.cpp + ../../../connd/connectiond_adaptor.cpp HEADERS += \ ../../../connd/qconnectionagent.h \ - ../../../connd/connectiond_adaptor.h \ - ../../../connd/wakeupwatcher.h + ../../../connd/connectiond_adaptor.h INCLUDEPATH += $$OUT_PWD/../../../connd