Potential Bluetooth Support in the Android App Support (AAS)

Current status of my qCommand stuff. (for both commands I’ve commented out the if systemctl is-active condition, because it’s not working as expected)

qc_BT-to-Android : mostly works. I can connect to and sync my watch in the Garmin Connect Android app, and connect to and control my hearing aids in the BeMore Android app.

Code
if [[ ! $(whoami) = "root" ]]; then
echo "must be run as root" >&2
exit 1
fi

# start by setting up the config file,even if it exists already
echo "[Config]" > /opt/appsupport/etc/appsupport.conf.d/99-passthrough.conf
echo "Proxies=android.hardware.bluetooth@1.1::IBluetoothHci,android.hardware.bluetooth@1.0::IBluetoothHci/default" >> /opt/appsupport/etc/appsupport.conf.d/99-passthrough.conf

# Stop the BT services in SfOS
systemctl stop bluetooth
systemctl stop bluebinder

# Start AAS if it isn't running already:
# returns 3 if inactive
# 0 if active
if [[ ! $(systemctl is-active --quiet appsupport@defaultuser.service) = 0 ]]; then
  echo "starting appsupport"
  systemctl reload-or-restart appsupport@defaultuser
fi

# Start the Android BT process
appsupport-attach pm enable com.android.bluetooth

qc-BT-to-SfOS: mostly works. Occasionally gives an error when starting bluebinder times out. (I haven’t checked the status of BT in SfOS if the error occurs. Nor have I looked into detail in “journalctl -xe”. That, and sorting out the operations conditional on systemctl is-active are the next jobs :slight_smile:

Code
if [[ ! $(whoami) = "root" ]]; then
  echo "must be run as root" >&2
  exit 1
fi

# If AAS is running, stop / disable its BT  process
#if [[ $(systemctl is-active --quiet appsupport@defaultuser.service) = 0 ]]; then
echo "DisablingBT in Android" 
  appsupport-attach pm disable com.android.bluetooth
echo "Stopping AAS" 
  systemctl stop appsupport@defaultuser 
#fi

# Start the BT services in SfOS
echo "Starting bluebinder" 
systemctl start bluebinder
echo "Starting AAS" 
systemctl start appsupport@defaultuser  
echo "Restarting bluetooth" 
systemctl  restart bluetooth
Occasional error
Job for bluebinder.service failed because a timeout was exceeded.
See "systemctl status bluebinder.service" and "journalctl -xe" for details.`
5 Likes