Loading system/main/shim/btm_api.cc +91 −8 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "device/include/controller.h" #include "gd/common/callback.h" #include "gd/neighbor/name.h" #include "gd/security/security_module.h" #include "main/shim/btm.h" #include "main/shim/btm_api.h" #include "main/shim/controller.h" Loading Loading @@ -230,6 +231,82 @@ void btm_api_process_extended_inquiry_result(RawAddress raw_address, } } class ShimBondListener : public bluetooth::security::ISecurityManagerListener { public: static ShimBondListener* GetInstance() { static ShimBondListener instance; return &instance; } ShimBondListener(const ShimBondListener&) = delete; ShimBondListener& operator=(const ShimBondListener&) = delete; void SetBtaCallbacks(const tBTM_APPL_INFO* bta_callbacks) { bta_callbacks_ = bta_callbacks; if (bta_callbacks->p_pin_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s pin_callback", __func__); } if (bta_callbacks->p_link_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s link_key_callback", __func__); } if (bta_callbacks->p_auth_complete_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s auth_complete_callback", __func__); } if (bta_callbacks->p_bond_cancel_cmpl_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s bond_cancel_complete_callback", __func__); } if (bta_callbacks->p_le_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_callback", __func__); } if (bta_callbacks->p_le_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_key_callback", __func__); } } void OnDeviceBonded(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnDeviceUnbonded(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnDeviceBondFailed(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnEncryptionStateChanged( bluetooth::hci::EncryptionChangeView encryption_change_view) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } private: ShimBondListener() : bta_callbacks_(nullptr) {} ~ShimBondListener() {} const tBTM_APPL_INFO* bta_callbacks_; }; tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, tBTM_CMPL_CB* p_cmpl_cb) { CHECK(p_results_cb != nullptr); Loading Loading @@ -912,34 +989,40 @@ tBTM_STATUS bluetooth::shim::BTM_SecBond(const RawAddress& bd_addr, transport, device_type); } bool bluetooth::shim::BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info) { CHECK(p_cb_info != nullptr); bool bluetooth::shim::BTM_SecRegister(const tBTM_APPL_INFO* bta_callbacks) { CHECK(bta_callbacks != nullptr); LOG_DEBUG("%s Registering security application", __func__); if (p_cb_info->p_pin_callback == nullptr) { if (bta_callbacks->p_pin_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s pin_callback", __func__); } if (p_cb_info->p_link_key_callback == nullptr) { if (bta_callbacks->p_link_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s link_key_callback", __func__); } if (p_cb_info->p_auth_complete_callback == nullptr) { if (bta_callbacks->p_auth_complete_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s auth_complete_callback", __func__); } if (p_cb_info->p_bond_cancel_cmpl_callback == nullptr) { if (bta_callbacks->p_bond_cancel_cmpl_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s bond_cancel_complete_callback", __func__); } if (p_cb_info->p_le_callback == nullptr) { if (bta_callbacks->p_le_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_callback", __func__); } if (p_cb_info->p_le_key_callback == nullptr) { if (bta_callbacks->p_le_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_key_callback", __func__); } ShimBondListener::GetInstance()->SetBtaCallbacks(bta_callbacks); bluetooth::shim::GetSecurityModule() ->GetSecurityManager() ->RegisterCallbackListener(ShimBondListener::GetInstance(), bluetooth::shim::GetGdShimHandler()); return true; } Loading Loading
system/main/shim/btm_api.cc +91 −8 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "device/include/controller.h" #include "gd/common/callback.h" #include "gd/neighbor/name.h" #include "gd/security/security_module.h" #include "main/shim/btm.h" #include "main/shim/btm_api.h" #include "main/shim/controller.h" Loading Loading @@ -230,6 +231,82 @@ void btm_api_process_extended_inquiry_result(RawAddress raw_address, } } class ShimBondListener : public bluetooth::security::ISecurityManagerListener { public: static ShimBondListener* GetInstance() { static ShimBondListener instance; return &instance; } ShimBondListener(const ShimBondListener&) = delete; ShimBondListener& operator=(const ShimBondListener&) = delete; void SetBtaCallbacks(const tBTM_APPL_INFO* bta_callbacks) { bta_callbacks_ = bta_callbacks; if (bta_callbacks->p_pin_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s pin_callback", __func__); } if (bta_callbacks->p_link_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s link_key_callback", __func__); } if (bta_callbacks->p_auth_complete_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s auth_complete_callback", __func__); } if (bta_callbacks->p_bond_cancel_cmpl_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s bond_cancel_complete_callback", __func__); } if (bta_callbacks->p_le_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_callback", __func__); } if (bta_callbacks->p_le_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_key_callback", __func__); } } void OnDeviceBonded(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnDeviceUnbonded(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnDeviceBondFailed(bluetooth::hci::AddressWithType device) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } void OnEncryptionStateChanged( bluetooth::hci::EncryptionChangeView encryption_change_view) override { if (bta_callbacks_->p_sp_callback) { // SP_CBACK (what events?) // link key notification // auth complete } } private: ShimBondListener() : bta_callbacks_(nullptr) {} ~ShimBondListener() {} const tBTM_APPL_INFO* bta_callbacks_; }; tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, tBTM_CMPL_CB* p_cmpl_cb) { CHECK(p_results_cb != nullptr); Loading Loading @@ -912,34 +989,40 @@ tBTM_STATUS bluetooth::shim::BTM_SecBond(const RawAddress& bd_addr, transport, device_type); } bool bluetooth::shim::BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info) { CHECK(p_cb_info != nullptr); bool bluetooth::shim::BTM_SecRegister(const tBTM_APPL_INFO* bta_callbacks) { CHECK(bta_callbacks != nullptr); LOG_DEBUG("%s Registering security application", __func__); if (p_cb_info->p_pin_callback == nullptr) { if (bta_callbacks->p_pin_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s pin_callback", __func__); } if (p_cb_info->p_link_key_callback == nullptr) { if (bta_callbacks->p_link_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s link_key_callback", __func__); } if (p_cb_info->p_auth_complete_callback == nullptr) { if (bta_callbacks->p_auth_complete_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s auth_complete_callback", __func__); } if (p_cb_info->p_bond_cancel_cmpl_callback == nullptr) { if (bta_callbacks->p_bond_cancel_cmpl_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s bond_cancel_complete_callback", __func__); } if (p_cb_info->p_le_callback == nullptr) { if (bta_callbacks->p_le_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_callback", __func__); } if (p_cb_info->p_le_key_callback == nullptr) { if (bta_callbacks->p_le_key_callback == nullptr) { LOG_INFO("UNIMPLEMENTED %s le_key_callback", __func__); } ShimBondListener::GetInstance()->SetBtaCallbacks(bta_callbacks); bluetooth::shim::GetSecurityModule() ->GetSecurityManager() ->RegisterCallbackListener(ShimBondListener::GetInstance(), bluetooth::shim::GetGdShimHandler()); return true; } Loading