|
1 /* |
|
2 * Copyright (c) 2004-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 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: IAD update handling.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "vcxiadupdate.h" |
|
22 #include "IptvDebug.h" |
|
23 #include <iaupdate.h> |
|
24 #include <iaupdateparameters.h> |
|
25 #include <iaupdateresult.h> |
|
26 #include <featmgr.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TUid KIadParamUid = { 0x102750D5 }; // Uid of VideoCenter.sis |
|
30 //_LIT( KIadParamSearch, "some search criteria" ); |
|
31 #if !defined(__SERIES60_30__) && !defined(__SERIES60_31__) && !defined(__SERIES60_32__) |
|
32 _LIT( KIadParamExec, "vcxnsappui.exe" ); |
|
33 #else |
|
34 _LIT( KIadParamExec, "iptvappui.exe" ); |
|
35 #endif // !defined(__SERIES60_30__) && !defined(__SERIES60_31__) && !defined(__SERIES60_32__) |
|
36 //_LIT8( KIadParamArg, " -x -x" ); |
|
37 |
|
38 // ======== MEMBER FUNCTIONS ======== |
|
39 |
|
40 // -------------------------------------------------------------------------- |
|
41 // CVcxIadUpdate::NewL |
|
42 // Two-phased constructor. |
|
43 // -------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CVcxIadUpdate* CVcxIadUpdate::NewL() |
|
46 { |
|
47 CVcxIadUpdate* self = new( ELeave ) CVcxIadUpdate(); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // -------------------------------------------------------------------------- |
|
55 // CVcxIadUpdate::CVcxIadUpdate |
|
56 // C++ default constructor can NOT contain any code, that might leave. |
|
57 // -------------------------------------------------------------------------- |
|
58 // |
|
59 CVcxIadUpdate::CVcxIadUpdate() |
|
60 : iUpdate( NULL ), iParameters( NULL ) |
|
61 { |
|
62 // None |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CVcxIadUpdate::ConstructL |
|
67 // Symbian 2nd phase constructor can leave. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void CVcxIadUpdate::ConstructL() |
|
71 { |
|
72 IPTVLOGSTRING_LOW_LEVEL( "CVcxIadUpdate::ConstructL()" ); |
|
73 |
|
74 if( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) |
|
75 { |
|
76 iUpdate = CIAUpdate::NewL( *this ); |
|
77 iParameters = CIAUpdateParameters::NewL(); |
|
78 } |
|
79 else |
|
80 { |
|
81 IPTVLOGSTRING_LOW_LEVEL( "CVcxIadUpdate::ConstructL(), Feature not supported" ); |
|
82 } |
|
83 } |
|
84 |
|
85 // -------------------------------------------------------------------------- |
|
86 // CVcxIadUpdate::~CVcxIadUpdate |
|
87 // Destructor |
|
88 // -------------------------------------------------------------------------- |
|
89 // |
|
90 CVcxIadUpdate::~CVcxIadUpdate() |
|
91 { |
|
92 Delete(); |
|
93 } |
|
94 |
|
95 // -------------------------------------------------------------------------- |
|
96 // CVcxIadUpdate::StartL |
|
97 // Starts update process. |
|
98 // -------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CVcxIadUpdate::StartL() |
|
101 { |
|
102 IPTVLOGSTRING_LOW_LEVEL( "CVcxIadUpdate::StartL()" ); |
|
103 |
|
104 if( iUpdate && iParameters ) |
|
105 { |
|
106 iParameters->SetUid( KIadParamUid ); |
|
107 //iParameters->SetSearchCriteriaL( KIAParamSearch ); |
|
108 // We want VC to be started after update is finished |
|
109 iParameters->SetCommandLineExecutableL( KIadParamExec ); |
|
110 //iParameters->SetCommandLineArgumentsL( KIAParamArg ); |
|
111 iParameters->SetShowProgress( EFalse ); |
|
112 |
|
113 // Check the updates |
|
114 iUpdate->CheckUpdates( *iParameters ); |
|
115 } |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CVcxIadUpdate::CheckUpdatesComplete |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CVcxIadUpdate::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) |
|
123 { |
|
124 IPTVLOGSTRING3_LOW_LEVEL( |
|
125 "CVcxIadUpdate::CheckUpdatesComplete(), aErrorCode: %d, aAvailableUpdates: %d", |
|
126 aErrorCode, aAvailableUpdates ); |
|
127 |
|
128 if ( aErrorCode == KErrNone ) |
|
129 { |
|
130 if ( aAvailableUpdates > 0 ) |
|
131 { |
|
132 // There were some updates available. |
|
133 iUpdate->UpdateQuery(); |
|
134 } |
|
135 else |
|
136 { |
|
137 // No updates available. |
|
138 Delete(); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CVcxIadUpdate::UpdateComplete |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CVcxIadUpdate::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ) |
|
148 { |
|
149 IPTVLOGSTRING3_LOW_LEVEL( |
|
150 "CVcxIadUpdate::UpdateComplete(), aErrorCode: %d, SuccessCount: %d", |
|
151 aErrorCode, aResult->SuccessCount() ); |
|
152 |
|
153 if ( aErrorCode == KErrNone ) |
|
154 { |
|
155 // The update process that the user started from IAUpdate UI is now completed. |
|
156 // If the client application itself was updated in the update process, this callback |
|
157 // is never called, since the client is not running anymore. |
|
158 TInt successCount = aResult->SuccessCount(); |
|
159 } |
|
160 |
|
161 delete aResult; // Ownership was transferred, so this must be deleted by the client |
|
162 |
|
163 // We do not need the client-server session anymore |
|
164 Delete(); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CVcxIadUpdate::UpdateQueryComplete |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CVcxIadUpdate::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) |
|
172 { |
|
173 IPTVLOGSTRING3_LOW_LEVEL( |
|
174 "CVcxIadUpdate::UpdateComplete(), aErrorCode: %d, aUpdateNow: %d", |
|
175 aErrorCode, aUpdateNow ); |
|
176 |
|
177 if ( aErrorCode == KErrNone ) |
|
178 { |
|
179 if ( aUpdateNow ) |
|
180 { |
|
181 // User choosed to update now, so let's launch the IAUpdate UI. |
|
182 iUpdate->ShowUpdates( *iParameters ); |
|
183 } |
|
184 else |
|
185 { |
|
186 // The answer was 'Later'. |
|
187 Delete(); |
|
188 } |
|
189 } |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CVcxIadUpdate::Delete |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 void CVcxIadUpdate::Delete() |
|
197 { |
|
198 delete iUpdate; iUpdate = NULL; |
|
199 delete iParameters; iParameters = NULL; |
|
200 } |
|
201 |
|
202 // End of File |