I spoke to the developers about this issue today and they confirmed that when you perform a GATT discovery, this will tell you which handle applies to which UUID (both values are passed, you cannot know the handle without the UUID).
To setup notifications, you need to know the handle
does it means that we need to pass the right handle (change wiced_sense_connection_handle) to this function to enable notification on specific UUID (on top of the GATT databasse declaration) ?
blecm_connectionEventNotifiationEnable((void (*)(void*, UINT32))wiced_sense_tx_opportunity_notice, 0, 6250/625, 30000/625, wiced_sense_connection_handle);
sorry but i'm a bit lost and i didn't find a correct / clean way to call a specific function to fill the right BLE packet content for a specific UUID.
i have basically 3 UUID :
- WICED sense service (the one you created) : no problem
- UUID A : new service
- characteristic first_char
- characteristic second_char
first_char & second_char are read only, and notification enable. The packet content is different.
I agree that it is a bit confusing. The blecm_connectionEventNotifiationEnable function does not actually send or enable GATT notifications. The function allows your application to register a callback to be called a few millisecond before something can be send up to the client. The handle in the blecm_con... function is not the attribute handle (which is related to UUID), but it is a connection handle identifying connection if you are connected to multiple devices.
When your callback (for example wiced_sense_tx_opportunity_notice) is called, your application can send one or several GATT Notification. When you are sending notifications you will need to use correct attribute handle in the bleprofile_sendnotification call.
Please note that you do not need precise timing, you do not need to use blecm_con.. function at all. Please see hello_sensor sample which sends notification without all these headaches.
1 of 1 people found this helpful
that's ok. thank you for clarification.
i reviewed my code, and now i'm able to enbale/disable notification and received good datas.
thanks for the clarification !