mirror of https://github.com/ARMmbed/mbed-os.git
GenericGap: clean up unused helper functions
parent
09a81a9972
commit
2422efc9bb
|
|
@ -28,7 +28,6 @@
|
|||
#include "ble/pal/GenericAccessService.h"
|
||||
#include "ble/pal/EventQueue.h"
|
||||
#include "ble/pal/ConnectionEventMonitor.h"
|
||||
#include "ble/pal/Deprecated.h"
|
||||
|
||||
#include "drivers/LowPowerTimeout.h"
|
||||
#include "drivers/LowPowerTicker.h"
|
||||
|
|
@ -60,14 +59,12 @@ class GenericGap :
|
|||
>
|
||||
{
|
||||
// Typedef of base and companion classes .
|
||||
// typedef ::ble::interface::LegacyGap<GenericGap> LegacyGap;
|
||||
typedef ::ble::interface::Gap<GenericGap> Gap;
|
||||
typedef pal::ConnectionEventMonitor<ConnectionEventMonitorEventHandler> ConnectionEventMonitor;
|
||||
typedef TPalGap<GenericGap> PalGap;
|
||||
typedef pal::GapEventHandler<GenericGap> PalGapEventHandler;
|
||||
|
||||
// Friendship with base classes
|
||||
// friend LegacyGap;
|
||||
friend Gap;
|
||||
friend ConnectionEventMonitor;
|
||||
friend pal::GapEventHandler<GenericGap>;
|
||||
|
|
@ -77,7 +74,6 @@ class GenericGap :
|
|||
using Gap::_eventHandler;
|
||||
using Gap::default_peripheral_privacy_configuration;
|
||||
using Gap::default_central_privacy_configuration;
|
||||
// using Gap::state;
|
||||
|
||||
typedef typename BLEProtocol::AddressBytes_t Address_t;
|
||||
typedef typename ble::whitelist_t whitelist_t;
|
||||
|
|
@ -654,7 +650,6 @@ private:
|
|||
BitArray<MAX_ADVERTISING_SETS> _connectable_payload_size_exceeded;
|
||||
BitArray<MAX_ADVERTISING_SETS> _set_is_connectable;
|
||||
|
||||
// deprecation flags
|
||||
bool _user_manage_connection_parameter_requests : 1;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -67,43 +67,6 @@ static bool is_in_range(T value, T lower_bound, T higher_bound)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if the connection parameters are valid or false otherwise.
|
||||
*/
|
||||
static bool is_connection_params_valid(const ::Gap::ConnectionParams_t *params)
|
||||
{
|
||||
if (params == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_in_range(params->slaveLatency, slave_latency_min, slave_latency_max) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_in_range(params->maxConnectionInterval, connection_interval_min, connection_interval_max) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_in_range(params->minConnectionInterval, connection_interval_min, params->maxConnectionInterval) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_in_range(params->connectionSupervisionTimeout, supervision_timeout_min, supervision_timeout_max) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t max_connection_interval_ms =
|
||||
((uint32_t) params->maxConnectionInterval * 125) / 100;
|
||||
uint16_t min_connection_supervision_timeout =
|
||||
((1 + params->slaveLatency) * max_connection_interval_ms * 2) / 10;
|
||||
|
||||
if (params->connectionSupervisionTimeout < min_connection_supervision_timeout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true of the connection parameters are acceptable as preferred connection
|
||||
* parameters.
|
||||
|
|
@ -259,35 +222,6 @@ static bool is_random_address(const BLEProtocol::AddressBytes_t address)
|
|||
is_random_static_address(address);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check disconnection reason validity.
|
||||
*/
|
||||
static bool is_disconnection_reason_valid(disconnection_reason_t reason)
|
||||
{
|
||||
switch (reason.value()) {
|
||||
/**
|
||||
* Note: accepted reasons are:
|
||||
typedef pal::disconnection_reason_t reason_t;
|
||||
case reason_t::AUTHENTICATION_FAILLURE:
|
||||
case reason_t::REMOTE_USER_TERMINATED_CONNECTION:
|
||||
case reason_t::REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES:
|
||||
case reason_t::REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF:
|
||||
case reason_t::UNSUPPORTED_REMOTE_FEATURE:
|
||||
case reason_t::PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED:
|
||||
case reason_t::UNACCEPTABLE_CONNECTION_PARAMETERS:
|
||||
*/
|
||||
|
||||
// TODO Fix Disconnectionreason_t which expose invalid value
|
||||
case disconnection_reason_t::REMOTE_USER_TERMINATED_CONNECTION:
|
||||
case disconnection_reason_t::REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES:
|
||||
case disconnection_reason_t::REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF:
|
||||
case disconnection_reason_t::UNACCEPTABLE_CONNECTION_PARAMETERS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if the whitelist in input is valid or false otherwise.
|
||||
*/
|
||||
|
|
@ -347,18 +281,6 @@ static pal::whitelist_address_type_t to_whitelist_address_type(
|
|||
pal::whitelist_address_type_t::RANDOM_DEVICE_ADDRESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a BLEProtocol::AddressType_t into a pal::peer_address_type
|
||||
*/
|
||||
static peer_address_type_t to_peer_address_type(
|
||||
LegacyAddressType_t address_type
|
||||
)
|
||||
{
|
||||
return (address_type == LegacyAddressType::PUBLIC) ?
|
||||
peer_address_type_t::PUBLIC :
|
||||
peer_address_type_t::RANDOM;
|
||||
}
|
||||
|
||||
microsecond_t minSupervisionTimeout(
|
||||
const conn_interval_t &maxConnectionInterval,
|
||||
const slave_latency_t &slaveLatency
|
||||
|
|
@ -754,20 +676,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
|||
return _pal_gap.disconnect(connectionHandle, reason);
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::setTxPower_(int8_t txPower)
|
||||
{
|
||||
// TODO: This is not standard, expose it as an extension API and document it
|
||||
// as such
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::getPermittedTxPowerValues_(const int8_t **valueArrayPP, size_t *countP)
|
||||
{
|
||||
*countP = 0;
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
uint8_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::getMaxWhitelistSize_(void) const
|
||||
{
|
||||
|
|
@ -886,12 +794,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
|||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::initRadioNotification_(void)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::enablePrivacy_(bool enable)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue