3 VALID_ONOFF_IDS="7 18 20"
4 GPIOPATH=/sys/class/gpio/gpio
6 for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do
7 for VALIDID in $VALID_ONOFF_IDS; do
8 if [ "$QUERY" == "$VALIDID=1" ]; then
10 elif [ "$QUERY" == "$VALIDID=0" ]; then
11 eval "GPIO_$VALIDID=0"
12 elif [ "$QUERY" == "$VALIDID=q" ]; then
13 eval "GPIO_$VALIDID=q"
16 if [ "$QUERY" == "mobile=1" ]; then
19 elif [ "$QUERY" == "nofloat=1" ]; then
26 GPIOVALUE=$(cat "${GPIOPATH}${1}/value")
27 if [ "$GPIOVALUE" = "1" ]; then
35 GPIOVALUE=$(cat "${GPIOPATH}${1}/value")
36 [ "$GPIOVALUE" = "1" ]
39 echo "Content-type: text/html"
43 for CHECKID in $VALID_ONOFF_IDS; do
45 VAL="$(eval echo \$GPIO_$CHECKID)"
46 if [ $VAL == 1 -o $VAL == 0 ]; then
47 echo "$VAL" > "${GPIOPATH}${CHECKID}/value"
49 echo -n "\"$CHECKID\":"
50 print_gpio_state $CHECKID
56 # echo "<title>Realraum Relay Switch</title>"
57 # echo '<script type="text/javascript">window.location="/cgi-bin/switch.cgi";</script>'
58 # echo "</head></html>"