Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code from BLE layer class #33171

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/ble/BleLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ class DLL_EXPORT BleLayer
void * mAppState = nullptr;
BleLayerDelegate * mBleTransport = nullptr;

typedef void (*BleConnectionReceivedFunct)(BLEEndPoint * newEndPoint);
BleConnectionReceivedFunct OnChipBleConnectReceived;

// Public functions:
BleLayer();

Expand Down Expand Up @@ -302,10 +299,6 @@ class DLL_EXPORT BleLayer
/// 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.
*
Expand Down
2 changes: 0 additions & 2 deletions src/platform/ESP32/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ namespace DeviceLayer {
namespace Internal {

#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER
void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);

enum class BleScanState : uint8_t
{
kNotScanning,
Expand Down
7 changes: 0 additions & 7 deletions src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ CHIP_ERROR BLEManagerImpl::_Init()
#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);
Expand Down Expand Up @@ -741,11 +739,6 @@ void BLEManagerImpl::ConnectDevice(esp_bd_addr_t & addr, esp_ble_addr_type_t add
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)
Expand Down
12 changes: 1 addition & 11 deletions src/platform/ESP32/nimble/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ void BLEManagerImpl::ConnectDevice(const ble_addr_t & addr, uint16_t timeout)
ChipLogError(Ble, "Failed to connect to rc=%d", rc);
}
}

void HandleIncomingBleConnection(BLEEndPoint * bleEP)
{
ChipLogProgress(DeviceLayer, "CHIPoBLE connection received");
}
#endif

CHIP_ERROR BLEManagerImpl::_Init()
Expand Down Expand Up @@ -237,12 +232,11 @@ CHIP_ERROR BLEManagerImpl::_Init()
#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;
Expand All @@ -266,10 +260,6 @@ void BLEManagerImpl::_Shutdown()
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);
}

Expand Down
7 changes: 0 additions & 7 deletions src/platform/Linux/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0

BLEManagerImpl BLEManagerImpl::sInstance;

void HandleIncomingBleConnection(BLEEndPoint * bleEP)
{
ChipLogProgress(DeviceLayer, "CHIPoBluez con rcvd");
}

CHIP_ERROR BLEManagerImpl::_Init()
{
CHIP_ERROR err;
Expand All @@ -99,8 +94,6 @@ CHIP_ERROR BLEManagerImpl::_Init()

memset(mDeviceName, 0, sizeof(mDeviceName));

OnChipBleConnectReceived = HandleIncomingBleConnection;

DeviceLayer::SystemLayer().ScheduleLambda([this] { DriveBLEState(); });

exit:
Expand Down
2 changes: 0 additions & 2 deletions src/platform/Linux/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {

void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);

enum class BleScanState : uint8_t
{
kNotScanning,
Expand Down
8 changes: 1 addition & 7 deletions src/platform/cc13xx_26xx/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ CHIP_ERROR BLEManagerImpl::_Init(void)
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;
Expand Down Expand Up @@ -367,11 +366,6 @@ bool BLEManagerImpl::SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQU
return false;
}

void BLEManagerImpl::HandleIncomingBleConnection(BLEEndPoint * bleEP)
{
BLEMGR_LOG("BLEMGR: HandleIncomingBleConnection");
}

// ===== Helper Members that implement the Low level BLE Stack behavior.

/*********************************************************************
Expand Down
2 changes: 0 additions & 2 deletions src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
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);
Expand Down
7 changes: 0 additions & 7 deletions src/platform/webos/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0

BLEManagerImpl BLEManagerImpl::sInstance;

void HandleIncomingBleConnection(BLEEndPoint * bleEP)
{
ChipLogProgress(DeviceLayer, "con rcvd");
}

void BLEManagerImpl::InitConnectionData()
{
/* Initialize Hashmap */
Expand Down Expand Up @@ -115,8 +110,6 @@ CHIP_ERROR BLEManagerImpl::_Init()

memset(mDeviceName, 0, sizeof(mDeviceName));

OnChipBleConnectReceived = HandleIncomingBleConnection;

ret = MainLoop::Instance().Init(_BleInitialize);
VerifyOrExit(ret != false, err = CHIP_ERROR_INTERNAL);

Expand Down
2 changes: 0 additions & 2 deletions src/platform/webos/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {

void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP);

enum class BleScanState : uint8_t
{
kNotScanning,
Expand Down
6 changes: 2 additions & 4 deletions src/transport/raw/BLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ void BLEBase::ClearState()
if (mBleLayer)
{
mBleLayer->CancelBleIncompleteConnection();
mBleLayer->OnChipBleConnectReceived = nullptr;
mBleLayer->mBleTransport = nullptr;
mBleLayer = nullptr;
mBleLayer->mBleTransport = nullptr;
mBleLayer = nullptr;
}

if (mBleEndPoint)
Expand Down Expand Up @@ -77,7 +76,6 @@ CHIP_ERROR BLEBase::Init(const BleListenParameters & param)
{
ChipLogDetail(Inet, "BLEBase::Init - not overriding transport");
}
mBleLayer->OnChipBleConnectReceived = nullptr;

mState = State::kInitialized;

Expand Down
Loading