From 42d50bffefd714860e9a7ab56fe589478f29bbdc Mon Sep 17 00:00:00 2001 From: zhanghaodong Date: Thu, 27 Jun 2024 20:13:46 +0800 Subject: [PATCH] fix:init gatt channelId and advId Signed-off-by: zhanghaodong --- .../bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c b/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c index d83ca0a52..97f13d59d 100644 --- a/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c +++ b/adapter/common/net/bluetooth/broadcast/adapter/ble/src/softbus_ble_gatt.c @@ -917,6 +917,12 @@ void SoftbusBleAdapterInit(void) int32_t ret = SoftBusAddBtStateListener(&g_softbusBcAdapterBtStateListener); DISC_CHECK_AND_RETURN_LOGE(ret >= 0, DISC_BLE_ADAPTER, "add bt state listener failed."); g_adapterBtStateListenerId = ret; + for (uint8_t channelId = 0; channelId < GATT_ADV_MAX_NUM; channelId++) { + g_advChannel[channelId].advId = -1; + } + for (uint8_t channelId = 0; channelId < GATT_SCAN_MAX_NUM; channelId++) { + g_scanChannel[channelId].scannerId = -1; + } } void SoftbusBleAdapterDeInit(void)