Skip to main content
ledi001
Associate III
November 24, 2024
Solved

How to send a value to BLE client in the ble_p2pServer_ota example?

  • November 24, 2024
  • 1 reply
  • 1146 views

Hi,

i use the example ble_p2pServer_ota with STM32WBA55. How can i send a value (uint_8 or a string) from the server (NUCLEO-WBA55) to the client (Cell Phone)?

Here in the example code (file p2p_server_app.c), the value of Switch_c_NOTIFICATION_ON for example is 1, but this is an enum and is used as a flag. I want to send an uint_8 or string value from a Sensor. How can i do this?

case P2P_SERVER_SWITCH_C_NOTIFY_ENABLED_EVT:
 /* USER CODE BEGIN Service1Char2_NOTIFY_ENABLED_EVT */
 P2P_SERVER_APP_Context.Switch_c_Notification_Status = Switch_c_NOTIFICATION_ON;	// send the value 1
 LOG_INFO_APP("-- P2P APPLICATION SERVER : NOTIFICATION ENABLED\n"); 
 LOG_INFO_APP(" \n\r");
 /* USER CODE END Service1Char2_NOTIFY_ENABLED_EVT */
 break;

 case P2P_SERVER_SWITCH_C_NOTIFY_DISABLED_EVT:
 /* USER CODE BEGIN Service1Char2_NOTIFY_DISABLED_EVT */
 P2P_SERVER_APP_Context.Switch_c_Notification_Status = Switch_c_NOTIFICATION_OFF;	// send the value 0
 LOG_INFO_APP("-- P2P APPLICATION SERVER : NOTIFICATION DISABLED\n"); 
 LOG_INFO_APP(" \n\r");
 /* USER CODE END Service1Char2_NOTIFY_DISABLED_EVT */
 break;
Best answer by STTwo-32

Hello @ledi001 

To understand how to use the P2P server APPs to send data, you can use this wiki as a reference.

You can always have a look at our application notes and Wiki pages before asking your questions. You may easier find the solution for your questions without even needing to ask.

Best Regards.

STTwo-32

1 reply

STTwo-32
STTwo-32Best answer
Technical Moderator
December 18, 2024

Hello @ledi001 

To understand how to use the P2P server APPs to send data, you can use this wiki as a reference.

You can always have a look at our application notes and Wiki pages before asking your questions. You may easier find the solution for your questions without even needing to ask.

Best Regards.

STTwo-32