Commit: d94551190dd59aac3edcd387e64335406b066779
Parent: 657abc0ebe6ba049ae783d13f06e0eff6abd9ab2
Author: Daniel Winkler <danielwinkler@google.com>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2020-10-30 02:44:19
Tree: 5719640528d8f60910346a39c9d2458bfb14fae4

advertising: Parse intervals and tx power from adv This change adds parsers for the advertising intervals and tx power properties of the LEAdvertisement1 object. It validates that each field adheres to the 5.2 spec, and that min and max intervals are compatible with each other, i.e. that min interval is less than max interval. A note here for maintainers: The tx power that is sent in the hci parameter command is an int8_t, but as far as I can tell, there is no clean way to use a signed 8-bit integer in dbus. The dbus byte type seems incompatible with negative values in high-level languages (python) without awkward usage manipulation on the client side. For this reason, I chose to use an int16_t type for the tx power dbus field, which is then downcasted to the int8_t in bluetoothd, which at least makes the signed-ness of the type crystal clear to the dbus client that uses it. This change is manually verified by ensuring the intervals and tx power parameters are correctly parsed from the LEAdvertisement1 object, and that the parse fails if the parameters are incorrect or not compatible with each other.

Diffstat

M src/advertising.c | 111 ++++++++++++++++++++++++++++++++++++++++

1 files changed, 111 insertions(+), 0 deletions(-)

View Full Diff | Patch