Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Bluetoothapis.h windows SDK - Issue

Bluetoothapis.h windows SDK - Issue

Scheduled Pinned Locked Moved Solved 3rd Party Software
windows sdkbluetoothapisbluetooth low e
4 Posts 3 Posters 2.9k 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.
  • N Offline
    N Offline
    NicoFrom13
    wrote on 22 Jan 2017, 07:14 last edited by
    #1

    Hello,

    I'm new to the Froum, so first of all, Hello all !

    I almost never post on forum before a lot of search, but here i'm blocked with something and i don't know how to success my problem.

    I actually want to use BluetoothApi from windows SDK, i checked the documentation and so, i try to use the BluetoothFindDirstDevice without any sucess.

    I mean i get no error inside Qt, but the program crash.

    Here is my code

    HBLUETOOTH_DEVICE_FIND hfind;
        hfind=NULL;
    
        BLUETOOTH_DEVICE_SEARCH_PARAMS params;
        params.dwSize=sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS);
    
        params.fReturnAuthenticated=true;
        params.fReturnConnected=true;
        params.fReturnUnknown=false;
        params.fReturnRemembered=true;
        params.fIssueInquiry=true;
        params.hRadio=NULL;
        params.cTimeoutMultiplier=5;
    
        BLUETOOTH_DEVICE_INFO btdi;
        ZeroMemory(&btdi,sizeof(BLUETOOTH_DEVICE_INFO));
        btdi.dwSize=sizeof(BLUETOOTH_DEVICE_INFO);
    
        hfind=BluetoothFindFirstDevice(&params,&btdi);
    
        if(hfind!=NULL)
        {
        qDebug()<<"We find a bt"   ;
        }else{
          qDebug()<<"Nothing"   ;
        }
    

    Qt 5.8 RC with minGW
    Windows 10 platform 64

    My Pro.file

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = BluetoothTest
    TEMPLATE = app
    
    INCLUDEPATH +="D:\WinSDK\Include"
    
    LIBS += "D:\WinSDK\Lib\10.0.14393.0\um\x86\WSock32.Lib"
    LIBS += "D:\WinSDK\Lib\10.0.14393.0\um\x86\bthprops.lib"
    
    
    SOURCES += main.cpp\
            mainwindow.cpp
    
    HEADERS  += mainwindow.h
    
    FORMS    += mainwindow.ui
    

    i don't know if you need more info to help me. if so ask me.

    Many thanks

    1 Reply Last reply
    0
    • C Online
      C Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on 22 Jan 2017, 10:17 last edited by Chris Kawa
      #2

      Hi, welcome to the forum.

      You can't use Windows SDK provided by Microsoft with MinGW. It ships with its own, modified version of it. It probably compiles because you have errors in your config in the .pro file: \ is an escape character and that's not how you pass libraries to the linker.

      Remove the INCLUDEPATH. MinGW kit already has a path to its own version of Windows SDK. Also remove the LIBS paths and only add:

      LIBS += -lWSock32 -lbthprops
      

      Tthere's a -l(lowercase L) before the name of the lib and no .lib suffix.
      After that Build->run qmake and you should be good to go.

      1 Reply Last reply
      1
      • N Offline
        N Offline
        NicoFrom13
        wrote on 22 Jan 2017, 12:19 last edited by
        #3

        Awesome man.

        That show me that sometimes ask the question is more usefull than searching for hours....

        I didn't know that i could not use Windows SDK with MinGW i understand now. windows SDK needs to be with Visual compiler ...

        Many thanks have a nice Day.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          harryclone
          Banned
          wrote on 6 Mar 2017, 10:38 last edited by
          #4
          This post is deleted!
          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