Skip to content

Commit

Permalink
Merge branch 'example/light_wifi_prov_ble_refresh' into 'main'
Browse files Browse the repository at this point in the history
example: Fix ble advertisement refresh after ble disconnection for light_wifi_prov example

See merge request app-frameworks/esp-matter!926
  • Loading branch information
chshu committed Nov 5, 2024
2 parents f72d175 + 70906ab commit a5db105
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class BLEManagerImpl final : public BLEManager,
mSecondaryBleSmSc = bleSmSc;
}

void RefreshAdv(void);

private:
chip::Optional<chip::ByteSpan> mScanResponse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a5db105

Please sign in to comment.