cancel
Showing results for 
Search instead for 
Did you mean: 

BLE_p2pServer example with STM32WBA55 - How can i forward a payload tu UART?

ledi001
Associate III

Hi,

I use the BLE_p2pServer example as a basis and would like to forward the transmitted data directly to the UART1 interface. My idea would be to use here (in p2p_server_app.c) a HAL_UART_Transmit_DMA() function, but I fail to access the data due to an incorrect type conversion.

 

case P2P_SERVER_LED_C_WRITE_NO_RESP_EVT:
      /* USER CODE BEGIN Service1Char1_WRITE_NO_RESP_EVT */
      if(p_Notification->DataTransfered.p_Payload[1] == 0x01)
      {
    	// HAL_UART_Transmit_DMA(huart, pData, Size); ... here i want to insert the UART transmission funkction
        BSP_LED_On(LED_BLUE);
        LOG_INFO_APP("-- P2P APPLICATION SERVER : LED1 ON\n"); 
        P2P_SERVER_APP_Context.LedControl.Led1 = 0x01; /* LED1 ON */
      }
      if(p_Notification->DataTransfered.p_Payload[1] == 0x00)
      {
        BSP_LED_Off(LED_BLUE);
        LOG_INFO_APP("-- P2P APPLICATION SERVER : LED1 OFF\n"); 
        P2P_SERVER_APP_Context.LedControl.Led1 = 0x00; /* LED1 OFF */
      }
      /* USER CODE END Service1Char1_WRITE_NO_RESP_EVT */
      break;

 

In p2p_server.h are the typedef structures as follows:

 

typedef struct
{
  uint8_t *p_Payload;
  uint8_t Length;
} P2P_SERVER_Data_t;

typedef struct
{
  P2P_SERVER_OpcodeEvt_t       EvtOpcode;
  P2P_SERVER_Data_t             DataTransfered;
  uint16_t                ConnectionHandle;
  uint16_t                AttributeHandle;
  uint8_t                 ServiceInstance;
} P2P_SERVER_NotificationEvt_t;

 

Can someone tell me how I can access the data correctly?

0 REPLIES 0