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 */