From a494b1c396d1c97d912ccdc707774c4cc27a6125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:32:38 +0200 Subject: [PATCH] [ble] Remove CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED (#21582) * [zephyr] Remove usage of IsFullyProvisioned() in BLE manager If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is set, which turns out to be true on Zephyr, NXP and, conditionally, ESP32 platforms, the BLE manager will not start BLE advertising if IsFullyProvisioned() method of the ConnectivityManager class returns true. The problem is that the method seems obsolete and the proper logic is already in place in Server.cpp, so we should align the platforms and remove the legacy code. Signed-off-by: Damian Krolik * Remove CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED Remove CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED and the associated code from platforms that never set it. Signed-off-by: Damian Krolik * Remove CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED from K32 Signed-off-by: Damian Krolik * Restyled by clang-format * Remove CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED from ESP32 Co-authored-by: Restyled.io --- config/esp32/components/chip/Kconfig | 8 ----- config/zephyr/Kconfig | 6 ---- src/include/platform/CHIPDeviceConfig.h | 10 ------- src/platform/Ameba/BLEManagerImpl.cpp | 19 ------------ src/platform/CYW30739/BLEManagerImpl.cpp | 21 -------------- src/platform/ESP32/CHIPDevicePlatformConfig.h | 1 - .../ESP32/bluedroid/BLEManagerImpl.cpp | 21 -------------- src/platform/ESP32/nimble/BLEManagerImpl.cpp | 21 -------------- src/platform/Linux/BLEManagerImpl.cpp | 21 -------------- src/platform/P6/BLEManagerImpl.cpp | 21 -------------- src/platform/Zephyr/BLEManagerImpl.cpp | 29 ------------------- .../Zephyr/CHIPDevicePlatformConfig.h | 2 -- .../bouffalolab/BL602/BLEManagerImpl.cpp | 21 -------------- src/platform/mbed/BLEManagerImpl.cpp | 10 ------- .../nrfconnect/CHIPDevicePlatformConfig.h | 2 -- .../nxp/k32w/k32w0/BLEManagerImpl.cpp | 17 ----------- .../nxp/k32w/k32w0/CHIPDevicePlatformConfig.h | 2 -- src/platform/qpg/BLEManagerImpl.cpp | 21 -------------- .../telink/CHIPDevicePlatformConfig.h | 2 -- src/platform/webos/BLEManagerImpl.cpp | 21 -------------- 20 files changed, 276 deletions(-) diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index af902c28af2019..587b694de9d51f 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -502,14 +502,6 @@ menu "CHIP Device Layer" When set, WoBLE advertisements will stop while a WoBLE connection is active. - config CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - bool "Disable Advertising when Provisioned" - default n - depends on ENABLE_CHIPOBLE - help - Automatically disable CHIP-over-BLE (WoBLE) advertising when the device transitions - to a fully provisioned state. - config DEINIT_BLE_ON_COMMISSIONING_COMPLETE bool "Disable and DeInit BLE on commissioning complete" default y diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index b17cb0780a4bec..fd779c62e319f3 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -104,12 +104,6 @@ config CHIP_BUILD_TESTS help This option enables building CHIP unit tests. -config CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED - bool "Disable CHIPoBLE advertising when device is fully provisioned" - default y - help - Disable CHIPoBLE advertising when the device achieves a fully provisioned state. - config CHIP_ENABLE_PAIRING_AUTOSTART bool "Enable pairing autostart" default n diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index f59f53df8048ab..e960c681596905 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -457,16 +457,6 @@ #define CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION 1 #endif -/** - * CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - * - * Automatically disable CHIPoBLE advertising when the device transitions to a fully - * provisioned state. - */ -#ifndef CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED 0 -#endif - /** * CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART * diff --git a/src/platform/Ameba/BLEManagerImpl.cpp b/src/platform/Ameba/BLEManagerImpl.cpp index 6987063539e708..550be5f78352ad 100644 --- a/src/platform/Ameba/BLEManagerImpl.cpp +++ b/src/platform/Ameba/BLEManagerImpl.cpp @@ -485,15 +485,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kServiceProvisioningChange: case DeviceEventType::kWiFiConnectivityChange: -// If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, when there is a change to the device's provisioning state and device -// is now fully provisioned, the CHIPoBLE advertising will be disabled. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED ChipLogProgress(DeviceLayer, "Updating advertising data"); mFlags.Clear(Flags::kAdvertisingConfigured); mFlags.Set(Flags::kRestartAdvertising); @@ -731,16 +722,6 @@ void BLEManagerImpl::DriveBLEState(void) // Check if BLE stack is initialized VerifyOrExit(mFlags.Has(Flags::kAMEBABLEStackInitialized), /* */); -// If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled and the device is fully provisioned, the CHIPoBLE -// advertising will be disabled. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Start advertising if needed... if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled)) { diff --git a/src/platform/CYW30739/BLEManagerImpl.cpp b/src/platform/CYW30739/BLEManagerImpl.cpp index 290461bfc89aa6..57734f4e0ec2ac 100644 --- a/src/platform/CYW30739/BLEManagerImpl.cpp +++ b/src/platform/CYW30739/BLEManagerImpl.cpp @@ -226,17 +226,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - ClearFlag(mFlags, kFlag_AdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising state to be refreshed to reflect new provisioning state. mFlags.Set(Flags::kFlag_AdvertisingRefreshNeeded, true); @@ -347,16 +336,6 @@ void BLEManagerImpl::DriveBLEState(void) if (!mFlags.Has(Flags::kFlag_AsyncInitCompleted)) { mFlags.Set(Flags::kFlag_AsyncInitCompleted, true); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - ClearFlag(mFlags, kFlag_AdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... diff --git a/src/platform/ESP32/CHIPDevicePlatformConfig.h b/src/platform/ESP32/CHIPDevicePlatformConfig.h index 96368be8a18bbf..7fb89b27adec60 100644 --- a/src/platform/ESP32/CHIPDevicePlatformConfig.h +++ b/src/platform/ESP32/CHIPDevicePlatformConfig.h @@ -77,7 +77,6 @@ #define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN #define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX #define CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION CONFIG_CHIPOBLE_SINGLE_CONNECTION -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC #define CHIP_DEVICE_CONFIG_CHIP_TIME_SERVICE_ENDPOINT_ID CONFIG_CHIP_TIME_SERVICE_ENDPOINT_ID #define CHIP_DEVICE_CONFIG_DEFAULT_TIME_SYNC_INTERVAL CONFIG_DEFAULT_TIME_SYNC_INTERVAL diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index fdec550c48de76..12ad3e8e2d928c 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -271,17 +271,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kServiceProvisioningChange: case DeviceEventType::kWiFiConnectivityChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising configuration to be refreshed to reflect new provisioning state. ChipLogProgress(DeviceLayer, "Updating advertising data"); mFlags.Clear(Flags::kAdvertisingConfigured); @@ -416,16 +405,6 @@ void BLEManagerImpl::DriveBLEState(void) if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If there's already a control operation in progress, wait until it completes. diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index 29dd2e7bd7d3de..2cf626c1751c50 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -284,17 +284,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kServiceProvisioningChange: case DeviceEventType::kWiFiConnectivityChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising configuration to be refreshed to reflect new provisioning state. ChipLogProgress(DeviceLayer, "Updating advertising data"); mFlags.Clear(Flags::kAdvertisingConfigured); @@ -440,16 +429,6 @@ void BLEManagerImpl::DriveBLEState(void) if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // Initializes the ESP BLE layer if needed. diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index cec9dabefebcba..426f6ca0b01f8d 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -233,17 +233,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason); break; case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising configuration to be refreshed to reflect new provisioning state. mFlags.Clear(Flags::kAdvertisingConfigured); @@ -563,16 +552,6 @@ void BLEManagerImpl::DriveBLEState() if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED ExitNow(); } diff --git a/src/platform/P6/BLEManagerImpl.cpp b/src/platform/P6/BLEManagerImpl.cpp index e2ccd9bc48dce0..01e27cb49f9c40 100644 --- a/src/platform/P6/BLEManagerImpl.cpp +++ b/src/platform/P6/BLEManagerImpl.cpp @@ -266,17 +266,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - ClearFlag(mFlags, kFlag_AdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising state to be refreshed to reflect new provisioning state. mFlags.Set(Flags::kFlag_AdvertisingRefreshNeeded, true); @@ -401,16 +390,6 @@ void BLEManagerImpl::DriveBLEState(void) if (!mFlags.Has(Flags::kFlag_AsyncInitCompleted)) { mFlags.Set(Flags::kFlag_AsyncInitCompleted, true); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - ClearFlag(mFlags, kFlag_AdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 8aa322afcfb16c..6039d2ae011c11 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -175,16 +175,6 @@ void BLEManagerImpl::DriveBLEState() if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... @@ -606,25 +596,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) err = HandleTXCharComplete(event); break; - case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - - // Force the advertising state to be refreshed to reflect new provisioning state. - mFlags.Set(Flags::kAdvertisingRefreshNeeded); - - DriveBLEState(); - - break; - default: break; } diff --git a/src/platform/Zephyr/CHIPDevicePlatformConfig.h b/src/platform/Zephyr/CHIPDevicePlatformConfig.h index 6916dea46d5795..d66d95a2bdd868 100644 --- a/src/platform/Zephyr/CHIPDevicePlatformConfig.h +++ b/src/platform/Zephyr/CHIPDevicePlatformConfig.h @@ -95,8 +95,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 #define CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH 0 -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED CONFIG_CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED - #define CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART 0 #ifndef CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART diff --git a/src/platform/bouffalolab/BL602/BLEManagerImpl.cpp b/src/platform/bouffalolab/BL602/BLEManagerImpl.cpp index 2ac59f4320f1dc..7d2bd2ad6e869f 100644 --- a/src/platform/bouffalolab/BL602/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/BLEManagerImpl.cpp @@ -206,16 +206,6 @@ void BLEManagerImpl::DriveBLEState() if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... @@ -582,17 +572,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising state to be refreshed to reflect new provisioning state. mFlags.Set(Flags::kAdvertisingRefreshNeeded); diff --git a/src/platform/mbed/BLEManagerImpl.cpp b/src/platform/mbed/BLEManagerImpl.cpp index 4cb7214a11c875..cf5914aa449078 100644 --- a/src/platform/mbed/BLEManagerImpl.cpp +++ b/src/platform/mbed/BLEManagerImpl.cpp @@ -666,16 +666,6 @@ void BLEManagerImpl::DriveBLEState() if (!mFlags.Has(kFlag_AsyncInitCompleted)) { mFlags.Set(kFlag_AsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(kFlag_AdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 087b06bdcabbc5..f9c3d086aecefa 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -191,8 +191,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 #define CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH 0 -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED CONFIG_CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED - #define CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART 0 #ifndef CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART diff --git a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp index f8e6518b2d466a..7ef69ae8b36947 100644 --- a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp @@ -408,15 +408,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); break; -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - case DeviceEventType::kServiceProvisioningChange: - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kServiceProvisioningChange"); - - mFlags.Clear(Flags::kAdvertisingEnabled); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - break; -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - default: break; } @@ -932,14 +923,6 @@ void BLEManagerImpl::DriveBLEState(void) // Check if BLE stack is initialized VerifyOrExit(mFlags.Has(Flags::kK32WBLEStackInitialized), /* */); -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Start advertising if needed... if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled)) { diff --git a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index 65978d928a03ee..3529d47b4435e6 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -85,8 +85,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 #define CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH 0 -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED 1 - #define CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART 0 #define CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART 0 diff --git a/src/platform/qpg/BLEManagerImpl.cpp b/src/platform/qpg/BLEManagerImpl.cpp index 8f3aa45fd0a867..0b4fe14ee0bf9e 100644 --- a/src/platform/qpg/BLEManagerImpl.cpp +++ b/src/platform/qpg/BLEManagerImpl.cpp @@ -221,17 +221,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) // Generic CHIP events case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising state to be refreshed to reflect new provisioning state. mFlags.Set(Flags::kAdvertisingRefreshNeeded); @@ -374,16 +363,6 @@ void BLEManagerImpl::DriveBLEState(void) if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED } // If the application has enabled CHIPoBLE and BLE advertising... diff --git a/src/platform/telink/CHIPDevicePlatformConfig.h b/src/platform/telink/CHIPDevicePlatformConfig.h index 00b00e3e32ae1a..8adee57775b26a 100644 --- a/src/platform/telink/CHIPDevicePlatformConfig.h +++ b/src/platform/telink/CHIPDevicePlatformConfig.h @@ -66,8 +66,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 #define CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH 0 -#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED CONFIG_CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED - #define CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART 0 #ifndef CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp index 5afa6a09430902..ad8aec549d0f00 100644 --- a/src/platform/webos/BLEManagerImpl.cpp +++ b/src/platform/webos/BLEManagerImpl.cpp @@ -256,17 +256,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason); break; case DeviceEventType::kServiceProvisioningChange: - // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the - // device's provisioning state, then automatically disable CHIPoBLE advertising if the device - // is now fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - // Force the advertising configuration to be refreshed to reflect new provisioning state. mFlags.Clear(Flags::kAdvertisingConfigured); @@ -803,16 +792,6 @@ void BLEManagerImpl::DriveBLEState() if (!mFlags.Has(Flags::kAsyncInitCompleted)) { mFlags.Set(Flags::kAsyncInitCompleted); - - // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, - // disable CHIPoBLE advertising if the device is fully provisioned. -#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED - if (ConfigurationMgr().IsFullyProvisioned()) - { - mFlags.Clear(Flags::kAdvertisingEnabled); - ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); - } -#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED ExitNow(); }