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

samples: bluetooth: use zephyr:code-sample directive #77760

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

kartben
Copy link
Collaborator

@kartben kartben commented Aug 29, 2024

Describe the Bluetooth samples using code-sample directive in preparation for upcoming changes to the Zephyr documentation that will be leveraging the provided description and metadata.

This is a work in progress but I am almost done. Perhaps the main "disruptive" change this is introducing is dropping "Bluetooth: " prefix in front of all the samples' names, but hopefully people agree it is redundant :)

The "descriptions" are not prominently featured just yet but will be in an upcoming update to how samples are listed. It will look something like the below, which hopefully illustrates the added value of these short descriptions :)

image

Could people added as early reviewers confirm that this is going in the right direction for them and that I didn't miss something obvious or a constraint specific to Bluetooth samples?

Note that the upcoming change to the docs will allow to add code sample categories, so it might make sense to add new groups for TMAP, HCI, etc. at some point

@kartben kartben force-pushed the bt_samples_doc branch 7 times, most recently from 71c8db2 to d8032cd Compare August 30, 2024 06:38
* :ref:`bluetooth-beacon-sample`
* :ref:`peripheral_hr`
* :zephyr:code-sample:`bluetooth_beacon`
* :zephyr:code-sample:`ble_peripheral_hr`
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is one prefixed with bluetooth_ and the other with ble_? Don't think the beacon sample runs on a classic stack.
I would prefer bluetooth_classic_xx for classic samples, and the rest is assumed to be LE.
What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a few more with the same inconsistency. Also some that is prefixed with _, and even one that is bluetooth_bt :D

Are we planning on using explicit tags, or should we attempt to shorten them at bit? e.g.

bluetooth_beacon => bt_beacon
bluetooth_direction_finding_central => bt_df_central

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer long names for the documentation references. Shortening the filenames/path should be ok. Although i hope people have shell completion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The simplest route might be to just use the same IDs as the folder names?
Related: is it time to introduce some subfolders underneath samples/bluetooth? It's starting to get really packed in there :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The simplest route might be to just use the same IDs as the folder names? Related: is it time to introduce some subfolders underneath samples/bluetooth? It's starting to get really packed in there :)

#64443 :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The simplest route might be to just use the same IDs as the folder names? Related: is it time to introduce some subfolders underneath samples/bluetooth? It's starting to get really packed in there :)

Sure, so we can have bluetooth prefix for all BT samples, and then, when we do the above move, we can have them like bluetooth_audio_xxx, bluetooth_mesh_xxx


Bluetooth: HAP Hearing Aid (HA)
###############################
Advertise and XXX
Copy link
Collaborator

Choose a reason for hiding this comment

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

Demonstrate the Bluetooth LE Audio Hearing Aid role


Bluetooth: HCI IPC
##################
Expose Zephyr Bluetooth controller to another device or CPU using the IPC subsystem.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It can be any configured bluetooth controller. eg, even one connected over UART

Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment for the other hci_xx samples

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took the wording from the "Overview" section of most HCI samples, so I guess they need to be fixed?
https://docs.zephyrproject.org/latest/samples/bluetooth/hci_spi/README.html#overview

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh yeah then they need to fixed, yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should be addressed both in the new descriptions and legacy "Overview" sections


Bluetooth: HCI H4 over USB
##########################
Turn a Zephyr board into a USB H4 Bluetooth dongle.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Turn a Zephyr board into a USB H4 Bluetooth dongle. Only supported by BlueZ on linux.


Bluetooth: HCI USB
##################
Turn a Zephyr board into a USB Bluetooth dongle.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Turn a Zephyr board into a USB Bluetooth dongle. Compatible with all major operating systems (Mac, Windows, Linux).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I agree with making the "short" description that long but I get your point and will see if I can add the precision in a maybe more concise way if you really think it's important to have it right at the sample listing level.


Bluetooth: HCI VS Scan Request
##############################
Manage vendor-specific HCI commands to obtain scan request events even using xxx.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use vendor-specific HCI commands to enable Scan Request events when using legacy advertising.

@jhedberg jhedberg self-assigned this Aug 30, 2024
@kartben kartben force-pushed the bt_samples_doc branch 4 times, most recently from 8a08d7e to 4a0fffa Compare August 30, 2024 15:18
* :ref:`bluetooth-beacon-sample`
* :ref:`peripheral_hr`
* :zephyr:code-sample:`bluetooth_beacon`
* :zephyr:code-sample:`ble_peripheral_hr`
Copy link
Collaborator

