Loading system/bta/dm/bta_dm_pm.cc +27 −11 Original line number Original line Diff line number Diff line Loading @@ -521,12 +521,18 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, uint8_t timer_idx, available_timer = BTA_DM_PM_MODE_TIMER_MAX; uint8_t timer_idx, available_timer = BTA_DM_PM_MODE_TIMER_MAX; uint64_t remaining_ms = 0; uint64_t remaining_ms = 0; if (!bta_dm_cb.device_list.count) return; if (!bta_dm_cb.device_list.count) { LOG_INFO("Device list count is zero"); return; } /* see if any attempt to put device in low power mode failed */ /* see if any attempt to put device in low power mode failed */ p_peer_device = bta_dm_find_peer_device(peer_addr); p_peer_device = bta_dm_find_peer_device(peer_addr); /* if no peer device found return */ /* if no peer device found return */ if (p_peer_device == NULL) return; if (p_peer_device == NULL) { LOG_INFO("No peer device found"); return; } failed_pm = p_peer_device->pm_mode_failed; failed_pm = p_peer_device->pm_mode_failed; Loading @@ -546,9 +552,13 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, p_act0 = &p_pm_spec->actn_tbl[p_srvcs->state][0]; p_act0 = &p_pm_spec->actn_tbl[p_srvcs->state][0]; p_act1 = &p_pm_spec->actn_tbl[p_srvcs->state][1]; p_act1 = &p_pm_spec->actn_tbl[p_srvcs->state][1]; APPL_TRACE_DEBUG("bta_dm_pm_set_mode: srvcsid: %d, state: %d, j: %d", p_srvcs->id, p_srvcs->state, j); allowed_modes |= p_pm_spec->allow_mask; allowed_modes |= p_pm_spec->allow_mask; LOG_DEBUG( "Service:%s[%hhu] state:%s[%hhu] allowed_modes:0x%02x " "service_index:%hhu ", BtaIdSysText(p_srvcs->id).c_str(), p_srvcs->id, bta_sys_conn_status_text(p_srvcs->state).c_str(), p_srvcs->state, allowed_modes, j); /* PM actions are in the order of strictness */ /* PM actions are in the order of strictness */ Loading Loading @@ -630,10 +640,8 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, timeout_ms, p_srvcs->id, pm_action); timeout_ms, p_srvcs->id, pm_action); timer_started = true; timer_started = true; } } } } else { /* no more timers */ LOG_WARN("no more timers"); else { APPL_TRACE_WARNING("bta_dm_act dm_pm_timer no more"); } } } } return; return; Loading @@ -641,22 +649,30 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, /* if pending power mode timer expires, and currecnt link is in a /* if pending power mode timer expires, and currecnt link is in a lower power mode than current profile requirement, igonre it */ lower power mode than current profile requirement, igonre it */ if (pm_req == BTA_DM_PM_EXECUTE && pm_request < pm_action) { if (pm_req == BTA_DM_PM_EXECUTE && pm_request < pm_action) { APPL_TRACE_ERROR("Ignore the power mode request: %d", pm_request) LOG_ERROR("Ignore the power mode request: %d", pm_request); return; return; } } if (pm_action == BTA_DM_PM_PARK) { if (pm_action == BTA_DM_PM_PARK) { p_peer_device->pm_mode_attempted = BTA_DM_PM_PARK; p_peer_device->pm_mode_attempted = BTA_DM_PM_PARK; bta_dm_pm_park(peer_addr); bta_dm_pm_park(peer_addr); LOG_WARN("DEPRECATED Setting link to park mode peer:%s", PRIVATE_ADDRESS(peer_addr)); } else if (pm_action & BTA_DM_PM_SNIFF) { } else if (pm_action & BTA_DM_PM_SNIFF) { /* dont initiate SNIFF, if link_policy has it disabled */ /* dont initiate SNIFF, if link_policy has it disabled */ if (BTM_is_sniff_allowed_for(peer_addr)) { if (BTM_is_sniff_allowed_for(peer_addr)) { LOG_DEBUG( "Link policy allows sniff mode so setting mode " "peer:%s", PRIVATE_ADDRESS(peer_addr)); p_peer_device->pm_mode_attempted = BTA_DM_PM_SNIFF; p_peer_device->pm_mode_attempted = BTA_DM_PM_SNIFF; bta_dm_pm_sniff(p_peer_device, (uint8_t)(pm_action & 0x0F)); bta_dm_pm_sniff(p_peer_device, (uint8_t)(pm_action & 0x0F)); } else { } else { APPL_TRACE_DEBUG( LOG_DEBUG("Link policy disallows sniff mode, ignore request peer:%s", "bta_dm_pm_set_mode: Link policy disallows SNIFF, ignore request"); PRIVATE_ADDRESS(peer_addr)); } } } else if (pm_action == BTA_DM_PM_ACTIVE) { } else if (pm_action == BTA_DM_PM_ACTIVE) { LOG_DEBUG("Setting link to active mode peer:%s", PRIVATE_ADDRESS(peer_addr)); bta_dm_pm_active(peer_addr); bta_dm_pm_active(peer_addr); } } } } Loading Loading
system/bta/dm/bta_dm_pm.cc +27 −11 Original line number Original line Diff line number Diff line Loading @@ -521,12 +521,18 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, uint8_t timer_idx, available_timer = BTA_DM_PM_MODE_TIMER_MAX; uint8_t timer_idx, available_timer = BTA_DM_PM_MODE_TIMER_MAX; uint64_t remaining_ms = 0; uint64_t remaining_ms = 0; if (!bta_dm_cb.device_list.count) return; if (!bta_dm_cb.device_list.count) { LOG_INFO("Device list count is zero"); return; } /* see if any attempt to put device in low power mode failed */ /* see if any attempt to put device in low power mode failed */ p_peer_device = bta_dm_find_peer_device(peer_addr); p_peer_device = bta_dm_find_peer_device(peer_addr); /* if no peer device found return */ /* if no peer device found return */ if (p_peer_device == NULL) return; if (p_peer_device == NULL) { LOG_INFO("No peer device found"); return; } failed_pm = p_peer_device->pm_mode_failed; failed_pm = p_peer_device->pm_mode_failed; Loading @@ -546,9 +552,13 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, p_act0 = &p_pm_spec->actn_tbl[p_srvcs->state][0]; p_act0 = &p_pm_spec->actn_tbl[p_srvcs->state][0]; p_act1 = &p_pm_spec->actn_tbl[p_srvcs->state][1]; p_act1 = &p_pm_spec->actn_tbl[p_srvcs->state][1]; APPL_TRACE_DEBUG("bta_dm_pm_set_mode: srvcsid: %d, state: %d, j: %d", p_srvcs->id, p_srvcs->state, j); allowed_modes |= p_pm_spec->allow_mask; allowed_modes |= p_pm_spec->allow_mask; LOG_DEBUG( "Service:%s[%hhu] state:%s[%hhu] allowed_modes:0x%02x " "service_index:%hhu ", BtaIdSysText(p_srvcs->id).c_str(), p_srvcs->id, bta_sys_conn_status_text(p_srvcs->state).c_str(), p_srvcs->state, allowed_modes, j); /* PM actions are in the order of strictness */ /* PM actions are in the order of strictness */ Loading Loading @@ -630,10 +640,8 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, timeout_ms, p_srvcs->id, pm_action); timeout_ms, p_srvcs->id, pm_action); timer_started = true; timer_started = true; } } } } else { /* no more timers */ LOG_WARN("no more timers"); else { APPL_TRACE_WARNING("bta_dm_act dm_pm_timer no more"); } } } } return; return; Loading @@ -641,22 +649,30 @@ static void bta_dm_pm_set_mode(const RawAddress& peer_addr, /* if pending power mode timer expires, and currecnt link is in a /* if pending power mode timer expires, and currecnt link is in a lower power mode than current profile requirement, igonre it */ lower power mode than current profile requirement, igonre it */ if (pm_req == BTA_DM_PM_EXECUTE && pm_request < pm_action) { if (pm_req == BTA_DM_PM_EXECUTE && pm_request < pm_action) { APPL_TRACE_ERROR("Ignore the power mode request: %d", pm_request) LOG_ERROR("Ignore the power mode request: %d", pm_request); return; return; } } if (pm_action == BTA_DM_PM_PARK) { if (pm_action == BTA_DM_PM_PARK) { p_peer_device->pm_mode_attempted = BTA_DM_PM_PARK; p_peer_device->pm_mode_attempted = BTA_DM_PM_PARK; bta_dm_pm_park(peer_addr); bta_dm_pm_park(peer_addr); LOG_WARN("DEPRECATED Setting link to park mode peer:%s", PRIVATE_ADDRESS(peer_addr)); } else if (pm_action & BTA_DM_PM_SNIFF) { } else if (pm_action & BTA_DM_PM_SNIFF) { /* dont initiate SNIFF, if link_policy has it disabled */ /* dont initiate SNIFF, if link_policy has it disabled */ if (BTM_is_sniff_allowed_for(peer_addr)) { if (BTM_is_sniff_allowed_for(peer_addr)) { LOG_DEBUG( "Link policy allows sniff mode so setting mode " "peer:%s", PRIVATE_ADDRESS(peer_addr)); p_peer_device->pm_mode_attempted = BTA_DM_PM_SNIFF; p_peer_device->pm_mode_attempted = BTA_DM_PM_SNIFF; bta_dm_pm_sniff(p_peer_device, (uint8_t)(pm_action & 0x0F)); bta_dm_pm_sniff(p_peer_device, (uint8_t)(pm_action & 0x0F)); } else { } else { APPL_TRACE_DEBUG( LOG_DEBUG("Link policy disallows sniff mode, ignore request peer:%s", "bta_dm_pm_set_mode: Link policy disallows SNIFF, ignore request"); PRIVATE_ADDRESS(peer_addr)); } } } else if (pm_action == BTA_DM_PM_ACTIVE) { } else if (pm_action == BTA_DM_PM_ACTIVE) { LOG_DEBUG("Setting link to active mode peer:%s", PRIVATE_ADDRESS(peer_addr)); bta_dm_pm_active(peer_addr); bta_dm_pm_active(peer_addr); } } } } Loading