5 # TODO: Centralize the definitions of the constants, as in AWK code.
6 FS1
='|' # Fields separator, level 1 (a record's fields)
7 FS2
=':' # Fields separator, level 2 (a field's subfields)
9 count_powered_controllers
() {
10 bluetoothctl
-- show |
grep -c 'Powered: yes'
13 count_connected_devices
() {
14 bluetoothctl
-- paired-devices \
16 |
xargs -I % bluetoothctl
-- info
% \
17 |
grep -c 'Connected: yes'
20 printf "%s%s%d\n" 'count_powered_controllers' "$FS1" "$(count_powered_controllers)"
21 printf "%s%s%d\n" 'count_connected_devices' "$FS1" "$(count_connected_devices)"