96d28a8c9f9a6c541b385a9de41d0c0f9da66271
[khatus.git] / x4 / bin / khatus_x4_sensor_bluetooth
1 #! /bin/sh
2
3 set -e
4
5 . "$(dirname $(realpath $0))/khatus_x4_lib_common_sensor.sh"
6
7 count_powered_controllers() {
8 bluetoothctl -- show | grep -c 'Powered: yes'
9 }
10
11 count_connected_devices() {
12 bluetoothctl -- paired-devices \
13 | awk '{print $2}' \
14 | xargs -I % bluetoothctl -- info % \
15 | grep -c 'Connected: yes'
16 }
17
18 sensor() {
19 printf "count_powered_controllers %d\n" $(count_powered_controllers)
20 printf "count_connected_devices %d\n" $(count_connected_devices)
21 }
22
23 run
This page took 0.044083 seconds and 3 git commands to generate.