Multiple Notifications after write to GATT DB/write handler question

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

cross mob
Anonymous
Not applicable

Hello everybody,

we're working on an iOS app that will transfer and receive data via Bluetooth LE over custom services and characteristics. These are implemented using SDK 2.2.0 on an BCM90276S module. This will transfer the data via PUART to a MCU.

If the app writes to a characteristic, the write handler is called and the received data is transferred to the MCU, this does work. If the MCU wants to communicate with the app, it writes data via PUART into the BLE module, which works, too.

This puts the received data into the GATT DB and sends a notification.

Now the app gets multiple notifications and is confused - as are we.

So I have two questions:

This is the code that sends the Notification after receiving it from the PUART:

BLEPROFILE_DB_PDU tempPDU;

bleprofile_ReadHandle(handle, &tempPDU); //read to tempPDU

memcpy(tempPDU.pdu, data, tempPDU.len); //memcpy new data to tempPDU

bleprofile_WriteHandle(handle, &tempPDU); //write new data to GATT DB

if (blecm_getAvailableTxBuffers() > 0) //check if TX buffer is not full

{

bleprofile_sendNotification(handle, data, length); //sent notification

}

Does bleprofile_WriteHandle automatically generate a notification if the characteristic has a LEGATTDB_CHAR_PROP_NOTIFY?

And does a bleprofile_WriteHandle issue a write_handle_callback?

I'm registering one, that will send the received characteristic via PUART:

legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);

Would a possible work around be the following:

legattdb_deRegWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);

bleprofile_WriteHandle(handle, &tempPDU);

legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)my_ble_write_handler);

Thanks for your help!

Best regards

Hannes Baumgart

0 Likes
1 Solution
Anonymous
Not applicable

Hi hantron,

Sorry for the late response,

bleprofile_WriteHandle does not automatically generate a notification, if you want to have a notification you have to call bleprofile_sendNotification which you are doing. 

bleprofile_WriteHandle does not issue a callback, there are no callbacks for internal write.  If you are seeing multiple notifications, what you can do is toggle a gpio or set up a counter to see how many times you are calling bleprofile_sendnotification from your line 7 above. 

Hope this helps,

Kevin

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Hi hantron,

Sorry for the late response,

bleprofile_WriteHandle does not automatically generate a notification, if you want to have a notification you have to call bleprofile_sendNotification which you are doing. 

bleprofile_WriteHandle does not issue a callback, there are no callbacks for internal write.  If you are seeing multiple notifications, what you can do is toggle a gpio or set up a counter to see how many times you are calling bleprofile_sendnotification from your line 7 above. 

Hope this helps,

Kevin

0 Likes
Anonymous
Not applicable

hantron any updates?

0 Likes