mirror of https://github.com/ARMmbed/mbed-os.git
BLE: rename functions that trap concurrent use of incorect GAP APIs
parent
6de585f7bf
commit
d3c26f4283
|
@ -1889,7 +1889,7 @@ public:
|
|||
virtual ble_error_t setScanParameters(
|
||||
const ble::ScanParameters& params
|
||||
) {
|
||||
use_non_deprecated_scan_api();
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
};
|
||||
|
@ -1912,7 +1912,7 @@ public:
|
|||
ble::scan_duration_t duration = ble::scan_duration_t(0),
|
||||
ble::scan_period_t period = ble::scan_period_t(0)
|
||||
) {
|
||||
use_non_deprecated_scan_api();
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
};
|
||||
|
@ -2035,12 +2035,12 @@ protected:
|
|||
/** Can only be called if use_non_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void use_deprecated_scan_api() const { }
|
||||
virtual void useVersionOneAPI() const { }
|
||||
|
||||
/** Can only be called if use_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void use_non_deprecated_scan_api() const { }
|
||||
virtual void useVersionTwoAPI() const { }
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -574,9 +574,9 @@ private:
|
|||
|
||||
void on_address_rotation_timeout();
|
||||
|
||||
virtual void use_deprecated_scan_api() const;
|
||||
virtual void useVersionOneAPI() const;
|
||||
|
||||
virtual void use_non_deprecated_scan_api() const;
|
||||
virtual void useVersionTwoAPI() const;
|
||||
|
||||
/* implements pal::Gap::EventHandler */
|
||||
private:
|
||||
|
|
|
@ -942,7 +942,7 @@ ble_error_t GenericGap::setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode)
|
|||
|
||||
ble_error_t GenericGap::setScanningPolicyMode(ScanningPolicyMode_t mode)
|
||||
{
|
||||
use_deprecated_scan_api();
|
||||
useVersionOneAPI();
|
||||
|
||||
if (mode > Gap::SCAN_POLICY_FILTER_ALL_ADV) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
@ -969,7 +969,7 @@ Gap::AdvertisingPolicyMode_t GenericGap::getAdvertisingPolicyMode(void) const
|
|||
|
||||
Gap::ScanningPolicyMode_t GenericGap::getScanningPolicyMode(void) const
|
||||
{
|
||||
use_deprecated_scan_api();
|
||||
useVersionOneAPI();
|
||||
return (ScanningPolicyMode_t) _scanning_filter_policy.value();
|
||||
}
|
||||
|
||||
|
@ -980,7 +980,7 @@ Gap::InitiatorPolicyMode_t GenericGap::getInitiatorPolicyMode(void) const
|
|||
|
||||
ble_error_t GenericGap::startRadioScan(const GapScanningParams &scanningParams)
|
||||
{
|
||||
use_deprecated_scan_api();
|
||||
useVersionOneAPI();
|
||||
|
||||
if (is_scan_params_valid(&scanningParams) == false) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
@ -2367,7 +2367,7 @@ void GenericGap::on_scan_request_received(
|
|||
|
||||
ble_error_t GenericGap::setScanParameters(const ScanParameters ¶ms)
|
||||
{
|
||||
use_non_deprecated_scan_api();
|
||||
useVersionTwoAPI();
|
||||
|
||||
if (is_extended_advertising_available()) {
|
||||
bool active_scanning[] = {
|
||||
|
@ -2417,7 +2417,7 @@ ble_error_t GenericGap::startScan(
|
|||
scan_period_t period
|
||||
)
|
||||
{
|
||||
use_non_deprecated_scan_api();
|
||||
useVersionTwoAPI();
|
||||
|
||||
if(_privacy_enabled && _central_privacy_configuration.use_non_resolvable_random_address)
|
||||
{
|
||||
|
@ -2597,7 +2597,7 @@ uint8_t GenericGap::getMaxPeriodicAdvertiserListSize()
|
|||
return _pal_gap.read_periodic_advertiser_list_size();
|
||||
}
|
||||
|
||||
void GenericGap::use_deprecated_scan_api() const
|
||||
void GenericGap::useVersionOneAPI() const
|
||||
{
|
||||
if (_non_deprecated_scan_api_used) {
|
||||
MBED_ERROR(mixed_scan_api_error, "Use of deprecated scan API with up to date API");
|
||||
|
@ -2605,7 +2605,7 @@ void GenericGap::use_deprecated_scan_api() const
|
|||
_deprecated_scan_api_used = true;
|
||||
}
|
||||
|
||||
void GenericGap::use_non_deprecated_scan_api() const
|
||||
void GenericGap::useVersionTwoAPI() const
|
||||
{
|
||||
if (_deprecated_scan_api_used) {
|
||||
MBED_ERROR(mixed_scan_api_error, "Use of up to date scan API with deprecated API");
|
||||
|
|
Loading…
Reference in New Issue