Loading system/gd/hci/acl_manager/le_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -1045,7 +1045,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { auto complete_view = LeSetDefaultSubrateCompleteView::Create(complete); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status = %s", ErrorCodeText(status).c_str()); })); } Loading system/gd/hci/address_with_type_test.cc +1 −1 Original line number Diff line number Diff line Loading @@ -307,7 +307,7 @@ TEST(AddressWithTypeTest, StringStream) { std::stringstream oss; oss << address_with_type; ASSERT_STREQ("66:55:44:33:22:11[PUBLIC_DEVICE_ADDRESS]", oss.str().c_str()); ASSERT_STREQ("66:55:44:33:22:11[PUBLIC_DEVICE_ADDRESS(0x00)]", oss.str().c_str()); } } // namespace hci Loading system/gd/hci/controller.cc +21 −22 Original line number Diff line number Diff line Loading @@ -279,14 +279,14 @@ struct Controller::impl { auto complete_view = WriteSecureConnectionsHostSupportCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void read_local_name_complete_handler(CommandCompleteView view) { auto complete_view = ReadLocalNameCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); std::array<uint8_t, 248> local_name_array = complete_view.GetLocalName(); local_name_ = std::string(local_name_array.begin(), local_name_array.end()); Loading @@ -298,7 +298,7 @@ struct Controller::impl { auto complete_view = ReadLocalVersionInformationCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_version_information_ = complete_view.GetLocalVersionInformation(); bluetooth::os::LogMetricBluetoothLocalVersions( Loading @@ -313,7 +313,7 @@ struct Controller::impl { auto complete_view = ReadLocalSupportedCommandsCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_supported_commands_ = complete_view.GetSupportedCommands(); } Loading @@ -321,7 +321,7 @@ struct Controller::impl { auto complete_view = ReadLocalExtendedFeaturesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); uint8_t page_number = complete_view.GetPageNumber(); extended_lmp_features_array_.push_back(complete_view.GetExtendedLmpFeatures()); bluetooth::os::LogMetricBluetoothLocalSupportedFeatures(page_number, complete_view.GetExtendedLmpFeatures()); Loading @@ -341,7 +341,7 @@ struct Controller::impl { auto complete_view = ReadBufferSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); acl_buffer_length_ = complete_view.GetAclDataPacketLength(); acl_buffers_ = complete_view.GetTotalNumAclDataPackets(); Loading @@ -353,7 +353,7 @@ struct Controller::impl { auto complete_view = ReadBdAddrCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); mac_address_ = complete_view.GetBdAddr(); promise.set_value(); } Loading @@ -362,7 +362,7 @@ struct Controller::impl { auto complete_view = LeReadBufferSizeV1CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_buffer_size_ = complete_view.GetLeBufferSize(); // If LE buffer size is zero, then buffers returned by Read_Buffer_Size are shared between BR/EDR and LE. Loading @@ -378,8 +378,7 @@ struct Controller::impl { auto complete_view = ReadLocalSupportedCodecsV1CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG( status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_supported_codec_ids_ = complete_view.GetSupportedCodecs(); local_supported_vendor_codec_ids_ = complete_view.GetVendorSpecificCodecs(); } Loading @@ -388,14 +387,14 @@ struct Controller::impl { auto complete_view = SetMinEncryptionKeySizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void le_read_buffer_size_v2_handler(CommandCompleteView view) { auto complete_view = LeReadBufferSizeV2CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_buffer_size_ = complete_view.GetLeBufferSize(); iso_buffer_size_ = complete_view.GetIsoBufferSize(); Loading @@ -412,7 +411,7 @@ struct Controller::impl { auto complete_view = LeSetHostFeatureCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void read_default_erroneous_data_reporting_handler(CommandCompleteView view) { Loading Loading @@ -475,7 +474,7 @@ struct Controller::impl { auto complete_view = LeReadLocalSupportedFeaturesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_local_supported_features_ = complete_view.GetLeFeatures(); } Loading @@ -483,7 +482,7 @@ struct Controller::impl { auto complete_view = LeReadSupportedStatesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_supported_states_ = complete_view.GetLeStates(); } Loading @@ -491,7 +490,7 @@ struct Controller::impl { auto complete_view = LeReadFilterAcceptListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_accept_list_size_ = complete_view.GetFilterAcceptListSize(); } Loading @@ -499,7 +498,7 @@ struct Controller::impl { auto complete_view = LeReadResolvingListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_resolving_list_size_ = complete_view.GetResolvingListSize(); } Loading @@ -507,7 +506,7 @@ struct Controller::impl { auto complete_view = LeReadMaximumDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_maximum_data_length_ = complete_view.GetLeMaximumDataLength(); } Loading @@ -515,7 +514,7 @@ struct Controller::impl { auto complete_view = LeReadSuggestedDefaultDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_suggested_default_data_length_ = complete_view.GetTxOctets(); } Loading @@ -523,7 +522,7 @@ struct Controller::impl { auto complete_view = LeReadMaximumAdvertisingDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_maximum_advertising_data_length_ = complete_view.GetMaximumAdvertisingDataLength(); } Loading @@ -531,7 +530,7 @@ struct Controller::impl { auto complete_view = LeReadNumberOfSupportedAdvertisingSetsCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_number_supported_advertising_sets_ = complete_view.GetNumberSupportedAdvertisingSets(); } Loading @@ -539,7 +538,7 @@ struct Controller::impl { auto complete_view = LeReadPeriodicAdvertiserListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_periodic_advertiser_list_size_ = complete_view.GetPeriodicAdvertiserListSize(); } Loading system/gd/hci/event_checkers.h +4 −6 Original line number Diff line number Diff line Loading @@ -29,14 +29,13 @@ void check_complete(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); if (!status_view.IsValid()) { log::error("Invalid packet, opcode 0x{:02x}", view.GetCommandOpCode()); log::error("Invalid packet, opcode {}", OpCodeText(view.GetCommandOpCode())); return; } ErrorCode status = status_view.GetStatus(); OpCode op_code = status_view.GetCommandOpCode(); if (status != ErrorCode::SUCCESS) { std::string error_code = ErrorCodeText(status); log::error("Error code {}, opcode 0x{:02x}", error_code, op_code); log::error("Error code {}, opcode {}", ErrorCodeText(status), OpCodeText(op_code)); return; } } Loading @@ -46,14 +45,13 @@ void check_status(CommandStatusView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); if (!status_view.IsValid()) { log::error("Invalid packet, opcode 0x{:02x}", view.GetCommandOpCode()); log::error("Invalid packet, opcode {}", OpCodeText(view.GetCommandOpCode())); return; } ErrorCode status = status_view.GetStatus(); OpCode op_code = status_view.GetCommandOpCode(); if (status != ErrorCode::SUCCESS) { std::string error_code = ErrorCodeText(status); log::error("Error code {}, opcode 0x{:02x}", error_code, op_code); log::error("Error code {}, opcode {}", ErrorCodeText(status), OpCodeText(op_code)); return; } } Loading system/gd/hci/hci_layer.cc +13 −27 Original line number Diff line number Diff line Loading @@ -166,9 +166,8 @@ struct HciLayer::impl { ErrorCode status = response_view.GetStatus(); if (status != ErrorCode::SUCCESS) { log::error( "Received UNEXPECTED command status:{} opcode:0x{:02x} ({})", "Received UNEXPECTED command status:{} opcode:{}", ErrorCodeText(status), op_code, OpCodeText(op_code)); } handle_command_response<CommandStatusView>(event, "status"); Loading @@ -192,22 +191,18 @@ struct HciLayer::impl { ASSERT_LOG( !command_queue_.empty(), "Unexpected %s event with OpCode 0x%02hx (%s)", "Unexpected %s event with OpCode (%s)", logging_id.c_str(), op_code, OpCodeText(op_code).c_str()); if (waiting_command_ == OpCode::CONTROLLER_DEBUG_INFO && op_code != OpCode::CONTROLLER_DEBUG_INFO) { log::error( "Discarding event that came after timeout 0x{:02x} ({})", op_code, OpCodeText(op_code)); log::error("Discarding event that came after timeout {}", OpCodeText(op_code)); common::StopWatch::DumpStopWatchLog(); return; } ASSERT_LOG( waiting_command_ == op_code, "Waiting for 0x%02hx (%s), got 0x%02hx (%s)", waiting_command_, "Waiting for %s, got %s", OpCodeText(waiting_command_).c_str(), op_code, OpCodeText(op_code).c_str()); bool is_vendor_specific = static_cast<int>(op_code) & (0x3f << 10); Loading @@ -234,8 +229,7 @@ struct HciLayer::impl { } else { ASSERT_LOG( command_queue_.front().waiting_for_status_ == is_status, "0x%02hx (%s) was not expecting %s event", op_code, "%s was not expecting %s event", OpCodeText(op_code).c_str(), logging_id.c_str()); Loading Loading @@ -270,7 +264,7 @@ struct HciLayer::impl { void on_hci_timeout(OpCode op_code) { common::StopWatch::DumpStopWatchLog(); log::error("Timed out waiting for 0x{:02x} ({})", op_code, OpCodeText(op_code)); log::error("Timed out waiting for {}", OpCodeText(op_code)); bluetooth::os::LogMetricHciTimeoutEvent(static_cast<uint32_t>(op_code)); Loading Loading @@ -329,8 +323,7 @@ struct HciLayer::impl { void register_event(EventCode event, ContextualCallback<void(EventView)> handler) { ASSERT_LOG( event != EventCode::LE_META_EVENT, "Can not register handler for %02hhx (%s)", EventCode::LE_META_EVENT, "Can not register handler for %s", EventCodeText(EventCode::LE_META_EVENT).c_str()); // Allow GD Cert tests to register for CONNECTION_REQUEST if (event == EventCode::CONNECTION_REQUEST && module_.on_acl_connection_request_.IsEmpty()) { Loading @@ -339,8 +332,7 @@ struct HciLayer::impl { } ASSERT_LOG( event_handlers_.count(event) == 0, "Can not register a second handler for %02hhx (%s)", event, "Can not register a second handler for %s", EventCodeText(event).c_str()); event_handlers_[event] = handler; } Loading @@ -352,8 +344,7 @@ struct HciLayer::impl { void register_le_event(SubeventCode event, ContextualCallback<void(LeMetaEventView)> handler) { ASSERT_LOG( subevent_handlers_.count(event) == 0, "Can not register a second handler for %02hhx (%s)", event, "Can not register a second handler for %s", SubeventCodeText(event).c_str()); subevent_handlers_[event] = handler; } Loading Loading @@ -397,10 +388,9 @@ struct HciLayer::impl { auto op_code = view.GetCommandOpCode(); ASSERT_LOG( op_code == OpCode::NONE, "Received %s event with OpCode 0x%02hx (%s) without a waiting command" "Received %s event with OpCode %s without a waiting command" "(is the HAL sending commands, but not handling the events?)", EventCodeText(event_code).c_str(), op_code, OpCodeText(op_code).c_str()); } if (event_code == EventCode::COMMAND_STATUS) { Loading @@ -409,10 +399,9 @@ struct HciLayer::impl { auto op_code = view.GetCommandOpCode(); ASSERT_LOG( op_code == OpCode::NONE, "Received %s event with OpCode 0x%02hx (%s) without a waiting command" "Received %s event with OpCode %s without a waiting command" "(is the HAL sending commands, but not handling the events?)", EventCodeText(event_code).c_str(), op_code, OpCodeText(op_code).c_str()); } std::unique_ptr<CommandView> no_waiting_command{nullptr}; Loading Loading @@ -450,7 +439,7 @@ struct HciLayer::impl { break; default: if (event_handlers_.find(event_code) == event_handlers_.end()) { log::warn("Unhandled event of type 0x{:02x} ({})", event_code, EventCodeText(event_code)); log::warn("Unhandled event of type {}", EventCodeText(event_code)); } else { event_handlers_[event_code].Invoke(event); } Loading @@ -476,10 +465,7 @@ struct HciLayer::impl { ASSERT(meta_event_view.IsValid()); SubeventCode subevent_code = meta_event_view.GetSubeventCode(); if (subevent_handlers_.find(subevent_code) == subevent_handlers_.end()) { log::warn( "Unhandled le subevent of type 0x{:02x} ({})", subevent_code, SubeventCodeText(subevent_code)); log::warn("Unhandled le subevent of type {}", SubeventCodeText(subevent_code)); return; } subevent_handlers_[subevent_code].Invoke(meta_event_view); Loading Loading
system/gd/hci/acl_manager/le_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -1045,7 +1045,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { auto complete_view = LeSetDefaultSubrateCompleteView::Create(complete); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status = %s", ErrorCodeText(status).c_str()); })); } Loading
system/gd/hci/address_with_type_test.cc +1 −1 Original line number Diff line number Diff line Loading @@ -307,7 +307,7 @@ TEST(AddressWithTypeTest, StringStream) { std::stringstream oss; oss << address_with_type; ASSERT_STREQ("66:55:44:33:22:11[PUBLIC_DEVICE_ADDRESS]", oss.str().c_str()); ASSERT_STREQ("66:55:44:33:22:11[PUBLIC_DEVICE_ADDRESS(0x00)]", oss.str().c_str()); } } // namespace hci Loading
system/gd/hci/controller.cc +21 −22 Original line number Diff line number Diff line Loading @@ -279,14 +279,14 @@ struct Controller::impl { auto complete_view = WriteSecureConnectionsHostSupportCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void read_local_name_complete_handler(CommandCompleteView view) { auto complete_view = ReadLocalNameCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); std::array<uint8_t, 248> local_name_array = complete_view.GetLocalName(); local_name_ = std::string(local_name_array.begin(), local_name_array.end()); Loading @@ -298,7 +298,7 @@ struct Controller::impl { auto complete_view = ReadLocalVersionInformationCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_version_information_ = complete_view.GetLocalVersionInformation(); bluetooth::os::LogMetricBluetoothLocalVersions( Loading @@ -313,7 +313,7 @@ struct Controller::impl { auto complete_view = ReadLocalSupportedCommandsCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_supported_commands_ = complete_view.GetSupportedCommands(); } Loading @@ -321,7 +321,7 @@ struct Controller::impl { auto complete_view = ReadLocalExtendedFeaturesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); uint8_t page_number = complete_view.GetPageNumber(); extended_lmp_features_array_.push_back(complete_view.GetExtendedLmpFeatures()); bluetooth::os::LogMetricBluetoothLocalSupportedFeatures(page_number, complete_view.GetExtendedLmpFeatures()); Loading @@ -341,7 +341,7 @@ struct Controller::impl { auto complete_view = ReadBufferSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); acl_buffer_length_ = complete_view.GetAclDataPacketLength(); acl_buffers_ = complete_view.GetTotalNumAclDataPackets(); Loading @@ -353,7 +353,7 @@ struct Controller::impl { auto complete_view = ReadBdAddrCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); mac_address_ = complete_view.GetBdAddr(); promise.set_value(); } Loading @@ -362,7 +362,7 @@ struct Controller::impl { auto complete_view = LeReadBufferSizeV1CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_buffer_size_ = complete_view.GetLeBufferSize(); // If LE buffer size is zero, then buffers returned by Read_Buffer_Size are shared between BR/EDR and LE. Loading @@ -378,8 +378,7 @@ struct Controller::impl { auto complete_view = ReadLocalSupportedCodecsV1CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG( status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); local_supported_codec_ids_ = complete_view.GetSupportedCodecs(); local_supported_vendor_codec_ids_ = complete_view.GetVendorSpecificCodecs(); } Loading @@ -388,14 +387,14 @@ struct Controller::impl { auto complete_view = SetMinEncryptionKeySizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void le_read_buffer_size_v2_handler(CommandCompleteView view) { auto complete_view = LeReadBufferSizeV2CompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_buffer_size_ = complete_view.GetLeBufferSize(); iso_buffer_size_ = complete_view.GetIsoBufferSize(); Loading @@ -412,7 +411,7 @@ struct Controller::impl { auto complete_view = LeSetHostFeatureCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); } void read_default_erroneous_data_reporting_handler(CommandCompleteView view) { Loading Loading @@ -475,7 +474,7 @@ struct Controller::impl { auto complete_view = LeReadLocalSupportedFeaturesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_local_supported_features_ = complete_view.GetLeFeatures(); } Loading @@ -483,7 +482,7 @@ struct Controller::impl { auto complete_view = LeReadSupportedStatesCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_supported_states_ = complete_view.GetLeStates(); } Loading @@ -491,7 +490,7 @@ struct Controller::impl { auto complete_view = LeReadFilterAcceptListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_accept_list_size_ = complete_view.GetFilterAcceptListSize(); } Loading @@ -499,7 +498,7 @@ struct Controller::impl { auto complete_view = LeReadResolvingListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_resolving_list_size_ = complete_view.GetResolvingListSize(); } Loading @@ -507,7 +506,7 @@ struct Controller::impl { auto complete_view = LeReadMaximumDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_maximum_data_length_ = complete_view.GetLeMaximumDataLength(); } Loading @@ -515,7 +514,7 @@ struct Controller::impl { auto complete_view = LeReadSuggestedDefaultDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_suggested_default_data_length_ = complete_view.GetTxOctets(); } Loading @@ -523,7 +522,7 @@ struct Controller::impl { auto complete_view = LeReadMaximumAdvertisingDataLengthCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_maximum_advertising_data_length_ = complete_view.GetMaximumAdvertisingDataLength(); } Loading @@ -531,7 +530,7 @@ struct Controller::impl { auto complete_view = LeReadNumberOfSupportedAdvertisingSetsCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_number_supported_advertising_sets_ = complete_view.GetNumberSupportedAdvertisingSets(); } Loading @@ -539,7 +538,7 @@ struct Controller::impl { auto complete_view = LeReadPeriodicAdvertiserListSizeCompleteView::Create(view); ASSERT(complete_view.IsValid()); ErrorCode status = complete_view.GetStatus(); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str()); ASSERT_LOG(status == ErrorCode::SUCCESS, "Status %s", ErrorCodeText(status).c_str()); le_periodic_advertiser_list_size_ = complete_view.GetPeriodicAdvertiserListSize(); } Loading
system/gd/hci/event_checkers.h +4 −6 Original line number Diff line number Diff line Loading @@ -29,14 +29,13 @@ void check_complete(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); if (!status_view.IsValid()) { log::error("Invalid packet, opcode 0x{:02x}", view.GetCommandOpCode()); log::error("Invalid packet, opcode {}", OpCodeText(view.GetCommandOpCode())); return; } ErrorCode status = status_view.GetStatus(); OpCode op_code = status_view.GetCommandOpCode(); if (status != ErrorCode::SUCCESS) { std::string error_code = ErrorCodeText(status); log::error("Error code {}, opcode 0x{:02x}", error_code, op_code); log::error("Error code {}, opcode {}", ErrorCodeText(status), OpCodeText(op_code)); return; } } Loading @@ -46,14 +45,13 @@ void check_status(CommandStatusView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); if (!status_view.IsValid()) { log::error("Invalid packet, opcode 0x{:02x}", view.GetCommandOpCode()); log::error("Invalid packet, opcode {}", OpCodeText(view.GetCommandOpCode())); return; } ErrorCode status = status_view.GetStatus(); OpCode op_code = status_view.GetCommandOpCode(); if (status != ErrorCode::SUCCESS) { std::string error_code = ErrorCodeText(status); log::error("Error code {}, opcode 0x{:02x}", error_code, op_code); log::error("Error code {}, opcode {}", ErrorCodeText(status), OpCodeText(op_code)); return; } } Loading
system/gd/hci/hci_layer.cc +13 −27 Original line number Diff line number Diff line Loading @@ -166,9 +166,8 @@ struct HciLayer::impl { ErrorCode status = response_view.GetStatus(); if (status != ErrorCode::SUCCESS) { log::error( "Received UNEXPECTED command status:{} opcode:0x{:02x} ({})", "Received UNEXPECTED command status:{} opcode:{}", ErrorCodeText(status), op_code, OpCodeText(op_code)); } handle_command_response<CommandStatusView>(event, "status"); Loading @@ -192,22 +191,18 @@ struct HciLayer::impl { ASSERT_LOG( !command_queue_.empty(), "Unexpected %s event with OpCode 0x%02hx (%s)", "Unexpected %s event with OpCode (%s)", logging_id.c_str(), op_code, OpCodeText(op_code).c_str()); if (waiting_command_ == OpCode::CONTROLLER_DEBUG_INFO && op_code != OpCode::CONTROLLER_DEBUG_INFO) { log::error( "Discarding event that came after timeout 0x{:02x} ({})", op_code, OpCodeText(op_code)); log::error("Discarding event that came after timeout {}", OpCodeText(op_code)); common::StopWatch::DumpStopWatchLog(); return; } ASSERT_LOG( waiting_command_ == op_code, "Waiting for 0x%02hx (%s), got 0x%02hx (%s)", waiting_command_, "Waiting for %s, got %s", OpCodeText(waiting_command_).c_str(), op_code, OpCodeText(op_code).c_str()); bool is_vendor_specific = static_cast<int>(op_code) & (0x3f << 10); Loading @@ -234,8 +229,7 @@ struct HciLayer::impl { } else { ASSERT_LOG( command_queue_.front().waiting_for_status_ == is_status, "0x%02hx (%s) was not expecting %s event", op_code, "%s was not expecting %s event", OpCodeText(op_code).c_str(), logging_id.c_str()); Loading Loading @@ -270,7 +264,7 @@ struct HciLayer::impl { void on_hci_timeout(OpCode op_code) { common::StopWatch::DumpStopWatchLog(); log::error("Timed out waiting for 0x{:02x} ({})", op_code, OpCodeText(op_code)); log::error("Timed out waiting for {}", OpCodeText(op_code)); bluetooth::os::LogMetricHciTimeoutEvent(static_cast<uint32_t>(op_code)); Loading Loading @@ -329,8 +323,7 @@ struct HciLayer::impl { void register_event(EventCode event, ContextualCallback<void(EventView)> handler) { ASSERT_LOG( event != EventCode::LE_META_EVENT, "Can not register handler for %02hhx (%s)", EventCode::LE_META_EVENT, "Can not register handler for %s", EventCodeText(EventCode::LE_META_EVENT).c_str()); // Allow GD Cert tests to register for CONNECTION_REQUEST if (event == EventCode::CONNECTION_REQUEST && module_.on_acl_connection_request_.IsEmpty()) { Loading @@ -339,8 +332,7 @@ struct HciLayer::impl { } ASSERT_LOG( event_handlers_.count(event) == 0, "Can not register a second handler for %02hhx (%s)", event, "Can not register a second handler for %s", EventCodeText(event).c_str()); event_handlers_[event] = handler; } Loading @@ -352,8 +344,7 @@ struct HciLayer::impl { void register_le_event(SubeventCode event, ContextualCallback<void(LeMetaEventView)> handler) { ASSERT_LOG( subevent_handlers_.count(event) == 0, "Can not register a second handler for %02hhx (%s)", event, "Can not register a second handler for %s", SubeventCodeText(event).c_str()); subevent_handlers_[event] = handler; } Loading Loading @@ -397,10 +388,9 @@ struct HciLayer::impl { auto op_code = view.GetCommandOpCode(); ASSERT_LOG( op_code == OpCode::NONE, "Received %s event with OpCode 0x%02hx (%s) without a waiting command" "Received %s event with OpCode %s without a waiting command" "(is the HAL sending commands, but not handling the events?)", EventCodeText(event_code).c_str(), op_code, OpCodeText(op_code).c_str()); } if (event_code == EventCode::COMMAND_STATUS) { Loading @@ -409,10 +399,9 @@ struct HciLayer::impl { auto op_code = view.GetCommandOpCode(); ASSERT_LOG( op_code == OpCode::NONE, "Received %s event with OpCode 0x%02hx (%s) without a waiting command" "Received %s event with OpCode %s without a waiting command" "(is the HAL sending commands, but not handling the events?)", EventCodeText(event_code).c_str(), op_code, OpCodeText(op_code).c_str()); } std::unique_ptr<CommandView> no_waiting_command{nullptr}; Loading Loading @@ -450,7 +439,7 @@ struct HciLayer::impl { break; default: if (event_handlers_.find(event_code) == event_handlers_.end()) { log::warn("Unhandled event of type 0x{:02x} ({})", event_code, EventCodeText(event_code)); log::warn("Unhandled event of type {}", EventCodeText(event_code)); } else { event_handlers_[event_code].Invoke(event); } Loading @@ -476,10 +465,7 @@ struct HciLayer::impl { ASSERT(meta_event_view.IsValid()); SubeventCode subevent_code = meta_event_view.GetSubeventCode(); if (subevent_handlers_.find(subevent_code) == subevent_handlers_.end()) { log::warn( "Unhandled le subevent of type 0x{:02x} ({})", subevent_code, SubeventCodeText(subevent_code)); log::warn("Unhandled le subevent of type {}", SubeventCodeText(subevent_code)); return; } subevent_handlers_[subevent_code].Invoke(meta_event_view); Loading