agent_gsm/connect_phone.sh

28 lines
548 B
Bash
Executable File

#!/bin/bash
MAC_ADDRESS=""
read -p "Please enter MAC BT address: " MAC_ADDRESS
# Write the address into config file before
sed -i "s/MAC_ADDRESS/$MAC_ADDRESS/" config/config.yaml
bluetoothctl -- power on
bluetoothctl -- agent on
sleep 10 # Time to give BT to start
bluetoothctl -- default-agent
bluetoothctl -- discoverable on
bluetoothctl -- pairable on
# Try to pair now
bluetoothctl -- pair ${MAC_ADDRESS}
sleep 10
# Trust to device
bluetoothctl -- trust ${MAC_ADDRESS}
# Connect to device
bluetoothctl -- connect ${MAC_ADDRESS}
sleep 5