|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Application class for Mce. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef C_CMCEIAUPDATEUTILS_H |
|
20 #define C_CMCEIAUPDATEUTILS_H |
|
21 |
|
22 // system include files go here: |
|
23 #include <e32base.h> |
|
24 #include <iaupdateobserver.h> |
|
25 |
|
26 // forward declarations go here: |
|
27 class CMceUi; |
|
28 class CIAUpdate; |
|
29 class CIAUpdateParameters; |
|
30 |
|
31 /** |
|
32 * Has utilities to help IAD aware applications to |
|
33 * update themselves (discover, download and install updates). |
|
34 * |
|
35 * @code |
|
36 * const TUid KYourAppUid ={0x10005ABC}; |
|
37 * CMceIAUpdateUtils *MsgIadUpdate = CMceIAUpdateUtils::NewL(); |
|
38 * iMsgIadUpdate->StartL(KYourAppUid); |
|
39 * @endcode |
|
40 * |
|
41 */ |
|
42 class CMceIAUpdateUtils : public CActive, |
|
43 public MIAUpdateObserver |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aAppUid Uid of the app for which update needs to be checked. |
|
50 */ |
|
51 static CMceIAUpdateUtils* NewL(CMceUi& aMceUi); |
|
52 |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CMceIAUpdateUtils(); |
|
58 |
|
59 void StartL( const TUid aAppUid ); |
|
60 |
|
61 /** |
|
62 * Is IAD Update requried to do now |
|
63 * @return TBool |
|
64 * ETrue, If the KMceIADUpdateCheckRetryInterval is over after the previous try |
|
65 * EFalse, If the KMceIADUpdateCheckRetryInterval is not over after the previous retry |
|
66 */ |
|
67 TBool IsUpdateRequired(); |
|
68 |
|
69 protected: |
|
70 |
|
71 /** |
|
72 * From CActive |
|
73 */ |
|
74 void RunL(); |
|
75 |
|
76 void DoCancel(); |
|
77 |
|
78 private: |
|
79 |
|
80 /** |
|
81 * C++ default constructor. |
|
82 */ |
|
83 CMceIAUpdateUtils(CMceUi& aMceUi); |
|
84 |
|
85 /** |
|
86 * By default Symbian 2nd phase constructor is private. |
|
87 */ |
|
88 void ConstructL(); |
|
89 |
|
90 /** |
|
91 * Cleanup function. |
|
92 */ |
|
93 void Delete(); |
|
94 |
|
95 /** |
|
96 * For Setting the active object active immediately. |
|
97 */ |
|
98 void CompleteSelf(); |
|
99 |
|
100 /** |
|
101 * Start IA update process. |
|
102 * @param aAppUid Uid of the app for which update needs to be checked. |
|
103 */ |
|
104 void DoStartL(TUid aAppUid); |
|
105 |
|
106 private: // From MIAUpdateObserver |
|
107 |
|
108 /** |
|
109 * From MIAUpdateObserver. |
|
110 * This callback function is called when the update checking operation has |
|
111 * completed. |
|
112 * |
|
113 * @param aErrorCode The error code of the observed update operation. |
|
114 * KErrNone for successful completion, |
|
115 * otherwise a system wide error code. |
|
116 * @param aAvailableUpdates Number of the updates that were found available. |
|
117 */ |
|
118 void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); |
|
119 |
|
120 |
|
121 /** |
|
122 * From MIAUpdateObserver. |
|
123 * This callback function is called when an update operation has completed. |
|
124 * Even if multiple functions are provided to start different update |
|
125 * operations, this callback function is always called after an update |
|
126 * operation has completed. |
|
127 * |
|
128 * @param aErrorCode The error code of the completed update operation. |
|
129 * KErrNone for successful completion, |
|
130 * otherwise a system wide error code. |
|
131 * @param aResult Details about the completed update operation. |
|
132 * Ownership is transferred. |
|
133 */ |
|
134 void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails ); |
|
135 |
|
136 |
|
137 /** |
|
138 * From MIAUpdateObserver. |
|
139 * This callback function is called when an update query operation has |
|
140 * completed. |
|
141 * |
|
142 * @param aErrorCode The error code of the observed query operation. |
|
143 * KErrNone for successful completion, |
|
144 * otherwise a system wide error code. |
|
145 * @param aUpdateNow ETrue informs that an update operation should be started. |
|
146 * EFalse informs that there is no need to start an update |
|
147 * operation. |
|
148 */ |
|
149 void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ); |
|
150 |
|
151 private: // data |
|
152 |
|
153 /** |
|
154 * IAD update API. |
|
155 * Own. |
|
156 */ |
|
157 CIAUpdate* iUpdate; |
|
158 |
|
159 /** |
|
160 * IAD update parameters. |
|
161 * Own. |
|
162 */ |
|
163 CIAUpdateParameters* iParameters; |
|
164 |
|
165 TUid iAppUid; |
|
166 |
|
167 CMceUi& iMceUi; |
|
168 |
|
169 /** |
|
170 * Previous IAD update check retry time |
|
171 */ |
|
172 TTime iPrevIADUpdateCheckTry; |
|
173 }; |
|
174 |
|
175 #endif // C_CMCEIAUPDATEUTILS_H |
|
176 |
|
177 //EOF |