【DigiKey好物畅享】ST NUCLEO-WBA65RI 蓝牙创建-4

my_testserver.c

添加处理函数,并且初始化 GATT 服务

/* USER CODE BEGIN Service1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */
LOG_INFO_APP("-- GATT : LED CONFIGURATION RECEIVED\n");
notification.DataTransfered.Length = p_attribute_modified->Attr_Data_Length;
notification.DataTransfered.p_Payload = p_attribute_modified->Attr_Data;
/* USER CODE END Service1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */

/* USER CODE BEGIN BLECORE_EVT */
/* Manage ACI_GATT_INDICATION_VSEVT_CODE occurring on Android 12 */
case ACI_GATT_INDICATION_VSEVT_CODE:
  {
    aci_gatt_indication_event_rp0 *pr = (void*)p_blecore_evt->data;
    tBleStatus status = aci_gatt_confirm_indication(pr->Connection_Handle);
    if (status != BLE_STATUS_SUCCESS)
    {
      LOG_INFO_APP("  Fail   : aci_gatt_confirm_indication command, result: 0x%x \n", status);
    }
    else
    {
      LOG_INFO_APP("  Success: aci_gatt_confirm_indication command\n");
    }
  }
  break; /* end ACI_GATT_NOTIFICATION_VSEVT_CODE */

/* USER CODE END BLECORE_EVT */