Loading system/gd/hal/hci_hal.h +4 −4 Original line number Diff line number Diff line Loading @@ -63,16 +63,16 @@ class HciHal : public ::bluetooth::Module { virtual ~HciHal() = default; // Register the callback for incoming packets. All incoming packets are dropped before // this callback is registered. Callback can only be registered once, but will be reset // after close(). // // Call this function before initialize() to guarantee all incoming packets are received. // this callback is registered. Callback can only be registered once. // // @param callback implements BluetoothHciHalCallbacks which will // receive callbacks when incoming HCI packets are received // from the controller to be sent to the host. virtual void registerIncomingPacketCallback(HciHalCallbacks* callback) = 0; // Unregister the callback for incoming packets. Drop all further incoming packets. virtual void unregisterIncomingPacketCallback() = 0; // Send an HCI command (as specified in the Bluetooth Specification // V4.2, Vol 2, Part 5, Section 5.4.1) to the Bluetooth controller. // Commands must be executed in order. Loading system/gd/hal/hci_hal_android_hidl.cc +4 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ class HciHalHidl : public HciHal { callbacks_->SetCallback(callback); } void unregisterIncomingPacketCallback() override { callbacks_->ResetCallback(); } void sendHciCommand(HciPacket command) override { btsnoop_logger_->capture(command, SnoopLogger::Direction::OUTGOING, SnoopLogger::PacketType::CMD); bt_hci_->sendHciCommand(command); Loading system/gd/hal/hci_hal_host_rootcanal.cc +9 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ class HciHalHostRootcanal : public HciHal { incoming_packet_callback_ = callback; } void unregisterIncomingPacketCallback() override { std::lock_guard<std::mutex> lock(mutex_); incoming_packet_callback_ = nullptr; } void sendHciCommand(HciPacket command) override { std::lock_guard<std::mutex> lock(mutex_); ASSERT(sock_fd_ != INVALID_FD); Loading Loading @@ -190,7 +195,10 @@ class HciHalHostRootcanal : public HciHal { } void incoming_packet_received() { ASSERT(incoming_packet_callback_ != nullptr); if (incoming_packet_callback_ == nullptr) { LOG_INFO("Dropping a packet"); return; } uint8_t buf[kBufSize] = {}; Loading system/gd/hal/hci_hal_host_rootcanal_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ class HciHalRootcanalTest : public ::testing::Test { } void TearDown() override { hal_->unregisterIncomingPacketCallback(); fake_registry_.StopAll(); close(fake_server_socket_); delete fake_server_; Loading system/gd/hci/hci_layer.cc +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ struct HciLayer::impl : public hal::HciHalCallbacks { } void Stop() { hal_->unregisterIncomingPacketCallback(); acl_queue_.GetDownEnd()->UnregisterDequeue(); delete hci_timeout_alarm_; command_queue_.clear(); Loading Loading
system/gd/hal/hci_hal.h +4 −4 Original line number Diff line number Diff line Loading @@ -63,16 +63,16 @@ class HciHal : public ::bluetooth::Module { virtual ~HciHal() = default; // Register the callback for incoming packets. All incoming packets are dropped before // this callback is registered. Callback can only be registered once, but will be reset // after close(). // // Call this function before initialize() to guarantee all incoming packets are received. // this callback is registered. Callback can only be registered once. // // @param callback implements BluetoothHciHalCallbacks which will // receive callbacks when incoming HCI packets are received // from the controller to be sent to the host. virtual void registerIncomingPacketCallback(HciHalCallbacks* callback) = 0; // Unregister the callback for incoming packets. Drop all further incoming packets. virtual void unregisterIncomingPacketCallback() = 0; // Send an HCI command (as specified in the Bluetooth Specification // V4.2, Vol 2, Part 5, Section 5.4.1) to the Bluetooth controller. // Commands must be executed in order. Loading
system/gd/hal/hci_hal_android_hidl.cc +4 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ class HciHalHidl : public HciHal { callbacks_->SetCallback(callback); } void unregisterIncomingPacketCallback() override { callbacks_->ResetCallback(); } void sendHciCommand(HciPacket command) override { btsnoop_logger_->capture(command, SnoopLogger::Direction::OUTGOING, SnoopLogger::PacketType::CMD); bt_hci_->sendHciCommand(command); Loading
system/gd/hal/hci_hal_host_rootcanal.cc +9 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ class HciHalHostRootcanal : public HciHal { incoming_packet_callback_ = callback; } void unregisterIncomingPacketCallback() override { std::lock_guard<std::mutex> lock(mutex_); incoming_packet_callback_ = nullptr; } void sendHciCommand(HciPacket command) override { std::lock_guard<std::mutex> lock(mutex_); ASSERT(sock_fd_ != INVALID_FD); Loading Loading @@ -190,7 +195,10 @@ class HciHalHostRootcanal : public HciHal { } void incoming_packet_received() { ASSERT(incoming_packet_callback_ != nullptr); if (incoming_packet_callback_ == nullptr) { LOG_INFO("Dropping a packet"); return; } uint8_t buf[kBufSize] = {}; Loading
system/gd/hal/hci_hal_host_rootcanal_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ class HciHalRootcanalTest : public ::testing::Test { } void TearDown() override { hal_->unregisterIncomingPacketCallback(); fake_registry_.StopAll(); close(fake_server_socket_); delete fake_server_; Loading
system/gd/hci/hci_layer.cc +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ struct HciLayer::impl : public hal::HciHalCallbacks { } void Stop() { hal_->unregisterIncomingPacketCallback(); acl_queue_.GetDownEnd()->UnregisterDequeue(); delete hci_timeout_alarm_; command_queue_.clear(); Loading