mirror of https://github.com/ARMmbed/mbed-os.git
GenericGap: prepare legacy advertising set
This is based on (and supercedes) PR #10772. As the switches between old and new APIs do not exist anymore, we create a function for legacy advertising set creation.pull/12730/head
parent
a2a99291d4
commit
eee3b687c4
|
|
@ -831,6 +831,8 @@ private:
|
|||
);
|
||||
|
||||
bool is_extended_advertising_available();
|
||||
|
||||
void prepare_legacy_advertising_set();
|
||||
};
|
||||
|
||||
} // namespace generic
|
||||
|
|
|
|||
|
|
@ -1127,15 +1127,10 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
|||
|
||||
/* clear advertising set data on the controller */
|
||||
_pal_gap.clear_advertising_sets();
|
||||
|
||||
setExtendedAdvertisingParameters(
|
||||
LEGACY_ADVERTISING_HANDLE,
|
||||
AdvertisingParameters()
|
||||
);
|
||||
#if BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
}
|
||||
|
||||
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
|
||||
prepare_legacy_advertising_set();
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
|
|
@ -1844,6 +1839,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
|||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
prepare_legacy_advertising_set();
|
||||
|
||||
if (!_existing_sets.get(handle)) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
|
@ -1998,6 +1995,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
|||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
prepare_legacy_advertising_set();
|
||||
|
||||
if (!_existing_sets.get(handle)) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
|
@ -2902,5 +2901,22 @@ bool GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
|
|||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
}
|
||||
|
||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::prepare_legacy_advertising_set()
|
||||
{
|
||||
#if BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
if (_existing_sets.get(LEGACY_ADVERTISING_HANDLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setExtendedAdvertisingParameters(
|
||||
LEGACY_ADVERTISING_HANDLE,
|
||||
AdvertisingParameters()
|
||||
);
|
||||
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
}
|
||||
|
||||
|
||||
} // generic
|
||||
} // ble
|
||||
|
|
|
|||
Loading…
Reference in New Issue