3 Replies Latest reply on Dec 28, 2015 11:20 PM by rohitk_

    how to code  CyBle_GattsNotification as blocking function?

      I need send big array through CyBle_GattsNotification. I want to know when the big array sent over?

         

      do you have blocking version of CyBle_GattsNotification function?

         

      In the following code, it can be realize blocking sending data?

         

        do
       {
        apiResult = CyBle_GattsNotification(cyBle_connHandle,&notificationPacket);
         
           CyBle_ProcessEvents();
        
          }while((CYBLE_ERROR_OK != apiResult)  && (CYBLE_STATE_CONNECTED == cyBle_state));

        • 1. Re: how to code  CyBle_GattsNotification as blocking function?

          Normally, you assign the array that needs to be sent using CyBle_GattsNotification and the BLE Stack takes care of sending the data, unless you receive as CYBLE_ERROR_MEMORY_ALLOCATION_FAILED as API return, which means memory allocation failed.

             

          From your requirement, it seems what you want is to ensure that your complete block of data has reached the client. In this case, you may use CyBle_GattsIndication (after enabling Indication property in the BLE component) and wait for response from the client side, which will ensure that the data has been sent.

          • 2. Re: how to code  CyBle_GattsNotification as blocking function?

            Hi Roit,

               

            currently I am working on this CyBle_GattsIndication function, I have tested on peripheral side and it works well when I am communicating with BLE dongle. Now I am trying to write code to receive data on central role. But somehow i can receive Indication event only one times and also not getting confirmation value. Can you please give me some suggestions to handle indication event?

               

            Thank you in advance..

            • 3. Re: how to code  CyBle_GattsNotification as blocking function?

              I'm not sure about why you are only getting the indication one time, but in order to receive the confirmation from the Client, then you need to call the cyble_gattconfirmation(<pointer to connection handle>) when you want to send the confirmation packet back to the peripheral device after receiving the indication event.