summaryrefslogtreecommitdiff
path: root/src/navigation/script/run
blob: d456020b8e48f66e817279001a34b45fca5e5b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /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 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:
# 
# <date>, <name>, <description of change>
#
# @licence end@
function run
{
	local x=$xterm
	local g=$gdb
	local title="$1"
	shift
	if [ "$1" = "-n" ]
	then
		shift
		x=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 "$@" &
	else
		"$@" &
	fi
	PIDS="$PIDS $!"
}

function terminate
{
	set +e
	trap "" EXIT INT
	kill $PIDS
}

gdb=0
xterm=0
enhpos=1
center="4612 N 0608 E"
BIN_DIR=$PWD/../bin
SRC_DIR=$PWD/..
while getopts b:c:gnx opt
do
	case $opt in
	b)
		BIN_DIR=$OPTARG
		;;
	c)
		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)
		gdb=1
		;;
	n)
		enhpos=0
		;;
	x)
		xterm=1
		;;
	\?)
		echo "Usage:"
		echo "$0 [-a application][-c center][-lnx]"
		echo "-c: Set center (supported values: paris,tokyo,longitude latitude). Default is geneve"
		echo "-g: RUn subprocesses within gdb (only with -x)"
		echo "-n: Don't start enhanced positioning service"
		echo "-x: Run subprocesses in own xterm to get separated log messages"
		exit 1
	esac
done
trap "terminate" EXIT INT
set -e
if [ "$enhpos" = 1 ]
then
	if [ -z "$REPLAYER_LOG_FILE" ]
	then
		REPLAYER_LOG_FILE=$SRC_DIR/positioning/provider/rest/geneve-cologny.gvsl
	fi
	export REPLAYER_LOG_FILE
	run EnhancedPositionService $BIN_DIR/positioning/src/position-daemon 
fi
cd $BIN_DIR/navit/navit
>bookmark.txt
echo "$center" >center.txt
run MapViewer ./navit navit_genivi_mapviewer.xml
run NavigationCore ./navit navit_genivi_navigationcore.xml
wait