iaupdate/IAD/firmwareupdate/src/iaupdatefwfotamodel.cpp
changeset 77 d1838696558c
parent 44 329d304c1aa1
--- a/iaupdate/IAD/firmwareupdate/src/iaupdatefwfotamodel.cpp	Tue Sep 28 14:48:39 2010 +0300
+++ b/iaupdate/IAD/firmwareupdate/src/iaupdatefwfotamodel.cpp	Thu Oct 14 14:11:30 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,7 +19,6 @@
 
 
 // INCLUDE FILES
-#include <sysutil.h>
 #include <centralrepository.h>
 #include <DevManInternalCRKeys.h>
 
@@ -51,7 +50,6 @@
 CIAUpdateFWFotaModel::~CIAUpdateFWFotaModel()
     {
     FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::~CIAUpdateFWFotaModel()" );
-    //iFwUpdIdStateList.Close();
     iFotaEngine.Close();
     }
 
@@ -108,7 +106,7 @@
 //
  void CIAUpdateFWFotaModel::EnableFwUpdRequestL( const TInt aProfileId )
     {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SetDefaultFotaProfileIdL()" );
+    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::EnableFwUpdRequestL()" );
     
     CRepository* centrep = NULL;
     TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) );
@@ -119,163 +117,9 @@
     centrep->Set( KDevManClientInitiatedFwUpdateId, aProfileId );
     delete centrep;
     
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SetDefaultFotaProfileIdL() completed" );
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::ReadProfileListL
-// -----------------------------------------------------------------------------
-//
-void CIAUpdateFWFotaModel::ReadProfileListL( CDesCArray*          /*aItems*/,
-                                         CArrayFixFlat<TInt>* /*aProfileIdList*/ )
-    {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::ReadProfileListL() - not implemented" );
-    //no implementation
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::SelectDefaultProfileFromList
-// -----------------------------------------------------------------------------
-//
-TInt CIAUpdateFWFotaModel::SelectDefaultProfileFromList(
-    const CArrayFixFlat<TInt>* /*aProfileIdList*/ ) const
-    {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::SelectDefaultProfileFromList() - not implemented" );
-    TInt retval( KErrNotFound );
-    return retval;
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::VerifyProfileL
-// -----------------------------------------------------------------------------
-//
-TBool CIAUpdateFWFotaModel::VerifyProfileL( const TInt /*aProfileId*/ ) const
-    {
-    TBool retval( EFalse );
-    return retval;
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::RetrieveFwUpdPkgIdListL
-// -----------------------------------------------------------------------------
-//
-RArray< TInt > CIAUpdateFWFotaModel::RetrieveFwUpdPkgIdListL()
-    {
-    const TInt maxNumOfProfiles = 32;
-    
-    TBuf16< maxNumOfProfiles > idListDescriptor;
-    User::LeaveIfError( iFotaEngine.GetUpdatePackageIds( idListDescriptor ) );
-    
-    RArray< TInt > idList;
-    
-    TInt count = idListDescriptor.Length();
-    for ( TInt i = 0; i < count; i++ )
-        {
-        idList.Append( idListDescriptor[ i ] );
-        }
-    
-    return idList;
+    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::CIAUpdateFWFotaModel::EnableFwUpdRequestL( completed" );
     }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL
-// -----------------------------------------------------------------------------
-//
- TInt CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(
-    RFotaEngineSession::TState aState )
-    {
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): aState = %d" ),
-         (TInt) aState ) );
-
-    RArray< TInt > idList = RetrieveFwUpdPkgIdListL();
-    TInt retval = KErrNotFound;
-
-    TInt count = idList.Count();
-    for ( TInt i = 0; (i < count) && (retval == KErrNotFound); i++ )
-        {
-        RFotaEngineSession::TState pkgState;
-        pkgState = iFotaEngine.GetState( idList[ i ] );
-        FTRACE( FPrint( _L(
-            "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): profileid = %d, pkgstate = %d" ),
-             idList[i], (TInt) pkgState ) );
-        if ( pkgState == aState )
-            {
-            retval = idList[ i ];
-            }
-        }
-
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::FindFwUpdPkgWithStateL(): completed, retval = %d" ),
-         retval ) );
-    idList.Close(); 
-    
-    return retval;
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::InitiateFwUpdInstall
-// -----------------------------------------------------------------------------
-//
- TInt CIAUpdateFWFotaModel::InitiateFwUpdInstall( TInt aPkgId, TInt aProfileId )
-    {
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::InitiateFwUpdInstall(): aPkgId = %d, aProfileId = %d" ),
-        aPkgId, aProfileId ) );
-
-    TInt retval = KErrGeneral;
-    retval = iFotaEngine.Update( aPkgId, aProfileId, KNullDesC8, KNullDesC8 );
-
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::InitiateFwUpdInstall() completed, retval = %d" ),
-        retval ) );
-    return retval;
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::CurrentFwVersionString
-// If the software version retrieval fails, the aVersionstring is not modified.
-// -----------------------------------------------------------------------------
-//
-TInt CIAUpdateFWFotaModel::CurrentFwVersionString( TDes& aVersionString )
-    {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::CurrentFwVersionString()" );
-    TBuf< KSysUtilVersionTextLength > buf;
-
-    TInt err = SysUtil::GetSWVersion( buf );
-    if ( err == KErrNone )
-        {
-        _LIT( separator, "\n" );
-        TInt location = buf.Find( separator );
-        if ( location != KErrNotFound)
-            {
-            // Delete the separator and the text after it. We are
-            // only interested in the first section.
-            buf.Delete( location, (buf.Length() - location) );
-            }
-
-        aVersionString.Copy( buf.Left( aVersionString.MaxLength() ) );
-        }
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::CurrentFwVersionString() completed, err = %d, string = \"%S\"" ),
-        err, &aVersionString ) );
-
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::LastUpdateTime
-// -----------------------------------------------------------------------------
-//
-TInt CIAUpdateFWFotaModel::LastUpdateTime( TTime& aTime )
-    {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::LastUpdateTime()" );
-    TInt retval = iFotaEngine.LastUpdate( aTime );
-    FTRACE( FPrint( _L(
-        "[IAUPDATEFW] CIAUpdateFWFotaModel::LastUpdateTime() completed, err = %d" ),
-        retval ) );
-    return retval;
-    }
+ 
 
 // -----------------------------------------------------------------------------
 // CIAUpdateFWFotaModel::MarkFwUpdChangesStartL
