Skip to content

Commit f6b40e0

Browse files
committed
BLE: Cleanup pal generic access service
1 parent b42abd0 commit f6b40e0

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ namespace impl {
2727
class GattServer;
2828
}
2929

30-
30+
namespace impl {
3131
/**
3232
* Implementation of ble::PalGenericAccessService for the Cordio stack.
3333
*/
34-
class PalGenericAccessService : public interface::PalGenericAccessService {
34+
class PalGenericAccessService final : public ble::PalGenericAccessService {
3535
public:
36-
PalGenericAccessService() { }
36+
PalGenericAccessService() = default;
3737

38-
virtual ~PalGenericAccessService() { }
38+
~PalGenericAccessService() = default;
3939

4040
#if 0 // Disabled until reworked and reintroduced to GattServer API
4141
virtual ble_error_t get_device_name_length(uint8_t& length);
@@ -45,20 +45,23 @@ class PalGenericAccessService : public interface::PalGenericAccessService {
4545
virtual ble_error_t set_appearance(GapAdvertisingData::Appearance appearance);
4646
#endif // Disabled until reworked and reintroduced to GattServer API
4747

48-
virtual ble_error_t get_peripheral_preferred_connection_parameters(
49-
ble::Gap::PreferredConnectionParams_t& parameters
50-
);
48+
ble_error_t get_peripheral_preferred_connection_parameters(
49+
ble::Gap::PreferredConnectionParams_t &parameters
50+
) final;
5151

52-
virtual ble_error_t set_peripheral_preferred_connection_parameters(
53-
const ble::Gap::PreferredConnectionParams_t& parameters
54-
);
52+
ble_error_t set_peripheral_preferred_connection_parameters(
53+
const ble::Gap::PreferredConnectionParams_t &parameters
54+
) final;
5555

5656
private:
5757
#if BLE_FEATURE_GATT_SERVER
58-
ble::impl::GattServer& gatt_server();
58+
59+
ble::impl::GattServer &gatt_server();
60+
5961
#endif // BLE_FEATURE_GATT_SERVER
6062
};
6163

62-
} // ble
64+
} // namespace impl
65+
} // namespace ble
6366

6467
#endif /* IMPL_PAL_GENERIC_ACCESS_SERVICE_ */

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "PalSecurityManagerImpl.h"
4949

5050
#include "internal/PalAttClientImpl.h"
51+
#include "internal/PalGenericAccessServiceImpl.h"
5152
#include "PalGapImpl.h"
5253

5354

@@ -193,7 +194,7 @@ const char *BLEInstanceBase::getVersion()
193194

194195
ble::impl::Gap &BLEInstanceBase::getGapImpl()
195196
{
196-
static ble::PalGenericAccessService cordio_gap_service;
197+
static ble::impl::PalGenericAccessService cordio_gap_service;
197198
static ble::impl::Gap gap(
198199
_event_queue,
199200
ble::impl::PalGap::get_gap(),

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "source/pal/PalGenericAccessService.h"
19+
#include "internal/PalGenericAccessServiceImpl.h"
2020
#include "GattServerImpl.h"
2121

2222
namespace ble {
23+
namespace impl {
2324

2425
#if 0 // Disabled until reworked and reintroduced to GattServer API
2526

@@ -91,7 +92,7 @@ virtual ble_error_t PalGenericAccessService::get_device_name_length(uint8_t& len
9192

9293

9394
ble_error_t PalGenericAccessService::get_peripheral_preferred_connection_parameters(
94-
ble::Gap::PreferredConnectionParams_t& parameters
95+
ble::Gap::PreferredConnectionParams_t &parameters
9596
)
9697
{
9798
#if BLE_FEATURE_GATT_SERVER
@@ -103,7 +104,7 @@ ble_error_t PalGenericAccessService::get_peripheral_preferred_connection_paramet
103104
}
104105

105106
ble_error_t PalGenericAccessService::set_peripheral_preferred_connection_parameters(
106-
const ble::Gap::PreferredConnectionParams_t& parameters
107+
const ble::Gap::PreferredConnectionParams_t &parameters
107108
)
108109
{
109110
#if BLE_FEATURE_GATT_SERVER
@@ -116,12 +117,15 @@ ble_error_t PalGenericAccessService::set_peripheral_preferred_connection_paramet
116117

117118

118119
#if BLE_FEATURE_GATT_SERVER
119-
ble::impl::GattServer& PalGenericAccessService::gatt_server()
120+
121+
ble::impl::GattServer &PalGenericAccessService::gatt_server()
120122
{
121123
return ble::impl::GattServer::getInstance();
122124
}
125+
123126
#endif // BLE_FEATURE_GATT_SERVER
124127

125-
} // ble
128+
} // namespace impl
129+
} // namespace ble
126130

127131

connectivity/FEATURE_BLE/source/pal/PalGenericAccessService.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "ble/Gap.h"
2626

2727
namespace ble {
28-
namespace interface {
2928

3029
/**
3130
* Manage state of the GAP service exposed by the GATT server.
@@ -70,11 +69,6 @@ struct PalGenericAccessService {
7069
) = 0;
7170
};
7271

73-
} // namespace interface
7472
} // namespace ble
7573

76-
/* This includes the concrete class implementation, to provide a an alternative BLE PAL implementation
77-
* disable Cordio and place your header in a path with the same structure */
78-
#include "ble/internal/PalGenericAccessServiceImpl.h"
79-
8074
#endif /* BLE_PAL_GENERIC_ACCESS_SERVICE_H_ */

0 commit comments

Comments
 (0)