Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bluetooth scanning #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(script_files
scripts/termux-api-stop
scripts/termux-audio-info
scripts/termux-battery-status
scripts/termux-bluetooth-scan
Copy link

@MatejMagat305 MatejMagat305 Jun 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, it would be better name "termux-bluetooth" - without "-scan", or no? It will probably has continuetion as "connect", "listen" or "send", am I wrong?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at the rest of this list - there's a lot of termux-$system-$behavior. termux-bluetooth-scan looks consistent to me.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it is true ...

scripts/termux-brightness
scripts/termux-call-log
scripts/termux-camera-info
Expand Down
25 changes: 25 additions & 0 deletions scripts/termux-bluetooth-scan.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!@TERMUX_PREFIX@/bin/sh
set -e -u

SCRIPTNAME=termux-bluetooth-scan
show_usage () {
echo "Usage: $SCRIPTNAME <start/stop/info>"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I requested a change to info in termux/termux-api#686 - update this once we agree on a verb over there.

echo "Scan for Bluetooth devices."
exit 0
}

while getopts :h option
do
case "$option" in
h) show_usage;;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done
shift $((OPTIND-1))

if [ $# = 1 ]; then
@TERMUX_PREFIX@/libexec/termux-api BluetoothScan --es mode "$1"
else
echo "$SCRIPTNAME: You didnt specify the mode to use." >&2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't

exit 1
fi