Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc9c9633 authored by Henri Chataing's avatar Henri Chataing
Browse files

PDL: Unify the declaration scope for Packet and Struct declarations

Packet and Struct currently live in different scopes, which allows
packet and struct to have the same name. This impacts the rust
code generation as packets and structs are disambiguated by adding
appropriate suffixes, which is undesirable.

This change renames the few name conflicts in hci_packets.pdl that
prevent an immediate enforcement of this new rule.

Bug: 228327522
Test: Tested libbluetooth, root-canal target compilation
Change-Id: I88bbd394b56dbf6ac24ead4dcdeddcd467f71426
parent 788208c1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ class NeighborMatchers(object):
        inquiry_view = hci_packets.InquiryResultView(hci_event)
        if inquiry_view is None:
            return False
        results = inquiry_view.GetInquiryResults()
        results = inquiry_view.GetResponses()
        return any((address == result.bd_addr for result in results))

    @staticmethod
@@ -257,7 +257,7 @@ class NeighborMatchers(object):
        inquiry_view = hci_packets.InquiryResultWithRssiView(hci_event)
        if inquiry_view is None:
            return False
        results = inquiry_view.GetInquiryResults()
        results = inquiry_view.GetResponses()
        return any((address == result.address for result in results))

    @staticmethod
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ void HciProcessor::process_special_event(
      if (!packet_view.IsValid()) {
        return;
      }
      auto inquiry_results = packet_view.GetInquiryResults();
      auto inquiry_results = packet_view.GetResponses();
      avg_byte_count = byte_count / inquiry_results.size();
      for (auto& inquiry_result : inquiry_results) {
        btaa_hci_packets.push_back(BtaaHciPacket(Activity::SCAN, inquiry_result.bd_addr_, avg_byte_count));
+2 −2
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ class LeScanningManagerFacadeService : public LeScanningManagerFacade::Service,
      uint16_t periodic_advertising_interval,
      std::vector<uint8_t> advertising_data) {
    AdvertisingReportMsg advertising_report_msg;
    std::vector<LeExtendedAdvertisingReport> advertisements;
    LeExtendedAdvertisingReport le_extended_advertising_report;
    std::vector<LeExtendedAdvertisingResponse> advertisements;
    LeExtendedAdvertisingResponse le_extended_advertising_report;
    le_extended_advertising_report.address_type_ = (DirectAdvertisingAddressType)address_type;
    le_extended_advertising_report.address_ = address;
    le_extended_advertising_report.advertising_data_ = advertising_data;
+18 −18
Original line number Diff line number Diff line
@@ -4959,7 +4959,7 @@ packet InquiryComplete : Event (event_code = INQUIRY_COMPLETE) {
  status : ErrorCode,
}

struct InquiryResult {
struct InquiryResponse {
  bd_addr : Address,
  page_scan_repetition_mode : PageScanRepetitionMode,
  _reserved_ : 8,
@@ -4970,8 +4970,8 @@ struct InquiryResult {
}

packet InquiryResult : Event (event_code = INQUIRY_RESULT) {
  _count_(inquiry_results) : 8,
  inquiry_results : InquiryResult[],
  _count_(responses) : 8,
  responses : InquiryResponse[],
}

enum LinkType : 8 {
@@ -5197,7 +5197,7 @@ packet FlowSpecificationComplete : Event (event_code = FLOW_SPECIFICATION_COMPLE
  access_latency : 32, // Octets/s
}

struct InquiryResultWithRssi {
struct InquiryResponseWithRssi {
  address : Address,
  page_scan_repetition_mode : PageScanRepetitionMode,
  _reserved_ : 8,
@@ -5208,8 +5208,8 @@ struct InquiryResultWithRssi {
}

packet InquiryResultWithRssi : Event (event_code = INQUIRY_RESULT_WITH_RSSI) {
  _count_(inquiry_results) : 8,
  inquiry_results : InquiryResultWithRssi[],
  _count_(responses) : 8,
  responses : InquiryResponseWithRssi[],
}

packet ReadRemoteExtendedFeaturesComplete : Event (event_code = READ_REMOTE_EXTENDED_FEATURES_COMPLETE) {
@@ -5403,7 +5403,7 @@ enum AdvertisingEventType : 8 {
  SCAN_RESPONSE = 0x04,
}

struct LeAdvertisingReport {
struct LeAdvertisingResponse {
  event_type : AdvertisingEventType,
  address_type : AddressType,
  address : Address,
@@ -5413,11 +5413,11 @@ struct LeAdvertisingReport {
}

packet LeAdvertisingReport : LeMetaEvent (subevent_code = ADVERTISING_REPORT) {
  _count_(advertising_reports) : 8,
  advertising_reports : LeAdvertisingReport[],
  _count_(responses) : 8,
  responses : LeAdvertisingResponse[],
}

struct LeAdvertisingReportRaw {
struct LeAdvertisingResponseRaw {
  event_type : AdvertisingEventType,
  address_type : AddressType,
  address : Address,
@@ -5427,8 +5427,8 @@ struct LeAdvertisingReportRaw {
}

packet LeAdvertisingReportRaw : LeMetaEvent (subevent_code = ADVERTISING_REPORT) {
  _count_(advertising_reports) : 8,
  advertising_reports : LeAdvertisingReportRaw[],
  _count_(responses) : 8,
  responses : LeAdvertisingResponseRaw[],
}

packet LeConnectionUpdateComplete : LeMetaEvent (subevent_code = CONNECTION_UPDATE_COMPLETE) {
@@ -5514,7 +5514,7 @@ enum DirectAddressType : 8 {
  RANDOM_DEVICE_ADDRESS = 0x01,
}

struct LeDirectedAdvertisingReport {
struct LeDirectedAdvertisingResponse {
  event_type : DirectAdvertisingEventType,
  address_type : DirectAdvertisingAddressType,
  address : Address,
@@ -5524,8 +5524,8 @@ struct LeDirectedAdvertisingReport {
}

packet LeDirectedAdvertisingReport : LeMetaEvent (subevent_code = DIRECTED_ADVERTISING_REPORT) {
  _count_(advertising_reports) : 8,
  advertising_reports : LeDirectedAdvertisingReport[],
  _count_(responses) : 8,
  responses : LeDirectedAdvertisingResponse[],
}

packet LePhyUpdateComplete : LeMetaEvent (subevent_code = PHY_UPDATE_COMPLETE) {
@@ -5543,7 +5543,7 @@ enum DataStatus : 2 {
  RESERVED = 0x3,
}

struct LeExtendedAdvertisingReport {
struct LeExtendedAdvertisingResponse {
  connectable : 1,
  scannable : 1,
  directed : 1,
@@ -5566,8 +5566,8 @@ struct LeExtendedAdvertisingReport {
}

packet LeExtendedAdvertisingReport : LeMetaEvent (subevent_code = EXTENDED_ADVERTISING_REPORT) {
  _count_(advertising_reports) : 8,
  advertising_reports : LeExtendedAdvertisingReport[],
  _count_(responses) : 8,
  responses : LeExtendedAdvertisingResponse[],
}

packet LePeriodicAdvertisingSyncEstablished : LeMetaEvent (subevent_code = PERIODIC_ADVERTISING_SYNC_ESTABLISHED) {
+5 −5
Original line number Diff line number Diff line
@@ -304,13 +304,13 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
      LOG_INFO("Dropping invalid advertising event");
      return;
    }
    std::vector<LeAdvertisingReport> reports = event_view.GetAdvertisingReports();
    std::vector<LeAdvertisingResponse> reports = event_view.GetResponses();
    if (reports.empty()) {
      LOG_INFO("Zero results in advertising event");
      return;
    }

    for (LeAdvertisingReport report : reports) {
    for (LeAdvertisingResponse report : reports) {
      uint16_t extended_event_type = 0;
      switch (report.event_type_) {
        case hci::AdvertisingEventType::ADV_IND:
@@ -362,7 +362,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
      LOG_INFO("Dropping invalid advertising event");
      return;
    }
    std::vector<LeDirectedAdvertisingReport> reports = event_view.GetAdvertisingReports();
    std::vector<LeDirectedAdvertisingResponse> reports = event_view.GetResponses();
    if (reports.empty()) {
      LOG_INFO("Zero results in advertising event");
      return;
@@ -377,13 +377,13 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
      LOG_INFO("Dropping invalid advertising event");
      return;
    }
    std::vector<LeExtendedAdvertisingReport> reports = event_view.GetAdvertisingReports();
    std::vector<LeExtendedAdvertisingResponse> reports = event_view.GetResponses();
    if (reports.empty()) {
      LOG_INFO("Zero results in advertising event");
      return;
    }

    for (LeExtendedAdvertisingReport report : reports) {
    for (LeExtendedAdvertisingResponse report : reports) {
      uint16_t event_type = report.connectable_ | (report.scannable_ << kScannableBit) |
                            (report.directed_ << kDirectedBit) | (report.scan_response_ << kScanResponseBit) |
                            (report.legacy_ << kLegacyBit) | ((uint16_t)report.data_status_ << kDataStatusBits);
Loading