Commit 4114aca0 authored by Lorn Potter's avatar Lorn Potter

[connectionagent] add roaming, autoconenct features. fix other bugs

parent 7a2de2a1
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="com.jolla.Connectiond">
<signal name="connectionRequest"/>
<signal name="wlanConfigurationNeeded"/>
<property name="askRoaming" type="b" access="readwrite"/>
<signal name="connectionRequest">
</signal>
<signal name="connectionState">
<arg name="state" type="s" direction="out"/>
<arg name="type" type="s" direction="out"/>
</signal>
<signal name="errorReported">
<arg direction="out" type="s" name="error"/>
<arg name="error" type="s" direction="out"/>
</signal>
<signal name="requestBrowser">
<arg direction="out" type="s" name="url"/>
<arg name="url" type="s" direction="out"/>
</signal>
<signal name="userInputCanceled">
</signal>
<signal name="userInputCanceled"/>
<signal name="userInputRequested">
<arg direction="out" type="s" name="service"/>
<arg direction="out" type="a{sv}" name="fields"/>
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In1"/>
<arg name="service" type="s" direction="out"/>
<arg name="fields" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
</signal>
<signal name="connectionState">
<arg direction="out" type="s" name="state"/>
<arg direction="out" type="s" name="type"/>
<signal name="configurationNeeded">
<arg name="type" type="s" direction="out"/>
</signal>
<signal name="roamingAskChanged">
<arg name="askRoaming" type="b" direction="out"/>
</signal>
<method name="connectToType">
<arg name="in0" type="s" direction="in"/>
</method>
<method name="sendConnectReply">
<arg direction="in" type="s" name="in0"/>
<arg direction="in" type="i" name="in1"/>
<arg name="in0" type="s" direction="in"/>
<arg name="in1" type="i" direction="in"/>
</method>
<method name="sendUserReply">
<arg direction="in" type="a{sv}" name="input"/>
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In0"/>
</method>
<method name="connectToType">
<arg direction="in" type="s" name="in0"/>
<arg name="input" type="a{sv}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
</method>
</interface>
</node>
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -v -c ConnAdaptor -a connadaptor.h:connadaptor.cpp conn.xml
* Command line was: qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jollamobile.Connectiond.xml
*
* qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
......@@ -33,6 +33,18 @@ ConnAdaptor::~ConnAdaptor()
// destructor
}
bool ConnAdaptor::askRoaming() const
{
// get the value of property askRoaming
return qvariant_cast< bool >(parent()->property("askRoaming"));
}
void ConnAdaptor::setAskRoaming(bool value)
{
// set the value of property askRoaming
parent()->setProperty("askRoaming", QVariant::fromValue(value));
}
void ConnAdaptor::connectToType(const QString &in0)
{
// handle method call com.jolla.Connectiond.connectToType
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -v -c ConnAdaptor -a connadaptor.h:connadaptor.cpp conn.xml
* Command line was: qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jollamobile.Connectiond.xml
*
* qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
......@@ -9,8 +9,8 @@
* before re-generating it.
*/
#ifndef CONNADAPTOR_H_1363752885
#define CONNADAPTOR_H_1363752885
#ifndef CONNADAPTOR_H_1366057292
#define CONNADAPTOR_H_1366057292
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
......@@ -30,9 +30,11 @@ class ConnAdaptor: public QDBusAbstractAdaptor
Q_CLASSINFO("D-Bus Interface", "com.jolla.Connectiond")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"com.jolla.Connectiond\">\n"
" <property access=\"readwrite\" type=\"b\" name=\"askRoaming\"/>\n"
" <signal name=\"connectionRequest\"/>\n"
" <signal name=\"configurationNeeded\">\n"
" <arg direction=\"out\" type=\"s\" name=\"url\"/>\n"
" <signal name=\"connectionState\">\n"
" <arg direction=\"out\" type=\"s\" name=\"state\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"type\"/>\n"
" </signal>\n"
" <signal name=\"errorReported\">\n"
" <arg direction=\"out\" type=\"s\" name=\"error\"/>\n"
......@@ -46,10 +48,15 @@ class ConnAdaptor: public QDBusAbstractAdaptor
" <arg direction=\"out\" type=\"a{sv}\" name=\"fields\"/>\n"
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
" </signal>\n"
" <signal name=\"connectionState\">\n"
" <arg direction=\"out\" type=\"s\" name=\"state\"/>\n"
" <signal name=\"configurationNeeded\">\n"
" <arg direction=\"out\" type=\"s\" name=\"type\"/>\n"
" </signal>\n"
" <signal name=\"roamingAskChanged\">\n"
" <arg direction=\"out\" type=\"b\" name=\"askRoaming\"/>\n"
" </signal>\n"
" <method name=\"connectToType\">\n"
" <arg direction=\"in\" type=\"s\" name=\"in0\"/>\n"
" </method>\n"
" <method name=\"sendConnectReply\">\n"
" <arg direction=\"in\" type=\"s\" name=\"in0\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"in1\"/>\n"
......@@ -58,9 +65,6 @@ class ConnAdaptor: public QDBusAbstractAdaptor
" <arg direction=\"in\" type=\"a{sv}\" name=\"input\"/>\n"
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
" </method>\n"
" <method name=\"connectToType\">\n"
" <arg direction=\"in\" type=\"s\" name=\"in0\"/>\n"
" </method>\n"
" </interface>\n"
"")
public:
......@@ -68,18 +72,23 @@ public:
virtual ~ConnAdaptor();
public: // PROPERTIES
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)
bool askRoaming() const;
void setAskRoaming(bool value);
public Q_SLOTS: // METHODS
void connectToType(const QString &in0);
void sendConnectReply(const QString &in0, int in1);
void sendUserReply(const QVariantMap &input);
Q_SIGNALS: // SIGNALS
void configurationNeeded(const QString &type);
void connectionRequest();
void connectionState(const QString &state, const QString &type);
void errorReported(const QString &error);
void requestBrowser(const QString &url);
void roamingAskChanged(bool askRoaming);
void userInputCanceled();
void userInputRequested(const QString &service, const QVariantMap &fields);
void configurationNeeded( const QString &type);
};
#endif
......@@ -18,7 +18,7 @@ INCLUDEPATH += lipstick
OTHER_FILES += com.jolla.Connectiond.xml
# create adaptor
#system(qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jolla.Connectiond.xml)
#system(qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jollamobile.Connectiond.xml)
SOURCES += main.cpp \
qconnectionmanager.cpp \
......
This diff is collapsed.
......@@ -23,6 +23,8 @@
#include <QVariant>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QQueue>
#include <QPair>
class UserAgent;
class SessionAgent;
......@@ -34,11 +36,14 @@ class NetworkService;
class QConnectionManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)
public:
~QConnectionManager();
static QConnectionManager &instance();
bool askRoaming() const;
void setAskRoaming(bool value);
Q_SIGNALS:
void connectionChanged(const QString &, bool); // ?
......@@ -62,13 +67,7 @@ public Q_SLOTS:
void sendConnectReply(const QString &in0, int in1);
void sendUserReply(const QVariantMap &input);
void onServiceAdded(const QString &servicePath);
void onServiceRemoved(const QString &servicePath);
void serviceErrorChanged(const QString &error);
void stateChanged(const QString &state);
void connectToType(const QString &type);
void defaultRouteChanged(NetworkService* defaultRoute);
private:
explicit QConnectionManager(QObject *parent = 0);
......@@ -87,14 +86,26 @@ private:
void connectToNetworkService(const QString &service);
uint currentNotification;
QHash<QString,NetworkService *> servicesMap;
QMap<QString,NetworkService *> servicesMap;
QStringList orderedServicesList;
QString findBestConnectableService();
void connectionHandover(const QString &oldService, const QString &newService);
QList <QString> connectedServices;
QStringList techPreferenceList;
bool askForRoaming;
private slots:
void onScanFinished();
void updateServicesMap();
void onServiceAdded(const QString &servicePath);
void onServiceRemoved(const QString &servicePath);
void serviceErrorChanged(const QString &error);
void serviceStateChanged(const QString &state);
void networkStateChanged(const QString &state);
void onServiceStrengthChanged(uint);
};
#endif // QCONNECTIONMANAGER_H
......@@ -103,7 +103,6 @@ void ConnectionAgentPlugin::sendConnectReply(const QString &replyMessage, int ti
void ConnectionAgentPlugin::connectToType(const QString &type)
{
qDebug() << Q_FUNC_INFO << type;;
connManagerInterface->connectToType(type);
}
......@@ -130,7 +129,6 @@ void ConnectionAgentPlugin::onUserInputRequested(const QString &service, const Q
QVariantMap vmap = qdbus_cast<QVariantMap>(arg);
map.insert(i.key(), vmap);
}
// qDebug() << Q_FUNC_INFO << map;
Q_EMIT userInputRequested(service, map);
}
......@@ -149,6 +147,15 @@ void ConnectionAgentPlugin::connectiondUnregistered(QString)
void ConnectionAgentPlugin::onConnectionState(const QString &state, const QString &type)
{
qDebug() << Q_FUNC_INFO << state << type;
Q_EMIT connectionState(state, type);
}
bool ConnectionAgentPlugin::askRoaming() const
{
return connManagerInterface->askRoaming();
}
void ConnectionAgentPlugin::setAskRoaming(bool value)
{
connManagerInterface->setAskRoaming(value);
}
......@@ -25,11 +25,15 @@ class NetworkManager;
class ConnectionAgentPlugin : public QObject
{
Q_OBJECT
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)
Q_DISABLE_COPY(ConnectionAgentPlugin)
public:
explicit ConnectionAgentPlugin(QObject *parent = 0);
~ConnectionAgentPlugin();
bool askRoaming() const;
void setAskRoaming(bool value);
public slots:
void sendUserReply(const QVariantMap &input);
......
......@@ -6,7 +6,7 @@ CONFIG += qt plugin
uri = com.jolla.connection
#create client
#system(qdbusxml2cpp ../connd/com.jolla.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface)
#system(qdbusxml2cpp ../connd/com.jollamobile.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface)
SOURCES += \
connectionagentplugin_plugin.cpp \
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/conn.xml -c ConnectionManagerInterface -p connectionamanagerinterface
* 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"
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/conn.xml -c ConnectionManagerInterface -p connectionamanagerinterface
* 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_1363759925
#define CONNECTIONAMANAGERINTERFACE_H_1363759925
#ifndef CONNECTIONAMANAGERINTERFACE_H_1366057321
#define CONNECTIONAMANAGERINTERFACE_H_1366057321
#include <QtCore/QObject>
#include <QtCore/QByteArray>
......@@ -30,6 +35,12 @@ public:
~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)
{
......@@ -53,13 +64,14 @@ public Q_SLOTS: // METHODS
}
Q_SIGNALS: // SIGNALS
void configurationNeeded(const QString &type);
void connectionRequest();
void connectionState(const QString &state, const QString &type);
void errorReported(const QString &error);
void requestBrowser(const QString &url);
void roamingAskChanged(bool askRoaming);
void userInputCanceled();
void userInputRequested(const QString &service, const QVariantMap &fields);
void configurationNeeded(const QString &type);
};
namespace com {
......
Wed Apr 17 2013 Lorn Potter <lorn.potter@jollamobile.com> - 0.5.7
* add roaming, autoconenct features. fix other bugs
* Sat Apr 13 2013 Lorn Potter <lorn.potter@jollamobile.com> - 0.5.6
- make one daemon running only. remove defaultRoute handling for now.
......
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