Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7330112 authored by Alice Kuo's avatar Alice Kuo
Browse files

csip: Extract the RSI AD type to notify upper layer

A CSIP supported device shall contains the RSI AD type in the
advertising report. Update the information to upper layer.
As users trigger to pair, setting need to know this device support CSIP
to handle the further UX behavior.

Bug: 178981521
Bug: 150670922
Test: Manual test
Change-Id: I8f018cd32e73b9b5cef6120ee63a708c980e1869
parent 04cbeef0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+8 −1
Original line number Diff line number Diff line
@@ -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,
+7 −0
Original line number Diff line number Diff line
@@ -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;

+26 −2
Original line number Diff line number Diff line
@@ -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) {
Loading