Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. First time multiplatform bluetooth setup help

First time multiplatform bluetooth setup help

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 629 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blue_balloons
    wrote on last edited by
    #1

    Hey y'all.

    Long story short, I'm using unreal engine and I want to use bluetooth devices inside a project; more specifically, I need to read gyroscope data from various simultaneous devices: microcontrollers, mobile phones, etc.

    My thought process was to first make a simple script in C++ that could read such data, and then import it into unreal. The project needs to be ran on both desktop (Windows/GNU) AND VR goggles (Android based), and with this concern in mind many discussion sites agreed qt was the most appropriate for development.

    I tried running a sample project that just reads out all available bluetooth devices within range but I can't actually access bluetooth, it just starts the dummy backend and says Qt Bluetooth module is non-functional.

    I am developing on windows 11 using qmake and mingw, I'm not using the IDE. I'm currently using version 6.7.1 and have the Connectivity additional library installed. Besides adding the ming64/bin folder to my path and installing the windows SDK I've made no other changes to my system.
    This is my first time using QT so I would appreciate some advice on how to get this thing off the ground and running, but more than anything I'm worried about how portable this code will be, considering this needs to be ran within unreal engine on unknown devices that I'll have no control over. I've also tried one of the sample projects offered in the IDE and it didn't run at all, won't even open the dummy phone windows, so I can't really pinpoint where the mistake could be.

    Cheers and thanks in advance!

    jsulmJ 1 Reply Last reply
    0
    • B blue_balloons

      Hey y'all.

      Long story short, I'm using unreal engine and I want to use bluetooth devices inside a project; more specifically, I need to read gyroscope data from various simultaneous devices: microcontrollers, mobile phones, etc.

      My thought process was to first make a simple script in C++ that could read such data, and then import it into unreal. The project needs to be ran on both desktop (Windows/GNU) AND VR goggles (Android based), and with this concern in mind many discussion sites agreed qt was the most appropriate for development.

      I tried running a sample project that just reads out all available bluetooth devices within range but I can't actually access bluetooth, it just starts the dummy backend and says Qt Bluetooth module is non-functional.

      I am developing on windows 11 using qmake and mingw, I'm not using the IDE. I'm currently using version 6.7.1 and have the Connectivity additional library installed. Besides adding the ming64/bin folder to my path and installing the windows SDK I've made no other changes to my system.
      This is my first time using QT so I would appreciate some advice on how to get this thing off the ground and running, but more than anything I'm worried about how portable this code will be, considering this needs to be ran within unreal engine on unknown devices that I'll have no control over. I've also tried one of the sample projects offered in the IDE and it didn't run at all, won't even open the dummy phone windows, so I can't really pinpoint where the mistake could be.

      Cheers and thanks in advance!

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @blue_balloons said in First time multiplatform bluetooth setup help:

      I've also tried one of the sample projects offered in the IDE and it didn't run at all,

      What do you mean exactly? It did not build? It could not be started?

      Qt is multiplatform framework, so as long as the platform you want to deploy to is supported you will be able to build and deploy Qt code to these platforms.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • K Offline
        K Offline
        kuzulis
        Qt Champions 2020
        wrote on last edited by kuzulis
        #3

        says Qt Bluetooth module is non-functional.
        ... and mingw, ...

        AFAIK, there are no BT support for MinGW. It is only supported starting Windows 10 && MSVC compiler.

        PS: But we did earlier (for Qt5), the custom bluetooth port using the WIN32 API. It supports from Windows XP for BT classic, and from Windows 8 for BT LE. Also it supports the MinGW toolchain.

        It was available up to Qt 5.15: https://github.com/qt/qtconnectivity/tree/5.15/src/bluetooth

        But you need to compile that sources himself and then install that Qt Connectivity module.

        Right now (in Qt6) the Qt Company dropped that Win32 in favor to UWP (only starting from Windows 10) ... something like that.

        UPD: That Qt5 Connectivity WIN32 port does not supportted the pairing for the BLE devices programmatically (because the Win32 API has not such API). You must pair the BLE devices by hand using the Windows's in-box pairing application.

        1 Reply Last reply
        2
        • B Offline
          B Offline
          blue_balloons
          wrote on last edited by blue_balloons
          #4

          Hello, thanks for your replies.

          @kuzulis I've tried compiling with MSVC instead, just using regular nmake with the files created with qmake; don't know if this is appropriate or if I'd need to reconfigure settings elsewhere. It lets me compile small test projects but I still get the dummy backend. I'm having trouble compiling example projects since the IDE only uses cmake as far as I know, but I suspect I'd get the same problem. And regardless, these examples came bundled with the 6.7.1 of qt, so you'd expect them to work right out of the box. It's weird to provide sample code that doesn't work with the provided compiler... I must have messed up something during the setup, but I don't know what.

          @jsulm I was able to build the project, but when I tried to run it, the window wouldn't appear. Don't know what I was doing wrong but I've since been able to compile and run all example projects that came bundled with 6.7.1 and are tagged as "bluetooth". They all work "properly", but none of them can actually use bluetooth, they all default to the dummy backend.

          so as long as the platform you want to deploy to is supported you will be able to build and deploy Qt code to these platforms

          Are there any instructions on how to deploy to different platforms? I tried the executable in a laptop with integrated bluetooth support and it complained about not having access to qt6 .dll's. Haven't gotten around to trying the example mobile apps in a real phone but I'd like to try too.

          Pl45m4P 1 Reply Last reply
          0
          • B blue_balloons

            Hello, thanks for your replies.

            @kuzulis I've tried compiling with MSVC instead, just using regular nmake with the files created with qmake; don't know if this is appropriate or if I'd need to reconfigure settings elsewhere. It lets me compile small test projects but I still get the dummy backend. I'm having trouble compiling example projects since the IDE only uses cmake as far as I know, but I suspect I'd get the same problem. And regardless, these examples came bundled with the 6.7.1 of qt, so you'd expect them to work right out of the box. It's weird to provide sample code that doesn't work with the provided compiler... I must have messed up something during the setup, but I don't know what.

            @jsulm I was able to build the project, but when I tried to run it, the window wouldn't appear. Don't know what I was doing wrong but I've since been able to compile and run all example projects that came bundled with 6.7.1 and are tagged as "bluetooth". They all work "properly", but none of them can actually use bluetooth, they all default to the dummy backend.

            so as long as the platform you want to deploy to is supported you will be able to build and deploy Qt code to these platforms

            Are there any instructions on how to deploy to different platforms? I tried the executable in a laptop with integrated bluetooth support and it complained about not having access to qt6 .dll's. Haven't gotten around to trying the example mobile apps in a real phone but I'd like to try too.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #5

            @blue_balloons said in First time multiplatform bluetooth setup help:

            I'm having trouble compiling example projects since the IDE only uses cmake as far as I know

            What IDE? QtCreator?! Visual Studio?!

            And regardless, these examples came bundled with the 6.7.1 of qt, so you'd expect them to work right out of the box

            They work.
            But if your device is not set up/configured for Bluetooth or it's not supported, Qt can't do anything about it.

            How did you install Qt 6.7? Via online installer?
            Have you installed the Qt Connectivity module as @kuzulis mentioned?

            Don't know what I was doing wrong but I've since been able to compile and run all example projects that came bundled with 6.7.1 and are tagged as "bluetooth". They all work "properly", but none of them can actually use bluetooth, they all default to the dummy backend.

            Because the example windows and dialogs can show up (and everything else seem to work) even when you are not able to connect to any Bluetooth service or device.

            Are there any instructions on how to deploy to different platforms

            Windows (via windeployqt):

            • https://doc.qt.io/qt-6/windows-deployment.html

            Linux:

            • https://doc.qt.io/qt-6/linux-deployment.html

            Android:

            • https://doc.qt.io/qt-6/deployment-android.html
              • https://doc.qt.io/qt-6/porting-to-android.html

            macOS:

            • https://doc.qt.io/qt-6/macos.html#deploying-applications-on-macos

            BTW:

            before you deploy your app for platform X, you need to compile it for this specific platform.
            Qt is platform independent, but this does not mean, that you can run your Qt Windows app on Linux, Android or Mac.
            The same code is able to work the same on all these platforms, but you have to build on them or for them (via cross-compiling).

            I tried the executable in a laptop with integrated bluetooth support and it complained about not having access to qt6 .dll

            Of course this does not work. You can not move the executable to a different location (same device or even to another computer) and expect it to run. It won't as you've noticed because the linked DLLs are missing or can not be found when the program.exe was moved just like that.
            You need to deploy your app properly with all the libs it uses.

            Also, you need to check if Unreal and your Qt app are compatible in terms of licensing.
            Don't know if it's possible to combine an Unreal Engine app and Qt's (L)GPL and release them together.


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            B 1 Reply Last reply
            1
            • Pl45m4P Pl45m4

              @blue_balloons said in First time multiplatform bluetooth setup help:

              I'm having trouble compiling example projects since the IDE only uses cmake as far as I know

              What IDE? QtCreator?! Visual Studio?!

              And regardless, these examples came bundled with the 6.7.1 of qt, so you'd expect them to work right out of the box

              They work.
              But if your device is not set up/configured for Bluetooth or it's not supported, Qt can't do anything about it.

              How did you install Qt 6.7? Via online installer?
              Have you installed the Qt Connectivity module as @kuzulis mentioned?

              Don't know what I was doing wrong but I've since been able to compile and run all example projects that came bundled with 6.7.1 and are tagged as "bluetooth". They all work "properly", but none of them can actually use bluetooth, they all default to the dummy backend.

              Because the example windows and dialogs can show up (and everything else seem to work) even when you are not able to connect to any Bluetooth service or device.

              Are there any instructions on how to deploy to different platforms

              Windows (via windeployqt):

              • https://doc.qt.io/qt-6/windows-deployment.html

              Linux:

              • https://doc.qt.io/qt-6/linux-deployment.html

              Android:

              • https://doc.qt.io/qt-6/deployment-android.html
                • https://doc.qt.io/qt-6/porting-to-android.html

              macOS:

              • https://doc.qt.io/qt-6/macos.html#deploying-applications-on-macos

              BTW:

              before you deploy your app for platform X, you need to compile it for this specific platform.
              Qt is platform independent, but this does not mean, that you can run your Qt Windows app on Linux, Android or Mac.
              The same code is able to work the same on all these platforms, but you have to build on them or for them (via cross-compiling).

              I tried the executable in a laptop with integrated bluetooth support and it complained about not having access to qt6 .dll

              Of course this does not work. You can not move the executable to a different location (same device or even to another computer) and expect it to run. It won't as you've noticed because the linked DLLs are missing or can not be found when the program.exe was moved just like that.
              You need to deploy your app properly with all the libs it uses.

              Also, you need to check if Unreal and your Qt app are compatible in terms of licensing.
              Don't know if it's possible to combine an Unreal Engine app and Qt's (L)GPL and release them together.

              B Offline
              B Offline
              blue_balloons
              wrote on last edited by
              #6

              @Pl45m4

              What IDE? QtCreator?! Visual Studio?!

              Qt Creator 13.0.1, the default thing that came with the installer.

              But if your device is not set up/configured for Bluetooth or it's not supported, Qt can't do anything about it.

              The PC I was using to test it does not have integrated bluetooth, I use one of those USB antennae things. And it works well enough for regular stuff like keyboards, gaming pads and microcontrollers. Wanted to try in a laptop/mobile because maybe the drivers aren't compatible? I haven't gotten around to reading much about qt so I wouldn't know, I honestly thought I wouldn't encounter this much resistance.

              How did you install Qt 6.7? Via online installer? Have you installed the Qt Connectivity module as @kuzulis mentioned?

              I'm fairly sure yes. It looked the same as the maintenance tool.
              And yes, I installed the Connectivity library using the maintenance tool. I didn't do anything else; the only qt folder I added to the PATH was the 6.7.1/mingw64/bin one that I needed to compile files.

              Also, you need to check if Unreal and your Qt app are compatible in terms of licensing.
              Don't know if it's possible to combine an Unreal Engine app and Qt's (L)GPL and release them together.

              Licensing wise I'm mostly sure it's okay becuse there's not a paid commercial release planned for the project. And code wise, I'm fairly certain that as long as it can fit in C++ it can be executed in Unreal, so the option to compile a library ought to work, fingers crossed.

              Thank you so much for linking those resources! Hopefully I can get something to work...

              Pl45m4P 1 Reply Last reply
              0
              • B blue_balloons

                @Pl45m4

                What IDE? QtCreator?! Visual Studio?!

                Qt Creator 13.0.1, the default thing that came with the installer.

                But if your device is not set up/configured for Bluetooth or it's not supported, Qt can't do anything about it.

                The PC I was using to test it does not have integrated bluetooth, I use one of those USB antennae things. And it works well enough for regular stuff like keyboards, gaming pads and microcontrollers. Wanted to try in a laptop/mobile because maybe the drivers aren't compatible? I haven't gotten around to reading much about qt so I wouldn't know, I honestly thought I wouldn't encounter this much resistance.

                How did you install Qt 6.7? Via online installer? Have you installed the Qt Connectivity module as @kuzulis mentioned?

                I'm fairly sure yes. It looked the same as the maintenance tool.
                And yes, I installed the Connectivity library using the maintenance tool. I didn't do anything else; the only qt folder I added to the PATH was the 6.7.1/mingw64/bin one that I needed to compile files.

                Also, you need to check if Unreal and your Qt app are compatible in terms of licensing.
                Don't know if it's possible to combine an Unreal Engine app and Qt's (L)GPL and release them together.

                Licensing wise I'm mostly sure it's okay becuse there's not a paid commercial release planned for the project. And code wise, I'm fairly certain that as long as it can fit in C++ it can be executed in Unreal, so the option to compile a library ought to work, fingers crossed.

                Thank you so much for linking those resources! Hopefully I can get something to work...

                Pl45m4P Offline
                Pl45m4P Offline
                Pl45m4
                wrote on last edited by Pl45m4
                #7

                @blue_balloons said in First time multiplatform bluetooth setup help:

                Licensing wise I'm mostly sure it's okay becuse there's not a paid commercial release planned for the project

                You still have to comply with the UE license conditions:

                c. Non-Compatible Licenses
                You may not, and may not permit others to, combine, Distribute, or otherwise use the Licensed Technology with any code or other content which is covered by a license that would directly or indirectly require that all or part of the Licensed Technology be governed under any terms other than those of this Agreement (those licenses, the “Non-Compatible Licenses”). This means, for example, that you may not combine the Licensed Technology with code or content that is licensed under any of the following licenses: GNU General Public License (GPL), Lesser GPL (LGPL) (unless you are merely dynamically linking a shared library), or Creative Commons Attribution-ShareAlike License.

                (from: https://www.unrealengine.com/en-US/eula/unreal)

                If I'm not mistaken "Licensed Technology" also includes their "product" when using the "community" version.
                These are UE's ToS, it doesn't matter if you plan to publish/sell your software or not.

                (I'm not a laywer, ask one, if you are not sure how to handle it. Depends on what you are going to do and if you publish/pass your "software" around... even for "free".)

                Same goes with Qt... just because most of us use the "open source" community version, we can't do what we want with it...
                (L)GPL applies to all of us.


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                1 Reply Last reply
                1
                • B Offline
                  B Offline
                  blue_balloons
                  wrote on last edited by blue_balloons
                  #8

                  @Pl45m4

                  That is... extremely unfortunate.
                  Apparently apache and MIT licenses are fair game though. Hopefully I'll find something else.

                  Apologies to anyone who stumbles onto this thread, I never did find a solution to my technical issue. Good luck!

                  Pl45m4P 1 Reply Last reply
                  0
                  • B blue_balloons

                    @Pl45m4

                    That is... extremely unfortunate.
                    Apparently apache and MIT licenses are fair game though. Hopefully I'll find something else.

                    Apologies to anyone who stumbles onto this thread, I never did find a solution to my technical issue. Good luck!

                    Pl45m4P Offline
                    Pl45m4P Offline
                    Pl45m4
                    wrote on last edited by Pl45m4
                    #9

                    @blue_balloons said in First time multiplatform bluetooth setup help:

                    That is... extremely unfortunate.

                    (unless you are merely dynamically linking a shared library)

                    The last part says you can link your Qt project as dynamic library (if I understood correctly, still no lawyer :D ).
                    So they don't want you to mix their stuff with anything (L)GPL-related (seems like that), but you can create a library from your Qt GUI project and link it to Unreal Engine (if you want to modify something).
                    Don't know if that fits your "project idea".

                    Edit:


                    The Licensed Technology

                    1. What Technology Epic Is Licensing to You
                      The Licensed Technology licensed to you under this Agreement includes all Unreal Engine code and related content that is copied to your computer when you download or install Unreal Engine. This includes Engine Code, Examples, and Starter Content.

                    “Engine Code” means the Source Code (as defined below) and object code of Unreal Engine, including any future versions made available to you by us under this Agreement and any object code compiled from that Source Code.

                    “Source Code” means the human readable form of a software program, including all modules it contains, plus any associated interface definition files, scripts used to control compilation, and installation of an executable.

                    “Examples” means the code, artwork, or other content made available by us in the Samples and Templates folders in the install directory.

                    “Starter Content” means the code, artwork, or other content made available by us and installed to your computer when you install Unreal Engine, excluding Examples.

                    The Licensed Technology includes any modified version of any of the foregoing that you make under the License.

                    Licensed Technology does not include any items, assets, content, or other materials that we may make available to you in other ways (the “Content”), even if that Content can be used with Unreal Engine. For example, assets you may download from an Epic-operated online marketplace (including, but not limited to, Fab) are not Licensed Technology and are not licensed to you under the terms of this Agreement.


                    ( https://www.unrealengine.com/en-US/eula/unreal )

                    So "Licensed Technology" includes everything you get, when downloading UE. Projects you create from scratch are excluded, if you don't include their example code or anything you got from them.

                    Also:
                    I found this (pretty old) reddit post where the license was also mentioned.


                    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                    ~E. W. Dijkstra

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved