diff options
Diffstat (limited to 'examples/bluetooth/pingpong/doc/src/pingpong.qdoc')
-rw-r--r-- | examples/bluetooth/pingpong/doc/src/pingpong.qdoc | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/examples/bluetooth/pingpong/doc/src/pingpong.qdoc b/examples/bluetooth/pingpong/doc/src/pingpong.qdoc new file mode 100644 index 00000000..df7fcc34 --- /dev/null +++ b/examples/bluetooth/pingpong/doc/src/pingpong.qdoc @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example pingpong + \title Bluetooth QML Ping Pong example + + The Bluetooth QML Ping Pong example presents the socket communication between two + Bluetooth devices. The basic concept is the ping pong game where two players + communicate via sockets. + + \image intro.png + + At the beginning, the user selects the role. One device acts as a server and the second + one as a client. After selecting the role, adjustments to the screen size are done + (two devices might have different screen sizes). The server side starts a service named + "PingPong server". + + \snippet pingpong/pingpong.cpp Starting the server + + On the client side, the full service discovery on the nearby Bluetooth devices is done. + + \snippet pingpong/pingpong.cpp Searching for the service + + When the ping pong service is discovered, the client connects to the server using the socket. + + \snippet pingpong/pingpong.cpp Connecting the socket + + On the server side, the connected signal is emitted initiating that the client is connected. + The necessary signals and slots on the server side are connected. + + \snippet pingpong/pingpong.cpp Initiating server socket + + The game starts after the devices are connected and the screen is adjusted. + + \snippet pingpong/pingpong.cpp Start the game + + The server updates the ball direction and coordinates. The coordinates of pedals are sent + to each other every 50ms. + + \snippet pingpong/pingpong.cpp Updating coordinates + + The coordinates are updated and exchanged via sockets. As presented, the server sends its + pedal's y coordinate and the ball coordinates whereas, the client sends only its pedal + y coordinate. + + \snippet pingpong/pingpong.cpp Checking the boundaries + + In the code above, it was shown how the server checks whether the ball has reached + the boundaries of the board. In the case of the goal, the server updates + the results via its socket. + + \image intro1.png + +*/ + |