summaryrefslogtreecommitdiff
path: root/src/run
diff options
context:
space:
mode:
author <philippe colliot>2015-06-12 18:14:07 +0200
committer <philippe colliot>2015-06-12 18:14:07 +0200
commit03e58571d8f9e24eac7019fbe9ccac5975fe2826 (patch)
tree2a28850c6df834ddb9d22f04fab5d84e6217b4b3 /src/run
parent2124036ef91b534a94bf6b98105394739b3cc96f (diff)
downloadnavigation-03e58571d8f9e24eac7019fbe9ccac5975fe2826.tar.gz
migration to cmake achieved
Diffstat (limited to 'src/run')
-rwxr-xr-xsrc/run286
1 files changed, 286 insertions, 0 deletions
diff --git a/src/run b/src/run
new file mode 100755
index 0000000..9eeff11
--- /dev/null
+++ b/src/run
@@ -0,0 +1,286 @@
+#! /bin/bash
+###########################################################################
+# @licence app begin@
+# SPDX-License-Identifier: MPL-2.0
+#
+# \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
+#
+# \file run
+#
+# \brief This file is part of the Build System.
+#
+# \author # Author: Martin Schaller <martin.schaller@it-schaller.de>
+#
+# \version 1.0
+#
+# This Source Code Form is subject to the terms of the
+# Mozilla Public License (MPL), v. 2.0.
+# If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# For further information see http://www.genivi.org/.
+#
+# List of changes:
+#
+# 5-8-2014, Philippe Colliot, Refine, add a sleep and improve comments
+# 30-9-2014, Philippe Colliot, Make it simpler and add a check for availability of hmi style-sheets
+#
+# @licence end@
+###########################################################################
+
+# function to start a process by freezing some of the options
+function run
+{
+ local x=$xterm
+ local g=$gdb
+ local l=$log
+ local title="$1"
+ shift
+ if [ "$1" = "-n" ]
+ then
+ shift
+ x=0
+ log=0
+ fi
+ if [ "$1" = -"g" ]
+ then
+ shift
+ g=0
+ fi
+ if [ "$x" = 1 ]
+ then
+ if [ "$g" = 1 ]
+ then
+ set -- gdb -ex run --args "$@"
+ fi
+ xterm -T "$title" -sb -sl 5000 -e "$@" &
+ elif [ "$log" = 1 ]
+ then
+ "$@" >"$CUR_DIR/$title.log" 2>&1 &
+ else
+ "$@" &
+ fi
+ PIDS="$PIDS $!"
+}
+
+# function to wait for the dbus service to be started, exit if too long
+function wait_for_service
+{
+ for i in $(seq 1 50)
+ do
+ if dbus-send --dest=$1 $2 org.freedesktop.DBus.Introspectable.Introspect
+ then
+ return
+ fi
+ 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
+ trap "" EXIT INT
+ kill $PIDS 2>/dev/null
+ if [ "$gdb" = 1 ]
+ then
+ kill -9 $PIDS 2>/dev/null
+ fi
+ if [ -n "$wm" ]
+ then
+ sleep 2
+ cd
+ nohup $wm >/dev/null 2>/dev/null &
+ fi
+}
+
+# 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)
+verbose=0 #no debug or log messages displayed
+center="4612 N 0608 E"
+
+CUR_DIR=$PWD
+BIN_DIR=$CUR_DIR/build
+SRC_DIR=$CUR_DIR
+
+SCRIPT_DIR=$SRC_DIR/script
+HMI_QML_DIR=$SRC_DIR/hmi/qml
+app=$HMI_QML_DIR/application.qml # hmi panel launched by default
+STYLE_SHEETS_GENERATED_INDICATOR=$HMI_QML_DIR/Core/style-sheets/the-style-sheets-have-been-generated-css.js
+REPLAYER_LOG_FILE=none
+export REPLAYER_LOG_FILE
+
+# location of exe, lib and config files
+AUTOMOTIVE_MESSAGE_BROKER=automotive-message-broker
+AUTOMOTIVE_MESSAGE_BROKER_SRC_DIR=$SRC_DIR/$AUTOMOTIVE_MESSAGE_BROKER
+AUTOMOTIVE_MESSAGE_BROKER_BIN_DIR=$AUTOMOTIVE_MESSAGE_BROKER_SRC_DIR/src/$AUTOMOTIVE_MESSAGE_BROKER-build
+GENIVI_LOGREPLAYER=genivilogreplayer
+GENIVI_LOGREPLAYER_SRC_DIR=$SRC_DIR/$GENIVI_LOGREPLAYER
+GENIVI_LOGREPLAYER_BIN_DIR=$BIN_DIR/$GENIVI_LOGREPLAYER
+
+NAVIGATION=navigation
+NAVIGATION_SRC_DIR=$SRC_DIR/$NAVIGATION/src/navigation
+NAVIGATION_BIN_DIR=$BIN_DIR/$NAVIGATION
+
+NAVIT=navit
+NAVIT_BIN_DIR=$NAVIGATION_BIN_DIR/navit/navit/navit
+
+POI_SERVER=poi-server
+POI_SERVER_SRC_DIR=$SRC_DIR/$NAVIGATION/src/poi-service/$POI_SERVER
+POI_SERVER_BIN_DIR=$SRC_DIR/$NAVIGATION/src/poi-service/bin
+
+LOG_REPLAYER=log-replayer
+LOG_REPLAYER_SRC_DIR=$NAVIGATION_SRC_DIR/positioning/$LOG_REPLAYER
+LOG_REPLAYER_BIN_DIR=$NAVIGATION_SRC_DIR/bin
+
+ENHANCED_POSITION_SERVICE=enhanced-position-service
+ENHANCED_POSITION_SERVICE_SRC_DIR=$NAVIGATION_SRC_DIR/positioning/$ENHANCED_POSITION_SERVICE
+ENHANCED_POSITION_SERVICE_BIN_DIR=$NAVIGATION_SRC_DIR/bin
+
+FUEL_STOP_ADVISOR=fuel-stop-advisor
+FUEL_STOP_ADVISOR_SRC_DIR=$SRC_DIR/$FUEL_STOP_ADVISOR
+FUEL_STOP_ADVISOR_BIN_DIR=$BIN_DIR/$FUEL_STOP_ADVISOR
+
+HMI_LAUNCHER=hmi-launcher
+HMI_LAUNCHER_SRC_DIR=$SRC_DIR/hmi/qml/$HMI_LAUNCHER
+HMI_LAUNCHER_BIN_DIR=$BIN_DIR/hmi/qml/$HMI_LAUNCHER
+
+
+# options analysis
+while getopts a:c:glnorvx opt
+do
+ case $opt in
+ a) #select another hmi panel
+ app=$OPTARG
+ ;;
+ c) #set the map center
+ case "$OPTARG" in
+ paris)
+ center="2.34 48.86"
+ ;;
+ tokyo)
+ center="139.74 35.70"
+ ;;
+ [0-9-]*)
+ center=$OPTARG
+ ;;
+ *)
+ echo "Unsupported center $OPTARG" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ g) #enable the debugger
+ gdb=1
+ ;;
+ l) #enable the layer manager
+ lm=1
+ ;;
+ n) #disable the enhanced position server
+ enhpos=0
+ ;;
+ o) #enable the log file
+ log=1
+ ;;
+ r) #disable the log replayer
+ replayer=0
+ ;;
+ v) #enable log messages
+ verbose=1
+ ;;
+ x) #enable subprocess in a separate xterm
+ xterm=1
+ ;;
+ \?)
+ echo "Usage:"
+ echo "$0 [-a application][-c center][-glnoprx]"
+ echo "-a: Set application (default application.qml)"
+ echo "-c: Set center (supported values: paris,tokyo,longitude latitude). Default is geneve"
+ echo "-g: Run subprocesses within gdb (only with -x)"
+ echo "-l: Use layermanager"
+ echo "-n: Don't start enhanced positioning service"
+ echo "-o: Create log file of subprocess output"
+ echo "-r: Don't start replayer"
+ echo "-v: Enable the output of log or debug messages"
+ echo "-x: Run subprocesses in own xterm to get separated log messages (doesn't make sense with -l)"
+ exit 1
+ esac
+done
+
+# check if style sheets have been generated
+if [ ! -f $STYLE_SHEETS_GENERATED_INDICATOR ]
+then
+ echo "Please generate the style sheets before"
+ $SCRIPT_DIR/prepare.sh -h
+ exit 1
+fi
+
+trap "terminate" EXIT INT
+set -e #exit on error now
+
+# start the automotive message broker and wait for dbus service
+cd $AUTOMOTIVE_MESSAGE_BROKER_BIN_DIR
+if [ "$verbose" = "1" ]
+then
+ run "Automotive Message Broker" ./ambd/ambd --config $GENIVI_LOGREPLAYER_SRC_DIR/logreplayerconfig.in.json
+else
+ run "Automotive Message Broker" ./ambd/ambd > /dev/null 2>&1 --config $GENIVI_LOGREPLAYER_SRC_DIR/logreplayerconfig.in.json
+fi
+wait_for_service org.automotive.message.broker /
+
+# start the poi server and wait for dbus service
+run "POI service" $POI_SERVER_BIN_DIR/$POI_SERVER -f $SCRIPT_DIR/empty.db
+wait_for_service org.genivi.poiservice.POISearch /org/genivi/poiservice/POISearch
+
+if [ "$enhpos" = 1 ]
+then # start the enhanced position service
+ run "EnhancedPositionService" $ENHANCED_POSITION_SERVICE_BIN_DIR/$ENHANCED_POSITION_SERVICE
+ wait_for_service org.genivi.positioning.EnhancedPosition /org/genivi/positioning/EnhancedPosition
+fi
+
+# start the two instances of navit with plugins (one for navigation core and another one for map viewer)
+cd $NAVIT_BIN_DIR
+>bookmark.txt
+echo "$center" >center.txt
+
+run "MapViewer" ./$NAVIT navit_genivi_mapviewer.xml
+
+wait_for_service org.genivi.mapviewer.Configuration /org/genivi/mapviewer
+wait_for_service org.genivi.mapviewer.MapViewerControl /org/genivi/mapviewer
+wait_for_service org.genivi.mapviewer.Session /org/genivi/mapviewer
+
+run "NavigationCore" ./$NAVIT navit_genivi_navigationcore.xml
+wait_for_service org.genivi.navigationcore.Configuration /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Guidance /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.LocationInput /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.MapMatchedPosition /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Routing /org/genivi/navigationcore
+wait_for_service org.genivi.navigationcore.Session /org/genivi/navigationcore
+
+if [ "$replayer" = 1 ]
+then # start the log replayer (of the fsa) with a sample log file
+ run "Log Replayer" $LOG_REPLAYER_BIN_DIR/$LOG_REPLAYER $LOG_REPLAYER_SRC_DIR/logs/geneve-cologny.log
+fi
+
+sleep 3 # need a sleep here (to be improved)
+# start the fuel stop advisor application
+run "Fuel Stop Advisor" $FUEL_STOP_ADVISOR_BIN_DIR/$FUEL_STOP_ADVISOR
+
+# log trace into a file
+if [ "$log" = 1 ]
+then
+ exec >$CUR_DIR/fsa.log
+ exec 2>&1
+fi
+
+# start the hmi
+$HMI_LAUNCHER_BIN_DIR/$HMI_LAUNCHER $app
+