From 2422efc9bbacee9519aea3fdf10b4209484a5aad Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Tue, 31 Mar 2020 13:58:01 +0100 Subject: [PATCH] GenericGap: clean up unused helper functions --- features/FEATURE_BLE/ble/generic/GenericGap.h | 5 - .../FEATURE_BLE/source/generic/GenericGap.tpp | 98 ------------------- 2 files changed, 103 deletions(-) diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index bf50d8df75..822b1d7b25 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -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 LegacyGap; typedef ::ble::interface::Gap Gap; typedef pal::ConnectionEventMonitor ConnectionEventMonitor; typedef TPalGap PalGap; typedef pal::GapEventHandler PalGapEventHandler; // Friendship with base classes - // friend LegacyGap; friend Gap; friend ConnectionEventMonitor; friend pal::GapEventHandler; @@ -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 _connectable_payload_size_exceeded; BitArray _set_is_connectable; - // deprecation flags bool _user_manage_connection_parameter_requests : 1; private: diff --git a/features/FEATURE_BLE/source/generic/GenericGap.tpp b/features/FEATURE_BLE/source/generic/GenericGap.tpp index c1523ed516..43e6a38aa7 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.tpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.tpp @@ -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 class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> -ble_error_t GenericGap::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 class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> -void GenericGap::getPermittedTxPowerValues_(const int8_t **valueArrayPP, size_t *countP) -{ - *countP = 0; -} - template class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> uint8_t GenericGap::getMaxWhitelistSize_(void) const { @@ -886,12 +794,6 @@ ble_error_t GenericGap class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> -ble_error_t GenericGap::initRadioNotification_(void) -{ - return BLE_ERROR_NOT_IMPLEMENTED; -} - template class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> ble_error_t GenericGap::enablePrivacy_(bool enable) {