@@ -2921,28 +2921,77 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
2921
2921
const uint8_t *data
2922
2922
)
2923
2923
{
2924
- if (!_eventHandler) {
2924
+ #if BLE_FEATURE_PRIVACY
2925
+ // Check if the address hasn't been resolved
2926
+ if (_privacy_enabled &&
2927
+ _central_privacy_configuration.resolution_strategy == CentralPrivacyConfiguration_t::RESOLVE_AND_FILTER &&
2928
+ address_type != NULL &&
2929
+ *address_type == pal::connection_peer_address_type_t ::RANDOM_ADDRESS &&
2930
+ is_random_private_resolvable_address (address.data ())
2931
+ ) {
2925
2932
return ;
2926
2933
}
2934
+ #endif // BLE_FEATURE_PRIVACY
2927
2935
2928
- _eventHandler->onAdvertisingReport (
2929
- AdvertisingReportEvent (
2930
- event_type,
2931
- address_type ?
2932
- (peer_address_type_t ::type) address_type->value () :
2933
- peer_address_type_t ::ANONYMOUS,
2934
- (BLEProtocol::AddressBytes_t &) address,
2935
- primary_phy,
2936
- secondary_phy ? *secondary_phy : phy_t ::NONE,
2937
- advertising_sid,
2938
- tx_power,
2936
+ if (_deprecated_scan_api_used == false ) {
2937
+ // report in new event handler
2938
+ if (!_eventHandler) {
2939
+ return ;
2940
+ }
2941
+ _eventHandler->onAdvertisingReport (
2942
+ AdvertisingReportEvent (
2943
+ event_type,
2944
+ address_type ?
2945
+ (peer_address_type_t ::type) address_type->value () :
2946
+ peer_address_type_t ::ANONYMOUS,
2947
+ (BLEProtocol::AddressBytes_t &) address,
2948
+ primary_phy,
2949
+ secondary_phy ? *secondary_phy : phy_t ::NONE,
2950
+ advertising_sid,
2951
+ tx_power,
2952
+ rssi,
2953
+ periodic_advertising_interval,
2954
+ (ble::peer_address_type_t ::type) direct_address_type.value (),
2955
+ (BLEProtocol::AddressBytes_t &) direct_address,
2956
+ mbed::make_Span (data, data_length)
2957
+ )
2958
+ );
2959
+ } else {
2960
+ if (event_type.legacy_advertising () == false ) {
2961
+ return ;
2962
+ }
2963
+
2964
+ GapAdvertisingParams::AdvertisingType_t advertising_type;
2965
+
2966
+ if (event_type.connectable () == false ) {
2967
+ if (event_type.scannable_advertising ()) {
2968
+ advertising_type = GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED;
2969
+ } else {
2970
+ advertising_type = GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED;
2971
+ }
2972
+ } else {
2973
+ if (event_type.directed_advertising ()) {
2974
+ advertising_type = GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED;
2975
+ } else {
2976
+ advertising_type = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED;
2977
+ }
2978
+ }
2979
+
2980
+ // This handler is not supposed to be called with V1 API as the extended
2981
+ // scan is not called. However the Cordio LL stack doesn't act that way
2982
+ // and use extended scan with V1 API.
2983
+ BLE_DEPRECATED_API_USE_BEGIN ()
2984
+ LegacyGap::processAdvertisementReport (
2985
+ address.data (),
2939
2986
rssi,
2940
- periodic_advertising_interval,
2941
- (ble::peer_address_type_t ::type) direct_address_type.value (),
2942
- (BLEProtocol::AddressBytes_t &) direct_address,
2943
- mbed::make_Span (data, data_length)
2944
- )
2945
- );
2987
+ event_type.scan_response (),
2988
+ advertising_type,
2989
+ data_length,
2990
+ data,
2991
+ (peer_address_type_t ::type) address_type->value ()
2992
+ );
2993
+ BLE_DEPRECATED_API_USE_END ()
2994
+ }
2946
2995
}
2947
2996
2948
2997
template <template <class > class PalGapImpl , class PalSecurityManager , class ConnectionEventMonitorEventHandler >
0 commit comments