termux-api: Add infrared and telephony api:s

This commit is contained in:
Fredrik Fornwall 2016-04-26 02:59:01 +02:00
parent bea93fbd7a
commit d525dd2fc7
4 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e -u
SCRIPTNAME=termux-infrared-frequencies
show_usage () {
echo "Usage: $SCRIPTNAME"
echo "Query the infrared transmitter's supported carrier frequencies."
echo ""
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 [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
@TERMUX_API@ InfraredFrequencies

View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e -u
SCRIPTNAME=termux-infrared-transmit
show_usage () {
echo "Usage: $SCRIPTNAME -f frequency pattern"
echo "Transmit an infrared pattern. The pattern is specified in comma-separated on/off intervals, such as '20,50,20,30'. Only patterns shorter than 2 seconds will be transmitted."
echo ""
echo " -f frequency IR carrier frequency in Hertz"
echo ""
exit 0
}
FREQUENCY=""
while getopts :hf: option
do
case "$option" in
h) show_usage;;
f) FREQUENCY="--ei frequency $OPTARG";;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done
shift $(($OPTIND-1))
if [ -z "$FREQUENCY" ]; then echo "$SCRIPTNAME: No frequency specified"; exit 1; fi
if [ $# -lt 1 ]; then echo "$SCRIPTNAME: too few arguments"; exit 1; fi
if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
@TERMUX_API@ InfraredTransmit $FREQUENCY --eia pattern $1

View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e -u
SCRIPTNAME=termux-telephony-cellinfo
show_usage () {
echo "Usage: $SCRIPTNAME"
echo "Get information about all observed cell information from all radios on the device including the primary and neighboring cells."
echo ""
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 [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
@TERMUX_API@ TelephonyCellInfo

View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e -u
SCRIPTNAME=termux-telephony-deviceinfo
show_usage () {
echo "Usage: $SCRIPTNAME"
echo "Get information about the telephony device."
echo ""
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 [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
@TERMUX_API@ TelephonyDeviceInfo