mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/fix_assert_pcl_bleprph_example_v5.0' into 'release/v5.0'
Nimble: Fix runtime assertion in bleprph due to two disconnect events (v5.0) See merge request espressif/esp-idf!22212
This commit is contained in:
@ -215,6 +215,39 @@ static void bleprph_power_control(uint16_t conn_handle)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if MYNEWT_VAL(BLE_POWER_CONTROL)
|
||||||
|
static int
|
||||||
|
bleprph_gap_power_event(struct ble_gap_event *event, void *arg)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch(event->type) {
|
||||||
|
case BLE_GAP_EVENT_TRANSMIT_POWER:
|
||||||
|
MODLOG_DFLT(INFO, "Transmit power event : status=%d conn_handle=%d reason=%d "
|
||||||
|
"phy=%d power_level=%x power_level_flag=%d delta=%d",
|
||||||
|
event->transmit_power.status,
|
||||||
|
event->transmit_power.conn_handle,
|
||||||
|
event->transmit_power.reason,
|
||||||
|
event->transmit_power.phy,
|
||||||
|
event->transmit_power.transmit_power_level,
|
||||||
|
event->transmit_power.transmit_power_level_flag,
|
||||||
|
event->transmit_power.delta);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case BLE_GAP_EVENT_PATHLOSS_THRESHOLD:
|
||||||
|
MODLOG_DFLT(INFO, "Pathloss threshold event : conn_handle=%d current path loss=%d "
|
||||||
|
"zone_entered =%d",
|
||||||
|
event->pathloss_threshold.conn_handle,
|
||||||
|
event->pathloss_threshold.current_path_loss,
|
||||||
|
event->pathloss_threshold.zone_entered);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nimble host executes this callback when a GAP event occurs. The
|
* The nimble host executes this callback when a GAP event occurs. The
|
||||||
* application associates a GAP event callback with each connection that forms.
|
* application associates a GAP event callback with each connection that forms.
|
||||||
@ -261,8 +294,8 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
#if MYNEWT_VAL(BLE_POWER_CONTROL)
|
#if MYNEWT_VAL(BLE_POWER_CONTROL)
|
||||||
bleprph_power_control(event->connect.conn_handle);
|
bleprph_power_control(event->connect.conn_handle);
|
||||||
|
|
||||||
ble_gap_event_listener_register(&power_control_event_listener,
|
ble_gap_event_listener_register(&power_control_event_listener,
|
||||||
bleprph_gap_event, NULL);
|
bleprph_gap_power_event, NULL);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -387,27 +420,6 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if MYNEWT_VAL(BLE_POWER_CONTROL)
|
|
||||||
case BLE_GAP_EVENT_TRANSMIT_POWER:
|
|
||||||
MODLOG_DFLT(INFO, "Transmit power event : status=%d conn_handle=%d reason=%d "
|
|
||||||
"phy=%d power_level=%x power_level_flag=%d delta=%d",
|
|
||||||
event->transmit_power.status,
|
|
||||||
event->transmit_power.conn_handle,
|
|
||||||
event->transmit_power.reason,
|
|
||||||
event->transmit_power.phy,
|
|
||||||
event->transmit_power.transmit_power_level,
|
|
||||||
event->transmit_power.transmit_power_level_flag,
|
|
||||||
event->transmit_power.delta);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case BLE_GAP_EVENT_PATHLOSS_THRESHOLD:
|
|
||||||
MODLOG_DFLT(INFO, "Pathloss threshold event : conn_handle=%d current path loss=%d "
|
|
||||||
"zone_entered =%d",
|
|
||||||
event->pathloss_threshold.conn_handle,
|
|
||||||
event->pathloss_threshold.current_path_loss,
|
|
||||||
event->pathloss_threshold.zone_entered);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user