OSDN Git Service

Properly pass address type when extended advertisement is received
authorJakub Pawlowski <jpawlowski@google.com>
Thu, 24 Sep 2020 19:33:16 +0000 (21:33 +0200)
committerJakub Pawlowski <jpawlowski@google.com>
Thu, 24 Sep 2020 20:54:52 +0000 (22:54 +0200)
Tag: #gd-refactor
Bug: 139080884
Change-Id: If55ccd7998c6239ffaa0f02468a5314aa759f4ef

gd/hci/facade/le_scanning_manager_facade.cc
gd/hci/le_report.h

index bf790b7..88eb6d6 100644 (file)
@@ -72,7 +72,7 @@ class LeScanningManagerFacadeService : public LeScanningManagerFacade::Service,
           LeReportMsg le_report_msg;
           std::vector<LeAdvertisingReport> advertisements;
           LeAdvertisingReport le_advertising_report;
-          le_advertising_report.address_type_ = report->address_type_;
+          le_advertising_report.address_type_ = static_cast<AddressType>(report->address_type_);
           le_advertising_report.address_ = report->address_;
           le_advertising_report.advertising_data_ = report->gap_data_;
           le_advertising_report.event_type_ = report->advertising_event_type_;
@@ -90,6 +90,7 @@ class LeScanningManagerFacadeService : public LeScanningManagerFacade::Service,
           LeReportMsg le_report_msg;
           std::vector<LeExtendedAdvertisingReport> advertisements;
           LeExtendedAdvertisingReport le_extended_advertising_report;
+          le_extended_advertising_report.address_type_ = report->address_type_;
           le_extended_advertising_report.address_ = report->address_;
           le_extended_advertising_report.advertising_data_ = report->gap_data_;
           le_extended_advertising_report.rssi_ = report->rssi_;
index 308c702..a5b8ed6 100644 (file)
@@ -24,15 +24,23 @@ namespace bluetooth::hci {
 class LeReport {
  public:
   explicit LeReport(const LeAdvertisingReport& advertisement)
-      : report_type_(ReportType::ADVERTISING_EVENT), advertising_event_type_(advertisement.event_type_),
-        address_(advertisement.address_), address_type_(advertisement.address_type_), rssi_(advertisement.rssi_),
+      : report_type_(ReportType::ADVERTISING_EVENT),
+        advertising_event_type_(advertisement.event_type_),
+        address_(advertisement.address_),
+        address_type_(static_cast<DirectAdvertisingAddressType>(advertisement.address_type_)),
+        rssi_(advertisement.rssi_),
         gap_data_(advertisement.advertising_data_) {}
   explicit LeReport(const LeDirectedAdvertisingReport& advertisement)
-      : report_type_(ReportType::DIRECTED_ADVERTISING_EVENT), address_(advertisement.address_),
+      : report_type_(ReportType::DIRECTED_ADVERTISING_EVENT),
+        address_(advertisement.address_),
+        address_type_(advertisement.address_type_),
         rssi_(advertisement.rssi_) {}
   explicit LeReport(const LeExtendedAdvertisingReport& advertisement)
-      : report_type_(ReportType::EXTENDED_ADVERTISING_EVENT), address_(advertisement.address_),
-        rssi_(advertisement.rssi_), gap_data_(advertisement.advertising_data_) {}
+      : report_type_(ReportType::EXTENDED_ADVERTISING_EVENT),
+        address_(advertisement.address_),
+        address_type_(advertisement.address_type_),
+        rssi_(advertisement.rssi_),
+        gap_data_(advertisement.advertising_data_) {}
   virtual ~LeReport() = default;
 
   enum class ReportType {
@@ -49,7 +57,7 @@ class LeReport {
   // Advertising Event
   const AdvertisingEventType advertising_event_type_{};
   const Address address_{};
-  const AddressType address_type_{};
+  const DirectAdvertisingAddressType address_type_{};
   const int8_t rssi_;
   const std::vector<GapData> gap_data_{};
 };