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. Crashing while turn on/off BTLE adapter
Forum Updated to NodeBB v4.3 + New Features

Crashing while turn on/off BTLE adapter

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 Posters 1.4k Views 2 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.
  • Pham HoangP Offline
    Pham HoangP Offline
    Pham Hoang
    wrote on last edited by Pham Hoang
    #1

    Hi, i got crashing while turn on/off BTLE power.
    it often crashing with QBluetoothDeviceDiscoveryAgent. now i am using

    QSharedPointer<QBluetoothLocalDevice> _btlePower;
    QBluetoothLocalDevice::HostMode mode = _btlePower->hostMode();

    if (mode == QBluetoothLocalDevice::HostPoweredOff)
    _isBTLEPowerOn = false;
    else
    _isBTLEPowerOn = true;

    i use it to check the power before each time use QBluetoothDeviceDiscoveryAgent.
    but sometime it still happened crashing somewhere. what is the best solution that QT support to handle this issue?

    jsulmJ 1 Reply Last reply
    0
    • Pham HoangP Pham Hoang

      Hi, i got crashing while turn on/off BTLE power.
      it often crashing with QBluetoothDeviceDiscoveryAgent. now i am using

      QSharedPointer<QBluetoothLocalDevice> _btlePower;
      QBluetoothLocalDevice::HostMode mode = _btlePower->hostMode();

      if (mode == QBluetoothLocalDevice::HostPoweredOff)
      _isBTLEPowerOn = false;
      else
      _isBTLEPowerOn = true;

      i use it to check the power before each time use QBluetoothDeviceDiscoveryAgent.
      but sometime it still happened crashing somewhere. what is the best solution that QT support to handle this issue?

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

      @Pham-Hoang said in Crashing while turn on/off BTLE adapter:

      crashing somewhere

      Use debugger to see where exactly it is crashing and check the stack trace.

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

      1 Reply Last reply
      3
      • Pham HoangP Offline
        Pham HoangP Offline
        Pham Hoang
        wrote on last edited by
        #3

        @jsulm actually, it is hard to catch the issue while coding/debugging. it is rarely, i see it in running time with log file.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Any more information in the logs ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Pham HoangP 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Any more information in the logs ?

            Pham HoangP Offline
            Pham HoangP Offline
            Pham Hoang
            wrote on last edited by Pham Hoang
            #5

            @SGaist hi i got it before the crashing:

            [CoreBluetooth] API MISUSE: <CBCentralManager: 0x10240ca80> can only accept this command while in the powered on state
            MacOS 10.14

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              How often are you doing that check ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Pham HoangP Offline
                Pham HoangP Offline
                Pham Hoang
                wrote on last edited by
                #7

                @SGaist said in Crashing while turn on/off BTLE adapter:

                w often are you doing that che

                i check it 1 time in onStartDeviceDiscovery before call
                discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);

                1 Reply Last reply
                0
                • Pham HoangP Offline
                  Pham HoangP Offline
                  Pham Hoang
                  wrote on last edited by
                  #8

                  i know discoveryAgent->start() can make a crashing while BTLE adapter off. anything more?

                  btw, i think it is perfect if QT help to handle the issue internal that return a error code or something which don't break

                  J.HilkJ 1 Reply Last reply
                  0
                  • Pham HoangP Pham Hoang

                    i know discoveryAgent->start() can make a crashing while BTLE adapter off. anything more?

                    btw, i think it is perfect if QT help to handle the issue internal that return a error code or something which don't break

                    J.HilkJ Online
                    J.HilkJ Online
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @Pham-Hoang can't say I ever ran into this issue, and my application continuously calls start everytime the finished Signal is emitted (with a 2 second delay to not completely drain the batteries).

                    Do you listen and react to the QBluetoothDeviceDiscoveryAgent::error() signal?


                    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.

                    1 Reply Last reply
                    2
                    • Pham HoangP Offline
                      Pham HoangP Offline
                      Pham Hoang
                      wrote on last edited by
                      #10

                      @J.Hilk said in Crashing while turn on/off BTLE adapter:

                      hDeviceDiscoveryAgent::err

                      i call start discovery each 10 seconds. the issue came when you trying to switch on/off BTLE adapter many times.
                      QBluetoothDeviceDiscoveryAgent::error() . yep, i have it. but if it go to error signal that mean it will not crashing.

                      J.HilkJ 1 Reply Last reply
                      0
                      • Pham HoangP Pham Hoang

                        @J.Hilk said in Crashing while turn on/off BTLE adapter:

                        hDeviceDiscoveryAgent::err

                        i call start discovery each 10 seconds. the issue came when you trying to switch on/off BTLE adapter many times.
                        QBluetoothDeviceDiscoveryAgent::error() . yep, i have it. but if it go to error signal that mean it will not crashing.

                        J.HilkJ Online
                        J.HilkJ Online
                        J.Hilk
                        Moderators
                        wrote on last edited by
                        #11

                        @Pham-Hoang you may have to explain that a bit more to me.

                        If you turn of your BTLE adapter QBluetoothDeviceDiscoveryAgent::PoweredOffError is emitted and you detect that and everything is fine.

                        But if you rapidly turn the adapter on and off it can happen that the adapter is actully powered of but allready/or still registered (from the OS) as connected and powerdOn ?

                        If that's the case, than I don't see a way to catch that particular error case.


                        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.

                        1 Reply Last reply
                        0
                        • Pham HoangP Offline
                          Pham HoangP Offline
                          Pham Hoang
                          wrote on last edited by
                          #12

                          @J.Hilk said in Crashing while turn on/off BTLE adapter:

                          QBluetoothDeviceDiscoveryAgent::PoweredOffError

                          this emitted is raised when discoveryAgent already started and in discovering. then if a turn off event happen, it will emit
                          QBluetoothDeviceDiscoveryAgent::PoweredOffError.
                          but the issue could came before discoveryAgent start and after i checked isBTLEPowerON()
                          or some other cases that i don't know yet.

                          But if you rapidly turn the adapter on and off it can happen that the adapter is actully powered of but allready/or still registered (from the OS) as connected and powerdOn ?
                          If that's the case, than I don't see a way to catch that particular error case.

                          yep, it is a case

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            By the way, can you give more information about your setup ? (hardware/software)

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            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