Skip to content

Commit d914cb1

Browse files
committed
BLE: Cleanup PalSigningEventMonitor.
1 parent f6b40e0 commit d914cb1

File tree

6 files changed

+17
-77
lines changed

6 files changed

+17
-77
lines changed

connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalSigningMonitorImpl.h

Lines changed: 0 additions & 33 deletions
This file was deleted.

connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,20 @@ PalGattClient &BLEInstanceBase::getPalGattClient()
267267

268268
ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
269269
{
270-
static PalSigningMonitor signing_event_monitor;
270+
// Creation of a proxy monitor to let the security manager register to
271+
// the gatt client and gatt server.
272+
static struct : PalSigningMonitor {
273+
void set_signing_event_handler(PalSigningMonitorEventHandler *handler)
274+
{
275+
#if BLE_FEATURE_GATT_CLIENT
276+
BLEInstanceBase::deviceInstance().getGattClientImpl().set_signing_event_handler(handler);
277+
#endif // BLE_FEATURE_GATT_CLIENT
278+
#if BLE_FEATURE_GATT_SERVER
279+
BLEInstanceBase::deviceInstance().getGattServerImpl().set_signing_event_handler(handler);
280+
#endif // BLE_FEATURE_GATT_SERVER
281+
}
282+
} signing_event_monitor;
283+
271284
static ble::impl::SecurityManager m_instance(
272285
ble::impl::PalSecurityManager::get_security_manager(),
273286
getGapImpl(),

connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class GattServer : public PalSigningMonitor {
211211

212212
void set_signing_event_handler(
213213
PalSigningMonitorEventHandler *signing_event_handler
214-
);
214+
) override;
215215

216216
EventHandler *getEventHandler();
217217

connectivity/FEATURE_BLE/source/cordio/source/PalSigningMonitorImpl.cpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

connectivity/FEATURE_BLE/source/generic/GattClientImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class GattClient :
167167
/**
168168
* @see ble::PalSigningMonitor::set_signing_event_handler
169169
*/
170-
void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler);
170+
void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler) override;
171171

172172
/**
173173
* @see PalGattClient::EventHandler::on_att_mtu_change

connectivity/FEATURE_BLE/source/pal/PalSigningMonitor.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class PalSigningMonitorEventHandler {
5858
};
5959
};
6060

61-
namespace interface {
6261
/**
6362
* Implemented by classes that need to be notified of signing events.
6463
* Notification is done by calling functions in the passed in event handler
@@ -70,14 +69,9 @@ class PalSigningMonitor {
7069
*
7170
* @param[in] signing_event_handler Event handler being registered.
7271
*/
73-
void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler);
72+
virtual void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler) = 0;
7473
};
7574

76-
} // namespace interface
7775
} // namespace ble
7876

79-
/* This includes the concrete class implementation, to provide a an alternative BLE PAL implementation
80-
* disable Cordio and place your header in a path with the same structure */
81-
#include "ble/internal/PalSigningMonitorImpl.h"
82-
8377
#endif /* MBED_BLE_SIGNING_EVENT_MONITOR */

0 commit comments

Comments
 (0)