#include "stack/include/l2cap_hci_link_interface.h"
struct StackAclBtmPm {
- tBTM_STATUS btm_pm_snd_md_req(uint8_t pm_id, int link_ind,
+ tBTM_STATUS btm_pm_snd_md_req(tACL_CONN& p_acl, uint8_t pm_id, int link_ind,
const tBTM_PM_PWR_MD* p_mode);
tBTM_PM_MCB* btm_pm_get_power_manager_from_address(const RawAddress& bda);
tBTM_PM_MCB* btm_pm_get_power_manager_from_handle(uint16_t handle);
return BTM_ILLEGAL_VALUE;
}
+ tACL_CONN* p_acl =
+ acl_get_connection_from_address(remote_bda, BT_TRANSPORT_BR_EDR);
+ if (p_acl == nullptr) {
+ LOG_WARN("Unable to find acl");
+ return BTM_UNKNOWN_ADDR;
+ }
+
/* take out the force bit */
tBTM_PM_MODE mode = p_mode->mode & ~BTM_PM_MD_FORCE;
remote_bda.ToString().c_str(), p_mode->mode, p_cb->state,
btm_cb.acl_cb_.pm_pend_link);
- return internal_.btm_pm_snd_md_req(pm_id, acl_ind, p_mode);
+ return internal_.btm_pm_snd_md_req(*p_acl, pm_id, acl_ind, p_mode);
}
/*******************************************************************************
* Returns tBTM_STATUS
*, bool *p_chg_ind
******************************************************************************/
-tBTM_STATUS StackAclBtmPm::btm_pm_snd_md_req(uint8_t pm_id, int link_ind,
+tBTM_STATUS StackAclBtmPm::btm_pm_snd_md_req(tACL_CONN& p_acl, uint8_t pm_id,
+ int link_ind,
const tBTM_PM_PWR_MD* p_mode) {
tBTM_PM_PWR_MD md_res;
tBTM_PM_MODE mode;
if (btm_cb.acl_cb_.pm_mode_db[xx].state & BTM_PM_STORED_MASK) {
btm_cb.acl_cb_.pm_mode_db[xx].state &= ~BTM_PM_STORED_MASK;
BTM_TRACE_DEBUG("btm_pm_check_stored :%d", xx);
- internal_.btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, xx, NULL);
+ internal_.btm_pm_snd_md_req(btm_cb.acl_cb_.acl_db[xx], BTM_PM_SET_ONLY_ID,
+ xx, NULL);
break;
}
}
int xx, yy, zz;
tBTM_PM_STATE old_state;
+ tACL_CONN* p_acl = acl_get_connection_from_handle(hci_handle);
+ if (p_acl == nullptr) {
+ LOG_WARN("Unable to find acl");
+ return;
+ }
+
/* get the index to acl_db */
xx = btm_handle_to_acl_index(hci_handle);
if (xx >= MAX_L2CAP_LINKS) return;
/* new request has been made. - post a message to BTU task */
if (old_state & BTM_PM_STORED_MASK) {
LOG_VERBOSE("Sending stored req: %d", xx);
- internal_.btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, xx, NULL);
+ internal_.btm_pm_snd_md_req(*p_acl, BTM_PM_SET_ONLY_ID, xx, NULL);
} else {
for (zz = 0; zz < MAX_L2CAP_LINKS; zz++) {
if (btm_cb.acl_cb_.pm_mode_db[zz].chg_ind) {
LOG_VERBOSE("Sending PM req :%d", zz);
- internal_.btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, zz, NULL);
+ internal_.btm_pm_snd_md_req(btm_cb.acl_cb_.acl_db[zz],
+ BTM_PM_SET_ONLY_ID, zz, NULL);
break;
}
}