mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Nimble: Fix runtime assertion in bleprph due to two disconnect events
This commit is contained in:
parent
2c794ea9c4
commit
4a2eb28d14
@ -212,6 +212,40 @@ static void bleprph_power_control(uint16_t conn_handle)
|
||||
}
|
||||
#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
|
||||
* application associates a GAP event callback with each connection that forms.
|
||||
@ -259,7 +293,7 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
||||
bleprph_power_control(event->connect.conn_handle);
|
||||
|
||||
ble_gap_event_listener_register(&power_control_event_listener,
|
||||
bleprph_gap_event, NULL);
|
||||
bleprph_gap_power_event, NULL);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@ -384,27 +418,6 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
||||
}
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user