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