Loading system/main/shim/hci_layer.cc +0 −1 Original line number Original line Diff line number Diff line Loading @@ -63,7 +63,6 @@ namespace { bool register_event_code(bluetooth::hci::EventCode event_code) { bool register_event_code(bluetooth::hci::EventCode event_code) { switch (event_code) { switch (event_code) { // Inquiry // Inquiry case bluetooth::hci::EventCode::INQUIRY_RESULT: case bluetooth::hci::EventCode::INQUIRY_RESULT_WITH_RSSI: case bluetooth::hci::EventCode::INQUIRY_RESULT_WITH_RSSI: case bluetooth::hci::EventCode::EXTENDED_INQUIRY_RESULT: case bluetooth::hci::EventCode::EXTENDED_INQUIRY_RESULT: Loading system/stack/btm/btm_inq.cc +25 −21 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ ******************************************************************************/ ******************************************************************************/ #include "hci_error_code.h" #include "hci_error_code.h" #include "main/shim/helpers.h" #include "neighbor_inquiry.h" #include "neighbor_inquiry.h" #define LOG_TAG "bluetooth" #define LOG_TAG "bluetooth" Loading Loading @@ -644,6 +645,11 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, get_main_thread()->Bind([](bluetooth::hci::EventView event) { get_main_thread()->Bind([](bluetooth::hci::EventView event) { on_incoming_hci_event(event); on_incoming_hci_event(event); })); })); bluetooth::shim::GetHciLayer()->RegisterEventHandler( bluetooth::hci::EventCode::INQUIRY_RESULT, get_main_thread()->Bind([](bluetooth::hci::EventView event) { on_incoming_hci_event(event); })); btm_cb.btm_inq_vars.registered_for_hci_events = true; btm_cb.btm_inq_vars.registered_for_hci_events = true; } } Loading Loading @@ -1282,9 +1288,7 @@ tINQ_DB_ENT* btm_inq_db_new(const RawAddress& p_bda, bool is_ble) { * Returns void * Returns void * * ******************************************************************************/ ******************************************************************************/ static void btm_process_inq_results_standard(const uint8_t* p, static void btm_process_inq_results_standard(bluetooth::hci::EventView event) { uint8_t hci_evt_len) { uint8_t num_resp, xx; RawAddress bda; RawAddress bda; tINQ_DB_ENT* p_i; tINQ_DB_ENT* p_i; tBTM_INQ_RESULTS* p_cur = NULL; tBTM_INQ_RESULTS* p_cur = NULL; Loading @@ -1306,27 +1310,24 @@ static void btm_process_inq_results_standard(const uint8_t* p, return; return; } } STREAM_TO_UINT8(num_resp, p); auto standard_view = bluetooth::hci::InquiryResultView::Create(event); ASSERT(standard_view.IsValid()); auto responses = standard_view.GetResponses(); { btm_cb.neighbor.classic_inquiry.results += responses.size(); constexpr uint16_t inquiry_result_size = 14; for (const auto& response : responses) { if (hci_evt_len < num_resp * inquiry_result_size) { log::error("can't fit {} results in {} bytes", num_resp, hci_evt_len); return; } } btm_cb.neighbor.classic_inquiry.results += num_resp; for (xx = 0; xx < num_resp; xx++) { /* Extract inquiry results */ /* Extract inquiry results */ STREAM_TO_BDADDR(bda, p); bda = bluetooth::ToRawAddress(response.bd_addr_); STREAM_TO_UINT8(page_scan_rep_mode, p); page_scan_rep_mode = STREAM_TO_UINT8(page_scan_per_mode, p); static_cast<uint8_t>(response.page_scan_repetition_mode_); page_scan_per_mode = 0; // reserved page_scan_mode = 0; // reserved STREAM_TO_UINT8(page_scan_mode, p); dc[0] = response.class_of_device_.cod[2]; dc[1] = response.class_of_device_.cod[1]; dc[2] = response.class_of_device_.cod[0]; STREAM_TO_DEVCLASS(dc, p); clock_offset = response.clock_offset_; STREAM_TO_UINT16(clock_offset, p); p_i = btm_inq_db_find(bda); p_i = btm_inq_db_find(bda); Loading Loading @@ -1728,7 +1729,7 @@ void btm_process_inq_results(const uint8_t* p, uint8_t hci_evt_len, uint8_t inq_res_mode) { uint8_t inq_res_mode) { switch (inq_res_mode) { switch (inq_res_mode) { case BTM_INQ_RESULT_STANDARD: case BTM_INQ_RESULT_STANDARD: btm_process_inq_results_standard(p, hci_evt_len); LOG_ALWAYS_FATAL("Please use PDL for STANDARD results"); break; break; case BTM_INQ_RESULT_WITH_RSSI: case BTM_INQ_RESULT_WITH_RSSI: btm_process_inq_results_rssi(p, hci_evt_len); btm_process_inq_results_rssi(p, hci_evt_len); Loading Loading @@ -2487,6 +2488,9 @@ static void on_incoming_hci_event(bluetooth::hci::EventView event) { case bluetooth::hci::EventCode::INQUIRY_COMPLETE: case bluetooth::hci::EventCode::INQUIRY_COMPLETE: on_inquiry_complete(event); on_inquiry_complete(event); break; break; case bluetooth::hci::EventCode::INQUIRY_RESULT: btm_process_inq_results_standard(event); break; default: default: log::warn("Dropping unhandled event: {}", log::warn("Dropping unhandled event: {}", bluetooth::hci::EventCodeText(event_code)); bluetooth::hci::EventCodeText(event_code)); Loading system/stack/btu/btu_hcif.cc +0 −3 Original line number Original line Diff line number Diff line Loading @@ -232,9 +232,6 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, btu_hcif_log_event_metrics(hci_evt_code, p); btu_hcif_log_event_metrics(hci_evt_code, p); switch (hci_evt_code) { switch (hci_evt_code) { case HCI_INQUIRY_RESULT_EVT: btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_STANDARD); break; case HCI_INQUIRY_RSSI_RESULT_EVT: case HCI_INQUIRY_RSSI_RESULT_EVT: btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_WITH_RSSI); btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_WITH_RSSI); break; break; Loading Loading
system/main/shim/hci_layer.cc +0 −1 Original line number Original line Diff line number Diff line Loading @@ -63,7 +63,6 @@ namespace { bool register_event_code(bluetooth::hci::EventCode event_code) { bool register_event_code(bluetooth::hci::EventCode event_code) { switch (event_code) { switch (event_code) { // Inquiry // Inquiry case bluetooth::hci::EventCode::INQUIRY_RESULT: case bluetooth::hci::EventCode::INQUIRY_RESULT_WITH_RSSI: case bluetooth::hci::EventCode::INQUIRY_RESULT_WITH_RSSI: case bluetooth::hci::EventCode::EXTENDED_INQUIRY_RESULT: case bluetooth::hci::EventCode::EXTENDED_INQUIRY_RESULT: Loading
system/stack/btm/btm_inq.cc +25 −21 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ ******************************************************************************/ ******************************************************************************/ #include "hci_error_code.h" #include "hci_error_code.h" #include "main/shim/helpers.h" #include "neighbor_inquiry.h" #include "neighbor_inquiry.h" #define LOG_TAG "bluetooth" #define LOG_TAG "bluetooth" Loading Loading @@ -644,6 +645,11 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, get_main_thread()->Bind([](bluetooth::hci::EventView event) { get_main_thread()->Bind([](bluetooth::hci::EventView event) { on_incoming_hci_event(event); on_incoming_hci_event(event); })); })); bluetooth::shim::GetHciLayer()->RegisterEventHandler( bluetooth::hci::EventCode::INQUIRY_RESULT, get_main_thread()->Bind([](bluetooth::hci::EventView event) { on_incoming_hci_event(event); })); btm_cb.btm_inq_vars.registered_for_hci_events = true; btm_cb.btm_inq_vars.registered_for_hci_events = true; } } Loading Loading @@ -1282,9 +1288,7 @@ tINQ_DB_ENT* btm_inq_db_new(const RawAddress& p_bda, bool is_ble) { * Returns void * Returns void * * ******************************************************************************/ ******************************************************************************/ static void btm_process_inq_results_standard(const uint8_t* p, static void btm_process_inq_results_standard(bluetooth::hci::EventView event) { uint8_t hci_evt_len) { uint8_t num_resp, xx; RawAddress bda; RawAddress bda; tINQ_DB_ENT* p_i; tINQ_DB_ENT* p_i; tBTM_INQ_RESULTS* p_cur = NULL; tBTM_INQ_RESULTS* p_cur = NULL; Loading @@ -1306,27 +1310,24 @@ static void btm_process_inq_results_standard(const uint8_t* p, return; return; } } STREAM_TO_UINT8(num_resp, p); auto standard_view = bluetooth::hci::InquiryResultView::Create(event); ASSERT(standard_view.IsValid()); auto responses = standard_view.GetResponses(); { btm_cb.neighbor.classic_inquiry.results += responses.size(); constexpr uint16_t inquiry_result_size = 14; for (const auto& response : responses) { if (hci_evt_len < num_resp * inquiry_result_size) { log::error("can't fit {} results in {} bytes", num_resp, hci_evt_len); return; } } btm_cb.neighbor.classic_inquiry.results += num_resp; for (xx = 0; xx < num_resp; xx++) { /* Extract inquiry results */ /* Extract inquiry results */ STREAM_TO_BDADDR(bda, p); bda = bluetooth::ToRawAddress(response.bd_addr_); STREAM_TO_UINT8(page_scan_rep_mode, p); page_scan_rep_mode = STREAM_TO_UINT8(page_scan_per_mode, p); static_cast<uint8_t>(response.page_scan_repetition_mode_); page_scan_per_mode = 0; // reserved page_scan_mode = 0; // reserved STREAM_TO_UINT8(page_scan_mode, p); dc[0] = response.class_of_device_.cod[2]; dc[1] = response.class_of_device_.cod[1]; dc[2] = response.class_of_device_.cod[0]; STREAM_TO_DEVCLASS(dc, p); clock_offset = response.clock_offset_; STREAM_TO_UINT16(clock_offset, p); p_i = btm_inq_db_find(bda); p_i = btm_inq_db_find(bda); Loading Loading @@ -1728,7 +1729,7 @@ void btm_process_inq_results(const uint8_t* p, uint8_t hci_evt_len, uint8_t inq_res_mode) { uint8_t inq_res_mode) { switch (inq_res_mode) { switch (inq_res_mode) { case BTM_INQ_RESULT_STANDARD: case BTM_INQ_RESULT_STANDARD: btm_process_inq_results_standard(p, hci_evt_len); LOG_ALWAYS_FATAL("Please use PDL for STANDARD results"); break; break; case BTM_INQ_RESULT_WITH_RSSI: case BTM_INQ_RESULT_WITH_RSSI: btm_process_inq_results_rssi(p, hci_evt_len); btm_process_inq_results_rssi(p, hci_evt_len); Loading Loading @@ -2487,6 +2488,9 @@ static void on_incoming_hci_event(bluetooth::hci::EventView event) { case bluetooth::hci::EventCode::INQUIRY_COMPLETE: case bluetooth::hci::EventCode::INQUIRY_COMPLETE: on_inquiry_complete(event); on_inquiry_complete(event); break; break; case bluetooth::hci::EventCode::INQUIRY_RESULT: btm_process_inq_results_standard(event); break; default: default: log::warn("Dropping unhandled event: {}", log::warn("Dropping unhandled event: {}", bluetooth::hci::EventCodeText(event_code)); bluetooth::hci::EventCodeText(event_code)); Loading
system/stack/btu/btu_hcif.cc +0 −3 Original line number Original line Diff line number Diff line Loading @@ -232,9 +232,6 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, btu_hcif_log_event_metrics(hci_evt_code, p); btu_hcif_log_event_metrics(hci_evt_code, p); switch (hci_evt_code) { switch (hci_evt_code) { case HCI_INQUIRY_RESULT_EVT: btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_STANDARD); break; case HCI_INQUIRY_RSSI_RESULT_EVT: case HCI_INQUIRY_RSSI_RESULT_EVT: btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_WITH_RSSI); btm_process_inq_results(p, hci_evt_len, BTM_INQ_RESULT_WITH_RSSI); break; break; Loading