cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 custom app event not call

Tthur.1
Associate II

Hi, in custom_app.c file, my event WRITE_NO_RESP_EVT is not call in the function Custom_STM_App_Notification. Where are the BLE notification in custom app ?

3 REPLIES 3
GFell.1
Associate II

Hi, I have got the same problem. WRITE_NO_RESP_EVT in custom_app.c is never called.

Did you find a solution for the problem?

Tthur.1
Associate II

Yes, i have modify the Custom_STM_Event_Handler function

static SVCCTL_EvtAckStatus_t Custom_STM_Event_Handler(void *Event)

{

 SVCCTL_EvtAckStatus_t return_value;

 hci_event_pckt *event_pckt;

 evt_blecore_aci *blecore_evt;

 aci_gatt_attribute_modified_event_rp0 *attribute_modified;

 aci_gatt_read_permit_req_event_rp0  *read_req;

 Custom_STM_App_Notification_evt_t   Notification;

 /* USER CODE BEGIN Custom_STM_Event_Handler_1 */

 /* USER CODE END Custom_STM_Event_Handler_1 */

 return_value = SVCCTL_EvtNotAck;

 event_pckt = (hci_event_pckt *)(((hci_uart_pckt*)Event)->data);

 switch(event_pckt->evt)

 {

  case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE:

   blecore_evt = (evt_blecore_aci*)event_pckt->data;

   switch(blecore_evt->ecode)

   {

    case ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE:

     /* USER CODE BEGIN EVT_BLUE_GATT_ATTRIBUTE_MODIFIED_BEGIN */

     /* USER CODE END EVT_BLUE_GATT_ATTRIBUTE_MODIFIED_BEGIN */

     attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data;

     if(attribute_modified->Attr_Handle == (CustomContext.CustomUart_TxHdle + CHARACTERISTIC_DESCRIPTOR_ATTRIBUTE_OFFSET))

     {

      return_value = SVCCTL_EvtAckFlowEnable;

      /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1 */

      /* USER CODE END CUSTOM_STM_Service_1_Char_1 */

      switch(attribute_modified->Attr_Data[0])

      {

       /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_attribute_modified */

       /* USER CODE END CUSTOM_STM_Service_1_Char_1_attribute_modified */

       /* Disabled Notification management */

       case (!(COMSVC_Notification)):

        /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_Disabled_BEGIN */

        /* USER CODE END CUSTOM_STM_Service_1_Char_1_Disabled_BEGIN */

        Notification.Custom_Evt_Opcode = CUSTOM_STM_UART_TX_NOTIFY_DISABLED_EVT;

        Custom_STM_App_Notification(&Notification);

        /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_Disabled_END */

        /* USER CODE END CUSTOM_STM_Service_1_Char_1_Disabled_END */

        break;

       /* Enabled Notification management */

       case COMSVC_Notification:

        /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_COMSVC_Notification_BEGIN */

        /* USER CODE END CUSTOM_STM_Service_1_Char_1_COMSVC_Notification_BEGIN */

        Notification.Custom_Evt_Opcode = CUSTOM_STM_UART_TX_NOTIFY_ENABLED_EVT;

        Custom_STM_App_Notification(&Notification);

        /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_COMSVC_Notification_END */

        /* USER CODE END CUSTOM_STM_Service_1_Char_1_COMSVC_Notification_END */

        break;

       default:

        /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_default */

        /* USER CODE END CUSTOM_STM_Service_1_Char_1_default */

       break;

      }

     } /* if(attribute_modified->Attr_Handle == (CustomContext.CustomUart_TxHdle + CHARACTERISTIC_DESCRIPTOR_ATTRIBUTE_OFFSET))*/

     else if(attribute_modified->Attr_Handle == (CustomContext.CustomUart_RxHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))

     {

      return_value = SVCCTL_EvtAckFlowEnable;

      /* USER CODE BEGIN CUSTOM_STM_Service_1_Char_2_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */

      Notification.Custom_Evt_Opcode = CUSTOM_STM_UART_RX_WRITE_NO_RESP_EVT;

      Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length;

      Notification.DataTransfered.pPayload=attribute_modified->Attr_Data;

      Custom_STM_App_Notification(&Notification);

      /* USER CODE END CUSTOM_STM_Service_1_Char_2_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */

     } /* if(attribute_modified->Attr_Handle == (CustomContext.CustomUart_RxHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))*/

     /* USER CODE BEGIN EVT_BLUE_GATT_ATTRIBUTE_MODIFIED_END */

     /* USER CODE END EVT_BLUE_GATT_ATTRIBUTE_MODIFIED_END */

     break;

    case ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE :

     /* USER CODE BEGIN EVT_BLUE_GATT_READ_PERMIT_REQ_BEGIN */

     /* USER CODE END EVT_BLUE_GATT_READ_PERMIT_REQ_BEGIN */

     read_req = (aci_gatt_read_permit_req_event_rp0*)blecore_evt->data;

     if(read_req->Attribute_Handle == (CustomContext.CustomBatHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))

     {

      return_value = SVCCTL_EvtAckFlowEnable;

      /*USER CODE BEGIN CUSTOM_STM_Service_2_Char_1_ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE_1 */

      /*USER CODE END CUSTOM_STM_Service_2_Char_1_ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE_1*/

      aci_gatt_allow_read(read_req->Connection_Handle);

      /*USER CODE BEGIN CUSTOM_STM_Service_2_Char_1_ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE_2 */

      /*USER CODE END CUSTOM_STM_Service_2_Char_1_ACI_GATT_READ_PERMIT_REQ_VSEVT_CODE_2*/

     } /* if(read_req->Attribute_Handle == (CustomContext.CustomBatHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))*/

     /* USER CODE BEGIN EVT_BLUE_GATT_READ_PERMIT_REQ_END */

     /* USER CODE END EVT_BLUE_GATT_READ_PERMIT_REQ_END */

     break;

    case ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE:

     /* USER CODE BEGIN EVT_BLUE_GATT_WRITE_PERMIT_REQ_BEGIN */

     /* USER CODE END EVT_BLUE_GATT_WRITE_PERMIT_REQ_BEGIN */

     /* USER CODE BEGIN EVT_BLUE_GATT_WRITE_PERMIT_REQ_END */

     /* USER CODE END EVT_BLUE_GATT_WRITE_PERMIT_REQ_END */

     break;

    /* USER CODE BEGIN BLECORE_EVT */

    /* USER CODE END BLECORE_EVT */

    default:

     /* USER CODE BEGIN EVT_DEFAULT */

     /* USER CODE END EVT_DEFAULT */

     break;

   }

   /* USER CODE BEGIN EVT_VENDOR*/

   /* USER CODE END EVT_VENDOR*/

   break; /* HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE */

   /* USER CODE BEGIN EVENT_PCKT_CASES*/

   /* USER CODE END EVENT_PCKT_CASES*/

  default:

   /* USER CODE BEGIN EVENT_PCKT*/

   /* USER CODE END EVENT_PCKT*/

   break;

 }

 /* USER CODE BEGIN Custom_STM_Event_Handler_2 */

 /* USER CODE END Custom_STM_Event_Handler_2 */

 return(return_value);

}/* end Custom_STM_Event_Handler */

GFell.1
Associate II

Thanks a lot, it works!