Skip to content

Commit

Permalink
Darwin: Avoid downcasts in BLEManagerImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
ksperling-apple committed Sep 3, 2023
1 parent 4a8aaba commit 333e520
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/platform/Darwin/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CHIP_ERROR BLEManagerImpl::StartScan(BleScannerDelegate * delegate)
{
if (mConnectionDelegate)
{
static_cast<BleConnectionDelegateImpl *>(mConnectionDelegate)->StartScan(delegate);
mConnectionDelegate->StartScan(delegate);
return CHIP_NO_ERROR;
}
return CHIP_ERROR_INCORRECT_STATE;
Expand All @@ -102,7 +102,7 @@ CHIP_ERROR BLEManagerImpl::StopScan()
{
if (mConnectionDelegate)
{
static_cast<BleConnectionDelegateImpl *>(mConnectionDelegate)->StopScan();
mConnectionDelegate->StopScan();
return CHIP_NO_ERROR;
}
return CHIP_ERROR_INCORRECT_STATE;
Expand Down
12 changes: 9 additions & 3 deletions src/platform/Darwin/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE

#include <ble/BleLayer.h>

namespace chip {
namespace DeviceLayer {

Expand All @@ -34,6 +36,10 @@ namespace Internal {

using namespace chip::Ble;

class BleConnectionDelegateImpl;
class BlePlatformDelegateImpl;
class BleApplicationDelegateImpl;

/**
* Concrete implementation of the BLEManagerImpl singleton object for the Darwin platforms.
*/
Expand Down Expand Up @@ -70,9 +76,9 @@ class BLEManagerImpl final : public BLEManager, private BleLayer

static BLEManagerImpl sInstance;

BleConnectionDelegate * mConnectionDelegate = nullptr;
BlePlatformDelegate * mPlatformDelegate = nullptr;
BleApplicationDelegate * mApplicationDelegate = nullptr;
BleConnectionDelegateImpl * mConnectionDelegate = nullptr;
BlePlatformDelegateImpl * mPlatformDelegate = nullptr;
BleApplicationDelegateImpl * mApplicationDelegate = nullptr;
};

/**
Expand Down

0 comments on commit 333e520

Please sign in to comment.