/****************************************************************************
**
** Copyright (C) 2014 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
    \brief A QML example showing Bluetooth communication.

    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

    \include examples-run.qdocinc

    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

*/
