From 56185582aa1fdaf966de6e143dae804ebcb7ab0e Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Mon, 26 Nov 2018 21:01:14 +0000 Subject: [PATCH] BLE: Report legacy advertising with new API. --- .../FEATURE_BLE/source/generic/GenericGap.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 0fe570b5f8..2bcef45c63 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -1550,6 +1550,26 @@ void GenericGap::on_advertising_report(const pal::GapAdvertisingReportEvent &e) peer_address_type_t peer_address_type = static_cast(advertising.address_type.value()); + // report in new event handler + if (_eventHandler) { + _eventHandler->onAdvertisingReport( + AdvertisingReportEvent( + advertising_event_t(/*advertising.type*/ 0), // TODO + peer_address_type, + advertising.address, + /* primary */ phy_t::LE_1M, + /* secondary */ phy_t::NONE, + /* SID - NO ADI FIELD IN THE PDU */ 0xFF, + /* tx power information not available */ 127, + advertising.rssi, + /* NO PERIODIC ADVERTISING */ periodic_interval_t(0), + peer_address_type_t::ANONYMOUS, + ble::address_t (), + mbed::Span(advertising.data.data(), advertising.data.size()) + ) + ); + } + BLE_DEPRECATED_API_USE_BEGIN() processAdvertisementReport( advertising.address.data(),