// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

    /*!
    \page creator-developing-b2qt.html
    \previouspage creator-developing-baremetal.html
    \nextpage creator-adding-docker-devices.html

    \title Connecting Boot2Qt Devices

    You can connect \l{Boot2Qt} devices to the development PC to run, debug,
    and analyze applications built for them from \QC.

    If you have a tool chain for building applications for Boot2Qt devices
    installed on the development PC, you can add it to \QC. You can then
    select a \l{glossary-buildandrun-kit}{kit} with the \uicontrol Boot2Qt
    device type to build applications for and run them on the devices.

    To be able to run and debug applications on Boot2Qt devices,
    you must add devices and select them in the \QC
    \l{Kits}{kit}.

    \section1 Enabling the Boot2Qt Plugin

    To enable the Boot2Qt plugin:

    \list 1
        \li Select \uicontrol Help > \uicontrol {About Plugins} >
            \uicontrol {Device Support} > \uicontrol Boot2Qt to
            enable the plugin.
        \li Select \uicontrol {Restart Now} to restart \QC and load the plugin.
    \endlist

    \section1 Adding Boot2Qt Devices

    If \QC does not automatically detect a device you connected with USB, select
    \preferences > \uicontrol Devices >
    \uicontrol Devices > \uicontrol Add > \uicontrol {Boot2Qt Device} to create
    either a network connection or a USB connection to it.

    \image qtcreator-boot2qt-device-configurations.webp {Devices tab in Preferences}

    To add a device without using a wizard, select \uicontrol {Boot2Qt Device} in
    the pull-down menu of the \uicontrol Add button.

    \note On Ubuntu Linux, the development user account must have access to the
    plugged-in devices. To grant them access to the device via USB, create a new
    \c udev rule, as described in
    \l{https://doc.qt.io/Boot2Qt/b2qt-requirements-x11.html#setting-up-usb-access-to-embedded-devices}
    {Boot2Qt: Setting Up USB Access to Embedded Devices}.

    You can edit the settings later in \preferences >
    \uicontrol Devices > \uicontrol Devices.

    To reboot the selected device, select \uicontrol {Reboot Device}.

    To restore the default application to the device, select
    \uicontrol {Restore Default App}.

    \section2 Protecting Connections

    You can protect the connections between \QC and a device by using an
    \l{https://www.openssh.com/}{OpenSSH} connection. OpenSSH is a
    connectivity tool for remote login using the SSH protocol. The OpenSSH
    suite is not delivered with \QC, so you must download it and install it
    on the development PC. Then, you must configure the paths to the tools in
    \QC. For more information, see \l {Configuring SSH Connections}.

    You need either a password or an SSH public and private key pair for
    authentication. If you do not have an SSH key, you can use the \c ssh-keygen
    tool to create it in \QC. For more information, see \l {Generating SSH Keys}.

    \QC does not store passwords. If you use password authentication, you may
    need to enter the password upon every connection to the device, or if
    caching is enabled, at every \QC restart. If you frequently run into the
    timeout, consider using key-based authentication. On \macos and Linux, you
    can also select \preferences > \uicontrol Devices > \uicontrol SSH
    and increase the time (in minutes) to use the same SSH connection in the
    \uicontrol {Connection sharing timeout} field. Windows does not support
    shared connections.

    \image qtcreator-ssh-options.png {SSH preferences}

    \section1 Flashing Boot2Qt Devices

    To flash the Boot2Qt image to an SD card with Flashing Wizard, select
    \uicontrol Tools > \uicontrol {Flash Boot to Qt Device} and follow the
    instructions of the wizard.

    \image qtcreator-boot2qt-flashing-wizard.png {Boot2Qt Flashing Wizard}

    \section1 Configuring Connections

    To configure connections between \QC and a Boot2Qt device and to
    specify build and run settings for the device:

    \list 1
        \li Check that you can reach the IP address of the device, or use USB to
            connect it.
        \li Select \preferences > \uicontrol Kits > \uicontrol {Qt Versions} >
            \uicontrol Add to add the Qt version for Boot2Qt.
        \li Select \preferences > \uicontrol Kits >
            \uicontrol Compilers > \uicontrol Add to add the compiler for
            building the applications.
        \li Select \uicontrol Tools > \uicontrol {Flash Boot to Qt Device}
            to flash the Boot2Qt image to an SD card with Flashing Wizard.
        \li To deploy applications and run them remotely on devices, specify
            parameters for connecting to the devices over the network (\QC
            automatically detects devices connected with USB):
            \list 1
                \li Select \preferences > \uicontrol Devices >
                    \uicontrol Devices > \uicontrol Add > \uicontrol Boot2Qt.
                    \image qtcreator-devices-boot2qt.png {Boot2Qt Network Device Setup wizard}
                \li In the \uicontrol {Device name} field, enter a name for
                    the connection.
                \li In the \uicontrol {Device address} field, enter the host
                    name or IP address of the device. This value will be
                    available in the \c %{Device:HostAddress} variable.
                \li Click \uicontrol {Finish} to test the connection and
                    add the device.

                    You can edit the connection parameters in the
                    \uicontrol Devices tab. The wizard does not show
                    parameters that have sensible default values. One of
                    these is the SSH port number, which is available in
                    the variable \c %{Device:SshPort}.

                    To add a device without using the wizard, select
                    \uicontrol {Boot2Qt Device} in the pull-down menu of the
                    \uicontrol Add button.
            \endlist
        \li Select \preferences > \uicontrol Kits >
            \uicontrol Add to add a kit for building applications for the
            device. Select the Qt version, compiler, and device that you
            added above, and choose \uicontrol Boot2Qt as the device type.
        \li To specify build settings:
        \list 1
            \li Open a project for an application you want to develop for the
                device.
            \li Select \uicontrol Projects > \uicontrol {Build & Run} to enable
                the kit that you specified above.
        \endlist
        \li Select \uicontrol Run to specify run settings. Usually, you can use
            the default settings.

            When you run the project, \QC deploys the application as
            specified by the deploy steps. By default, \QC copies the
            application files to the device. For more information, see
            \l{Specifying Run Settings for Boot2Qt Devices}.
    \endlist
*/
