3 Replies Latest reply on Nov 13, 2019 12:21 PM by NazarP_56

    Indication response from the client

    DaGa_4352226

      Hallo community,

       

      Im sending  data via indication protocol. This is a for loop which it says how many times has to update the server and afterwards sents the indication update. I want to send the next package of info after the respone of the cliet arrived. I found the event from the cy_ble: CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF.

       

      This particully Event is for:

      This event indicates that an Indication Response is received from the GATT Client.

      The event parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

       

      When I receive the conn_handle_t structure, this structure does not manage a attHandle. Thus, I can not re start to sending the next package to the client.

      How can I manage this?

       

      Resume: I want to send different pakages using a for loop (not necesary if you tell me) via indications

      Regards,

      David

        • 1. Re: Indication response from the client
          NazarP_56

          Hello David,

           

          Per BLUETOOTH SPECIFICATION Version 5.0, Vol 3, Part F, Section 3.4.7.2 "Handle Value Indication" (p.2210):
          " …

          The client shall send a Handle Value Confirmation in response to a Handle Value Indication. No further indications to this client shall occur until the confirmation has been received by the server
          ...

          "
          So, you should implement your "for loop" with waiting CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF event before send next indication.

          You can use some state-machine or waiting CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF by polling Cy_BLE_ProcessEvent.

           

          Regards,
          Nazar

          1 of 1 people found this helpful
          • 2. Re: Indication response from the client
            DaGa_4352226

            I tried to to a waiting after sending my first indication and the code was like this

             

            In the main.c

            export bool indicationResponse;

            case CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF:

                        indicationResponse = true;

                        DBG_PRINTF("CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF \r\n");

             

            in the for loop:

            for (uint8_t i = controlNumber[0]; i >= 1; i-- ){

                 indicationResponse = false;

                 cy_en_ble_api_result_t errorIndication = Cy_BLE_GATTS_SendIndication(connHandle, &attibuteInfo);

                 if (errorIndication == CY_BLE_SUCCESS){

                 while(!indicationResponse)

                  {   Cy_BLE_ProcessEvents();

                       DBG_PRINTF("Waiting for Server indication response...\r\n");

                    }

                   DBG_PRINTF("Indication response received\r\n");

                  }

                else

                 DBG_PRINTF("Error with the notification 0x%04X\r\n" , errorIndication);

            }

             

            But the program got stock in the while loop...

            How should be the implemantation for the loop?

             

            To be honest, Ive never heard about the state-machine... what is it?

             

            Regards,

            David

            • 3. Re: Indication response from the client
              NazarP_56

              Hi David,

               

              Do you see CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF in your debug output?
              Do you have implemented a write request to store CCCD for your char? Also, you should use a pointer to connection handle structure as a first param to Cy_BLE_GATTS_SendIndication function.
              Please look attached file (it sends indications 10 times when you write CCCD to enable indication).

               

              Thanks,
              Nazar