summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
author <philippe colliot>2014-08-05 15:08:30 +0200
committer <philippe colliot>2014-08-05 15:08:30 +0200
commit2ba301feb48263e94bc73c0153fcaf6db12f56c2 (patch)
treee588916e760d91c1f622c4b702d48164be8e5497 /src/script
parentb8f0c5930205c111be428c2f6abf3446b9ffa712 (diff)
downloadnavigation-2ba301feb48263e94bc73c0153fcaf6db12f56c2.tar.gz
fix some pb with logreplayer, refine run script
Diffstat (limited to 'src/script')
-rwxr-xr-xsrc/script/run90
1 files changed, 47 insertions, 43 deletions
diff --git a/src/script/run b/src/script/run
index d1724d1..3cfa9ce 100755
--- a/src/script/run
+++ b/src/script/run
@@ -22,32 +22,30 @@
#
# List of changes:
#
-# <date>, <name>, <description of change>
+# 5-8-2014, Philippe Colliot, Refine, add a sleep and improve comments
#
# @licence end@
###########################################################################
+# function to start a process by managing the options
function run
{
local x=$xterm
local g=$gdb
local l=$log
- title="$1"
+ local title="$1"
shift
-
if [ "$1" = "-n" ]
then
shift
x=0
l=0
fi
-
if [ "$1" = "-g" ]
then
shift
g=0
fi
-
if [ "$x" = 1 ]
then
if [ "$g" = 1 ]
@@ -61,9 +59,10 @@ function run
else
"$@" &
fi
- PIDS="$PIDS $!"
+ PIDS="$PIDS $!" #add pid to list of pid
}
+# function to wait for the dbus service to be started, exit if too long
function wait_for_service
{
for i in $(seq 1 50)
@@ -75,8 +74,10 @@ function wait_for_service
echo "Waiting for $1"
sleep 0.1
done
+ exit 1
}
+# function to catch the ctrl C or exit and to stop cleanly
function terminate
{
set +e
@@ -94,51 +95,51 @@ function terminate
fi
}
+# paths
CUR_DIR=$PWD
BIN_DIR=$PWD/../../bin
SRC_DIR=$PWD/..
-gdb=0
-xterm=0
-log=0
-enhpos=1
-lm=0
-prototyping=0
-replayer=1
-wm=""
+
+# default settings
+gdb=0 #no debug
+xterm=0 #no subprocess into a separate xterm
+log=0 #no log file
+enhpos=1 #enhanced position server enabled
+replayer=1 #replayer enabled
+lm=0 #layer manager disabled
+wm="" #to store the current window manager (in case of start with the layer manager)
+
+# hmi panel launched
app=$SRC_DIR/hmi/qml/application.qml
-popup=$SRC_DIR/hmi/qml/pop-up.qml
-while getopts a:c:glnoprx opt
+while getopts a:c:glnorx opt
do
case $opt in
- a)
- app=$OPTARG
+ a) #select another hmi panel
+ app=$OPTARG
;;
- c)
- plugin_args="$plugin_args -$opt $OPTARG"
+ c) #set the map center (used by the navigation core run script)
+ plugin_args="$plugin_args -$opt $OPTARG"
;;
- g)
+ g) #enable the debugger
plugin_args="$plugin_args -$opt"
gdb=1
;;
- l)
+ l) #enable the layer manager (not running)
lm=1
;;
- n)
+ n) #disable the enhanced position server (used by the navigation core run script)
enhpos=0
plugin_args="$plugin_args -$opt"
;;
- o)
+ o) #enable the log file
plugin_args="$plugin_args -$opt"
log=1
;;
- p)
- prototyping=1
- ;;
- r)
+ r) #disable the log replayer
replayer=0
;;
- x)
+ x) #enable subprocess in a separate xterm
plugin_args="$plugin_args -$opt"
xterm=1
;;
@@ -151,7 +152,6 @@ do
echo "-l: Use layermanager"
echo "-n: Don't start enhanced positioning service"
echo "-o: Create log file of subprocess output"
- echo "-p: Prototyping"
echo "-r: Don't start replayer"
echo "-x: Run subprocesses in own xterm to get separated log messages (doesn't make sense with -l)"
exit 1
@@ -161,6 +161,7 @@ done
REPLAYER_LOG_FILE=none
export REPLAYER_LOG_FILE
+# manage the layer manager (not running)
if [ "$lm" = "1" ]
then
for i in metacity compiz
@@ -186,50 +187,53 @@ then
lm_pid=$!
sleep 2
fi
+
export | egrep " LM_PLUGIN_PATH=|LM_USE_SESSION_BUS=| DBUS_SESSION_BUS_ADDRESS=| LD_LIBRARY_PATH=| PATH=| DISPLAY=" >env.sh
+
trap "terminate" EXIT INT
-set -e
+set -e #exit on error now
+# start the automotive message broker and wait for dbus service
cd $BIN_DIR/automotive-message-broker
run "Automotive Message Broker" ./ambd/ambd --config $SRC_DIR/genivilogreplayer/logreplayerconfig
wait_for_service org.automotive.message.broker /
+# start the poi service and wait for dbus service
cd $BIN_DIR/poi-service
run "POI service" ./poi-server -f empty.db
wait_for_service org.genivi.poiservice.POISearch /org/genivi/poiservice/POISearch
+# start the two instances of navit with plugins (one for navigation core and another one for map viewer)
+# we don't use the log replayer of positioning because we still need some specific data for the FSA application !
cd $SRC_DIR/navigation-service*/src/navigation/script
-#we don't use the replayer used by the navigation core because we still need a plugin for the application !
if [ "$enhpos" = 1 ]
-then
+then # start the enhanced position server
run "Navit Plugins" ./run -r -b $BIN_DIR $plugin_args
if [ "$replayer" = 1 ]
- then
+ then # start the log replayer
cd $BIN_DIR/log-replayer
run "Log Replayer" ./log-replayer $SRC_DIR/positioning_*/log-replayer/logs/geneve-cologny.log
fi
-else
+else # no enhanced position server
run "Navit Plugins" ./run -rn -b $BIN_DIR $plugin_args
fi
+sleep 2 # need a sleep here (to be improved)
+# start the fuel stop advisor application
run "Fuel Stop Advisor" $BIN_DIR/fuel-stop-advisor/fuel-stop-advisor
+# log trace into a file
if [ "$log" = 1 ]
then
- exec >$CUR_DIR/qmlviewer.log
+ exec >$CUR_DIR/fsa.log
exec 2>&1
fi
cd $BIN_DIR/hmi/qml
if [ "$lm" = 1 ]
-then
+then # start the hmi into the layer manager (not running)
lmqmlviewer $app
-else
-if [ "$prototyping" = 1 ]
-then
- ./hmi-launcher $app $popup
-else
+else # start the hmi with the launcher
./hmi-launcher $app
fi
-fi