Issue
On my Raspberry Pi 4, I would like to use bluetoothctl in non interactive mode but cannot figure out how to access the gatt menu. The command should be something like "bluetoothctl gatt menu list-attributes" but this syntax doesn't work.
For info, in interactive mode one must type "menu gatt" to switch to gatt menu and then commands like "list-attributes" are available.
Thanks in advance !
Eric
Solution
bluetoothctl
allows for the commands to be specified using a dot to indicate the hierarchy. e.g gatt.list-attributes
For accessing information with code BlueZ provides APIs using D-Bus bindings.
For example, to get all the information BlueZ has can be done like this:
import pydbus
bus = pydbus.SystemBus()
obj_mngr = bus.get('org.bluez', '/')
mngd_objs = obj_mngr.GetManagedObjects()
for path, obj in mngd_objs.items():
print(obj)
The API is documented at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc
Examples are available at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test
Answered By - ukBaz Answer Checked By - Gilberto Lyons (WPSolving Admin)