(*bta_ag_cb.p_cback)(BTA_AG_CLOSE_EVT, (tBTA_AG*)&close);
/* if not deregistering (deallocating) reopen registered servers */
- if (p_scb->dealloc == false) {
+ if (!p_scb->dealloc) {
/* Clear peer bd_addr so instance can be reused */
p_scb->peer_addr = RawAddress::kEmpty;
/* Ensure we do not send duplicate indicators if not requested by app */
/* If it was requested by app, transmit CIEV even if it is duplicate. */
if (id == BTA_AG_IND_CALL) {
- if ((value == p_scb->call_ind) && (on_demand == false)) return;
+ if ((value == p_scb->call_ind) && (!on_demand)) return;
p_scb->call_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_CALLSETUP) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_CALLSETUP) && (!on_demand)) {
if (value == p_scb->callsetup_ind) return;
p_scb->callsetup_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_SERVICE) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_SERVICE) && (!on_demand)) {
if (value == p_scb->service_ind) return;
p_scb->service_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_SIGNAL) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_SIGNAL) && (!on_demand)) {
if (value == p_scb->signal_ind) return;
p_scb->signal_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_ROAM) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_ROAM) && (!on_demand)) {
if (value == p_scb->roam_ind) return;
p_scb->roam_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_BATTCHG) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_BATTCHG) && (!on_demand)) {
if (value == p_scb->battchg_ind) return;
p_scb->battchg_ind = (uint8_t)value;
}
- if ((id == BTA_AG_IND_CALLHELD) && (on_demand == false)) {
+ if ((id == BTA_AG_IND_CALLHELD) && (!on_demand)) {
/* call swap could result in sending callheld=1 multiple times */
if ((value != 1) && (value == p_scb->callheld_ind)) return;
p_scb->local_hf_indicators[i].ind_id);
/* Check whether local and peer sides support this indicator */
- if (p_scb->local_hf_indicators[i].is_supported == true &&
- peer_index != -1) {
+ if (p_scb->local_hf_indicators[i].is_supported && peer_index != -1) {
/* In the format of ind, state */
p += utl_itoa((uint16_t)p_scb->local_hf_indicators[i].ind_id, p);
*p++ = ',';
} else {
APPL_TRACE_DEBUG(
"%s HF Indicator %d already %s", p_result->data.ind.id,
- (p_result->data.ind.on_demand == true) ? "Enabled" : "Disabled");
+ (p_result->data.ind.on_demand) ? "Enabled" : "Disabled");
}
}
break;
*
******************************************************************************/
void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result) {
- if (result == true) {
+ if (result) {
/* Subsequent SCO connection will skip codec negotiation */
APPL_TRACE_DEBUG("%s: Succeeded for index 0x%04x", __func__,
p_scb->sco_idx);
continue;
}
- if (p->in_use && p->dealloc == false) {
+ if (p->in_use && !p->dealloc) {
others |= p->reg_services;
}
}
/* for outgoing RC connection as INT/CT */
if ((p_scb->rc_handle == BTA_AV_RC_HANDLE_NONE) &&
/* (bta_av_cb.features & BTA_AV_FEAT_RCCT) && */
- (p_scb->use_rc == true || (p_scb->role & BTA_AV_ROLE_AD_ACP))) {
+ (p_scb->use_rc || (p_scb->role & BTA_AV_ROLE_AD_ACP))) {
if ((p_scb->wait & BTA_AV_WAIT_ROLE_SW_BITS) == 0) {
bta_sys_start_timer(p_scb->avrc_ct_timer, BTA_AV_RC_DISC_TIME_VAL,
BTA_AV_AVRC_TIMER_EVT, p_scb->hndl);
for (i = p_scb->sep_info_idx; i < p_scb->num_seps; i++) {
/* steam not in use, is a sink, and is the right media type (audio/video) */
- if ((p_scb->sep_info[i].in_use == false) &&
+ if ((!p_scb->sep_info[i].in_use) &&
(p_scb->sep_info[i].tsep == sep_requested) &&
(p_scb->sep_info[i].media_type == p_scb->media_type)) {
p_scb->sep_info_idx = i;
bta_sys_app_open(BTA_ID_AV, p_scb->app_id, p_scb->peer_addr);
- if (p_scb->skip_sdp == true) {
+ if (p_scb->skip_sdp) {
tA2DP_Service a2dp_ser;
a2dp_ser.avdt_version = AVDT_VERSION;
p_scb->skip_sdp = false;
for (i = 0; i < p_scb->num_seps; i++) {
/* steam not in use, is a sink, and is audio */
- if ((p_scb->sep_info[i].in_use == false) &&
+ if ((!p_scb->sep_info[i].in_use) &&
(p_scb->sep_info[i].media_type == p_scb->media_type)) {
if ((p_scb->sep_info[i].tsep == AVDT_TSEP_SNK) &&
(uuid_int == UUID_SERVCLASS_AUDIO_SOURCE))
/* check whether there is already an opened audio or video connection with the
* same device */
- for (idx = 0; (idx < BTA_AV_NUM_STRS) && (is_av_opened == false); idx++) {
+ for (idx = 0; (idx < BTA_AV_NUM_STRS) && (!is_av_opened); idx++) {
p_opened_scb = bta_av_cb.p_scb[idx];
if (p_opened_scb && (p_opened_scb->state == BTA_AV_OPEN_SST) &&
(p_opened_scb->peer_addr == p_scb->peer_addr))
/* if there is already an active AV connnection with the same bd_addr,
don't send disconnect req, just report the open event with
BTA_AV_FAIL_GET_CAP status */
- if (is_av_opened == true) {
+ if (is_av_opened) {
tBTA_AV_OPEN open;
open.bd_addr = p_scb->peer_addr;
open.chnl = p_scb->chnl;
bta_sys_clear_policy(BTA_ID_AV, policy, p_scb->peer_addr);
- if ((p_scb->started == false) &&
- ((p_scb->role & BTA_AV_ROLE_START_INT) == 0)) {
+ if ((!p_scb->started) && ((p_scb->role & BTA_AV_ROLE_START_INT) == 0)) {
p_scb->role |= BTA_AV_ROLE_START_INT;
bta_sys_busy(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->peer_addr);
*
******************************************************************************/
void bta_av_start_failed(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) {
- if (p_scb->started == false && p_scb->co_started == false) {
+ if (!p_scb->started && !p_scb->co_started) {
bta_sys_idle(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->peer_addr);
notify_start_failed(p_scb);
}
APPL_TRACE_DEBUG("%s: audio_open_cnt = %d, err_code = %d", __func__,
bta_av_cb.audio_open_cnt, err_code);
- if (p_scb->started == false) {
+ if (!p_scb->started) {
/* handle the condition where there is a collision of SUSPEND req from
*either side
** Second SUSPEND req could be rejected. Do not treat this as a failure
return;
}
- if (p_scb->use_rc == true || (p_scb->role & BTA_AV_ROLE_AD_ACP)) {
+ if (p_scb->use_rc || (p_scb->role & BTA_AV_ROLE_AD_ACP)) {
if (bta_av_cb.disc) {
/* AVRC discover db is in use */
if (p_scb->rc_handle == BTA_AV_RC_HANDLE_NONE) {
int i;
for (i = 0; i < BTA_AV_NUM_RCB; i++) {
- if ((p_cb->disabling == true) || (bta_av_cb.rcb[i].shdl != 0))
+ if ((p_cb->disabling) || (bta_av_cb.rcb[i].shdl != 0))
bta_av_del_rc(&bta_av_cb.rcb[i]);
}
}
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
p_scb = bta_av_cb.p_scb[i];
- if (p_scb && p_scb->co_started && (p_scb->sco_suspend == false)) {
+ if (p_scb && p_scb->co_started && (!p_scb->sco_suspend)) {
APPL_TRACE_DEBUG("suspending scb:%d", i);
/* scb is used and started, not suspended automatically */
p_scb->sco_suspend = true;
tBTA_DM_ENABLE enable_event;
/* if already in use, return an error */
- if (bta_dm_cb.is_bta_dm_active == true) {
+ if (bta_dm_cb.is_bta_dm_active) {
APPL_TRACE_WARNING("%s Device already started by another application",
__func__);
memset(&enable_event, 0, sizeof(tBTA_DM_ENABLE));
void bta_dm_confirm(tBTA_DM_MSG* p_data) {
tBTM_STATUS res = BTM_NOT_AUTHORIZED;
- if (p_data->confirm.accept == true) res = BTM_SUCCESS;
+ if (p_data->confirm.accept) res = BTM_SUCCESS;
BTM_ConfirmReqReply(res, p_data->confirm.bd_addr);
}
void bta_dm_ci_rmt_oob_act(tBTA_DM_MSG* p_data) {
tBTM_STATUS res = BTM_NOT_AUTHORIZED;
- if (p_data->ci_rmt_oob.accept == true) res = BTM_SUCCESS;
+ if (p_data->ci_rmt_oob.accept) res = BTM_SUCCESS;
BTM_RemoteOobDataReply(res, p_data->ci_rmt_oob.bd_addr, p_data->ci_rmt_oob.c,
p_data->ci_rmt_oob.r);
}
APPL_TRACE_DEBUG("%s", __func__);
- if (bta_dm_search_cb.cancel_pending == false) {
+ if (!bta_dm_search_cb.cancel_pending) {
p_msg->inq_cmpl.hdr.event = BTA_DM_INQUIRY_CMPL_EVT;
p_msg->inq_cmpl.num = ((tBTM_INQUIRY_CMPL*)p_result)->num_resp;
} else {
APPL_TRACE_WARNING("[%d]: state:%d, info:x%x, avoid_rs %d", i,
p_dev->conn_state, p_dev->info, avoid_roleswitch);
if ((p_dev->conn_state == BTA_DM_CONNECTED) &&
- (p_dev->info & BTA_DM_DI_AV_ACTIVE) && (avoid_roleswitch == false)) {
+ (p_dev->info & BTA_DM_DI_AV_ACTIVE) && (!avoid_roleswitch)) {
/* make master and take away the role switch policy */
if (BTM_CMD_STARTED == BTM_SwitchRole(p_dev->peer_bdaddr,
HCI_ROLE_MASTER,
if (bta_dm_cb.device_list.peer_device[i].pref_role !=
BTA_SLAVE_ROLE_ONLY &&
- delay_role_switch == false) {
+ !delay_role_switch) {
BTM_SwitchRole(bta_dm_cb.device_list.peer_device[i].peer_bdaddr,
HCI_ROLE_MASTER, NULL);
} else {
*
******************************************************************************/
void BTA_GATTC_Disable(void) {
- if (bta_sys_is_register(BTA_ID_GATTC) == false) {
+ if (!bta_sys_is_register(BTA_ID_GATTC)) {
APPL_TRACE_WARNING("GATTC Module not enabled/already disabled");
return;
}
*/
void BTA_GATTC_AppRegister(tBTA_GATTC_CBACK* p_client_cb,
BtaAppRegisterCallback cb) {
- if (bta_sys_is_register(BTA_ID_GATTC) == false)
+ if (!bta_sys_is_register(BTA_ID_GATTC))
bta_sys_register(BTA_ID_GATTC, &bta_gattc_reg);
do_in_bta_thread(FROM_HERE, base::Bind(&bta_gattc_register, Uuid::GetRandom(),
tGATT_STATUS status = GATT_SUCCESS;
uint8_t i, first_unuse = 0xff;
- if (p_cb->enabled == false) {
+ if (!p_cb->enabled) {
bta_gatts_enable(p_cb);
}
*
******************************************************************************/
void BTA_GATTS_Disable(void) {
- if (bta_sys_is_register(BTA_ID_GATTS) == false) {
+ if (!bta_sys_is_register(BTA_ID_GATTS)) {
APPL_TRACE_WARNING("GATTS Module not enabled/already disabled");
return;
}
evt.conn.bd_addr = client_cb->peer_addr;
/* if not deregistering reopen server */
- if (bta_hf_client_cb_arr.deregister == false) {
+ if (!bta_hf_client_cb_arr.deregister) {
/* Make sure SCO is shutdown */
bta_hf_client_sco_shutdown(client_cb);
uint16_t buf_len) {
APPL_TRACE_DEBUG("%s", __func__);
if ((client_cb->at_cb.current_cmd == BTA_HF_CLIENT_AT_NONE ||
- client_cb->svc_conn == false) &&
+ !client_cb->svc_conn) &&
!alarm_is_scheduled(client_cb->at_cb.hold_timer)) {
uint16_t len;
client_cb->at_cb.current_cmd = BTA_HF_CLIENT_AT_NONE;
return;
case BTA_HF_CLIENT_AT_CLIP: // last cmd is post slc seq
- if (client_cb->send_at_reply == false) {
+ if (!client_cb->send_at_reply) {
client_cb->send_at_reply = true;
}
break;
bta_hf_client_cback_sco(client_cb, BTA_HF_CLIENT_AUDIO_CLOSE_EVT);
break;
case BTA_HF_CLIENT_AT_CLIP: // last cmd is post slc seq
- if (client_cb->send_at_reply == false) {
+ if (!client_cb->send_at_reply) {
client_cb->send_at_reply = true;
}
break;
client_cb->at_cb.offset += space_left;
/* find end of last complete command before proceeding */
- while (bta_hf_client_check_at_complete(client_cb) == false) {
+ while (!bta_hf_client_check_at_complete(client_cb)) {
if (client_cb->at_cb.offset == 0) {
APPL_TRACE_ERROR("HFPClient: AT parser buffer overrun, disconnecting");
client_cb->at_cb.offset += len;
/* If last event is complete, parsing can be started */
- if (bta_hf_client_check_at_complete(client_cb) == true) {
+ if (bta_hf_client_check_at_complete(client_cb)) {
bta_hf_client_at_parse_start(client_cb);
bta_hf_client_at_clear_buf(client_cb);
}
APPL_TRACE_DEBUG("%s", __func__);
- if (query == true) {
+ if (query) {
at_len = snprintf(buf, sizeof(buf), "AT+BTRH?\r");
} else {
at_len = snprintf(buf, sizeof(buf), "AT+BTRH=%u\r", val);
/* call app callback */
bta_hf_client_cback_sco(client_cb, BTA_HF_CLIENT_AUDIO_CLOSE_EVT);
- if (client_cb->sco_close_rfc == true) {
+ if (client_cb->sco_close_rfc) {
client_cb->sco_close_rfc = false;
bta_hf_client_rfc_do_close(p_data);
}
if (p_cb->app_id != 0 && p_cb->hid_srvc.in_use) {
APPL_TRACE_DEBUG("%s: discovery has been done for HID service", __func__);
/* configure protocol mode */
- if (bta_hh_le_set_protocol_mode(p_cb, p_cb->mode) == false) {
+ if (!bta_hh_le_set_protocol_mode(p_cb, p_cb->mode)) {
bta_hh_le_open_cmpl(p_cb);
}
}
*
******************************************************************************/
void bta_hh_le_notify_enc_cmpl(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_buf) {
- if (p_cb == NULL || p_cb->security_pending == false || p_buf == NULL ||
+ if (p_cb == NULL || !p_cb->security_pending || p_buf == NULL ||
p_buf->le_enc_cmpl.client_if != bta_hh_cb.gatt_if) {
return;
}
tBTA_HH_DEV_CB* p_dev_cb = (tBTA_HH_DEV_CB*)data;
if (interop_match_addr(INTEROP_HID_PREF_CONN_SUP_TIMEOUT_3S,
- (RawAddress*)&p_dev_cb->addr) == true) {
+ (RawAddress*)&p_dev_cb->addr)) {
if (tout < 300) tout = 300;
}
* force the index to be IDX_INVALID
*/
if ((index != BTA_HH_IDX_INVALID) &&
- (bta_hh_cb.kdev[index].in_use == false)) {
+ (!bta_hh_cb.kdev[index].in_use)) {
index = BTA_HH_IDX_INVALID;
}
}
case TCS_PSM_INTERCOM: /* 5 */
case TCS_PSM_CORDLESS: /* 7 */
- if (false == bta_sys_is_register(BTA_ID_CT) &&
- false == bta_sys_is_register(BTA_ID_CG))
+ if (!bta_sys_is_register(BTA_ID_CT) &&
+ !bta_sys_is_register(BTA_ID_CG))
ret = true;
break;
case BT_PSM_BNEP: /* F */
- if (false == bta_sys_is_register(BTA_ID_PAN)) ret = true;
+ if (!bta_sys_is_register(BTA_ID_PAN)) ret = true;
break;
case HID_PSM_CONTROL: /* 0x11 */
case HID_PSM_INTERRUPT: /* 0x13 */
// FIX: allow HID Device and HID Host to coexist
- if (false == bta_sys_is_register(BTA_ID_HD) ||
- false == bta_sys_is_register(BTA_ID_HH))
+ if (!bta_sys_is_register(BTA_ID_HD) ||
+ !bta_sys_is_register(BTA_ID_HH))
ret = true;
break;
case AVCT_PSM: /* 0x17 */
case AVDT_PSM: /* 0x19 */
- if ((false == bta_sys_is_register(BTA_ID_AV)) &&
- (false == bta_sys_is_register(BTA_ID_AVK)))
+ if ((!bta_sys_is_register(BTA_ID_AV)) &&
+ (!bta_sys_is_register(BTA_ID_AVK)))
ret = true;
break;
int32_t channel = p_data->alloc_channel.channel;
uint8_t scn = 0;
if (channel > 0) {
- if (BTM_TryAllocateSCN(channel) == false) {
+ if (!BTM_TryAllocateSCN(channel)) {
APPL_TRACE_ERROR("rfc channel:%d already in use or invalid", channel);
channel = 0;
}
memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
- if (cc->has_cfg == true) {
+ if (cc->has_cfg) {
cfg = cc->cfg;
if (cfg.fcr_present && cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) {
chan_mode_mask = GAP_FCR_CHAN_OPT_ERTM;
}
}
- if (cc->has_ertm_info == true) {
+ if (cc->has_ertm_info) {
ertm_info = &(cc->ertm_info);
}
memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO));
- if (ls->has_cfg == true) {
+ if (ls->has_cfg) {
cfg = ls->cfg;
if (cfg.fcr_present && cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) {
chan_mode_mask = GAP_FCR_CHAN_OPT_ERTM;
}
}
- if (ls->has_ertm_info == true) {
+ if (ls->has_ertm_info) {
ertm_info = &(ls->ertm_info);
}
/* PSM checking is not required for LE COC */
if (0 == sec_id ||
((ls->type == BTA_JV_CONN_TYPE_L2CAP) &&
- (false == bta_jv_check_psm(ls->local_psm))) ||
+ (!bta_jv_check_psm(ls->local_psm))) ||
(handle = GAP_ConnOpen("JV L2CAP", sec_id, 1, nullptr, ls->local_psm,
&cfg, ertm_info, ls->sec_mask, chan_mode_mask,
bta_jv_l2cap_server_cback, ls->type)) ==
evt_data.sec_id = sec_id;
evt_data.status = BTA_JV_SUCCESS;
if (0 == sec_id ||
- BTM_SetSecurityLevel(true, "", sec_id, cc->sec_mask, BT_PSM_RFCOMM,
- BTM_SEC_PROTO_RFCOMM, cc->remote_scn) == false) {
+ !BTM_SetSecurityLevel(true, "", sec_id, cc->sec_mask, BT_PSM_RFCOMM,
+ BTM_SEC_PROTO_RFCOMM, cc->remote_scn)) {
evt_data.status = BTA_JV_FAILURE;
APPL_TRACE_ERROR(
"sec_id:%d is zero or BTM_SetSecurityLevel failed, remote_scn:%d",
sec_id = bta_jv_alloc_sec_id();
if (0 == sec_id ||
- BTM_SetSecurityLevel(false, "JV PORT", sec_id, rs->sec_mask,
- BT_PSM_RFCOMM, BTM_SEC_PROTO_RFCOMM,
- rs->local_scn) == false) {
+ !BTM_SetSecurityLevel(false, "JV PORT", sec_id, rs->sec_mask,
+ BT_PSM_RFCOMM, BTM_SEC_PROTO_RFCOMM,
+ rs->local_scn)) {
APPL_TRACE_ERROR("bta_jv_rfcomm_start_server, run out of sec_id");
break;
}
int i;
APPL_TRACE_API("BTA_JvEnable");
- if (p_cback && false == bta_sys_is_register(BTA_ID_JV)) {
+ if (p_cback && !bta_sys_is_register(BTA_ID_JV)) {
memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB));
/* set handle to invalid value by default */
for (i = 0; i < BTA_JV_PM_MAX_NUM; i++) {
APPL_TRACE_API("%", __func__);
- if (p_cback && false == bta_sys_is_register(BTA_ID_MCE)) {
+ if (p_cback && !bta_sys_is_register(BTA_ID_MCE)) {
memset(&bta_mce_cb, 0, sizeof(tBTA_MCE_CB));
/* register with BTA system manager */
for (uint8_t index = 0; index < BTA_PAN_NUM_CONN; index++) {
p_scb = &bta_pan_cb.scb[index];
- if (p_scb->in_use == true && app_id == p_scb->app_id) {
+ if (p_scb->in_use && app_id == p_scb->app_id) {
/* save temp bd_addr */
bd_addr = p_scb->bd_addr;
found = true;
}
/* If cannot find a match then there is no connection at all */
- if (found == false) return false;
+ if (!found) return false;
/* Find whether there is another connection with different device other than
PANU.
Could be same service or different service */
for (uint8_t index = 0; index < BTA_PAN_NUM_CONN; index++) {
p_scb = &bta_pan_cb.scb[index];
- if (p_scb->in_use == true && p_scb->app_id != bta_pan_cb.app_id[0] &&
+ if (p_scb->in_use && p_scb->app_id != bta_pan_cb.app_id[0] &&
bd_addr != p_scb->bd_addr) {
return true;
}
/* if data path configured for rx pull */
if ((bta_pan_cb.flow_mask & BTA_PAN_RX_MASK) == BTA_PAN_RX_PULL) {
/* if we can accept data */
- if (p_scb->pan_flow_enable == true) {
+ if (p_scb->pan_flow_enable) {
/* call application callout function for rx path */
bta_pan_co_rx_path(p_scb->handle, p_scb->app_id);
}
/* if configured for zero copy push */
else if ((bta_pan_cb.flow_mask & BTA_PAN_TX_MASK) == BTA_PAN_TX_PUSH_BUF) {
/* if app can accept data */
- if (p_scb->app_flow_enable == true) {
+ if (p_scb->app_flow_enable) {
BT_HDR* p_buf;
/* read data from the queue */
tBTA_SDP_STATUS status = BTA_SDP_FAILURE;
APPL_TRACE_API(__func__);
- if (p_cback && false == bta_sys_is_register(BTA_ID_SDP)) {
+ if (p_cback && !bta_sys_is_register(BTA_ID_SDP)) {
memset(&bta_sdp_cb, 0, sizeof(tBTA_SDP_CB));
/* register with BTA system manager */
for (; bta_id <= bta_id_max; bta_id++) {
if (bta_sys_cb.reg[bta_id] != NULL) {
- if (bta_sys_cb.is_reg[bta_id] == true &&
+ if (bta_sys_cb.is_reg[bta_id] &&
bta_sys_cb.reg[bta_id]->disable != NULL) {
(*bta_sys_cb.reg[bta_id]->disable)();
}
static int get_adapter_properties(void) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_get_adapter_properties();
}
static int get_adapter_property(bt_property_type_t type) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_get_adapter_property(type);
}
static int set_adapter_property(const bt_property_t* property) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_set_adapter_property(property);
}
int get_remote_device_properties(RawAddress* remote_addr) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_get_remote_device_properties(remote_addr);
}
int get_remote_device_property(RawAddress* remote_addr,
bt_property_type_t type) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_get_remote_device_property(remote_addr, type);
}
int set_remote_device_property(RawAddress* remote_addr,
const bt_property_t* property) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_set_remote_device_property(remote_addr, property);
}
int get_remote_services(RawAddress* remote_addr) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_get_remote_services(*remote_addr);
}
static int start_discovery(void) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_start_discovery();
}
static int cancel_discovery(void) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_cancel_discovery();
}
static int create_bond(const RawAddress* bd_addr, int transport) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_create_bond(bd_addr, transport);
}
static int create_bond_out_of_band(const RawAddress* bd_addr, int transport,
const bt_out_of_band_data_t* oob_data) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_create_bond_out_of_band(bd_addr, transport, oob_data);
}
static int cancel_bond(const RawAddress* bd_addr) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_cancel_bond(bd_addr);
}
return BT_STATUS_SUCCESS;
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_remove_bond(bd_addr);
}
static int get_connection_state(const RawAddress* bd_addr) {
/* sanity check */
- if (interface_ready() == false) return 0;
+ if (!interface_ready()) return 0;
return btif_dm_get_connection_state(bd_addr);
}
static int pin_reply(const RawAddress* bd_addr, uint8_t accept, uint8_t pin_len,
bt_pin_code_t* pin_code) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_pin_reply(bd_addr, accept, pin_len, pin_code);
}
static int ssp_reply(const RawAddress* bd_addr, bt_ssp_variant_t variant,
uint8_t accept, uint32_t passkey) {
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dm_ssp_reply(bd_addr, variant, accept, passkey);
}
static int read_energy_info() {
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
btif_dm_read_energy_info();
return BT_STATUS_SUCCESS;
}
LOG_INFO(LOG_TAG, "%s: id = %s", __func__, profile_id);
/* sanity check */
- if (interface_ready() == false) return NULL;
+ if (!interface_ready()) return NULL;
/* check for supported profile interfaces */
if (is_profile(profile_id, BT_PROFILE_HANDSFREE_ID))
LOG_INFO(LOG_TAG, "%s", __func__);
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dut_mode_configure(enable);
}
LOG_INFO(LOG_TAG, "%s", __func__);
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_dut_mode_send(opcode, buf, len);
}
LOG_INFO(LOG_TAG, "%s", __func__);
/* sanity check */
- if (interface_ready() == false) return BT_STATUS_NOT_READY;
+ if (!interface_ready()) return BT_STATUS_NOT_READY;
return btif_le_test_mode(opcode, buf, len);
}
rc = btsnoop_compress(ringbuffer, buffer);
}
- if (rc == false) {
+ if (!rc) {
dprintf(fd, "%s Log compression failed", __func__);
goto error;
}
BTIF_TRACE_DEBUG("%s: bond state=%d", __func__, pairing_cb.state);
RawAddress bd_addr = p_auth_cmpl->bd_addr;
- if ((p_auth_cmpl->success == true) && (p_auth_cmpl->key_present)) {
+ if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) {
if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) ||
(p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) ||
(p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) ||
/* Clear OOB data */
memset(&oob_cb, 0, sizeof(oob_cb));
- if ((p_auth_cmpl->success == true) && (p_auth_cmpl->key_present)) {
+ if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) {
/* store keys */
}
if (p_auth_cmpl->success) {
HAL_CBACK(bt_gatt_callbacks, client->notify_cb, p_data->notify.conn_id,
data);
- if (p_data->notify.is_notify == false)
+ if (!p_data->notify.is_notify)
BTA_GATTC_SendIndConfirm(p_data->notify.conn_id, p_data->notify.handle);
break;
we should set the BTA AG Codec to mSBC. This would trigger a +BCS to mSBC
at the time
of SCO connection establishment */
- if ((btif_conf_hf_force_wbs == true) &&
- (p_data->val.num & BTA_AG_CODEC_MSBC)) {
+ if ((btif_conf_hf_force_wbs) && (p_data->val.num & BTA_AG_CODEC_MSBC)) {
BTIF_TRACE_EVENT("%s: btif_hf override-Preferred Codec to MSBC",
__func__);
BTA_AgSetCodec(btif_hf_cb[idx].handle, BTA_AG_CODEC_MSBC);
__func__, p_dev->rc_handle, index, label, code,
dump_rc_pdu(pmetamsg_resp->rsp.pdu));
- if (index >= 0 && p_dev->rc_pdu_info[index].is_rsp_pending == false) {
+ if (index >= 0 && !p_dev->rc_pdu_info[index].is_rsp_pending) {
BTIF_TRACE_ERROR("%s: is_rsp_pending false, returning", __func__);
return;
}
case AVRC_PDU_INFORM_DISPLAY_CHARSET: {
tAVRC_RESPONSE avrc_rsp;
BTIF_TRACE_EVENT("%s: AVRC_PDU_INFORM_DISPLAY_CHARSET", __func__);
- if (p_dev->rc_connected == true) {
+ if (p_dev->rc_connected) {
memset(&(avrc_rsp.inform_charset), 0, sizeof(tAVRC_RSP));
avrc_rsp.inform_charset.opcode =
opcode_from_pdu(AVRC_PDU_INFORM_DISPLAY_CHARSET);
return;
}
- if (p_dev->rc_procedure_complete == true) {
+ if (p_dev->rc_procedure_complete) {
return;
}
p_dev->rc_procedure_complete = true;
CHECK_RC_CONNECTED(p_dev);
/* check if rsp to previous cmd was completed */
- if (p_dev->rc_pdu_info[IDX_GET_FOLDER_ITEMS_RSP].is_rsp_pending == false) {
+ if (!p_dev->rc_pdu_info[IDX_GET_FOLDER_ITEMS_RSP].is_rsp_pending) {
BTIF_TRACE_WARNING("%s: Not sending response as no PDU was registered",
__func__);
return BT_STATUS_UNHANDLED;
__func__, rsp_status, avrc_rsp.br_player.status);
/* check if rsp to previous cmd was completed */
- if (p_dev->rc_pdu_info[IDX_SET_BROWSED_PLAYER_RSP].is_rsp_pending == false) {
+ if (!p_dev->rc_pdu_info[IDX_SET_BROWSED_PLAYER_RSP].is_rsp_pending) {
BTIF_TRACE_WARNING("%s: Not sending response as no PDU was registered",
__func__);
return BT_STATUS_UNHANDLED;
p_event = NULL;
}
/* Registered for all events, we can request application settings */
- if (p_event == NULL && p_dev->rc_app_settings.query_started == false) {
+ if (p_event == NULL && !p_dev->rc_app_settings.query_started) {
/* we need to do this only if remote TG supports
* player application settings
*/
if (handle != -1 && handle != 0) {
bool result;
result = SDP_DeleteRecord(handle);
- if (result == false) {
+ if (!result) {
BTIF_TRACE_ERROR(" Unable to remove handle 0x%08x", handle);
}
}
return BT_STATUS_FAIL;
}
- if (p_cb->p_handlers[p_cb->state](event, data) == false)
- return BT_STATUS_UNHANDLED;
+ if (!p_cb->p_handlers[p_cb->state](event, data)) return BT_STATUS_UNHANDLED;
return status;
}
}
/* Send exit event to the current state */
- if (p_cb->p_handlers[p_cb->state](BTIF_SM_EXIT_EVT, NULL) == false)
+ if (!p_cb->p_handlers[p_cb->state](BTIF_SM_EXIT_EVT, NULL))
status = BT_STATUS_UNHANDLED;
/* Change to the new state */
p_cb->state = state;
/* Send enter event to the new state */
- if (p_cb->p_handlers[p_cb->state](BTIF_SM_ENTER_EVT, NULL) == false)
+ if (!p_cb->p_handlers[p_cb->state](BTIF_SM_ENTER_EVT, NULL))
status = BT_STATUS_UNHANDLED;
return status;
// lower-level close() should be idempotent... so let's call it and see...
if (sock->is_le_coc) {
// Only call if we are non server connections
- if (sock->handle >= 0 && (sock->server == false)) {
+ if (sock->handle >= 0 && (!sock->server)) {
BTA_JvL2capClose(sock->handle);
}
- if ((sock->channel >= 0) && (sock->server == true)) {
+ if ((sock->channel >= 0) && (sock->server)) {
BTA_JvFreeChannel(sock->channel, BTA_JV_CONN_TYPE_L2CAP);
}
} else {
// Only call if we are non server connections
- if ((sock->handle >= 0) && (sock->server == false)) {
+ if ((sock->handle >= 0) && (!sock->server)) {
if (sock->fixed_chan)
BTA_JvL2capCloseLE(sock->handle);
else
BTA_JvL2capClose(sock->handle);
}
- if ((sock->channel >= 0) && (sock->server == true)) {
+ if ((sock->channel >= 0) && (sock->server)) {
if (sock->fixed_chan)
BTA_JvFreeChannel(sock->channel, BTA_JV_CONN_TYPE_L2CAP_LE);
else
APPL_TRACE_DEBUG("on_srv_l2cap_listen_started() sock->handle =%d id:%d",
sock->handle, sock->id);
- if (sock->server_psm_sent == false) {
+ if (!sock->server_psm_sent) {
if (!send_app_psm_or_chan_l(sock)) {
// closed
APPL_TRACE_DEBUG("send_app_psm() failed, close rs->id:%d", sock->id);
sock->server);
// TODO: This does not seem to be called...
// I'm not sure if this will be called for non-server sockets?
- if (!sock->fixed_chan && (sock->server == true)) {
+ if (!sock->fixed_chan && (sock->server)) {
BTA_JvFreeChannel(sock->channel, BTA_JV_CONN_TYPE_L2CAP);
}
btsock_l2cap_free_l(sock);
}
static bool send_app_scn(rfc_slot_t* slot) {
- if (slot->scn_notified == true) {
+ if (slot->scn_notified) {
// already send, just return success.
return true;
}
APPL_TRACE_DEBUG("send_app_scn() failed, close rs->id:%d", rs->id);
cleanup_rfc_slot(rs);
} else {
- if (rs->is_service_uuid_valid == true) {
+ if (rs->is_service_uuid_valid) {
// We already have data for SDP record, create it (RFC-only
// profiles)
BTA_JvCreateRecordByUser(rs->id);
proto_list[1].num_params = 1;
proto_list[1].params[0] = channel;
- if (with_obex == true) {
+ if (with_obex) {
proto_list[2].protocol_uuid = UUID_PROTOCOL_OBEX;
proto_list[2].num_params = 0;
}
ret = btif_config_get_int(bdstr, BTIF_STORAGE_PATH_REMOTE_VER_MFCT,
&info->manufacturer);
- if (ret == true)
+ if (ret)
ret = btif_config_get_int(bdstr, BTIF_STORAGE_PATH_REMOTE_VER_VER,
&info->version);
- if (ret == true)
+ if (ret)
ret = btif_config_get_int(bdstr, BTIF_STORAGE_PATH_REMOTE_VER_SUBVER,
&info->sub_ver);
}
RawAddress* bd_addr = (RawAddress*)property->val;
/* Fetch the local BD ADDR */
const controller_t* controller = controller_get_interface();
- if (controller->get_is_ready() == false) {
+ if (!controller->get_is_ready()) {
LOG_ERROR(LOG_TAG,
"%s: Controller not ready! Unable to return Bluetooth Address",
__func__);
}
/* if no ccbs bound to this lcb, disconnect */
- if (bind == false) {
+ if (!bind) {
avct_bcb_event(p_bcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
return;
}
}
/* if no ccbs bound to this lcb, disconnect */
- if (bind == false) {
+ if (!bind) {
avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
}
}
/* set event */
event = (p_data->cong) ? AVCT_CONG_IND_EVT : AVCT_UNCONG_IND_EVT;
p_lcb->cong = p_data->cong;
- if (p_lcb->cong == false && !fixed_queue_is_empty(p_lcb->tx_q)) {
+ if (!p_lcb->cong && !fixed_queue_is_empty(p_lcb->tx_q)) {
while (!p_lcb->cong &&
(p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_lcb->tx_q)) != NULL) {
if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) {
UINT16_TO_BE_STREAM(p, p_data->ul_msg.p_ccb->cc.pid);
}
- if (p_lcb->cong == true) {
+ if (p_lcb->cong) {
fixed_queue_enqueue(p_lcb->tx_q, p_buf);
}
/* do we have responses to send? send them */
else if (!fixed_queue_is_empty(p_ccb->rsp_q)) {
while ((p_msg = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) {
- if (avdt_msg_send(p_ccb, p_msg) == true) {
+ if (avdt_msg_send(p_ccb, p_msg)) {
/* break out if congested */
break;
}
drop_code = 4;
} else if (cr == AVCT_RSP) {
- if (req_continue == true) {
+ if (req_continue) {
avrc_cmd.pdu = AVRC_PDU_REQUEST_CONTINUATION_RSP;
drop_code = 2;
- } else if (buf_overflow == true) {
+ } else if (buf_overflow) {
/* Incoming message too big to fit in BT_DEFAULT_BUFFER_SIZE. Send abort
* to peer */
avrc_cmd.pdu = AVRC_PDU_ABORT_CONTINUATION_RSP;
drop = true;
}
- if (drop == false) {
+ if (!drop) {
msg.hdr.opcode = opcode;
(*avrc_cb.ccb[handle].p_msg_cback)(handle, label, opcode, &msg);
} else {
/* AVRCP spec has not defined any control channel commands that needs
* fragmentation at this level
* check for fragmentation only on the response */
- if ((cr == AVCT_RSP) && (chk_frag == true)) {
+ if ((cr == AVCT_RSP) && (chk_frag)) {
if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN) {
int offset_len = MAX(AVCT_MSG_OFFSET, p_pkt->offset);
BT_HDR* p_pkt_new =
/* min len required = item_type(1) + item len(2) + min item (14) = 17 */
for (xx = 0;
xx < p_rsp->item_count && len_left > AVRC_MIN_LEN_GET_FOLDER_ITEMS_RSP &&
- multi_items_add_fail == false;
+ !multi_items_add_fail;
xx++) {
p_item_start = p_data;
UINT8_TO_BE_STREAM(p_data, p_item_list[xx].item_type);
p_player = &p_item_list[xx].u.player;
item_len = AVRC_FEATURE_MASK_SIZE + p_player->name.str_len + 12;
- if ((len_left <= item_len) ||
- AVRC_ITEM_PLAYER_IS_VALID(p_player) == false) {
+ if ((len_left <= item_len) || !AVRC_ITEM_PLAYER_IS_VALID(p_player)) {
p_data = p_item_start;
} else {
UINT16_TO_BE_STREAM(p_data, p_player->player_id);
/* fill in variable item lenth */
UINT16_TO_BE_STREAM(p_item_len, item_len);
} else {
- if (multi_items_add_fail == false) {
+ if (!multi_items_add_fail) {
/* some item is not added properly - set an error status */
if (len_left < item_len)
status = AVRC_STS_INTERNAL_ERR;
status = AVRC_STS_BAD_PARAM;
}
}
- if (multi_items_add_fail == false) {
+ if (!multi_items_add_fail) {
len += item_len;
len += 3; /* the item_type(1) and item_len(2) */
}
#if (BLE_VND_INCLUDED == TRUE)
extern void BTM_BleReadControllerFeatures(
tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback) {
- if (true == btm_cb.cmn_ble_vsc_cb.values_read) return;
+ if (btm_cb.cmn_ble_vsc_cb.values_read) return;
BTM_TRACE_DEBUG("BTM_BleReadControllerFeatures");
}
if ((p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) &&
- btm_ble_brcm_find_resolving_pending_entry(
- p_dev_rec->bd_addr, BTM_BLE_META_REMOVE_IRK_ENTRY) == false) {
+ !btm_ble_brcm_find_resolving_pending_entry(
+ p_dev_rec->bd_addr, BTM_BLE_META_REMOVE_IRK_ENTRY)) {
btm_ble_update_resolving_list(p_dev_rec->bd_addr, false);
btm_ble_remove_resolving_list_entry(p_dev_rec);
} else {
free_idx = i;
} else if (btm_cb.devcb.p_vend_spec_cb[i] == p_cb) {
/* Found callback in lookup table. If deregistering, clear the entry. */
- if (is_register == false) {
+ if (!is_register) {
btm_cb.devcb.p_vend_spec_cb[i] = NULL;
BTM_TRACE_EVENT("BTM Deregister For VSEvents is successfully");
}
/* Only process the inquiry filter; Ignore the connection filter until it
is used by the upper layers */
- if (p_inq->inqfilt_active == true) {
+ if (p_inq->inqfilt_active) {
/* Extract the returned status from the buffer */
STREAM_TO_UINT8(hci_status, p);
if (hci_status != HCI_SUCCESS) {
else
p_i->inq_info.results.rssi = BTM_INQ_RES_IGNORE_RSSI;
- if (is_new == true) {
+ if (is_new) {
/* Save the info */
p_cur = &p_i->inq_info.results;
p_cur->page_scan_rep_mode = page_scan_rep_mode;
/* If the inquire BDA and remote DBA are the same, then stop the timer and set
* the active to false */
- if ((p_inq->remname_active == true) &&
- (!bda || (*bda == p_inq->remname_bda))) {
+ if ((p_inq->remname_active) && (!bda || (*bda == p_inq->remname_bda))) {
if (BTM_UseLeLink(p_inq->remname_bda)) {
if (hci_status == HCI_ERR_UNSPECIFIED)
btm_ble_cancel_remote_name(p_inq->remname_bda);
if (mode != BTM_PM_MD_ACTIVE && p_cb->state != BTM_PM_MD_ACTIVE)
p_cb->chg_ind = true; /* needs to wake, then sleep */
- if (p_cb->chg_ind == true) /* needs to wake first */
+ if (p_cb->chg_ind) /* needs to wake first */
md_res.mode = BTM_PM_MD_ACTIVE;
#if (BTM_SSR_INCLUDED == TRUE)
else if (BTM_PM_MD_SNIFF == md_res.mode && p_cb->max_lat) {
btm_pm_snd_md_req(BTM_PM_SET_ONLY_ID, xx, NULL);
} else {
for (zz = 0; zz < MAX_L2CAP_LINKS; zz++) {
- if (btm_cb.pm_mode_db[zz].chg_ind == true) {
+ if (btm_cb.pm_mode_db[zz].chg_ind) {
#if (BTM_PM_DEBUG == TRUE)
BTM_TRACE_DEBUG("btm_pm_proc_mode_change: Sending PM req :%d", zz);
#endif // BTM_PM_DEBUG
*
******************************************************************************/
tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void) {
- if (true == btm_pm_device_in_active_or_sniff_mode())
+ if (btm_pm_device_in_active_or_sniff_mode())
return BTM_CONTRL_ACTIVE;
- else if (true == btm_pm_device_in_scan_state())
+ else if (btm_pm_device_in_scan_state())
return BTM_CONTRL_SCAN;
else
return BTM_CONTRL_IDLE;
/* Only check if link key already exists */
if (!(p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN)) return;
- if (btm_sec_is_upgrade_possible(p_dev_rec, is_originator) == true) {
+ if (btm_sec_is_upgrade_possible(p_dev_rec, is_originator)) {
BTM_TRACE_DEBUG("need upgrade!! sec_flags:0x%x", p_dev_rec->sec_flags);
/* upgrade is possible: check if the application wants the upgrade.
* If the application is configured to use a global MITM flag,
/* set up the control block to indicated dedicated bonding */
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE;
- if (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == false) {
+ if (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR)) {
LOG(WARNING) << "Security Manager: failed create allocate LCB "
<< p_dev_rec->bd_addr;
"service id:%d, is trusted:%d", p_dev_rec->p_cur_service->service_id,
(BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask,
p_dev_rec->p_cur_service->service_id)));
- if ((btm_sec_are_all_trusted(p_dev_rec->trusted_mask) == false) &&
+ if ((!btm_sec_are_all_trusted(p_dev_rec->trusted_mask)) &&
(p_dev_rec->p_cur_service->service_id < BTM_SEC_MAX_SERVICES) &&
- (BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask,
- p_dev_rec->p_cur_service->service_id) ==
- false)) {
+ (!BTM_SEC_IS_SERVICE_TRUSTED(p_dev_rec->trusted_mask,
+ p_dev_rec->p_cur_service->service_id))) {
BTM_TRACE_EVENT("Security Manager: Start authorization");
return (btm_sec_start_authorization(p_dev_rec));
}
"0x%02x",
__func__, major, minor);
- if (btm_cb.security_mode_changed == false) {
+ if (!btm_cb.security_mode_changed) {
btm_cb.security_mode_changed = true;
#ifdef APPL_AUTH_WRITE_EXCEPTION
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
uint16_t conn_id;
/* if uncongested, check to see if there is any more pending data */
- if (p_tcb != NULL && congested == false) {
+ if (p_tcb != NULL && !congested) {
gatt_cl_send_next_cmd_inq(*p_tcb);
}
/* notifying all applications for the connection up event */
req.client_read_index = i;
status = (*gatt_cb.cb_info.p_srv_chg_callback)(
GATTS_SRV_CHG_CMD_READ_CLENT, &req, &rsp);
- if (status == true) {
+ if (status) {
memcpy(&srv_chg_clt, &rsp.srv_chg, sizeof(tGATTS_SRV_CHG));
if (gatt_add_srv_chg_clt(&srv_chg_clt) == NULL) {
LOG(ERROR) << "Unable to add a service change client";
* controller */
if ((HCI_NON_FLUSHABLE_PB_SUPPORTED(BTM_ReadLocalFeatures())) &&
(BTM_GetNumScoLinks() == 0)) {
- if (l2cb.is_flush_active == false) {
+ if (!l2cb.is_flush_active) {
l2cb.is_flush_active = true;
/* The only packet type defined - 0 - Automatically-Flushable Only */
alarm_cancel(p_ccb->l2c_ccb_timer);
/* If failure was channel mode try to renegotiate */
- if (l2c_fcr_renegotiate_chan(p_ccb, p_cfg) == false) {
+ if (!l2c_fcr_renegotiate_chan(p_ccb, p_cfg)) {
L2CAP_TRACE_API(
"L2CAP - Calling Config_Rsp_Cb(), CID: 0x%04x, Failure: %d",
p_ccb->local_cid, p_cfg->result);
CHECK(p_ccb != NULL);
if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) {
/* Check if remote side flowed us off or the transmit window is full */
- if ((p_ccb->fcrb.remote_busy == true) ||
+ if ((p_ccb->fcrb.remote_busy) ||
(fixed_queue_length(p_ccb->fcrb.waiting_for_ack_q) >=
p_ccb->peer_cfg.fcr.tx_win_sz)) {
#if (L2CAP_ERTM_STATS == TRUE)
/* If a window has opened, check if we can send any more packets */
if ((!fixed_queue_is_empty(p_ccb->fcrb.retrans_q) ||
!fixed_queue_is_empty(p_ccb->xmit_hold_q)) &&
- (p_ccb->fcrb.wait_ack == false) &&
- (l2c_fcr_is_flow_controlled(p_ccb) == false)) {
+ (!p_ccb->fcrb.wait_ack) && (!l2c_fcr_is_flow_controlled(p_ccb))) {
l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, NULL);
}
}
}
}
- if (packet_ok == false) {
+ if (!packet_ok) {
osi_free(p_buf);
} else if (p_buf != NULL) {
#if (L2CAP_NUM_FIXED_CHNLS > 0)
}
/* Get a new buffer and copy the data that can be sent in a PDU */
- if (first_seg == true)
+ if (first_seg)
p_xmit = l2c_fcr_clone_buf(p_buf, L2CAP_LCC_OFFSET, no_of_bytes_to_send);
else
p_xmit = l2c_fcr_clone_buf(p_buf, L2CAP_MIN_OFFSET, no_of_bytes_to_send);
p_buf->event = p_ccb->local_cid;
p_xmit->event = p_ccb->local_cid;
- if (first_seg == true) {
+ if (first_seg) {
p_xmit->offset -= L2CAP_LCC_SDU_LENGTH; /* for writing the SDU length. */
p = (uint8_t*)(p_xmit + 1) + p_xmit->offset;
UINT16_TO_STREAM(p, sdu_len);
return (NULL);
}
- if (last_seg == true) {
+ if (last_seg) {
p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->xmit_hold_q);
osi_free(p_buf);
}
p_ccb = pn;
}
- if (p_lcb->link_state == LST_CONNECTING && l2cb.is_ble_connecting == true) {
+ if (p_lcb->link_state == LST_CONNECTING && l2cb.is_ble_connecting) {
L2CA_CancelBleConnectReq(l2cb.ble_connecting_bda);
}
/* Release the LCB */
/* Make sure MTU is at least the minimum */
if (p_cfg->mtu >= L2CAP_MIN_MTU) {
/* In basic mode, limit the MTU to our buffer size */
- if ((p_cfg->fcr_present == false) && (p_cfg->mtu > L2CAP_MTU_SIZE))
+ if ((!p_cfg->fcr_present) && (p_cfg->mtu > L2CAP_MTU_SIZE))
p_cfg->mtu = L2CAP_MTU_SIZE;
/* Save the accepted value in case of renegotiation */
L2CAP_TRACE_API(
"l2cu_create_conn - btm_is_sco_active_by_bdaddr() is_sco_active = %s",
- (is_sco_active == true) ? "true" : "false");
+ (is_sco_active) ? "true" : "false");
- if (is_sco_active == true)
+ if (is_sco_active)
continue; /* No Master Slave switch not allowed when SCO Active */
#endif
/*4_1_TODO check if btm_cb.devcb.local_features to be used instead */
*
******************************************************************************/
void mca_dcb_do_disconn(tMCA_DCB* p_dcb, UNUSED_ATTR tMCA_DCB_EVT* p_data) {
- if ((p_dcb->lcid == 0) || (L2CA_DisconnectReq(p_dcb->lcid) == false)) {
+ if ((p_dcb->lcid == 0) || (!L2CA_DisconnectReq(p_dcb->lcid))) {
tMCA_CLOSE close;
close.param = MCA_INT;
close.reason = L2CAP_DISC_OK;
}
int available = 0;
// if(ioctl(fd, FIONREAD, &available) < 0)
- if (p_port->p_data_co_callback(
- handle, (uint8_t*)&available, sizeof(available),
- DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE) == false) {
+ if (!p_port->p_data_co_callback(handle, (uint8_t*)&available,
+ sizeof(available),
+ DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE)) {
RFCOMM_TRACE_ERROR(
"p_data_co_callback DATA_CO_CALLBACK_TYPE_INCOMING_SIZE failed, "
"available:%d",
(((int)p_buf->len + available) <= (int)length)) {
// if(recv(fd, (uint8_t *)(p_buf + 1) + p_buf->offset + p_buf->len,
// available, 0) != available)
- if (p_port->p_data_co_callback(
+ if (!p_port->p_data_co_callback(
handle, (uint8_t*)(p_buf + 1) + p_buf->offset + p_buf->len,
- available, DATA_CO_CALLBACK_TYPE_OUTGOING) == false)
+ available, DATA_CO_CALLBACK_TYPE_OUTGOING))
{
error(
// memcpy ((uint8_t *)(p_buf + 1) + p_buf->offset, p_data, length);
// if(recv(fd, (uint8_t *)(p_buf + 1) + p_buf->offset, (int)length, 0) !=
// (int)length)
- if (p_port->p_data_co_callback(
- handle, (uint8_t*)(p_buf + 1) + p_buf->offset, length,
- DATA_CO_CALLBACK_TYPE_OUTGOING) == false) {
+ if (!p_port->p_data_co_callback(handle,
+ (uint8_t*)(p_buf + 1) + p_buf->offset,
+ length, DATA_CO_CALLBACK_TYPE_OUTGOING)) {
error(
"p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, length:%d",
length);
RFCOMM_TRACE_EVENT("rfc_inc_credit:%d", p_port->credit_tx);
- if (p_port->tx.peer_fc == true)
- PORT_FlowInd(p_port->rfc.p_mcb, p_port->dlci, true);
+ if (p_port->tx.peer_fc) PORT_FlowInd(p_port->rfc.p_mcb, p_port->dlci, true);
}
}
}
/* handle queue if L2CAP not congested */
- while (p_mcb->l2cap_congested == false) {
+ while (!p_mcb->l2cap_congested) {
BT_HDR* p = (BT_HDR*)fixed_queue_try_dequeue(p_mcb->cmd_q);
if (p == NULL) break;
L2CA_DataWrite(p_mcb->lcid, p);
if (SDP_DISC_ATTR_TYPE(p_sattr->attr_len_type) ==
DATA_ELE_SEQ_DESC_TYPE) {
ret = sdp_fill_proto_elem(p_sattr, layer_uuid, p_elem);
- if (ret == true) break;
+ if (ret) break;
}
}
return ret;
if (p_device_info == NULL) return SDP_ILLEGAL_PARAMETER;
/* if record is to be primary record, get handle to replace old primary */
- if (p_device_info->primary_record == true &&
- sdp_cb.server_db.di_primary_handle)
+ if (p_device_info->primary_record && sdp_cb.server_db.di_primary_handle)
handle = sdp_cb.server_db.di_primary_handle;
else {
handle = SDP_CreateRecord();
/* build the SDP entry */
/* Add the UUID to the Service Class ID List */
- if ((SDP_AddServiceClassIdList(handle, 1, &di_uuid)) == false)
+ if (!(SDP_AddServiceClassIdList(handle, 1, &di_uuid)))
result = SDP_DI_REG_FAILED;
/* mandatory */
if (result != SDP_SUCCESS)
SDP_DeleteRecord(handle);
- else if (p_device_info->primary_record == true)
+ else if (p_device_info->primary_record)
sdp_cb.server_db.di_primary_handle = handle;
return result;
p_rec; p_rec = sdp_db_service_search(p_rec, &uid_seq)) {
/* Allow space for attribute sequence type and length */
p_seq_start = p_rsp;
- if (p_ccb->cont_info.last_attr_seq_desc_sent == false) {
+ if (!p_ccb->cont_info.last_attr_seq_desc_sent) {
/* See if there is enough room to include a new service in the current
* response */
rem_len = max_list_len - (int16_t)(p_rsp - &p_ccb->rsp_list[0]);
}
/* Go back and put the type and length into the buffer */
- if (p_ccb->cont_info.last_attr_seq_desc_sent == false) {
+ if (!p_ccb->cont_info.last_attr_seq_desc_sent) {
seq_len = sdpu_get_attrib_seq_len(p_rec, &attr_seq_sav);
if (seq_len != 0) {
UINT8_TO_BE_STREAM(p_seq_start,
uint16_t start_id = 0, end_id = 0;
for (xx = 0; xx < attr_seq->num_attr; xx++) {
- if (is_range == false) {
+ if (!is_range) {
start_id = attr_seq->attr_entry[xx].start;
end_id = attr_seq->attr_entry[xx].end;
}
if (handle == p_db_attr->handle) {
if ((p_db_attr->uuid == GATT_UUID_PNP_ID ||
p_db_attr->uuid == GATT_UUID_SYSTEM_ID) &&
- is_long == true) {
+ is_long) {
st = GATT_NOT_LONG;
break;
}