diff options
author | Kalle Viironen <kalle.viironen@digia.com> | 2014-02-21 12:24:09 +0200 |
---|---|---|
committer | Kalle Viironen <kalle.viironen@digia.com> | 2014-02-21 12:27:37 +0200 |
commit | 436af494659d416cfbd531b8d3ba9fc49e2fa710 (patch) | |
tree | ab5e6b48e711a3c3a2e2cd4399ce1b3d34347406 /src/imports/wifi/qwifimanager.h | |
parent | a10b8b669d357325e9f0b735bcda42758ad2b3d0 (diff) | |
parent | 4738811e35a559d238ba20703eb792fca8f5756b (diff) |
Merge branch 'stable' into releaseQtEE_v2.0.0
* stable: (90 commits)
Doc: Document support services for Yocto recipes
doc: minor changes to customization inline code blocks
Doc: Clarify which Qt Creator templates work out of the box
Doc: Fix missing sudo for i.MX6 embedded Linux deployment
Doc: Fixed 32bit package install command for newer ubuntu versions
doc: add quide how to use b2qt_build_scripts
Doc: Add instructions how to install newer VirtualBox
[Wifi] Fix initialization code
Doc: Explain about disabling surfaceflinger
Enable internet on eAndroid emulator
Doc: Add instructions for building Boot2Qt demos
Doc: Troubleshooting entry for BeagleBone Black HDMI issues
Don't use wifi on Emulator
Doc: Document building your own embedded linux stack
Update copyright year
Doc: Fix the 2.0 release date
Doc: ChangeLog: Remove 'black screen after exit' from bugfixes
Doc: Use a global Qt documentation template
Doc: Add changelog
Disable QConnectivity daemon on emulator
...
Change-Id: I25ba7e19677c3d91d5e78ab68291296face3c073
Diffstat (limited to 'src/imports/wifi/qwifimanager.h')
-rw-r--r-- | src/imports/wifi/qwifimanager.h | 83 |
1 files changed, 53 insertions, 30 deletions
diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h index 5fd74f5..432f411 100644 --- a/src/imports/wifi/qwifimanager.h +++ b/src/imports/wifi/qwifimanager.h @@ -1,8 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 #include <QtCore/QObject> #include <QtCore/QByteArray> +#include <QtNetwork/QLocalSocket> + +#include <cutils/properties.h> #include "qwifinetworklist.h" @@ -11,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 exitingEventThread() const { return m_exitingEventThread; } 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_exitingEventThread; }; #endif // QWIFIMANAGER_H |