Bring multi-channel transport into the glorious new age
Some devices still use MCT as their UART protocol, so
we need to bring it forward to the fresh new HAL.
Also, adding tests for H4 while I'm here.
Test: new unit tests pass and a device using MCT now
boots BT again \o/
Fixes: 34992730
Change-Id: Idb8e536a2779929ad8a0d4bac492c3011995cd79
diff --git a/bluetooth/1.0/default/vendor_interface.h b/bluetooth/1.0/default/vendor_interface.h
index 8115640..a401ee6 100644
--- a/bluetooth/1.0/default/vendor_interface.h
+++ b/bluetooth/1.0/default/vendor_interface.h
@@ -20,7 +20,7 @@
#include "async_fd_watcher.h"
#include "bt_vendor_lib.h"
-#include "hci_packetizer.h"
+#include "hci_protocol.h"
namespace android {
namespace hardware {
@@ -30,15 +30,15 @@
using ::android::hardware::hidl_vec;
using InitializeCompleteCallback = std::function<void(bool success)>;
-using PacketReadCallback =
- std::function<void(HciPacketType, const hidl_vec<uint8_t> &)>;
+using PacketReadCallback = std::function<void(const hidl_vec<uint8_t>&)>;
class FirmwareStartupTimer;
class VendorInterface {
public:
static bool Initialize(InitializeCompleteCallback initialize_complete_cb,
- PacketReadCallback packet_read_cb);
+ PacketReadCallback event_cb, PacketReadCallback acl_cb,
+ PacketReadCallback sco_cb);
static void Shutdown();
static VendorInterface *get();
@@ -46,27 +46,25 @@
void OnFirmwareConfigured(uint8_t result);
- static void OnPacketReady();
-
private:
virtual ~VendorInterface() = default;
bool Open(InitializeCompleteCallback initialize_complete_cb,
- PacketReadCallback packet_read_cb);
+ PacketReadCallback event_cb, PacketReadCallback acl_cb,
+ PacketReadCallback sco_cb);
void Close();
void OnTimeout();
- void HandleIncomingPacket();
+ void HandleIncomingEvent(const hidl_vec<uint8_t>& hci_packet);
void *lib_handle_;
bt_vendor_interface_t *lib_interface_;
async::AsyncFdWatcher fd_watcher_;
- int uart_fd_;
- PacketReadCallback packet_read_cb_;
InitializeCompleteCallback initialize_complete_cb_;
+ hci::HciProtocol* hci_;
- hci::HciPacketizer hci_packetizer_ {VendorInterface::OnPacketReady};
+ PacketReadCallback event_cb_;
FirmwareStartupTimer *firmware_startup_timer_;
};