Remove dead code from BLE layer class (#33171)
* Remove OnChipBleConnectReceived from BleLayer class
* Remove HandleReadReceived from BleLayer class
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h
index d9480cb..bad3ab3 100644
--- a/src/ble/BleLayer.h
+++ b/src/ble/BleLayer.h
@@ -229,9 +229,6 @@
void * mAppState = nullptr;
BleLayerDelegate * mBleTransport = nullptr;
- typedef void (*BleConnectionReceivedFunct)(BLEEndPoint * newEndPoint);
- BleConnectionReceivedFunct OnChipBleConnectReceived;
-
// Public functions:
BleLayer();
@@ -302,10 +299,6 @@
/// Call when an outstanding GATT indication receives a positive receipt confirmation.
bool HandleIndicationConfirmation(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId);
- /// Call when a GATT read request is received.
- bool HandleReadReceived(BLE_CONNECTION_OBJECT connObj, BLE_READ_REQUEST_CONTEXT requestContext, const ChipBleUUID * svcId,
- const ChipBleUUID * charId);
-
/**< Platform must call this function when any previous operation undertaken by the BleLayer via BleAdapter
* fails, such as a characteristic write request or subscribe attempt, or when a BLE connection is closed.
*
diff --git a/src/platform/ESP32/BLEManagerImpl.h b/src/platform/ESP32/BLEManagerImpl.h
index 9364ead..3f466fc 100644
--- a/src/platform/ESP32/BLEManagerImpl.h
+++ b/src/platform/ESP32/BLEManagerImpl.h
@@ -79,8 +79,6 @@
namespace Internal {
#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER
-void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);
-
enum class BleScanState : uint8_t
{
kNotScanning,
diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
index e5d9077..72d738d 100644
--- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
+++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
@@ -220,8 +220,6 @@
#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral);
mFlags.Set(Flags::kFastAdvertisingEnabled, !mIsCentral);
- OnChipBleConnectReceived = HandleIncomingBleConnection;
-
#else
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
@@ -741,11 +739,6 @@
ChipLogError(Ble, "Failed to connect to rc=%d", rc);
}
}
-
-void HandleIncomingBleConnection(BLEEndPoint * bleEP)
-{
- ChipLogProgress(DeviceLayer, "CHIPoBLE connection received");
-}
#endif
bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId)
diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp
index 67b5f9b..a69bc16 100644
--- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp
+++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp
@@ -200,11 +200,6 @@
ChipLogError(Ble, "Failed to connect to rc=%d", rc);
}
}
-
-void HandleIncomingBleConnection(BLEEndPoint * bleEP)
-{
- ChipLogProgress(DeviceLayer, "CHIPoBLE connection received");
-}
#endif
CHIP_ERROR BLEManagerImpl::_Init()
@@ -237,12 +232,11 @@
#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral);
mFlags.Set(Flags::kFastAdvertisingEnabled, !mIsCentral);
- OnChipBleConnectReceived = HandleIncomingBleConnection;
#else
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
-
#endif
+
mNumGAPCons = 0;
memset(reinterpret_cast<void *>(mCons), 0, sizeof(mCons));
mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
@@ -266,10 +260,6 @@
mFlags.ClearAll().Set(Flags::kGATTServiceStarted);
mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled;
-#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER
- OnChipBleConnectReceived = nullptr;
-#endif // CONFIG_ENABLE_ESP32_BLE_CONTROLLER
-
PlatformMgr().ScheduleWork(DriveBLEState, 0);
}
diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp
index d9025bd..a5bd19f 100644
--- a/src/platform/Linux/BLEManagerImpl.cpp
+++ b/src/platform/Linux/BLEManagerImpl.cpp
@@ -81,11 +81,6 @@
BLEManagerImpl BLEManagerImpl::sInstance;
-void HandleIncomingBleConnection(BLEEndPoint * bleEP)
-{
- ChipLogProgress(DeviceLayer, "CHIPoBluez con rcvd");
-}
-
CHIP_ERROR BLEManagerImpl::_Init()
{
CHIP_ERROR err;
@@ -99,8 +94,6 @@
memset(mDeviceName, 0, sizeof(mDeviceName));
- OnChipBleConnectReceived = HandleIncomingBleConnection;
-
DeviceLayer::SystemLayer().ScheduleLambda([this] { DriveBLEState(); });
exit:
diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h
index e3f3e41..200c987 100644
--- a/src/platform/Linux/BLEManagerImpl.h
+++ b/src/platform/Linux/BLEManagerImpl.h
@@ -39,8 +39,6 @@
namespace DeviceLayer {
namespace Internal {
-void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);
-
enum class BleScanState : uint8_t
{
kNotScanning,
diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp
index e733184..e8bb817 100644
--- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp
+++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp
@@ -118,8 +118,7 @@
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
- mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
- OnChipBleConnectReceived = HandleIncomingBleConnection;
+ mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
err = CreateEventHandler();
return err;
@@ -367,11 +366,6 @@
return false;
}
-void BLEManagerImpl::HandleIncomingBleConnection(BLEEndPoint * bleEP)
-{
- BLEMGR_LOG("BLEMGR: HandleIncomingBleConnection");
-}
-
// ===== Helper Members that implement the Low level BLE Stack behavior.
/*********************************************************************
diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
index b4cf4e2..1651293 100644
--- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
+++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
@@ -317,8 +317,6 @@
void ClearPendingBLEParamUpdate(uint16_t connHandle);
void UpdateBLERPA(void);
- static void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);
-
/* Static helper function */
static void EventHandler(void * arg);
static CHIP_ERROR DriveBLEState(void);
diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp
index 6d9726c..786ded0 100644
--- a/src/platform/webos/BLEManagerImpl.cpp
+++ b/src/platform/webos/BLEManagerImpl.cpp
@@ -68,11 +68,6 @@
BLEManagerImpl BLEManagerImpl::sInstance;
-void HandleIncomingBleConnection(BLEEndPoint * bleEP)
-{
- ChipLogProgress(DeviceLayer, "con rcvd");
-}
-
void BLEManagerImpl::InitConnectionData()
{
/* Initialize Hashmap */
@@ -115,8 +110,6 @@
memset(mDeviceName, 0, sizeof(mDeviceName));
- OnChipBleConnectReceived = HandleIncomingBleConnection;
-
ret = MainLoop::Instance().Init(_BleInitialize);
VerifyOrExit(ret != false, err = CHIP_ERROR_INTERNAL);
diff --git a/src/platform/webos/BLEManagerImpl.h b/src/platform/webos/BLEManagerImpl.h
index 7336f95..2bd4e6b 100644
--- a/src/platform/webos/BLEManagerImpl.h
+++ b/src/platform/webos/BLEManagerImpl.h
@@ -37,8 +37,6 @@
namespace DeviceLayer {
namespace Internal {
-void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);
-
enum class BleScanState : uint8_t
{
kNotScanning,
diff --git a/src/transport/raw/BLE.cpp b/src/transport/raw/BLE.cpp
index 76123af..811969e 100644
--- a/src/transport/raw/BLE.cpp
+++ b/src/transport/raw/BLE.cpp
@@ -46,9 +46,8 @@
if (mBleLayer)
{
mBleLayer->CancelBleIncompleteConnection();
- mBleLayer->OnChipBleConnectReceived = nullptr;
- mBleLayer->mBleTransport = nullptr;
- mBleLayer = nullptr;
+ mBleLayer->mBleTransport = nullptr;
+ mBleLayer = nullptr;
}
if (mBleEndPoint)
@@ -77,7 +76,6 @@
{
ChipLogDetail(Inet, "BLEBase::Init - not overriding transport");
}
- mBleLayer->OnChipBleConnectReceived = nullptr;
mState = State::kInitialized;