Skip to content

Commit cf91053

Browse files
committed
BLE: Move cordio implementation include into source folder
1 parent 029ed3a commit cf91053

16 files changed

+70
-70
lines changed

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

+24-25
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@
1717
*/
1818

1919
#include "mbed.h"
20-
#include "us_ticker_api.h"
20+
#include "platform/CriticalSectionLock.h"
21+
#include "hal/us_ticker_api.h"
22+
#include "platform/mbed_assert.h"
23+
2124
#include "ble/BLE.h"
22-
#include "CriticalSectionLock.h"
25+
#include "ble/driver/CordioHCIDriver.h"
26+
27+
#include "source/pal/PalAttClient.h"
28+
#include "source/pal/PalSecurityManager.h"
29+
#include "source/pal/PalGap.h"
30+
#include "source/pal/PalSigningMonitor.h"
31+
#include "source/pal/PalAttClientToGattClient.h"
32+
33+
#include "source/BLEInstanceBaseImpl.h"
34+
#include "source/GattServerImpl.h"
35+
#include "source/PalSecurityManagerImpl.h"
36+
#include "source/PalAttClientImpl.h"
37+
#include "source/PalGenericAccessServiceImpl.h"
38+
#include "source/PalGapImpl.h"
39+
2340
#include "wsf_types.h"
2441
#include "wsf_msg.h"
2542
#include "wsf_os.h"
@@ -34,24 +51,8 @@
3451
#include "att_api.h"
3552
#include "smp_api.h"
3653
#include "hci_drv.h"
37-
#include "mbed_assert.h"
3854
#include "bstream.h"
3955

40-
#include "source/pal/PalAttClient.h"
41-
#include "source/pal/PalSecurityManager.h"
42-
#include "source/pal/PalGap.h"
43-
#include "source/pal/PalSigningMonitor.h"
44-
#include "source/pal/PalAttClientToGattClient.h"
45-
#include "source/BLEInstanceBase.h"
46-
#include "ble/driver/CordioHCIDriver.h"
47-
#include "GattServerImpl.h"
48-
#include "PalSecurityManagerImpl.h"
49-
50-
#include "internal/PalAttClientImpl.h"
51-
#include "internal/PalGenericAccessServiceImpl.h"
52-
#include "PalGapImpl.h"
53-
#include "internal/BLEInstanceBaseImpl.h"
54-
5556

5657
using namespace std::chrono;
5758

@@ -123,9 +124,7 @@ BLEInstanceBase::BLEInstanceBase(CordioHCIDriver &hci_driver) :
123124
stack_setup();
124125
}
125126

126-
BLEInstanceBase::~BLEInstanceBase()
127-
{
128-
}
127+
BLEInstanceBase::~BLEInstanceBase() = default;
129128

