rust/bt-ascs: Add presentation delay range helpers

A client has to request one Presentation_Delay per direction for all
the ASEs in a CIG (BAP v1.0.2 Section 7.1.3), but each ASE publishes
its own range. Add helpers on PresentationDelayRange that combine those
ranges and pick a delay from the result.

BAP v1.0.2 Section 5.6.2 makes the supported range a shall and the
preferred range only a should, so the helpers treat them differently.
If the supported ranges have no value in common, combining fails.
Preferred bounds never cause a failure. A bound outside the supported
range moves to the nearest supported bound, preferred bounds that cross
are dropped, and a zero bound (ASCS v1.0.1 Table 4.3) means no
preference. Combining normalizes the preferred bounds once, after
merging every range, because normalizing pair by pair gives an answer
that depends on the order of the ASEs.

Decoding now rejects a range whose min is above its max, since no value
in it can satisfy the shall.

Test: cargo test -p bt-ascs
Change-Id: I01e07e74ecac123bf3f4aa25d455f8136a6a6964
Reviewed-on: https://bluetooth-review.googlesource.com/c/bluetooth/+/4123
1 file changed
tree: 50ef9eb02be12bf9fec22bacc06985d351f4f1dd
  1. .agents/
  2. docs/
  3. infra/
  4. rust/
  5. .gitignore
  6. AUTHORS
  7. CONTRIBUTING.md
  8. GEMINI.md
  9. LICENSE
  10. OWNERS
  11. PATENTS
  12. presubmit.sh
  13. README.md
README.md

Bluetooth Shared Libraries

What is this?

This is a repository for shared libraries and tools that can be useful for multiple Bluetooth stacks.

These tools and libraries are meant to be:

  • Stack-agnostic and platform-agnostic
  • Implement a useful subset of a published Bluetooth specification.

It has been started as a repository for developing Rust crates but can be easily expanded to include libraries and tools written in other languages.

What is this not?

It is not a full Bluetooth stack. Google has two officially open-source Bluetooth stacks:

Structure

  • rust - Rust Crates
  • docs - General documentation (documentation for each library/tool is included in their directories)