Im trying to read the output form Bluetoothctl automaticly. So a bash script would scan the output for certain words like and echo if there is a new device. ([NEW]Device x:x:x:x:x ). Now i found that you could use DBus-monitoring for that. but im not sure on how to use it. and there are not alot of exampels out there. Nor guides. Thnx in advance
Bluetoothctl uses Bluez5. Bluez5 exposes interfaces in the DBus for each functionality it offers.
If you want get started this way, try to undertand what is DBus and how you can use it. Then look at what DBus interfaces are exposed by Bluez and what you can do with it. Finally start calling DBus methods, either directly or using proxies !
Here's a link to the bluetoothctl source code (look near the bottom to find the command list you are familiar with ) https://git.kernel.org/cgit/bluetooth/bluez.git/tree/client/main.c
Bluetoothctl was created using GBDus (GLib bindings for dbus in C) however you use python glib bindings. In the git above, you will also be able to find the documentation of all the bluez dbus interface in /tree/doc