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

Commit 547322ec authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Propagate BT5 specific scan result properties up the stack (2/3) am: 82bb0ebe

am: 4749dc0d

Change-Id: I63538d28f11389dd03ea61eab0446a139168f40a
parents b08d9e7f 4749dc0d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3942,6 +3942,12 @@ static void bta_dm_observe_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.ble_evt_type = p_inq->ble_evt_type;
  result.inq_res.ble_primary_phy = p_inq->ble_primary_phy;
  result.inq_res.ble_secondary_phy = p_inq->ble_secondary_phy;
  result.inq_res.ble_advertising_sid = p_inq->ble_advertising_sid;
  result.inq_res.ble_tx_power = p_inq->ble_tx_power;
  result.inq_res.ble_periodic_adv_int = p_inq->ble_periodic_adv_int;

  /* application will parse EIR to find out remote device name */
  result.inq_res.p_eir = p_eir;
+5 −0
Original line number Diff line number Diff line
@@ -731,6 +731,11 @@ typedef struct {
  uint8_t inq_result_type;
  uint8_t ble_addr_type;
  uint16_t ble_evt_type;
  uint8_t ble_primary_phy;
  uint8_t ble_secondary_phy;
  uint8_t ble_advertising_sid;
  int8_t ble_tx_power;
  uint16_t ble_periodic_adv_int;
  tBT_DEVICE_TYPE device_type;
  uint8_t flag;
} tBTA_DM_INQ_RES;
+14 −6
Original line number Diff line number Diff line
@@ -217,6 +217,10 @@ void bta_batch_scan_reports_cb(int client_id, tBTA_STATUS status,

void bta_scan_results_cb_impl(bt_bdaddr_t bd_addr, tBT_DEVICE_TYPE device_type,
                              int8_t rssi, uint8_t addr_type,
                              uint16_t ble_evt_type, uint8_t ble_primary_phy,
                              uint8_t ble_secondary_phy,
                              uint8_t ble_advertising_sid, int8_t ble_tx_power,
                              uint16_t ble_periodic_adv_int,
                              vector<uint8_t> value) {
  uint8_t remote_name_len;
  const uint8_t* p_eir_remote_name = NULL;
@@ -255,8 +259,9 @@ void bta_scan_results_cb_impl(bt_bdaddr_t bd_addr, tBT_DEVICE_TYPE device_type,

  btif_storage_set_remote_addr_type(&bd_addr, addr_type);

  HAL_CBACK(bt_gatt_callbacks, scanner->scan_result_cb, &bd_addr, rssi,
            std::move(value));
  HAL_CBACK(bt_gatt_callbacks, scanner->scan_result_cb, ble_evt_type, addr_type,
            &bd_addr, ble_primary_phy, ble_secondary_phy, ble_advertising_sid,
            ble_tx_power, rssi, ble_periodic_adv_int, std::move(value));
}

void bta_scan_results_cb(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
@@ -284,11 +289,14 @@ void bta_scan_results_cb(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
    }
  }

  tBTA_DM_INQ_RES* r = &p_data->inq_res;
  bt_bdaddr_t bdaddr;
  bdcpy(bdaddr.address, p_data->inq_res.bd_addr);
  do_in_jni_thread(Bind(bta_scan_results_cb_impl, bdaddr,
                        p_data->inq_res.device_type, p_data->inq_res.rssi,
                        p_data->inq_res.ble_addr_type, std::move(value)));
  bdcpy(bdaddr.address, r->bd_addr);
  do_in_jni_thread(Bind(bta_scan_results_cb_impl, bdaddr, r->device_type,
                        r->rssi, r->ble_addr_type, r->ble_evt_type,
                        r->ble_primary_phy, r->ble_secondary_phy,
                        r->ble_advertising_sid, r->ble_tx_power,
                        r->ble_periodic_adv_int, std::move(value)));
}

void bta_track_adv_event_cb(tBTM_BLE_TRACK_ADV_DATA* p_track_adv_data) {
+5 −2
Original line number Diff line number Diff line
@@ -369,10 +369,13 @@ void ServiceStoppedCallback(int status, int server_if, int srvc_handle) {
  g_internal->api_synchronize.notify_one();
}

void ScanResultCallback(bt_bdaddr_t* bda, int rssi,
void ScanResultCallback(uint16_t ble_evt_type, uint8_t addr_type,
                        bt_bdaddr_t* bda, uint8_t ble_primary_phy,
                        uint8_t ble_secondary_phy, uint8_t ble_advertising_sid,
                        int8_t ble_tx_power, int8_t rssi,
                        uint16_t ble_periodic_adv_int,
                        std::vector<uint8_t> adv_data) {
  std::string addr(BtAddrString(bda));
  (void)adv_data;
  std::lock_guard<std::mutex> lock(g_internal->lock);
  g_internal->scan_results[addr] = rssi;
}
+4 −1
Original line number Diff line number Diff line
@@ -89,7 +89,10 @@ void RegisterClientCallback(int status, int client_if, bt_uuid_t* app_uuid) {
}

void ScanResultCallback(
    bt_bdaddr_t* bda, int rssi,
    uint16_t ble_evt_type, uint8_t addr_type, bt_bdaddr_t* bda,
    uint8_t ble_primary_phy, uint8_t ble_secondary_phy,
    uint8_t ble_advertising_sid, int8_t ble_tx_power, int8_t rssi,
    uint16_t ble_periodic_adv_int,
    std::vector<uint8_t> adv_data) {  // NOLINT(pass-by-value)
  shared_lock<shared_mutex_impl> lock(g_instance_lock);
  VERIFY_INTERFACE_OR_RETURN();
Loading