diff --git a/components/bt/bluedroid/bta/dm/bta_dm_act.c b/components/bt/bluedroid/bta/dm/bta_dm_act.c index ca673df09..e7b141f1a 100755 --- a/components/bt/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_act.c @@ -4800,6 +4800,27 @@ void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data) } +/******************************************************************************* +** +** Function bta_dm_ble_stop_advertising +** +** Description This function stop the BLE avdertising for the device. +** +** Parameters: void +** Explanation: This function added by Yulong at 2016/10/19 +*******************************************************************************/ +void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data) +{ + if(p_data->hdr.event != BTA_DM_API_BLE_STOP_ADV_EVT) + { + APPL_TRACE_ERROR("Invalid BTA event,cann't stop the BLE adverting\n"); + } + + btm_ble_stop_adv(); +} + + + #if BLE_PRIVACY_SPT == TRUE /******************************************************************************* ** @@ -4927,7 +4948,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data) if (BTM_SetBleDataLength(p_data->ble_set_data_length.remote_bda, p_data->ble_set_data_length.tx_data_length) != BTM_SUCCESS) { - APPL_TRACE_ERROR("%s failed", __FUNCTION__); + APPL_TRACE_ERROR("%s failed\n", __FUNCTION__); } } diff --git a/components/bt/bluedroid/bta/dm/bta_dm_api.c b/components/bt/bluedroid/bta/dm/bta_dm_api.c index 5dd94b6ac..9579843c5 100755 --- a/components/bt/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_api.c @@ -2089,6 +2089,32 @@ extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration, } } +/******************************************************************************* +** +** Function BTA_DmBleStopAdvertising +** +** Description This function set the random address for the APP +** +** Parameters void +** +** Returns void +** +** +*******************************************************************************/ +extern void BTA_DmBleStopAdvertising(void) +{ + BT_HDR *p_msg; + + APPL_TRACE_API("BTA_DmBleStopAdvertising\n"); + + if ((p_msg = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) + { + memset(p_msg, 0, sizeof(BT_HDR)); + p_msg->event = BTA_DM_API_BLE_STOP_ADV_EVT; + bta_sys_sendmsg(p_msg); + } +} + /******************************************************************************* ** diff --git a/components/bt/bluedroid/bta/dm/bta_dm_int.h b/components/bt/bluedroid/bta/dm/bta_dm_int.h index 7b407440f..08cbb907d 100755 --- a/components/bt/bluedroid/bta/dm/bta_dm_int.h +++ b/components/bt/bluedroid/bta/dm/bta_dm_int.h @@ -95,6 +95,9 @@ enum /*******This event added by Yulong at 2016/9/9 to support the random address setting for the APP******/ BTA_DM_API_SET_RAND_ADDR_EVT, + /*******This event added by Yulong at 2016/10/19 to + support stop the ble advertising setting by the APP******/ + BTA_DM_API_BLE_STOP_ADV_EVT, #if BLE_PRIVACY_SPT == TRUE BTA_DM_API_LOCAL_PRIVACY_EVT, #endif @@ -1128,6 +1131,7 @@ extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data); extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data); extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data); extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data); +extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data); extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data); extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data); extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data); diff --git a/components/bt/bluedroid/bta/dm/bta_dm_main.c b/components/bt/bluedroid/bta/dm/bta_dm_main.c index 40f8e0b21..ef4033134 100755 --- a/components/bt/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_main.c @@ -92,6 +92,9 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = /*******This handler function added by Yulong at 2016/9/9 to support the random address setting for the APP******/ bta_dm_ble_set_rand_address, /*BTA_DM_API_SET_RAND_ADDR_EVT*/ + /*******This handler function added by Yulong at 2016/10/19 to + support stop the ble advertising setting by the APP******/ + bta_dm_ble_stop_advertising, /*BTA_DM_API_BLE_STOP_ADV_EVT*/ #if BLE_PRIVACY_SPT == TRUE bta_dm_ble_config_local_privacy, /* BTA_DM_API_LOCAL_PRIVACY_EVT */ #endif diff --git a/components/bt/bluedroid/bta/include/bta_api.h b/components/bt/bluedroid/bta/include/bta_api.h index 4776d5954..8a5b11ad5 100755 --- a/components/bt/bluedroid/bta/include/bta_api.h +++ b/components/bt/bluedroid/bta/include/bta_api.h @@ -2023,6 +2023,8 @@ extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration, tBTA_DM_SEARCH_CBACK *p_results_cb); +extern void BTA_DmBleStopAdvertising(void); + extern void BTA_DmSetRandAddress(BD_ADDR rand_addr); #endif diff --git a/components/bt/bluedroid/stack/btm/btm_ble.c b/components/bt/bluedroid/stack/btm/btm_ble.c index 974bbfbfa..f12b960c0 100755 --- a/components/bt/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/bluedroid/stack/btm/btm_ble.c @@ -453,7 +453,7 @@ void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res) } p_dev_rec->sec_flags |= BTM_SEC_LE_AUTHENTICATED; - BTM_TRACE_DEBUG ("%s", __func__); + BTM_TRACE_DEBUG ("%s\n", __func__); SMP_ConfirmReply(bd_addr, res_smp); } diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index a12e074ba..540baf571 100755 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -659,7 +659,7 @@ BOOLEAN BTM_BleConfigPrivacy(BOOLEAN privacy_mode) #if BLE_PRIVACY_SPT == TRUE tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb; - BTM_TRACE_EVENT ("%s", __func__); + BTM_TRACE_EVENT ("%s\n", __func__); /* if LE is not supported, return error */ if (!controller_get_interface()->supports_ble()) @@ -1333,7 +1333,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length) *******************************************************************************/ UINT16 BTM_BleReadDiscoverability() { - BTM_TRACE_API("%s", __FUNCTION__); + BTM_TRACE_API("%s\n", __FUNCTION__); return (btm_cb.ble_ctr_cb.inq_var.discoverable_mode); } @@ -1350,7 +1350,7 @@ UINT16 BTM_BleReadDiscoverability() *******************************************************************************/ UINT16 BTM_BleReadConnectability() { - BTM_TRACE_API ("%s", __FUNCTION__); + BTM_TRACE_API ("%s\n", __FUNCTION__); return (btm_cb.ble_ctr_cb.inq_var.connectable_mode); } @@ -1782,7 +1782,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode) own_addr_type = p_addr_cb->own_addr_type; UINT16 adv_int_min, adv_int_max; - BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x", __FUNCTION__, mode, combined_mode); + BTM_TRACE_EVENT ("%s mode=0x%0x combined_mode=0x%x\n", __FUNCTION__, mode, combined_mode); /*** Check mode parameter ***/ if (mode > BTM_BLE_MAX_DISCOVERABLE) @@ -1800,7 +1800,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode) btu_stop_timer(&p_cb->fast_adv_timer); /* update adv params if start advertising */ - BTM_TRACE_EVENT ("evt_type=0x%x p-cb->evt_type=0x%x ", evt_type, p_cb->evt_type); + BTM_TRACE_EVENT ("evt_type=0x%x p-cb->evt_type=0x%x\n ", evt_type, p_cb->evt_type); if (new_mode == BTM_BLE_ADV_ENABLE) { diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index 4ba8f2847..bf16e0fb3 100755 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -447,7 +447,7 @@ void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired) *******************************************************************************/ void BTM_SetSecureConnectionsOnly (BOOLEAN secure_connections_only_mode) { - BTM_TRACE_API("%s: Mode : %u", __FUNCTION__, + BTM_TRACE_API("%s: Mode : %u\n", __FUNCTION__, secure_connections_only_mode); btm_cb.devcb.secure_connections_only = secure_connections_only_mode; diff --git a/components/bt/bluedroid/stack/gatt/gatt_sr.c b/components/bt/bluedroid/stack/gatt/gatt_sr.c index 7e6417bab..a48d8896f 100755 --- a/components/bt/bluedroid/stack/gatt/gatt_sr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_sr.c @@ -919,7 +919,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data) } else if (len < GATT_MTU_REQ_MIN_LEN) { - GATT_TRACE_ERROR("invalid MTU request PDU received."); + GATT_TRACE_ERROR("invalid MTU request PDU received.\n"); gatt_send_error_rsp (p_tcb, GATT_INVALID_PDU, GATT_REQ_MTU, 0, FALSE); } else @@ -933,7 +933,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data) else p_tcb->payload_size = mtu; - GATT_TRACE_ERROR("MTU request PDU with MTU size %d", p_tcb->payload_size); + GATT_TRACE_ERROR("MTU request PDU with MTU size %d\n", p_tcb->payload_size); l2cble_set_fixed_channel_tx_data_length(p_tcb->peer_bda, L2CAP_ATT_CID, p_tcb->payload_size); diff --git a/components/bt/bluedroid/stack/smp/smp_l2c.c b/components/bt/bluedroid/stack/smp/smp_l2c.c index 0aa5ee095..8988983bd 100755 --- a/components/bt/bluedroid/stack/smp/smp_l2c.c +++ b/components/bt/bluedroid/stack/smp/smp_l2c.c @@ -296,7 +296,7 @@ static void smp_br_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf) tSMP_CB *p_cb = &smp_cb; UINT8 *p = (UINT8 *)(p_buf + 1) + p_buf->offset; UINT8 cmd ; - SMP_TRACE_EVENT ("SMDBG l2c %s", __func__); + SMP_TRACE_EVENT ("SMDBG l2c %s\n", __func__); STREAM_TO_UINT8(cmd, p);