I have made the following changes intended for : CE:MW:Shared / connman-qt
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/8161 Thank You, lpotter [This message was auto-generated] --- Request # 8161: Messages from BOSS: State: review at 2013-02-21T03:05:07 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:lpotter:branches:CE:MW:Shared / connman-qt -> CE:MW:Shared / connman-qt changes files: -------------- --- connman-qt.changes +++ connman-qt.changes @@ -0,0 +1,4 @@ +* Thu Feb 21 2013 Lorn Potter <[email protected]> - 0.4.3.2 +- bumped version to 0.4.3.2 +- various fixes + @@ -2 +6 @@ -- bumped version to 0.4.2 +- bumped version to 0.4.3 old: ---- connman-qt-0.4.3.tar.bz2 new: ---- connman-qt-0.4.3.2.tar.bz2 spec files: ----------- --- connman-qt.spec +++ connman-qt.spec @@ -9,7 +9,7 @@ # << macros Summary: qt bindings for connman -Version: 0.4.3 +Version: 0.4.3.2 Release: 1 Group: System/GUI/Other License: Apache License other changes: -------------- ++++++ connman-qt-0.4.3.tar.bz2 -> connman-qt-0.4.3.2.tar.bz2 --- README.rst +++ README.rst @@ -5,6 +5,8 @@ the class `NetworkManager` represents `net.connman.Manager`, `NetworkTechnology` represents `net.connman.Technology` and `NetworkService` represents `net.connman.Service`. +`NetworkSession` represents `net.connman.Session`. +`NetworkTechnology` represents `net.connman.Technology`. `TechnologyModel` is a QML component representing a list of network services of a given technology. @@ -15,3 +17,26 @@ `NetworkManager`. Also it provides the D-Bus interface `net.connman.Agent`. .. warning:: `NetworkingModel` is going to be deprecated. + +These classes are written to be re-usable in the qml environment, by setting the +path property to that of an appropriate dbus path, will re-initialize the object to be used for the path given. + + +QMake CONFIG flags +----------- +* notest: doesn't compile test program +* noplugin: doesn't compile qml plugin + +Example: +``qmake CONFIG+=notest`` + +The requestConnect signal in UserAgent requires a patch to connman. +http://gitweb.merproject.org/gitweb?p=mer-core/connman.git;a=blob_plain;f=0003-connman-request-connect-notify.patch;hb=HEAD + +This allows a signal being sent to the UserAgent when there is a connection started/tried but no technology is connected. +This only works if you use that patch and connman's dnsproxy. + +The Agent class has two answers it can handle "Clear" and "Suppress" +"Suppress" will suppress the request signal for the timeout period or until "Clear" is sent to the agent. + + --- connman-qt.pro +++ connman-qt.pro @@ -1,5 +1,13 @@ TEMPLATE = subdirs -SUBDIRS += libconnman-qt plugin -SUBDIRS += test CONFIG += ordered +SUBDIRS += libconnman-qt +# CONFIG flag to disable qml plugin +!noplugin { + SUBDIRS += plugin +} + +# CONFIG flag to disable test program +!notest { + SUBDIRS += test +} --- libconnman-qt/connman-manager.xml +++ libconnman-qt/connman-manager.xml @@ -39,15 +39,19 @@ <method name="UnregisterCounter" tp:name-for-bindings="Unregister_Counter"> <arg name="path" type="o"/> </method> + <arg name="settings" type="a{sv}"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> <method name="DestroySession" tp:name-for-bindings="Destroy_Session"> <arg name="session" type="o"/> </method> <method name="RequestPrivateNetwork" tp:name-for-bindings="Request_Privete_Network"> - <arg name="options" type="a{sv}"> - <arg name="path" type="o" direction="out"/> - <arg name="dict" type="a{sv}" direction="out"/> - <arg name="fd" type="i" direction="out"/> + <arg name="options" type="a{sv}"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> + <arg name="path" type="o" direction="out"/> + <arg name="dict" type="a{sv}" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/> + <arg name="fd" type="i" direction="out"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> @@ -67,8 +71,8 @@ <signal name="ServicesChanged" tp:name-for-bindings="Services_Changed"> <arg name="changed" type="a(oa{sv})"/> - <arg name="removed" type="ao"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ConnmanObjectList"/> + <arg name="removed" type="ao"/> </signal> <signal name="PropertyChanged" tp:name-for-bindings="Property_Changed"> --- libconnman-qt/connman-session.xml +++ libconnman-qt/connman-session.xml @@ -9,12 +9,12 @@ <method name="Disconnect" tp:name-for-bindings="Disconnect" /> <method name="Change" tp:name-for-bindings="Change"> - <arg name="name" type="s"> - <arg name="value" type="v"> + <arg name="name" type="s"/> + <arg name="value" type="v"/> </method> <method name="Update" tp:name-for-bindings="Update"/> - <arg name="settings" type="a{sv}"> + <arg name="settings" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value=QVariantMap"/> </method> --- libconnman-qt/counter.cpp +++ libconnman-qt/counter.cpp @@ -10,6 +10,7 @@ #include <QtDBus/QDBusConnection> #include "counter.h" +#include "networkmanager.h" static const char COUNTER_PATH[] = "/ConnectivityCounter"; --- libconnman-qt/counter.h +++ libconnman-qt/counter.h @@ -15,7 +15,7 @@ #include <QtDBus/QDBusAbstractAdaptor> #include <QtDBus/QDBusObjectPath> -#include <networkmanager.h> +class NetworkManager; class Counter : public QObject { --- libconnman-qt/networkmanager.cpp +++ libconnman-qt/networkmanager.cpp @@ -428,3 +428,12 @@ } return QString(); } + +QStringList NetworkManager::technologiesList() +{ + QStringList techList; + foreach (NetworkTechnology *tech, m_technologiesCache) { + techList << tech->type(); + } + return techList; +} --- libconnman-qt/networkmanager.h +++ libconnman-qt/networkmanager.h @@ -38,7 +38,6 @@ Q_PROPERTY(NetworkService* defaultRoute READ defaultRoute NOTIFY defaultRouteChanged) Q_PROPERTY(bool sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged) - Q_PROPERTY(QString serviceAdded NOTIFY serviceAdded) public: NetworkManager(QObject* parent=0); @@ -110,7 +109,6 @@ static const QString State; static const QString OfflineMode; static const QString SessionMode; - QStringList m_servicesList; bool m_available; --- libconnman-qt/networkservice.cpp +++ libconnman-qt/networkservice.cpp @@ -81,6 +81,10 @@ return m_propertiesCache.value(State).toString(); } +const QString NetworkService::error() const { + return m_propertiesCache.value(Error).toString(); +} + const QString NetworkService::type() const { return m_propertiesCache.value(Type).toString(); } @@ -161,11 +165,11 @@ QDBusPendingReply<> conn_reply = m_service->Connect(); m_service->setTimeout(old_timeout); - dbg_connectWatcher = new QDBusPendingCallWatcher(conn_reply, m_service); - connect(dbg_connectWatcher, + m_connectReqWatcher = new QDBusPendingCallWatcher(conn_reply, m_service); + connect(m_connectReqWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, - SLOT(dbg_connectReply(QDBusPendingCallWatcher*))); + SLOT(handleConnectReply(QDBusPendingCallWatcher*))); } void NetworkService::requestDisconnect() @@ -214,21 +218,21 @@ m_service->SetProperty(ProxyConfig, QDBusVariant(QVariant(adaptToConnmanProperties(proxy)))); } -/* this slot is used for debugging */ -void NetworkService::dbg_connectReply(QDBusPendingCallWatcher *call) +void NetworkService::handleConnectReply(QDBusPendingCallWatcher *call) { - pr_dbg() << "Got something from service.connect()"; Q_ASSERT(call); QDBusPendingReply<> reply = *call; + if (!reply.isFinished()) { pr_dbg() << "connect() not finished yet"; } if (reply.isError()) { pr_dbg() << "Reply from service.connect(): " << reply.error().message(); + emit connectRequestFailed(reply.error().message()); } } -void NetworkService::propertyChanged(const QString &name, const QDBusVariant &value) +void NetworkService::updateProperty(const QString &name, const QDBusVariant &value) { QVariant tmp = value.variant(); @@ -238,6 +242,8 @@ if (name == Name) { emit nameChanged(tmp.toString()); + } else if (name == Error) { + emit errorChanged(tmp.toString()); } else if (name == State) { emit stateChanged(tmp.toString()); } else if (name == Security) { @@ -283,6 +289,7 @@ if (m_service) { delete m_service; m_service = 0; + m_propertiesCache.clear(); } m_service = new Service("net.connman", m_path, QDBusConnection::systemBus(), this); @@ -298,6 +305,6 @@ } connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)), - this, SLOT(propertyChanged(QString,QDBusVariant))); + this, SLOT(updateProperty(QString,QDBusVariant))); } } --- libconnman-qt/networkservice.h +++ libconnman-qt/networkservice.h @@ -25,6 +25,7 @@ Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(QString state READ state NOTIFY stateChanged) Q_PROPERTY(QString type READ type NOTIFY typeChanged) + Q_PROPERTY(QString error READ error NOTIFY errorChanged) Q_PROPERTY(QStringList security READ security NOTIFY securityChanged) Q_PROPERTY(uint strength READ strength NOTIFY strengthChanged) Q_PROPERTY(bool favorite READ favorite NOTIFY favoriteChanged) @@ -51,6 +52,7 @@ const QString name() const; const QString type() const; const QString state() const; + const QString error() const; const QStringList security() const; bool autoConnect() const; uint strength() const; @@ -73,6 +75,7 @@ signals: void nameChanged(const QString &name); void stateChanged(const QString &state); + void errorChanged(const QString &error); void securityChanged(const QStringList &security); void strengthChanged(const uint strength); void favoriteChanged(const bool &favorite); @@ -89,6 +92,7 @@ void proxyChanged(const QVariantMap &proxy); void proxyConfigChanged(const QVariantMap &proxy); void ethernetChanged(const QVariantMap ðernet); + void connectRequestFailed(const QString &error); void typeChanged(const QString &type); public slots: @@ -108,7 +112,7 @@ QString m_path; QVariantMap m_propertiesCache; - QDBusPendingCallWatcher *dbg_connectWatcher; + QDBusPendingCallWatcher *m_connectReqWatcher; static const QString Name; static const QString State; @@ -131,8 +135,8 @@ static const QString Ethernet; private slots: - void propertyChanged(const QString &name, const QDBusVariant &value); - void dbg_connectReply(QDBusPendingCallWatcher *call); + void updateProperty(const QString &name, const QDBusVariant &value); + void handleConnectReply(QDBusPendingCallWatcher *call); private: Q_DISABLE_COPY(NetworkService); --- libconnman-qt/networktechnology.cpp +++ libconnman-qt/networktechnology.cpp @@ -16,7 +16,6 @@ const QString NetworkTechnology::Type("Type"); const QString NetworkTechnology::Powered("Powered"); const QString NetworkTechnology::Connected("Connected"); -const QString NetworkTechnology::State("State"); NetworkTechnology::NetworkTechnology(const QString &path, const QVariantMap &properties, QObject* parent) : QObject(parent), @@ -56,11 +55,11 @@ throw -1; // FIXME } - if (m_propertiesCache.isEmpty()) { +// if (m_propertiesCache.isEmpty()) { QDBusReply<QVariantMap> reply; reply = m_technology->GetProperties(); m_propertiesCache = reply.value(); - } +// } connect(m_technology, SIGNAL(PropertyChanged(const QString&, const QDBusVariant&)), @@ -139,13 +138,10 @@ Q_ASSERT(m_technology); m_propertiesCache[name] = tmp; - if (name == Powered) { emit poweredChanged(tmp.toBool()); } else if (name == Connected) { emit connectedChanged(tmp.toBool()); - } else if (name == State) { - Q_EMIT stateChanged(tmp.toString()); } } @@ -156,11 +152,6 @@ emit scanFinished(); } -QString NetworkTechnology::state() const -{ - return m_propertiesCache[NetworkTechnology::State].toString(); -} - QString NetworkTechnology::path() const { return m_path; --- libconnman-qt/networktechnology.h +++ libconnman-qt/networktechnology.h @@ -23,8 +23,6 @@ Q_PROPERTY(QString type READ type) Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged) Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) - Q_PROPERTY(QString state READ state NOTIFY stateChanged) - Q_PROPERTY(QString path READ path WRITE setPath) public: @@ -38,7 +36,6 @@ bool powered() const; bool connected() const; const QString objPath() const; - QString state() const; QString path() const; @@ -51,7 +48,6 @@ void poweredChanged(const bool &powered); void connectedChanged(const bool &connected); void scanFinished(); - void stateChanged(const QString &state); private: Technology *m_technology; @@ -62,7 +58,6 @@ static const QString Type; static const QString Powered; static const QString Connected; - static const QString State; QString m_path; void init(const QString &path); --- libconnman-qt/sessionagent.cpp +++ libconnman-qt/sessionagent.cpp @@ -7,7 +7,7 @@ * */ -#include <debug.h> +#include "debug.h" #include "sessionagent.h" #include "session.h" @@ -31,7 +31,7 @@ QObject(parent), agentPath(path), m_session(0), - m_manager(NetworkManagerFactory::createInstance()) + m_manager(NetworkManagerFactory::createInstance()) { m_manager->setSessionMode(true); createSession(); --- libconnman-qt/useragent.cpp +++ libconnman-qt/useragent.cpp @@ -7,31 +7,29 @@ * */ -#include <debug.h> +#include "debug.h" #include "useragent.h" +#include "networkmanager.h" static const char AGENT_PATH[] = "/ConnectivityUserAgent"; UserAgent::UserAgent(QObject* parent) : QObject(parent), m_req_data(NULL), - m_manager(NetworkManagerFactory::createInstance()) - , requestType(TYPE_DEFAULT) + m_manager(NetworkManagerFactory::createInstance()), + requestType(TYPE_DEFAULT), + agentPath(QString()) { - new AgentAdaptor(this); // this object will be freed when UserAgent is freed - QDBusConnection::systemBus().registerObject(AGENT_PATH, this); - - if (m_manager->isAvailable()) { - m_manager->unregisterAgent(QString(AGENT_PATH)); - m_manager->registerAgent(QString(AGENT_PATH)); - } + QString agentpath = QLatin1String("/ConnectivityUserAgent"); + setAgentPath(agentpath); connect(m_manager, SIGNAL(availabilityChanged(bool)), this, SLOT(updateMgrAvailability(bool))); + } UserAgent::~UserAgent() { - m_manager->unregisterAgent(QString(AGENT_PATH)); + m_manager->unregisterAgent(QString(agentPath)); } void UserAgent::requestUserInput(ServiceRequestData* data) @@ -97,7 +95,7 @@ void UserAgent::updateMgrAvailability(bool available) { if (available) { - m_manager->registerAgent(QString(AGENT_PATH)); + m_manager->registerAgent(QString(agentPath)); } } @@ -136,16 +134,34 @@ if (!QDBusConnection::systemBus().send(error)) { qDebug() << "Could not queue message"; } + if (connectionRequestType() == "Suppress") { return; } - setConnectionRequestType("Suppress"); - Q_EMIT userConnectRequested(msg); Q_EMIT connectionRequest(); + Q_EMIT userConnectRequested(msg); + setConnectionRequestType("Suppress"); +} + +QString UserAgent::path() const +{ + return agentPath; +} + +void UserAgent::setAgentPath(QString &path) +{ + new AgentAdaptor(this); // this object will be freed when UserAgent is freed + agentPath = path; + QDBusConnection::systemBus().registerObject(agentPath, this); + + if (m_manager->isAvailable()) { + m_manager->registerAgent(QString(agentPath)); + } } //////////////////// + AgentAdaptor::AgentAdaptor(UserAgent* parent) : QDBusAbstractAdaptor(parent), m_userAgent(parent) @@ -201,3 +217,5 @@ { m_userAgent->requestConnect(message); } + + --- libconnman-qt/useragent.h +++ libconnman-qt/useragent.h @@ -10,7 +10,11 @@ #ifndef USERAGENT_H #define USERAGENT_H -#include <networkmanager.h> +#include <QDBusMessage> +#include <QDBusObjectPath> +#include <QDBusAbstractAdaptor> + +class NetworkManager; struct ServiceRequestData { @@ -24,6 +28,8 @@ { Q_OBJECT Q_PROPERTY(QString connectionRequestType READ connectionRequestType WRITE setConnectionRequestType) + Q_PROPERTY(void connectionRequest NOTIFY connectionRequest) + Q_PROPERTY(QString path READ path WRITE setAgentPath) Q_DISABLE_COPY(UserAgent) public: @@ -42,6 +48,9 @@ void setConnectionRequestType(const QString &type); QString connectionRequestType() const; + QString path() const; + void setAgentPath(QString &path); + signals: void userInputRequested(const QString &servicePath, const QVariantList &fields); void userInputCanceled(); @@ -52,7 +61,6 @@ private slots: void updateMgrAvailability(bool); - void requestTimeout(); private: @@ -65,6 +73,7 @@ NetworkManager* m_manager; QDBusMessage currentDbusMessage; ConnectionRequestType requestType; + QString agentPath; friend class AgentAdaptor; }; --- plugin/technologymodel.cpp +++ plugin/technologymodel.cpp @@ -19,11 +19,7 @@ connect(tech, \ SIGNAL(scanFinished()), \ this, \ - SLOT(finishedScan())); \ - connect(tech, \ - SIGNAL(stateChanged(QString)), \ - this, \ - SIGNAL(stateChanged(QString))) + SLOT(finishedScan())); TechnologyModel::TechnologyModel(QAbstractListModel* parent) @@ -114,33 +110,33 @@ if (m_techname == name) { return; } - QStringList netTypes; - netTypes << "ethernet"; - netTypes << "wifi"; - netTypes << "cellular"; - netTypes << "bluetooth"; + QStringList netTypes = m_manager->technologiesList(); + + bool oldPowered(false); if (!netTypes.contains(name)) { - qDebug() << name << "is not a known technology name"; + qDebug() << name << "is not a known technology name:" << netTypes; return; } - bool oldPowered(false); + if (m_tech) { + oldPowered = m_tech->powered(); + disconnect(m_tech, SIGNAL(poweredChanged(bool)), + this, SLOT(changedPower(bool))); + disconnect(m_tech, SIGNAL(scanFinished()), + this, SLOT(finishedScan())); + } - m_techname = name; - m_tech = m_manager->getTechnology(m_techname); + m_tech = m_manager->getTechnology(name); if (!m_tech) { - if (oldPowered) { - emit poweredChanged(false); - } return; } else { + m_techname = name; emit nameChanged(m_techname); if (oldPowered != m_tech->powered()) { emit poweredChanged(!oldPowered); } - CONNECT_TECHNOLOGY_SIGNALS(m_tech); } } @@ -234,3 +230,4 @@ if (tech->type() == m_tech->type()) Q_EMIT scanRequestFinished(); } + --- plugin/technologymodel.h +++ plugin/technologymodel.h @@ -58,7 +58,6 @@ void availabilityChanged(const bool &available); void poweredChanged(const bool &powered); void technologiesChanged(); - void stateChanged(const QString &state); void scanRequestFinished(); ++++++ connman-qt.yaml --- connman-qt.yaml +++ connman-qt.yaml @@ -1,6 +1,6 @@ Name: connman-qt Summary: qt bindings for connman -Version: 0.4.3 +Version: 0.4.3.2 Release: 1 Group: System/GUI/Other License: Apache License
