Please find the example code attached with this response.
The example project notifies an uint8 value over the Alert Notification profile on a button press ( If you are using BLE pioneer kit , the button is p2.7).
Please let me know if you need any further modifications or you will be able to move forward with this example.
BLE_ANS_GYAN.cyprj.Archive01.zip 657.7 K
Thank you for your help. Now, I have few questions for you, if you don't mind helping me more.
First one being, how exactly can you check whether or not uint8 value was "notified" over the Alert Notification Profile? (from the CySmart Android App or Desktop App).
Second question, when I press the Switch button, nothing happens. Am I supposed to enable notification before doing any of these steps?
Also, I noticed that in your ANS CallBack function, you only used CYBLE_EVT_ANSS_CHAR_WRITE event. If it is not too much too ask, what exactly does it do? I know these much seems like basic questions, and I know they are all in the datasheet which I have read, but I am new to this and I keep confusing myself or overthinking some of these and I am trying to learn as much as I can now.
You have not used any other event in your BLE CallBack function as well except for the STACK_ON event.
1 of 1 people found this helpful
Yes, you have to enable the Notification in CySmart Desktop App/Mobile App.
On the Button press ,you will see the Notification data in the "New Alert" characteristics.
Also, this example just sends the Alert Notification and does not have other functionality included.
To be more specific , CYBLE_EVT_ANSS_CHAR_WRITE events triggers when the client device writes to the ANS server. Since , here we are not handling and write request from the client device , I just simply put it.
Also, STACK_ON event triggers after calling the CyBle_Start() function and on successful initialization of BLE stack. I am starting advertisement in this event.
You can refer the code examples from here - PSoC-4-BLE/100_Projects_in_100_Days at master · cypresssemiconductorco/PSoC-4-BLE · GitHub to become more familiar with BLE applications.
Thank you for your help.
I will look at the link.