Commit 78b452ff authored by Lorn Potter's avatar Lorn Potter

add license files and make work

parent a871c7fe
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jolla.Connectiond.xml
*
* 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.
*/
/****************************************************************************
**
** 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 "connadaptor.h"
#include <QtCore/QMetaObject>
......@@ -24,25 +30,21 @@
ConnAdaptor::ConnAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
ConnAdaptor::~ConnAdaptor()
{
// destructor
}
void ConnAdaptor::sendConnectReply(const QString &in0, int in1)
{
qDebug() << Q_FUNC_INFO << in0 << in1;
// handle method call com.jolla.Connectiond.sendConnectReply
QMetaObject::invokeMethod(parent(), "sendConnectReply", Q_ARG(QString, in0), Q_ARG(int, in1));
}
void ConnAdaptor::sendUserReply(const QVariantMap &input)
{
qDebug() << Q_FUNC_INFO << input;
// handle method call com.jolla.Connectiond.sendUserReply
QMetaObject::invokeMethod(parent(), "sendUserReply", Q_ARG(QVariantMap, input));
}
......
/****************************************************************************
**
** 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 <QtCore/QCoreApplication>
#include <QTimer>
......
/****************************************************************************
**
** Copyright (C) 2012 Jolla Ltd.
** Copyright (C) 2013 Jolla Ltd
** Contact: lorn.potter@gmail.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qconnectionmanager.h"
......@@ -109,31 +84,26 @@ void QConnectionManager::onUserInputRequested(const QString &servicePath, const
{
// gets called when a connman service gets called to connect and needs more configurations.
qDebug() << Q_FUNC_INFO;// << servicePath << fields;
Q_EMIT userInputRequested(servicePath, fields);
}
// from useragent
void QConnectionManager::onUserInputCanceled()
{
qDebug() << Q_FUNC_INFO;
Q_EMIT userInputCanceled();
}
// from useragent
void QConnectionManager::onErrorReported(const QString &error)
{
qDebug() << Q_FUNC_INFO << error;
Q_EMIT errorReported(error);
}
// from useragent
void QConnectionManager::onConnectionRequest()
{
qDebug() << Q_FUNC_INFO;
// if (!autoConnect()) {
Q_EMIT connectionRequest();
// }
}
......@@ -144,13 +114,11 @@ void QConnectionManager::sendMessage()
void QConnectionManager::sendConnectReply(const QString &in0, int in1)
{
qDebug() << Q_FUNC_INFO << in0 << in1;
ua->sendConnectReply(in0, in1);
}
void QConnectionManager::sendUserReply(const QVariantMap &input)
{
qDebug() << Q_FUNC_INFO;
ua->sendUserReply(input);
}
......@@ -197,12 +165,11 @@ void QConnectionManager::serviceErrorChanged(const QString &error)
void QConnectionManager::stateChanged(const QString &state)
{
qDebug() << Q_FUNC_INFO << state;
Q_UNUSED(state)
}
bool QConnectionManager::autoConnect()
{
qDebug() << Q_FUNC_INFO;
QStringList techList = netman->technologiesList();
Q_FOREACH (const QString &tech, techList) {
......
/****************************************************************************
**
** 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 "connectionagentplugin.h"
#include "connectionamanagerinterface.h"
......@@ -9,8 +24,6 @@
ConnectionAgentPlugin::ConnectionAgentPlugin(QObject *parent):
QObject(parent)
{
qDebug() << Q_FUNC_INFO << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << this;
connectiondWatcher = new QDBusServiceWatcher(CONND_SERVICE,QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForRegistration |
QDBusServiceWatcher::WatchForUnregistration, this);
......@@ -20,14 +33,7 @@ ConnectionAgentPlugin::ConnectionAgentPlugin(QObject *parent):
connect(connectiondWatcher, SIGNAL(serviceUnregistered(QString)),
this, SLOT(connectiondUnregistered(QString)));
bool available = QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE);
if(available) {
connectToConnectiond();
qDebug() << Q_FUNC_INFO << CONND_SERVICE << "success!!";
} else {
qDebug() << Q_FUNC_INFO << CONND_SERVICE << "not available";
}
connectToConnectiond();
}
ConnectionAgentPlugin::~ConnectionAgentPlugin()
......@@ -36,7 +42,6 @@ ConnectionAgentPlugin::~ConnectionAgentPlugin()
void ConnectionAgentPlugin::sendUserReply(const QVariantMap &input)
{
qDebug() << Q_FUNC_INFO << this << sender();
QDBusPendingReply<> reply = connManagerInterface->sendUserReply(input);
if (reply.isError()) {
qDebug() << Q_FUNC_INFO << reply.error().message();
......@@ -45,13 +50,11 @@ void ConnectionAgentPlugin::sendUserReply(const QVariantMap &input)
void ConnectionAgentPlugin::sendConnectReply(const QString &replyMessage, int timeout)
{
qDebug() << Q_FUNC_INFO << replyMessage << timeout;
connManagerInterface->sendConnectReply(replyMessage,timeout);
}
void ConnectionAgentPlugin::onErrorReported(const QString &error)
{
qDebug() << Q_FUNC_INFO << error;
Q_EMIT errorReported(error);
}
......@@ -78,7 +81,6 @@ void ConnectionAgentPlugin::onUserInputRequested(const QString &service, const Q
void ConnectionAgentPlugin::onConnectionRequested()
{
qDebug() << Q_FUNC_INFO;
Q_EMIT connectionRequest();
}
......@@ -88,6 +90,17 @@ void ConnectionAgentPlugin::connectToConnectiond(QString)
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()),
......
/****************************************************************************
**
** 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 CONNECTIONAGENTPLUGIN_H
#define CONNECTIONAGENTPLUGIN_H
......@@ -8,10 +24,10 @@
class ConnectionAgentPlugin : public QObject
{
Q_OBJECT
// Q_DISABLE_COPY(ConnectionAgentPlugin)
Q_DISABLE_COPY(ConnectionAgentPlugin)
public:
ConnectionAgentPlugin(QObject *parent = 0);
explicit ConnectionAgentPlugin(QObject *parent = 0);
~ConnectionAgentPlugin();
public slots:
......@@ -24,7 +40,6 @@ signals:
void errorReported(const QString &error);
void connectionRequest();
// void userConnectRequested(const QDBusMessage &message);
private:
com::jolla::Connectiond *connManagerInterface;
QDBusServiceWatcher *connectiondWatcher;
......
/****************************************************************************
**
** 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 "connectionagentplugin_plugin.h"
#include "connectionagentplugin.h"
#include <qdeclarative.h>
/*
*This class is for accessing connman's UserAgent from multiple sources.
*This is because currently, there can only be one UserAgent per system.
*
*It also makes use of a patch to connman, that allows the UserAgent
*to get signaled when a connection is needed. This is the real reason
*this deamon is needed. An InputRequest is short lived, and thus, may
*not clash with other apps that need to use UserAgent.
*
*When you are trying to intercept a connection request, you need a long
*living process to wait until such time. This will immediately clash if
*a wlan needs user Input signal from connman, and the configure will never
*get the proper signal.
*
*This qml type can be used as such:
*
*import com.jolla.connection 1.0
*
* ConnectionAgent {
* id: userAgent
* onUserInputRequested: {
* console.log(" onUserInputRequested:")
* }
*
* onConnectionRequest: {
* console.log("onConnectionRequest ")
* sendSuppress()
* }
* onErrorReported: {
* console.log("Got error from connman: " + error);
* }
* }
*
**/
void ConnectionagentpluginPlugin::registerTypes(const char *uri)
{
qDebug() << Q_FUNC_INFO << uri;
......
/****************************************************************************
**
** 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 CONNECTIONAGENTPLUGIN_PLUGIN_H
#define CONNECTIONAGENTPLUGIN_PLUGIN_H
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/com.jolla.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.
*/
/****************************************************************************
**
** 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 "connectionamanagerinterface.h"
......
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp ../connd/com.jolla.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.
*/
/****************************************************************************
**
** 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 CONNECTIONAMANAGERINTERFACE_H_1363426405
#define CONNECTIONAMANAGERINTERFACE_H_1363426405
......
# (Lines starting with hash marks are comments)
# Fixed section header (do not change):
[D-BUS Service]
Name=com.jolla.Connectiond
Exec=/usr/bin/connectionagent
[Unit]
Description=Connection daemon for connman UserAgent
Requires=dbus.socket dbus.service
[Service]
ExecStart=/usr/bin/connectionagent
Restart=always
BusName=com.jolla.Connectiond
Type=dbus
[Install]
WantedBy=jolla-middleware.target
\ No newline at end of file
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