Choose a reason for hiding this comment

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

The simplest route might be to just use the same IDs as the folder names? Related: is it time to introduce some subfolders underneath samples/bluetooth? It's starting to get really packed in there :)

Sure, so we can have bluetooth prefix for all BT samples, and then, when we do the above move, we can have them like bluetooth_audio_xxx, bluetooth_mesh_xxx

Comment on lines +2 to +5
:name: Broadcast Audio Sink
:relevant-api: bluetooth

Bluetooth: Broadcast Audio Sink
Use LE Audio Broadcast Sink functionality.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'll follow up with a name update PR later - I think several of our LE audio samples could benefit from better names and descriptions, but let's not muddy this PR too much with that :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this would be awesome. It's true that a lot of the names and descriptions are very "content-free" right now and not all that helpful. Hopefully the follow-up PR will be much easier to implement once the directives will already be there :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

#78094 :)

samples/bluetooth/bthome_sensor_template/README.rst Outdated Show resolved Hide resolved
@@ -1,8 +1,8 @@
.. zephyr:code-sample:: bluetooth_cap_acceptor
:name: Bluetooth: Common Audio Profile Acceptor
:name: Common Audio Profile Acceptor
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you prefer:

  1. Common Audio Profile Acceptor
  2. Common Audio Profile (CAP) Acceptor
  3. CAP Acceptor

Just in case we want to be consistent with the Audio samples later

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. is probably best as this makes it easier to capture all the various types/combination of search queries users might perform

I thought someone said they would address naming in a follow-up PR though? :P

samples/bluetooth/central_iso/README.rst Outdated Show resolved Hide resolved
samples/bluetooth/ibeacon/README.rst Outdated Show resolved Hide resolved
samples/bluetooth/periodic_adv/README.rst Outdated Show resolved Hide resolved
Describe the samples using code-sample directive in preparation for
upcoming changes to the Zephyr documentation that will be leveraging
the provided description and metadata.

Signed-off-by: Benjamin Cabé <[email protected]>
Replace occurrences of "BLE" by the recommended "Bluetooth LE" term.

Signed-off-by: Benjamin Cabé <[email protected]>
@@ -1,19 +1,20 @@
.. _bluetooth_central_gatt_write:
.. zephyr:code-sample:: ble_central_gatt_write
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to the BLE -> Bluetooth LE change you did, we should probably do it for the references as well - Especially the ones that you've added/modified in this PR

Suggested change
.. zephyr:code-sample:: ble_central_gatt_write
.. zephyr:code-sample:: bluetooth_central_gatt_write

Copy link
Collaborator

Choose a reason for hiding this comment

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

They can also match the prefix we use in the stack as a shorter alternative:

Suggested change
.. zephyr:code-sample:: ble_central_gatt_write
.. zephyr:code-sample:: bt_le_central_gatt_write

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I can give it a try.

Copy link
Collaborator Author

@kartben kartben Sep 5, 2024

Choose a reason for hiding this comment

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

I am actually not sure I have the knowledge required to pick the "right" prefix. I would frankly just name them bt_<samplefoldername>. The point is really just to have some kind of unique ID for documentation purposes, it's not like it's directly exposed to the end user or anything

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not like it's directly exposed to the end user or anything

Nor do we have any documentation or guidelines for naming schemes of sample labels :)

Doesn't need a fix in this PR, but arguably something that makes sense to make consistent later

.. _bluetooth_direction_finding_central:
.. zephyr:code-sample:: bluetooth_direction_finding_central
:name: Direction Finding Central
:relevant-api: bluetooth
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was your process for finding the relevant APIs?

I think any central sample should also have bt_conn as a API reference, as that is used to establish the connections

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My process can be best described as "best effort" for an initial pass :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright - Thought you might have made a script to check which functions were called (which in theory is possible, although not a 5-min task ;) )

@kartben
Copy link
Collaborator Author

kartben commented Sep 5, 2024

@jhedberg @jori-nordic good enough for you guys? Happy to address some remaining tweaks that would be needed but ideally we can continue any pending housekeeping tasks in follow-up PRs. Thanks!

@nashif nashif merged commit d1858d2 into zephyrproject-rtos:main Sep 5, 2024
20 checks passed
@kartben kartben deleted the bt_samples_doc branch September 10, 2024 19:55
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.

5 participants