You are here

how to code CyBle_GattsNotification as blocking function? | Cypress Semiconductor

how to code CyBle_GattsNotification as blocking function?

Summary: 2 Replies, Latest post by pkakadiya_1540891 on 30 May 2016 01:31 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
kai1.huang_1512706's picture
27 posts

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?

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

roit's picture
Cypress Employee
221 posts

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.

pkakadiya_1540891's picture
6 posts

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

Log in to post new comments.