Important: Please read the Qt Code of Conduct -

Qt Bluetooth server not working with QCoreApplication

  • Hello to all,

    I'm trying to build a simple Qt based Bluetooth Server (rfcomm) that just prints in the console the text that is sent by the client. I've noticed that when I'm using QCoreApplication(this is what I need because it will run on a board) instead of QGuiApplication or QApplication, I'm not able to receive any message and I'm not notified when a client is connected (SLOTS are not called). The entire code can be found here. The server can be tested with Qt Bluetooth Chat example and the entire code of my server is extracted from the example. It could be something related to the event loop but I don't know what. I'm running the server on OS X El Capitan with Qt 5.6.1.

    Any suggestions?
    Thanks a lot!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you removing the app_bundle option when you build your application with only QCoreApplication ?

  • According to the Qt team response on this reported bug Bluetooth I/O related functionality needs a running loop which is not available through QCoreApplication.

    Qt 5.7 has a workaround for this - using Core Foundation event dispatcher.

    To activate this event dispatcher you'll need to set the 'QT_EVENT_DISPATCHER_CORE_FOUNDATION=1' environment variable.

Log in to reply