diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc index 72de399ea22becabd53d93eddf37df7242e33eb8..154ab9a96475026f397d3a39b318d7b626deb2f0 100644 --- a/system/bta/dm/bta_dm_act.cc +++ b/system/bta/dm/bta_dm_act.cc @@ -1829,6 +1829,7 @@ static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, uint8_t* p_eir, result.inq_res.inq_result_type = p_inq->inq_result_type; result.inq_res.device_type = p_inq->device_type; result.inq_res.flag = p_inq->flag; + result.inq_res.include_rsi = p_inq->include_rsi; /* application will parse EIR to find out remote device name */ result.inq_res.p_eir = p_eir; diff --git a/system/bta/include/bta_api.h b/system/bta/include/bta_api.h index 30e315c68c23a52311628a5a97f5a74eac0dcfd0..b9ae66e7a3911ecbc64b1e7a1d53cae30a9abfe7 100644 --- a/system/bta/include/bta_api.h +++ b/system/bta/include/bta_api.h @@ -429,6 +429,7 @@ typedef struct { uint16_t ble_periodic_adv_int; tBT_DEVICE_TYPE device_type; uint8_t flag; + bool include_rsi; /* true, if ADV contains RSI data */ } tBTA_DM_INQ_RES; /* Structure associated with BTA_DM_INQ_CMPL_EVT */ diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc index 79ba7ade2ac1ecd0c95bc30da36f5dc5e7a4cd1b..09145250d0f40a9853ad318da42035e559fb863d 100644 --- a/system/btif/src/btif_dm.cc +++ b/system/btif/src/btif_dm.cc @@ -1181,7 +1181,7 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event, } { - bt_property_t properties[5]; + bt_property_t properties[6]; bt_device_type_t dev_type; uint32_t num_properties = 0; bt_status_t status; @@ -1238,6 +1238,13 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event, &(p_search_data->inq_res.rssi)); num_properties++; + /* CSIP supported device */ + BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], + BT_PROPERTY_REMOTE_IS_COORDINATED_SET_MEMBER, + sizeof(bool), + &(p_search_data->inq_res.include_rsi)); + num_properties++; + status = btif_storage_add_remote_device(&bdaddr, num_properties, properties); ASSERTC(status == BT_STATUS_SUCCESS, diff --git a/system/include/hardware/bluetooth.h b/system/include/hardware/bluetooth.h index 97d7d1d1473445b6854252e245b2f18670c3c5ea..24b1a89209fe56639946e00654684d193fa83579 100644 --- a/system/include/hardware/bluetooth.h +++ b/system/include/hardware/bluetooth.h @@ -325,6 +325,13 @@ typedef enum { BT_PROPERTY_DYNAMIC_AUDIO_BUFFER, + /** + * Description - True if Remote is a Member of a Coordinated Set. + * Access mode - GET. + * Data Type - bool. + */ + BT_PROPERTY_REMOTE_IS_COORDINATED_SET_MEMBER, + BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF, } bt_property_type_t; diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc index 04688b35f97a21702c3b1081e28a3a147493c063..9aa417b141fb6783e1097971e2763e6f3a92031a 100644 --- a/system/stack/btm/btm_ble_gap.cc +++ b/system/stack/btm/btm_ble_gap.cc @@ -1959,6 +1959,13 @@ void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type, return; } + bool include_rsi = false; + uint8_t len; + if (AdvertiseDataParser::GetFieldByType(adv_data, BTM_BLE_AD_TYPE_RSI, + &len)) { + include_rsi = true; + } + tINQ_DB_ENT* p_i = btm_inq_db_find(bda); /* Check if this address has already been processed for this inquiry */ @@ -1966,7 +1973,8 @@ void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type, /* never been report as an LE device */ if (p_i && (!(p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BLE) || /* scan response to be updated */ - (!p_i->scan_rsp))) { + (!p_i->scan_rsp) || + (!p_i->inq_info.results.include_rsi && include_rsi))) { update = true; } else if (btm_cb.ble_ctr_cb.is_ble_observe_active()) { update = false; @@ -1997,6 +2005,10 @@ void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type, secondary_phy, advertising_sid, tx_power, rssi, periodic_adv_int, adv_data); + if (include_rsi) { + (&p_i->inq_info.results)->include_rsi = true; + } + tBTM_INQ_RESULTS_CB* p_opportunistic_obs_results_cb = btm_cb.ble_ctr_cb.p_opportunistic_obs_results_cb; if (p_opportunistic_obs_results_cb) { @@ -2041,6 +2053,13 @@ void btm_ble_process_adv_pkt_cont_for_inquiry( tBTM_INQUIRY_VAR_ST* p_inq = &btm_cb.btm_inq_vars; bool update = true; + bool include_rsi = false; + uint8_t len; + if (AdvertiseDataParser::GetFieldByType(advertising_data, BTM_BLE_AD_TYPE_RSI, + &len)) { + include_rsi = true; + } + tINQ_DB_ENT* p_i = btm_inq_db_find(bda); /* Check if this address has already been processed for this inquiry */ @@ -2048,7 +2067,8 @@ void btm_ble_process_adv_pkt_cont_for_inquiry( /* never been report as an LE device */ if (p_i && (!(p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BLE) || /* scan response to be updated */ - (!p_i->scan_rsp))) { + (!p_i->scan_rsp) || + (!p_i->inq_info.results.include_rsi && include_rsi))) { update = true; } else if (btm_cb.ble_ctr_cb.is_ble_observe_active()) { update = false; @@ -2079,6 +2099,10 @@ void btm_ble_process_adv_pkt_cont_for_inquiry( secondary_phy, advertising_sid, tx_power, rssi, periodic_adv_int, advertising_data); + if (include_rsi) { + (&p_i->inq_info.results)->include_rsi = true; + } + tBTM_INQ_RESULTS_CB* p_opportunistic_obs_results_cb = btm_cb.ble_ctr_cb.p_opportunistic_obs_results_cb; if (p_opportunistic_obs_results_cb) { diff --git a/system/stack/btm/neighbor_inquiry.h b/system/stack/btm/neighbor_inquiry.h index 8d1b0d547b533e53b2804c7ed2ccfada18b4cf97..c36320e02cbab001c49cc78c6c2aad7ba5dfd2b1 100644 --- a/system/stack/btm/neighbor_inquiry.h +++ b/system/stack/btm/neighbor_inquiry.h @@ -116,6 +116,7 @@ typedef struct { int8_t ble_tx_power; uint16_t ble_periodic_adv_int; uint8_t flag; + bool include_rsi; } tBTM_INQ_RESULTS; /**************************************** diff --git a/system/stack/include/btm_ble_api_types.h b/system/stack/include/btm_ble_api_types.h index dfee8062930dcff10b34b4ce59f01e875b88f65d..2cd6a02cc7a349f1f871d1ea80209afd7e7d2e9d 100644 --- a/system/stack/include/btm_ble_api_types.h +++ b/system/stack/include/btm_ble_api_types.h @@ -295,6 +295,7 @@ typedef void(tBTM_RAND_ENC_CB)(tBTM_RAND_ENC* p1); HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 \ */ #define BTM_BLE_AD_TYPE_APPEARANCE 0x19 +#define BTM_BLE_AD_TYPE_RSI HCI_EIR_RSI_TYPE /* 0x2E */ /* Min/max Preferred number of payload octets that the local Controller should include in a single Link Layer Data Channel PDU. */