-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ESP32 - Update advertising data to be closer to the spec #1911
ESP32 - Update advertising data to be closer to the spec #1911
Conversation
Size increase report for "gn_nrf-example-build"
Full report output
|
Size increase report for "gn_linux-example-build"
Full report output
|
Size increase report for "nrf-example-build"
Full report output
|
Size increase report for "linux-example-build"
Full report output
|
Size increase report for "esp32-example-build"
Full report output
|
[self connect:peripheral]; | ||
[self stopScanning]; | ||
NSNumber * isConnectable = [advertisementData objectForKey:CBAdvertisementDataIsConnectable]; | ||
if ([isConnectable boolValue]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supernit: how do people feel about early return and continues to decrease code indents? I find it easier to understand code if it is less indented once it starts growing, however I also see a pattern in other chip places of 'only one exit point' (but does that apply to non-resource constrained code?)
like:
if (![isConnectable boolValue]) {
return; // only connectable devices are useful
}
CBUUID * .....
for (....) {
if (!... isEqualToData...) {
continue;
}
if (....) {
}
}
vs.
if ([isConnectable boolValue]) {
CBUUID * .....;
for (....) {
if (...) {
if (...) {
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my part I'm 100% in favour or early returns and to declared variables just before they are used, if possible.
I think @gerickson advocates for the 'single exit point' patterns thought.
advData[index++] = advDataVersionDiscriminator & 0x00FF; | ||
|
||
// Construct the Chip BLE Service Data to be sent in the scan response packet. | ||
err = esp_ble_gap_config_adv_data_raw(advData, sizeof(advData)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the size always need to be sizeof == MAX_ADV_DATA_LEN or could we use index here to reduce payload sizes? does it matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we will need to use manufacturer specific data and add them to the advertising data if there is enough space. The rest will go into the Scan Req/Resp packet.
I will dig into this when I will work on that in order to give you a more accurate answer.
Will merge since my comments were more nit/meh. Would love an answer, however if we need to adjust code we can do it so in a separate PR. |
Merge in WMN_TOOLS/matter from fix/caracal_matter_templates to silabs_slc_1.3 Squashed commit of the following: commit c7bfc56563f34eb152cdcdca3e6c15d4944c9fb3 Author: Sarthak Shaha <[email protected]> Date: Tue May 28 12:59:32 2024 -0400 added missing space commit e11a0a23281f07390ace70e23a8c47bbe9e61512 Author: Sarthak Shaha <[email protected]> Date: Tue May 28 12:31:24 2024 -0400 revert commit d849715b699bf2111cfd29f87b892095ecccd094 Author: Sarthak Shaha <[email protected]> Date: Tue May 28 12:29:03 2024 -0400 adding appropriate boards/parts for caracle ... and 1 more commit
Problem
This PR update the ble advertising data to get it closer to the spec.
Summary of Changes