4 Replies Latest reply on Jun 14, 2018 9:37 AM by abdoulgoita_3381461

    Alert Notification Service

    abdoulgoita_3381461

      Hi,

       

      I would first like to state that I am a beginner first (in programming, and microcontroller in general, only dealt with Arduino).

      I am trying to use the Alert Notification Service (ANS) to send a Simple Text Alert (showing text, "Alert Received" or any other text) to my Android phone. However, I have looked around and couldn't find an example that does such a thing. I'm using the PSoC BLE as a GATT Server and GAP Peripheral, and my Android phone with the CySmart installed and my GATT Client and GAP Central.

      Can anyone point me to the right direction?

       

      Thanks

        • 1. Re: Alert Notification Service
          Gyan Chand

          Hi,

           

              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.

           

          -Gyan

          1 of 1 people found this helpful
          • 2. Re: Alert Notification Service
            abdoulgoita_3381461

            Hi,

             

            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.

            • 3. Re: Alert Notification Service
              Gyan Chand

              Hello,

               

                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.

               

              -Gyan

               

               

               

               

              1 of 1 people found this helpful
              • 4. Re: Alert Notification Service
                abdoulgoita_3381461

                Thank you for your help.

                 

                I will look at the link.