Remote screen grabbing for Qt applications - TeamViewer Support
<main>
<article class="userContent">
<p><strong>NOTE</strong>: <strong>The code for the remote screen SDK is moved to </strong><a href="https://github.com/teamviewer/iotagentsdk" rel="nofollow noreferrer ugc"><strong>https://github.com/teamviewer/iotagentsdk</strong></a><strong> </strong></p><p><strong>Further updates and documentation can be found on GitHub.</strong></p><p><br></p><p><em>This article will guide the user to enable remote screen grabbing for Qt applications by using the remote screen SDK provided by Teamviewer</em></p><h2 data-id="general">General</h2><p>TeamViewer currently provides 3 different options to access the content of the screen attached to a device on which the TeamViewer IoT agent installed. In this article the option to directly access Qt applications is described. This is realized through an SDK which TeamViewer provides. This SDK is directly linked into the application and so enables the connection to the Teamviewer IoT agent on the edge device and so to the TeamViewer network.</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/lithium_attachments/12656iBE85549AACC6514A.jpg" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/lithium_attachments/12656iBE85549AACC6514A.jpg" alt="RemoteScreenSDKGlobal.png" height="180" width="320" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p> </p><p>Building Block Description Qt application The Qt application that in the end provides a user frontend which can be accessed from the outside Customer Qt application The frontend part of the Qt application. This is not provided by TeamViewer, but from the entity that designs the application and device. RemoteScreen SDK Software Development Kit containing an interface and plugin to enable remote control for a customer application (short: SDK/plugin). TeamViewer IoT agent TeamViewer software enable the edge device to create TeamViewer connections for remote control TeamViewer Client The TeamViewer program installed on the user pc. To initiate remote control connections to the device. </p><p> </p><h3 data-id="requirements">Requirements</h3><p>There are some preconditions, that you must meet, so that you can use this feature. Please make sure that you fulfill them all:</p><ul><li>You need a valid license for TeamViewer 14.</li><li>The TeamViewer IoT agent must be installed on the device</li><li>There must be a Qt application running on the device and this application must be accessible so the remote screen SDK can be linked to it.</li><li>This device should either be configured to display the user interface via a Linux frame buffer device or is capable enough to send its image data to the SDK</li></ul><h4 data-id="software-dependencies">Software dependencies</h4><p>For building the whole package the following libraries and tool need to be available:</p><ul><li>CMake (3.5 or newer)</li><li>Compiler tool chain with support for C++14 (like GCC or Clang)</li><li>Google Protocol Buffers library (3.0 and newer)</li><li>Google gRPC library (1.20 or newer)</li><li>zlib (needed by gRPC</li><li>Qt 5 (5.3 or newer)</li></ul><p>On debian systems (when writing the documentation debian 10 was the latest) the following development packages can be used for building</p><ul><li>cmake</li><li>build-essential or g++</li><li>libgrpc++-dev</li><li>protobuf-compiler-grpc</li><li>libprotobuf-dev</li><li>protobuf-compiler</li><li>qtbase5-dev</li><li>qtdeclarative5-dev</li></ul><p>For example : </p><pre class="code codeBlock" spellcheck="false" tabindex="0">sudo apt-get -y install cmake
</pre><h4 data-id="hardware-requirements">Hardware requirements</h4><ul><li>For supported platforms regarding the TeamViewer IoT Agent visit <a href="https://www.teamviewer.com/link/?url=150157" rel="nofollow noreferrer ugc">https://www.teamviewer.com/link/?url=150157</a></li><li>At least 30 MB free disk space</li><li>Systemd software suite</li><li>Glibc-utils package (version 2.17 higher)</li><li>Linux 2.6.27 kernel</li></ul><h4 data-id="where-to-download">Where to download</h4><p>The TeamViewer Remote Screen SDK can be downloaded by clicking on the following link: </p><ul><li>Agent version < 2.15.10 </li></ul><p><a href="https://download.teamviewer-iot.com/remoteScreenSDK/TVRemoteScreenSDK_1.1.40.zip" rel="nofollow noreferrer ugc">https://download.teamviewer-iot.com/remoteScreenSDK/TVRemoteScreenSDK_1.1.40.zip</a> </p><ul><li> Agent version >= 2.15.10 </li></ul><p><a href="https://download.teamviewer-iot.com/remoteScreenSDK/TVRemoteScreenSDK_2.1.10.zip" rel="nofollow noreferrer ugc">https://download.teamviewer-iot.com/remoteScreenSDK/TVRemoteScreenSDK_2.1.10.zip</a> </p><h2 data-id="how-to-build-a-qt-application-with-the-remote-screen-sdk">How to build a Qt application with the Remote Screen SDK</h2><p>To build the remote screen SDK please ensure that all required libraries and dependencies are installed and available.</p><h4 data-id="steps-to-build%3A">Steps to build: </h4><p># create and navigate to a build directory</p><pre class="code codeBlock" spellcheck="false" tabindex="0">mkdir build
cd build
</pre><p><br></p><p># run cmake</p><pre class="code codeBlock" spellcheck="false" tabindex="0">cmake <path to extracted SDK>
</pre><p># run make</p><pre class="code codeBlock" spellcheck="false" tabindex="0">make
</pre><p>After building the package there should be two binaries:</p><ul><li> libTVQtRC.so - integration plugin, used by a Qt application for providing</li><li>Remote Screen capabilities</li><li>-qt_simulate - an example application showing the basic usage of the plugin</li></ul><h4 data-id="installation-for-development">Installation for Development</h4><p>The SDK can also be installed to be used in a development environment:</p><p># default installation (as root, if needed)</p><pre class="code codeBlock" spellcheck="false" tabindex="0">make install
</pre><p>The default installation prefix for CMake is /usr/local. So after installation there are two projects installed:</p><ul><li>TVRemoteScreenSDK</li><li>The Qt plugin (<prefix>/lib/lbTVQtRC.so) along with the public headers (<prefix>/include/*.h) to use it.</li><li>TVRemoteScreenSDKCommunication</li><li>The public C++ API used by the plugin. This API in independent of Qt and can be used together with any other framework.</li></ul><p>To install the SDK into a custom prefix one can override CMAKE_INSTALL_PREFIX when configuring the SDK before building:</p><p><br></p><p><br></p><p><br></p><p># configure to install into custom prefix</p><pre class="code codeBlock" spellcheck="false" tabindex="0">cmake -DCMAKE_INSTALL_PREFIX=<custom-install-path> <path-to-sources-root>
</pre><p></p><p><br></p><h3 data-id="configuration-settings">Configuration settings</h3><h4 data-id="configuration-of-the-teamviewer-iot-agent">Configuration of the TeamViewer IoT agent</h4><p>The TeamViewer IoT agent needs then to be configured to remote control an "external application". This configuration involves also specifying a so-called "image grab strategy": With that the agent tells the application in what way it expects image updates. To do this:</p><p>From remote terminal run:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">sudo teamviewer-iot-agent configure set EnableRemoteScreen 1
sudo teamviewer-iot-agent configure set RemoteScreenChannels \"EAP\"
</pre><p>N<strong>ote: </strong></p><p>That the value in escaped double quotes can vary from user case. The values could be:</p><h4 data-id="use-case">Use case</h4><h4 data-id="setting"> Setting</h4><h5 data-id="external-app-(sdk)-with-built-in-grabbing"> External App (SDK) with built-in grabbing</h5><h5 data-id="strng-remotescreenchannels-%22eap%22"> [strng] RemoteScreenChannels = \"EAP\"</h5><h5 data-id="external-app-(sdk)-with-notifications-about-framebuffer-changes"> External App (SDK) with notifications about framebuffer changes</h5><h5 data-id="fb-device-devfb42">→ FB device /dev/fb42</h5><h5> </h5><h5 data-id="strng-remotescreenchannels-%22eap%3Afbpush%3Adevfb42%22">[strng] RemoteScreenChannels = \"EAP:FBPush:/dev/fb42\"</h5><h5 data-id="external-app-(sdk)-with-frambuffer-grabbing"> External App (SDK) with frambuffer grabbing</h5><h5 data-id="first-fb-device-(devfb0)">→ first FB device (/dev/fb0)</h5><h5 data-id="-1"> </h5><h5 data-id="strng-remotescreenchannels-%22eap%3Afbpull%22">[strng] RemoteScreenChannels = \"EAP:FBPull\"</h5><p> </p><p> </p><p> The agent currently supports the following strategies:</p><ul><li>Application provided (default when setting the remote screen channel to "EAP")</li><li>The application (or the Qt plugin) is grabbing internally and send resulting images to the TeamViewer agent.</li><li>Linux frame buffer device continuous (called "FrameBuffer-Pull" or the channel setting "FBPull")</li><li>This repeatedly copies the contents of a Linux frame buffer device regardless of any actual image changes.</li><li>Linux frame buffer device with notifications (called "FrameBuffer-Push" or the channel setting "FBPush")</li><li>This copies the contents of a Linux frame buffer device when the external application notifies the agent to do so.</li></ul><p>After starting the agent its API for remote screen is now available and can be used by the Qt plugin.</p><h4 data-id="further-configuration">Further configuration</h4><p>After installing the IoT Agent it creates a system group called 'tv_api'. Every application that wants to communicate with the agent needs to run under a user that is part of the before mentioned system group:</p><p><br></p><p><br></p><p><br></p><p># add current user to group tv_api</p><pre class="code codeBlock" spellcheck="false" tabindex="0">usermod -a -G tv_api $USER
</pre><p></p><p><br></p><p><br></p><p>For further information on the TeamViewer IoT agent check here</p><p><a href="https://community.teamviewer.com/t5/TeamViewer-IoT-Knowledge-Base/TeamViewer-IoT-Remote-Screen/ta-p/58731" rel="nofollow noreferrer ugc">https://community.teamviewer.com/t5/TeamViewer-IoT-Knowledge-Base/TeamViewer-IoT-Remote-Screen/ta-p/58731</a></p><h2 data-id="example-application">Example application</h2><p>In the package for the SDK is an example application included. This example show the basic operations of the SDK and how to integrate the plugin into a Qt Quick based application. It requires Qt 5.3 with the modules Qt Quick 2.3 and Qt Quick Window 2.0 to run.</p><p>On debian based distributions the following packages are required to run:</p><ul><li>qml-module-qtquick2</li><li>qml-module-qtquick-window2</li></ul><p>To start the example application:</p><ul><li>Open the Build directory using graphical interface</li><li>Locate the qt_simulate</li><li>execute the qt_simulate</li></ul><p>With the example application one can also test and see the basic operations:</p><ul><li>connectivity to the agent: the circle on the top left corner is green when the IoT agent is available (this does NOT indicate network connectivity)</li><li>set the control mode: "Set Full Control" (image updates and input), "Set View Only" (image updates, no input), "Disable Remote Control" (no image updates, no input)</li><li>terminate all incoming TeamViewer sessions: Terminate TV Session" is only enabled if there is at lease one active remote control session. By clicking, it terminates all incoming sessions and the button is disabled afterwards.</li><li>mouse and keyboard input testing</li><li>rudimentary animation testing</li></ul><h2 data-id="known-issues">Known Issues</h2><p>Please contact TeamViewer IoT Support ⟨iot-support@teamviewer-iot.com⟩ if you encounter problems when using the remote screen SDK.</p><h4 data-id="inverted-colors">Inverted Colors</h4><p>On some ARM based devices, the colors may seem inverted or appear wrong on the client’s side.</p><h4 data-id="screen-refresh">Screen refresh</h4><p>When the RemoteScreenChannels setting is configured with EAP:FBPush, it may happen that the client picture is sometimes not refreshed appropriately during a TeamViewer session. Resizing the window will force an update and will display the actual content of the application in the client window.</p><p>For more information about the different channel configurations and their use, please visit <a href="https://www.teamviewer.com/link/?url=710439" rel="nofollow noreferrer ugc">https://www.teamviewer.com/link/?url=710439</a></p><h2 data-id="license-information">License information</h2><p>The TeamViewer Remote Screen SDK is released under MIT License allowing an easy integration of our source code.</p><p>To create Qt applications respective Qt licenses are needed</p><h2 data-id="further-readingrealated-articles">Further reading/Realated articles</h2><ul><li><a href="https://community.teamviewer.com/t5/TeamViewer-IoT-Knowledge-Base/TeamViewer-IoT-Remote-Screen/ta-p/58731" rel="nofollow noreferrer ugc">General information on Remote Screen Grabbing</a></li><li><a href="https://community.teamviewer.com/t5/TeamViewer-IoT-Knowledge-Base/Install-TeamViewer-IoT-Agent/ta-p/17084" rel="nofollow noreferrer ugc">How to install the TeamViewer IoT agent</a></li><li>Also please check the readme file inside the Remote screen SDK for additional information</li></ul>
</article>
</main>