130129
/**
131130
* The singleton which represents the BLE transport for the BLE.
@@ -217,7 +216,7 @@ ble::Gap &BLEInstanceBase::getGap()
217216

218217
const ble::Gap &BLEInstanceBase::getGap() const
219218
{
220-
BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this);
219+
auto &self = const_cast<BLEInstanceBase &>(*this);
221220
return const_cast<const ble::Gap &>(self.getGap());
222221
};
223222

@@ -237,7 +236,7 @@ ble::GattServer &BLEInstanceBase::getGattServer()
237236

238237
const ble::GattServer &BLEInstanceBase::getGattServer() const
239238
{
240-
BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this);
239+
auto &self = const_cast<BLEInstanceBase &>(*this);
241240
return const_cast<const ble::GattServer &>(self.getGattServer());
242241
}
243242

@@ -273,8 +272,8 @@ ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
273272
{
274273
// Creation of a proxy monitor to let the security manager register to
275274
// the gatt client and gatt server.
276-
static struct : PalSigningMonitor {
277-
void set_signing_event_handler(PalSigningMonitorEventHandler *handler)
275+
static struct : ble::PalSigningMonitor {
276+
void set_signing_event_handler(PalSigningMonitorEventHandler *handler) final
278277
{
279278
#if BLE_FEATURE_GATT_CLIENT
280279
BLEInstanceBase::deviceInstance().getGattClientImpl().set_signing_event_handler(handler);

connectivity/FEATURE_BLE/source/cordio/include/ble/internal/BLEInstanceBaseImpl.h renamed to connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h

+27-24
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,30 @@
2020
#define IMPL_BLE_INSTANCE_BASE_H_
2121

2222
#include "ble/BLE.h"
23-
#include "ble/common/blecommon.h"
24-
#include "source/BLEInstanceBase.h"
2523

26-
#include "ble/driver/CordioHCIDriver.h"
2724
#include "ble/GattServer.h"
25+
#include "ble/GattClient.h"
26+
#include "ble/Gap.h"
27+
#include "ble/SecurityManager.h"
28+
29+
#include "ble/common/blecommon.h"
30+
#include "ble/driver/CordioHCIDriver.h"
31+
32+
#include "source/BLEInstanceBase.h"
2833
#include "source/pal/PalAttClient.h"
2934
#include "source/pal/PalGattClient.h"
30-
#include "ble/GattClient.h"
3135
#include "source/pal/PalGap.h"
32-
#include "ble/Gap.h"
3336
#include "source/pal/PalGenericAccessService.h"
34-
#include "ble/SecurityManager.h"
3537
#include "source/pal/PalEventQueue.h"
36-
#include "drivers/LowPowerTimer.h"
3738
#include "source/pal/PalSecurityManager.h"
3839

3940
#include "source/generic/GapImpl.h"
4041
#include "source/generic/GattClientImpl.h"
41-
#include "source/GattServerImpl.h"
4242
#include "source/generic/SecurityManagerImpl.h"
43-
#include "internal/PalEventQueueImpl.h"
43+
#include "source/GattServerImpl.h"
44+
#include "source/PalEventQueueImpl.h"
45+
46+
#include "drivers/LowPowerTimer.h"
4447

4548
namespace ble {
4649

@@ -51,7 +54,7 @@ namespace impl {
5154
/**
5255
* @see BLEInstanceBase
5356
*/
54-
class BLEInstanceBase : public ble::BLEInstanceBase {
57+
class BLEInstanceBase final : public ble::BLEInstanceBase {
5558
friend PalSigningMonitor;
5659

5760
/**
@@ -75,36 +78,36 @@ class BLEInstanceBase : public ble::BLEInstanceBase {
7578
/**
7679
* @see BLEInstanceBase::init
7780
*/
78-
virtual ble_error_t init(
81+
ble_error_t init(
7982
FunctionPointerWithContext<::BLE::InitializationCompleteCallbackContext *> initCallback
80-
);
83+
) final;
8184

8285
/**
8386
* @see BLEInstanceBase::hasInitialized
8487
*/
85-
virtual bool hasInitialized() const;
88+
bool hasInitialized() const final;
8689

8790
/**
8891
* @see BLEInstanceBase::shutdown
8992
*/
90-
virtual ble_error_t shutdown();
93+
ble_error_t shutdown() final;
9194

9295
/**
9396
* @see BLEInstanceBase::getVersion
9497
*/
95-
virtual const char *getVersion();
98+
const char *getVersion() final;
9699

97100
ble::impl::Gap &getGapImpl();
98101

99102
/**
100103
* @see BLEInstanceBase::getGap
101104
*/
102-
virtual ble::Gap &getGap();
105+
ble::Gap &getGap() final;
103106

104107
/**
105108
* @see BLEInstanceBase::getGap
106109
*/
107-
virtual const ble::Gap &getGap() const;
110+
const ble::Gap &getGap() const final;
108111

109112
#if BLE_FEATURE_GATT_SERVER
110113

@@ -113,12 +116,12 @@ class BLEInstanceBase : public ble::BLEInstanceBase {
113116
/**
114117
* @see BLEInstanceBase::getGattServer
115118
*/
116-
virtual ble::GattServer &getGattServer();
119+
ble::GattServer &getGattServer() final;
117120

118121
/**
119122
* @see BLEInstanceBase::getGattServer
120123
*/
121-
virtual const ble::GattServer &getGattServer() const;
124+
const ble::GattServer &getGattServer() const final;
122125

123126
#endif // BLE_FEATURE_GATT_SERVER
124127

@@ -129,7 +132,7 @@ class BLEInstanceBase : public ble::BLEInstanceBase {
129132
/**
130133
* @see BLEInstanceBase::getGattClient
131134
*/
132-
virtual ble::GattClient &getGattClient();
135+
ble::GattClient &getGattClient() final;
133136

134137
/**
135138
* Get the PAL Gatt Client.
@@ -147,24 +150,24 @@ class BLEInstanceBase : public ble::BLEInstanceBase {
147150
/**
148151
* @see BLEInstanceBase::getSecurityManager
149152
*/
150-
virtual ble::SecurityManager &getSecurityManager();
153+
ble::SecurityManager &getSecurityManager() final;
151154

152155
/**
153156
* @see BLEInstanceBase::getSecurityManager
154157
*/
155-
virtual const ble::SecurityManager &getSecurityManager() const;
158+
const ble::SecurityManager &getSecurityManager() const final;
156159

157160
#endif // BLE_FEATURE_SECURITY
158161

159162
/**
160163
* @see BLEInstanceBase::waitForEvent
161164
*/
162-
virtual void waitForEvent();
165+
void waitForEvent();
163166

164167
/**
165168
* @see BLEInstanceBase::processEvents
166169
*/
167-
virtual void processEvents();
170+
void processEvents() final;
168171

169172
private:
170173
static void stack_handler(wsfEventMask_t event, wsfMsgHdr_t *msg);

connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include "ble/common/BLERoles.h"
2020
#include <algorithm>
21-
#include "GattServerImpl.h"
22-
#include "BLEInstanceBaseImpl.h"
21+
#include "source/GattServerImpl.h"
22+
#include "source/BLEInstanceBaseImpl.h"
2323
#include "wsf_types.h"
2424
#include "att_api.h"
2525

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

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "wsf_types.h"
2626
#include "att_api.h"
2727

28-
2928
#include "ble/GattServer.h"
3029
#include "ble/Gap.h"
3130
#include "ble/SecurityManager.h"
@@ -38,7 +37,6 @@
3837
#include "ble/common/CallChainOfFunctionPointersWithContext.h"
3938
#include "ble/common/blecommon.h"
4039

41-
4240
#include "source/BLEInstanceBase.h"
4341
#include "source/generic/GattServerEvents.h"
4442
#include "source/pal/PalSigningMonitor.h"

connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
*/
1818

1919
#include "source/pal/PalAttClient.h"
20-
#include "GattServerImpl.h"
2120
#include "source/pal/PalSimpleAttServerMessage.h"
2221
#include "source/pal/PalGattClient.h"
23-
#include "BLEInstanceBaseImpl.h"
24-
#include "internal/PalAttClientImpl.h"
22+
23+
#include "source/GattServerImpl.h"
24+
#include "source/BLEInstanceBaseImpl.h"
25+
#include "source/PalAttClientImpl.h"
2526

2627
#include "att_api.h"
2728
#include "att_defs.h"

connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "internal/PalEventQueueImpl.h"
2019
#include "source/BLEInstanceBase.h"
20+
#include "source/PalEventQueueImpl.h"
2121

2222
namespace ble {
2323
namespace impl {

connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
#include "PalGapImpl.h"
18+
#include "source/PalGapImpl.h"
1919
#include "hci_api.h"
2020
#include "dm_api.h"
2121
#include "dm_main.h"

connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "internal/PalGenericAccessServiceImpl.h"
20-
#include "GattServerImpl.h"
19+
#include "source/PalGenericAccessServiceImpl.h"
20+
#include "source/GattServerImpl.h"
2121

2222
namespace ble {
2323
namespace impl {

connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
#include "ble/common/BLERoles.h"
2222
#include "ble/common/blecommon.h"
23-
#include "internal/PalSecurityManagerImpl.h"
24-
#include "internal/PalAttClientImpl.h"
23+
#include "source/PalSecurityManagerImpl.h"
24+
#include "source/PalAttClientImpl.h"
2525
#include "dm_api.h"
2626
#include "att_api.h"
2727
#include "smp_api.h"

connectivity/FEATURE_BLE/source/generic/GapImpl.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ class PalSecurityManager;
5353

5454
class PalGap;
5555

56-
class BLEInstanceBase;
57-
5856
namespace impl {
5957

58+
class BLEInstanceBase;
59+
6060
class Gap :
61-
public PalConnectionMonitor,
61+
public ble::PalConnectionMonitor,
6262
public PalGapEventHandler {
6363
friend PalConnectionMonitor;
6464
friend PalGapEventHandler;
6565
friend PalGap;
66-
friend BLEInstanceBase;
66+
friend impl::BLEInstanceBase;
6767

6868
using EventHandler = ::ble::Gap::EventHandler;
6969
using GapShutdownCallback_t = ::ble::Gap::GapShutdownCallback_t;

connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
namespace ble {
4343
class PalGenericAccessService;
44-
class BLEInstanceBase;
4544

4645
namespace impl {
4746

@@ -450,9 +449,9 @@ class SecurityManager :
450449

451450
public:
452451
SecurityManager(
453-
PalSecurityManager &palImpl,
454-
PalConnectionMonitor &connMonitorImpl,
455-
PalSigningMonitor &signingMonitorImpl
452+
ble::PalSecurityManager &palImpl,
453+
ble::PalConnectionMonitor &connMonitorImpl,
454+
ble::PalSigningMonitor &signingMonitorImpl
456455
) : eventHandler(nullptr),
457456
_pal(palImpl),
458457
_connection_monitor(connMonitorImpl),

0 commit comments

Comments
 (0)