Commit f51c77e8 authored by Lorn Potter's avatar Lorn Potter

update these. fixes some bugs, makes better

parent f81c021e
......@@ -17,6 +17,7 @@
</signal>
<signal name="connectionState">
<arg direction="out" type="s" name="state"/>
<arg direction="out" type="s" name="type"/>
</signal>
<method name="sendConnectReply">
<arg direction="in" type="s" name="in0"/>
......
<!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"/>
<signal name="errorReported">
<arg direction="out" type="s" name="error"/>
</signal>
<signal name="requestBrowser">
<arg direction="out" type="s" name="url"/>
</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"/>
</signal>
<method name="sendConnectReply">
<arg direction="in" type="s" name="in0"/>
<arg direction="in" type="i" name="in1"/>
</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"/>
</method>
</interface>
</node>
......@@ -46,6 +46,7 @@ class ConnAdaptor: public QDBusAbstractAdaptor
" </signal>\n"
" <signal name=\"connectionState\">\n"
" <arg direction=\"out\" type=\"s\" name=\"state\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"type\"/>\n"
" </signal>\n"
" <method name=\"sendConnectReply\">\n"
" <arg direction=\"in\" type=\"s\" name=\"in0\"/>\n"
......@@ -71,7 +72,7 @@ public Q_SLOTS: // METHODS
void sendUserReply(const QVariantMap &input);
Q_SIGNALS: // SIGNALS
void connectionRequest();
void connectionState(const QString &state);
void connectionState(const QString &state, const QString &type);
void errorReported(const QString &error);
void requestBrowser(const QString &url);
void userInputCanceled();
......
......@@ -13,7 +13,7 @@ QT -= gui
INCLUDEPATH += libconnman-qt
#INCLUDEPATH += lipstick
INCLUDEPATH += lipstick
OTHER_FILES += com.jolla.Connectiond.xml
......@@ -30,7 +30,7 @@ HEADERS+= \
connadaptor.h
LIBS += -lconnman-qt4
#LIBS += -llipstick
LIBS += -llipstick
target.path = /usr/bin
INSTALLS += target
......
This diff is collapsed.
......@@ -49,7 +49,7 @@ Q_SIGNALS:
void errorReported(const QString &error);
void connectionRequest();
void wlanConfigurationNeeded();
void connectionState(const QString &state);
void connectionState(const QString &state, const QString &type);
public Q_SLOTS:
......@@ -64,12 +64,13 @@ public Q_SLOTS:
void sendConnectReply(const QString &in0, int in1);
void sendUserReply(const QVariantMap &input);
void networkStateChanged(const QString &state);
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);
......@@ -79,15 +80,24 @@ private:
bool autoConnect();
NetworkManager *netman;
NetworkService *netService;
// NetworkService *netService;
SessionAgent *sessionAgent;
bool okToConnect;
QString currentNetworkState;
QString currentType;
bool serviceConnect;
void connectToNetworkService(const QString &service);
void showNotification(const QString &message,int timeout);
uint currentNotification;
QList <QString> servicePaths;
QHash<QString,NetworkService *> servicesMap;
private slots:
void onScanFinished();
void updateServicesMap();
void sessionSettingsUpdated(const QVariantMap &map);
};
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.2, 2013-03-17T11:41:16. -->
<!-- Written by Qt Creator 2.6.2, 2013-03-25T11:53:45. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
......
......@@ -47,6 +47,55 @@ ConnectionAgentPlugin::~ConnectionAgentPlugin()
{
}
void ConnectionAgentPlugin::connectToConnectiond(QString)
{
qDebug() << Q_FUNC_INFO << connManagerInterface;
if (connManagerInterface) {
delete connManagerInterface;
connManagerInterface = 0;
}
bool available = QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE);
qDebug() << Q_FUNC_INFO << available;
// if(!available) {
QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService(CONND_SERVICE);
if (!reply.isValid()) {
qDebug() << Q_FUNC_INFO << reply.error().message();
return;
}
// }
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE)) {
qDebug() << Q_FUNC_INFO << QString("XXXXXXXXXXXXXXXXXXXXXXXXXX %1 not available").arg(CONND_SERVICE);
}
connManagerInterface = new com::jolla::Connectiond(CONND_SERVICE, CONND_PATH,
QDBusConnection::sessionBus(), this);
if (!connManagerInterface->isValid()) {
qDebug() << Q_FUNC_INFO << "is not valid interface";
}
connect(connManagerInterface,SIGNAL(connectionRequest()),
this,SLOT(onConnectionRequested()));
connect(connManagerInterface,SIGNAL(wlanConfigurationNeeded()),
this,SIGNAL(wlanConfigurationNeeded()));
connect(connManagerInterface,SIGNAL(userInputCanceled()),
this,SIGNAL(userInputCanceled()));
connect(connManagerInterface,SIGNAL(errorReported(QString)),
this,SLOT(onErrorReported(QString)));
connect(connManagerInterface,SIGNAL(connectionState(QString, QString)),
this,SLOT(onConnectionState(QString, QString)));
connect(connManagerInterface,SIGNAL(requestBrowser(QString)),
this,SLOT(onRequestBrowser(QString)));
connect(connManagerInterface,SIGNAL(userInputRequested(QString,QVariantMap)),
this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection);
}
void ConnectionAgentPlugin::sendUserReply(const QVariantMap &input)
{
qDebug() << Q_FUNC_INFO;
......@@ -99,45 +148,6 @@ void ConnectionAgentPlugin::onConnectionRequested()
Q_EMIT connectionRequest();
}
void ConnectionAgentPlugin::connectToConnectiond(QString)
{
if (connManagerInterface) {
delete connManagerInterface;
connManagerInterface = 0;
}
bool available = QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE);
if(!available) {
QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService(CONND_SERVICE);
if (!reply.isValid()) {
qDebug() << Q_FUNC_INFO << reply.error().message();
return;
}
}
connManagerInterface = new com::jolla::Connectiond(CONND_SERVICE, CONND_PATH, QDBusConnection::sessionBus(), this);
connect(connManagerInterface,SIGNAL(connectionRequest()),
this,SLOT(onConnectionRequested()));
connect(connManagerInterface,SIGNAL(wlanConfigurationNeeded()),
this,SIGNAL(wlanConfigurationNeeded()));
connect(connManagerInterface,SIGNAL(userInputCanceled()),
this,SIGNAL(userInputCanceled()));
connect(connManagerInterface,SIGNAL(errorReported(QString)),
this,SLOT(onErrorReported(QString)));
connect(connManagerInterface,SIGNAL(connectionState(QString)),
this,SLOT(onConnectionState(QString)));
connect(connManagerInterface,SIGNAL(requestBrowser(QString)),
this,SLOT(onRequestBrowser(QString)));
connect(connManagerInterface,SIGNAL(userInputRequested(QString,QVariantMap)),
this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection);
}
void ConnectionAgentPlugin::connectiondUnregistered(QString)
{
......@@ -153,8 +163,8 @@ void ConnectionAgentPlugin::onWlanConfigurationNeeded()
Q_EMIT wlanConfigurationNeeded();
}
void ConnectionAgentPlugin::onConnectionState(const QString &state)
void ConnectionAgentPlugin::onConnectionState(const QString &state, const QString &type)
{
qDebug() << Q_FUNC_INFO << state;
Q_EMIT connectionState(state);
qDebug() << Q_FUNC_INFO << state << type;
Q_EMIT connectionState(state, type);
}
......@@ -42,7 +42,7 @@ signals:
void errorReported(const QString &error);
void connectionRequest();
void wlanConfigurationNeeded();
void connectionState(const QString &state);
void connectionState(const QString &state, const QString &type);
private:
com::jolla::Connectiond *connManagerInterface;
......@@ -54,7 +54,7 @@ private slots:
void onUserInputRequested(const QString &service, const QVariantMap &fields);
void onConnectionRequested();
void onWlanConfigurationNeeded();
void onConnectionState(const QString &state);
void onConnectionState(const QString &state, const QString &type);
void connectToConnectiond(const QString = QString());
void connectiondUnregistered(const QString = QString());
......
......@@ -59,7 +59,7 @@ public Q_SLOTS: // METHODS
Q_SIGNALS: // SIGNALS
void connectionRequest();
void connectionState(const QString &state);
void connectionState(const QString &state, const QString &type);
void errorReported(const QString &error);
void requestBrowser(const QString &url);
void userInputCanceled();
......
# (Lines starting with hash marks are comments)
# Fixed section header (do not change):
[D-BUS Service]
Name=com.jolla.Connectiond
Exec=/usr/bin/connectionagent
SystemdService=connectionagent.service
Interface=/Connectiond
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Allow any connection to receive the message -->
<policy context="default">
<allow own="com.jolla.Connectiond"/>
<allow send_destination="com.jolla.Connectiond"/>
<allow receive_sender="com.jolla.Connectiond"/>
<allow send_path="/com/jolla/Connectiond"/>
</policy>
</busconfig>
\ No newline at end of file
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Allow any connection to receive the message -->
<policy context="default">
<allow own="com.jolla.Connectiond" />
<allow send_destination="com.jolla.Connectiond" />
<allow receive_sender="com.jolla.Connectiond" />
<allow send_path="/Connectiond" />
</policy>
</busconfig>
......@@ -19,13 +19,13 @@ PkgConfigBR:
- QtCore
- QtDBus
BuildRequires: pkgconfig(connman-qt)
Configure: none
Builder: qmake
Files:
- "%{_usr}/bin/connectionagent"
- "%{_usr}/share/dbus-1/services/com.jolla.Connectiond.service"
- "%{_bindir}/connectionagent"
- "%{_datadir}/dbus-1/services/com.jolla.Connectiond.service"
SubPackages:
- Name: declarative
Summary: Declarative plugin for connection agent.
......
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