4 Replies Latest reply on Apr 11, 2019 9:41 AM by MiRo_263836

    PSOC6 BLE - Sending data to app - Notifications not enabled

    MiRo_263836

      I used CE218137 - BLE Proximity as an example of sending data to an app.  I am connect and start Nofity and I get data.

       

      I have tried this in my own project and after I set the Notify on the App, I get to the write request but when I check if Notifications are enabled, it says no.  I have the notify box checked in the characteristics of the service. This drops through to Notifications not enabled.

       

                             /* Check if the ADC service notifications are enabled */

                          adcNotificationEnabled = Cy_BLE_GATTS_IsNotificationEnabled(

                                      &connectionHandle,

                                      CY_BLE_ADC_DATA_ADC_CHARACTERISTIC_CHAR_HANDLE);

                         

                      if ( adcNotificationEnabled)

                      {

                          SendBleNotification(CY_BLE_ADC_DATA_ADC_CHARACTERISTIC_CHAR_HANDLE, &ADC_data);

                          ADC_data++;

                           printf("'Send Notificatons value: %d \r\n", sendNotifications);

                      }

                      else

                      {

                          printf("'Notifications not enabled");

                      }   

       

      When and where does the Notifications Enabled get set?  Shouldn't it be set when I start Nofity in the CySmart app?

       

      Thanks,

      Mike Roberts

        • 1. Re: PSOC6 BLE - Sending data to app - Notifications not enabled
          DheerajK_81

          If you have defined a characteristic with notify option checked, the characteristic will have the provision for notifications.  But it will be set whenever you click notify in the Cysmart app. Please share your project and android source code so that we can have a look at what's going wrong.

           

          Regards,
          Dheeraj

          • 2. Re: PSOC6 BLE - Sending data to app - Notifications not enabled
            VaisakhK_66

            Hi Mike,

             

            When you enable the notification from the Client App, you will get a GATT Server write request event (CY_BLE_EVT_GATTS_WRITE_REQ).

            Upon receiving this event, you need to update the local GATT DB using the Cy_BLE_GATTS_WriteAttributeValuePeer().

             

            For example,

             

            case CY_BLE_EVT_GATTS_WRITE_REQ:
            /* Read the write request parameter */
                    writeReqParameter = (cy_stc_ble_gatts_write_cmd_req_param_t*)eventParam;
            
            
                Cy_BLE_GATTS_WriteAttributeValuePeer(&connectionHandle,&writeRequest->handleValPair);
            
            
                /* Send the response to the write request received */
                bleApiResult = Cy_BLE_GATTS_WriteRsp(connectionHandle);
            
            
            adcNotificationEnabled = Cy_BLE_GATTS_IsNotificationEnabled(&connectionHandle, CY_BLE_ADC_DATA_ADC_CHARACTERISTIC_CHAR_HANDLE);
            
            
            if ( adcNotificationEnabled)
            {
                        SendBleNotification(CY_BLE_ADC_DATA_ADC_CHARACTERISTIC_CHAR_HANDLE, &ADC_data);
                        ADC_data++;
                        printf("'Send Notificatons value: %d \r\n", sendNotifications);
            }
            else
            {
            printf("'Notifications not enabled");
            }
            break;
            

             

            Let me know if this helps.

             

            Thanks,

            Vaisakh

            • 3. Re: PSOC6 BLE - Sending data to app - Notifications not enabled
              MiRo_263836

              I think that is it.  I noticed that in the Proximity example and I didn’t do that in my project. I will try it and let you know.

              • 4. Re: PSOC6 BLE - Sending data to app - Notifications not enabled
                MiRo_263836

                I finally got back on this project. That didn't work but I think that it is the right track.  I am going copy the exact way that the prox example does it and let you know.