From c03fcde202a0dea22e753b3a380081415861d9da Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 22 Nov 2013 12:04:18 +0100 Subject: Add license headers Add an Enterprise License header to source files. Change-Id: I373886dade31ce00d4c10c64ebaf8ba226d5a62d Reviewed-by: Eirik Aavitsland --- src/imports/wifi/qwifimanager.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/imports/wifi/qwifimanager.h') diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h index 5fd74f5..59f2b44 100644 --- a/src/imports/wifi/qwifimanager.h +++ b/src/imports/wifi/qwifimanager.h @@ -1,3 +1,21 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://qt.digia.com/ +** +****************************************************************************/ #ifndef QWIFIMANAGER_H #define QWIFIMANAGER_H -- cgit v1.2.3 From 696510db8f43427a9bb6ff249f688851f531cd12 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 2 Jan 2014 15:57:14 +0100 Subject: Fix dhcp issues and improve public API - Use qconnectivity daemon for dhcp requests. Since dhcp requests are executed in other process we don't block gui thread for this lengthy operation. - Why not to use "do_dhcp_request" - it is a legacy implementation of a dhcp client and is not used anywhere in the Android source code itself. It appears that do_dhcp_request was not removed from the libhardware_legacy to keep compatibility for others, whose code might still depend on it. - Differnet changes to the internal implementation and the public API. - Add 'Interface' singleton type, installing a singleton type allows developers to provide arbitrary functionality to a client without requiring individual instances of the type to be instantiated by the client. We use this to determine if Android has wifi interface. Change-Id: I836f3a2a587b1ebf9f670ed08b10fe3483504b9e Reviewed-by: Eirik Aavitsland --- src/imports/wifi/qwifimanager.h | 65 ++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'src/imports/wifi/qwifimanager.h') diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h index 59f2b44..85384cc 100644 --- a/src/imports/wifi/qwifimanager.h +++ b/src/imports/wifi/qwifimanager.h @@ -21,6 +21,9 @@ #include #include +#include + +#include #include "qwifinetworklist.h" @@ -29,71 +32,73 @@ class QWifiManagerEventThread; class QWifiManager : public QObject { Q_OBJECT - - Q_PROPERTY(bool ready READ isReady NOTIFY readyChanged) - Q_PROPERTY(bool online READ isOnline NOTIFY onlineChanged) + Q_ENUMS(NetworkState) + Q_PROPERTY(NetworkState networkState READ networkState NOTIFY networkStateChanged) + Q_PROPERTY(bool backendReady READ isbackendReady NOTIFY backendReadyChanged) Q_PROPERTY(bool scanning READ scanning WRITE setScanning NOTIFY scanningChanged) - Q_PROPERTY(QString connectedSSID READ connectedSSID NOTIFY connectedSSIDChanged) Q_PROPERTY(QWifiNetworkList *networks READ networks CONSTANT) public: - enum InternalState { - IS_Uninitialized, - IS_LoadDriver, - IS_StartBackend, - IS_ConnectToBackend, - IS_UpAndRunning + enum NetworkState { + Disconnected, + ObtainingIPAddress, + DhcpRequestFailed, + Connected }; QWifiManager(); + ~QWifiManager(); QWifiNetworkList *networks() { return &m_networks; } - QString connectedSSID() const { return m_connectedSSID; } - bool scanning() const { return m_scanning; } void setScanning(bool scanning); - - bool isReady() const { return m_internalState == IS_UpAndRunning; } - bool isOnline() const { return m_online; } - + NetworkState networkState() const { return m_state; } + bool isbackendReady() const { return m_backendReady; } + bool exiting() const { return m_exiting; } public slots: void start(); - + void stop(); void connect(QWifiNetwork *network, const QString &passphrase); + void disconnect(); signals: void scanningChanged(bool arg); - void readyChanged(bool ready); - void onlineChanged(bool online); + void networkStateChanged(); + void backendReadyChanged(); void connectedSSIDChanged(const QString &); protected: bool event(QEvent *); + void sendDhcpRequest(const QByteArray &request); + void handleConnected(); + void connectToBackend(); + void disconnectFromBackend(); + QByteArray call(const char *command) const; + bool checkedCall(const char *command) const; + +protected slots: + void connectedToDaemon(); + void handleDhcpReply(); private: friend class QWifiManagerEventThread; - void handleConnected(); - void parseScanResults(); - void connectToBackend(); - QByteArray call(const char *command); - bool checkedCall(const char *command); - QString m_connectedSSID; QWifiNetworkList m_networks; - QWifiManagerEventThread *m_eventThread; int m_scanTimer; - - InternalState m_internalState; - bool m_scanning; - bool m_online; + bool m_backendReady; + QByteArray m_interface; + NetworkState m_state; + QLocalSocket *m_daemonClientSocket; + QByteArray m_request; + bool m_exiting; }; #endif // QWIFIMANAGER_H -- cgit v1.2.3 From eb7f5c21121d7a5fe86b52ec04337d77bc9f3cf4 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 29 Jan 2014 19:07:20 +0100 Subject: Make sure that wifi event thread doesn't block on exit After setting m_exitEventThread to True we need to generate wifi event, otherwise there might be cases that we block in wifi_wait_for_event and wifi event thread never exits. Change-Id: I699ca0c25e23abc7045c1850bf773443bac897e8 Reviewed-by: Eirik Aavitsland --- src/imports/wifi/qwifimanager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/imports/wifi/qwifimanager.h') diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h index 85384cc..c9ba2ef 100644 --- a/src/imports/wifi/qwifimanager.h +++ b/src/imports/wifi/qwifimanager.h @@ -56,7 +56,7 @@ public: void setScanning(bool scanning); NetworkState networkState() const { return m_state; } bool isbackendReady() const { return m_backendReady; } - bool exiting() const { return m_exiting; } + bool exitingEventThread() const { return m_exitingEventThread; } public slots: void start(); @@ -98,7 +98,7 @@ private: NetworkState m_state; QLocalSocket *m_daemonClientSocket; QByteArray m_request; - bool m_exiting; + bool m_exitingEventThread; }; #endif // QWIFIMANAGER_H -- cgit v1.2.3 From b7347b14ba53a3d847ec783855a2c46101fafac3 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 11 Feb 2014 13:48:34 +0100 Subject: Update copyright year MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic818e79d7bfca04bd8a8d8aa12b3ff70ea26a7a3 Reviewed-by: Topi Reiniƶ --- src/imports/wifi/qwifimanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/imports/wifi/qwifimanager.h') diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h index c9ba2ef..432f411 100644 --- a/src/imports/wifi/qwifimanager.h +++ b/src/imports/wifi/qwifimanager.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use the contact form at ** http://qt.digia.com/ -- cgit v1.2.3