3 if [ "$TMPFS" == "" ]; then
12 # -------- check for connection to Leading Device (for Follower) ------------------------
18 if [ "$MODE" == "f" ]; then
20 if ping -W 4 -w 4 -c 2 $LEADER_IP &> /dev/null; then
22 myLog "Connection to group network has been esteblished."
26 myLog "No connection has been esteblished. WiFi interface deactivated."
30 # ----------------- playing back Intro until GPS fixation ------------------------------
37 if [ ! -s "$TMPFS/$state" ]; then # no side messages (state file is empty)
39 fragment_1="$SYSMESSAGES/$DEV_JINGLE"
40 fragment_2="$SYSMESSAGES/$INTRO_HELLO"
41 fragment_3="$SYSMESSAGES/$INTRO_INSTRUCTION_QUESTION"
43 # ------- playing intro -------------------------------------------------
45 if [ "$pauseOn" != "0" ]; then
46 startFrom=$(( $startFrom + ($pauseOn - $startOn) - $REWIND ))
47 if [ $startFrom -lt 0 ]; then startFrom=0; fi
49 echo "Resume $file from" $(date +%H:%M:%S -d @$startFrom -u) | myLog
54 currentL=$(cat $TMPFS/$currentLang)
56 echo "startFrom: $startFrom"
58 echo "Intro: $fragment_1, $fragment_2, $fragment_3"
59 playFile $startFrom "$CONTENT/$currentL/$fragment_1" "$CONTENT/$currentL/$fragment_2" "$CONTENT/$currentL/$fragment_3"
61 # -------- end of playing -----------------------------------------------
63 if [ "$(cat $TMPFS/$state)" == "MESSAGE" ]; then
65 echo "pauseOn: $pauseOn" | myLog
70 # -----------------------------------------------------------------------
73 # echo "[$0] Intro playback is busy (message playing?)"
79 # ------------------ playing SO TODAY .... message -------------------------------------
83 echo "waiting for GPS fixation..." | myLog
85 nmeaTimeDate=$(cat $TIMENMEA) # wait and read FIFO (waiting for GPS fixation)
87 nmeaDate=$(echo $nmeaTimeDate | awk -F'|' '{print $1; exit}')
88 nmeaTime=$(echo $nmeaTimeDate | awk -F'|' '{print $2; exit}')
91 timeMessage="" # TODO: GET TIME NMEA HERE
93 date=$(echo $timeMessage | awk '{print $1; exit}')
94 month=$(echo $timeMessage | awk '{print $2; exit}')
95 itis=$(echo $timeMessage | awk '{print "$" $3; exit}')
96 hrs=$(echo $timeMessage | awk '{print $4; exit}')
97 hrsWord=$(echo $timeMessage | awk '{print "$" $5; exit}')
98 min=$(echo $timeMessage | awk '{print $6; exit}')
99 minWord=$(echo $timeMessage | awk '{print "$" $7; exit}')
102 currentL=$(cat $TMPFS/$currentLang)
106 number=$(ls -p $CONTENT/$currentL/$SYSMESSAGES/$DAY | grep -v '/' | awk -v a=$date 'NR == a {print; exit}')
107 echo "date: $number" | myLog
112 number=$(ls -p $CONTENT/$currentL/$SYSMESSAGES/$MONTH | grep -v '/' | awk -v a=$month 'NR == a {print; exit}')
113 echo "month: $number" | myLog
114 SMon="$MONTH/$number"
118 SItis=$(eval "echo $itis")
122 number=$(ls -p $CONTENT/$currentL/$SYSMESSAGES/$TIME_NUMBERS_1 | grep -v '/' | awk -v a=$hrs 'NR == a+1 {print; exit}')
123 echo "hrs: $number" | myLog
124 SHrs="$TIME_NUMBERS_1/$number"
125 SHrsH=$(eval "echo $hrsWord")
129 if [ "$min" != "0" ]; then
130 number=$(ls -p $CONTENT/$currentL/$SYSMESSAGES/$TIME_NUMBERS_2 | grep -v '/' | awk -v a=$min 'NR == a+1 {print; exit}')
131 echo "min: $number" | myLog
132 Smin="$TIME_NUMBERS_2/$number"
133 SminM=$(eval "echo $minWord")
136 intorFin1="$INTRO_COORDINATES"
137 introFin2="$DEV_JINGLE_OUT"
139 echo "$INTRO_SO_TODAY|$SDay|$SMon|$SItis|$SHrs|$SHrsH|$Smin|$SminM|$intorFin1|$introFin2" > $TMPFS/$message