Loading system/gd/hci/controller.cc +19 −31 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <utility> #include "common/init_flags.h" #include "hci/event_checkers.h" #include "hci/hci_layer.h" #include "hci_controller_generated.h" #include "os/metrics.h" Loading Loading @@ -589,8 +590,9 @@ struct Controller::impl { void set_event_mask(uint64_t event_mask) { std::unique_ptr<SetEventMaskBuilder> packet = SetEventMaskBuilder::Create(event_mask); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<SetEventMaskCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<SetEventMaskCompleteView>)); } void write_le_host_support(Enable enable, Enable deprecated_host_bit) { Loading @@ -601,20 +603,20 @@ struct Controller::impl { std::unique_ptr<WriteLeHostSupportBuilder> packet = WriteLeHostSupportBuilder::Create(enable, deprecated_host_bit); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteLeHostSupportCompleteView>)); module_.GetHandler()->BindOnce(check_complete<WriteLeHostSupportCompleteView>)); } void write_simple_pairing_mode(Enable enable) { std::unique_ptr<WriteSimplePairingModeBuilder> packet = WriteSimplePairingModeBuilder::Create(enable); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteSimplePairingModeCompleteView>)); module_.GetHandler()->BindOnce(check_complete<WriteSimplePairingModeCompleteView>)); } void reset() { std::unique_ptr<ResetBuilder> packet = ResetBuilder::Create(); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<ResetCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<ResetCompleteView>)); } void le_rand(LeRandCallback cb) { Loading @@ -635,8 +637,9 @@ struct Controller::impl { } void set_event_filter(std::unique_ptr<SetEventFilterBuilder> packet) { hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<SetEventFilterCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<SetEventFilterCompleteView>)); } void write_local_name(std::string local_name) { Loading @@ -647,8 +650,9 @@ struct Controller::impl { std::copy(std::begin(local_name), std::end(local_name), std::begin(local_name_array)); std::unique_ptr<WriteLocalNameBuilder> packet = WriteLocalNameBuilder::Create(local_name_array); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<WriteLocalNameCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<WriteLocalNameCompleteView>)); } void host_buffer_size(uint16_t host_acl_data_packet_length, uint8_t host_synchronous_data_packet_length, Loading @@ -656,32 +660,16 @@ struct Controller::impl { std::unique_ptr<HostBufferSizeBuilder> packet = HostBufferSizeBuilder::Create(host_acl_data_packet_length, host_synchronous_data_packet_length, host_total_num_acl_data_packets, host_total_num_synchronous_data_packets); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<HostBufferSizeCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<HostBufferSizeCompleteView>)); } void le_set_event_mask(uint64_t le_event_mask) { std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_le_set_event_mask_status)); } void check_le_set_event_mask_status(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = LeSetEventMaskCompleteView::Create(view); ASSERT(status_view.IsValid()); auto status = status_view.GetStatus(); if (status != ErrorCode::SUCCESS) { LOG_WARN("Unexpected return status %s", ErrorCodeText(status).c_str()); } } template <class T> void check_status(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); ASSERT(status_view.IsValid()); ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS); std::move(packet), module_.GetHandler()->BindOnce(check_complete<LeSetEventMaskCompleteView>)); } #define OP_CODE_MAPPING(name) \ Loading Loading
system/gd/hci/controller.cc +19 −31 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <utility> #include "common/init_flags.h" #include "hci/event_checkers.h" #include "hci/hci_layer.h" #include "hci_controller_generated.h" #include "os/metrics.h" Loading Loading @@ -589,8 +590,9 @@ struct Controller::impl { void set_event_mask(uint64_t event_mask) { std::unique_ptr<SetEventMaskBuilder> packet = SetEventMaskBuilder::Create(event_mask); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<SetEventMaskCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<SetEventMaskCompleteView>)); } void write_le_host_support(Enable enable, Enable deprecated_host_bit) { Loading @@ -601,20 +603,20 @@ struct Controller::impl { std::unique_ptr<WriteLeHostSupportBuilder> packet = WriteLeHostSupportBuilder::Create(enable, deprecated_host_bit); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteLeHostSupportCompleteView>)); module_.GetHandler()->BindOnce(check_complete<WriteLeHostSupportCompleteView>)); } void write_simple_pairing_mode(Enable enable) { std::unique_ptr<WriteSimplePairingModeBuilder> packet = WriteSimplePairingModeBuilder::Create(enable); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteSimplePairingModeCompleteView>)); module_.GetHandler()->BindOnce(check_complete<WriteSimplePairingModeCompleteView>)); } void reset() { std::unique_ptr<ResetBuilder> packet = ResetBuilder::Create(); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<ResetCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<ResetCompleteView>)); } void le_rand(LeRandCallback cb) { Loading @@ -635,8 +637,9 @@ struct Controller::impl { } void set_event_filter(std::unique_ptr<SetEventFilterBuilder> packet) { hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<SetEventFilterCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<SetEventFilterCompleteView>)); } void write_local_name(std::string local_name) { Loading @@ -647,8 +650,9 @@ struct Controller::impl { std::copy(std::begin(local_name), std::end(local_name), std::begin(local_name_array)); std::unique_ptr<WriteLocalNameBuilder> packet = WriteLocalNameBuilder::Create(local_name_array); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<WriteLocalNameCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<WriteLocalNameCompleteView>)); } void host_buffer_size(uint16_t host_acl_data_packet_length, uint8_t host_synchronous_data_packet_length, Loading @@ -656,32 +660,16 @@ struct Controller::impl { std::unique_ptr<HostBufferSizeBuilder> packet = HostBufferSizeBuilder::Create(host_acl_data_packet_length, host_synchronous_data_packet_length, host_total_num_acl_data_packets, host_total_num_synchronous_data_packets); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( this, &Controller::impl::check_status<HostBufferSizeCompleteView>)); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnce(check_complete<HostBufferSizeCompleteView>)); } void le_set_event_mask(uint64_t le_event_mask) { std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_le_set_event_mask_status)); } void check_le_set_event_mask_status(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = LeSetEventMaskCompleteView::Create(view); ASSERT(status_view.IsValid()); auto status = status_view.GetStatus(); if (status != ErrorCode::SUCCESS) { LOG_WARN("Unexpected return status %s", ErrorCodeText(status).c_str()); } } template <class T> void check_status(CommandCompleteView view) { ASSERT(view.IsValid()); auto status_view = T::Create(view); ASSERT(status_view.IsValid()); ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS); std::move(packet), module_.GetHandler()->BindOnce(check_complete<LeSetEventMaskCompleteView>)); } #define OP_CODE_MAPPING(name) \ Loading