termux-api: Add infrared and telephony api:s
authorFredrik Fornwall <fredrik@fornwall.net>
Tue, 26 Apr 2016 00:59:01 +0000 (02:59 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Tue, 26 Apr 2016 00:59:01 +0000 (02:59 +0200)
packages/termux-api/termux-infrared-frequencies [new file with mode: 0755]
packages/termux-api/termux-infrared-transmit [new file with mode: 0755]
packages/termux-api/termux-telephony-cellinfo [new file with mode: 0755]
packages/termux-api/termux-telephony-deviceinfo [new file with mode: 0755]

diff --git a/packages/termux-api/termux-infrared-frequencies b/packages/termux-api/termux-infrared-frequencies
new file mode 100755 (executable)
index 0000000..911247a
--- /dev/null
@@ -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
diff --git a/packages/termux-api/termux-infrared-transmit b/packages/termux-api/termux-infrared-transmit
new file mode 100755 (executable)
index 0000000..90661cc
--- /dev/null
@@ -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
diff --git a/packages/termux-api/termux-telephony-cellinfo b/packages/termux-api/termux-telephony-cellinfo
new file mode 100755 (executable)
index 0000000..d8e7967
--- /dev/null
@@ -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
diff --git a/packages/termux-api/termux-telephony-deviceinfo b/packages/termux-api/termux-telephony-deviceinfo
new file mode 100755 (executable)
index 0000000..4f63d87
--- /dev/null
@@ -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