|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file contains the header file of the CIAUpdateStarter |
|
15 * class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __IAUPDATE_STARTER_H__ |
|
21 #define __IAUPDATE_STARTER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "iaupdateuitimerobserver.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CApaWindowGroupName; |
|
29 class MIAUpdateStarterObserver; |
|
30 class CIAUpdateUITimer; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * |
|
35 */ |
|
36 |
|
37 class CIAUpdateStarter :public CActive, public MIAUpdateUITimerObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Construct a CIAUpdateStarter using two phase construction, |
|
43 * and return a pointer to the created object |
|
44 * @param aCommandLineExecutable Name of executable to be started |
|
45 * @param aCommandLineArguments Command line arguments of an application |
|
46 * @return A pointer to the created instance of CIAUpdateStarter |
|
47 */ |
|
48 static CIAUpdateStarter* NewL( const TDesC& aCommandLineExecutable, |
|
49 const TDesC8& aCommandLineArguments ); |
|
50 |
|
51 /** |
|
52 * Destructor |
|
53 */ |
|
54 ~CIAUpdateStarter(); |
|
55 |
|
56 public: // new functions |
|
57 /** |
|
58 * Starts an executable |
|
59 * |
|
60 * @param aStarterObserver Observer |
|
61 */ |
|
62 void StartExecutableL( MIAUpdateStarterObserver& aStarterObserver ); |
|
63 |
|
64 /** |
|
65 * Checks weather startable executable exists in installation package |
|
66 * |
|
67 * @param aPUid Package Uid of installation |
|
68 */ |
|
69 void CheckInstalledPackageL( const TUid& aPUid ); |
|
70 |
|
71 /** |
|
72 * Bring started application to foreground |
|
73 */ |
|
74 void BringToForegroundL() const; |
|
75 |
|
76 private: // from CActive |
|
77 |
|
78 /** |
|
79 * @see CActive::DoCancel |
|
80 * |
|
81 */ |
|
82 void DoCancel(); |
|
83 |
|
84 /** |
|
85 * When the server side has finished operation, the CActive object will |
|
86 * be informed about it, and as a result RunL will be called. This function |
|
87 * well inform the observer that the operation has been completed. |
|
88 * @see CActive::RunL |
|
89 * |
|
90 */ |
|
91 void RunL(); |
|
92 |
|
93 /** |
|
94 * Just trap leave error and pass it to observer |
|
95 * |
|
96 * @see CActive::RunError |
|
97 * |
|
98 */ |
|
99 TInt RunError( TInt aError ); |
|
100 |
|
101 private: // from MIAUpdateUITimerObserver |
|
102 |
|
103 void BackgroundDelayComplete( TInt aError ); |
|
104 |
|
105 void ForegroundDelayComplete( TInt aError ); |
|
106 |
|
107 void ProcessStartDelayComplete( TInt aError ); |
|
108 |
|
109 private: //constructors |
|
110 |
|
111 /** |
|
112 * Perform the second phase construction of a CIAUpdateStarter object |
|
113 * @param aCommandLineExecutable Name of executable to be started |
|
114 * @param aCommandLineArguments Command line arguments of an application |
|
115 */ |
|
116 void ConstructL( const TDesC& aCommandLineExecutable, |
|
117 const TDesC8& aCommandLineArguments ); |
|
118 |
|
119 /** |
|
120 * C++ constructor |
|
121 */ |
|
122 CIAUpdateStarter(); |
|
123 |
|
124 private: //new functions |
|
125 |
|
126 /** |
|
127 * Starts executable |
|
128 */ |
|
129 void LaunchExeL(); |
|
130 |
|
131 /** |
|
132 * Close executable |
|
133 */ |
|
134 void CloseExecutableL(); |
|
135 |
|
136 /** |
|
137 * Finds UID of executable |
|
138 * @param aUid UID |
|
139 */ |
|
140 void UidForExecutableL( TUid& aUid ) const; |
|
141 |
|
142 /** |
|
143 * Starts process |
|
144 */ |
|
145 void StartProcessL(); |
|
146 |
|
147 private: //data |
|
148 |
|
149 HBufC* iCommandLineExecutable; |
|
150 |
|
151 HBufC8* iCommandLineArguments; |
|
152 |
|
153 TBool iStartNeeded; |
|
154 |
|
155 TBool iExeStarted; |
|
156 |
|
157 TUid iUid; |
|
158 |
|
159 TInt iPrevWgId; |
|
160 |
|
161 RThread iThread; |
|
162 |
|
163 RProcess iProcess; |
|
164 |
|
165 MIAUpdateStarterObserver* iStarterObserver; //not owned |
|
166 |
|
167 CEikonEnv* iEikEnv; //not owned |
|
168 |
|
169 CIAUpdateUITimer* iProcessStartTimer; |
|
170 |
|
171 }; |
|
172 |
|
173 |
|
174 #endif // __IAUPDATE_STARTER_H__ |