04-26-2021, 08:30 AM
04-26-2021, 10:42 AM
The active flags are below. "1" = active.
To get the name of a connected Bluetooth device use the command below and parse the output.
Code:
pi@rp2:~ $ moodeutl -q "select * from cfg_system where param like '%active%'"
17|rbactive|0
50|aplactive|0
83|btactive|0
94|slactive|0
103|spotactive|0
120|inpactive|0
pi@rp2:~ $
To get the name of a connected Bluetooth device use the command below and parse the output.
Code:
# No device connected
pi@rp2:~ $ sudo /var/www/command/bt.sh -c
** Connected devices
**
**
pi@rp2:~ $
# Device connected
pi@rp2:~ $ sudo /var/www/command/bt.sh -c
** Connected devices
**
** XX:XX:XX:XX:XX:XX Tim's iPhone
**
pi@rp2:~ $
04-26-2021, 01:08 PM
Is it in any way possible to do this in Python?
04-27-2021, 10:55 AM
For sqlite: https://docs.python.org/3/library/sqlite3.html
For sudo /var/www/command/bt.sh -c, you can use subprocess: https://docs.python.org/fr/3/library/subprocess.html
For sudo /var/www/command/bt.sh -c, you can use subprocess: https://docs.python.org/fr/3/library/subprocess.html