BLE: Cleanup pal generic access service

pull/13475/head
Vincent Coubard 2020-08-24 14:41:23 +01:00
parent b42abd0e25
commit f6b40e0e66
4 changed files with 26 additions and 24 deletions

View File

@ -27,15 +27,15 @@ namespace impl {
class GattServer;
}
namespace impl {
/**
* Implementation of ble::PalGenericAccessService for the Cordio stack.
*/
class PalGenericAccessService : public interface::PalGenericAccessService {
class PalGenericAccessService final : public ble::PalGenericAccessService {
public:
PalGenericAccessService() { }
PalGenericAccessService() = default;
virtual ~PalGenericAccessService() { }
~PalGenericAccessService() = default;
#if 0 // Disabled until reworked and reintroduced to GattServer API
virtual ble_error_t get_device_name_length(uint8_t& length);
@ -45,20 +45,23 @@ public:
virtual ble_error_t set_appearance(GapAdvertisingData::Appearance appearance);
#endif // Disabled until reworked and reintroduced to GattServer API
virtual ble_error_t get_peripheral_preferred_connection_parameters(
ble::Gap::PreferredConnectionParams_t& parameters
);
ble_error_t get_peripheral_preferred_connection_parameters(
ble::Gap::PreferredConnectionParams_t &parameters
) final;
virtual ble_error_t set_peripheral_preferred_connection_parameters(
const ble::Gap::PreferredConnectionParams_t& parameters
);
ble_error_t set_peripheral_preferred_connection_parameters(
const ble::Gap::PreferredConnectionParams_t &parameters
) final;
private:
#if BLE_FEATURE_GATT_SERVER
ble::impl::GattServer& gatt_server();
ble::impl::GattServer &gatt_server();
#endif // BLE_FEATURE_GATT_SERVER
};
} // ble
} // namespace impl
} // namespace ble
#endif /* IMPL_PAL_GENERIC_ACCESS_SERVICE_ */

View File

@ -48,6 +48,7 @@
#include "PalSecurityManagerImpl.h"
#include "internal/PalAttClientImpl.h"
#include "internal/PalGenericAccessServiceImpl.h"
#include "PalGapImpl.h"
@ -193,7 +194,7 @@ const char *BLEInstanceBase::getVersion()
ble::impl::Gap &BLEInstanceBase::getGapImpl()
{
static ble::PalGenericAccessService cordio_gap_service;
static ble::impl::PalGenericAccessService cordio_gap_service;
static ble::impl::Gap gap(
_event_queue,
ble::impl::PalGap::get_gap(),

View File

@ -16,10 +16,11 @@
* limitations under the License.
*/
#include "source/pal/PalGenericAccessService.h"
#include "internal/PalGenericAccessServiceImpl.h"
#include "GattServerImpl.h"
namespace ble {
namespace impl {
#if 0 // Disabled until reworked and reintroduced to GattServer API
@ -91,7 +92,7 @@ virtual ble_error_t PalGenericAccessService::get_device_name_length(uint8_t& len
ble_error_t PalGenericAccessService::get_peripheral_preferred_connection_parameters(
ble::Gap::PreferredConnectionParams_t& parameters
ble::Gap::PreferredConnectionParams_t &parameters
)
{
#if BLE_FEATURE_GATT_SERVER
@ -103,7 +104,7 @@ ble_error_t PalGenericAccessService::get_peripheral_preferred_connection_paramet
}
ble_error_t PalGenericAccessService::set_peripheral_preferred_connection_parameters(
const ble::Gap::PreferredConnectionParams_t& parameters
const ble::Gap::PreferredConnectionParams_t &parameters
)
{
#if BLE_FEATURE_GATT_SERVER
@ -116,12 +117,15 @@ ble_error_t PalGenericAccessService::set_peripheral_preferred_connection_paramet
#if BLE_FEATURE_GATT_SERVER
ble::impl::GattServer& PalGenericAccessService::gatt_server()
ble::impl::GattServer &PalGenericAccessService::gatt_server()
{
return ble::impl::GattServer::getInstance();
}
#endif // BLE_FEATURE_GATT_SERVER
} // ble
} // namespace impl
} // namespace ble

View File

@ -25,7 +25,6 @@
#include "ble/Gap.h"
namespace ble {
namespace interface {
/**
* Manage state of the GAP service exposed by the GATT server.
@ -70,11 +69,6 @@ public:
) = 0;
};
} // namespace interface
} // namespace ble
/* This includes the concrete class implementation, to provide a an alternative BLE PAL implementation
* disable Cordio and place your header in a path with the same structure */
#include "ble/internal/PalGenericAccessServiceImpl.h"
#endif /* BLE_PAL_GENERIC_ACCESS_SERVICE_H_ */