forked from nemomobile/libconnman-qt
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Lorn Potter
committed
Dec 28, 2012
1 parent
8127255
commit b43af37
Showing
10 changed files
with
513 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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,118 @@ | ||
/* | ||
* Copyright © 2012, Jolla Ltd | ||
* | ||
* This program is licensed under the terms and conditions of the | ||
* Apache License, version 2.0. The full text of the Apache License is at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*/ | ||
|
||
#include "networksession.h" | ||
#include "sessionagent.h" | ||
|
||
NetworkSession::NetworkSession(QObject *parent) : | ||
QObject(parent), | ||
m_sessionAgent(0), | ||
m_path("/ConnmanQmlSessionAgent") | ||
{ | ||
} | ||
|
||
NetworkSession::~NetworkSession() | ||
{ | ||
} | ||
|
||
void NetworkSession::registerSession() | ||
{ | ||
if (m_path.isEmpty()) | ||
return; | ||
m_sessionAgent = new SessionAgent(m_path ,this); | ||
connect(m_sessionAgent,SIGNAL(settingsUpdated(QVariantMap)), | ||
this,SLOT(sessionSettingsUpdated(QVariantMap))); | ||
|
||
m_sessionAgent->registerSession(); | ||
} | ||
|
||
QString NetworkSession::state() const | ||
{ | ||
return settingsMap.value("State").toString(); | ||
} | ||
|
||
QString NetworkSession::name() const | ||
{ | ||
return settingsMap.value("Name").toString(); | ||
} | ||
|
||
QString NetworkSession::bearer() const | ||
{ | ||
return settingsMap.value("Bearer").toString(); | ||
} | ||
|
||
QString NetworkSession::sessionInterface() const | ||
{ | ||
return settingsMap.value("Interface").toString(); | ||
} | ||
|
||
QVariantMap NetworkSession::ipv4() const | ||
{ | ||
return settingsMap.value("IPv4").toMap(); | ||
} | ||
|
||
QVariantMap NetworkSession::ipv6() const | ||
{ | ||
return settingsMap.value("IPv6").toMap(); | ||
} | ||
|
||
QStringList NetworkSession::allowedBearers() const | ||
{ | ||
return settingsMap.value("AllowedBearers").toStringList(); | ||
} | ||
|
||
QString NetworkSession::connectionType() const | ||
{ | ||
return settingsMap.value("ConnectionType").toString(); | ||
} | ||
|
||
void NetworkSession::setAllowedBearers(const QStringList &bearers) | ||
{ | ||
settingsMap.insert("AllowedBearers", qVariantFromValue(bearers)); | ||
m_sessionAgent->setAllowedBearers(bearers); | ||
} | ||
|
||
void NetworkSession::setConnectionType(const QString &type) | ||
{ | ||
settingsMap.insert("ConnectionType", qVariantFromValue(type)); | ||
m_sessionAgent->setConnectionType(type); | ||
} | ||
|
||
void NetworkSession::requestDestroy() | ||
{ | ||
m_sessionAgent->requestDestroy(); | ||
} | ||
|
||
void NetworkSession::requestConnect() | ||
{ | ||
m_sessionAgent->requestConnect(); | ||
} | ||
|
||
void NetworkSession::requestDisconnect() | ||
{ | ||
m_sessionAgent->requestDisconnect(); | ||
} | ||
|
||
void NetworkSession::sessionSettingsUpdated(const QVariantMap &settings) | ||
{ | ||
Q_FOREACH(const QString &name, settings.keys()) { | ||
settingsMap.insert(name,settings[name]); | ||
} | ||
Q_EMIT settingsChanged(settings); | ||
} | ||
|
||
QString NetworkSession::path() const | ||
{ | ||
return m_path; | ||
} | ||
|
||
void NetworkSession::setPath(const QString &path) | ||
{ | ||
m_path = path; | ||
} |
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,73 @@ | ||
/* | ||
* Copyright © 2012, Jolla Ltd | ||
* | ||
* This program is licensed under the terms and conditions of the | ||
* Apache License, version 2.0. The full text of the Apache License is at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*/ | ||
|
||
|
||
#ifndef SESSIONSERVICE_H | ||
#define SESSIONSERVICE_H | ||
|
||
#include <QObject> | ||
#include <QtDBus> | ||
|
||
class SessionAgent; | ||
|
||
class NetworkSession : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(QString state READ state) | ||
Q_PROPERTY(QString name READ name) | ||
Q_PROPERTY(QString bearer READ bearer) | ||
Q_PROPERTY(QString sessionInterface READ sessionInterface) | ||
Q_PROPERTY(QVariantMap ipv4 READ ipv4) | ||
Q_PROPERTY(QVariantMap ipv6 READ ipv6) | ||
|
||
Q_PROPERTY(QString path READ path WRITE setPath) | ||
|
||
Q_PROPERTY(QStringList allowedBearers READ allowedBearers WRITE setAllowedBearers NOTIFY allowedBearersChanged) | ||
Q_PROPERTY(QString connectionType READ connectionType WRITE setConnectionType NOTIFY connectionTypeChanged) | ||
|
||
public: | ||
NetworkSession(QObject *parent = 0); | ||
virtual ~NetworkSession(); | ||
|
||
//Settings | ||
QString state() const; | ||
QString name() const; | ||
QString bearer() const; | ||
QString sessionInterface() const; | ||
QVariantMap ipv4() const; | ||
QVariantMap ipv6() const; | ||
QStringList allowedBearers() const; | ||
QString connectionType() const; | ||
|
||
QString path() const; | ||
|
||
void setAllowedBearers(const QStringList &bearers); | ||
void setConnectionType(const QString &type); | ||
|
||
signals: | ||
|
||
void allowedBearersChanged(const QStringList &bearers); | ||
void connectionTypeChanged(const QString &type); | ||
void settingsChanged(const QVariantMap &settings); | ||
|
||
public slots: | ||
void requestDestroy(); | ||
void requestConnect(); | ||
void requestDisconnect(); | ||
void sessionSettingsUpdated(const QVariantMap &settings); | ||
void setPath(const QString &path); | ||
void registerSession(); | ||
|
||
private: | ||
SessionAgent *m_sessionAgent; | ||
QVariantMap settingsMap; | ||
QString m_path; | ||
}; | ||
|
||
#endif // SESSIONSERVICE_H |
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,25 @@ | ||
/* | ||
* Copyright © 2012, Jolla. | ||
* | ||
* This program is licensed under the terms and conditions of the | ||
* Apache License, version 2.0. The full text of the Apache License is at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*/ | ||
|
||
#include "session.h" | ||
|
||
/* | ||
* Implementation of interface class Session | ||
*/ | ||
|
||
Session::Session(const QString &path, QObject *parent) | ||
: QDBusAbstractInterface(staticConnmanService(), path, staticInterfaceName(), QDBusConnection::systemBus(), parent) | ||
{ | ||
qDebug() << Q_FUNC_INFO; | ||
} | ||
|
||
Session::~Session() | ||
{ | ||
} | ||
|
Oops, something went wrong.