cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of the constants generated by CubeMX - STM32WB55 for BLE

Starmaxou
Associate II

Hello,

I am trying to use the STM32WB55 Nucleo Pack to develop a BLE application.

Does anyone know what these constants represent ?

/**
 * There is one handler per service enabled
 * Note: There is no handler for the Device Information Service
 *
 * This shall take into account all registered handlers
 * (from either the provided services or the custom services)
 */
#define BLE_CFG_SVC_MAX_NBR_CB    7
 
#define BLE_CFG_CLT_MAX_NBR_CB    1

This code is extracted from the client project but it is the same in the server project.

Thank you for your reply!

1 REPLY 1
Remi QUINTIN
ST Employee

These 2 constants are initialized by the BLE controller:

Regarding BLE_CFG_SVC_MAX_NBR_CB : 

This API registers a handler to be called when a GATT user event is received from the BLE core device. When

/*        a Service is created, it shall register a callback to be notified when a GATT event is received from the

  *        BLE core device. When a GATT event is received, it shall be checked in the handler if the GATT events belongs

  *        to the Service or not. The handler shall return the correct status depending on the result. As soon as one

  *        Service handler registered acknowledges positively the GATT event, the ble_controller stops calling the

  *        registered Service handlers. */

 void SVCCTL_RegisterSvcHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Service_Event_Handler )

{

#if (BLE_CFG_SVC_MAX_NBR_CB > 0)

 SVCCTL_EvtHandler.SVCCTL__SvcHandlerTab[SVCCTL_EvtHandler.NbreOfRegisteredHandler] = pfBLE_SVC_Service_Event_Handler;

 SVCCTL_EvtHandler.NbreOfRegisteredHandler++;

#else

 (void)(pfBLE_SVC_Service_Event_Handler);

#endif

Then the handler is registered during the initialization of the service.

/**

*       Register the event handler to the BLE controller

*/

SVCCTL_RegisterSvcHandler(PeerToPeer_Event_Handler);

It is the same for BLE_CFG_CLT_MAX_NBR_CB 

SVCCTL_RegisterCltHandler() is used for clients

SVCCTL_RegisterSvcHandler() is used for services.