bluetooth: Add initialization completed callback
Test: bluetooth_hidl_hal_test
Bug: 31972505
Change-Id: I64c19a7fe7299079c5daf74e7b238b0d71d65db2
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index d12bfb9..1559119 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -30,12 +30,16 @@
static const uint8_t HCI_DATA_TYPE_ACL = 2;
static const uint8_t HCI_DATA_TYPE_SCO = 3;
-Return<Status> BluetoothHci::initialize(
+Return<void> BluetoothHci::initialize(
const ::android::sp<IBluetoothHciCallbacks>& cb) {
ALOGW("BluetoothHci::initialize()");
event_cb_ = cb;
bool rc = VendorInterface::Initialize(
+ [this](bool status) {
+ event_cb_->initializationComplete(
+ status ? Status::SUCCESS : Status::INITIALIZATION_ERROR);
+ },
[this](HciPacketType type, const hidl_vec<uint8_t>& packet) {
switch (type) {
case HCI_PACKET_TYPE_EVENT:
@@ -52,9 +56,8 @@
break;
}
});
- if (!rc) return Status::INITIALIZATION_ERROR;
-
- return Status::SUCCESS;
+ if (!rc) event_cb_->initializationComplete(Status::INITIALIZATION_ERROR);
+ return Void();
}
Return<void> BluetoothHci::close() {