From 954ffa102f4953ae45cae835ed49d299a51b1690 Mon Sep 17 00:00:00 2001 From: Tian Hao Date: Thu, 1 Dec 2016 20:16:09 +0800 Subject: [PATCH] component/bt : add ble event type --- .../bt/bluedroid/api/include/esp_gap_ble_api.h | 13 +++++++++++++ .../bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c | 1 + 2 files changed, 14 insertions(+) diff --git a/components/bt/bluedroid/api/include/esp_gap_ble_api.h b/components/bt/bluedroid/api/include/esp_gap_ble_api.h index 7a320143d..242d74f0f 100644 --- a/components/bt/bluedroid/api/include/esp_gap_ble_api.h +++ b/components/bt/bluedroid/api/include/esp_gap_ble_api.h @@ -203,6 +203,18 @@ typedef enum { ESP_GAP_SEARCH_SEARCH_CANCEL_CMPL_EVT = 6, /*!< Search cancelled */ } esp_gap_search_evt_t; +/** + * @brief Ble scan result event type, to indicate the + * result is scan response or advertising data or other + */ +typedef enum { + ESP_BLE_EVT_CONN_ADV = 0x00, /*!< Connectable undirected advertising (ADV_IND) */ + ESP_BLE_EVT_CONN_DIR_ADV = 0x01, /*!< Connectable directed advertising (ADV_DIRECT_IND) */ + ESP_BLE_EVT_DISC_ADV = 0x02, /*!< Scannable undirected advertising (ADV_SCAN_IND) */ + ESP_BLE_EVT_NON_CONN_ADV = 0x03, /*!< Non connectable undirected advertising (ADV_NONCONN_IND) */ + ESP_BLE_EVT_SCAN_RSP = 0x04, /*!< Scan Response (SCAN_RSP) */ +} esp_ble_evt_type_t; + /** * @brief Gap callback parameters union */ @@ -233,6 +245,7 @@ typedef union { esp_bd_addr_t bda; /*!< Bluetooth device address which has been searched */ esp_bt_dev_type_t dev_type; /*!< Device type */ esp_ble_addr_type_t ble_addr_type; /*!< Ble device address type */ + esp_ble_evt_type_t ble_evt_type; /*!< Ble scan result event type */ int rssi; /*!< Searched device's RSSI */ uint8_t ble_adv[ESP_BLE_ADV_DATA_LEN_MAX]; /*!< Received EIR */ int flag; /*!< Advertising data flag bit */ diff --git a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c index a37b4054d..ba9e96223 100644 --- a/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -453,6 +453,7 @@ static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data param.scan_rst.dev_type = p_data->inq_res.device_type; param.scan_rst.rssi = p_data->inq_res.rssi; param.scan_rst.ble_addr_type = p_data->inq_res.ble_addr_type; + param.scan_rst.ble_evt_type = p_data->inq_res.ble_evt_type; param.scan_rst.flag = p_data->inq_res.flag; memcpy(param.scan_rst.ble_adv, p_data->inq_res.p_eir, ESP_BLE_ADV_DATA_LEN_MAX);