summaryrefslogtreecommitdiff
path: root/bluetooth/bluetooth_hci.cc
diff options
context:
space:
mode:
Diffstat (limited to 'bluetooth/bluetooth_hci.cc')
-rw-r--r--bluetooth/bluetooth_hci.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/bluetooth/bluetooth_hci.cc b/bluetooth/bluetooth_hci.cc
index fa14b539..fe2b782b 100644
--- a/bluetooth/bluetooth_hci.cc
+++ b/bluetooth/bluetooth_hci.cc
@@ -32,6 +32,9 @@ namespace hikey {
using android::hardware::hidl_vec;
+BluetoothHci::BluetoothHci()
+ : deathRecipient(new BluetoothDeathRecipient(this)) {}
+
Return<void> BluetoothHci::initialize(
const ::android::sp<IBluetoothHciCallbacks>& cb) {
ALOGI("BluetoothHci::initialize()");
@@ -44,6 +47,7 @@ Return<void> BluetoothHci::initialize(
}
event_cb_ = cb;
+ event_cb_->linkToDeath(deathRecipient, 0);
hci_ = new hci::H4Protocol(
hci_tty_fd_,
@@ -88,6 +92,8 @@ Return<void> BluetoothHci::close() {
hci_tty_fd_ = -1;
}
+ event_cb_->unlinkToDeath(deathRecipient);
+
if (hci_ != nullptr) {
delete hci_;
hci_ = nullptr;