APPL_TRACE_DEBUG("%s: already in remote initiate sniff", __func__);
return;
}
+ }
#else
APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d", mode, index);
- if (mode != BTM_PM_MD_SNIFF) {
+ if (mode == BTM_PM_MD_SNIFF) {
+ return;
+ }
#endif
- /* if the current mode is not sniff, issue the sniff command.
- * If sniff, but SSR is not used in this link, still issue the command */
- memcpy(&pwr_md, &p_bta_dm_pm_md[index], sizeof(tBTM_PM_PWR_MD));
- if (p_peer_dev->info & BTA_DM_DI_INT_SNIFF) {
- pwr_md.mode |= BTM_PM_MD_FORCE;
- }
- status =
- BTM_SetPowerMode(bta_dm_cb.pm_id, p_peer_dev->peer_bdaddr, &pwr_md);
- if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) {
- p_peer_dev->info &= ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF);
- p_peer_dev->info |= BTA_DM_DI_SET_SNIFF;
- } else if (status == BTM_SUCCESS) {
- APPL_TRACE_DEBUG(
- "bta_dm_pm_sniff BTM_SetPowerMode() returns BTM_SUCCESS");
- p_peer_dev->info &=
- ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
- } else /* error */
- {
- APPL_TRACE_ERROR(
- "bta_dm_pm_sniff BTM_SetPowerMode() returns ERROR status=%d", status);
- p_peer_dev->info &=
- ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
- }
+ /* if the current mode is not sniff, issue the sniff command.
+ * If sniff, but SSR is not used in this link, still issue the command */
+ memcpy(&pwr_md, &p_bta_dm_pm_md[index], sizeof(tBTM_PM_PWR_MD));
+ if (p_peer_dev->info & BTA_DM_DI_INT_SNIFF) {
+ pwr_md.mode |= BTM_PM_MD_FORCE;
+ }
+ status = BTM_SetPowerMode(bta_dm_cb.pm_id, p_peer_dev->peer_bdaddr, &pwr_md);
+ if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) {
+ p_peer_dev->info &= ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF);
+ p_peer_dev->info |= BTA_DM_DI_SET_SNIFF;
+ } else if (status == BTM_SUCCESS) {
+ APPL_TRACE_DEBUG("bta_dm_pm_sniff BTM_SetPowerMode() returns BTM_SUCCESS");
+ p_peer_dev->info &=
+ ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
+ } else /* error */
+ {
+ APPL_TRACE_ERROR(
+ "bta_dm_pm_sniff BTM_SetPowerMode() returns ERROR status=%d", status);
+ p_peer_dev->info &=
+ ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
}
}
/*******************************************************************************