3 Replies Latest reply on Dec 23, 2018 9:12 PM by MeenakshiR_71

    Readvertise ble

      Hello, im trying to disconnect the ble of the client side from the server side.

      cy_ble_disable/cy_ble_stop are working but i can't readvertise afterward.

      Ive tried using cy_ble_start/cy_ble_enable following the previous api's but its still not working.

       

      Is it possiable to do it some how?

      Thanks

        • 1. Re: Readvertise ble
          himam_31

          Hello,

           

          Can you please attach your project.

           

          Thanks,

          Hima

          • 2. Re: Readvertise ble
            ajays_86

            Hi,

             

            To disconnect the BLE client (say Phone) from the server side (PSoC 6) use Cy_BLE_GAP_Disconnect() API.

             

            cy_stc_ble_gap_disconnect_info_t param =
                {
                    .bdHandle = /* BD Handle */
                    .reason  = CY_BLE_HCI_ERROR_OTHER_END_TERMINATED_USER
                };
            Cy_BLE_GAP_Disconnect(&param);
            
            

             

            On disconnection, the following events are generated in order.

            CY_BLE_EVT_GATT_DISCONNECT_IND

            CY_BLE_EVT_GAP_DEVICE_DISCONNECTED

             

            After the CY_BLE_EVT_GATT_DISCONNECT_IND and CY_BLE_EVT_GAP_DEVICE_DISCONNECTED events you can use Cy_BLE_GAPP_StartAdvertisement() to restart the advertisement.

             

            Thanks,

            Ajay

            • 3. Re: Readvertise ble
              MeenakshiR_71

              You need to make sure you have received "CY_BLE_EVT_STACK_SHUTDOWN_COMPLETE" before calling Cy_BLE_Start() API. Note that you do not have to call Cy_BLE_Enable as Start calls it automatically.

               

              Also make sure the Cy_BLE_Stop() and Start() return CY_BLE_SUCCESS, otherwise post the error you are getting in the thread. After receiving CY_BLE_SUCCESS from the API calls, you need to call Cy_BLE_ProcessEvents to process the commands through the stack till you receive CY_BLE_EVT_STACK_SHUTDOWN_COMPLETE event for Stop and CY_BLE_EVT_STACK_ON event for Start.

               

              Regards,

              Meenakshi Sundaram R