Demo: Genivi Demo script update.
[profile/ivi/layer-management.git] / GeniviDemo.sh
1 #!/bin/sh
2 ############################################################################
3
4 # Copyright 2010, 2011 BMW Car IT GmbH
5
6
7 # Licensed under the Apache License, Version 2.0 (the "License"); 
8 # you may not use this file except in compliance with the License. 
9 # You may obtain a copy of the License at 
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0 
12 #
13 # Unless required by applicable law or agreed to in writing, software 
14 # distributed under the License is distributed on an "AS IS" BASIS, 
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
16 # See the License for the specific language governing permissions and 
17 # limitations under the License.
18 #
19 ############################################################################
20
21 export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
22 export LM_PLUGIN_PATH=/usr/local/lib/layermanager
23 export DISPLAY=:0.0
24 PIDSURFACE1=/tmp/surface1.pid
25 PIDSURFACE2=/tmp/surface2.pid
26 PIDLM=/tmp/surface3.pid
27
28 start_egl_example_application()
29 {
30     EGLX11ApplicationExample &
31     pidofdlt=`ps aux | grep EGLX11ApplicationExample | grep -v grep | awk '{print $2}'`
32     echo $pidofdlt > $PIDSURFACE1
33 }
34
35 start_mock_example_application()
36 {
37     EGLX11MockNavigation -layer 3000 -surface 20 &
38     pidofdlt=`ps aux | grep EGLX11MockNavigation  | grep -v grep | awk '{print $2}'`
39     echo $pidofdlt > $PIDSURFACE2
40 }
41
42
43 start_layermanager()
44 {
45     LayerManagerService -c4 -f0 -w1280 -h480 &
46     pidofdlt=`ps aux | grep LayerManagerService  | grep -v grep | awk '{print $2}'`
47     echo $pidofdlt > $PIDLM
48 }
49
50 killprocess()
51 {
52     if [ -f $1 ]; then
53         kill -9 `cat $1`
54         rm -f $1
55     fi
56 }
57 stop() 
58 {
59     killprocess $PIDSURFACE1
60     killprocess $PIDSURFACE2
61 }
62
63 stop_layermanager() 
64 {
65     killprocess $PIDLM
66 }
67
68
69 start()
70 {
71     start_egl_example_application
72     start_mock_example_application
73 }
74
75 case "$1" in
76     start)
77         start
78         ;;
79     start_lm)
80         start_layermanager
81         ;;
82     start_example_application)
83         start_example_application
84         ;;
85     stop)
86         stop
87         ;;
88     stop_lm)
89         stop_layermanager
90         ;;       
91     *)
92         echo "Usage: $0 {start|start_lm|start_example_application|stop|stop_lm}"
93         ;;
94 esac
95 exit 0