component bt:added the stop adverstising API to the BTA module

This commit is contained in:
yulong 2016-10-19 01:55:14 -04:00
parent 2182b69b3d
commit fcf664276f
10 changed files with 67 additions and 11 deletions

View file

@ -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__);
}
}

View file

@ -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);
}
}
/*******************************************************************************
**

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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;

View file

@ -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);

View file

@ -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);