Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advertise service UUID in main ble adv packet #260

Merged
merged 7 commits into from
Jan 31, 2024
Merged

Conversation

ojousima
Copy link
Member

No description provided.

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ojousima
Copy link
Member Author

@TheSomeMan This code is meant to use together with the data format C5. The change adds Service UUID field into advertisement package. The end goal is that user application can filter for Bluetooth advertisements by Service UUID.

The code works by holding the desired service UUID and a flag to include the UUID in advertisement in a global variable in src/nrf5_sdk15_platform/communication/ruuvi_nrf5_sdk15_communication_ble_advertising.c. The ble_advdata_t structure will have the information Nordic SDK uses to build the final advertisement binary data, if the include UUID flag is included the UUID is included in the structure.

If the data cannot be encoded e.g. because user tries to include UUID with the original data format v5,

err_code |= ruuvi_nrf5_sdk15_to_ruuvi_error ( 
  ble_advdata_encode (&advdata, p_adv->data.adv_data.p_data,
                                         & (p_adv->data.adv_data.len)));

will return an error and advertisement contents are undefined - practically one or more fields are cut off, but nothing guarantees it.

@ojousima ojousima requested a review from TheSomeMan January 30, 2024 14:10
Copy link
Collaborator

@TheSomeMan TheSomeMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks

@ojousima ojousima merged commit 2555fc5 into master Jan 31, 2024
5 checks passed
@ojousima ojousima deleted the advertise-uuid branch January 31, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants