|
1 /* |
|
2 * Copyright (c) 2007 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: CNcdSilentInstallActiveObserver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_SILENT_INSTALL_ACTIVE_OBSERVER_H |
|
20 #define NCD_SILENT_INSTALL_ACTIVE_OBSERVER_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 // For silent install |
|
26 #include <SWInstApi.h> |
|
27 |
|
28 class MNcdAsyncSilentInstallObserver; |
|
29 |
|
30 |
|
31 /** |
|
32 * CNcdSilentInstallActiveObserver |
|
33 * |
|
34 * This is a CActive class that observes when another |
|
35 * operation has finished. When this observer is informed |
|
36 * about the completion of another operation |
|
37 * this class object informs the MNcdAsyncSilentInstallObserver |
|
38 * about the completion. |
|
39 * |
|
40 * @see MNcdAsyncSilentInstallObserver |
|
41 */ |
|
42 class CNcdSilentInstallActiveObserver : public CActive |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * @param aObserver The information about the completion of |
|
49 * an operation is forwarded to this observer by calling its callback |
|
50 * function. |
|
51 * @return CNcdSilentInstallActiveObserver* Newly created object. |
|
52 */ |
|
53 static CNcdSilentInstallActiveObserver* NewL( MNcdAsyncSilentInstallObserver& aObserver ); |
|
54 |
|
55 /** |
|
56 * @see NewL |
|
57 */ |
|
58 static CNcdSilentInstallActiveObserver* NewLC( MNcdAsyncSilentInstallObserver& aObserver ); |
|
59 |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 */ |
|
64 virtual ~CNcdSilentInstallActiveObserver(); |
|
65 |
|
66 |
|
67 /** |
|
68 * Sets this object active for observing a silent install operation. |
|
69 * |
|
70 * @param aFileName Installation file name. |
|
71 * @param aSilentInstallOptionsPckg Silent installation options. |
|
72 */ |
|
73 void StartToObserveL( const TDesC& aFileName, |
|
74 const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg ); |
|
75 |
|
76 |
|
77 /** |
|
78 * Sets this object active for observing a silent install operation. |
|
79 * |
|
80 * @param aFile Installation file handle. |
|
81 * @param aSilentInstallOptionsPckg Silent installation options. |
|
82 */ |
|
83 void StartToObserveL( RFile& aFile, |
|
84 const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg ); |
|
85 |
|
86 |
|
87 /** |
|
88 * Cancels the asynchronous silent install operation. |
|
89 * This will also close the silent launcher. |
|
90 * |
|
91 * @note Call this function instead of normal active object |
|
92 * Cancel. This function will use the Cancel to cancel the |
|
93 * ongoing asynchronous operation. And, after cancel operation |
|
94 * is finished, the silent launcher connection will be closed. |
|
95 * |
|
96 * @return TInt System wide error code about the cancellation. |
|
97 * KErrCancel if the cancellation was success. |
|
98 * If the cancellation could not cancel the operation but the |
|
99 * operation continued synchronously to the end, the result |
|
100 * of the finished operation will be returned here. |
|
101 */ |
|
102 TInt CancelAsyncOperation(); |
|
103 |
|
104 |
|
105 protected: // CActive |
|
106 |
|
107 /** |
|
108 * @see CActive::DoCancel |
|
109 * |
|
110 * Cancels the silent install operation. |
|
111 */ |
|
112 virtual void DoCancel(); |
|
113 |
|
114 /** |
|
115 * @see CActive::RunL |
|
116 * |
|
117 * When the silent install operation finishes, this function calls |
|
118 * the callback function of the observer. |
|
119 */ |
|
120 virtual void RunL(); |
|
121 |
|
122 |
|
123 protected: |
|
124 |
|
125 /** |
|
126 * @see NewL |
|
127 */ |
|
128 CNcdSilentInstallActiveObserver( MNcdAsyncSilentInstallObserver& aObserver ); |
|
129 |
|
130 /** |
|
131 * @see NewL |
|
132 */ |
|
133 virtual void ConstructL(); |
|
134 |
|
135 |
|
136 /** |
|
137 * @return MNcdAsyncSilentInstallObserver& The information |
|
138 * about the completion of an operation is forwarded to |
|
139 * this observer by calling its callback function. |
|
140 * Ownership is not transferred. |
|
141 */ |
|
142 MNcdAsyncSilentInstallObserver& AsyncObserver() const; |
|
143 |
|
144 |
|
145 /** |
|
146 * @return SwiUI::RSWInstSilentLauncher& The launcher |
|
147 * that handles the installation operations that this |
|
148 * class object observes. Ownerhsip is not transferred. |
|
149 */ |
|
150 SwiUI::RSWInstSilentLauncher& SilentLauncher(); |
|
151 |
|
152 |
|
153 /** |
|
154 * Converts the given error code if necessary. |
|
155 * This can be used to simplify error codes for responses. |
|
156 * |
|
157 * @param aErrorCode Original error code. |
|
158 * @return TInt New error code. |
|
159 */ |
|
160 TInt ConvertErrorCode( TInt aErrorCode ); |
|
161 |
|
162 |
|
163 private: |
|
164 |
|
165 // Prevent these if not implemented |
|
166 CNcdSilentInstallActiveObserver( const CNcdSilentInstallActiveObserver& aObject ); |
|
167 CNcdSilentInstallActiveObserver& operator =( const CNcdSilentInstallActiveObserver& aObject ); |
|
168 |
|
169 |
|
170 private: // data |
|
171 |
|
172 // The information about the completion of |
|
173 // an operation is forwarded to this observer |
|
174 // by calling its callback function. |
|
175 MNcdAsyncSilentInstallObserver& iObserver; |
|
176 |
|
177 // The silent launcher handles the install operations that |
|
178 // this class object observes. |
|
179 SwiUI::RSWInstSilentLauncher iSilentLauncher; |
|
180 |
|
181 SwiUI::TServerRequest iCancelCode; |
|
182 |
|
183 }; |
|
184 |
|
185 #endif // NCD_SILENT_INSTALL_ACTIVE_OBSERVER_H |