1 /* |
|
2 * Copyright (c) 2004-2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #include <e32property.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 // Forward declarations |
|
28 |
|
29 class RApaLsSession; |
|
30 |
|
31 namespace Swi |
|
32 { |
|
33 /** |
|
34 * Describes the installation behaviour of any sis files found by the Daemon |
|
35 */ |
|
36 class MDaemonInstallBehaviour |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * The behavioural states |
|
41 */ |
|
42 enum TSisInstallState |
|
43 { |
|
44 EStateVerifyAppCacheList, |
|
45 EStateVerifySwisProperty, |
|
46 EStateVerifySwisIdle, |
|
47 EStateInstall |
|
48 }; |
|
49 |
|
50 public: |
|
51 /** |
|
52 * Application architecture server has a cached list of applications |
|
53 * and this is required to be ready to use |
|
54 */ |
|
55 virtual TSisInstallState VerifyAppCacheListL() = 0; |
|
56 |
|
57 /** |
|
58 * The software installer uses a property to indicate what operation it is in, |
|
59 * this should be defined |
|
60 */ |
|
61 virtual TSisInstallState VerifySwisPropertyL() = 0; |
|
62 |
|
63 /** |
|
64 * Before any installation of sisx files can take place, the software installer |
|
65 * must not be busy |
|
66 */ |
|
67 virtual TSisInstallState VerifySwisIdleL() = 0; |
|
68 |
|
69 /** |
|
70 * Request Installation |
|
71 * |
|
72 * If not using the swidaemonplugin, then use apparch to |
|
73 * launch the handler for the SIS file and block until the |
|
74 * handler is done (ie. exits). |
|
75 * |
|
76 * If using the swidaemonplugin, then ask the plugin to do the |
|
77 * install, but do NOT wait for it to complete (and the plugin |
|
78 * RequestInstallL function must not block either). |
|
79 * |
|
80 * @param aFileName The name of the sis filename |
|
81 */ |
|
82 virtual void DoInstallRequestL(const TDesC& aFileName) = 0; |
|
83 |
|
84 /** |
|
85 * Tell daemon we have called DoInstallRequestL for all SIS |
|
86 * files on this removable media. |
|
87 */ |
|
88 virtual void DoNotifyMediaProcessingComplete() = 0; |
|
89 }; |
|
90 |
|
91 /** |
|
92 * The Daemon SIS installer |
|
93 */ |
|
94 class CSisInstaller : public CActive |
|
95 { |
|
96 public: |
|
97 /** |
|
98 * Symbian construction (for member variables) |
|
99 */ |
|
100 static CSisInstaller* NewL(MDaemonInstallBehaviour* aDaemonBehaviour); |
|
101 |
|
102 /** |
|
103 * C++ destructor |
|
104 */ |
|
105 ~CSisInstaller(); |
|
106 |
|
107 /** |
|
108 Adds a file to the list of files to be installed |
|
109 @param aFileName The full name and path of the file to be installed |
|
110 */ |
|
111 void AddFileToInstallL(const TDesC& aFileName); |
|
112 |
|
113 /** |
|
114 * Install the specified sis file |
|
115 */ |
|
116 void StartInstallingL(); |
|
117 |
|
118 private: // From CActive |
|
119 |
|
120 /** |
|
121 * Called by Cancel when a request from this class is outstanding |
|
122 * nb. You should probably call Reset instead of Cancel. |
|
123 */ |
|
124 void DoCancel(); |
|
125 |
|
126 public: |
|
127 /** |
|
128 * Cancel outstanding requests and reset statemachine. |
|
129 * Also calls Cancel. |
|
130 * Called by DoCancel, StartInstallingL and RunError |
|
131 */ |
|
132 void Reset(); |
|
133 |
|
134 private: |
|
135 /** |
|
136 * Asynchronous completion request processing |
|
137 */ |
|
138 void RunL(); |
|
139 |
|
140 /** |
|
141 * Handles any Leaves from the RunL |
|
142 */ |
|
143 TInt RunError(TInt aError); |
|
144 |
|
145 private: |
|
146 /** |
|
147 * C++ constructor |
|
148 */ |
|
149 CSisInstaller(MDaemonInstallBehaviour* aDaemonBehaviour); |
|
150 |
|
151 /** |
|
152 * 2nd phase constructor |
|
153 */ |
|
154 void ConstructL(); |
|
155 |
|
156 /** |
|
157 * Asynchronous request activate |
|
158 */ |
|
159 void ReRequestL(); |
|
160 |
|
161 /** |
|
162 * Self request completion |
|
163 */ |
|
164 void CompleteSelf(); |
|
165 |
|
166 private: |
|
167 // The behaviour of the daemon with respect to installing |
|
168 MDaemonInstallBehaviour* iDaemonBehaviour; |
|
169 |
|
170 // The state |
|
171 MDaemonInstallBehaviour::TSisInstallState iState; |
|
172 |
|
173 RPointerArray <HBufC> iFilesToInstall; |
|
174 |
|
175 // Sis files and location |
|
176 TBuf<KMaxFileName> iSisFile; |
|
177 TInt iFileIndex; |
|
178 |
|
179 // Timer and time step |
|
180 RTimer iTimer; |
|
181 TTimeIntervalMicroSeconds32 iTimeStep; |
|
182 |
|
183 // Software installer property |
|
184 RProperty iProperty; |
|
185 }; |
|
186 } |
|
187 |
|