1. cleanup the warnings.
2. fix the some function called in gap
3. fix some code in btc_main
esp_err_t esp_ble_gap_stop_scanning(void)
{
btc_msg_t msg;
- btc_ble_gap_args_t arg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data);
-#if BLE_INCLUDED == TRUE
-static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc,
- BD_NAME p_bdn, UINT8 *features,
- BOOLEAN is_new, UINT16 handle,
- tBT_TRANSPORT transport);
-#else
-static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc,
- BD_NAME p_bdn, UINT8 *features,
- BOOLEAN is_new);
-#endif
-
-
static void bta_dm_policy_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
/* Extended Inquiry Response */
if ( bta_dm_search_cb.p_sdp_db != NULL && bta_dm_search_cb.p_sdp_db->raw_used != 0 &&
bta_dm_search_cb.p_sdp_db->raw_data != NULL) {
APPL_TRACE_DEBUG(
- "%s raw_data used = 0x%x raw_data_ptr = 0x%x", __func__,
+ "%s raw_data used = 0x%x raw_data_ptr = %p", __func__,
bta_dm_search_cb.p_sdp_db->raw_used,
bta_dm_search_cb.p_sdp_db->raw_data);
{
tSDP_UUID uuid;
- UINT16 num_attrs = 1;
tBTA_DM_MSG *p_msg;
memset (&uuid, 0, sizeof(tSDP_UUID));
bdcpy(bta_dm_search_cb.peer_bdaddr, remote_bd_addr);
- APPL_TRACE_DEBUG("%s name_discover_done = %d p_btm_inq_info 0x%x state = %d, transport=%d",
+ APPL_TRACE_DEBUG("%s name_discover_done = %d p_btm_inq_info %p state = %d, transport=%d",
__func__,
bta_dm_search_cb.name_discover_done,
bta_dm_search_cb.p_btm_inq_info,
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
if ( bta_dm_search_cb.p_btm_inq_info ) {
- APPL_TRACE_DEBUG("%s p_btm_inq_info 0x%x results.device_type 0x%x services_to_search 0x%x",
+ APPL_TRACE_DEBUG("%s p_btm_inq_info %p results.device_type 0x%x services_to_search 0x%x",
__func__,
bta_dm_search_cb.p_btm_inq_info,
bta_dm_search_cb.p_btm_inq_info->results.device_type,
}
-/*******************************************************************************
-**
-** Function bta_dm_acl_change_cback
-**
-** Description Callback from btm when acl connection goes up or down
-**
-**
-** Returns void
-**
-*******************************************************************************/
-#if BLE_INCLUDED == TRUE
-static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, BD_NAME p_bdn,
- UINT8 *features, BOOLEAN is_new, UINT16 handle,
- tBT_TRANSPORT transport)
-#else
-static void bta_dm_acl_change_cback(BD_ADDR p_bda, DEV_CLASS p_dc, BD_NAME p_bdn,
- UINT8 *features, BOOLEAN is_new)
-#endif
-{
- tBTA_DM_ACL_CHANGE *p_msg = (tBTA_DM_ACL_CHANGE *) GKI_getbuf(sizeof(tBTA_DM_ACL_CHANGE));
- if (p_msg != NULL) {
- memset(p_msg, 0, sizeof(tBTA_DM_ACL_CHANGE));
-
- bdcpy(p_msg->bd_addr, p_bda);
- p_msg->is_new = is_new;
-#if BLE_INCLUDED == TRUE
- p_msg->handle = handle;
- p_msg->transport = transport;
-#endif
- /* This is collision case */
- if (features != NULL) {
- if ((features[0] == 0xFF) && !is_new) {
- p_msg->event = BTM_BL_COLLISION_EVT;
- }
- }
-
- p_msg->hdr.event = BTA_DM_ACL_CHANGE_EVT;
- bta_sys_sendmsg(p_msg);
- }
-}
-
-
/*******************************************************************************
**
** Function bta_dm_rs_cback
break;
}
- APPL_TRACE_DEBUG("bta_dm_encrypt_cback status =%d p_callback=0x%x", bta_status, p_callback);
+ APPL_TRACE_DEBUG("bta_dm_encrypt_cback status =%d p_callback=%p", bta_status, p_callback);
if (p_callback) {
(*p_callback)(bd_addr, transport, bta_status);
tBTM_STATUS status = BTM_SUCCESS;
tBTA_DM_SEC sec_event;
char *p_name = NULL;
- UINT8 i;
- tBT_DEVICE_TYPE dev_type;
if (!bta_dm_cb.p_sec_cback) {
return BTM_NOT_AUTHORIZED;
if ( bta_dm_search_cb.ble_raw_used + sizeof(tBTA_GATT_ID) < bta_dm_search_cb.ble_raw_size ) {
- APPL_TRACE_DEBUG("ADDING BLE SERVICE uuid=0x%x, ble_ptr = 0x%x, ble_raw_used = 0x%x",
+ APPL_TRACE_DEBUG("ADDING BLE SERVICE uuid=0x%x, ble_ptr = %p, ble_raw_used = 0x%x",
service_id.uuid.uu.uuid16, bta_dm_search_cb.p_ble_rawdata, bta_dm_search_cb.ble_raw_used);
if (bta_dm_search_cb.p_ble_rawdata) {
{
UINT8 i, j;
- UINT16 policy_setting;
UINT8 *p = NULL;
tBTA_DM_PEER_DEVICE *p_dev;
static void bta_create_sap_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
- tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr;
tSDP_PROTOCOL_ELEM pe;
UINT16 pversion = -1;
}
}
-static bt_status_t btc_enable_bluetooth(void)
+static void btc_enable_bluetooth(void)
{
- BTA_EnableBluetooth(btc_sec_callback);
+ if (BTA_EnableBluetooth(btc_sec_callback) != BTA_SUCCESS) {
+ future_ready(*btc_main_get_future_p(BTC_MAIN_ENABLE_FUTURE), FUTURE_SUCCESS);
+ }
}
-static bt_status_t btc_disable_bluetooth(void)
+static void btc_disable_bluetooth(void)
{
- BTA_DisableBluetooth();
+ if (BTA_DisableBluetooth() != BTA_SUCCESS) {
+ future_ready(*btc_main_get_future_p(BTC_MAIN_DISABLE_FUTURE), FUTURE_SUCCESS);
+ }
}
void btc_init_callback(void)
future_ready(*btc_main_get_future_p(BTC_MAIN_INIT_FUTURE), FUTURE_SUCCESS);
}
-static bt_status_t btc_init_bluetooth(void)
+static void btc_init_bluetooth(void)
{
bte_main_boot_entry(btc_init_callback);
}
for (;;) {
if (pdTRUE == xQueueReceive(xBtcQueue, &msg, (portTickType)portMAX_DELAY)) {
- LOG_DEBUG("%s msg %u %u %u %08x\n", __func__, msg.sig, msg.pid, msg.act, msg.arg);
+ LOG_DEBUG("%s msg %u %u %u %p\n", __func__, msg.sig, msg.pid, msg.act, msg.arg);
switch (msg.sig) {
case BTC_SIG_API_CALL:
profile_tab[msg.pid].btc_call(&msg);
#include "blufi_adv.h"
#include "blufi_int.h"
-static uint8_t *success_msg = "BLUFI_CONFIG_OK";
-static uint8_t *failed_msg = "BLUFI_CONFIG_FAILED";
+const char success_msg[] = "BLUFI_CONFIG_OK";
+const char failed_msg[] = "BLUFI_CONFIG_FAILED";
#define BTC_BLUFI_CB_TO_APP(_event, _param) ((esp_profile_cb_t)btc_profile_cb_get(BTC_PID_BLUFI))(_event, _param)
{
tBTA_GATTS_RSP rsp;
tBT_UUID uuid = {LEN_UUID_16, {SVC_BLUFI_UUID}};
- UINT8 len = 0;
UINT8 *p_rec_data = NULL;
tBTA_GATT_STATUS status;
static void btc_blufi_config_success(void)
{
LOG_DEBUG("config success\n");
- blufi_msg_notify(success_msg, strlen(success_msg));
+ blufi_msg_notify((uint8_t *)success_msg, strlen(success_msg));
}
static void btc_blufi_config_failed(void)
{
LOG_DEBUG("config faield\n");
- blufi_msg_notify(failed_msg, strlen(failed_msg));
+ blufi_msg_notify((uint8_t *)failed_msg, strlen(failed_msg));
}
void btc_blufi_cb_handler(btc_msg_t *msg)
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT;
- param.adv_data_cmpl.status = status;
-
- ret = btc_transfer_context(&msg, ¶m,
- sizeof(esp_ble_gap_cb_param_t), NULL);
-
- if (ret != BT_STATUS_SUCCESS) {
- LOG_ERROR("%s btc_transfer_context failed\n", __func__);
- }
-}
-
-static void btc_set_scan_param_callback(tGATT_IF client_if, tBTA_STATUS status )
-{
- esp_ble_gap_cb_param_t param;
- bt_status_t ret;
- btc_msg_t msg;
-
- msg.sig = BTC_SIG_API_CB;
- msg.pid = BTC_PID_GAP_BLE;
- msg.act = ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT;
- param.adv_data_cmpl.status = status;
+ param.scan_rsp_data_cmpl.status = status;
ret = btc_transfer_context(&msg, ¶m,
sizeof(esp_ble_gap_cb_param_t), NULL);
}
}
-
-
static void btc_ble_set_adv_data(esp_ble_adv_data_t *adv_data,
tBTA_SET_ADV_DATA_CMPL_CBACK p_adv_data_cback)
{
tBTA_BLE_AD_MASK data_mask = 0;
- btc_to_bta_adv_data(adv_data, &gl_bta_adv_data, &data_mask);
-
if (!adv_data->set_scan_rsp) {
+ btc_to_bta_adv_data(adv_data, &gl_bta_adv_data, &data_mask);
BTA_DmBleSetAdvConfig(data_mask, &gl_bta_adv_data, p_adv_data_cback);
} else {
- BTA_DmBleSetScanRsp(data_mask, &gl_bta_adv_data, p_adv_data_cback);
+ btc_to_bta_adv_data(adv_data, &gl_bta_scan_rsp_data, &data_mask);
+ BTA_DmBleSetScanRsp(data_mask, &gl_bta_scan_rsp_data, p_adv_data_cback);
}
}
-
-static void btc_ble_set_scan_param(esp_ble_scan_params_t *ble_scan_params,
- tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback)
-{
- //tBTA_BLE_AD_MASK data_mask = 0;
- BTA_DmSetBleScanParams (ESP_DEFAULT_GATT_IF,
- ble_scan_params->scan_interval,
- ble_scan_params->scan_window,
- ble_scan_params->scan_type,
- scan_param_setup_cback);
- //btc_to_bta_adv_data(scan_rsp_data, &gl_bta_scan_rsp_data, &data_mask);
- //BTA_DmBleSetScanRsp(data_mask, &gl_bta_scan_rsp_data, p_scan_rsp_data_cback);
-}
-
-void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params)
+static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params)
{
tBTA_DM_DISC disc_mode = 0;
tBTA_DM_CONN conn_mode = 0;
}
}
-static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params,
- tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback)
+static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback)
{
if (BLE_ISVALID_PARAM(scan_params->scan_interval, BTM_BLE_SCAN_INT_MIN, BTM_BLE_SCAN_INT_MAX) &&
BLE_ISVALID_PARAM(scan_params->scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX) &&
(scan_params->scan_type == BTM_BLE_SCAN_MODE_ACTI || scan_params->scan_type == BTM_BLE_SCAN_MODE_PASS)) {
- BTA_DmSetBleScanFilterParams(0 /*client_if*/,
+ BTA_DmSetBleScanFilterParams(ESP_DEFAULT_GATT_IF, /*client_if*/
scan_params->scan_interval,
scan_params->scan_window,
scan_params->scan_type,
scan_params->own_addr_type,
scan_params->scan_filter_policy,
scan_param_setup_cback);
- }
+ } else {
+ btc_scan_params_callback(ESP_DEFAULT_GATT_IF, BTM_ILLEGAL_VALUE);
+ }
}
static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
break;
}
case BTC_GAP_BLE_ACT_SET_SCAN_PARAM:
- btc_ble_set_scan_param(&arg->set_scan_param.scan_params, btc_set_scan_param_callback);
+ btc_ble_set_scan_params(&arg->set_scan_param.scan_params, btc_scan_params_callback);
break;
case BTC_GAP_BLE_ACT_START_SCAN:
btc_ble_start_scanning(arg->start_scan.duration, btc_search_callback);
return LEN_UUID_128;
}
-int btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src)
+void btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src)
{
int i = 0;
}
case BTC_GATTS_ACT_OPEN: {
// Ensure device is in inquiry database
- int addr_type = 0;
- int device_type = 0;
tBTA_GATT_TRANSPORT transport = BTA_GATT_TRANSPORT_LE;
//TODO : implement address type and device type
#include "esp_gatt_defs.h"
#include "esp_gattc_api.h"
-int btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src);
+void btc128_to_bta_uuid(tBT_UUID *p_dest, uint8_t *p_src);
void btc_to_bta_uuid(tBT_UUID *p_dest, esp_bt_uuid_t *p_src);
void btc_to_bta_gatt_id(tBTA_GATT_ID *p_dest, esp_gatt_id_t *p_src);
void btc_to_bta_srvc_id(tBTA_GATT_SRVC_ID *p_dest, esp_gatt_srvc_id_t *p_src);
static const interop_entry_t interop_database[] = {
// Nexus Remote (Spike)
// Note: May affect other Asus brand devices
- {{0x08, 0x62, 0x66, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
- {{0x38, 0x2c, 0x4a, 0xc9, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
- {{0x38, 0x2c, 0x4a, 0xe6, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
- {{0x54, 0xa0, 0x50, 0xd9, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
- {{0xac, 0x9e, 0x17, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
- {{0xf0, 0x79, 0x59, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x08, 0x62, 0x66, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x38, 0x2c, 0x4a, 0xc9, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x38, 0x2c, 0x4a, 0xe6, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x54, 0xa0, 0x50, 0xd9, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0xac, 0x9e, 0x17, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0xf0, 0x79, 0x59, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
// Motorola Key Link
- {{0x1c, 0x96, 0x5a, 0, 0, 0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x1c, 0x96, 0x5a, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
// Flic smart button
- {{0x80, 0xe4, 0xda, 0x70, 0, 0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
+ {{{0x80, 0xe4, 0xda, 0x70, 0, 0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
// BMW car kits (Harman/Becker)
- {{0x9c, 0xdf, 0x03, 0, 0, 0}, 3, INTEROP_AUTO_RETRY_PAIRING}
+ {{{0x9c, 0xdf, 0x03, 0, 0, 0}}, 3, INTEROP_AUTO_RETRY_PAIRING}
};
#endif /*_INTEROP_DATABASE_H_*/
static int hci_layer_init_env(void);
static void hci_layer_deinit_env(void);
static void hci_host_thread_handler(void *arg);
-static int hci_send_async_command(bt_vendor_opcode_t opcode, void *param);
-static void event_finish_startup(void *context);
-static void firmware_config_callback(bool success);
-static void event_postload(void);
-static void sco_config_callback(bool success);
static void event_command_ready(fixed_queue_t *queue);
static void event_packet_ready(fixed_queue_t *queue);
static void restart_comamnd_waiting_response_timer(
hci_host_task_post();
}
-// Postload functions
-static void event_postload(void)
-{
- if (hci_send_async_command(BT_VND_OP_SCO_CFG, NULL) == -1) {
- // If couldn't configure sco, we won't get the sco configuration callback
- // so go pretend to do it now
- sco_config_callback(false);
-
- }
-}
-
-static void sco_config_callback(UNUSED_ATTR bool success)
-{
- LOG_INFO("%s postload finished.", __func__);
-}
// Command/packet transmitting functions
-
static void event_command_ready(fixed_queue_t *queue)
{
waiting_command_t *wait_entry = NULL;
return NULL;
}
-static int hci_send_async_command(bt_vendor_opcode_t opcode, void *param)
-{
-}
-
static void init_layer_interface()
{
if (!interface_created) {
#include "freertos/xtensa_api.h"
#include "rom/ets_sys.h"
-#define RTC_TIMER_TICKS_TO_MS(ticks) ((ticks/625)<<1 + (ticks-(ticks/625)*625)/312)
+#define RTC_TIMER_TICKS_TO_MS(ticks) (((ticks/625)<<1) + (ticks-(ticks/625)*625)/312)
#define BT_ALARM_START_WAIT_TICKS 100
for (i = 0; i < ALARM_CBS_NUM; i++) {
if (alarm_cbs[i].alarm_hdl == NULL) { //available
- LOG_DEBUG(">>>> %d %08x<<<<\n", i, &alarm_cbs[i]);
+ LOG_DEBUG("%s %d %p\n", __func__, i, &alarm_cbs[i]);
return &alarm_cbs[i];
}
}
}
alarm = pvTimerGetTimerID(xTimer);
- LOG_DEBUG("TimerID %08x, Name %s\n", alarm, pcTimerGetTimerName(xTimer));
+ LOG_DEBUG("TimerID %p, Name %s\n", alarm, pcTimerGetTimerName(xTimer));
if (alarm->cb) {
alarm->cb(alarm->cb_data);
}
BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT transport)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(remote_bda);
- tACL_CONN *p = btm_bda_to_acl(remote_bda, transport);
/* if no device can be located, return */
if (p_dev_rec == NULL) {
gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
}
-/*******************************************************************************
-** Function btm_enc_proc_ltk
-** Description send LTK reply when it's ready.
-*******************************************************************************/
-static void btm_enc_proc_ltk(tSMP_ENC *p)
-{
- UINT8 i;
- BTM_TRACE_DEBUG ("btm_enc_proc_ltk");
- if (p && p->param_len == BT_OCTET16_LEN) {
- for (i = 0; i < (BT_OCTET16_LEN - btm_cb.key_size); i ++) {
- p->param_buf[BT_OCTET16_LEN - i - 1] = 0;
- }
- btsnd_hcic_ble_ltk_req_reply(btm_cb.enc_handle, p->param_buf);
- }
-}
-
-/*******************************************************************************
-** Function btm_enc_proc_slave_y
-** Description calculate LTK when Y is ready
-*******************************************************************************/
-static void btm_enc_proc_slave_y(tSMP_ENC *p)
-{
- UINT16 div, y;
- UINT8 *pp = p->param_buf;
- tBTM_CB *p_cb = &btm_cb;
- tSMP_ENC output;
- tBTM_SEC_DEV_REC *p_dev_rec;
-
- BTM_TRACE_DEBUG ("btm_enc_proc_slave_y");
- if (p != NULL) {
- STREAM_TO_UINT16(y, pp);
-
- div = p_cb->ediv ^ y;
- p_dev_rec = btm_find_dev_by_handle (p_cb->enc_handle);
-
- if ( p_dev_rec &&
- p_dev_rec->ble.keys.div == div ) {
- BTM_TRACE_DEBUG ("LTK request OK");
- /* calculating LTK , LTK = E er(div) */
- SMP_Encrypt(p_cb->devcb.ble_encryption_key_value, BT_OCTET16_LEN, (UINT8 *)&div, 2, &output);
- btm_enc_proc_ltk(&output);
- } else {
- BTM_TRACE_DEBUG ("LTK request failed - send negative reply");
- btsnd_hcic_ble_ltk_req_neg_reply(p_cb->enc_handle);
- if (p_dev_rec) {
- btm_ble_link_encrypted(p_dev_rec->bd_addr, 0);
- }
-
- }
- }
-}
-
/*******************************************************************************
**
** Function btm_ble_ltk_request_reply
{
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
tBTM_CB *p_cb = &btm_cb;
- tSMP_ENC output;
if (p_rec == NULL) {
BTM_TRACE_ERROR("btm_ble_ltk_request_reply received for unknown device");
case SMP_COMPLT_EVT:
if (btm_cb.api.p_le_callback) {
/* the callback function implementation may change the IO capability... */
- BTM_TRACE_DEBUG ("btm_cb.api.p_le_callback=0x%x", btm_cb.api.p_le_callback );
+ BTM_TRACE_DEBUG ("btm_cb.api.p_le_callback=%p", btm_cb.api.p_le_callback );
(*btm_cb.api.p_le_callback) (event, bd_addr, (tBTM_LE_EVT_DATA *)p_data);
}
btm_ble_increment_sign_ctr(bd_addr, TRUE);
}
- BTM_TRACE_DEBUG("%s p_mac = %d", __func__, p_mac);
+ BTM_TRACE_DEBUG("%s p_mac = %p", __func__, p_mac);
BTM_TRACE_DEBUG("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x",
*p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3));
BTM_TRACE_DEBUG("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x",
btm_ble_adv_filt_cb.op_q.p_scan_cfg_cback[btm_ble_adv_filt_cb.op_q.next_idx] = p_cmpl_cback;
btm_ble_adv_filt_cb.op_q.p_filt_param_cback[btm_ble_adv_filt_cb.op_q.next_idx]
= p_filt_param_cback;
- BTM_TRACE_DEBUG("btm_ble_advfilt_enq_op_q: act_ocf:%d, action:%d, ocf:%d,cb_evt;%d, cback:%x",
+ BTM_TRACE_DEBUG("btm_ble_advfilt_enq_op_q: act_ocf:%d, action:%d, ocf:%d,cb_evt;%d, cback:%p",
btm_ble_adv_filt_cb.op_q.action_ocf[btm_ble_adv_filt_cb.op_q.next_idx], action,
ocf, cb_evt, p_cmpl_cback);
btm_ble_adv_filt_cb.op_q.next_idx = (btm_ble_adv_filt_cb.op_q.next_idx + 1)
STREAM_TO_UINT32(total_idle_time, p);
STREAM_TO_UINT32(total_energy_used, p);
- BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%ld, rx_t=%ld, ener_used=%ld, idle_t=%ld",
+ BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%u, rx_t=%u, ener_used=%u, idle_t=%u",
status, total_tx_time, total_rx_time, total_energy_used, total_idle_time);
if (NULL != ble_energy_info_cb.p_ener_cback)
return status;
}
+#if BLE_VND_INCLUDED == TRUE
/*******************************************************************************
**
** Function btm_vsc_brcm_features_complete
*******************************************************************************/
static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_params)
{
-#if BLE_VND_INCLUDED == TRUE
UINT8 status = 0xFF;
UINT8 *p;
if (p_ctrl_le_feature_rd_cmpl_cback != NULL) {
p_ctrl_le_feature_rd_cmpl_cback(status);
}
-#endif
}
+#endif
/*******************************************************************************
**
{
tBTM_LE_RANDOM_CB *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
- tBTM_STATUS status = BTM_SUCCESS;
BTM_TRACE_EVENT ("BTM_BleSetAdvParamsStartAdv\n");
chnl_map,
p_cb->afp);
- btm_ble_start_adv();
+ return btm_ble_start_adv();
}
#if BLE_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_rec = &btm_cb.sec_dev_rec[0];
tBTM_SEC_DEV_REC temp_rec = *p_target_rec;
- BD_ADDR dummy_bda = {0};
BTM_TRACE_DEBUG("%s\n", __func__);
*******************************************************************************/
static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_features)
{
- UINT8 last;
- UINT8 first;
-
BTM_TRACE_DEBUG ("btm_decode_ext_features_page page: %d", page_number);
switch (page_number) {
/* Extended (Legacy) Page 0 */
static BOOLEAN btm_sec_queue_encrypt_request (BD_ADDR bd_addr, tBT_TRANSPORT transport,
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
-static void btm_sec_clean_pending_req_queue (BD_ADDR remote_bda, tBT_TRANSPORT transport) ;
static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport,
UINT8 encr_enable);
-static BOOLEAN btm_sec_acceptor_rejects_bonding (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_use_smp_br_chnl(tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec);
is_originator = FALSE;
}
- BTM_TRACE_DEBUG ("%s() conn_type: 0x%x, 0x%x\n", __func__, conn_type, p_ref_data);
+ BTM_TRACE_DEBUG ("%s() conn_type: 0x%x, %p\n", __func__, conn_type, p_ref_data);
#else
is_originator = conn_type;
- BTM_TRACE_DEBUG ("%s() is_originator:%d, 0x%x\n", __func__, is_originator, p_ref_data);
+ BTM_TRACE_DEBUG ("%s() is_originator:%d, %p\n", __func__, is_originator, p_ref_data);
#endif
/* Find or get oldest record */
}
if (p_dev_rec) {
- BTM_TRACE_EVENT ("Security Manager: rmt_name_complete PairState: %s RemName: %s status: %d State:%d p_dev_rec: 0x%08x \n",
+ BTM_TRACE_EVENT ("Security Manager: rmt_name_complete PairState: %s RemName: %s status: %d State:%d p_dev_rec: %p \n",
btm_pair_state_descr (btm_cb.pairing_state), p_bd_name,
status, p_dev_rec->sec_state, p_dev_rec);
} else {
/* If we were delaying asking UI for a PIN because name was not resolved, ask now */
if ( (btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_LOCAL_PIN) && p_bd_addr
&& (memcmp (btm_cb.pairing_bda, p_bd_addr, BD_ADDR_LEN) == 0) ) {
- BTM_TRACE_EVENT ("btm_sec_rmt_name_request_complete() delayed pin now being requested flags:0x%x, (p_pin_callback=0x%p)\n", btm_cb.pairing_flags, btm_cb.api.p_pin_callback);
+ BTM_TRACE_EVENT ("btm_sec_rmt_name_request_complete() delayed pin now being requested flags:0x%x, (p_pin_callback=%p)\n", btm_cb.pairing_flags, btm_cb.api.p_pin_callback);
if (((btm_cb.pairing_flags & BTM_PAIR_FLAGS_WE_STARTED_DD) == 0) &&
((btm_cb.pairing_flags & BTM_PAIR_FLAGS_PIN_REQD) == 0) &&
p_dev_rec->sm4 |= BTM_SM4_TRUE;
- BTM_TRACE_EVENT("%s: State: %s Flags: 0x%04x p_cur_service: 0x%08x\n",
+ BTM_TRACE_EVENT("%s: State: %s Flags: 0x%04x p_cur_service: %p\n",
__FUNCTION__, btm_pair_state_descr(btm_cb.pairing_state),
btm_cb.pairing_flags, p_dev_rec->p_cur_service);
|| (!p_dev_rec->is_originator
&& ((p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK) == BTM_COD_MAJOR_PERIPHERAL)
&& (p_dev_rec->dev_class[2] & BTM_COD_MINOR_KEYBOARD)) ) {
- BTM_TRACE_WARNING("btm_sec_pin_code_request(): Pairing disabled:%d; PIN callback:%x, Dev Rec:%x!\n",
+ BTM_TRACE_WARNING("btm_sec_pin_code_request(): Pairing disabled:%d; PIN callback:%p, Dev Rec:%p!\n",
p_cb->pairing_disabled, p_cb->api.p_pin_callback, p_dev_rec);
btsnd_hcic_pin_code_neg_reply (p_bda);
}
}
-/*******************************************************************************
-**
-** Function btm_sec_clean_pending_req_queue
-**
-** Description This function cleans up the pending security request when the
-** link to the target device dropped.
-**
-** Returns void
-**
-*******************************************************************************/
-static void btm_sec_clean_pending_req_queue (BD_ADDR remote_bda, tBT_TRANSPORT transport)
-{
- tBTM_SEC_QUEUE_ENTRY *p_e;
- BUFFER_Q *bq = &btm_cb.sec_pending_q;
-
- p_e = (tBTM_SEC_QUEUE_ENTRY *)GKI_getfirst(bq);
-
- if (p_e != NULL) {
- if (memcmp(p_e->bd_addr, remote_bda, BD_ADDR_LEN) == 0
-#if BLE_INCLUDED == TRUE
- && p_e->transport == transport
-#endif
- ) {
- (*p_e->p_callback) (remote_bda, transport, p_e->p_ref_data, BTM_ERR_PROCESSING);
- GKI_remove_from_queue(bq, (void *)p_e);
- }
- p_e = (tBTM_SEC_QUEUE_ENTRY *) GKI_getnext ((void *)p_e);
- }
-}
-
/*******************************************************************************
**
** Function btm_sec_is_serv_level0
{
tGAP_CCB *p_ccb;
UINT16 cid;
- tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}};
+ //tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}};
GAP_TRACE_EVENT ("GAP_CONN - Open Request");
{
UINT16 xx;
tGAP_CCB *p_ccb;
- tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}};
+ //tBT_UUID bt_uuid = {2, {GAP_PROTOCOL_ID}};
/* See if we have a CCB listening for the connection */
for (xx = 0, p_ccb = gap_cb.conn.ccb_pool; xx < GAP_MAX_CONNECTIONS; xx++, p_ccb++) {
*******************************************************************************/
void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSPORT transport)
{
- UINT16 conn_id = GATT_INVALID_CONN_ID;
tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr (remote_bda, transport);
if (p_clcb == NULL) {
gatt_end_operation(p_clcb, GATT_SUCCESS, (void *)p_clcb->p_attr_buf);
}
} else { /* exception, should not happen */
- GATT_TRACE_ERROR("attr offset = %d p_attr_buf = %d ", offset, p_clcb->p_attr_buf);
+ GATT_TRACE_ERROR("attr offset = %d p_attr_buf = %p ", offset, p_clcb->p_attr_buf);
gatt_end_operation(p_clcb, GATT_NO_RESOURCES, (void *)p_clcb->p_attr_buf);
}
}
/* Double check in case any buffers are queued */
GATT_TRACE_DEBUG("gatt_dequeue_sr_cmd" );
if (p_tcb->sr_cmd.p_rsp_msg) {
- GATT_TRACE_ERROR("free p_tcb->sr_cmd.p_rsp_msg = %d", p_tcb->sr_cmd.p_rsp_msg);
+ GATT_TRACE_ERROR("%s free msg %p", __func__, p_tcb->sr_cmd.p_rsp_msg);
GKI_freebuf (p_tcb->sr_cmd.p_rsp_msg);
}
tL2C_RCB *p_rcb;
//counter_add("l2cap.conn.req", 1);
- L2CAP_TRACE_API ("L2CA_ErtmConnectReq() PSM: 0x%04x BDA: %08x%04x p_ertm_info: 0x%08x allowed:0x%x preferred:%d", psm,
+ L2CAP_TRACE_API ("L2CA_ErtmConnectReq() PSM: 0x%04x BDA: %08x%04x p_ertm_info: %p allowed:0x%x preferred:%d", psm,
(p_bd_addr[0] << 24) + (p_bd_addr[1] << 16) + (p_bd_addr[2] << 8) + p_bd_addr[3],
(p_bd_addr[4] << 8) + p_bd_addr[5], p_ertm_info,
(p_ertm_info) ? p_ertm_info->allowed_modes : 0,
if ( ((p_lcb = l2cu_allocate_lcb (p_bd_addr, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
/* currently use BR/EDR for ERTM mode l2cap connection */
|| (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE) ) {
- L2CAP_TRACE_WARNING ("L2CAP - conn not started for PSM: 0x%04x p_lcb: 0x%08x", psm, p_lcb);
+ L2CAP_TRACE_WARNING ("L2CAP - conn not started for PSM: 0x%04x p_lcb: %p", psm, p_lcb);
return (0);
}
}
tL2C_CCB *p_ccb;
//counter_add("l2cap.conn.rsp", 1);
- L2CAP_TRACE_API ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:0x%08x",
+ L2CAP_TRACE_API ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:%p",
lcid, result, status,
(p_bd_addr[0] << 24) + (p_bd_addr[1] << 16) + (p_bd_addr[2] << 8) + p_bd_addr[3],
(p_bd_addr[4] << 8) + p_bd_addr[5], p_ertm_info);
}
if (num_to_flush != L2CAP_FLUSH_CHANS_GET) {
- L2CAP_TRACE_API ("L2CA_FlushChannel (FLUSH) CID: 0x%04x NumToFlush: %d QC: %u pFirst: 0x%08x",
+ L2CAP_TRACE_API ("L2CA_FlushChannel (FLUSH) CID: 0x%04x NumToFlush: %d QC: %u pFirst: %p",
lcid, num_to_flush, GKI_queue_length(&p_ccb->xmit_hold_q), GKI_getfirst(&p_ccb->xmit_hold_q));
} else {
L2CAP_TRACE_API ("L2CA_FlushChannel (QUERY) CID: 0x%04x", lcid);
void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout)
{
- int i;
tL2C_LCB *p_lcb;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (bda);
void l2cble_advertiser_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type,
UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout)
{
- int i;
tL2C_LCB *p_lcb;
tBTM_SEC_DEV_REC *p_dev_rec;
UNUSED(type);
static void l2cble_start_conn_update (tL2C_LCB *p_lcb)
{
UINT16 min_conn_int, max_conn_int, slave_latency, supervision_tout;
- tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev(p_lcb->remote_bd_addr);
tACL_CONN *p_acl_cb = btm_bda_to_acl(p_lcb->remote_bd_addr, BT_TRANSPORT_LE);
if (p_lcb->conn_update_mask & L2C_BLE_UPDATE_PENDING) {
/* Check if tx-sequence is the expected one */
if (tx_seq != p_ccb->fcrb.next_seq_expected) {
- L2CAP_TRACE_WARNING ("Rx L2CAP PDU: CID: 0x%04x Lost frames Exp: %u Got: %u p_rx_sdu: 0x%08x",
+ L2CAP_TRACE_WARNING ("Rx L2CAP PDU: CID: 0x%04x Lost frames Exp: %u Got: %u p_rx_sdu: %p",
p_ccb->local_cid, p_ccb->fcrb.next_seq_expected, tx_seq, p_ccb->fcrb.p_rx_sdu);
/* Lost one or more packets, so flush the SAR queue */
UNUSED(transport);
- L2CAP_TRACE_DEBUG ("l2c_link_sec_comp: %d, 0x%x", status, p_ref_data);
+ L2CAP_TRACE_DEBUG ("l2c_link_sec_comp: %d, %p", status, p_ref_data);
if (status == BTM_SUCCESS_NO_SECURITY) {
status = BTM_SUCCESS;
}
if ( (!p_ccb->in_use) || (p_q == NULL) ) {
- L2CAP_TRACE_ERROR ("l2cu_enqueue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x",
+ L2CAP_TRACE_ERROR ("l2cu_enqueue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: %p",
p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb);
return;
}
}
if ( (!p_ccb->in_use) || (p_q == NULL) || (p_q->p_first_ccb == NULL) ) {
- L2CAP_TRACE_ERROR ("l2cu_dequeue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x p_q: 0x%08x p_q->p_first_ccb: 0x%08x",
+ L2CAP_TRACE_ERROR ("l2cu_dequeue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: %p p_q: %p p_q->p_first_ccb: %p",
p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb, p_q, p_q ? p_q->p_first_ccb : 0);
return;
}
tL2C_CCB *p_next_ccb;
int xx;
- L2CAP_TRACE_DEBUG ("l2cu_resubmit_pending_sec_req p_bda: 0x%08x", p_bda);
+ L2CAP_TRACE_DEBUG ("l2cu_resubmit_pending_sec_req p_bda: %p", p_bda);
/* If we are called with a BDA, only resubmit for that BDA */
if (p_bda) {
p_attr = p_attr->p_next_attr;
}
return FALSE;
+#else
+ return FALSE;
#endif
}
p_attr = p_attr->p_next_attr;
}
return FALSE;
+#else
+ return FALSE;
#endif
}
#endif
}
+#if SDP_CLIENT_ENABLED == TRUE
/*******************************************************************************
**
** Function SDP_AttrStringCopy
dst[0] = '\0';
}
}
+#endif
/*******************************************************************************
**
#if (SDP_RAW_DATA_INCLUDED == TRUE)
INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len)
{
- INT32 len = 0; /* Number of bytes in the entry */
INT32 offset = -1; /* default to not found */
#if SDP_SERVER_ENABLED == TRUE
+ INT32 len = 0; /* Number of bytes in the entry */
tSDP_RECORD *p_rec;
UINT16 start = 0;
UINT16 end = 0xffff;
p_mac = output.param_buf + (BT_OCTET16_LEN - tlen);
memcpy(p_signature, p_mac, tlen);
- SMP_TRACE_DEBUG("tlen = %d p_mac = %d", tlen, p_mac);
+ SMP_TRACE_DEBUG("tlen = %d p_mac = %p", tlen, p_mac);
SMP_TRACE_DEBUG("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x",
*p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3));
SMP_TRACE_DEBUG("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x",
bluedroid/include \
include
-CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -Wno-error=format
+CFLAGS +=
LIBS := btdm_app
bluedroid \
.
-include $(IDF_PATH)/make/component_common.mk
+#include $(IDF_PATH)/make/component_common.mk
ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
$(COMPONENT_LIBRARY): $(ALL_LIB_FILES)
char *p = NULL;
LOG_DEBUG("the data is:%s\n", data);
- p = strstr(data, HEADER_SSID);
+ p = strstr((char *)data, HEADER_SSID);
if (p) {
LOG_ERROR("SSID: %s\n", p + strlen(HEADER_SSID) + 1);
strcpy(tmp_ssid, p + strlen(HEADER_SSID) + 1);
}
- p = strstr(data, HEADER_PASSWD);
+ p = strstr((char *)data, HEADER_PASSWD);
if (p) {
LOG_ERROR("PASSWORD: %s\n", p + strlen(HEADER_PASSWD) + 1);
strcpy(tmp_passwd, p + strlen(HEADER_PASSWD) + 1);
}
- p = strstr(data, HEADER_CONFIRM);
+ p = strstr((char *)data, HEADER_CONFIRM);
if (p) {
LOG_ERROR("CONFIRM\n");
wifi_set_blue_config(tmp_ssid, tmp_passwd);