Created new repo for 'ioemu'

This commit is contained in:
xdrm-brackets 2018-01-28 17:49:11 +01:00
parent 75c3d6120c
commit c5d6074e43
8 changed files with 3 additions and 145 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ioemu"]
path = ioemu
url = https://git.xdrm.io/logauth/ioemu.git

1
ioemu/.gitignore vendored
View File

@ -1 +0,0 @@
.lock

@ -1 +0,0 @@
Subproject commit e84678ac6b9524a2c8a270f2af88a79a59fd2923

View File

@ -1,32 +0,0 @@
#!/bin/bash
# (1) Primary init.
#--------------------------------------------------------#
# (1) Get absolute folder #
ROOT=$(dirname `realpath $0`);
# (2) Check required arguments
test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tSATS_IP\tThe ip for the SATS system\n" && exit 1;
SATS_IP=$1;
# (3) Check lock file #
test -f $ROOT/.lock && echo "Daemon already started ($ROOT/.lock)" && exit 1;
touch $ROOT/.lock;
# (2) Set traps before starting any subproccess
#--------------------------------------------------------#
trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" INT;
trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" KILL;
# (3) Wait for trigger to launch server
#--------------------------------------------------------#
# (1) Wait for trigger #
$ROOT/com/trigger 9999;
# (2) Launch server in background #
$ROOT/com/launch ioemu $SATS_IP 44440 44441;

View File

@ -1,21 +0,0 @@
#!/bin/bash
# (1) Declare association state <-> color_id
#--------------------------------------------------------#
# (1) Create associative array #
declare -A COLCODE;
# (2) States #
COLCODE[0]=90;
COLCODE[R]=31;
COLCODE[G]=32;
COLCODE[B]=34;
# (2) Check argument + display led
#--------------------------------------------------------#
# (1) Check argument #
test $# -ge 1 && state="$1" || state="0";
# (2) Display led #
echo -e "\e[${COLCODE[$state]}m⬤\e[0m";

View File

@ -1,19 +0,0 @@
#!/bin/bash
# (1) Declare association state <-> color_id
#--------------------------------------------------------#
# (1) Create associative array #
declare -A COLCODE;
# (2) States #
COLCODE[0]=90;
COLCODE[1]=32;
# (2) Check argument + display led
#--------------------------------------------------------#
# (1) Check argument #
test $# -ge 1 && state="$1" || state="0";
# (2) Display led #
echo -e "\e[${COLCODE[$state]}m⏺\e[0m";

View File

@ -1,50 +0,0 @@
#!/bin/bash
# (1) Primary init.
#--------------------------------------------------------#
# (1) Get absolute folder #
ROOT=$(dirname `realpath $0`);
ROOT=`dirname $ROOT`;
# (2) Check lock file #
test ! -f $ROOT/.lock && echo "Daemon not started" && exit 1;
# (2) While viewing loop
#--------------------------------------------------------#
# (1) Initialise vars #
LED="0"; Rx=(0 0 0); # led; relays
SYSTD_TREE=""; # service_log
# (2) Get BUF_IN #
source $ROOT/com/config_ioemu;
while sleep 2; clear; do
# (3) Get last value from lines beginning by 'GSTA' #
STATE="`cat $BUF_IN | grep -Po "^GPIO(.+)$" | sed 's/^GPIO\(....\)$/\1/g' | tail -n1`";
echo "state: $STATE";
# (4) Apply to values if not 'x' (means 'ignore' that chip) #
if [ ! -z "$STATE" ]; then
test "${STATE:0:1}" != "x" && LED="${STATE:0:1}"; # if set to 'x', ignore
test "${STATE:1:1}" != "x" && Rx[1]="${STATE:1:1}"; # if set to 'x', ignore
test "${STATE:2:1}" != "x" && Rx[2]="${STATE:2:1}"; # if set to 'x', ignore
test "${STATE:3:1}" != "x" && Rx[3]="${STATE:3:1}"; # if set to 'x', ignore
fi;
# (5) Display led #
echo -n "LED: "; $ROOT/src/disp-led $LED;
# (6) Display relays #
echo -n "R1: "; $ROOT/src/disp-relay ${Rx[1]};
echo -n "R2: "; $ROOT/src/disp-relay ${Rx[2]};
echo -n "R3: "; $ROOT/src/disp-relay ${Rx[3]};
done;

View File

@ -1,21 +0,0 @@
#!/bin/bash
# (1) Primary init.
#--------------------------------------------------------#
# (1) Get absolute folder #
ROOT=$(dirname `realpath $0`);
# (2) Check lock file #
test ! -f $ROOT/.lock && echo "Daemon not started" && exit 1;
# (3) Check argument #
test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tgpio\tGPIO real-time view\n\tsystemd\tSystemd real-time dependency tree\n\tlogs\tLogs real-time view\n" && exit 1;
# (4) Check argument binds to an actual file #
test ! -f $ROOT/sub-view/$1 && echo -e "ERR: No such value for argument" && exit 1;
# (2) Start sub-view
#--------------------------------------------------------#
$ROOT/sub-view/$1;