2024-11-07 02:20 AM
Hi,
i am playing with the code example BLE_p2pServer_ota with NUCLEO-WBA55 and i would like to change the BLE advertising intervall in the code (not with CubeMX).
For example, if I switch on the blue LED with using ST BLE Toolbox on the smartphone, the advertising interval should change to 100ms - 200ms after BLE disconnection. If I switch off the LED, the advertising interval should be reset to the default value after the BLE connection is disconnected.
My idea was to change paramA and ParamB in the file app_ble.c:
/* Call ACI APIs */
switch(ProcGapPeripheralId)
{
case PROC_GAP_PERIPH_ADVERTISE_START_FAST:
case PROC_GAP_PERIPH_ADVERTISE_START_LP:
case PROC_GAP_PERIPH_ADVERTISE_NON_CONN_START_FAST:
case PROC_GAP_PERIPH_ADVERTISE_NON_CONN_START_LP:
{
/* Start Advertising */
if (ledState == 1)
{
paramA = 0x64; // new min time (100ms)
paramB = 0xC8; // new max time (200ms)
}
else if (ledState == 0)
{
paramA = ADV_INTERVAL_MIN; // min time default value
paramB = ADV_INTERVAL_MAX; // max time default value
}
status = aci_gap_set_discoverable(paramD,
paramA,
paramB,
CFG_BD_ADDRESS_TYPE,
ADV_FILTER,
0, 0, 0, 0, 0, 0);
But when i disconnect, nothing has changed.
Solved! Go to Solution.
2024-11-07 03:00 AM
2024-11-07 03:00 AM
The code is working :)
There was an error with ledState variable.