ScreenDump: check for valid screenId and set screenId for layer
[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
23 # set plugin path, if installation path is not used
24 #export LM_PLUGIN_PATH=/usr/local/lib/layermanager
25
26 export DISPLAY=:0.0
27 PIDSURFACE1=/tmp/surface1.pid
28 PIDSURFACE2=/tmp/surface2.pid
29 PIDLM=/tmp/surface3.pid
30
31 start_egl_example_application()
32 {
33     EGLX11ApplicationExample &
34     pidofdlt=`ps aux | grep EGLX11ApplicationExample | grep -v grep | awk '{print $2}'`
35     echo $pidofdlt > $PIDSURFACE1
36 }
37
38 start_mock_example_application()
39 {
40     EGLX11MockNavigation -layer 3000 -surface 20 &
41     pidofdlt=`ps aux | grep EGLX11MockNavigation  | grep -v grep | awk '{print $2}'`
42     echo $pidofdlt > $PIDSURFACE2
43 }
44
45
46 start_layermanager()
47 {
48     LayerManagerService -c4 -f0 -w1280 -h480 &
49     pidofdlt=`ps aux | grep LayerManagerService  | grep -v grep | awk '{print $2}'`
50     echo $pidofdlt > $PIDLM
51 }
52
53 killprocess()
54 {
55     if [ -f $1 ]; then
56         kill -9 `cat $1`
57         rm -f $1
58     fi
59 }
60 stop() 
61 {
62     killprocess $PIDSURFACE1
63     killprocess $PIDSURFACE2
64 }
65
66 stop_layermanager() 
67 {
68     killprocess $PIDLM
69 }
70
71
72 start()
73 {
74     start_egl_example_application
75     start_mock_example_application
76 }
77
78 case "$1" in
79     start)
80         start
81         ;;
82     start_lm)
83         start_layermanager
84         ;;
85     start_example_application)
86         start_example_application
87         ;;
88     stop)
89         stop
90         ;;
91     stop_lm)
92         stop_layermanager
93         ;;       
94     *)
95         echo "Usage: $0 {start|start_lm|start_example_application|stop|stop_lm}"
96         ;;
97 esac
98 exit 0