Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Bluetooth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Bluetooth
Commits
fcafdfd9
Commit
fcafdfd9
authored
1 year ago
by
Myles Watson
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Use PDL for extended inquiry results" into main
parents
39fd9338
f8d32262
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
system/main/shim/hci_layer.cc
+0
-3
0 additions, 3 deletions
system/main/shim/hci_layer.cc
system/stack/btm/btm_inq.cc
+41
-29
41 additions, 29 deletions
system/stack/btm/btm_inq.cc
with
41 additions
and
32 deletions
system/main/shim/hci_layer.cc
+
0
−
3
View file @
fcafdfd9
...
@@ -62,9 +62,6 @@ static const packet_fragmenter_t* packet_fragmenter;
...
@@ -62,9 +62,6 @@ static const packet_fragmenter_t* packet_fragmenter;
namespace
{
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
case
bluetooth
::
hci
::
EventCode
::
EXTENDED_INQUIRY_RESULT
:
// SCO
// SCO
case
bluetooth
::
hci
::
EventCode
::
SYNCHRONOUS_CONNECTION_COMPLETE
:
case
bluetooth
::
hci
::
EventCode
::
SYNCHRONOUS_CONNECTION_COMPLETE
:
case
bluetooth
::
hci
::
EventCode
::
SYNCHRONOUS_CONNECTION_CHANGED
:
case
bluetooth
::
hci
::
EventCode
::
SYNCHRONOUS_CONNECTION_CHANGED
:
...
...
This diff is collapsed.
Click to expand it.
system/stack/btm/btm_inq.cc
+
41
−
29
View file @
fcafdfd9
...
@@ -26,8 +26,10 @@
...
@@ -26,8 +26,10 @@
******************************************************************************/
******************************************************************************/
#include
"hci_error_code.h"
#include
"hci_error_code.h"
#include
"hcidefs.h"
#include
"main/shim/helpers.h"
#include
"main/shim/helpers.h"
#include
"neighbor_inquiry.h"
#include
"neighbor_inquiry.h"
#include
"packet/bit_inserter.h"
#define LOG_TAG "bluetooth"
#define LOG_TAG "bluetooth"
#include
<base/logging.h>
#include
<base/logging.h>
...
@@ -700,6 +702,11 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb,
...
@@ -700,6 +702,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
::
EXTENDED_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
;
}
}
...
@@ -1593,9 +1600,7 @@ static void btm_process_inq_results_rssi(bluetooth::hci::EventView event) {
...
@@ -1593,9 +1600,7 @@ static void btm_process_inq_results_rssi(bluetooth::hci::EventView event) {
* Returns void
* Returns void
*
*
******************************************************************************/
******************************************************************************/
static
void
btm_process_inq_results_extended
(
const
uint8_t
*
p
,
static
void
btm_process_inq_results_extended
(
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
;
...
@@ -1609,7 +1614,6 @@ static void btm_process_inq_results_extended(const uint8_t* p,
...
@@ -1609,7 +1614,6 @@ static void btm_process_inq_results_extended(const uint8_t* p,
uint8_t
rssi
=
0
;
uint8_t
rssi
=
0
;
DEV_CLASS
dc
;
DEV_CLASS
dc
;
uint16_t
clock_offset
;
uint16_t
clock_offset
;
const
uint8_t
*
p_eir_data
=
NULL
;
log
::
debug
(
"Received inquiry result inq_active:0x{:x} state:{}"
,
log
::
debug
(
"Received inquiry result inq_active:0x{:x} state:{}"
,
btm_cb
.
btm_inq_vars
.
inq_active
,
btm_cb
.
btm_inq_vars
.
state
);
btm_cb
.
btm_inq_vars
.
inq_active
,
btm_cb
.
btm_inq_vars
.
state
);
...
@@ -1620,32 +1624,23 @@ static void btm_process_inq_results_extended(const uint8_t* p,
...
@@ -1620,32 +1624,23 @@ static void btm_process_inq_results_extended(const uint8_t* p,
return
;
return
;
}
}
STREAM_TO_UINT8
(
num_resp
,
p
);
auto
extended_view
=
bluetooth
::
hci
::
ExtendedInquiryResultView
::
Create
(
event
);
ASSERT
(
extended_view
.
IsValid
());
btm_cb
.
neighbor
.
classic_inquiry
.
results
++
;
{
{
if
(
num_resp
>
1
)
{
log
::
error
(
"extended results ({}) > 1"
,
num_resp
);
return
;
}
constexpr
uint16_t
extended_inquiry_result_size
=
254
;
if
(
hci_evt_len
-
1
!=
extended_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
++
)
{
update
=
false
;
update
=
false
;
/* Extract inquiry results */
/* Extract inquiry results */
STREAM_TO_BDADDR
(
bda
,
p
);
bda
=
bluetooth
::
ToRawAddress
(
extended_view
.
GetAddress
());
STREAM_TO_UINT8
(
page_scan_rep_mode
,
p
);
page_scan_rep_mode
=
STREAM_TO_UINT8
(
page_scan_per_mode
,
p
);
static_cast
<
uint8_t
>
(
extended_view
.
GetPageScanRepetitionMode
());
page_scan_per_mode
=
0
;
// reserved
STREAM_TO_DEVCLASS
(
dc
,
p
);
dc
[
0
]
=
extended_view
.
GetClassOfDevice
().
cod
[
2
];
STREAM_TO_UINT16
(
clock_offset
,
p
);
dc
[
1
]
=
extended_view
.
GetClassOfDevice
().
cod
[
1
];
STREAM_TO_UINT8
(
rssi
,
p
);
dc
[
2
]
=
extended_view
.
GetClassOfDevice
().
cod
[
0
];
clock_offset
=
extended_view
.
GetClockOffset
();
rssi
=
extended_view
.
GetRssi
();
p_i
=
btm_inq_db_find
(
bda
);
p_i
=
btm_inq_db_find
(
bda
);
...
@@ -1675,7 +1670,7 @@ static void btm_process_inq_results_extended(const uint8_t* p,
...
@@ -1675,7 +1670,7 @@ static void btm_process_inq_results_extended(const uint8_t* p,
}
}
/* If no update needed continue with next response (if any) */
/* If no update needed continue with next response (if any) */
else
else
continue
;
return
;
}
}
/* If existing entry, use that, else get a new one (possibly reusing the
/* If existing entry, use that, else get a new one (possibly reusing the
...
@@ -1731,12 +1726,26 @@ static void btm_process_inq_results_extended(const uint8_t* p,
...
@@ -1731,12 +1726,26 @@ static void btm_process_inq_results_extended(const uint8_t* p,
}
}
if
(
is_new
||
update
)
{
if
(
is_new
||
update
)
{
// Create a vector of EIR data and pad it with 0
auto
data
=
std
::
vector
<
uint8_t
>
();
data
.
reserve
(
HCI_EXT_INQ_RESPONSE_LEN
);
bluetooth
::
packet
::
BitInserter
bi
(
data
);
for
(
const
auto
&
eir
:
extended_view
.
GetExtendedInquiryResponse
())
{
if
(
eir
.
data_type_
!=
static_cast
<
bluetooth
::
hci
::
GapDataType
>
(
0
))
{
eir
.
Serialize
(
bi
);
}
}
while
(
data
.
size
()
<
HCI_EXT_INQ_RESPONSE_LEN
)
{
data
.
push_back
(
0
);
}
const
uint8_t
*
p_eir_data
=
data
.
data
();
{
{
memset
(
p_cur
->
eir_uuid
,
0
,
memset
(
p_cur
->
eir_uuid
,
0
,
BTM_EIR_SERVICE_ARRAY_SIZE
*
(
BTM_EIR_ARRAY_BITS
/
8
));
BTM_EIR_SERVICE_ARRAY_SIZE
*
(
BTM_EIR_ARRAY_BITS
/
8
));
/* set bit map of UUID list from received EIR */
/* set bit map of UUID list from received EIR */
btm_set_eir_uuid
(
p
,
p_cur
);
btm_set_eir_uuid
(
p_eir_data
,
p_cur
);
p_eir_data
=
p
;
}
}
/* If a callback is registered, call it with the results */
/* If a callback is registered, call it with the results */
...
@@ -1775,7 +1784,7 @@ void btm_process_inq_results(const uint8_t* p, uint8_t hci_evt_len,
...
@@ -1775,7 +1784,7 @@ void btm_process_inq_results(const uint8_t* p, uint8_t hci_evt_len,
LOG_ALWAYS_FATAL
(
"Please use PDL for RSSI results"
);
LOG_ALWAYS_FATAL
(
"Please use PDL for RSSI results"
);
break
;
break
;
case
BTM_INQ_RESULT_EXTENDED
:
case
BTM_INQ_RESULT_EXTENDED
:
btm_process_inq_results_extended
(
p
,
hci_evt_len
);
LOG_ALWAYS_FATAL
(
"Please use PDL for EXTENDED results"
);
break
;
break
;
}
}
}
}
...
@@ -2534,6 +2543,9 @@ static void on_incoming_hci_event(bluetooth::hci::EventView event) {
...
@@ -2534,6 +2543,9 @@ static void on_incoming_hci_event(bluetooth::hci::EventView event) {
case
bluetooth
::
hci
::
EventCode
::
INQUIRY_RESULT_WITH_RSSI
:
case
bluetooth
::
hci
::
EventCode
::
INQUIRY_RESULT_WITH_RSSI
:
btm_process_inq_results_rssi
(
event
);
btm_process_inq_results_rssi
(
event
);
break
;
break
;
case
bluetooth
::
hci
::
EventCode
::
EXTENDED_INQUIRY_RESULT
:
btm_process_inq_results_extended
(
event
);
break
;
default:
default:
log
::
warn
(
"Dropping unhandled event: {}"
,
log
::
warn
(
"Dropping unhandled event: {}"
,
bluetooth
::
hci
::
EventCodeText
(
event_code
));
bluetooth
::
hci
::
EventCodeText
(
event_code
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment