You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

159 lines
4.4 KiB

/* USER CODE BEGIN Header */
/**
******************************************************************************
* File Name : App/p2p_server_app.c
* Description : P2P Server Application
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "app_common.h"
#include "dbg_trace.h"
#include "ble.h"
#include "p2p_server_app.h"
#include "stm32_seq.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private defines ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macros -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
static void P2PS_Send_Notification(void);
/* USER CODE END PFP */
/* Functions Definition ------------------------------------------------------*/
void P2PS_STM_App_Notification(P2PS_STM_App_Notification_evt_t *pNotification)
{
/* USER CODE BEGIN P2PS_STM_App_Notification_1 */
/* USER CODE END P2PS_STM_App_Notification_1 */
switch(pNotification->P2P_Evt_Opcode)
{
/* USER CODE BEGIN P2PS_STM_App_Notification_P2P_Evt_Opcode */
/* USER CODE END P2PS_STM_App_Notification_P2P_Evt_Opcode */
case P2PS_STM__NOTIFY_ENABLED_EVT:
/* USER CODE BEGIN P2PS_STM__NOTIFY_ENABLED_EVT */
/* USER CODE END P2PS_STM__NOTIFY_ENABLED_EVT */
break;
case P2PS_STM_NOTIFY_DISABLED_EVT:
/* USER CODE BEGIN P2PS_STM_NOTIFY_DISABLED_EVT */
/* USER CODE END P2PS_STM_NOTIFY_DISABLED_EVT */
break;
case P2PS_STM_WRITE_EVT:
/* USER CODE BEGIN P2PS_STM_WRITE_EVT */
/* USER CODE END P2PS_STM_WRITE_EVT */
break;
default:
/* USER CODE BEGIN P2PS_STM_App_Notification_default */
/* USER CODE END P2PS_STM_App_Notification_default */
break;
}
/* USER CODE BEGIN P2PS_STM_App_Notification_2 */
/* USER CODE END P2PS_STM_App_Notification_2 */
return;
}
void P2PS_APP_Notification(P2PS_APP_ConnHandle_Not_evt_t *pNotification)
{
/* USER CODE BEGIN P2PS_APP_Notification_1 */
/* USER CODE END P2PS_APP_Notification_1 */
switch(pNotification->P2P_Evt_Opcode)
{
/* USER CODE BEGIN P2PS_APP_Notification_P2P_Evt_Opcode */
/* USER CODE END P2PS_APP_Notification_P2P_Evt_Opcode */
case PEER_CONN_HANDLE_EVT :
/* USER CODE BEGIN PEER_CONN_HANDLE_EVT */
/* USER CODE END PEER_CONN_HANDLE_EVT */
break;
case PEER_DISCON_HANDLE_EVT :
/* USER CODE BEGIN PEER_DISCON_HANDLE_EVT */
/* USER CODE END PEER_DISCON_HANDLE_EVT */
break;
default:
/* USER CODE BEGIN P2PS_APP_Notification_default */
/* USER CODE END P2PS_APP_Notification_default */
break;
}
/* USER CODE BEGIN P2PS_APP_Notification_2 */
/* USER CODE END P2PS_APP_Notification_2 */
return;
}
void P2PS_APP_Init(void)
{
/* USER CODE BEGIN P2PS_APP_Init */
UTIL_SEQ_RegTask(CFG_TASK_SW1_BUTTON_PUSHED_ID, UTIL_SEQ_DEFAULT, P2PS_Send_Notification);
/* USER CODE END P2PS_APP_Init */
return;
}
/* USER CODE BEGIN FD */
static void P2PS_Send_Notification(void) {
P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, 0x00);
return;
}
/* USER CODE END FD */
/*************************************************************
*
* LOCAL FUNCTIONS
*
*************************************************************/
/* USER CODE BEGIN FD_LOCAL_FUNCTIONS*/
/* USER CODE END FD_LOCAL_FUNCTIONS*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/