how to code CyBle_GattsNotification as blocking function?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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));

0 Likes
1 Solution
Anonymous
Not applicable

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.

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

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.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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..

0 Likes
Anonymous
Not applicable

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.

0 Likes