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. Scanning BLE beacons
Forum Updated to NodeBB v4.3 + New Features

Scanning BLE beacons

Scheduled Pinned Locked Moved Solved General and Desktop
42 Posts 4 Posters 14.6k Views 1 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #14

    @jenya7 said in Scanning BLE beacons:

    auto d = new DeviceInfo(info);

    DeviceInfo is NOT QBluetoothDeviceInfo. It's some custom class you created. We don't know how to access it.

    If you are asking how to get data from info (which is an instance of QBluetoothDeviceInfo), then just read the docs we have already linked: https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html

    (Z(:^

    J 1 Reply Last reply
    0
    • sierdzioS sierdzio

      @jenya7 said in Scanning BLE beacons:

      auto d = new DeviceInfo(info);

      DeviceInfo is NOT QBluetoothDeviceInfo. It's some custom class you created. We don't know how to access it.

      If you are asking how to get data from info (which is an instance of QBluetoothDeviceInfo), then just read the docs we have already linked: https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html

      J Offline
      J Offline
      jenya7
      wrote on last edited by
      #15

      @sierdzio said in Scanning BLE beacons:

      @jenya7 said in Scanning BLE beacons:

      auto d = new DeviceInfo(info);

      DeviceInfo is NOT QBluetoothDeviceInfo. It's some custom class you created. We don't know how to access it.

      If you are asking how to get data from info (which is an instance of QBluetoothDeviceInfo), then just read the docs we have already linked: https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html

      I see. Yes I use this class (from an example - C:\Qt\Examples\Qt-5.12.0\bluetooth\lowenergyscanner)

      class DeviceInfo: public QObject
      {
          Q_OBJECT
          Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged)
          Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged)
      public:
          DeviceInfo() = default;
          DeviceInfo(const QBluetoothDeviceInfo &d);
          QString getAddress() const;
          QString getName() const;
          QBluetoothDeviceInfo getDevice();
          void setDevice(const QBluetoothDeviceInfo &dev);
      
      Q_SIGNALS:
          void deviceChanged();
      
      private:
          QBluetoothDeviceInfo device;
      };
      

      So it has

      QString DeviceInfo::getName() const
      {
          return device.name();
      }
      

      What if I want to add

       DeviceInfo::getData() const
      {
          return device. //???? - no data field
      }
      
      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #16

        But what data do you want to read? Manufacturer data? Device UUID? Address?

        Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

        (Z(:^

        J J.HilkJ 2 Replies Last reply
        0
        • J Offline
          J Offline
          jenya7
          wrote on last edited by
          #17
          This post is deleted!
          1 Reply Last reply
          0
          • sierdzioS sierdzio

            But what data do you want to read? Manufacturer data? Device UUID? Address?

            Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

            J Offline
            J Offline
            jenya7
            wrote on last edited by jenya7
            #18

            @sierdzio said in Scanning BLE beacons:

            But what data do you want to read? Manufacturer data? Device UUID? Address?

            Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

            OK. I understand. I can use info directly like info.name, but how do I get data (no info.data).
            Yes I want to se all beacon raw data - payload. I need no services. It's a remote sensor sending me temperature, humidity, pressure, etc.

            1 Reply Last reply
            0
            • sierdzioS sierdzio

              But what data do you want to read? Manufacturer data? Device UUID? Address?

              Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #19

              @sierdzio said in Scanning BLE beacons:

              Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

              not with beacon, beacons are not connectable. And the Qt Api gives no way to identify that.

              what the op is looking for should be in
              https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              J 1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #20

                It's been a long time since I've done it, sorry I don't remember the details. Check the example docs above, it explains how to connect to various services and characteristics, then you can start receiving the data.

                (Z(:^

                1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @sierdzio said in Scanning BLE beacons:

                  Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

                  not with beacon, beacons are not connectable. And the Qt Api gives no way to identify that.

                  what the op is looking for should be in
                  https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                  J Offline
                  J Offline
                  jenya7
                  wrote on last edited by jenya7
                  #21

                  @J-Hilk said in Scanning BLE beacons:

                  @sierdzio said in Scanning BLE beacons:

                  Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

                  not with beacon, beacons are not connectable. And the Qt Api gives no way to identify that.

                  what the op is looking for should be in
                  https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                  No. It has to get a payload. Every beacon has a payload (20 bytes) of my own data. App. I wrote on my phone (Android) gets all beacons and I see my payload too.
                  Wat's the point to get a beacon? To see it's name, rssi, and other fields ? I need the data it sends.

                  J.HilkJ 1 Reply Last reply
                  0
                  • J jenya7

                    @J-Hilk said in Scanning BLE beacons:

                    @sierdzio said in Scanning BLE beacons:

                    Or you want to read the data that the device is sending? To do that, you need to connect to it first. https://doc.qt.io/qt-5/qtbluetooth-lowenergyscanner-example.html#connecting-to-services

                    not with beacon, beacons are not connectable. And the Qt Api gives no way to identify that.

                    what the op is looking for should be in
                    https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                    No. It has to get a payload. Every beacon has a payload (20 bytes) of my own data. App. I wrote on my phone (Android) gets all beacons and I see my payload too.
                    Wat's the point to get a beacon? To see it's name, rssi, and other fields ? I need the data it sends.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #22

                    @jenya7 I'm not sure to what you're replying ?

                    I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                    I do it too.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    J 1 Reply Last reply
                    0
                    • J.HilkJ J.Hilk

                      @jenya7 I'm not sure to what you're replying ?

                      I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                      I do it too.

                      J Offline
                      J Offline
                      jenya7
                      wrote on last edited by jenya7
                      #23

                      @J-Hilk said in Scanning BLE beacons:

                      @jenya7 I'm not sure to what you're replying ?

                      I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                      I do it too.

                      I see. But info has no such field.

                      void BT_DEVICE::AddDevice(const QBluetoothDeviceInfo &info)
                      {
                         info. //no manufacturerData
                      }
                      
                      J.HilkJ 1 Reply Last reply
                      0
                      • sierdzioS Offline
                        sierdzioS Offline
                        sierdzio
                        Moderators
                        wrote on last edited by
                        #24

                        This function was introduced in Qt 5.12.

                        Maybe you are using older Qt version?

                        (Z(:^

                        1 Reply Last reply
                        1
                        • J jenya7

                          @J-Hilk said in Scanning BLE beacons:

                          @jenya7 I'm not sure to what you're replying ?

                          I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                          I do it too.

                          I see. But info has no such field.

                          void BT_DEVICE::AddDevice(const QBluetoothDeviceInfo &info)
                          {
                             info. //no manufacturerData
                          }
                          
                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by J.Hilk
                          #25

                          @jenya7 said in Scanning BLE beacons:

                          @J-Hilk said in Scanning BLE beacons:

                          @jenya7 I'm not sure to what you're replying ?

                          I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                          I do it too.

                          I see. But info has no such field.

                          no, it does not, and here you come in and either
                          - expand DeviceInfo class that comes with the BTLE example and you're using

                          or
                          - create your own interface class that wraps around QBlueToothDeviceInfo

                          written before the edit of

                          void BT_DEVICE::AddDevice(const QBluetoothDeviceInfo &info)
                          {
                          info. //no manufacturerData
                          }

                          @sierdzio is probably right, what version are you using?


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          J 1 Reply Last reply
                          0
                          • J.HilkJ J.Hilk

                            @jenya7 said in Scanning BLE beacons:

                            @J-Hilk said in Scanning BLE beacons:

                            @jenya7 I'm not sure to what you're replying ?

                            I said, your payload can be accessed via https://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#manufacturerData-1

                            I do it too.

                            I see. But info has no such field.

                            no, it does not, and here you come in and either
                            - expand DeviceInfo class that comes with the BTLE example and you're using

                            or
                            - create your own interface class that wraps around QBlueToothDeviceInfo

                            written before the edit of

                            void BT_DEVICE::AddDevice(const QBluetoothDeviceInfo &info)
                            {
                            info. //no manufacturerData
                            }

                            @sierdzio is probably right, what version are you using?

                            J Offline
                            J Offline
                            jenya7
                            wrote on last edited by
                            #26

                            @J-Hilk said in Scanning BLE beacons:

                            @sierdzio is probably right, what version are you using?

                            It is 5.11.3

                            jsulmJ 1 Reply Last reply
                            0
                            • J jenya7

                              @J-Hilk said in Scanning BLE beacons:

                              @sierdzio is probably right, what version are you using?

                              It is 5.11.3

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #27

                              @jenya7 If you follow the link from @J-Hilk you will see that you need Qt >= 5.12 for that method.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              J 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @jenya7 If you follow the link from @J-Hilk you will see that you need Qt >= 5.12 for that method.

                                J Offline
                                J Offline
                                jenya7
                                wrote on last edited by
                                #28

                                @jsulm said in Scanning BLE beacons:

                                @jenya7 If you follow the link from @J-Hilk you will see that you need Qt >= 5.12 for that method.

                                Wow. On Linux the latest available from repository is 5.11.3.

                                jsulmJ 1 Reply Last reply
                                0
                                • J jenya7

                                  @jsulm said in Scanning BLE beacons:

                                  @jenya7 If you follow the link from @J-Hilk you will see that you need Qt >= 5.12 for that method.

                                  Wow. On Linux the latest available from repository is 5.11.3.

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #29

                                  @jenya7 said in Scanning BLE beacons:

                                  On Linux the latest available from repository is 5.11.3

                                  You can install newer versions using Qt Online Installer...

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  J 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @jenya7 said in Scanning BLE beacons:

                                    On Linux the latest available from repository is 5.11.3

                                    You can install newer versions using Qt Online Installer...

                                    J Offline
                                    J Offline
                                    jenya7
                                    wrote on last edited by
                                    #30

                                    @jsulm said in Scanning BLE beacons:

                                    @jenya7 said in Scanning BLE beacons:

                                    On Linux the latest available from repository is 5.11.3

                                    You can install newer versions using Qt Online Installer...

                                    I see no options for Linux there.

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • J jenya7

                                      @jsulm said in Scanning BLE beacons:

                                      @jenya7 said in Scanning BLE beacons:

                                      On Linux the latest available from repository is 5.11.3

                                      You can install newer versions using Qt Online Installer...

                                      I see no options for Linux there.

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #31

                                      @jenya7 And what is this: https://www.qt.io/download-thank-you?os=linux ?

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      J 1 Reply Last reply
                                      0
                                      • jsulmJ jsulm

                                        @jenya7 And what is this: https://www.qt.io/download-thank-you?os=linux ?

                                        J Offline
                                        J Offline
                                        jenya7
                                        wrote on last edited by
                                        #32

                                        @jsulm said in Scanning BLE beacons:

                                        @jenya7 And what is this: https://www.qt.io/download-thank-you?os=linux ?

                                        sorry, may be stupid question - how do I run it?
                                        tied this way

                                        sudo /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run
                                        /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: 1: /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: nC@�!@8: not found
                                        /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: 1: /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: ELF: not found
                                        /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: 2: /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: @#: not found
                                        /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: 3: /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run: Syntax error: "(" unexpected
                                        
                                        
                                        jsulmJ 1 Reply Last reply
                                        0
                                        • sierdzioS Offline
                                          sierdzioS Offline
                                          sierdzio
                                          Moderators
                                          wrote on last edited by
                                          #33
                                          chmod +x /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run
                                          /home/pi/Downloads/qt-unified-linux-x64-4.2.0-online.run
                                          

                                          Do not install as root.

                                          (Z(:^

                                          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