Loading system/stack/btm/btm_inq.cc +12 −5 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ #include "stack/include/bt_types.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_client_interface.h" #include "stack/include/btm_log_history.h" #include "stack/include/btm_log_history.h" #include "stack/include/hci_error_code.h" #include "stack/include/hci_error_code.h" #include "stack/include/hcidefs.h" #include "stack/include/hcidefs.h" Loading Loading @@ -430,7 +431,9 @@ tBTM_STATUS BTM_SetInquiryMode(uint8_t mode) { } else } else return (BTM_ILLEGAL_VALUE); return (BTM_ILLEGAL_VALUE); if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE); if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return BTM_WRONG_MODE; } btsnd_hcic_write_inquiry_mode(mode); btsnd_hcic_write_inquiry_mode(mode); Loading Loading @@ -525,7 +528,8 @@ uint16_t BTM_IsInquiryActive(void) { ******************************************************************************/ ******************************************************************************/ static void BTM_CancelLeScan() { static void BTM_CancelLeScan() { if (!bluetooth::shim::is_classic_discovery_only_enabled()) { if (!bluetooth::shim::is_classic_discovery_only_enabled()) { log::assert_that(BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); log::assert_that(get_btm_client_interface().local.BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); if ((btm_cb.btm_inq_vars.inqparms.mode & BTM_BLE_GENERAL_INQUIRY) != 0) if ((btm_cb.btm_inq_vars.inqparms.mode & BTM_BLE_GENERAL_INQUIRY) != 0) btm_ble_stop_inquiry(); btm_ble_stop_inquiry(); } else { } else { Loading @@ -545,7 +549,8 @@ static void BTM_CancelLeScan() { void BTM_CancelInquiry(void) { void BTM_CancelInquiry(void) { log::verbose(""); log::verbose(""); log::assert_that(BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); log::assert_that(get_btm_client_interface().local.BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); btm_cb.neighbor.inquiry_history_->Push({ btm_cb.neighbor.inquiry_history_->Push({ .status = tBTM_INQUIRY_CMPL::CANCELED, .status = tBTM_INQUIRY_CMPL::CANCELED, Loading Loading @@ -717,7 +722,7 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, } } /*** Make sure the device is ready ***/ /*** Make sure the device is ready ***/ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::error("adapter is not up"); log::error("adapter is not up"); btm_cb.neighbor.inquiry_history_->Push({ btm_cb.neighbor.inquiry_history_->Push({ .status = tBTM_INQUIRY_CMPL::NOT_STARTED, .status = tBTM_INQUIRY_CMPL::NOT_STARTED, Loading Loading @@ -1873,7 +1878,9 @@ tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda, uint64_t timeout_ms, uint64_t timeout_ms, tBTM_NAME_CMPL_CB* p_cb) { tBTM_NAME_CMPL_CB* p_cb) { /*** Make sure the device is ready ***/ /*** Make sure the device is ready ***/ if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE); if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return BTM_WRONG_MODE; } if (btm_cb.rnr.remname_active) { if (btm_cb.rnr.remname_active) { return (BTM_BUSY); return (BTM_BUSY); } else { } else { Loading system/stack/btm/btm_sec.cc +3 −1 Original line number Original line Diff line number Diff line Loading @@ -4744,7 +4744,9 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { * * ******************************************************************************/ ******************************************************************************/ static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) { static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) { if (!BTM_IsDeviceUp()) return false; if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return false; } p_dev_rec->sec_rec.sec_state = BTM_SEC_STATE_GETTING_NAME; p_dev_rec->sec_rec.sec_state = BTM_SEC_STATE_GETTING_NAME; Loading system/stack/l2cap/l2c_api.cc +5 −5 Original line number Original line Diff line number Diff line Loading @@ -317,7 +317,7 @@ uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) { log::verbose("BDA {} PSM: 0x{:04x}", p_bd_addr, psm); log::verbose("BDA {} PSM: 0x{:04x}", p_bd_addr, psm); /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return 0; return 0; } } Loading Loading @@ -515,7 +515,7 @@ uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, log::verbose("BDA: {} PSM: 0x{:04x}", p_bd_addr, psm); log::verbose("BDA: {} PSM: 0x{:04x}", p_bd_addr, psm); /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return 0; return 0; } } Loading Loading @@ -740,7 +740,7 @@ std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm, std::vector<uint16_t> allocated_cids; std::vector<uint16_t> allocated_cids; /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return allocated_cids; return allocated_cids; } } Loading Loading @@ -1191,7 +1191,7 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { } } // Fail if BT is not yet up // Fail if BT is not yet up if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("Bt controller is not ready fixed_cid:0x{:04x}", fixed_cid); log::warn("Bt controller is not ready fixed_cid:0x{:04x}", fixed_cid); return (false); return (false); } } Loading Loading @@ -1305,7 +1305,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, return (tL2CAP_DW_RESULT::FAILED); return (tL2CAP_DW_RESULT::FAILED); } } if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid); log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid); osi_free(p_buf); osi_free(p_buf); return (tL2CAP_DW_RESULT::FAILED); return (tL2CAP_DW_RESULT::FAILED); Loading Loading
system/stack/btm/btm_inq.cc +12 −5 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ #include "stack/include/bt_types.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_ble_api.h" #include "stack/include/btm_client_interface.h" #include "stack/include/btm_log_history.h" #include "stack/include/btm_log_history.h" #include "stack/include/hci_error_code.h" #include "stack/include/hci_error_code.h" #include "stack/include/hcidefs.h" #include "stack/include/hcidefs.h" Loading Loading @@ -430,7 +431,9 @@ tBTM_STATUS BTM_SetInquiryMode(uint8_t mode) { } else } else return (BTM_ILLEGAL_VALUE); return (BTM_ILLEGAL_VALUE); if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE); if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return BTM_WRONG_MODE; } btsnd_hcic_write_inquiry_mode(mode); btsnd_hcic_write_inquiry_mode(mode); Loading Loading @@ -525,7 +528,8 @@ uint16_t BTM_IsInquiryActive(void) { ******************************************************************************/ ******************************************************************************/ static void BTM_CancelLeScan() { static void BTM_CancelLeScan() { if (!bluetooth::shim::is_classic_discovery_only_enabled()) { if (!bluetooth::shim::is_classic_discovery_only_enabled()) { log::assert_that(BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); log::assert_that(get_btm_client_interface().local.BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); if ((btm_cb.btm_inq_vars.inqparms.mode & BTM_BLE_GENERAL_INQUIRY) != 0) if ((btm_cb.btm_inq_vars.inqparms.mode & BTM_BLE_GENERAL_INQUIRY) != 0) btm_ble_stop_inquiry(); btm_ble_stop_inquiry(); } else { } else { Loading @@ -545,7 +549,8 @@ static void BTM_CancelLeScan() { void BTM_CancelInquiry(void) { void BTM_CancelInquiry(void) { log::verbose(""); log::verbose(""); log::assert_that(BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); log::assert_that(get_btm_client_interface().local.BTM_IsDeviceUp(), "assert failed: BTM_IsDeviceUp()"); btm_cb.neighbor.inquiry_history_->Push({ btm_cb.neighbor.inquiry_history_->Push({ .status = tBTM_INQUIRY_CMPL::CANCELED, .status = tBTM_INQUIRY_CMPL::CANCELED, Loading Loading @@ -717,7 +722,7 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, } } /*** Make sure the device is ready ***/ /*** Make sure the device is ready ***/ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::error("adapter is not up"); log::error("adapter is not up"); btm_cb.neighbor.inquiry_history_->Push({ btm_cb.neighbor.inquiry_history_->Push({ .status = tBTM_INQUIRY_CMPL::NOT_STARTED, .status = tBTM_INQUIRY_CMPL::NOT_STARTED, Loading Loading @@ -1873,7 +1878,9 @@ tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda, uint64_t timeout_ms, uint64_t timeout_ms, tBTM_NAME_CMPL_CB* p_cb) { tBTM_NAME_CMPL_CB* p_cb) { /*** Make sure the device is ready ***/ /*** Make sure the device is ready ***/ if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE); if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return BTM_WRONG_MODE; } if (btm_cb.rnr.remname_active) { if (btm_cb.rnr.remname_active) { return (BTM_BUSY); return (BTM_BUSY); } else { } else { Loading
system/stack/btm/btm_sec.cc +3 −1 Original line number Original line Diff line number Diff line Loading @@ -4744,7 +4744,9 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { * * ******************************************************************************/ ******************************************************************************/ static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) { static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) { if (!BTM_IsDeviceUp()) return false; if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { return false; } p_dev_rec->sec_rec.sec_state = BTM_SEC_STATE_GETTING_NAME; p_dev_rec->sec_rec.sec_state = BTM_SEC_STATE_GETTING_NAME; Loading
system/stack/l2cap/l2c_api.cc +5 −5 Original line number Original line Diff line number Diff line Loading @@ -317,7 +317,7 @@ uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) { log::verbose("BDA {} PSM: 0x{:04x}", p_bd_addr, psm); log::verbose("BDA {} PSM: 0x{:04x}", p_bd_addr, psm); /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return 0; return 0; } } Loading Loading @@ -515,7 +515,7 @@ uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, log::verbose("BDA: {} PSM: 0x{:04x}", p_bd_addr, psm); log::verbose("BDA: {} PSM: 0x{:04x}", p_bd_addr, psm); /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return 0; return 0; } } Loading Loading @@ -740,7 +740,7 @@ std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm, std::vector<uint16_t> allocated_cids; std::vector<uint16_t> allocated_cids; /* Fail if we have not established communications with the controller */ /* Fail if we have not established communications with the controller */ if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("BTU not ready"); log::warn("BTU not ready"); return allocated_cids; return allocated_cids; } } Loading Loading @@ -1191,7 +1191,7 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { } } // Fail if BT is not yet up // Fail if BT is not yet up if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("Bt controller is not ready fixed_cid:0x{:04x}", fixed_cid); log::warn("Bt controller is not ready fixed_cid:0x{:04x}", fixed_cid); return (false); return (false); } } Loading Loading @@ -1305,7 +1305,7 @@ tL2CAP_DW_RESULT L2CA_SendFixedChnlData(uint16_t fixed_cid, return (tL2CAP_DW_RESULT::FAILED); return (tL2CAP_DW_RESULT::FAILED); } } if (!BTM_IsDeviceUp()) { if (!get_btm_client_interface().local.BTM_IsDeviceUp()) { log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid); log::warn("Controller is not ready CID: 0x{:04x}", fixed_cid); osi_free(p_buf); osi_free(p_buf); return (tL2CAP_DW_RESULT::FAILED); return (tL2CAP_DW_RESULT::FAILED); Loading