cancel
Showing results for 
Search instead for 
Did you mean: 

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

ledi001
Senior

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;
1 REPLY 1
STTwo-32
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.