From d525dd2fc7ee011f5020d1badf745ee2a4c5bddb Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 26 Apr 2016 02:59:01 +0200 Subject: [PATCH] termux-api: Add infrared and telephony api:s --- packages/termux-api/termux-infrared-frequencies | 23 +++++++++++++++++++ packages/termux-api/termux-infrared-transmit | 30 +++++++++++++++++++++++++ packages/termux-api/termux-telephony-cellinfo | 23 +++++++++++++++++++ packages/termux-api/termux-telephony-deviceinfo | 23 +++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100755 packages/termux-api/termux-infrared-frequencies create mode 100755 packages/termux-api/termux-infrared-transmit create mode 100755 packages/termux-api/termux-telephony-cellinfo create mode 100755 packages/termux-api/termux-telephony-deviceinfo diff --git a/packages/termux-api/termux-infrared-frequencies b/packages/termux-api/termux-infrared-frequencies new file mode 100755 index 00000000..911247a5 --- /dev/null +++ b/packages/termux-api/termux-infrared-frequencies @@ -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 index 00000000..90661cc0 --- /dev/null +++ b/packages/termux-api/termux-infrared-transmit @@ -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 index 00000000..d8e79673 --- /dev/null +++ b/packages/termux-api/termux-telephony-cellinfo @@ -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 index 00000000..4f63d873 --- /dev/null +++ b/packages/termux-api/termux-telephony-deviceinfo @@ -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 -- 2.11.0