2 Replies Latest reply on Aug 4, 2016 5:32 AM by forqzy_1626536

    BLE scan report CYBLE_EVT_HCI_STATUS 12

    forqzy_1626536

      There is a error when I have two Central start at the same time try to scan and connect to two Peripheral.

         

       

         

      #1. Two Central device start scan

         

      #2. When receive CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT,

         

        if the target mac address arrived then CyBle_GapcStopScan().

         

      #3. After receive CYBLE_EVT_GAPC_SCAN_START_STOP try to connect.

         

         But if there are two Central, I always get state=scanning, then report HCI_STATUS 12.

         

      Any idea?

         

      ///////////////////////////////////////

         

      Stop Scanning, waiting for Scanning event 
      CYBLE_EVT_GAPC_SCAN_START_STOP 
      state: scanning
      CYBLE_EVT_HCI_STATUS 12 

        • 1. Re: BLE scan report CYBLE_EVT_HCI_STATUS 12
          resh

          You should get  CYBLE_EVT_GAPC_SCAN_START_STOP with the event data of '0x01'  indicating success, before initiating a connection. This could be the reason for HCI error.

          • 2. Re: BLE scan report CYBLE_EVT_HCI_STATUS 12
            forqzy_1626536

            Thanks for the reply.

               

            With more investigation in this topic, here is more findings.

               

            #1. When CYBLE_EVT_GAPC_SCAN_START_STOP received the event data is "0x01", then I try to init the connection

               

              In most situation it will report this HCI error.

               

            #2. This is because the ble state still in CyBle_GetState() == CYBLE_STATE_SCANNING

               

              If the duplicate filtering is not selected, these scan result event still coming.

               

            #3. So for temp solution, put the connect in the main loop, until the state not in CYBLE_STATE_SCANNING.

               

             

               

            So what is the standard procedure for connect a new device?

               

            #1. startscan CyBle_GapcStartScan

               

            #2. processing the scan result CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT

               

            #3. once find the target device, stop scan  CyBle_GapcStopScan

               

            #4. connect when receive the CYBLE_EVT_GAPC_SCAN_START_STOP and event data=0x01?