I should add that the declaration
char deviceName = "12345678";
is done before the switch(event) case structure, I just copy-pasted it into the CYBLE_EVT_STACK_ON case to avoid adding a large block of code.
Adding that declaration before the switch case structure solves your issue?
No, I am just making the clarification because the code does not actually compile when the declaration is inside the case structure. The issue is separate from that and is still present.
1 of 1 people found this helpful
From your attached code, you have just changed the device name and advdata length, the other data remains untouched, right?
One possible reason is regarding to mobile app you are using, which remains the old name even though it's changed. You can try to switch to another app, e.g. CySmart, to check whether this issue is still there.
If it is not effective, you can try to put the the code snippet from under swtich case to main loop with judging some boundary conditions, like -
- Whether BLE stack is on;
- Whether current state of advertisement is stopped;
- Whether the current BLE connection number is 0.
Of course, the most intuitive way is to enter debug mode and observe whether the adv data is changed or not before advertising start.
I did what you suggested and checked the data using debug mode. It was what I expected. I then messed around with the BLE settings and had no luck. Eventually I tried to change the Local name display mode to Shortened and I can now see my changes to the local name when I connect to the device. For some reason the device name in the scan list (prior to connnection) is still the same name that one sets in the "Profiles" setting tab.
Since I was able to verify remotely that the data changes I am all set for now. Thank you!