106 // CIAUpdateFWFotaModel::EnableFwUpdRequestL |
104 // CIAUpdateFWFotaModel::EnableFwUpdRequestL |
107 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
108 // |
106 // |
109 void CIAUpdateFWFotaModel::EnableFwUpdRequestL( const TInt aProfileId ) |
107 void CIAUpdateFWFotaModel::EnableFwUpdRequestL( const TInt aProfileId ) |
110 { |
108 { |
111 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SetDefaultFotaProfileIdL()" ); |
109 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::EnableFwUpdRequestL()" ); |
112 |
110 |
113 CRepository* centrep = NULL; |
111 CRepository* centrep = NULL; |
114 TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); |
112 TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); |
115 FTRACE( FPrint( _L( |
113 FTRACE( FPrint( _L( |
116 "[IAUPDATEFW] CIAUpdateFWFotaModel::EnableFwUpdRequestL(), opening cenrep returned %d" ), |
114 "[IAUPDATEFW] CIAUpdateFWFotaModel::EnableFwUpdRequestL(), opening cenrep returned %d" ), |
117 err ) ); |
115 err ) ); |
118 User::LeaveIfError( err ); |
116 User::LeaveIfError( err ); |
119 centrep->Set( KDevManClientInitiatedFwUpdateId, aProfileId ); |
117 centrep->Set( KDevManClientInitiatedFwUpdateId, aProfileId ); |
120 delete centrep; |
118 delete centrep; |
121 |
119 |
122 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SetDefaultFotaProfileIdL() completed" ); |
120 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::CIAUpdateFWFotaModel::EnableFwUpdRequestL( completed" ); |
123 } |
121 } |
124 |
122 |
125 // ----------------------------------------------------------------------------- |
|
126 // CIAUpdateFWFotaModel::ReadProfileListL |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CIAUpdateFWFotaModel::ReadProfileListL( CDesCArray* /*aItems*/, |
|
130 CArrayFixFlat<TInt>* /*aProfileIdList*/ ) |
|
131 { |
|
132 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::ReadProfileListL() - not implemented" ); |
|
133 //no implementation |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CIAUpdateFWFotaModel::SelectDefaultProfileFromList |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 TInt CIAUpdateFWFotaModel::SelectDefaultProfileFromList( |
|
141 const CArrayFixFlat<TInt>* /*aProfileIdList*/ ) const |
|
142 { |
|
143 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SelectDefaultProfileFromList() - not implemented" ); |
|
144 TInt retval( KErrNotFound ); |
|
145 return retval; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CIAUpdateFWFotaModel::VerifyProfileL |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TBool CIAUpdateFWFotaModel::VerifyProfileL( const TInt /*aProfileId*/ ) const |
|
153 { |
|
154 TBool retval( EFalse ); |
|
155 return retval; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CIAUpdateFWFotaModel::RetrieveFwUpdPkgIdListL |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 RArray< TInt > CIAUpdateFWFotaModel::RetrieveFwUpdPkgIdListL() |
|
163 { |
|
164 const TInt maxNumOfProfiles = 32; |
|
165 |
|
166 TBuf16< maxNumOfProfiles > idListDescriptor; |
|
167 User::LeaveIfError( iFotaEngine.GetUpdatePackageIds( idListDescriptor ) ); |
|
168 |
|
169 RArray< TInt > idList; |
|
170 |
|
171 TInt count = idListDescriptor.Length(); |
|
172 for ( TInt i = 0; i < count; i++ ) |
|
173 { |
|
174 idList.Append( idListDescriptor[ i ] ); |
|
175 } |
|
176 |
|
177 return idList; |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL( |
|
185 RFotaEngineSession::TState aState ) |
|
186 { |
|
187 FTRACE( FPrint( _L( |
|
188 "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): aState = %d" ), |
|
189 (TInt) aState ) ); |
|
190 |
|
191 RArray< TInt > idList = RetrieveFwUpdPkgIdListL(); |
|
192 TInt retval = KErrNotFound; |
|
193 |
|
194 TInt count = idList.Count(); |
|
195 for ( TInt i = 0; (i < count) && (retval == KErrNotFound); i++ ) |
|
196 { |
|
197 RFotaEngineSession::TState pkgState; |
|
198 pkgState = iFotaEngine.GetState( idList[ i ] ); |
|
199 FTRACE( FPrint( _L( |
|
200 "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): profileid = %d, pkgstate = %d" ), |
|
201 idList[i], (TInt) pkgState ) ); |
|
202 if ( pkgState == aState ) |
|
203 { |
|
204 retval = idList[ i ]; |
|
205 } |
|
206 } |
|
207 |
|
208 FTRACE( FPrint( _L( |
|
209 "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): completed, retval = %d" ), |
|
210 retval ) ); |
|
211 idList.Close(); |
|
212 |
|
213 return retval; |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CIAUpdateFWFotaModel::InitiateFwUpdInstall |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 TInt CIAUpdateFWFotaModel::InitiateFwUpdInstall( TInt aPkgId, TInt aProfileId ) |
|
221 { |
|
222 FTRACE( FPrint( _L( |
|
223 "[IAUPDATEFW] CIAUpdateFWFotaModel::InitiateFwUpdInstall(): aPkgId = %d, aProfileId = %d" ), |
|
224 aPkgId, aProfileId ) ); |
|
225 |
|
226 TInt retval = KErrGeneral; |
|
227 retval = iFotaEngine.Update( aPkgId, aProfileId, KNullDesC8, KNullDesC8 ); |
|
228 |
|
229 FTRACE( FPrint( _L( |
|
230 "[IAUPDATEFW] CIAUpdateFWFotaModel::InitiateFwUpdInstall() completed, retval = %d" ), |
|
231 retval ) ); |
|
232 return retval; |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CIAUpdateFWFotaModel::CurrentFwVersionString |
|
237 // If the software version retrieval fails, the aVersionstring is not modified. |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TInt CIAUpdateFWFotaModel::CurrentFwVersionString( TDes& aVersionString ) |
|
241 { |
|
242 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::CurrentFwVersionString()" ); |
|
243 TBuf< KSysUtilVersionTextLength > buf; |
|
244 |
|
245 TInt err = SysUtil::GetSWVersion( buf ); |
|
246 if ( err == KErrNone ) |
|
247 { |
|
248 _LIT( separator, "\n" ); |
|
249 TInt location = buf.Find( separator ); |
|
250 if ( location != KErrNotFound) |
|
251 { |
|
252 // Delete the separator and the text after it. We are |
|
253 // only interested in the first section. |
|
254 buf.Delete( location, (buf.Length() - location) ); |
|
255 } |
|
256 |
|
257 aVersionString.Copy( buf.Left( aVersionString.MaxLength() ) ); |
|
258 } |
|
259 FTRACE( FPrint( _L( |
|
260 "[IAUPDATEFW] CIAUpdateFWFotaModel::CurrentFwVersionString() completed, err = %d, string = \"%S\"" ), |
|
261 err, &aVersionString ) ); |
|
262 |
|
263 return err; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CIAUpdateFWFotaModel::LastUpdateTime |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 TInt CIAUpdateFWFotaModel::LastUpdateTime( TTime& aTime ) |
|
271 { |
|
272 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::LastUpdateTime()" ); |
|
273 TInt retval = iFotaEngine.LastUpdate( aTime ); |
|
274 FTRACE( FPrint( _L( |
|
275 "[IAUPDATEFW] CIAUpdateFWFotaModel::LastUpdateTime() completed, err = %d" ), |
|
276 retval ) ); |
|
277 return retval; |
|
278 } |
|
279 |
123 |
280 // ----------------------------------------------------------------------------- |
124 // ----------------------------------------------------------------------------- |
281 // CIAUpdateFWFotaModel::MarkFwUpdChangesStartL |
125 // CIAUpdateFWFotaModel::MarkFwUpdChangesStartL |
282 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
283 // |
127 // |
284 void CIAUpdateFWFotaModel::MarkFwUpdChangesStartL() |
128 void CIAUpdateFWFotaModel::MarkFwUpdChangesStartL() |
285 { |
129 { |
286 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::MarkFwUpdChangesStartL()" ); |
130 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::MarkFwUpdChangesStartL()" ); |
287 } |
131 } |
288 |
132 |
289 // ----------------------------------------------------------------------------- |
|
290 // CIAUpdateFWFotaModel::FwUpdStatesChangedL |
|
291 // The array is reseted at the end of the execution to save memory, since at |
|
292 // the moment the information is not needed multiple times. |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 TBool CIAUpdateFWFotaModel::FwUpdStatesChangedL() |
|
296 { |
|
297 FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::FwUpdStatesChangedL()" ); |
|
298 |
|
299 TBool retval = EFalse; |
|
300 |
133 |
301 TInt configFlags( 0 ); |
|
302 TInt SetGenValue(0); |
|
303 CRepository* centrep = NULL; |
|
304 TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); |
|
305 if ( centrep ) |
|
306 { |
|
307 centrep->Get( KDevManSessionType, configFlags ); |
|
308 |
|
309 } |
|
310 if ( err != KErrNone ) |
|
311 { |
|
312 User::Leave( err ); |
|
313 } |
|
314 else |
|
315 { |
|
316 |
|
317 centrep->Set( KDevManSessionType, SetGenValue ); |
|
318 } |
|
319 if(centrep) |
|
320 { |
|
321 delete centrep; |
|
322 } |
|
323 if ( configFlags == 1 ) |
|
324 { |
|
325 retval = ETrue; |
|
326 } |
|
327 // configFlags=2 for FOTA Package not downloaded case ,1- successful download |
|
328 return retval; |
|
329 } |
|
330 |
134 |
331 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
332 // CIAUpdateFWFotaModel::CIAUpdateFWFotaModel |
136 // CIAUpdateFWFotaModel::CIAUpdateFWFotaModel |
333 // C++ default constructor can NOT contain any code, that |
137 // C++ default constructor can NOT contain any code, that |
334 // might leave. |
138 // might leave. |
335 // ----------------------------------------------------------------------------- |
139 // ----------------------------------------------------------------------------- |
336 // |
140 // |
337 CIAUpdateFWFotaModel::CIAUpdateFWFotaModel( /*CNSCDocument* aDocument*/ ) /*: |
141 CIAUpdateFWFotaModel::CIAUpdateFWFotaModel() |
338 iDocument( aDocument )*/ |
|
339 { |
142 { |
340 } |
143 } |
341 |
144 |
342 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
343 // CIAUpdateFWFotaModel::ConstructL |
146 // CIAUpdateFWFotaModel::ConstructL |