summaryrefslogtreecommitdiffstats
path: root/examples/wifi
diff options
context:
space:
mode:
Diffstat (limited to 'examples/wifi')
-rw-r--r--examples/wifi/wifi-cpp/doc/images/wifi-cpp.jpgbin41866 -> 0 bytes
-rw-r--r--examples/wifi/wifi-cpp/doc/src/wifi-cpp.qdoc97
-rw-r--r--examples/wifi/wifi-cpp/main.cpp228
-rw-r--r--examples/wifi/wifi-cpp/wifi-cpp.pro9
-rw-r--r--examples/wifi/wifi-qml/WifiConnectionHandler.qml51
-rw-r--r--examples/wifi/wifi-qml/WifiScanner.qml249
-rw-r--r--examples/wifi/wifi-qml/doc/images/wifi-qml.jpgbin76197 -> 0 bytes
-rw-r--r--examples/wifi/wifi-qml/doc/src/wifi-qml.qdoc85
-rw-r--r--examples/wifi/wifi-qml/main.cpp30
-rw-r--r--examples/wifi/wifi-qml/main.qml32
-rw-r--r--examples/wifi/wifi-qml/qml.qrc7
-rw-r--r--examples/wifi/wifi-qml/wifi-qml.pro11
-rw-r--r--examples/wifi/wifi.pro4
13 files changed, 0 insertions, 803 deletions
diff --git a/examples/wifi/wifi-cpp/doc/images/wifi-cpp.jpg b/examples/wifi/wifi-cpp/doc/images/wifi-cpp.jpg
deleted file mode 100644
index 90feb20..0000000
--- a/examples/wifi/wifi-cpp/doc/images/wifi-cpp.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/wifi/wifi-cpp/doc/src/wifi-cpp.qdoc b/examples/wifi/wifi-cpp/doc/src/wifi-cpp.qdoc
deleted file mode 100644
index 334dba7..0000000
--- a/examples/wifi/wifi-cpp/doc/src/wifi-cpp.qdoc
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-/*!
- \title Getting Started with B2Qt.Wifi in C++
- \example wifi/wifi-cpp
- \ingroup wifi-examples
- \brief Guide to getting started with B2Qt.Wifi using C++.
-
- \section1 Preparing the Application
-
- Use the following \c include statement to access the C++ classes:
-
- \code
- #include <B2QtWifi>
- \endcode
-
- Before building your application, add the following statement to your
- \c .pro file to link against the B2Qt.Wifi library:
-
- \code
- QT += b2qtwifi
- \endcode
-
- This guide will demonstrate how to create a Qt Widget-based application
- that utilizes the B2Qt.Wifi API to set up a wifi network connection. We
- will start by looking at how to scan for wifi access points, and how to
- display and process this data in the application. At the end of the guide
- we will show how to connect directly to a known wifi network configuration.
-
- \image wifi-cpp.jpg
-
- \section1 Listing Wifi Networks
-
- First we need to set up QListView widget which we will use to list wifi
- networks that can be detected by the device. The detected network access
- points are packed as a list-based data model and can be retrieved using
- QWifiManager::networks. Here we also set a custom item delegate and
- connect to two QWifiManager signals.
-
- \snippet wifi/wifi-cpp/main.cpp 0
-
- \section1 Creating a Delegate
-
- The Wifi network model has many data roles that describe the different
- properties of Wifi network. This data can be used by an application to list
- detailed network information and/or to create QWifiConfiguration objects.
- In this example we are interested in the network name. In the paint()
- method we check if the network name is equal to the currently active
- network connection, and append appropriate network state information.
-
- \snippet wifi/wifi-cpp/main.cpp 1
-
- \section1 Connecting to a Selected Network
-
- On press of the \uicontrol Connect button, connetToNetwork() slot gets
- invoked. In this slot we query network properties for the selected network
- and create a QWifiConfiguration object, which we later pass to the
- QWifiManager::connect function to set up a connection. During this
- operation any changes in the network state is reported by QWifiManager
- asynchronously.
-
- \snippet wifi/wifi-cpp/main.cpp 2
-
- We use QWifiManager::NetworkState change event handler to trigger the
- repainting of the delegate. This way, we can present a current network
- state to the user.
-
- \snippet wifi/wifi-cpp/main.cpp 4
-
- \section1 Connecting To a Known Network
-
- If you already know the network configuration beforehand, you can skip the
- network scanning, listing and selection steps. This can be a valid use-case
- for devices that do not change their physical location.
-
- QWifiManager::BackendState change events are reported asynchronously, so we
- must connect the signal to a slot that connects to the network access point
- after the backend initialization is complete.
-
- \snippet wifi/wifi-cpp/main.cpp 3
- */
diff --git a/examples/wifi/wifi-cpp/main.cpp b/examples/wifi/wifi-cpp/main.cpp
deleted file mode 100644
index 54a35e9..0000000
--- a/examples/wifi/wifi-cpp/main.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-#include <QtCore>
-#include <QtWidgets>
-#include <B2QtWifi>
-
-class NetworkDelegate : public QStyledItemDelegate
-{
- Q_OBJECT
-//! [1]
-public:
- NetworkDelegate(QObject *parent = 0)
- : QStyledItemDelegate(parent)
- {
- m_wifiManager = QWifiManager::instance();
- }
-
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
- {
- QStyledItemDelegate::paint(painter, option, index);
- painter->save();
- QString ssid = qvariant_cast<QString>(index.data(QWifiManager::SSID));
- if (ssid == m_wifiManager->currentSSID())
- ssid += networkStateText();
- painter->drawText(option.rect, Qt::AlignVCenter, ssid);
- painter->restore();
- }
-
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
- {
- QFont font = QApplication::font();
- QFontMetrics fm(font);
- return QSize(option.rect.width(), fm.height() * 2);
- }
-
-protected:
- QString networkStateText() const
- {
- QWifiManager::NetworkState networkState = m_wifiManager->networkState();
- switch (networkState) {
- case QWifiManager::Disconnected:
- return QStringLiteral("");
- break;
- case QWifiManager::Authenticating:
- return QStringLiteral(" (authenticating)");
- break;
- case QWifiManager::HandshakeFailed:
- return QStringLiteral(" (handshake failed)");
- break;
- case QWifiManager::ObtainingIPAddress:
- return QStringLiteral(" (obtaining IP address)");
- break;
- case QWifiManager::DhcpRequestFailed:
- return QStringLiteral(" (dhcp request failed)");
- break;
- case QWifiManager::Connected:
- return QStringLiteral(" (connected)");
- break;
- }
- }
-//! [1]
-private:
- QWifiManager *m_wifiManager;
-};
-
-class WifiSettings : public QWidget
-{
- Q_OBJECT
-public:
- //! [0]
- WifiSettings(QWidget *parent = 0)
- : QWidget(parent)
- , m_listView(new QListView(this))
- , m_networkDelegate(new NetworkDelegate(this))
- {
- m_wifiManager = QWifiManager::instance();
- m_listView->setModel(m_wifiManager->networks());
- m_listView->setItemDelegate(m_networkDelegate);
-
- connect(m_wifiManager, &QWifiManager::backendStateChanged,
- this, &WifiSettings::handleBackendStateChanged);
- connect(m_wifiManager, &QWifiManager::networkStateChanged,
- this, &WifiSettings::handleNetworkStateChanged);
-
- setupWidgets();
- }
- //! [0]
-protected:
- void setupWidgets()
- {
- m_backendStateReporter = new QLabel(this);
- handleBackendStateChanged(m_wifiManager->backendState());
- m_passwordInput = new QLineEdit(this);
- m_passwordInput->setPlaceholderText("Enter Password");
-
- QPushButton *connectButton = new QPushButton("Connect", this);
- QPushButton *disconnectButton = new QPushButton("Disconnect", this);
- QPushButton *startBackendButton = new QPushButton("Switch On", this);
- QPushButton *stopBackendButton = new QPushButton("Switch Off", this);
-
- connect(startBackendButton, &QPushButton::clicked, m_wifiManager, &QWifiManager::start);
- connect(stopBackendButton, &QPushButton::clicked, m_wifiManager, &QWifiManager::stop);
- connect(connectButton, &QPushButton::clicked, this, &WifiSettings::connectToNetwork);
- connect(disconnectButton, &QPushButton::clicked, m_wifiManager, &QWifiManager::disconnect);
-
- QGridLayout *grid = new QGridLayout(this);
- grid->addWidget(connectButton, 0, 0);
- grid->addWidget(disconnectButton, 0, 1);
- grid->addWidget(startBackendButton, 1, 0);
- grid->addWidget(stopBackendButton, 1, 1);
- grid->addWidget(m_listView, 2, 0, 1, 2);
- grid->addWidget(m_passwordInput, 3, 0, 1, 2);
- grid->addWidget(m_backendStateReporter, 4, 0, 1, 2);
- setLayout(grid);
- }
-
-
-protected slots:
- void handleBackendStateChanged(QWifiManager::BackendState state)
- {
- switch (state) {
- case QWifiManager::Running:
- m_wifiManager->setScanning(true);
- m_backendStateReporter->setText("wifi backend state: <b>running<\b>");
- break;
- case QWifiManager::NotRunning:
- m_wifiManager->setScanning(false);
- m_backendStateReporter->setText("wifi backend state: <b>stopped<\b>");
- break;
- case QWifiManager::Initializing:
- m_backendStateReporter->setText("wifi backend state: <b>initializing<\b>");
- break;
- case QWifiManager::Terminating:
- m_backendStateReporter->setText("wifi backend state: <b>terminating<\b>");
- break;
- }
- }
- //! [4]
- void handleNetworkStateChanged(QWifiManager::NetworkState state)
- {
- m_listView->viewport()->repaint();
- }
- //! [4]
- //! [2]
- void connectToNetwork()
- {
- QModelIndex index = m_listView->currentIndex();
- QWifiConfiguration config;
- if (index.isValid()) {
- QString ssid = qvariant_cast<QString>(index.data(QWifiManager::SSID));
- config.setSsid(ssid);
- config.setPassphrase(m_passwordInput->text());
- m_wifiManager->connect(&config);
- }
- }
- //! [2]
-private:
- QWifiManager *m_wifiManager;
- QListView *m_listView;
- NetworkDelegate *m_networkDelegate;
- QLabel *m_backendStateReporter;
- QLineEdit *m_passwordInput;
-};
-
-//! [3]
-class WifiConnectionHandler : public QObject
-{
- Q_OBJECT
-public:
- WifiConnectionHandler()
- {
- // replace with a valid network configuration
- m_config.setSsid("my-local-wifi");
- m_config.setPassphrase("helloworld123");
- m_config.setProtocol("WPA");
- m_manager = QWifiManager::instance();
- if (m_manager->backendState() == QWifiManager::Running) {
- m_manager->connect(&m_config);
- } else {
- connect(m_manager, &QWifiManager::backendStateChanged,
- this, &WifiConnectionHandler::connectToNetwork);
- m_manager->start();
- }
- }
-
-protected slots:
- void connectToNetwork(QWifiManager::BackendState state)
- {
- if (state == QWifiManager::Running)
- m_manager->connect(&m_config);
- }
-
-private:
- QWifiManager *m_manager;
- QWifiConfiguration m_config;
-};
-//! [3]
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- WifiSettings wifiSettingsWindow;
- wifiSettingsWindow.show();
-
- // disable the above 2 lines before enabling this
- // WifiConnectionHandler connectionHandler;
-
- return a.exec();
-}
-
-#include "main.moc"
diff --git a/examples/wifi/wifi-cpp/wifi-cpp.pro b/examples/wifi/wifi-cpp/wifi-cpp.pro
deleted file mode 100644
index f457df3..0000000
--- a/examples/wifi/wifi-cpp/wifi-cpp.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-QT += core widgets b2qtwifi
-
-TARGET = wifi-cpp
-TEMPLATE = app
-
-target.path = /data/user/qt/$$TARGET
-INSTALLS += target
-
-SOURCES += main.cpp
diff --git a/examples/wifi/wifi-qml/WifiConnectionHandler.qml b/examples/wifi/wifi-qml/WifiConnectionHandler.qml
deleted file mode 100644
index f3f2c10..0000000
--- a/examples/wifi/wifi-qml/WifiConnectionHandler.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-import QtQuick 2.3
-import B2Qt.Wifi 1.0
-
-//! [0]
-Item {
- WifiConfiguration {
- id: localConfig
- ssid: "network-for-my-device"
- passphrase: "password123"
- protocol: "WPA2"
- }
-
- Connections {
- target: WifiManager
- onBackendStateChanged: {
- if (WifiManager.backendState === WifiManager.Running)
- WifiManager.connect(localConfig)
- }
- onNetworkStateChanged: {
- if (WifiManager.networkState === WifiManager.Connected)
- print("successfully connected to: " + WifiManager.currentSSID)
- }
- }
-
- Component.onCompleted: {
- if (WifiManager.backendState === WifiManager.Running) {
- WifiManager.connect(localConfig)
- } else {
- WifiManager.start()
- }
- }
-}
-//! [0]
diff --git a/examples/wifi/wifi-qml/WifiScanner.qml b/examples/wifi/wifi-qml/WifiScanner.qml
deleted file mode 100644
index 9dbbd46..0000000
--- a/examples/wifi/wifi-qml/WifiScanner.qml
+++ /dev/null
@@ -1,249 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-import QtQuick 2.3
-import QtQuick.Controls 1.2
-import B2Qt.Wifi 1.0
-
-Item {
- anchors.fill: parent
-
- Binding {
- target: WifiManager
- property: "scanning"
- value: networkView.visible
- }
-
- Button {
- id: wifiOnOffButton
- anchors.top: parent.top
- anchors.topMargin: 20
- anchors.left: parent.left
- anchors.right: parent.right
- onClicked: {
- if (WifiManager.backendState === WifiManager.Running) {
- if (networkView.visible)
- networkView.visible = false
- WifiManager.stop()
- } else if (WifiManager.backendState === WifiManager.NotRunning) {
- WifiManager.start()
- }
- }
-
- Component.onCompleted: updateButtonText(WifiManager.backendState)
- Connections {
- target: WifiManager
- onBackendStateChanged: wifiOnOffButton.updateButtonText(backendState)
- }
-
- function updateButtonText(backendState)
- {
- if (backendState === WifiManager.Initializing)
- wifiOnOffButton.text = "Initializing..."
- if (backendState === WifiManager.Terminating)
- wifiOnOffButton.text = "Terminating..."
- if (backendState === WifiManager.NotRunning)
- wifiOnOffButton.text = "Switch On"
- if (backendState === WifiManager.Running)
- wifiOnOffButton.text = "Switch Off"
- }
- }
-
- Button {
- id: listNetworksButton
- anchors.top: wifiOnOffButton.bottom
- anchors.topMargin: 30
- anchors.left: parent.left
- anchors.right: parent.right
- visible: WifiManager.backendState === WifiManager.Running
- text: networkView.visible ? "Hide wifi networks"
- : "List available wifi networks"
- onClicked: networkView.visible = !networkView.visible
- }
- //! [0]
- ListView {
- id: networkView
- model: WifiManager.networks
- delegate: listDelegate
- implicitHeight: 800
- anchors.top: listNetworksButton.bottom
- anchors.topMargin: 30
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- visible: false
- clip: true
-
- property string networkStateText: ""
- property QtObject expandedNetworkBox: null
- property bool hasExpandedNetworkBox: expandedNetworkBox !== null
-
- function setNetworkStateText(networkState) {
- if (networkState === WifiManager.ObtainingIPAddress)
- networkView.networkStateText = " (obtaining ip..)"
- else if (networkState === WifiManager.DhcpRequestFailed)
- networkView.networkStateText = " (dhcp request failed)"
- else if (networkState === WifiManager.Connected)
- networkView.networkStateText = " (connected)"
- else if (networkState === WifiManager.Authenticating)
- networkView.networkStateText = " (authenticating..)"
- else if (networkState === WifiManager.HandshakeFailed)
- networkView.networkStateText = " (wrong password)"
- else if (networkState === WifiManager.Disconnected)
- networkView.networkStateText = ""
- }
-
- Connections {
- target: WifiManager
- onNetworkStateChanged: networkView.setNetworkStateText(networkState)
- }
-
- Component.onCompleted: {
- if (WifiManager.backendState == WifiManager.Running)
- networkView.visible = true
- }
- }
- //! [0]
- //! [2]
- WifiConfiguration {
- id: config
- protocol: "WPA2"
- }
- //! [2]
- Component {
- id: listDelegate
- Rectangle {
- id: networkBox
- property bool expanded: false
- property bool isCurrentNetwork: WifiManager.currentSSID === ssid
- property bool connected: isCurrentNetwork && WifiManager.networkState === WifiManager.Connected
- property int notExpandedHeight: ssidLabel.height + bssidLabel.height + 20
- property int expandedHeight: notExpandedHeight + passwordInput.height + connectionButton.height + 54
- property int connectedExpandedHeight: notExpandedHeight + connectionButton.height + 30
- height: expanded ? (connected ? connectedExpandedHeight : expandedHeight) : notExpandedHeight
- width: parent.width
- clip: true
- border.color: "black"
- border.width: 1
-
- Component.onDestruction: if (expanded) networkView.expandedNetworkBox = null
- onHeightChanged: if (expanded) networkView.positionViewAtIndex(index, ListView.Contain)
-
- Behavior on height { NumberAnimation { duration: 500; easing.type: Easing.InOutCubic } }
- //! [1]
- Text {
- id: ssidLabel
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.margins: 5
- anchors.leftMargin: 10
- font.pixelSize: 26
- font.bold: true
- text: isCurrentNetwork ? ssid + networkView.networkStateText : ssid
- Component.onCompleted: networkView.setNetworkStateText(WifiManager.networkState)
- }
-
- Text {
- id: bssidLabel
- anchors.top: ssidLabel.bottom
- anchors.left: parent.left
- anchors.margins: 5
- anchors.leftMargin: 30
- text: bssid
- font.pixelSize: ssidLabel.font.pixelSize * 0.8
- }
-
- Text {
- id: flagsLabel
- anchors.top: bssidLabel.top
- anchors.left: bssidLabel.right
- anchors.leftMargin: 35
- text: (supportsWPA2 ? "WPA2 " : "")
- + (supportsWPA ? "WPA " : "")
- + (supportsWEP ? "WEP " : "")
- + (supportsWPS ? "WPS " : "");
- font.pixelSize: ssidLabel.font.pixelSize * 0.8
- font.italic: true
- }
-
- ProgressBar {
- id: signalStrengthBar
- height: 20
- width: networkBox.width * 0.5
- anchors.margins: 10
- anchors.right: parent.right
- anchors.top: parent.top
- minimumValue: 0
- maximumValue: 100
- value : signalStrength
- }
- //! [1]
- MouseArea {
- anchors.fill: parent
- onClicked: handleNetworkBoxExpanding()
- }
-
- function handleNetworkBoxExpanding()
- {
- expanded = !expanded
- if (expanded) {
- if (networkView.hasExpandedNetworkBox)
- networkView.expandedNetworkBox.expanded = false
- networkView.expandedNetworkBox = networkBox
- } else {
- networkView.expandedNetworkBox = null
- }
- }
-
- TextField {
- id: passwordInput
- anchors.top: flagsLabel.bottom
- anchors.topMargin: 15
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width * 0.36
- height: connectionButton.height * 1.1
- placeholderText: "Enter Password"
- visible: !connected
- font.pixelSize: 16
- echoMode: TextInput.Password
- inputMethodHints: Qt.ImhNoPredictiveText
- }
-
- Button {
- id: connectionButton
- y: connected ? passwordInput.y
- : passwordInput.y + passwordInput.height + 10
- width: passwordInput.width
- anchors.horizontalCenter: parent.horizontalCenter
- text: connected ? "Disconnect" : "Connect"
- //! [3]
- onClicked: {
- if (connected) {
- WifiManager.disconnect()
- } else {
- config.ssid = ssid;
- config.passphrase = passwordInput.text
- if (!WifiManager.connect(config))
- print("failed to connect: " + WifiManager.lastError)
- }
- }
- //! [3]
- }
- }
- }
-}
diff --git a/examples/wifi/wifi-qml/doc/images/wifi-qml.jpg b/examples/wifi/wifi-qml/doc/images/wifi-qml.jpg
deleted file mode 100644
index 649707f..0000000
--- a/examples/wifi/wifi-qml/doc/images/wifi-qml.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/wifi/wifi-qml/doc/src/wifi-qml.qdoc b/examples/wifi/wifi-qml/doc/src/wifi-qml.qdoc
deleted file mode 100644
index ba77c1e..0000000
--- a/examples/wifi/wifi-qml/doc/src/wifi-qml.qdoc
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-/*!
-
- \title Getting Started with B2Qt.Wifi in QML
- \example wifi/wifi-qml
- \ingroup wifi-examples
- \brief Guide to getting started with B2Qt.Wifi using QML.
-
- \section1 Preparing the Application
-
- Use the following \c import statement in the QML files to access the B2Qt.Wifi QML types:
-
- \code
- import B2Qt.Wifi 1.0
- \endcode
-
- This guide will demonstrate how to create a QML based application that utilizes
- B2Qt.Wifi API to set up a wifi network connection. We will start by looking at how to scan the
- surroundings for wifi access points and how to display and process this data in the application.
- At the end of the guide we will show how to connect directly to a known wifi network configuration.
-
- \image wifi-qml.jpg
-
- \section1 Listing Wifi Networks
-
- First we need to set up ListView which we will use to list wifi networks
- that can be sensed by the device. The sensed network access points are packed as a list-based
- data model and can be retrieved from WifiManager::networks. Here we also set a custom item
- delegate and connect to WifiManager::networkStateChanged signal.
-
- \snippet wifi/wifi-qml/WifiScanner.qml 0
-
- \section1 Creating a Delegate
-
- The wifi network model has many data roles that describe the different properties of wifi networks.
- This data can be used by an application to list detailed network information and/or to set up
- WifiConfiguration objects. We use these network data roles in our delegate for listing
- ssid, bssid, supported security protocols and for signal strengh representation.
-
- \snippet wifi/wifi-qml/WifiScanner.qml 1
-
- \section1 Connecting To a Selected Network
-
- WifiConfiguration element will be used to describe the network that we want to connect to,
- selected from the network list.
-
- \snippet wifi/wifi-qml/WifiScanner.qml 2
-
- When \uicontrol Connect button is clicked we set the network name and password properties on
- the \c config and pass it to WifiManager::connect, which sets up a wifi connection behind-the-scenes.
- During this operation or whenever there are changes in the network state, QWifiManager provides
- asynchronous QWifiManager::NetworkState change events.
-
- \snippet wifi/wifi-qml/WifiScanner.qml 3
-
- \section1 Connecting To a Known Network
-
- If you are not interested in scanning the environment for wifi network access points and you already
- know the network configuration beforehand, the network scanning, listing and selection steps can be
- entirely skipped. This can be a valid use-case for devices that won't be changing their physical location.
-
- QWifiManager::BackendState change events are delivered asynchronously. Therefore we have to add a signal handler
- that will connect to the network access point after the backend initialization process has been completed,
- if the backend is not already in the initialized state at the time of running this code.
-
- \snippet wifi/wifi-qml/WifiConnectionHandler.qml 0
-
- */
diff --git a/examples/wifi/wifi-qml/main.cpp b/examples/wifi/wifi-qml/main.cpp
deleted file mode 100644
index 32c6b74..0000000
--- a/examples/wifi/wifi-qml/main.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- return app.exec();
-}
diff --git a/examples/wifi/wifi-qml/main.qml b/examples/wifi/wifi-qml/main.qml
deleted file mode 100644
index 9c8726d..0000000
--- a/examples/wifi/wifi-qml/main.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** 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://www.qt.io
-**
-****************************************************************************/
-import QtQuick 2.3
-import QtQuick.Window 2.2
-
-Window {
- visible: true
- width: Screen.width
- height: Screen.height
- color: "#D9D9D9"
-
- WifiScanner {}
-
- // disable the above line before enabling WifiConnectionHandler
- // WifiConnectionHandler {}
-}
diff --git a/examples/wifi/wifi-qml/qml.qrc b/examples/wifi/wifi-qml/qml.qrc
deleted file mode 100644
index 3c36973..0000000
--- a/examples/wifi/wifi-qml/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>WifiScanner.qml</file>
- <file>WifiConnectionHandler.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/wifi/wifi-qml/wifi-qml.pro b/examples/wifi/wifi-qml/wifi-qml.pro
deleted file mode 100644
index 70fc76a..0000000
--- a/examples/wifi/wifi-qml/wifi-qml.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
-
-target.path = /data/user/qt
-export(target.path)
-INSTALLS += target
diff --git a/examples/wifi/wifi.pro b/examples/wifi/wifi.pro
deleted file mode 100644
index 9e03f0e..0000000
--- a/examples/wifi/wifi.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += wifi-cpp \
- wifi-qml