Bluetooth Low Energy example doesn't work



  • Hello,
    I'm new in Qt, and I want to develop a program with BLE connection. I started to run "Bluetooth Low Energy Scanner" example and some other examples from the examples list. But it doesn't work correctly. The list of devices always empty.
    I am using windows 10 and Qt 5.10.0
    Can anyone help me please?



  • Can anyone help me?
    I found this but still confused!
    Does Qt supports Bluetooth API on Windows 10?
    If yes, could you please tell me how to use it?


  • Qt Champions 2018

    @Ashi said in Bluetooth Low Energy example doesn't work:

    Can anyone help me?
    I found this but still confused!
    Does Qt supports Bluetooth API on Windows 10?

    By reading the docs, no. At least not until someone provides a suitable driver.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    IIRC, the wip/win branch of the module provides preliminary support for BLE. However you have to build it yourself.



  • Thanks @SGaist ,

    I tried to do the following:
    git clone git://code.qt.io/qt/qtconnectivity.git
    cd qtconnectivity
    git checkout wip/win

    But still the same problem. The devices list is empty.
    Did I do something wrong? or miss something?
    Thank you very much!


  • Lifetime Qt Champion

    @Ashi
    Hi and you did also build it ?



  • @mrjj yes I did.


  • Lifetime Qt Champion

    @Ashi
    and make install ?
    so its installed into Qt ?



  • @Ashi How can I make install?? Could you please explain?
    Thanks in advance!


  • Lifetime Qt Champion

    nmake install in the build folder if you are using Visual Studio and mingw32-make install if you are using MinGW



  • This post is deleted!


  • @SGaist After made make install I got the following:

    C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity>nmake install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cd src\ && ( if not exist Makefile C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\qmake.exe -o Makefile C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity\src\src.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cd bluetooth\ && ( if not exist Makefile C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\qmake.exe -o Makefile C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity\src\bluetooth\bluetooth.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
    Project MESSAGE: perl -w C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\syncqt.pl -module QtBluetooth -version 5.10.1 -outdir C:/Qt/Qt5.10.0/Examples/Qt-5.10.0/qtconnectivity C:/Qt/Qt5.10.0/Examples/Qt-5.10.0/qtconnectivity
    'perl' is not recognized as an internal or external command,
    operable program or batch file.
    Project ERROR: Failed to run: perl -w C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\syncqt.pl -module QtBluetooth -version 5.10.1 -outdir C:/Qt/Qt5.10.0/Examples/Qt-5.10.0/qtconnectivity C:/Qt/Qt5.10.0/Examples/Qt-5.10.0/qtconnectivity
    NMAKE : fatal error U1077: 'cd' : return code '0x3'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    
    

    And still after running the example again, the devices list is empty.


  • Lifetime Qt Champion

    As the error suggests: you are missing Perl. Install it.

    It’s normal noting changed, the module wasn’t even built.



  • @SGaist During installation process of QT this problem occurred:

    0_1514874723242_Qt-perl.png
    So I clicked 'Ignore'.
    Then I tried to install "C:\Qt\Qt5.10.0\Tools\Perl52213_32\strawberry-perl-5.22.1.3-32bit.msi
    but nothing changed.
    I tried to reinstall it and disabled Antivirus and the same error appeared.
    Is there anyway to overcome this problem?


  • Lifetime Qt Champion

    Did it install successfully ?
    If so did you try to call perl from a new command prompt ?



  • @SGaist I restarted the Qt command line and the error that related to Perl disappeared and I got the following:

    
    C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity>nmake install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cd src\ && ( if not exist Makefile C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\qmake.exe -o Makefile C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity\src\src.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cd bluetooth\ && ( if not exist Makefile C:\Qt\Qt5.10.0\5.10.0\msvc2015_64\bin\qmake.exe -o Makefile C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity\src\bluetooth\bluetooth.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.Release install
    
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /OPT:REF /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /VERSION:5.10 /MANIFEST:embed /OUT:..\..\lib\Qt5Bluetooth.dll @C:\Users\kacst\AppData\Local\Temp\nm98A.tmp
    Qt5Core.lib(Qt5Core.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x458'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    
    
    C:\Qt\Qt5.10.0\Examples\Qt-5.10.0\qtconnectivity>
    

    Thanks for your response!


  • Qt Champions 2018

    @Ashi Shouldn't you "nmake install" what you cloned from the repository before?

    git clone git://code.qt.io/qt/qtconnectivity.git
    cd qtconnectivity
    git checkout wip/win
    ...
    nmake
    nmake install
    

  • Lifetime Qt Champion

    You should also use the correct command line prompt for building especially if you start with the one provided by Visual Studio.