diff --git a/system/blueberry/tests/gd/cert/matchers.py b/system/blueberry/tests/gd/cert/matchers.py index 95dbe4dcfc56b1dfd3ae6c4b7adb0d5f7d77196e..df15d7d4e4994e94915e2631e591f11e1ce8c4b9 100644 --- a/system/blueberry/tests/gd/cert/matchers.py +++ b/system/blueberry/tests/gd/cert/matchers.py @@ -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 diff --git a/system/gd/btaa/linux_generic/hci_processor.cc b/system/gd/btaa/linux_generic/hci_processor.cc index 60c5969bc9436cd043e381fcf8d295cb37eb0b31..28c1e70b19ae01ce5e70f830bcaa21631c3f8e18 100644 --- a/system/gd/btaa/linux_generic/hci_processor.cc +++ b/system/gd/btaa/linux_generic/hci_processor.cc @@ -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)); diff --git a/system/gd/hci/facade/le_scanning_manager_facade.cc b/system/gd/hci/facade/le_scanning_manager_facade.cc index 8e583e218b28c087e5cd13611423f5589997afe3..ea0d058510fe1d20e8fe2ab93b5c8f625a96a7a8 100644 --- a/system/gd/hci/facade/le_scanning_manager_facade.cc +++ b/system/gd/hci/facade/le_scanning_manager_facade.cc @@ -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; diff --git a/system/gd/hci/hci_packets.pdl b/system/gd/hci/hci_packets.pdl index 2051261fc0bf0d9fb2712136722b2bd2ce00d16b..ed0a5318e304e04fc2949b134caf4cc3b396e44b 100644 --- a/system/gd/hci/hci_packets.pdl +++ b/system/gd/hci/hci_packets.pdl @@ -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) { diff --git a/system/gd/hci/le_scanning_manager.cc b/system/gd/hci/le_scanning_manager.cc index 5a742c8578cd8528c574465b6772e2d514b9abdf..6ba1c4286203f018f695fdbff3a7c1e41482eaf8 100644 --- a/system/gd/hci/le_scanning_manager.cc +++ b/system/gd/hci/le_scanning_manager.cc @@ -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); diff --git a/system/gd/hci/le_scanning_manager_test.cc b/system/gd/hci/le_scanning_manager_test.cc index f5e64492958bceee1aec2ab74abeab4af0127353..bcf0c0287c9e4fe7d225d01c1ddc04cacc7abd4a 100644 --- a/system/gd/hci/le_scanning_manager_test.cc +++ b/system/gd/hci/le_scanning_manager_test.cc @@ -382,7 +382,7 @@ TEST_F(LeScanningManagerTest, start_scan_test) { ASSERT_EQ(std::future_status::ready, result); test_hci_layer_->IncomingEvent(LeSetScanEnableCompleteBuilder::Create(uint8_t{1}, ErrorCode::SUCCESS)); - LeAdvertisingReport report{}; + LeAdvertisingResponse report{}; report.event_type_ = AdvertisingEventType::ADV_DIRECT_IND; report.address_type_ = AddressType::PUBLIC_DEVICE_ADDRESS; Address::FromString("12:34:56:78:9a:bc", report.address_); @@ -409,7 +409,7 @@ TEST_F(LeAndroidHciScanningManagerTest, start_scan_test) { ASSERT_EQ(std::future_status::ready, result); test_hci_layer_->IncomingEvent(LeSetScanEnableCompleteBuilder::Create(uint8_t{1}, ErrorCode::SUCCESS)); - LeAdvertisingReport report{}; + LeAdvertisingResponse report{}; report.event_type_ = AdvertisingEventType::ADV_DIRECT_IND; report.address_type_ = AddressType::PUBLIC_DEVICE_ADDRESS; Address::FromString("12:34:56:78:9a:bc", report.address_); @@ -527,7 +527,7 @@ TEST_F(LeExtendedScanningManagerTest, start_scan_test) { test_hci_layer_->IncomingEvent(LeSetScanEnableCompleteBuilder::Create(uint8_t{1}, ErrorCode::SUCCESS)); - LeExtendedAdvertisingReport report{}; + LeExtendedAdvertisingResponse report{}; report.connectable_ = 1; report.scannable_ = 0; report.address_type_ = DirectAdvertisingAddressType::PUBLIC_DEVICE_ADDRESS; diff --git a/system/gd/neighbor/inquiry.cc b/system/gd/neighbor/inquiry.cc index 9eceebb366e2eb48264fe8931a9407283b31fe7e..f814fd028663200893b5a59e33f76e8f59411f86 100644 --- a/system/gd/neighbor/inquiry.cc +++ b/system/gd/neighbor/inquiry.cc @@ -208,14 +208,14 @@ void neighbor::InquiryModule::impl::OnEvent(hci::EventView view) { case hci::EventCode::INQUIRY_RESULT: { auto packet = hci::InquiryResultView::Create(view); ASSERT(packet.IsValid()); - LOG_INFO("Inquiry result size:%zd num_responses:%zu", packet.size(), packet.GetInquiryResults().size()); + LOG_INFO("Inquiry result size:%zd num_responses:%zu", packet.size(), packet.GetResponses().size()); inquiry_callbacks_.result(packet); } break; case hci::EventCode::INQUIRY_RESULT_WITH_RSSI: { auto packet = hci::InquiryResultWithRssiView::Create(view); ASSERT(packet.IsValid()); - LOG_INFO("Inquiry result with rssi num_responses:%zu", packet.GetInquiryResults().size()); + LOG_INFO("Inquiry result with rssi num_responses:%zu", packet.GetResponses().size()); inquiry_callbacks_.result_with_rssi(packet); } break; diff --git a/system/gd/packet/parser/doc/reference.md b/system/gd/packet/parser/doc/reference.md index 1e521372d3f52feca8cf594ea403ff5276a3237f..6158faee5744a47eebd4beb51c323402220ac354 100644 --- a/system/gd/packet/parser/doc/reference.md +++ b/system/gd/packet/parser/doc/reference.md @@ -54,6 +54,20 @@ packet Brew { } ``` +## Identifiers + +- Identifiers can denote a field; an enumeration tag; or a declared type. + +- Field identifiers declared in a [packet](#packet) (resp. [struct](#struct)) belong to the _scope_ that extends + to the packet (resp. struct), and all derived packets (resp. structs). + +- Field identifiers declared in a [group](#group) belong to the _scope_ that + extends to the packets declaring a [group field](#group_field) for this group. + +- Two fields may not be declared with the same identifier in any packet scope. + +- Two types may not be declared width the same identifier. + ## Declarations > declaration: {#declaration}\ diff --git a/system/main/shim/btm.cc b/system/main/shim/btm.cc index 3ffd99aad60c53fb5de21df30c5a5a351b71da81..e28f16b56646fcabbf9ccc3fb7b13fa440767ae4 100644 --- a/system/main/shim/btm.cc +++ b/system/main/shim/btm.cc @@ -174,7 +174,7 @@ Btm::Btm(os::Handler* handler, neighbor::InquiryModule* inquiry) } void Btm::OnInquiryResult(bluetooth::hci::InquiryResultView view) { - for (auto& response : view.GetInquiryResults()) { + for (auto& response : view.GetResponses()) { btm_api_process_inquiry_result( ToRawAddress(response.bd_addr_), static_cast<uint8_t>(response.page_scan_repetition_mode_), @@ -184,7 +184,7 @@ void Btm::OnInquiryResult(bluetooth::hci::InquiryResultView view) { void Btm::OnInquiryResultWithRssi( bluetooth::hci::InquiryResultWithRssiView view) { - for (auto& response : view.GetInquiryResults()) { + for (auto& response : view.GetResponses()) { btm_api_process_inquiry_result_with_rssi( ToRawAddress(response.address_), static_cast<uint8_t>(response.page_scan_repetition_mode_), diff --git a/tools/rootcanal/model/controller/link_layer_controller.cc b/tools/rootcanal/model/controller/link_layer_controller.cc index b4764cb6bdd83a217ebf7452614eadfbf21a5e7c..655dcd0a8734aa09fc3cf71dc5b4f8c07e5b1d42 100644 --- a/tools/rootcanal/model/controller/link_layer_controller.cc +++ b/tools/rootcanal/model/controller/link_layer_controller.cc @@ -799,7 +799,7 @@ void LinkLayerController::IncomingInquiryResponsePacket( (bluetooth::hci::PageScanRepetitionMode) inquiry_response.GetPageScanRepetitionMode(); - std::vector<bluetooth::hci::InquiryResult> responses; + std::vector<bluetooth::hci::InquiryResponse> responses; responses.emplace_back(); responses.back().bd_addr_ = inquiry_response.GetSourceAddress(); responses.back().page_scan_repetition_mode_ = page_scan_repetition_mode; @@ -820,7 +820,7 @@ void LinkLayerController::IncomingInquiryResponsePacket( (bluetooth::hci::PageScanRepetitionMode) inquiry_response.GetPageScanRepetitionMode(); - std::vector<bluetooth::hci::InquiryResultWithRssi> responses; + std::vector<bluetooth::hci::InquiryResponseWithRssi> responses; responses.emplace_back(); responses.back().address_ = inquiry_response.GetSourceAddress(); responses.back().page_scan_repetition_mode_ = page_scan_repetition_mode; @@ -1825,7 +1825,7 @@ void LinkLayerController::IncomingLeScanResponsePacket( if (adv_type != model::packets::AdvertisementType::SCAN_RESPONSE) { return; } - bluetooth::hci::LeAdvertisingReportRaw report; + bluetooth::hci::LeAdvertisingResponseRaw report; report.event_type_ = bluetooth::hci::AdvertisingEventType::SCAN_RESPONSE; report.address_ = incoming.GetSourceAddress(); report.address_type_ = @@ -1845,7 +1845,7 @@ void LinkLayerController::IncomingLeScanResponsePacket( properties_.IsUnmasked(EventCode::LE_META_EVENT) && properties_.GetLeEventSupported( bluetooth::hci::SubeventCode::EXTENDED_ADVERTISING_REPORT)) { - bluetooth::hci::LeExtendedAdvertisingReport report{}; + bluetooth::hci::LeExtendedAdvertisingResponse report{}; report.address_ = incoming.GetSourceAddress(); report.address_type_ = static_cast<bluetooth::hci::DirectAdvertisingAddressType>(address_type);