summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/picturetransfer/doc/src/picturetransfer.qdoc
blob: a2acafb983c2ac1552ed4ea6078bc5a71a1dd21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
a/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the QtBluetooth module.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\example picturetransfer
\title QML Bluetooth Picture Push Example
\brief An example showing the use Bluetooth Object Push Profile (OPP).

The Bluetooth Picture Push example shows how to use the \l
QBluetoothTransferManager API. The example transfers a local image to a remote
device. Unfortunately this example cannot be used on Android as Qt does not
support the Object Push Profile (OPP) on this platform.

On the first user interface page the application scans for remote Bluetooth
devices. The user must select the appropriate device to continue:

\image opp-example-1.png

The next page presents a list of image files on the device. The files must be
located under \l QStandardPaths::PicturesLocation}:

\image opp-example-2.png

Once the picture was selected the UI shows the progress of the file transfer:

\image opp-example-3.png

\include examples-run.qdocinc

\sa {Qt Bluetooth}

\section1 Device Discovery

The device discovery uses the \l BluetoothDiscoveryModel to detect the remote
devices. Each discovery is displayed as an entry in a list. Once a device was
selected the device address is stored in the \c root element. More details about
the \c root element will follow further below.

\snippet picturetransfer/DeviceDiscovery.qml Discovery-1
\snippet picturetransfer/DeviceDiscovery.qml Discovery-2

\section1 File Selection

The file is selected with the help of \l FolderListModel. Once again the
selected file is stored in the \c root element:

\snippet picturetransfer/PictureSelector.qml FileSelect-1
\snippet picturetransfer/PictureSelector.qml FileSelect-2
\snippet picturetransfer/PictureSelector.qml FileSelect-3
\snippet picturetransfer/PictureSelector.qml FileSelect-4

\section1 Root Element

The already mentioned \c root element collects the necessary pieces of data for
the picture transfer. Once the file name has been set it triggers the file
transfer:


\snippet picturetransfer/bttransfer.qml Root-1
\snippet picturetransfer/bttransfer.qml Root-2
\snippet picturetransfer/bttransfer.qml Root-3
\snippet picturetransfer/bttransfer.qml Root-3

\section1 File Transfer

The file transfer is implemented in C++:

\snippet picturetransfer/filetransfer.cpp Transfer-1

and exposed to QML via a context property:

\snippet picturetransfer/main.cpp Transfer-2



*/