Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a871c7f
Showing
36 changed files
with
2,457 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
connectionagent | ||
=============== | ||
|
||
Connectionagent is a daemon and declarative plugin for accessing connman's UserAgent. It allows multiple access to UserAgent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!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"> | ||
<method name="sendUserReply"> | ||
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In0"/> | ||
<arg type="a{sv}" name="input"/> | ||
</method> | ||
<method name="sendConnectReply"> | ||
<arg direction="in" type="s"/> | ||
<arg direction="in" type="i"/> | ||
</method> | ||
<signal name="userInputRequested"> | ||
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In1"/> | ||
<arg type="s" name="service"/> | ||
<arg type="a{sv}" name="fields"/> | ||
</signal> | ||
<signal name="userInputCanceled"/> | ||
<signal name="errorReported"> | ||
<arg type="s" name="error"/> | ||
</signal> | ||
<signal name="requestBrowser"> | ||
<arg type="s" name="url"/> | ||
</signal> | ||
<signal name="connectionRequest"/> | ||
</interface> | ||
</node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!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"> | ||
<method name="sendUserReply"> | ||
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In0"/> | ||
<arg type="a{sv}" name="input"/> | ||
</method> | ||
<method name="sendConnectReply"> | ||
<arg direction="in" type="s"/> | ||
<arg direction="in" type="i"/> | ||
</method> | ||
<signal name="userInputRequested"> | ||
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In1"/> | ||
<arg type="s" name="service"/> | ||
<arg type="a{sv}" name="fields "/> | ||
</signal> | ||
<signal name="userInputCanceled"/> | ||
<signal name="errorReported"> | ||
<arg type="s" name="service"/> | ||
<arg type="s" name="error"/> | ||
</signal> | ||
<signal name="requestBrowser"> | ||
<arg type="s" name="service"/> | ||
<arg type="s" name="url"/> | ||
</signal> | ||
<signal name="connectionRequest"/> | ||
</interface> | ||
</node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#include "connadaptor.h" | ||
#include <QtCore/QMetaObject> | ||
#include <QtCore/QByteArray> | ||
#include <QtCore/QList> | ||
#include <QtCore/QMap> | ||
#include <QtCore/QString> | ||
#include <QtCore/QStringList> | ||
#include <QtCore/QVariant> | ||
|
||
/* | ||
* Implementation of adaptor class ConnAdaptor | ||
*/ | ||
|
||
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)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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. | ||
* This file may have been hand-edited. Look for HAND-EDIT comments | ||
* before re-generating it. | ||
*/ | ||
|
||
#ifndef CONNADAPTOR_H_1363412350 | ||
#define CONNADAPTOR_H_1363412350 | ||
|
||
#include <QtCore/QObject> | ||
#include <QtDBus/QtDBus> | ||
class QByteArray; | ||
template<class T> class QList; | ||
template<class Key, class Value> class QMap; | ||
class QString; | ||
class QStringList; | ||
class QVariant; | ||
|
||
/* | ||
* Adaptor class for interface com.jolla.Connectiond | ||
*/ | ||
class ConnAdaptor: public QDBusAbstractAdaptor | ||
{ | ||
Q_OBJECT | ||
Q_CLASSINFO("D-Bus Interface", "com.jolla.Connectiond") | ||
Q_CLASSINFO("D-Bus Introspection", "" | ||
" <interface name=\"com.jolla.Connectiond\">\n" | ||
" <method name=\"sendUserReply\">\n" | ||
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n" | ||
" <arg type=\"a{sv}\" name=\"input\"/>\n" | ||
" </method>\n" | ||
" <method name=\"sendConnectReply\">\n" | ||
" <arg direction=\"in\" type=\"s\"/>\n" | ||
" <arg direction=\"in\" type=\"i\"/>\n" | ||
" </method>\n" | ||
" <signal name=\"userInputRequested\">\n" | ||
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n" | ||
" <arg type=\"s\" name=\"service\"/>\n" | ||
" <arg type=\"a{sv}\" name=\"fields \"/>\n" | ||
" </signal>\n" | ||
" <signal name=\"userInputCanceled\"/>\n" | ||
" <signal name=\"errorReported\">\n" | ||
" <arg type=\"s\" name=\"error\"/>\n" | ||
" </signal>\n" | ||
" <signal name=\"requestBrowser\">\n" | ||
" <arg type=\"s\" name=\"url\"/>\n" | ||
" </signal>\n" | ||
" <signal name=\"connectionRequest\"/>\n" | ||
" </interface>\n" | ||
"") | ||
public: | ||
ConnAdaptor(QObject *parent); | ||
virtual ~ConnAdaptor(); | ||
|
||
public: // PROPERTIES | ||
public Q_SLOTS: // METHODS | ||
void sendConnectReply(const QString &in0, int in1); | ||
void sendUserReply(const QVariantMap &input); | ||
Q_SIGNALS: // SIGNALS | ||
void connectionRequest(); | ||
void errorReported(const QString &error); | ||
void requestBrowser(const QString &url); | ||
void userInputCanceled(); | ||
void userInputRequested(const QString &service, const QVariantMap &fields); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
QT += core network dbus gui | ||
QT -= gui | ||
|
||
TARGET = connectionagent | ||
CONFIG += console | ||
CONFIG -= app_bundle | ||
|
||
TEMPLATE = app | ||
|
||
QT += core network dbus | ||
QT -= gui | ||
|
||
|
||
INCLUDEPATH += libconnman-qt | ||
|
||
OTHER_FILES += com.jolla.Connectiond.xml | ||
|
||
# create adaptor | ||
system(qdbusxml2cpp -c ConnAdaptor -a connadaptor.h:connadaptor.cpp com.jolla.Connectiond.xml) | ||
|
||
SOURCES += main.cpp \ | ||
qconnectionmanager.cpp \ | ||
connadaptor.cpp | ||
|
||
|
||
HEADERS+= \ | ||
qconnectionmanager.h \ | ||
connadaptor.h | ||
|
||
LIBS += -lconnman-qt4 | ||
# LIBS += -llipstick | ||
|
||
target.path = /usr/sbin | ||
INSTALLS += target | ||
|
||
MOC_DIR=.moc | ||
OBJECTS_DIR=.obj | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
#include <QtCore/QCoreApplication> | ||
#include <QTimer> | ||
#include <QDebug> | ||
#include <QDBusConnection> | ||
#include <signal.h> | ||
#include <fcntl.h> | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
|
||
#include "qconnectionmanager.h" | ||
#include "connadaptor.h" | ||
|
||
static void signal_handler(int signum) | ||
{ | ||
switch(signum) { | ||
case SIGHUP: exit(EXIT_FAILURE); break; | ||
case SIGTERM: exit(EXIT_SUCCESS); exit(0); break; | ||
} | ||
} | ||
|
||
static void daemonize(void) | ||
{ | ||
pid_t pid, sid; | ||
int fd; | ||
|
||
if ( getppid() == 1 ) return; | ||
|
||
signal(SIGHUP,signal_handler); | ||
signal(SIGTERM,signal_handler); | ||
|
||
pid = fork(); | ||
if (pid < 0) { | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
if (pid > 0) { | ||
exit(EXIT_SUCCESS); | ||
} | ||
|
||
sid = setsid(); | ||
if (sid < 0) { | ||
exit(EXIT_FAILURE); | ||
} | ||
if ((chdir("/")) < 0) { | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
fd = open("/dev/null",O_RDWR, 0); | ||
|
||
if (fd != -1) { | ||
dup2 (fd, STDIN_FILENO); | ||
dup2 (fd, STDOUT_FILENO); | ||
dup2 (fd, STDERR_FILENO); | ||
|
||
if (fd > 2) { | ||
close (fd); | ||
} | ||
} | ||
|
||
umask(027); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
if (argc > 1) | ||
if (strcmp(argv[1],"-d") == 0) { | ||
daemonize(); | ||
} | ||
|
||
QCoreApplication::setOrganizationName("Jolla Ltd"); | ||
QCoreApplication::setOrganizationDomain("com.jollamobile"); | ||
QCoreApplication::setApplicationName("connectionagent"); | ||
QCoreApplication::setApplicationVersion("1.0"); | ||
|
||
QCoreApplication a(argc, argv); | ||
|
||
QConnectionManager::instance(); | ||
|
||
return a.exec(); | ||
} | ||
|
Oops, something went wrong.