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. Implementing bluetooth - general questions - part 1
Qt 6.11 is out! See what's new in the release blog

Implementing bluetooth - general questions - part 1

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 760 Views 3 Watching
  • 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    Thanks to this forum support my bluetooth application frame / GUI is working as desired. Appreciate such support very much .

    Now is the time to modify basic btscanner to consistently establish bluetooth devices connection and pass data thru it.

    According to manuals, the Qt uses "blueZ" library.
    Such library, which is basically hidden from direct access , throws errors when bluetooth process fails - generally in format
    "qt.bluetooth.bluez ....."
    and displays them on console at run time.

    My desire is to redirect these error / progress messages to Qt form / widget.

    Any suggestions how to accomplish this would be greatly appreciated.

    Cheers

    Pl45m4P 1 Reply Last reply
    0
    • A Anonymous_Banned275

      Thanks to this forum support my bluetooth application frame / GUI is working as desired. Appreciate such support very much .

      Now is the time to modify basic btscanner to consistently establish bluetooth devices connection and pass data thru it.

      According to manuals, the Qt uses "blueZ" library.
      Such library, which is basically hidden from direct access , throws errors when bluetooth process fails - generally in format
      "qt.bluetooth.bluez ....."
      and displays them on console at run time.

      My desire is to redirect these error / progress messages to Qt form / widget.

      Any suggestions how to accomplish this would be greatly appreciated.

      Cheers

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

      @AnneRanch

      QBluetoothServiceDiscoveryAgent and QBluetoothDeviceDiscoveryAgent have error signals and errorString() functions, to which you can connect to and "simply" set this QString errorString to your menuBar or wherever you want to show it.

      Here is an example (might confuse you a bit, because it's using lambda connections). So no slot needed. Your code is right inside the connect-statement. But it's the usual way, how to use it, I guess.

      connect(bluetoothDeviceDiscoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error),
          [=](QBluetoothDeviceDiscoveryAgent::Error error){ 
      // Place code to set your error to your ui here
      });
      

      (From: https://doc.qt.io/qt-5/qbluetoothdevicediscoveryagent.html#error-1)

      You will receive the "human readable" error msg, by using this function:

      QString QBluetoothDeviceDiscoveryAgent::errorString()
      

      https://doc.qt.io/qt-5/qbluetoothdevicediscoveryagent.html#errorString


      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
      3
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        Thanks, I need to pay more attention to doc , but I did nor realize how versatile signals / slots are.

        Pl45m4P 1 Reply Last reply
        0
        • A Anonymous_Banned275

          Thanks, I need to pay more attention to doc , but I did nor realize how versatile signals / slots are.

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

          @AnneRanch

          It's all about signals and slots (almost) :-)

          You don't like just reading the "manual" / docs, but you really should check out the docs of your classes, that you are currently using. All default signals, which could be emitted by this class are listed there. So it's always worth to take a look at it.

          (The docs are accessible inside QtCreator by clicking / marking any Qt class (QWhatever) and pressing the F1 key. So you don't have to browse the internet and look for your class documentation. In case you didn't know that)


          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

          • Login

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