- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At present I know that we can use CyBle_GapGetLocalName to read BLE device's changed name and then using CyBle_GapSetLocalName and saving that local name in FLASH memory can change my device namme. Even after reset device name retains if we call CyBle_GapSetLocalName with saved device name from FLASH. Its clear that I am reading device name by polling, If device name is changed I will get in CyBle_GapGetLocalName otw not.
Is there any kind of event that is generated on PSoC BLE device , if I change my BLE device name from my android side using GAP's device name characteristic.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you can handle the CYBLE_EVT_GATTS_WRITE_REQ
event 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_gattDB[]
defined in the generated file BLE_gatt.c
and you will see generated ATT handles.
In my 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anyone from Cypress ?
All I want is a an event that is generated on writing GAP's device name characteristic from iOS or anroid.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you can handle the CYBLE_EVT_GATTS_WRITE_REQ
event 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_gattDB[]
defined in the generated file BLE_gatt.c
and you will see generated ATT handles.
In my 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did not find that particular ATT handle defined in a generated .h
file (like it is done in BLE_custom.h
), so I think the best solution will be to search through cyBle_gattDB
to find it, since one should not rely on hardcoded details inside the generated source files!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, I was also unable to find the handle. But now I can change device name. Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again! It look like the device name handle is CYBLE_GAP_DEVICE_NAME_INDEX + 1
; take a look in the implementations of CyBle_GapSetLocalName()
/CyBle_GapGetLocalName()
🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also trying to save but no success
please let know how your able to set the device name by giving piece of code for the same.