mirror of https://github.com/ARMmbed/mbed-os.git
Cordio: remove LegacyGap implementation
parent
be3858cec2
commit
af6f32e584
|
@ -149,26 +149,6 @@ public:
|
|||
*/
|
||||
void setPreferredConnectionParams(const ::Gap::ConnectionParams_t& params);
|
||||
|
||||
/**
|
||||
* @see ::GattServer::setDeviceName
|
||||
*/
|
||||
ble_error_t setDeviceName(const uint8_t *deviceName);
|
||||
|
||||
/**
|
||||
* @see ::GattServer::getDeviceName
|
||||
*/
|
||||
void getDeviceName(const uint8_t*& name, uint16_t& length);
|
||||
|
||||
/**
|
||||
* @see ::GattServer::setAppearance
|
||||
*/
|
||||
void setAppearance(GapAdvertisingData::Appearance appearance);
|
||||
|
||||
/**
|
||||
* @see ::GattServer::getAppearance
|
||||
*/
|
||||
GapAdvertisingData::Appearance getAppearance();
|
||||
|
||||
/**
|
||||
* @see ::GattServer::reset
|
||||
*/
|
||||
|
|
|
@ -19,69 +19,6 @@ public:
|
|||
|
||||
virtual ~GenericAccessService() { }
|
||||
|
||||
virtual ble_error_t get_device_name_length(uint8_t& length) {
|
||||
#if BLE_FEATURE_GATT_SERVER
|
||||
const uint8_t* name = NULL;
|
||||
uint16_t actual_length = 0;
|
||||
|
||||
gatt_server().getDeviceName(name, actual_length);
|
||||
length = actual_length;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
#else
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ble_error_t get_device_name(Span<uint8_t>& array) {
|
||||
#if BLE_FEATURE_GATT_SERVER
|
||||
const uint8_t* name = NULL;
|
||||
uint16_t length = 0;
|
||||
|
||||
gatt_server().getDeviceName(name, length);
|
||||
|
||||
if (length > array.size()) {
|
||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
memcpy(array.data(), name, length);
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
#else
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // BLE_FEATURE_GATT_SERVER
|
||||
}
|
||||
|
||||
virtual ble_error_t set_device_name(const uint8_t* device_name) {
|
||||
#if BLE_FEATURE_GATT_SERVER
|
||||
return gatt_server().setDeviceName(device_name);
|
||||
#else
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // BLE_FEATURE_GATT_SERVER
|
||||
}
|
||||
|
||||
virtual ble_error_t get_appearance(
|
||||
GapAdvertisingData::Appearance& appearance
|
||||
) {
|
||||
#if BLE_FEATURE_GATT_SERVER
|
||||
appearance = gatt_server().getAppearance();
|
||||
return BLE_ERROR_NONE;
|
||||
#else
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // BLE_FEATURE_GATT_SERVER
|
||||
}
|
||||
|
||||
virtual ble_error_t set_appearance(
|
||||
GapAdvertisingData::Appearance appearance
|
||||
) {
|
||||
#if BLE_FEATURE_GATT_SERVER
|
||||
gatt_server().setAppearance(appearance);
|
||||
return BLE_ERROR_NONE;
|
||||
#else
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
#endif // BLE_FEATURE_GATT_SERVER
|
||||
}
|
||||
|
||||
virtual ble_error_t get_peripheral_prefered_connection_parameters(
|
||||
::Gap::ConnectionParams_t& parameters
|
||||
) {
|
||||
|
|
|
@ -818,47 +818,6 @@ void GattServer::setPreferredConnectionParams(const ::Gap::ConnectionParams_t& p
|
|||
memcpy(generic_access_service.ppcp + 6, ¶ms.connectionSupervisionTimeout, 2);
|
||||
}
|
||||
|
||||
ble_error_t GattServer::setDeviceName(const uint8_t *deviceName)
|
||||
{
|
||||
size_t length = 0;
|
||||
|
||||
if (deviceName != NULL) {
|
||||
length = strlen((const char*)deviceName);
|
||||
}
|
||||
|
||||
if (length == 0) {
|
||||
free(generic_access_service.device_name_value());
|
||||
} else {
|
||||
uint8_t* res = (uint8_t*) realloc(generic_access_service.device_name_value(), length);
|
||||
if (res == NULL) {
|
||||
return BLE_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
generic_access_service.device_name_value() = res;
|
||||
memcpy(res, deviceName, length);
|
||||
}
|
||||
|
||||
generic_access_service.device_name_length = length;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
void GattServer::getDeviceName(const uint8_t*& name, uint16_t& length)
|
||||
{
|
||||
length = generic_access_service.device_name_length;
|
||||
name = generic_access_service.device_name_value();
|
||||
}
|
||||
|
||||
void GattServer::setAppearance(GapAdvertisingData::Appearance appearance)
|
||||
{
|
||||
generic_access_service.appearance = appearance;
|
||||
}
|
||||
|
||||
GapAdvertisingData::Appearance GattServer::getAppearance()
|
||||
{
|
||||
return (GapAdvertisingData::Appearance) generic_access_service.appearance;
|
||||
}
|
||||
|
||||
ble_error_t GattServer::reset_(void)
|
||||
{
|
||||
Base::reset_();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "ble/pal/AttClientToGattClientAdapter.h"
|
||||
#include "ble/pal/PalGap.h"
|
||||
|
||||
#include "source/LegacyGap.tpp"
|
||||
#include "source/gap/Gap.tpp"
|
||||
#include "source/GattClient.tpp"
|
||||
#include "source/SecurityManager.tpp"
|
||||
|
@ -121,14 +120,3 @@ template class ble::interface::Gap<
|
|||
SecurityManagerImpl
|
||||
>
|
||||
>;
|
||||
|
||||
template class ble::interface::LegacyGap<
|
||||
ble::generic::GenericGap<
|
||||
ble::pal::vendor::cordio::Gap,
|
||||
SecurityManagerImpl::PalSecurityManager,
|
||||
SecurityManagerImpl
|
||||
>
|
||||
>;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue