summaryrefslogtreecommitdiffstats
path: root/src/doc
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@qt.io>2017-09-04 11:55:21 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2017-09-07 09:25:17 +0000
commit03b3e6fd62ff9e9a80212a313340e0a0c2f0135f (patch)
treee44c5da1f775ace3c5be6c38f1c608d73d07ceae /src/doc
parent43e4b847851afc5d00664a9e88ef825ca9fedd02 (diff)
Add a wifi example
The WiFi tutorial linked to NetworkSettings module and NetworkSettingsManager QML type. Added a section Tutorial and Example Code to a module reference page. It contains a link to WiFi tutorial and provides the Settings UI Git repository as an additional example code for Qt Device Utilities. Task-number: QTBUG-56694 Change-Id: Ib6c6a446fd36530525d521e5d568ec154d58a63d Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/src/external-resources.qdoc11
-rw-r--r--src/doc/src/qtdeviceutilities.qdoc16
-rw-r--r--src/doc/src/wifiexample.qdoc78
3 files changed, 103 insertions, 2 deletions
diff --git a/src/doc/src/external-resources.qdoc b/src/doc/src/external-resources.qdoc
index 9914ad3..2edf436 100644
--- a/src/doc/src/external-resources.qdoc
+++ b/src/doc/src/external-resources.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** All rights reserved.
** For any questions to The Qt Company, please use the contact form at
** http://www.qt.io/contact-us
@@ -20,3 +20,12 @@
\title Qt for Device Creation
*/
+/*!
+ \externalpage http://code.qt.io/cgit/qt/qtdeviceutilities.git/
+ \title Device Utilities Git Repository
+*/
+
+/*!
+ \externalpage http://code.qt.io/cgit/qt/qtdeviceutilities.git/tree/src/settingsui
+ \title Settings UI
+*/
diff --git a/src/doc/src/qtdeviceutilities.qdoc b/src/doc/src/qtdeviceutilities.qdoc
index bce13a8..9e692fe 100644
--- a/src/doc/src/qtdeviceutilities.qdoc
+++ b/src/doc/src/qtdeviceutilities.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** All rights reserved.
** For any questions to The Qt Company, please use the contact form at
** http://www.qt.io/contact-us
@@ -48,5 +48,19 @@
\section2 Settings UI
\generatelist qmltypesbymodule QtDeviceUtilities.SettingsUI
+
+ \section1 Tutorial and Example Code
+
+ \l{Qt Device Utilities WiFi Tutorial} demonstrates how you can use
+ the \l{QtDeviceUtilities.NetworkSettings}{NetworkSettings} module for
+ connecting to WiFi.
+
+ The source code of Qt Device Utilities is availabe via a public Git repository.
+ For more information, see \l{Device Utilities Git Repository}.
+
+ You find the Qt Device Utilities module sources under
+ \l{http://code.qt.io/cgit/qt/qtdeviceutilities.git/tree/src}. Especially,
+ the sources of \l{Settings UI} provide examples of how to use Qt Device Utilities.
+
*/
diff --git a/src/doc/src/wifiexample.qdoc b/src/doc/src/wifiexample.qdoc
new file mode 100644
index 0000000..6e28099
--- /dev/null
+++ b/src/doc/src/wifiexample.qdoc
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** All rights reserved.
+** For any questions to The Qt Company, please use the contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of Qt for Device Creation.
+**
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+****************************************************************************/
+/*!
+ \page qtdeviceutilities-wifitutorial.html
+ \title Qt Device Utilities WiFi Tutorial
+ \previouspage qtee-module-reference.html
+
+ \section1 Importing NetworkSettings
+
+ Import the NetworkSettings module as follows:
+ \badcode
+ import QtDeviceUtilities.NetworkSettings 1.0
+ \endcode
+
+ \section1 Filtering WiFi Networks
+
+ In order to connect to WiFi instead of wired networks, set
+ NetworkSettingsManager in a WiFi filtering mode:
+
+ \badcode
+ Component.onCompleted: NetworkSettingsManager.services.type = NetworkSettingsType.Wifi;
+ \endcode
+
+ After you have set the filter, \l{NetworkSettingsManager::services}{NetworkSettingsManager.services} contains
+ the NetworkService objects services representing WiFi networks.
+
+ \section1 Connecting to WiFi
+
+ In order to connect to Wifi, invoke the
+ \l{NetworkService::connectService()}{connectService} method on NetworkService.
+
+ If no passphrase is needed, \l{NetworkService::connectService()}{connectService}
+ connects to a WiFi network and changes the connected property of the selected service.
+
+ If a passphrase is needed, NetworkSettingsManager.userAgent
+ emits the \l{NetworkSettingsManager::userAgent.showUserCredentialsInput}{showUserCredentialsInput} signal.
+ Before a WiFi network is connected, you must provide the passphrase via
+ \l{NetworkSettingsManager::userAgent.setPassphrase}{NetworkSettingsManager.userAgent.setPassPhrase}.
+
+ To implement the passphrase handling, you must set a signal handler as follows:
+ \badcode
+ Connections {
+ target: NetworkSettingsManager.userAgent
+ onShowUserCredentialsInput : {
+ // obtain the passphrase and set it
+ }
+ onError: {
+ // handle errors
+ }
+ }
+ \endcode
+
+ \section1 Implementing User Interface
+
+ When you are implementing a user interface for handling WiFi connections,
+ remember that \l{NetworkSettingsManager::services}{NetworkSettingsManager.services}
+ is designed to be used as a model. The \l{Settings UI} implementation
+ uses it directly to display a list of available WiFi networks.
+
+ Handling WiFi connections and passphrases for list selections
+ should be straightforward as described in \l{Filtering WiFi Networks} and
+ \l{Connecting to WiFi}.
+*/