std::lock_guard<std::mutex> lock(btm_cb_mutex_);
- if (btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE) {
+ if (btm_cb.ble_ctr_cb.is_ble_observe_active()) {
LOG_WARN("%s Observing already active", __func__);
return BTM_WRONG_MODE;
}
btm_cb.ble_ctr_cb.p_obs_results_cb = p_results_cb;
btm_cb.ble_ctr_cb.p_obs_cmpl_cb = p_cmpl_cb;
Stack::GetInstance()->GetBtm()->StartObserving();
- btm_cb.ble_ctr_cb.scan_activity |= BTM_LE_OBSERVE_ACTIVE;
+ btm_cb.ble_ctr_cb.set_ble_observe_active();
if (duration_sec != 0) {
Stack::GetInstance()->GetBtm()->SetObservingTimer(
Stack::GetInstance()->GetBtm()->StopObserving();
std::lock_guard<std::mutex> lock(btm_cb_mutex_);
- btm_cb.ble_ctr_cb.scan_activity &= ~BTM_LE_OBSERVE_ACTIVE;
+ btm_cb.ble_ctr_cb.reset_ble_observe();
if (btm_cb.ble_ctr_cb.p_obs_cmpl_cb) {
(btm_cb.ble_ctr_cb.p_obs_cmpl_cb)(
} else {
std::lock_guard<std::mutex> lock(btm_cb_mutex_);
- if (!(btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE)) {
+ if (!btm_cb.ble_ctr_cb.is_ble_observe_active()) {
LOG_WARN("%s Observing already inactive", __func__);
}
Stack::GetInstance()->GetBtm()->CancelObservingTimer();
Stack::GetInstance()->GetBtm()->StopObserving();
- btm_cb.ble_ctr_cb.scan_activity &= ~BTM_LE_OBSERVE_ACTIVE;
+ btm_cb.ble_ctr_cb.reset_ble_observe();
Stack::GetInstance()->GetBtm()->StopObserving();
if (btm_cb.ble_ctr_cb.p_obs_cmpl_cb) {
(btm_cb.ble_ctr_cb.p_obs_cmpl_cb)(&btm_cb.btm_inq_vars.inq_cmpl_info);
Stack::GetInstance()->GetBtm()->CancelScanningTimer();
Stack::GetInstance()->GetBtm()->StopActiveScanning();
- btm_cb.ble_ctr_cb.scan_activity &= ~BTM_BLE_INQUIRY_MASK;
+ btm_cb.ble_ctr_cb.reset_ble_inquiry();
btm_cb.btm_inq_vars.inqparms.mode &=
~(btm_cb.btm_inq_vars.inqparms.mode & BTM_BLE_INQUIRY_MASK);
if (start) {
/* shared inquiry database, do not allow observe if any inquiry is active */
- if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
+ if (btm_cb.ble_ctr_cb.is_ble_observe_active()) {
BTM_TRACE_ERROR("%s Observe Already Active", __func__);
return status;
}
status = BTM_CMD_STARTED;
/* scan is not started */
- if (!BTM_BLE_IS_SCAN_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
+ if (!btm_cb.ble_ctr_cb.is_ble_scan_active()) {
/* allow config of scan type */
cache.ClearAll();
p_inq->scan_type = (p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE)
}
if (status == BTM_CMD_STARTED) {
- btm_cb.ble_ctr_cb.scan_activity |= BTM_LE_OBSERVE_ACTIVE;
+ btm_cb.ble_ctr_cb.set_ble_observe_active();
if (duration != 0) {
/* start observer timer */
uint64_t duration_ms = duration * 1000;
btm_ble_observer_timer_timeout, NULL);
}
}
- } else if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
+ } else if (btm_cb.ble_ctr_cb.is_ble_observe_active()) {
status = BTM_CMD_STARTED;
btm_ble_stop_observe();
} else {
/* if selective connection is active, or inquiry is already active, reject it
*/
- if (BTM_BLE_IS_INQ_ACTIVE(p_ble_cb->scan_activity)) {
+ if (p_ble_cb->is_ble_inquiry_active()) {
BTM_TRACE_ERROR("LE Inquiry is active, can not start inquiry");
return (BTM_BUSY);
}
- if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) {
+ if (!p_ble_cb->is_ble_scan_active()) {
cache.ClearAll();
btm_send_hci_set_scan_params(
BTM_BLE_SCAN_MODE_ACTI, BTM_BLE_LOW_LATENCY_SCAN_INT,
if (status == BTM_CMD_STARTED) {
p_inq->inq_active |= BTM_BLE_GENERAL_INQUIRY;
- p_ble_cb->scan_activity |= BTM_BLE_GENERAL_INQUIRY;
+ p_ble_cb->set_ble_inquiry_active();
BTM_TRACE_DEBUG("btm_ble_start_inquiry inq_active = 0x%02x",
p_inq->inq_active);
uint8_t data_len;
/* for observer, always "discoverable */
- if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity))
- rt |= BTM_BLE_OBS_RESULT;
+ if (btm_cb.ble_ctr_cb.is_ble_observe_active()) rt |= BTM_BLE_OBS_RESULT;
if (!adv_data.empty()) {
const uint8_t* p_flag = AdvertiseDataParser::GetFieldByType(
uint16_t event_type, periodic_adv_int, direct_address_type;
/* Only process the results if the inquiry is still active */
- if (!BTM_BLE_IS_SCAN_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) return;
+ if (!btm_cb.ble_ctr_cb.is_ble_scan_active()) return;
/* Extract the number of reports in this event. */
STREAM_TO_UINT8(num_reports, p);
int8_t rssi;
/* Only process the results if the inquiry is still active */
- if (!BTM_BLE_IS_SCAN_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) return;
+ if (!btm_cb.ble_ctr_cb.is_ble_scan_active()) return;
/* Extract the number of reports in this event. */
STREAM_TO_UINT8(num_reports, p);
/* scan repsonse to be updated */
(!p_i->scan_rsp))) {
update = true;
- } else if (BTM_BLE_IS_OBS_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
+ } else if (btm_cb.ble_ctr_cb.is_ble_observe_active()) {
update = false;
} else {
/* if yes, skip it */
alarm_cancel(p_ble_cb->inq_var.inquiry_timer);
- p_ble_cb->scan_activity &= ~BTM_BLE_INQUIRY_MASK;
+ p_ble_cb->reset_ble_inquiry();
/* If no more scan activity, stop LE scan now */
- if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity))
+ if (!p_ble_cb->is_ble_scan_active()) {
btm_ble_stop_scan();
- else if ((p_ble_cb->inq_var.scan_interval != BTM_BLE_LOW_LATENCY_SCAN_INT) ||
- (p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN)) {
+ } else if ((p_ble_cb->inq_var.scan_interval !=
+ BTM_BLE_LOW_LATENCY_SCAN_INT) ||
+ (p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN)) {
BTM_TRACE_DEBUG("%s: setting default params for ongoing observe", __func__);
btm_ble_stop_scan();
btm_ble_start_scan();
alarm_cancel(p_ble_cb->observer_timer);
- p_ble_cb->scan_activity &= ~BTM_LE_OBSERVE_ACTIVE;
+ p_ble_cb->reset_ble_observe();
p_ble_cb->p_obs_results_cb = NULL;
p_ble_cb->p_obs_cmpl_cb = NULL;
- if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) btm_ble_stop_scan();
+ if (!p_ble_cb->is_ble_scan_active()) {
+ btm_ble_stop_scan();
+ }
if (p_obs_cb) (p_obs_cb)(&btm_cb.btm_inq_vars.inq_cmpl_info);
}