Merge branch 'example/light_wifi_prov_ble_refresh' into 'main'

example: Fix ble advertisement refresh after ble disconnection for light_wifi_prov example

See merge request app-frameworks/esp-matter!926
This commit is contained in:
Shu Chen
2024-11-05 12:23:25 +08:00
3 changed files with 11 additions and 0 deletions
@@ -186,6 +186,8 @@ public:
mSecondaryBleSmSc = bleSmSc;
}
void RefreshAdv(void);
private:
chip::Optional<chip::ByteSpan> mScanResponse;
@@ -1365,6 +1365,14 @@ CHIP_ERROR BLEManagerImpl::HandleGAPConnect(struct ble_gap_event * gapEvent)
#endif
}
void BLEManagerImpl::RefreshAdv(void)
{
mFlags.Set(Flags::kAdvertisingRefreshNeeded);
mFlags.Clear(Flags::kAdvertisingConfigured);
PlatformMgr().ScheduleWork(DriveBLEState, 0);
}
CHIP_ERROR BLEManagerImpl::HandleGAPDisconnect(struct ble_gap_event * gapEvent)
{
ChipLogProgress(DeviceLayer, "BLE GAP connection terminated (con %u reason 0x%02x)", gapEvent->disconnect.conn.conn_handle,
@@ -402,6 +402,7 @@ static int protocomm_matter_ble_gap_event(struct ble_gap_event *event, void *arg
break;
case BLE_GAP_EVENT_DISCONNECT:
transport_matter_ble_disconnect(event, arg);
chip::DeviceLayer::Internal::BLEMgrImpl().RefreshAdv();
break;
case BLE_GAP_EVENT_MTU:
transport_matter_ble_set_mtu(event, arg);