Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Bluetooth communication

Qt Bluetooth communication

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 1.7k 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.
  • PientashekP Offline
    PientashekP Offline
    Pientashek
    wrote on last edited by kshegunov
    #1

    Hey,
    I have an application based on Qt and QML, which is on the minicomputer (UpBoard). I need to add the ability to transfer data via Bluetooth to a mobile android application. The problem is that UpBoard does not have a built-in BT. And here the questions arise:

    • which BT module to choose? USB adapter or some HC-05 / HC-06? What are the differences between them?
    • how to detect the module "programmatically" in c ++ (Qt) and start sending data? Any example code?
      I am a beginner in the topic of Bluetooth. Thank you in advance for your help!
      Regards, Paul.

    [Polish: https://forum.qt.io/topic/102441/qt-komunikacja-przez-bluetooth ~kshegunov]

    KillerSmathK 1 Reply Last reply
    0
    • PientashekP Pientashek

      Hey,
      I have an application based on Qt and QML, which is on the minicomputer (UpBoard). I need to add the ability to transfer data via Bluetooth to a mobile android application. The problem is that UpBoard does not have a built-in BT. And here the questions arise:

      • which BT module to choose? USB adapter or some HC-05 / HC-06? What are the differences between them?
      • how to detect the module "programmatically" in c ++ (Qt) and start sending data? Any example code?
        I am a beginner in the topic of Bluetooth. Thank you in advance for your help!
        Regards, Paul.

      [Polish: https://forum.qt.io/topic/102441/qt-komunikacja-przez-bluetooth ~kshegunov]

      KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      @Pientashek
      Firstly, i suggest you to read a overview of Qt Bluetooth Api
      https://doc.qt.io/qt-5/qtbluetooth-index.html
      It will provide you a general knowledge of how Qt supports the Bluetooth technology.

      The qt has examples of bluetooth comunication between devices, for example:
      https://doc.qt.io/qt-5/qtbluetooth-btchat-example.html (C++)
      https://doc.qt.io/qt-5/qtbluetooth-chat-example.html (Qml)

      how to detect the module "programmatically" in c ++ (Qt)

      You can check all avaliable bluetooth devices on your system by calling allDevices static method.

      See a example (Using QGuiApplication):

      #include <QGuiApplication>
      #include <QBluetoothLocalDevice>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
      
          if (infos.isEmpty()){
              qWarning() << "Missing Bluetooth local device. ";
              return 0;
          }
      
          for(const QBluetoothHostInfo &hostInfo : qAsConst(infos)){
              qDebug() << hostInfo.name() << hostInfo.address(); // name and mac address
          }
      
         // your code
      
          return app.exec();
      }
      

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      M 1 Reply Last reply
      2
      • PientashekP Offline
        PientashekP Offline
        Pientashek
        wrote on last edited by
        #3

        @KillerSmath said in Qt Bluetooth communication:

        #include <QGuiApplication>
        #include <QBluetoothLocalDevice>
        #include <QDebug>

        int main(int argc, char *argv[])
        {
        QGuiApplication app(argc, argv);

        QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
        
        if (infos.isEmpty()){
            qWarning() << "Missing Bluetooth local device. ";
            return 0;
        }
        
        for(const QBluetoothHostInfo &hostInfo : qAsConst(infos)){
            qDebug() << hostInfo.name() << hostInfo.address(); // name and mac address
        

        Thank You for answer, i'll try to do something :)

        1 Reply Last reply
        0
        • KillerSmathK KillerSmath

          @Pientashek
          Firstly, i suggest you to read a overview of Qt Bluetooth Api
          https://doc.qt.io/qt-5/qtbluetooth-index.html
          It will provide you a general knowledge of how Qt supports the Bluetooth technology.

          The qt has examples of bluetooth comunication between devices, for example:
          https://doc.qt.io/qt-5/qtbluetooth-btchat-example.html (C++)
          https://doc.qt.io/qt-5/qtbluetooth-chat-example.html (Qml)

          how to detect the module "programmatically" in c ++ (Qt)

          You can check all avaliable bluetooth devices on your system by calling allDevices static method.

          See a example (Using QGuiApplication):

          #include <QGuiApplication>
          #include <QBluetoothLocalDevice>
          #include <QDebug>
          
          int main(int argc, char *argv[])
          {
              QGuiApplication app(argc, argv);
          
              QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
          
              if (infos.isEmpty()){
                  qWarning() << "Missing Bluetooth local device. ";
                  return 0;
              }
          
              for(const QBluetoothHostInfo &hostInfo : qAsConst(infos)){
                  qDebug() << hostInfo.name() << hostInfo.address(); // name and mac address
              }
          
             // your code
          
              return app.exec();
          }
          
          M Offline
          M Offline
          Minnie254
          wrote on last edited by Minnie254
          #4

          @KillerSmath said in Qt Bluetooth communication:

          @Pientashek
          Firstly, i suggest you to read a overview of Qt Bluetooth Api
          https://doc.qt.io/qt-5/qtbluetooth-index.html
          It will provide you a general knowledge of how Qt supports the Bluetooth technology.

          The qt has examples of bluetooth comunication between devices, for example:
          https://doc.qt.io/qt-5/qtbluetooth-btchat-example.html (C++)
          https://doc.qt.io/qt-5/qtbluetooth-chat-example.html (Qml)

          how to detect the module "programmatically" in c ++ (Qt)

          You can check all avaliable bluetooth devices on your system by calling vidmate.

          See a example (Using QGuiApplication):

          #include <QGuiApplication>
          #include <QBluetoothLocalDevice>
          #include <QDebug>
          
          int main(int argc, char *argv[])
          {
              QGuiApplication app(argc, argv);
          
              QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
          
              if (infos.isEmpty()){
                  qWarning() << "Missing Bluetooth local device. "; 
                  return 0;
              }
          
              for(const QBluetoothHostInfo &hostInfo : qAsConst(infos)){
                  qDebug() << hostInfo.name() << hostInfo.address(); // name and mac address
              }
          
             // your code
          
              return app.exec();
          }
          

          Happy to help! Thanks for leaving a comment.

          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