omadm/omadmappui/src/NSmlDMFotaModel.cpp
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Class containing the FOTA functionality and communication to
       
    15 *                other related components
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <sysutil.h>
       
    23 #include <centralrepository.h>
       
    24 #include <fotaengine.h>
       
    25 #include <DevManInternalCRKeys.h>
       
    26 #include "NSmlDMSyncPrivateCRKeys.h"
       
    27 
       
    28 #include "NSmlDMSyncDocument.h"
       
    29 #include "NSmlDMFotaModel.h"
       
    30 #include "NSmlDMSyncUi.hrh"
       
    31 #include "NSmlDMSyncDebug.h"
       
    32 
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CNSmlDMFotaModel::NewL
       
    38 // Two-phased constructor.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CNSmlDMFotaModel* CNSmlDMFotaModel::NewL( CNSmlDMSyncDocument* aDocument )
       
    42     {
       
    43     CNSmlDMFotaModel* self = new( ELeave ) CNSmlDMFotaModel( aDocument );
       
    44     
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop();
       
    48 
       
    49     return self;
       
    50     }
       
    51 
       
    52     
       
    53 // Destructor
       
    54 CNSmlDMFotaModel::~CNSmlDMFotaModel()
       
    55     {
       
    56     FLOG( "[OMADM] CNSmlDMFotaModel::~CNSmlDMFotaModel()" );
       
    57     //iFwUpdIdStateList.Close();
       
    58     iFotaEngine.Close();
       
    59     }
       
    60 
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CNSmlDMFotaModel::GetProfileName
       
    64 // Changes aProfileName to KNullDesC if the profile identifier is
       
    65 // not found.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CNSmlDMFotaModel::GetProfileNameL( const TInt   aProfileId,
       
    69                                               HBufC* aProfileName ) const
       
    70     {
       
    71     FLOG( "[OMADM] CNSmlDMFotaModel::GetProfileNameL()" );
       
    72 
       
    73     TInt index( 0 );
       
    74     aProfileName->Des().Copy( KNullDesC );
       
    75     
       
    76     iDocument->RefreshProfileListL( ETrue ); // Include hidden profile
       
    77     CArrayFixFlat<TNSmlDMProfileItem>* profileList = iDocument->ProfileList( index );
       
    78     
       
    79     for ( index = 0; index < profileList->Count(); index++ )
       
    80         {
       
    81         if ( ( *profileList )[index].iProfileId == aProfileId )
       
    82             {
       
    83             aProfileName->Des().Copy( ( *profileList )[index].iProfileName );
       
    84             }
       
    85         }
       
    86 
       
    87     FTRACE( FPrint( _L(
       
    88         "[OMADM] CNSmlDMFotaModel::GetProfileNameL(): aProfileId = %d, ProfileName = \"%S\"" ),
       
    89          aProfileId, aProfileName ) );
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CNSmlDMFotaModel::DefaultFotaProfileIdL
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 TInt CNSmlDMFotaModel::DefaultFotaProfileIdL() const
       
    97     {
       
    98     FLOG( "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL()" );
       
    99     
       
   100     TInt profileId( KErrNotFound );
       
   101     CRepository* centrep = NULL;
       
   102     TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
       
   103     FTRACE( FPrint( _L(
       
   104         "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL(), opening cenrep returned %d" ),
       
   105         err ) );
       
   106 
       
   107     User::LeaveIfError( err );
       
   108     centrep->Get( KNSmlDMDefaultFotaProfileKey, profileId );
       
   109     delete centrep;
       
   110     
       
   111     FTRACE( FPrint( _L(
       
   112         "[OMADM] CNSmlDMFotaModel::DefaultFotaProfileIdL() completed, profileId = %d" ),
       
   113         profileId ) );
       
   114     return profileId;
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CNSmlDMFotaModel::SetDefaultFotaProfileIdL
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 void CNSmlDMFotaModel::SetDefaultFotaProfileIdL( const TInt aProfileId )
       
   122     {
       
   123     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL()" );
       
   124     
       
   125     CRepository* centrep = NULL;
       
   126     TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
       
   127     FTRACE( FPrint( _L(
       
   128         "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL(), opening cenrep returned %d" ),
       
   129         err ) );
       
   130 
       
   131     User::LeaveIfError( err );
       
   132     centrep->Set( KNSmlDMDefaultFotaProfileKey, aProfileId );
       
   133     delete centrep;
       
   134     
       
   135     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL() completed" );
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CNSmlDMFotaModel::EnableFwUpdRequestL
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CNSmlDMFotaModel::EnableFwUpdRequestL( const TInt aProfileId )
       
   143     {
       
   144     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL()" );
       
   145     
       
   146     CRepository* centrep = NULL;
       
   147     TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) );
       
   148     FTRACE( FPrint( _L(
       
   149         "[OMADM] CNSmlDMFotaModel::EnableFwUpdRequestL(), opening cenrep returned %d" ),
       
   150         err ) );
       
   151     User::LeaveIfError( err );
       
   152     centrep->Set( KDevManClientInitiatedFwUpdateId, aProfileId );
       
   153     delete centrep;
       
   154     
       
   155     FLOG( "[OMADM] CNSmlDMFotaModel::SetDefaultFotaProfileIdL() completed" );
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CNSmlDMFotaModel::ReadProfileListL
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 void CNSmlDMFotaModel::ReadProfileListL( CDesCArray*          aItems,
       
   163                                          CArrayFixFlat<TInt>* aProfileIdList )
       
   164     {
       
   165     FLOG( "[OMADM] CNSmlDMFotaModel::ReadProfileListL()" );
       
   166 
       
   167     TInt index( 0 );
       
   168 
       
   169     iDocument->RefreshProfileListL( ETrue ); // Include hidden profile
       
   170     CArrayFixFlat<TNSmlDMProfileItem>* profileList = iDocument->ProfileList( index );
       
   171 
       
   172     for ( index = 0; index < profileList->Count(); index++ )
       
   173         {
       
   174         aItems->AppendL( ( *profileList )[index].iProfileName );
       
   175         aProfileIdList->AppendL( ( *profileList )[index].iProfileId );
       
   176         }
       
   177         
       
   178     FTRACE( FPrint( _L(
       
   179         "[OMADM] CNSmlDMFotaModel::ReadProfileListL() completed, items = %d" ),
       
   180         index ) );
       
   181     }
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 // CNSmlDMFotaModel::SelectDefaultProfileFromList
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 TInt CNSmlDMFotaModel::SelectDefaultProfileFromList(
       
   188     const CArrayFixFlat<TInt>* aProfileIdList ) const
       
   189     {
       
   190     FLOG( "[OMADM] CNSmlDMFotaModel::SelectDefaultProfileFromList()" );
       
   191 
       
   192     TInt retval( KErrNotFound );
       
   193     TInt defaultId( KErrNotFound );
       
   194     
       
   195     TRAPD( err, defaultId = iDocument->FotaModel()->DefaultFotaProfileIdL() );
       
   196     
       
   197     if ( err != KErrNone )
       
   198         {
       
   199         // We do not care about the possible errors here. It only means
       
   200         // that the identifier is not found on the list.
       
   201         FTRACE( FPrint( _L(
       
   202             "[OMADM] CNSmlDMFotaModel::SelectDefaultProfileFromList() received error %d" ),
       
   203             err ) );
       
   204         }
       
   205         
       
   206     for ( TInt index( 0 ); index < aProfileIdList->Count(); index++ )
       
   207         {
       
   208         if ( ( *aProfileIdList )[index] == defaultId )
       
   209             {
       
   210             retval = index;
       
   211             break;  // Jump out of the loop
       
   212             }
       
   213         }
       
   214     
       
   215     FTRACE( FPrint( _L(
       
   216         "[OMADM] CNSmlDMFotaModel::SelectDefaultProfileFromList() completed, retval = %d" ),
       
   217         retval ) );
       
   218     return retval;
       
   219     }
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // CNSmlDMFotaModel::VerifyProfileL
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 TBool CNSmlDMFotaModel::VerifyProfileL( const TInt aProfileId ) const
       
   226     {
       
   227     FTRACE( FPrint( _L(
       
   228         "[OMADM] CNSmlDMFotaModel::VerifyProfileL(), aProfileId = %d" ),
       
   229         aProfileId ) );
       
   230 
       
   231     TInt index( 0 );
       
   232     TBool retval( EFalse );
       
   233 
       
   234     iDocument->RefreshProfileListL( ETrue ); // Include hidden profile
       
   235     CArrayFixFlat<TNSmlDMProfileItem>* profileList = iDocument->ProfileList( index );
       
   236 
       
   237     for ( index = 0; index < profileList->Count(); index++ )
       
   238         {
       
   239         if ( ( *profileList )[index].iProfileId == aProfileId )
       
   240             {
       
   241             retval = ETrue;
       
   242             break;  // Jump out of the loop
       
   243             }
       
   244         }
       
   245         
       
   246     FTRACE( FPrint( _L(
       
   247         "[OMADM] CNSmlDMFotaModel::VerifyProfileL() completed, return = %d" ),
       
   248         retval ) );
       
   249     return retval;
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CNSmlDMFotaModel::RetrieveFwUpdPkgIdListL
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 TInt CNSmlDMFotaModel::RetrieveFwUpdPkgIdListL(TFotaState aState)
       
   257     {
       
   258     const TInt maxNumOfProfiles = 32;
       
   259     
       
   260     TBuf16< maxNumOfProfiles > idListDescriptor;
       
   261     User::LeaveIfError( iFotaEngine.GetUpdatePackageIds( idListDescriptor ) );
       
   262 	TInt retval = KErrNotFound;
       
   263     RArray< TInt > idList;
       
   264     
       
   265     TInt count = idListDescriptor.Length();
       
   266     for ( TInt i = 0; i < count; i++ )
       
   267         {
       
   268         idList.Append( idListDescriptor[ i ] );
       
   269         }
       
   270 	TInt count1 = idList.Count();
       
   271 	for ( TInt i = 0; (i < count1) && (retval == KErrNotFound); i++ )
       
   272 		{
       
   273 		RFotaEngineSession::TState pkgState;
       
   274 		pkgState = iFotaEngine.GetState( idList[ i ] );
       
   275 		FTRACE( FPrint( _L(
       
   276 				"[OMADM] CNSmlDMFotaModel::RetrieveFwUpdPkgIdListL(): profileid = %d, pkgstate = %d" ),
       
   277 				idList[i], (TInt) pkgState ) );
       
   278 		if ( pkgState == aState )
       
   279 			{
       
   280 			retval = idList[ i ];
       
   281 			}
       
   282 		}
       
   283 	FTRACE( FPrint( _L(
       
   284 	"[OMADM] CNSmlDMFotaModel::RetrieveFwUpdPkgIdListL(): completed, retval = %d" ),
       
   285 	retval ) );
       
   286 	idList.Close(); 
       
   287 	return retval;
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CNSmlDMFotaModel::FindFwUpdPkgWithStateL
       
   292 // -----------------------------------------------------------------------------
       
   293 //
       
   294 TInt CNSmlDMFotaModel::FindFwUpdPkgWithStateL(
       
   295     TFotaState aState )
       
   296     {
       
   297     FTRACE( FPrint( _L(
       
   298         "[OMADM] CNSmlDMFotaModel::FindFwUpdPkgWithStateL(): aState = %d" ),
       
   299          (TInt) aState ) );
       
   300 	RFotaEngineSession fotasession;
       
   301 	fotasession.OpenL();
       
   302 	CleanupClosePushL(fotasession);
       
   303 	const TInt x = -1;
       
   304 	TFotaState res = EIdle;
       
   305 	res = (TFotaState)fotasession.GetState(x);
       
   306 	CleanupStack::PopAndDestroy(&fotasession);
       
   307 	if( res == aState )
       
   308 		return KErrNone;
       
   309 	else
       
   310 		return KErrNotFound;
       
   311     }
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 // CNSmlDMFotaModel::InitiateFwUpdInstall
       
   315 // -----------------------------------------------------------------------------
       
   316 //
       
   317 TInt CNSmlDMFotaModel::InitiateFwUpdInstall( TInt aPkgId, TInt aProfileId )
       
   318     {
       
   319     FTRACE( FPrint( _L(
       
   320         "[OMADM] CNSmlDMFotaModel::InitiateFwUpdInstall(): aPkgId = %d, aProfileId = %d" ),
       
   321         aPkgId, aProfileId ) );
       
   322 
       
   323     TInt retval = KErrGeneral;
       
   324     retval = iFotaEngine.Update( aPkgId, aProfileId, KNullDesC8, KNullDesC8 );
       
   325 
       
   326     FTRACE( FPrint( _L(
       
   327         "[OMADM] CNSmlDMFotaModel::InitiateFwUpdInstall() completed, retval = %d" ),
       
   328         retval ) );
       
   329     return retval;
       
   330     }
       
   331     
       
   332 // -----------------------------------------------------------------------------
       
   333 // CNSmlDMFotaModel::ContinueFwUpdInstall
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 void CNSmlDMFotaModel::ContinueFwUpdInstall( )
       
   337     {
       
   338     FLOG( "[OMADM] CNSmlDMFotaModel::ContinueFwUpdInstall(): begin" );
       
   339 
       
   340     TInt retval = iFotaEngine.TryResumeDownload( );
       
   341     
       
   342     FTRACE( FPrint( _L(
       
   343     		"[OMADM] CNSmlDMFotaModel::ContinueFwUpdInstall() completed, retval = %d") ,retval ));
       
   344     }
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 // CNSmlDMFotaModel::CurrentFwVersionString
       
   348 // If the software version retrieval fails, the aVersionstring is not modified.
       
   349 // -----------------------------------------------------------------------------
       
   350 //
       
   351 TInt CNSmlDMFotaModel::CurrentFwVersionString( TDes& aVersionString )
       
   352     {
       
   353     FLOG( "[OMADM] CNSmlDMFotaModel::CurrentFwVersionString()" );
       
   354     TBuf< KSysUtilVersionTextLength > buf;
       
   355 
       
   356     TInt err = SysUtil::GetSWVersion( buf );
       
   357     if ( err == KErrNone )
       
   358         {
       
   359         _LIT( separator, "\n" );
       
   360         TInt location = buf.Find( separator );
       
   361         if ( location != KErrNotFound)
       
   362             {
       
   363             // Delete the separator and the text after it. We are
       
   364             // only interested in the first section.
       
   365             buf.Delete( location, (buf.Length() - location) );
       
   366             }
       
   367 
       
   368         aVersionString.Copy( buf.Left( aVersionString.MaxLength() ) );
       
   369         }
       
   370     FTRACE( FPrint( _L(
       
   371         "[OMADM] CNSmlDMFotaModel::CurrentFwVersionString() completed, err = %d, string = \"%S\"" ),
       
   372         err, &aVersionString ) );
       
   373 
       
   374     return err;
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------------------------
       
   378 // CNSmlDMFotaModel::LastUpdateTime
       
   379 // -----------------------------------------------------------------------------
       
   380 //
       
   381 TInt CNSmlDMFotaModel::LastUpdateTime( TTime& aTime )
       
   382     {
       
   383     FLOG( "[OMADM] CNSmlDMFotaModel::LastUpdateTime()" );
       
   384     TInt retval = iFotaEngine.LastUpdate( aTime );
       
   385     FTRACE( FPrint( _L(
       
   386         "[OMADM] CNSmlDMFotaModel::LastUpdateTime() completed, err = %d" ),
       
   387         retval ) );
       
   388     return retval;
       
   389     }
       
   390 
       
   391 // -----------------------------------------------------------------------------
       
   392 // CNSmlDMFotaModel::MarkFwUpdChangesStartL
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 void CNSmlDMFotaModel::MarkFwUpdChangesStartL()
       
   396     {
       
   397     FLOG( "[OMADM] CNSmlDMFotaModel::MarkFwUpdChangesStartL()" );
       
   398     
       
   399     /*iFwUpdIdStateList.Reset();
       
   400     RArray< TInt > pkgIdList = RetrieveFwUpdPkgIdListL();
       
   401 
       
   402     TInt count = pkgIdList.Count();
       
   403     for ( TInt i = 0; i < count; i++ )
       
   404         {
       
   405         TFwUpdIdState item;
       
   406         item.iPkgId = pkgIdList[ i ];
       
   407         item.iState = iFotaEngine.GetState( pkgIdList[ i ] );
       
   408         iFwUpdIdStateList.Append( item );
       
   409         }
       
   410     FTRACE( FPrint( _L(
       
   411         "[OMADM] CNSmlDMFotaModel::MarkFwUpdChangesStartL() completed, list count = %d" ),
       
   412         iFwUpdIdStateList.Count() ) );
       
   413     pkgIdList.Close();  */      
       
   414     }
       
   415 
       
   416 // -----------------------------------------------------------------------------
       
   417 // CNSmlDMFotaModel::FwUpdStatesChangedL
       
   418 // The array is reseted at the end of the execution to save memory, since at
       
   419 // the moment the information is not needed multiple times.
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 TBool CNSmlDMFotaModel::FwUpdStatesChangedL()
       
   423     {
       
   424     FLOG( "[OMADM] CNSmlDMFotaModel::FwUpdStatesChangedL()" );
       
   425     
       
   426     TBool retval = EFalse;
       
   427     /*RArray< TInt > pkgIdList = RetrieveFwUpdPkgIdListL();
       
   428 
       
   429     TInt count = pkgIdList.Count();
       
   430     for ( TInt i = 0; i < count; i++ )
       
   431         {
       
   432         FTRACE( FPrint( _L(
       
   433             "[OMADM] CNSmlDMFotaModel::FwUpdStatesChangedL() searching pkgid = %d" ),
       
   434             pkgIdList[ i ] ) );
       
   435 
       
   436         TInt originalCount = iFwUpdIdStateList.Count();
       
   437         TBool found = EFalse;
       
   438         
       
   439         for ( TInt index = 0; (index < originalCount) && (!found);
       
   440             index++ )
       
   441             {
       
   442             if ( iFwUpdIdStateList[ index ].iPkgId == pkgIdList[ i ] )
       
   443                 {
       
   444                 FTRACE( FPrint( _L(
       
   445                     "[OMADM] CNSmlDMFotaModel::FwUpdStatesChangedL() found pkgid = %d" ),
       
   446                     iFwUpdIdStateList[ index ].iPkgId ) );
       
   447                 FTRACE( FPrint( _L(
       
   448                     "[OMADM] CNSmlDMFotaModel::FwUpdStatesChangedL() states are: %d and %d" ),
       
   449                     iFotaEngine.GetState( pkgIdList[ i ] ),
       
   450                     iFwUpdIdStateList[ index ].iState ) );
       
   451 
       
   452                 found = ETrue;
       
   453                 if ( iFwUpdIdStateList[ index ].iState
       
   454                     != iFotaEngine.GetState( pkgIdList[ i ] ) )
       
   455                     {
       
   456                     retval = ETrue;
       
   457                     }
       
   458                 }
       
   459             }
       
   460         
       
   461         if ( !found )
       
   462             {
       
   463             retval = ETrue;
       
   464             }
       
   465         }
       
   466     iFwUpdIdStateList.Reset();
       
   467 
       
   468     FTRACE( FPrint( _L(
       
   469         "[OMADM] CNSmlDMFotaModel::FwUpdStatesChangedL() completed, return = %d" ),
       
   470         retval ) );
       
   471     pkgIdList.Close();*/
       
   472     TInt configFlags = EGenericSession;
       
   473         //TInt SetGenValue(EGenericSession );
       
   474         CRepository* centrep = NULL;
       
   475         TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) );
       
   476         if ( centrep )
       
   477             {
       
   478             centrep->Get( KDevManSessionType, configFlags );
       
   479             
       
   480             }
       
   481         if ( err != KErrNone ) 
       
   482             {
       
   483             User::Leave( err );
       
   484             }
       
   485         else
       
   486             {
       
   487             centrep->Set( KDevManSessionType, EGenericSession );
       
   488             }      
       
   489         if(centrep)    
       
   490            {
       
   491            delete centrep;
       
   492            }
       
   493         if ( configFlags == EFotaPkgFound )
       
   494 			{
       
   495 			retval = ETrue;
       
   496 			}           
       
   497         // configFlags=2 for FOTA Package not downloaded case ,1- successful download
       
   498     return retval;
       
   499     }
       
   500 
       
   501 // -----------------------------------------------------------------------------
       
   502 // CNSmlDMFotaModel::CNSmlDMFotaModel
       
   503 // C++ default constructor can NOT contain any code, that
       
   504 // might leave.
       
   505 // -----------------------------------------------------------------------------
       
   506 //
       
   507 CNSmlDMFotaModel::CNSmlDMFotaModel( CNSmlDMSyncDocument* aDocument ) :
       
   508     iDocument( aDocument )
       
   509     {
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CNSmlDMFotaModel::ConstructL
       
   514 // Symbian 2nd phase constructor can leave.
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 void CNSmlDMFotaModel::ConstructL()
       
   518     {
       
   519     iFotaEngine.OpenL();
       
   520     }
       
   521 
       
   522 // -----------------------------------------------------------------------------
       
   523 // CNSmlDMFotaModel::GetCurrentFwUpdState
       
   524 // Fetches the state of last or current Fota operation
       
   525 // -----------------------------------------------------------------------------
       
   526 //
       
   527 TFotaState CNSmlDMFotaModel::GetCurrentFwUpdState()
       
   528 	{
       
   529 	const TInt x = -1;
       
   530 	TFotaState res = EIdle;
       
   531 	res = (TFotaState)iFotaEngine.GetState(x);
       
   532 	return res;
       
   533 	}
       
   534 
       
   535 //  End of File