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
1205b555
Commit
1205b555
authored
1 year ago
by
Rongxuan Liu
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Restore advertising enable parameters onResume" into main
parents
065272f7
f3172f01
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
system/gd/hci/le_advertising_manager.cc
+6
-0
6 additions, 0 deletions
system/gd/hci/le_advertising_manager.cc
system/gd/hci/le_advertising_manager_test.cc
+41
-0
41 additions, 0 deletions
system/gd/hci/le_advertising_manager_test.cc
with
47 additions
and
0 deletions
system/gd/hci/le_advertising_manager.cc
+
6
−
0
View file @
1205b555
...
...
@@ -1230,6 +1230,12 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb
if
(
enable
)
{
enabled_sets_
[
advertiser_id
].
advertising_handle_
=
advertiser_id
;
if
(
advertising_api_type_
==
AdvertisingApiType
::
EXTENDED
)
{
enabled_sets_
[
advertiser_id
].
duration_
=
duration
;
enabled_sets_
[
advertiser_id
].
max_extended_advertising_events_
=
max_extended_advertising_events
;
}
advertising_sets_
[
advertiser_id
].
duration
=
duration
;
advertising_sets_
[
advertiser_id
].
max_extended_advertising_events
=
max_extended_advertising_events
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
system/gd/hci/le_advertising_manager_test.cc
+
41
−
0
View file @
1205b555
...
...
@@ -1717,6 +1717,47 @@ TEST_F(LeExtendedAdvertisingAPITest, trigger_advertiser_callbacks_if_started_whi
sync_client_handler
();
}
TEST_F
(
LeExtendedAdvertisingAPITest
,
duration_maxevents_restored_on_resume
)
{
// arrange
auto
test_le_address_manager
=
(
TestLeAddressManager
*
)
test_acl_manager_
->
GetLeAddressManager
();
uint16_t
duration
=
1000
;
uint8_t
max_extended_advertising_events
=
100
;
// enable advertiser
le_advertising_manager_
->
EnableAdvertiser
(
advertiser_id_
,
true
,
duration
,
max_extended_advertising_events
);
ASSERT_EQ
(
OpCode
::
LE_SET_EXTENDED_ADVERTISING_ENABLE
,
test_hci_layer_
->
GetCommand
().
GetOpCode
());
EXPECT_CALL
(
mock_advertising_callback_
,
OnAdvertisingEnabled
(
advertiser_id_
,
true
,
AdvertisingCallback
::
AdvertisingStatus
::
SUCCESS
));
test_hci_layer_
->
IncomingEvent
(
LeSetExtendedAdvertisingEnableCompleteBuilder
::
Create
(
uint8_t
{
1
},
ErrorCode
::
SUCCESS
));
test_le_address_manager
->
client_
->
OnPause
();
// verify advertising is disabled onPause
ASSERT_EQ
(
OpCode
::
LE_SET_EXTENDED_ADVERTISING_ENABLE
,
test_hci_layer_
->
GetCommand
().
GetOpCode
());
test_hci_layer_
->
IncomingEvent
(
LeSetExtendedAdvertisingEnableCompleteBuilder
::
Create
(
1
,
ErrorCode
::
SUCCESS
));
sync_client_handler
();
test_le_address_manager
->
client_
->
OnResume
();
// verify advertising is reenabled onResume with correct parameters
auto
command
=
test_hci_layer_
->
GetCommand
();
ASSERT_EQ
(
OpCode
::
LE_SET_EXTENDED_ADVERTISING_ENABLE
,
command
.
GetOpCode
());
auto
enable_command_view
=
LeSetExtendedAdvertisingEnableView
::
Create
(
LeAdvertisingCommandView
::
Create
(
command
));
ASSERT_TRUE
(
enable_command_view
.
IsValid
());
ASSERT_EQ
(
bluetooth
::
hci
::
Enable
::
ENABLED
,
enable_command_view
.
GetEnable
());
auto
enabled_sets
=
enable_command_view
.
GetEnabledSets
();
ASSERT_EQ
(
static_cast
<
uint8_t
>
(
1
),
enabled_sets
.
size
());
ASSERT_EQ
(
duration
,
enabled_sets
[
0
].
duration_
);
ASSERT_EQ
(
max_extended_advertising_events
,
enabled_sets
[
0
].
max_extended_advertising_events_
);
test_hci_layer_
->
IncomingEvent
(
LeSetExtendedAdvertisingEnableCompleteBuilder
::
Create
(
1
,
ErrorCode
::
SUCCESS
));
sync_client_handler
();
}
TEST_F
(
LeExtendedAdvertisingAPITest
,
no_callbacks_on_pause
)
{
// arrange
auto
test_le_address_manager
=
(
TestLeAddressManager
*
)
test_acl_manager_
->
GetLeAddressManager
();
...
...
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