Edit - To be more specific, all I want is whenever android person send's a GAP device name characteristic for updating PSoC BLE's name I should know immediately rather than polling using CyBle_GapGetLocalName (which I am doing at this moment).
Anyone from Cypress ?
All I want is a an event that is generated on writing GAP's device name characteristic from iOS or anroid.
I assume you can handle the
CYBLE_EVT_GATTS_WRITE_REQevent in your custom event handler and see if the ATT handle to be written is the one of Device Name Characteristic. Take a look at the variable
CYBLE_GATTS_DB_T cyBle_gattDBdefined in the generated file
BLE_gatt.cand you will see generated ATT handles.
BLE_gatt.c, the ATT handle for Device Name is 0x0003 (the first Characteristic). I am not sure if this value is persistent during code generation (but maybe it is required by Bluetooth specification?), so you should instead search through
cyBle_gattDB(for example at the beginning of your program) to find an (the!) attribute with an UUID of
CYBLE_UUID_CHAR_DEVICE_NAME. Then you will have your ATT handle.
I was unable to find device name handle earlier. But now I can see it in BLE_gatt.c. This is what I was missing. Thanks a lot.
I will implement this tomorrow and post the results here.
I did not find that particular ATT handle defined in a generated
.hfile (like it is done in
BLE_custom.h), so I think the best solution will be to search through
cyBle_gattDBto find it, since one should not rely on hardcoded details inside the generated source files!
Yeah, I was also unable to find the handle. But now I can change device name. Thanks for your help.
Hi again! It look like the device name handle is
CYBLE_GAP_DEVICE_NAME_INDEX + 1; take a look in the implementations of