@@ -286,47 +130,7 @@
     FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::MarkFwUpdChangesStartL()" );    
     }
 
-// -----------------------------------------------------------------------------
-// CIAUpdateFWFotaModel::FwUpdStatesChangedL
-// The array is reseted at the end of the execution to save memory, since at
-// the moment the information is not needed multiple times.
-// -----------------------------------------------------------------------------
-//
- TBool CIAUpdateFWFotaModel::FwUpdStatesChangedL()
-    {
-    FLOG( "[IAUPDATEFW] CIAUpdateFWFotaModel::FwUpdStatesChangedL()" );
-    
-    TBool retval = EFalse;
 
-    TInt configFlags( 0 );
-        TInt SetGenValue(0);
-        CRepository* centrep = NULL;
-        TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) );
-        if ( centrep )
-            {
-            centrep->Get( KDevManSessionType, configFlags );
-            
-            }
-        if ( err != KErrNone ) 
-            {
-            User::Leave( err );
-            }
-        else
-            {
-            
-            centrep->Set( KDevManSessionType, SetGenValue );
-            }      
-        if(centrep)    
-           {
-           delete centrep;
-           }
-        if ( configFlags == 1 )
-			{
-			retval = ETrue;
-			}           
-        // configFlags=2 for FOTA Package not downloaded case ,1- successful download
-    return retval;
-    }
 
 // -----------------------------------------------------------------------------
 // CIAUpdateFWFotaModel::CIAUpdateFWFotaModel
@@ -334,8 +138,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CIAUpdateFWFotaModel::CIAUpdateFWFotaModel( /*CNSCDocument* aDocument*/ ) /*:
-    iDocument( aDocument )*/
+CIAUpdateFWFotaModel::CIAUpdateFWFotaModel() 
     {
     }