Commit 2572568a authored by Slava Monich's avatar Slava Monich

[connectionagent] Removed (some) unnecessary stuff

The background wifi scan is taken care of by connman, there is no need
to mess with that.
parent 3ba10b0c
...@@ -23,12 +23,10 @@ connadaptor.header_flags = -c ConnAdaptor ...@@ -23,12 +23,10 @@ connadaptor.header_flags = -c ConnAdaptor
connadaptor.source_flags = -c ConnAdaptor connadaptor.source_flags = -c ConnAdaptor
SOURCES += main.cpp \ SOURCES += main.cpp \
qconnectionagent.cpp \ qconnectionagent.cpp
wakeupwatcher.cpp
HEADERS += \ HEADERS += \
qconnectionagent.h \ qconnectionagent.h
wakeupwatcher.h
target.path = /usr/bin target.path = /usr/bin
INSTALLS += target INSTALLS += target
......
...@@ -16,13 +16,11 @@ ...@@ -16,13 +16,11 @@
#include "qconnectionagent.h" #include "qconnectionagent.h"
#include "connectiond_adaptor.h" #include "connectiond_adaptor.h"
#include "wakeupwatcher.h"
#include <connman-qt5/useragent.h> #include <connman-qt5/useragent.h>
#include <connman-qt5/networkmanager.h> #include <connman-qt5/networkmanager.h>
#include <connman-qt5/networktechnology.h> #include <connman-qt5/networktechnology.h>
#include <connman-qt5/networkservice.h> #include <connman-qt5/networkservice.h>
#include <connman-qt5/sessionagent.h>
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
...@@ -85,9 +83,6 @@ QConnectionAgent::QConnectionAgent(QObject *parent) : ...@@ -85,9 +83,6 @@ QConnectionAgent::QConnectionAgent(QObject *parent) :
//ethernet,bluetooth,cellular,wifi is default //ethernet,bluetooth,cellular,wifi is default
techPreferenceList << "bluetooth" << "wifi" << "cellular" << "ethernet"; 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"); connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman");
scanTimer = new QTimer(this); scanTimer = new QTimer(this);
...@@ -561,16 +556,6 @@ void QConnectionAgent::flightModeDialogSuppressionTimeout() ...@@ -561,16 +556,6 @@ void QConnectionAgent::flightModeDialogSuppressionTimeout()
flightModeSuppression = false; 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) void QConnectionAgent::serviceAutoconnectChanged(bool on)
{ {
NetworkService *service = qobject_cast<NetworkService *>(sender()); NetworkService *service = qobject_cast<NetworkService *>(sender());
......
...@@ -17,23 +17,14 @@ ...@@ -17,23 +17,14 @@
#define QCONNECTIONAGENT_H #define QCONNECTIONAGENT_H
#include <QObject> #include <QObject>
#include <QMap>
#include <QStringList> #include <QStringList>
#include <QVariant> #include <QVariant>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QQueue>
#include <QPair>
#include <QElapsedTimer>
#include <QVector> #include <QVector>
class UserAgent; class UserAgent;
class SessionAgent;
class NetworkManager; class NetworkManager;
class NetworkService; class NetworkService;
class NetworkTechnology; class NetworkTechnology;
class WakeupWatcher;
class QTimer; class QTimer;
class QConnectionAgent : public QObject class QConnectionAgent : public QObject
...@@ -120,14 +111,9 @@ private: ...@@ -120,14 +111,9 @@ private:
void removeAllTypes(const QString &type); void removeAllTypes(const QString &type);
UserAgent *ua; UserAgent *ua;
NetworkManager *netman; NetworkManager *netman;
SessionAgent *sessionAgent;
QString currentNetworkState; QString currentNetworkState;
ServiceList orderedServicesList; ServiceList orderedServicesList;
QStringList techPreferenceList; QStringList techPreferenceList;
bool isEthernet; bool isEthernet;
bool connmanAvailable; bool connmanAvailable;
...@@ -135,7 +121,6 @@ private: ...@@ -135,7 +121,6 @@ private:
NetworkTechnology *tetheringWifiTech; NetworkTechnology *tetheringWifiTech;
bool tetheringEnabled; bool tetheringEnabled;
bool flightModeSuppression; bool flightModeSuppression;
WakeupWatcher *mceWatch;
uint scanTimeoutInterval; uint scanTimeoutInterval;
QTimer *scanTimer; QTimer *scanTimer;
...@@ -160,8 +145,6 @@ private slots: ...@@ -160,8 +145,6 @@ private slots:
void offlineModeChanged(bool); void offlineModeChanged(bool);
void flightModeDialogSuppressionTimeout(); void flightModeDialogSuppressionTimeout();
void displayStateChanged(const QString &);
void serviceAutoconnectChanged(bool); void serviceAutoconnectChanged(bool);
void scanTimeout(); void scanTimeout();
void techTetheringChanged(bool b); void techTetheringChanged(bool b);
......
/****************************************************************************
**
** 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 <QDBusPendingReply>
#include <QDebug>
#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<QString> 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);
}
}
/****************************************************************************
**
** 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 <QObject>
#include <QDBusInterface>
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
...@@ -11,12 +11,10 @@ DEFINES += SRCDIR=\\\"$$PWD/\\\" ...@@ -11,12 +11,10 @@ DEFINES += SRCDIR=\\\"$$PWD/\\\"
SOURCES += tst_connectionagent.cpp \ SOURCES += tst_connectionagent.cpp \
../../../connd/qconnectionagent.cpp \ ../../../connd/qconnectionagent.cpp \
../../../connd/connectiond_adaptor.cpp \ ../../../connd/connectiond_adaptor.cpp
../../../connd/wakeupwatcher.cpp
HEADERS += \ HEADERS += \
../../../connd/qconnectionagent.h \ ../../../connd/qconnectionagent.h \
../../../connd/connectiond_adaptor.h \ ../../../connd/connectiond_adaptor.h
../../../connd/wakeupwatcher.h
INCLUDEPATH += $$OUT_PWD/../../../connd INCLUDEPATH += $$OUT_PWD/../../../connd
......
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