201025_01
authorhgs
Tue, 13 Jul 2010 09:37:43 +0530
changeset 50 a36219ae6585
parent 49 689a71addb96
child 51 2e64dc50f295
201025_01
fotaapplication/fotaserver/FotaEngine/BWINS/fotaengineu.def
fotaapplication/fotaserver/FotaEngine/INC/fotaenginedebug.h
fotaapplication/fotaserver/FotaEngine/SRC/fotaengine.cpp
fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp
fotaapplication/fotaserver/FotaEngine/eabi/fotaengineu.def
fotaapplication/fotaserver/FotaEngine/group/fotaengine.mmp
fotaapplication/fotaserver/FotaRfsPlugin/group/RfsFotaPlugin.mmp
fotaapplication/fotaserver/FotaRfsPlugin/group/bld.inf
fotaapplication/fotaserver/FotaRfsPlugin/inc/RfsFotaPlugin.h
fotaapplication/fotaserver/FotaRfsPlugin/inc/fotadebug.h
fotaapplication/fotaserver/FotaRfsPlugin/src/10281873.rss
fotaapplication/fotaserver/FotaRfsPlugin/src/Proxy.cpp
fotaapplication/fotaserver/FotaRfsPlugin/src/RfsFotaPlugin.cpp
fotaapplication/fotaserver/FotaScheduleHandler/group/fotaschedulehandler.mmp
fotaapplication/fotaserver/FotaScheduleHandler/inc/FotaSchedDebug.h
fotaapplication/fotaserver/FotaScheduleHandler/src/fotaschedulehandler.cpp
fotaapplication/fotaserver/FotaServer/data/fotaserver.rss
fotaapplication/fotaserver/FotaServer/data/fotaserver_reg.rss
fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp
fotaapplication/fotaserver/FotaServer/inc/DevEncController.h
fotaapplication/fotaserver/FotaServer/inc/DevEncProgressDlg.h
fotaapplication/fotaserver/FotaServer/inc/DevEncProgressObserver.h
fotaapplication/fotaserver/FotaServer/inc/FotaDB.h
fotaapplication/fotaserver/FotaServer/inc/FotaDLProgressDlg.h
fotaapplication/fotaserver/FotaServer/inc/FotaNetworkRegStatus.h
fotaapplication/fotaserver/FotaServer/inc/FotaReminderDlg.h
fotaapplication/fotaserver/FotaServer/inc/FotaServer.h
fotaapplication/fotaserver/FotaServer/inc/FotaSrvApp.h
fotaapplication/fotaserver/FotaServer/inc/FotaSrvDebug.h
fotaapplication/fotaserver/FotaServer/inc/FotaSrvDocument.h
fotaapplication/fotaserver/FotaServer/inc/FotaSrvUI.h
fotaapplication/fotaserver/FotaServer/inc/FotasrvSession.h
fotaapplication/fotaserver/FotaServer/inc/fotaUpdateAgentComms.h
fotaapplication/fotaserver/FotaServer/inc/fotadownload.h
fotaapplication/fotaserver/FotaServer/inc/fotaserverPrivatePSKeys.h
fotaapplication/fotaserver/FotaServer/inc/fotaserver_service.rh
fotaapplication/fotaserver/FotaServer/inc/fotaupdate.h
fotaapplication/fotaserver/FotaServer/loc/fotaserver.loc
fotaapplication/fotaserver/FotaServer/src/DevEncController.cpp
fotaapplication/fotaserver/FotaServer/src/DevEncProgressDlg.cpp
fotaapplication/fotaserver/FotaServer/src/DevEncProgressObserver.cpp
fotaapplication/fotaserver/FotaServer/src/FotaDB.cpp
fotaapplication/fotaserver/FotaServer/src/FotaDLProgressDlg.cpp
fotaapplication/fotaserver/FotaServer/src/FotaNetworkRegStatus.cpp
fotaapplication/fotaserver/FotaServer/src/FotaReminderDlg.cpp
fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp
fotaapplication/fotaserver/FotaServer/src/FotaSrvApp.cpp
fotaapplication/fotaserver/FotaServer/src/FotaSrvDocument.cpp
fotaapplication/fotaserver/FotaServer/src/FotaSrvUi.cpp
fotaapplication/fotaserver/FotaServer/src/fotaSrvSession.cpp
fotaapplication/fotaserver/FotaServer/src/fotadownload.cpp
fotaapplication/fotaserver/FotaServer/src/fotaupdate.cpp
fotaapplication/fotaserver/FotaStorage/BWINS/fotadiskstorageu.def
fotaapplication/fotaserver/FotaStorage/data/102072C6.rss
fotaapplication/fotaserver/FotaStorage/group/fotadiskstorage.mmp
fotaapplication/fotaserver/FotaStorage/group/fotastorage.mmp
fotaapplication/fotaserver/FotaStorage/inc/fotaDiskStorage.h
fotaapplication/fotaserver/FotaStorage/inc/fotadebug.h
fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp
fotaapplication/fotaserver/FotaStorage/src/fotastorage.cpp
fotaapplication/fotaserver/cenrep/fotadiskstoragePrivateCRKeys.h
fotaapplication/fotaserver/cenrep/fotaserverPrivateCRKeys.h
fotaapplication/fotaserver/cenrep/keys_fotadiskstorage.xls
fotaapplication/fotaserver/cenrep/keys_fotaserver.xls
fotaapplication/fotaserver/conf/fotadiskstorage.confml
fotaapplication/fotaserver/conf/fotadiskstorage_102072C6.crml
fotaapplication/fotaserver/conf/fotaserver.confml
fotaapplication/fotaserver/conf/fotaserver_102072C4.crml
fotaapplication/fotaserver/fmsclient/bwins/fmsclientu.def
fotaapplication/fotaserver/fmsclient/eabi/fmsclientu.def
fotaapplication/fotaserver/fmsclient/group/bld.inf
fotaapplication/fotaserver/fmsclient/group/fmsclient.mmp
fotaapplication/fotaserver/fmsclient/inc/fmsclient.h
fotaapplication/fotaserver/fmsclient/inc/fmsclientdebug.h
fotaapplication/fotaserver/fmsclient/src/fmsclient.cpp
fotaapplication/fotaserver/fmserver/group/bld.inf
fotaapplication/fotaserver/fmserver/group/fmsserver.mmp
fotaapplication/fotaserver/fmserver/inc/fmsdebug.h
fotaapplication/fotaserver/fmserver/inc/fmsinterruptaob.h
fotaapplication/fotaserver/fmserver/inc/fmsserver.h
fotaapplication/fotaserver/fmserver/inc/fmsserversession.h
fotaapplication/fotaserver/fmserver/src/fmsinterruptaob.cpp
fotaapplication/fotaserver/fmserver/src/fmsserver.cpp
fotaapplication/fotaserver/fmserver/src/fmsserversession.cpp
fotaapplication/fotaserver/fotacustcmds/bwins/fotacustcmdsu.def
fotaapplication/fotaserver/fotacustcmds/eabi/fotacustcmdsu.def
fotaapplication/fotaserver/fotacustcmds/group/bld.inf
fotaapplication/fotaserver/fotacustcmds/group/fotacustcmds.mmp
fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdallreasons.h
fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdfirmwareupdate.h
fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdfirstboot.h
fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdsfactory.h
fotaapplication/fotaserver/fotacustcmds/inc/fotastartupDebug.h
fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdallreasons.cpp
fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdfirmwareupdate.cpp
fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdfirstboot.cpp
fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdsfactory.cpp
fotaapplication/fotaserver/group/bld.inf
fotaapplication/fotaserver/group/fota_icons_aif_scalable_dc.mk
fotaapplication/fotaserver/group/fota_icons_dc.mk
fotaapplication/fotaserver/inc/FotaIPCTypes.cpp
fotaapplication/fotaserver/inc/FotaIPCTypes.h
fotaapplication/fotaserver/inc/fmsclientserver.h
fotaapplication/fotaserver/rom/fotaserver.iby
fotaapplication/fotaserver/rom/fotaserverresources.iby
--- a/fotaapplication/fotaserver/FotaEngine/BWINS/fotaengineu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-EXPORTS
-	??0RFotaEngineSession@@QAE@XZ @ 1 NONAME ; RFotaEngineSession::RFotaEngineSession(void)
-	?Close@RFotaEngineSession@@QAEXXZ @ 2 NONAME ; void RFotaEngineSession::Close(void)
-	?CurrentVersion@RFotaEngineSession@@QAEHAAVTDes16@@@Z @ 3 NONAME ; int RFotaEngineSession::CurrentVersion(class TDes16 &)
-	?DeleteUpdatePackage@RFotaEngineSession@@QAEHH@Z @ 4 NONAME ; int RFotaEngineSession::DeleteUpdatePackage(int)
-	?Download@RFotaEngineSession@@QAEHHABVTDesC8@@H00@Z @ 5 NONAME ; int RFotaEngineSession::Download(int, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
-	?DownloadAndUpdate@RFotaEngineSession@@QAEHHABVTDesC8@@H00@Z @ 6 NONAME ; int RFotaEngineSession::DownloadAndUpdate(int, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
-	?ExtensionInterface@RFotaEngineSession@@EAEXVTUid@@AAPAX@Z @ 7 NONAME ; void RFotaEngineSession::ExtensionInterface(class TUid, void * &)
-	?GenericAlertSentL@RFotaEngineSession@@QAEXH@Z @ 8 NONAME ; void RFotaEngineSession::GenericAlertSentL(int)
-	?GetResult@RFotaEngineSession@@QAEHH@Z @ 9 NONAME ; int RFotaEngineSession::GetResult(int)
-	?GetState@RFotaEngineSession@@QAE?AW4TState@1@H@Z @ 10 NONAME ; enum RFotaEngineSession::TState RFotaEngineSession::GetState(int)
-	?GetUpdatePackageIds@RFotaEngineSession@@QAEHAAVTDes16@@@Z @ 11 NONAME ; int RFotaEngineSession::GetUpdatePackageIds(class TDes16 &)
-	?IsPackageStoreSizeAvailable@RFotaEngineSession@@QAEHH@Z @ 12 NONAME ; int RFotaEngineSession::IsPackageStoreSizeAvailable(int)
-	?LastUpdate@RFotaEngineSession@@QAEHAAVTTime@@@Z @ 13 NONAME ; int RFotaEngineSession::LastUpdate(class TTime &)
-	?OpenL@RFotaEngineSession@@QAEXXZ @ 14 NONAME ; void RFotaEngineSession::OpenL(void)
-	?OpenUpdatePackageStore@RFotaEngineSession@@QAEHHAAPAVRWriteStream@@@Z @ 15 NONAME ; int RFotaEngineSession::OpenUpdatePackageStore(int, class RWriteStream * &)
-	?ScheduledUpdateL@RFotaEngineSession@@QAEHVTFotaScheduledUpdate@@@Z @ 16 NONAME ; int RFotaEngineSession::ScheduledUpdateL(class TFotaScheduledUpdate)
-	?Update@RFotaEngineSession@@QAEHHHABVTDesC8@@0@Z @ 17 NONAME ; int RFotaEngineSession::Update(int, int, class TDesC8 const &, class TDesC8 const &)
-	?UpdatePackageDownloadComplete@RFotaEngineSession@@QAEXH@Z @ 18 NONAME ; void RFotaEngineSession::UpdatePackageDownloadComplete(int)
-	?GetDownloadUpdatePackageSize@RFotaEngineSession@@QAEHHAAH0@Z @ 19 NONAME ; int RFotaEngineSession::GetDownloadUpdatePackageSize(int, int &, int &)
-	?TryResumeDownload@RFotaEngineSession@@QAEHXZ @ 20 NONAME ; int RFotaEngineSession::TryResumeDownload(void)
-
--- a/fotaapplication/fotaserver/FotaEngine/INC/fotaenginedebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros 
-*
-*/
-
-
-
-#ifndef FOTADEBUG_H
-#define FOTADEBUG_H
-
-    // IMPORT_C static TInt Print(TRefByValue<const TDesC> aFmt,...);
-    #ifdef _FOTA_DEBUG
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fotaengine.log" );
-        _LIT( KLogDirFullName, "c:\\logs\\" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-#endif      // FOTADEBUG_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaEngine/SRC/fotaengine.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Client for fotaserver
-*
-*/
-
-
-
-
-// INCLUDES
-#include <bldvariant.hrh>
-#include "fotaengine.h"
-#include "FotaIPCTypes.h"
-#include "fotaConst.h"
-#include "fotaenginedebug.h"
-#include <apgcli.h>
-#include <AknServerApp.h>
-
-// CONSTANTS
-_LIT(KServerNameFormat, "%08x_%08x_AppServer");        
-
-// =================== LOCAL FUNCTIONS ========================================
-
-// ---------------------------------------------------------------------------
-// IsClientFota()   Checks if client is another fotaserver
-// ---------------------------------------------------------------------------
-TBool IsClientFota()
-    {
-    RThread thread;
-    TUid    fota,dlmgr;
-    fota.iUid           = KFotaServerUid;
-    dlmgr.iUid			= KDLMgrServerUid;
-    if (thread.SecureId() == fota.iUid || thread.SecureId() == dlmgr.iUid )
-        {
-        return ETrue;
-        }
-    return EFalse;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::StartServerL() 
-// Start application server
-// ---------------------------------------------------------------------------
-//
-void RFotaEngineSession::StartApplicationL( const TUid& aNameUid
-                                            , const TUid& aAppServerUid )
-    {
-    TInt err;
-    FLOG(_L("RFotaEngineSession::StartApplicationL >>"));
-    RApaLsSession apa;
-    err = apa.Connect();
-    User::LeaveIfError(err);
-    CleanupClosePushL(apa);
-
-    // Get application information
-    TApaAppInfo info;
-    err=0;
-    for(TInt i = 20; ((err = apa.GetAppInfo(info, 
-	    aAppServerUid)) == RApaLsSession::EAppListInvalid) && i > 0; i--)
-        {
-        User::After(500000);
-        }
-    User::LeaveIfError(err);
-
-    // Start aplication server
-    CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
-    cmdLine->SetExecutableNameL(info.iFullName);
-    cmdLine->SetServerRequiredL( aNameUid.iUid );
-    cmdLine->SetCommandL(EApaCommandBackground);
-    TThreadId   srvid;
-    err = apa.StartApp(*cmdLine, srvid);
-    User::LeaveIfError(err);
-
-    // Wait until server is running.
-
-    // Rendezvous() is not reliable for synchronising with the new server
-    // in this case as we may not be able
-    // to open the server thread before it has reached its rendezvous
-    // point, in which case we hang.
-    // So, the standby algorithm is to poll for server existence (yuk)
-	const TInt maxPoll = 100;
-	const TInt waitDelay = 100000;	// 0.1 seconds
-    TFullName serverName;
-    serverName.Format(KServerNameFormat, aNameUid, aAppServerUid);
-	for (TInt ii = 0; ii < maxPoll; ii++)
-		{
-		// look for the server name
-		TFindServer find(serverName);
-		TFullName fullName;
-        err = find.Next(fullName);
-		if ( err == KErrNone)
-			{
-			break;		// found the server, so return
-			}
-		User::After(waitDelay);			// wait before trying again
-		}
-	User::LeaveIfError(err);	// failed to find the server, bomb out
-
-    CleanupStack::PopAndDestroy(2, &apa);	// cmdLine and apa
-    FLOG(_L("RFotaEngineSession::StartApplicationL <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::StartServerL() 
-// Connect to existing server
-// ---------------------------------------------------------------------------
-//
-void RFotaEngineSession::ConnectToServerL( const TUid& aNameUid
-                                            , const TUid& aAppServerUid )
-    {
-    RWsSession  ws;
-    TInt        err;
-
-    FLOG(_L("RFotaEngineSession::ConnectToServerL >>"));
-    if (aAppServerUid == KNullUid)
-        {
-        User::Leave(KErrGeneral);
-        }
-
-	// Connect to server
-    TFullName serverName;
-	serverName.Format(KServerNameFormat, 
-	aNameUid, aAppServerUid);
-    TRAP(err, ConnectExistingByNameL(serverName) );
-    if(err)
-        {
-        TVersion vers(0,0,1);
-        err = CreateSession (serverName, vers);
-        User::LeaveIfError(err);
-        }
-    FLOG(_L("       3"));
-
-    FLOG(_L("RFotaEngineSession::ConnectToServerL <<"));
-    }
-    
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::OpenL( )
-// Opens session to fotaserver. 
-// ---------------------------------------------------------------------------
-EXPORT_C void RFotaEngineSession::OpenL( )
-{
-    RProcess pr; TFullName fn = pr.FullName(); 
-    TInt err(0);
-    TUid diff1 = TUid::Uid(KUikonUidPluginInterfaceNotifiers);
-    FLOG(_L("[RFotaEngineSession] OpenL\tcalled by '%S' >>"),&fn );
-
-    // -------------------------------------------- V
-    err = KErrNotFound;
-    // If client is fotaserver - MUST create new server
-    if( !IsClientFota() ) 
-        {
-        TRAP(err, ConnectToServerL( diff1 , TUid::Uid(KFotaServerUid)) );
-        }
-    else
-        {
-        diff1 = TUid::Uid(KUikonUidPluginInterfaceNotifiers+1);
-        }
-
-    if(err!=KErrNone)
-        {
-        StartApplicationL( diff1 , TUid::Uid(KFotaServerUid));
-        ConnectToServerL( diff1 , TUid::Uid(KFotaServerUid));
-        }
-    FLOG(_L("[RFotaEngineSession]\tconnected <<") );
-}
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::Close( )
-// Closes session to fotaserver
-// ---------------------------------------------------------------------------
-EXPORT_C void RFotaEngineSession::Close( )
-{
-    RProcess pr; TFullName fn = pr.FullName(); 
-    FLOG(_L("[RFotaEngineSession] RFotaEngineSession::Close() >> called by '%S'"),&fn );
-        
-    if ( iStream )
-        {
-        iStream->Close(); // this uses iChunk
-        delete iStream;  iStream=0;
-        }
-    iChunk.Close();
-
-    // Tell server that generic alert is sent for this pkg, so state is 
-    // cleaned up     
-    if ( iGenericAlertSentPkgID != -1 )
-        {
-        TInt err = SendReceive( EGenericAlertSentForPackage
-                                    , TIpcArgs(iGenericAlertSentPkgID) );
-        }
-
-    REikAppServiceBase::Close();
-    FLOG(_L("[RFotaEngineSession] RFotaEngineSession::Close() <<") );
-}
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::Download
-// Starts download of upd package.
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::Download(const TInt aPkgId
-    , const TDesC8& aPkgURL, const TSmlProfileId aProfileId
-    , const TDesC8& aPkgName, const TDesC8& aPkgVersion)
-{
-    TInt err;
-    TDownloadIPCParams          ipcparam;
-    ipcparam.iPkgId             = aPkgId;
-    ipcparam.iProfileId         = aProfileId;
-    ipcparam.iPkgName.Copy      (aPkgName);
-    ipcparam.iPkgVersion.Copy   (aPkgVersion);
-    TPckg<TDownloadIPCParams>   pkg(ipcparam);
-    err = SendReceive ( EFotaDownload ,  TIpcArgs(&pkg, &aPkgURL));
-    return err;
-}
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::DownloadAndUpdate
-// Starts download and update of update pakcage
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::DownloadAndUpdate(const TInt aPkgId
-        ,const TDesC8& aPkgURL, const TSmlProfileId aProfileId
-        ,const TDesC8& aPkgName, const TDesC8& aPkgVersion)
-{
-    TInt err;
-    TDownloadIPCParams          ipcparam;
-    ipcparam.iPkgId             = aPkgId;
-    ipcparam.iProfileId         = aProfileId;
-    ipcparam.iPkgName.Copy      (aPkgName);
-    ipcparam.iPkgVersion.Copy   (aPkgVersion);
-    TPckg<TDownloadIPCParams>   pkg(ipcparam);
-    err = SendReceive( EFotaDownloadAndUpdate,  TIpcArgs(&pkg, &aPkgURL));
-    return err;
-}
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::Update
-// Starts update of update package
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::Update(const TInt aPkgId
-        ,const TSmlProfileId aProfileId, const TDesC8& aPkgName
-        ,const TDesC8& aPkgVersion)
-{
-    TInt err;
-    TDownloadIPCParams          ipcparam;
-    ipcparam.iPkgId             = aPkgId;
-    ipcparam.iProfileId         = aProfileId;
-    ipcparam.iPkgName.Copy      (aPkgName);
-    ipcparam.iPkgVersion.Copy   (aPkgVersion);
-    TPckg<TDownloadIPCParams>   pkg(ipcparam);
-    err = SendReceive ( EFotaUpdate ,  TIpcArgs(&pkg));
-    return err;
-}
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::IsPackageStoreSizeAvailable
-// Checks if there's space enough for update package
-// ---------------------------------------------------------------------------
-EXPORT_C TBool RFotaEngineSession::IsPackageStoreSizeAvailable(
-                                                    const TInt aSize)
-    {
-//    // -------------------------------------------- v 
-//    if( IsClientFota() ) 
-//        {
-//        FLOG(_L("     IsPackageStoreSizeAvailable  NOT CONNECTING"));
-//        return ETrue;
-//        }
-//    // -------------------------------------------- ^ 
-    TInt            err;
-    TBool           available;
-    TPckg<TBool>    pavailable(available);
-    err = SendReceive ( EIsPackageStoreSizeAvailable, TIpcArgs(aSize
-                                                        , &pavailable ) );
-    if ( err ) 
-        {   
-        FLOG(_L("RFotaEngineSession::IsPackageStoreSizeAvailable error %d")
-                    ,err);
-        }
-    return available;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::OpenUpdatePackageStore
-// OPens update package storage for writing.
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::OpenUpdatePackageStore(const TInt aPkgId
-                                                 ,RWriteStream*& aPkgStore)
-	{
-    FLOG(_L( "RFotaEngineSession::OpenUpdatePackageStore >> pkgid %d " )
-                    ,aPkgId );
-    TInt err;
-    err = iChunk.CreateGlobal( KNullDesC, KFotaChunkMinSize, KFotaChunkMaxSize );
-    if(err) return err;
-    iStream = new RFotaWriteStream();
-    iStream->iFotaEngineSession = this;    
-    TRAP( err, iStream->OpenL(aPkgId) );
-    aPkgStore = iStream;
-    if(err) return err;
-
-    TIpcArgs args;
-    args.Set(0,aPkgId);
-    args.Set(1,iChunk );
-	err = SendReceive( EFotaOpenUpdatePackageStore, args );
-    FLOG(_L( "RFotaEngineSession::OpenUpdatePackageStore << err  %d" ),err );
-    return err;
-    }
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::GetDownloadUpdatePackageSize
-// Gets the downloaded and full size of the update package. 
-// Implementation is not ready and will be provided later.
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::GetDownloadUpdatePackageSize(const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize)
-	{
-	FLOG(_L("RFotaEngineSession::GetDownloadUpdatePackageSize, aPkgId=%d >>"),aPkgId);
-	TInt err (KErrNone);
-    TPckg<TInt> pkg1(aDownloadedSize);
-    TPckg<TInt>	pkg2(aTotalSize);
-	err = SendReceive( EFotaGetDownloadUpdatePackageSize,TIpcArgs(aPkgId,&pkg1, &pkg2)  );
-	FLOG(_L("RFotaEngineSession::GetDownloadUpdatePackageSize << err = %d, aDownloadedSize = %d, aTotalSize = %d" ), err, aDownloadedSize, aTotalSize);
-	return err;
-	}
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::TryResumeDownload
-// Requests to resume the suspended download of the update package. 
-// Implementation is not ready and will be provided later.
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::TryResumeDownload()
-	{
-	FLOG(_L("RFotaEngineSession::TryResumeDownload >>"));
-
-	TInt err = KErrNone;
-	
-	err = SendReceive( EFotaTryResumeDownload );
-	
-	FLOG(_L("RFotaEngineSession::TryResumeDownload << err = %d" ),err);
-	return err;
-	}
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::UpdatePackageDownloadComplete
-// Ends update pkg storing. Closes resources.
-// ---------------------------------------------------------------------------
-EXPORT_C void RFotaEngineSession::UpdatePackageDownloadComplete(
-                                                          const TInt aPkgId)
-    {
-    FLOG(_L("RFotaEngineSession::UpdatePackageDownloadComplete >> id %d")
-                            ,aPkgId);
-    if ( iStream )
-        {
-        iStream->Close();
-        delete iStream;
-        iStream=0;
-        }
-    TInt err = SendReceive(EUpdatePackageDownloadComplete, TIpcArgs(aPkgId) );
-    FLOG(_L("RFotaEngineSession::UpdatePackageDownloadComplete << error %d ")
-                            ,err);
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::GetState
-// ---------------------------------------------------------------------------
-EXPORT_C RFotaEngineSession::TState RFotaEngineSession::GetState(
-                                                         const TInt aPkgId)
-    {
-    FLOG(_L("RFotaEngineSession::GetState"));
-    TInt err(0);
-    RFotaEngineSession::TState          state;
-    TPckg<RFotaEngineSession::TState>   pkgstate(state);
-    err = SendReceive ( EGetState , TIpcArgs(aPkgId, &pkgstate));
-    if ( err ) 
-        {
-        FLOG(_L("RFotaEngineSession::GetState error %d"),err);
-        }
-    return state;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::GetResult    
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::GetResult(const TInt aPkgId)
-    {
-    FLOG(_L("RFotaEngineSession::GetResult"));
-    TInt            result;
-    TPckg<TInt>     pkgresult(result);
-    SendReceive ( EGetResult , TIpcArgs(aPkgId, &pkgresult));
-    return result;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::DeleteUpdatePackage
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::DeleteUpdatePackage(const TInt aPkgId)
-{
-    TInt err = SendReceive(EDeletePackage, TIpcArgs(aPkgId) );
-    return err;
-}
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::LastUpdate
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::LastUpdate(TTime& aUpdates)
-    {
-    TInt err;
-    FLOG(_L("RFotaEngineSession::LastUpdate >>"));
-    TBuf<15>                    timestamp;
-    err = SendReceive ( EGetUpdateTimestamp, TIpcArgs(&timestamp) );
-
-    if ( timestamp.Length() > 0 )
-        {
-        TInt year   = timestamp[0];
-        TInt month  = timestamp[1];
-        TInt day    = timestamp[2];
-        TInt hour   = timestamp[3];
-        TInt minute = timestamp[4];
-        aUpdates = TDateTime (year,(TMonth)month,day,hour,minute,0,0 );
-        }
-    else
-        {
-        aUpdates.Set( _L( "19900327:101010.000000" ) ); 
-        err = KErrUnknown;
-        }
-    FLOG(_L("RFotaEngineSession::LastUpdate <<"));
-    return err;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::CurrentVersion
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::CurrentVersion(TDes& aSWVersion)
-    {
-    aSWVersion.Copy(_L("1.0"));  
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::ExtensionInterface
-// ---------------------------------------------------------------------------
-EXPORT_C void RFotaEngineSession::ExtensionInterface(TUid /*aInterfaceId*/
-                                              ,TAny*& /*aImplementation*/)
-    {
-    RProcess pr; TFullName fn = pr.FullName(); 
-    FLOG(_L("RFotaEngineSession::ExtensionInterface called by %S"), &fn);
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::RFotaEngineSession
-// ---------------------------------------------------------------------------
-EXPORT_C RFotaEngineSession::RFotaEngineSession() : iStream(0)
-                    , iGenericAlertSentPkgID(-1)
-    {
-    FLOG(_L("RFotaEngineSession::RFotaEngineSession() >>"));
-    FLOG(_L("RFotaEngineSession::RFotaEngineSession() <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::GetUpdatePackageIds
-// Gets ids of the update packages present in the system.
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::GetUpdatePackageIds(TDes16& aPackageIdList)
-    {
-    TInt err;
-    FLOG(_L("RFotaEngineSession::GetUpdatePackageIds >>"));
-    TBuf<10> b; b.Copy(_L("dkkd"));
-    TPkgIdList                  pkgids;
-    TPckg<TPkgIdList>           pkgids_pkg(pkgids);
-    TIpcArgs                    args ( &pkgids_pkg);
-    err = SendReceive ( EGetUpdatePackageIds, args);
-    aPackageIdList.Copy(pkgids);
-    FLOG(_L("RFotaEngineSession::GetUpdatePackageIds <<"));
-    return err;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::GenericAlertSentL
-// marks genereic alert being sent
-// ---------------------------------------------------------------------------
-EXPORT_C void RFotaEngineSession::GenericAlertSentL ( const TInt aPackageID )
-    {
-    iGenericAlertSentPkgID = aPackageID;
-    }
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::ScheduledUpdateL
-// Update fw
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFotaEngineSession::ScheduledUpdateL ( const TFotaScheduledUpdate aSchedule )
-    {
-  	TInt err(KErrNotSupported);
-
-    TPckg<TFotaScheduledUpdate> p(aSchedule);
-    err = SendReceive( EScheduledUpdate, TIpcArgs(&p) );
-
-    return err;
-    }
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::ServiceUid
-// Apparc asks which session class to create in server side
-// ---------------------------------------------------------------------------
-TUid RFotaEngineSession::ServiceUid() const
-	{
-    RProcess pr; TFullName fn = pr.FullName(); 
-    FLOG(_L( "RFotaEngineSession::ServiceUid() >> called by: %S" ), &fn );
-    FLOG(_L( "RFotaEngineSession::ServiceUid() << ret: 0x%X" ),
-                                            KFotaServiceUid );
-	return TUid::Uid( KFotaServiceUid );
-	}
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::SendChunkL
-// Tells server to read chunk contnets
-// ---------------------------------------------------------------------------
-void RFotaEngineSession::SendChunkL(const TUint8* aP1, const TUint8* aP2)
-    {
-    TInt writecount = aP2-aP1;
-    TInt err = SendReceive(EFotaSendChunk, TIpcArgs(writecount) );
-
-    if ( err )
-        {   
-        FLOG(_L("RFotaEngineSession::SendChunkL error %d"),err);
-        }
-    User::LeaveIfError ( err );
-    }
-
-
-// ---------------------------------------------------------------------------
-// RFotaEngineSession::ReleaseChunkHandle()
-// Releases server's handle to the chuhnk
-// ---------------------------------------------------------------------------
-TInt RFotaEngineSession::ReleaseChunkHandle()
-	{
-	return Send( EFotaReleaseChunkHandle);
-	}
--- a/fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Stream for storing firmware update package
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <centralrepository.h>
-#include "fotadiskstoragePrivateCRKeys.h"
-#include "fotaengstream.h"
-#include "fotaengine.h"
-#include "fotaenginedebug.h"
-
-// ======================= MEMBER FUNCTIONS ==================================
-
-// ---------------------------------------------------------------------------
-// RFotaWriteStream::RFotaWriteStream()
-// ---------------------------------------------------------------------------
-RFotaWriteStream::RFotaWriteStream() : RWriteStream (), iWriteLimit(0)
-    {
-    iFotaEngineSession  = 0;
-    iBuf.iMyWriteStream = this;
-    }
-
-// ---------------------------------------------------------------------------
-// RFotaWriteStream::OpenL()
-// Opens stream
-// ---------------------------------------------------------------------------
-TInt RFotaWriteStream::OpenL(const TInt /*aPkgId*/)
-    {
-    FLOG(_L( "[RFotaEngineSession] RFotaWriteStream::OpenL() >>" ) );
-
-    // Get write limit 
-    TInt            writelimit( KDefaultWriteLimit );
-    CRepository*    centrep( NULL);
-    TRAPD( err, centrep = CRepository::NewL( KCRUidFotaDiskStorage ) );
-    if(err) FLOG(_L(" writelimit not defined in centrep") );
-    if ( centrep ) 
-        {
-        err = centrep->Get(  KFotaDiskSpaceReservationKey, writelimit );
-        }
-    iWriteLimit = writelimit;
-    delete centrep;
-
-    iBuf.ResetL();
-    Attach ( &iBuf );  // set sink
-
-    FLOG(_L( "[RFotaEngineSession] RFotaWriteStream::OpenL() <<" ) );
-    return 0;
-    }
-
-
-// ---------------------------------------------------------------------------
-// TDP2StreamBuf::Reset()
-// Redefine write area.
-// ---------------------------------------------------------------------------
-void TDP2StreamBuf::ResetL()
-    {
-  	FLOG(_L("TDP2StreamBuf::ResetL() >>" ));
-    // Define write area (chunk)
-    TArea   a (EWrite) ;
-    TInt    limitedwritearea(-1);
-    TInt    chunksize = iMyWriteStream->iFotaEngineSession->iChunk.Size();
-   // TInt    writelimit = iMyWriteStream->iWriteLimit;
-/*	08-nov-06 flexible mem handling overrides this
-    // If writelimit is being exceeded, raise error
-    if ( iBytesWritten > writelimit ) 
-        {
-        User::Leave ( KErrOverflow );
-        }
-*/        
-/*		08-nov-06 flexible mem handling overrides this
-    // Ensure that we cant go beyond write limit
-    if ( (iSentChunks+1) * chunksize > writelimit )
-        {
-        limitedwritearea = writelimit - iBytesWritten;
-
-        // 0-size writearea would crash writestream base classes
-        if ( limitedwritearea == 0 )
-            {
-            limitedwritearea += 1;
-            }        
-        }
-*/
-
-    // Define write area
-    TUint8* p1 = iMyWriteStream->iFotaEngineSession->iChunk.Base();
-    TUint8* p2;
-    p2 = p1 + chunksize;
-    
-    /* // dead code
-    if ( limitedwritearea == -1 ) 
-        {
-        p2 = p1 + chunksize;
-        }
-    else
-        {
-        p2 = p1 + limitedwritearea;
-        }
-        */
-    SetBuf  (a,p1 , p2 );
-  	FLOG(_L("TDP2StreamBuf::ResetL() <<" ));
-    }
-
-// ---------------------------------------------------------------------------
-// TDP2StreamBuf::DoRelease()
-// Stream is released. This is called when data has been comitted to stream.
-// ---------------------------------------------------------------------------
-void TDP2StreamBuf::DoRelease()
-    {
-    FLOG(_L("TDP2StreamBuf::DoRelease() >>" ));
-    TRAPD(err,  OverflowL() );
-    if ( err ) FLOG(_L(" DoRelease overflow err %d"),err);
-    this->iMyWriteStream->iFotaEngineSession->ReleaseChunkHandle();
-    FLOG(_L("TDP2StreamBuf::DoRelease() <<" ));
-    }
-
-
-// ---------------------------------------------------------------------------
-// TDP2StreamBuf::TDP2StreamBuf()
-// ---------------------------------------------------------------------------
-TDP2StreamBuf::TDP2StreamBuf() : iBytesWritten(0), iSentChunks(0)
-                    ,iMyWriteStream(0)
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// TDP2StreamBuf::UnderflowL(TInt aMaxLength)
-// ---------------------------------------------------------------------------
-TInt TDP2StreamBuf::UnderflowL(TInt aMaxLength)
-    {
-    FLOG(_L("TDP2StreamBuf::UnderflowL %d"), aMaxLength );
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// TDP2StreamBuf::OverflowL()
-// Send buffer data to server. Reset buffer.
-// ---------------------------------------------------------------------------
-void TDP2StreamBuf::OverflowL()
-    {
-    FLOG(_L("TDP2StreamBuf::OverflowL >>") );
-    // Send pointers to data to server. Then reset.
-    TUint8* p1 = iMyWriteStream->iFotaEngineSession->iChunk.Base();
-    TUint8* p2 = Ptr(EWrite);                           // start point of 
-                                                        // write area
-    FLOG(_L("TDP2StreamBuf::OverflowL ptrs 0x%x  0x%x"),p1,p2 );
-    TPtr8   data(p1, p2-p1, p2-p1 );
-    iBytesWritten += p2-p1;
-    if ( p2-p1 >0 )
-        {
-        iMyWriteStream->iFotaEngineSession->SendChunkL(p1,p2);
-        iSentChunks++;
-        }
-    ResetL();
-    FLOG(_L("TDP2StreamBuf::OverflowL <<") );
-    }
-
-// End of file
--- a/fotaapplication/fotaserver/FotaEngine/eabi/fotaengineu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-EXPORTS
-	_ZN18RFotaEngineSession10LastUpdateER5TTime @ 1 NONAME
-	_ZN18RFotaEngineSession14CurrentVersionER6TDes16 @ 2 NONAME
-	_ZN18RFotaEngineSession17DownloadAndUpdateEiRK6TDesC8iS2_S2_ @ 3 NONAME
-	_ZN18RFotaEngineSession18ExtensionInterfaceE4TUidRPv @ 4 NONAME
-	_ZN18RFotaEngineSession19DeleteUpdatePackageEi @ 5 NONAME
-	_ZN18RFotaEngineSession19GetUpdatePackageIdsER6TDes16 @ 6 NONAME
-	_ZN18RFotaEngineSession22OpenUpdatePackageStoreEiRP12RWriteStream @ 7 NONAME
-	_ZN18RFotaEngineSession27IsPackageStoreSizeAvailableEi @ 8 NONAME
-	_ZN18RFotaEngineSession29UpdatePackageDownloadCompleteEi @ 9 NONAME
-	_ZN18RFotaEngineSession5CloseEv @ 10 NONAME
-	_ZN18RFotaEngineSession5OpenLEv @ 11 NONAME
-	_ZN18RFotaEngineSession6UpdateEiiRK6TDesC8S2_ @ 12 NONAME
-	_ZN18RFotaEngineSession8DownloadEiRK6TDesC8iS2_S2_ @ 13 NONAME
-	_ZN18RFotaEngineSession8GetStateEi @ 14 NONAME
-	_ZN18RFotaEngineSession9GetResultEi @ 15 NONAME
-	_ZN18RFotaEngineSessionC1Ev @ 16 NONAME
-	_ZN18RFotaEngineSessionC2Ev @ 17 NONAME
-	_ZTI13TDP2StreamBuf @ 18 NONAME ; #<TI>#
-	_ZTI18RFotaEngineSession @ 19 NONAME ; #<TI>#
-	_ZTV13TDP2StreamBuf @ 20 NONAME ; #<VT>#
-	_ZTV18RFotaEngineSession @ 21 NONAME ; #<VT>#
-	_ZN18RFotaEngineSession17GenericAlertSentLEi @ 22 NONAME
-	_ZN18RFotaEngineSession16ScheduledUpdateLE20TFotaScheduledUpdate @ 23 NONAME
-	_ZN18RFotaEngineSession17TryResumeDownloadEv @ 24 NONAME
-	_ZN18RFotaEngineSession28GetDownloadUpdatePackageSizeEiRiS0_ @ 25 NONAME
-
--- a/fotaapplication/fotaserver/FotaEngine/group/fotaengine.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Project specification file for fotaengine
-*
-*/
-
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-//MACRO  _FOTA_DEBUG 
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-TARGET          fotaengine.dll
-TARGETTYPE      DLL
-UID             0x1000008d 0x102072C5
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID                VID_DEFAULT
-
-SOURCEPATH      ../SRC
-SOURCE          fotaengine.cpp
-SOURCE          fotaengstream.cpp
-SOURCEPATH		../../inc
-SOURCE          FotaIPCTypes.cpp
-
-USERINCLUDE    ../INC  ../../inc ../../cenrep
-
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE		/epoc32/include/uiklaf/private
-
-LIBRARY         avkon.lib
-LIBRARY         euser.lib
-LIBRARY         estor.lib
-LIBRARY         apparc.lib
-LIBRARY         cone.lib
-LIBRARY         bafl.lib
-LIBRARY         apgrfx.lib
-LIBRARY         mtur.lib
-LIBRARY         eikcore.lib
-LIBRARY			efsrv.lib
-LIBRARY			ws32.lib			// wssession
-LIBRARY			centralrepository.lib
-LIBRARY	flogger.lib
-
-//End of file
--- a/fotaapplication/fotaserver/FotaRfsPlugin/group/RfsFotaPlugin.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Project definition file for project rfsfotaplugin
-*
-*/
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-// MACRO  _FOTA_DEBUG
-// MACRO  _FOTA_DEBUG_RDEBUG
-
-TARGET					rfsfotaplugin.dll
-TARGETTYPE				PLUGIN
-UID						0x10009D8D 0x10281873
-
-CAPABILITY				CAP_ECOM_PLUGIN
-VENDORID				VID_DEFAULT
-
-SOURCEPATH				../src
-SOURCE					RfsFotaPlugin.cpp
-SOURCE					Proxy.cpp
-
-START RESOURCE			10281873.rss
-TARGET rfsfotaplugin.rsc
-LANGUAGE_IDS
-END
-
-
-
-USERINCLUDE				../inc  ../../inc ../../../inc
-SYSTEMINCLUDE			 /epoc32/include/ecom 
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY euser.lib       // Base library
-LIBRARY ecom.lib	    // ECom library
-LIBRARY flogger.lib
--- a/fotaapplication/fotaserver/FotaRfsPlugin/group/bld.inf	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*	 This file provides the information required for building RFS AP
-*    	plugin
-*
-*/
-
-
-
-PRJ_PLATFORMS
-
-PRJ_MMPFILES
-
-../group/RfsFotaPlugin.mmp
-
-
-PRJ_EXPORTS
-
-
-PRJ_TESTMMPFILES
-
-
--- a/fotaapplication/fotaserver/FotaRfsPlugin/inc/RfsFotaPlugin.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Handles restory factory settings
-*
-*/
-
-
-
-
-#ifndef RfsFotaPlugin_H
-#define RfsFotaPlugin_H
-
-//  INCLUDES
-#include <e32base.h>
-#include <fotastorage.h>
-
-#include "rfsPlugin.h"
-
-// CLASS DECLARATION
-
-/**
- *  Ensures that there is disk space reservation in place after 1st boot
- *
- *  @lib    fotaserver.exe
- *  @since  S60 v3.1
- */
-class CRfsFotaPlugin: public CRFSPlugin
-    {
-public:
-
-
-    /**
-    * Two-phased constructor.
-     *
-     * @since   S60   v3.1
-     * @param	aInitParams initial parameters
-     * @return  Error code
-     */
-    static CRfsFotaPlugin* NewL(TAny* aInitParams);
-
-    virtual ~CRfsFotaPlugin();
-
-
-    /**
-     * Handle restory factory settings. Run at boot up.
-     *
-     * @since   S60   v3.1
-	 * @param	aType   type of boot
-     * @return  none
-     */
-    void RestoreFactorySettingsL( const TRfsReason aType );
-
-
-    /**
-    * GetScriptL
-    *
-	* @param    aType
-	* @param    aPath
-    * @return   None
-    */
-    void GetScriptL( const TRfsReason aType, TDes& aPath );
-
-    
-    /**
-    * GetScriptL
-    *
-	* @param    aType
-	* @param    aCommand
-    * @return   None
-    */
-    void ExecuteCustomCommandL( const TRfsReason aType, TDesC& aCommand );
-
-
-private:
-
-    CRfsFotaPlugin();
-
-    
-    /**
-    * Constructor
-    *
-	* @param    aInitParams
-    * @return   None
-    */
-	CRfsFotaPlugin(TAny* aInitParams);
-
-    void ConstructL();
-
-
-    
-    /**
-    * Load fota storage plugin
-    *
-	* @param    None
-    * @return   None
-    */
-    void            LoadStoragePluginL ();
-
-    
-    /**
-    * unload fota storage plugin
-    *
-	* @param    None
-    * @return   None
-    */
-    void            UnLoadStoragePluginL ();
-
-private: // data    
-
-
-    /**
-     * Destructor key of fotastorageplugin.
-     */
-    TUid                iStorageDtorKey;
-
-
-    /**
-     * Fotastorage plugin. Used for disk space reservation file handling
-     */
-    CFotaStorage*       iStorage;
-
-    };
-
-
-#endif      // RfsFotaPlugin_H
-
-// End of File
--- a/fotaapplication/fotaserver/FotaRfsPlugin/inc/fotadebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros 
-*
-*/
-
-
-
-#ifndef FOTADEBUG_H
-#define FOTADEBUG_H
-
-    // IMPORT_C static TInt Print(TRefByValue<const TDesC> aFmt,...);
-    #ifdef _FOTA_DEBUG
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "rfsfotaplugin.log" );
-        _LIT( KLogDirFullName, "c:\\logs\\" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-#endif      // FOTADEBUG_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaRfsPlugin/src/10281873.rss	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 1028 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-#include "registryinfo.rh"
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
-	{
-	// UID for the DLL
-	dll_uid = 0x10281873;
-	// Declare array of interface info
-	interfaces = 
-		{
-		INTERFACE_INFO
-			{
-			// UID of interface that is implemented
-			interface_uid = 0x102073BB;
-			implementations = 
-				{
-				IMPLEMENTATION_INFO
-					{
-					implementation_uid = 0x10281874;
-					version_no = 1;
-					display_name = "RFS FOTA Plugin";
-					default_data = "I"; // N = Normal RFS, D = Deep RFS, I = Init RFS (FirstBoot RFS)
-					opaque_data = "";
-					}
-				};
-			}
-		};
-	}
-
--- a/fotaapplication/fotaserver/FotaRfsPlugin/src/Proxy.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This class export ECom interface implementations.
-*
-*/
-
-
-
-#include <e32std.h>
-#include <implementationproxy.h>
-#include "RfsFotaPlugin.h"
-
-// Map the interface UIDs to implementation factory functions
-const TImplementationProxy ImplementationTable[] =
-    {
-    IMPLEMENTATION_PROXY_ENTRY(0x10281874,	CRfsFotaPlugin::NewL)
-    };
-
-// Exported proxy for instantiation method resolution
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-    {
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-    }
-
--- a/fotaapplication/fotaserver/FotaRfsPlugin/src/RfsFotaPlugin.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "RfsFotaPlugin.h"
-#include "fotadebug.h"
-
-_LIT(KScriptPath, "");
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// constructor
-// ---------------------------------------------------------------------------
-//
-CRfsFotaPlugin::CRfsFotaPlugin()
-    {
-    FLOG(_L("CRfsFotaPlugin::CRfsFotaPlugin()"));
-    }
-
-// ---------------------------------------------------------------------------
-// constructor
-// ---------------------------------------------------------------------------
-//
-CRfsFotaPlugin::CRfsFotaPlugin(TAny* /*aInitParams*/)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// destructor
-// ---------------------------------------------------------------------------
-//
-CRfsFotaPlugin::~CRfsFotaPlugin()
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::NewL
-// ---------------------------------------------------------------------------
-//
-CRfsFotaPlugin* CRfsFotaPlugin::NewL(TAny* aInitParams)
-    {
-    FLOG(_L("CRfsFotaPlugin::NewL()"));
-    CRfsFotaPlugin* self = new (ELeave) CRfsFotaPlugin(aInitParams);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CRfsFotaPlugin::ConstructL()
-    {
-    FLOG(_L("CRfsFotaPlugin::ConstructL()"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::RestoreFactorySettingsL
-// Handle rfs. Must reserve disk space to keep user from filling it. 
-// ---------------------------------------------------------------------------
-//
-void CRfsFotaPlugin::RestoreFactorySettingsL( const TRfsReason aType )
-    {
-    FLOG(_L("CRfsFotaPlugin::RestoreFactorySettingsL(%d)"), aType);
-
-    if ( aType == ENormalRfs ) 
-        {
-        FLOG(_L(" ERROR - NORMAL RFS (Only FirstBoot RFS is ordered) "));
-        }
-    if ( aType == EDeepRfs   ) 
-        { 
-        FLOG(_L(" ERROR - DEEP   RFS (Only FirstBoot RFS is ordered) "));
-        }
-
-    LoadStoragePluginL ();
-    iStorage->AdjustDummyStorageL () ;
-
-    UnLoadStoragePluginL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::GetScriptL
-// ---------------------------------------------------------------------------
-//
-void CRfsFotaPlugin::GetScriptL( const TRfsReason /*aType*/, TDes& aPath )
-    {
-    FLOG(_L("CRfsFotaPlugin::GetScriptL"));
-    aPath.Copy( KScriptPath);
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::ExecuteCustomCommandL
-// ---------------------------------------------------------------------------
-void CRfsFotaPlugin::ExecuteCustomCommandL( const TRfsReason /*aType*/,
-                                        TDesC& /*aCommand*/ )
-    {
-    FLOG(_L("CRfsFotaPlugin::ExecuteCustomCommandL"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::LoadStoragePluginL 
-// Load update storage plugin via ecom framework.
-// ---------------------------------------------------------------------------
-//
-void CRfsFotaPlugin::LoadStoragePluginL ()
-    {
-    FLOG(_L("CRfsFotaPlugin::LoadStoragePluginL"));
-    if(iStorage)
-        {
-        UnLoadStoragePluginL ();
-        }
-    TUid                if_uid;
-    if_uid.iUid =  (0x10207384);
-    RImplInfoPtrArray   pluginArray;
-    REComSession::ListImplementationsL( if_uid, pluginArray );
-    CleanupClosePushL (pluginArray);
-
-    if( pluginArray.Count() )
-        {
-        for( TInt i = 0; i < pluginArray.Count(); i++ )
-            {
-            CImplementationInformation* info = pluginArray[ i ];
-            TUid id = info->ImplementationUid();
-            delete info;
-            info = NULL;
-            iStorage =(CFotaStorage*) REComSession::CreateImplementationL(
-                                        id , iStorageDtorKey); 
-            }
-        }
-    else
-        {
-        FLOG(_L("  storage plugin not found, ERROR"));
-        User::Leave ( KErrNotFound );
-        }
-    CleanupStack::PopAndDestroy(1); // array 
-    }
-
-
-// ---------------------------------------------------------------------------
-// CRfsFotaPlugin::UnLoadStoragePluginL
-// Unloads storage plugin
-// ---------------------------------------------------------------------------
-//
-void CRfsFotaPlugin::UnLoadStoragePluginL ()
-    {
-    FLOG(_L("CRfsFotaPlugin::UnLoadStoragePluginL"));
-    if(iStorage != NULL) 
-        {
-        delete iStorage;
-        iStorage=0;
-        }
-    REComSession::DestroyedImplementation(iStorageDtorKey); // sets reference count of plugin to 0
-    REComSession::FinalClose();
-    }
-
-// End of file
--- a/fotaapplication/fotaserver/FotaScheduleHandler/group/fotaschedulehandler.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Handles scheduled update, starts fotaserver and request upd
-*
-*/
-
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-//MACRO  _FOTA_DEBUG
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-
-TARGET          	fotaschedulehandler.exe
-TARGETTYPE		EXE
-
-EPOCSTACKSIZE 0x5400
-
-UID 0x100039CE 0x101F99FA
-
-// set vendor id (from defaultcaps.hrh)
-VENDORID VID_DEFAULT
-
-// set dll capability (from defaultcaps.hrh)
-CAPABILITY  CAP_APPLICATION
-
-
-SOURCEPATH ../src
-
-SOURCE				fotaschedulehandler.cpp
-
-USERINCLUDE . 
-USERINCLUDE ../inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY	euser.lib
-LIBRARY	efsrv.lib
-LIBRARY	estor.lib
-LIBRARY	schsvr.lib
-LIBRARY	fotaengine.lib
-LIBRARY	flogger.lib
-
-
--- a/fotaapplication/fotaserver/FotaScheduleHandler/inc/FotaSchedDebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros 
-*
-*/
-
-
-
-#ifndef FOTADEBUG_H
-#define FOTADEBUG_H
-
-    #ifdef _FOTA_DEBUG
-
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fotaschedhandler.log" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-#endif      // FOTADEBUG_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaScheduleHandler/src/fotaschedulehandler.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Handles scheduled update, starts fotaserver and request upd
-*
-*/
-
-
-
-#include <schinfo.h>
-#include <schtask.h>
-#include <s32file.h>
-#include <e32math.h>
-#include <e32cons.h>
-
-#include "FotaSchedDebug.h"
-#include "fotaengine.h"
-#include "../../inc/FotaIPCTypes.h"
-
-// Constants
-
-// -----------------------------------------------------------------------------
-// UpdateFirmwareL
-//
-// -----------------------------------------------------------------------------
-//
-LOCAL_D void UpdateFirmwareL(RFile& aTaskFile)
-	{
-    FLOG(_L("fotaschedulehandler UpdateFirmwareL(RFile& aTaskFile)"));
-    TInt err;
-    CFileStore*         store;
-    RStoreReadStream    instream;
-    // Get tasks from scheduler's store
-    store = CDirectFileStore::FromLC(aTaskFile);
-    instream.OpenLC(*store,store->Root());
-    TInt count = instream.ReadInt32L();
-    FLOG(_L("fotaschedulehandler  task count  %d"),count );
-	for (TInt i=0;i<count;i++)
-        {
-		CScheduledTask* task = CScheduledTask::NewLC(instream);
-        HBufC* b = const_cast<HBufC*>(&(task->Data()));
-        TPtr ptr = b->Des();
-        HBufC8* b8 = HBufC8::NewLC( b->Length() );
-        b8->Des().Copy(ptr);
-        TFotaScheduledUpdate fotareminder(-1,-1);
-        TPckg<TFotaScheduledUpdate>   fotareminderpkg(fotareminder);
-        fotareminderpkg.Copy(b8->Des());
-        CleanupStack::PopAndDestroy( b8 );
-        FLOG(_L("fotaschedulehandler packageid:%d  sched:%d"),fotareminder.iPkgId, fotareminder.iScheduleId);
-        RFotaEngineSession fota;
-        fota.OpenL();
-        CleanupClosePushL( fota );
-        err = fota.ScheduledUpdateL (fotareminder);
-        if(err){} // to remove compiler warning
-        FLOG(_L("fotaschedulehandler       2........ err %d"),err);
-        fota.Close();
-        FLOG(_L("fotaschedulehandler       3 "));
-        CleanupStack::PopAndDestroy( &fota); 
-		CleanupStack::PopAndDestroy(task);
-        }
-	CleanupStack::PopAndDestroy( &instream ); 
-	CleanupStack::PopAndDestroy( store ); 
-	}
-
-
-// -----------------------------------------------------------------------------
-// ExecuteL
-//
-// -----------------------------------------------------------------------------
-//
-LOCAL_D TInt ExecuteL()
-	{
-	TInt err = KErrNoMemory;
-		
-	RFile file;
-		
-	// Adopt the task file from the Task Scheduler
-	err = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(),
-									TScheduledTaskFile::FileHandleIndex());
-    FLOG(_L("  err  %d"),err );
-	User::LeaveIfError(err);
-	
-	TRAP(err, UpdateFirmwareL(file));
-	
-	file.Close();
-	
-	User::LeaveIfError(err);		
-	return err;
-	}
-
-
-// -----------------------------------------------------------------------------
-// Execute
-//
-// -----------------------------------------------------------------------------
-//
-LOCAL_D TInt Execute()
-	{
-    FLOG(_L("fotaschedulehandler Execute()"));
-	TInt err = KErrNoMemory;
-	
-	// construct and install active scheduler
-	CActiveScheduler* scheduler = new CActiveScheduler;
-	if (!scheduler)
-		{
-		return err;
-		}
-	CActiveScheduler::Install(scheduler);
-	CTrapCleanup* cleanupStack = CTrapCleanup::New();
-	if (cleanupStack)
-		{
-        TRAP(err, ExecuteL());
-		delete cleanupStack;
-		}
-    delete scheduler;
-	return err;
-	}
-
-
-// -----------------------------------------------------------------------------
-// E32Main
-//
-// -----------------------------------------------------------------------------
-//
-GLDEF_C TInt E32Main()
-	{
-	return Execute();
-	}
-
-
-
--- a/fotaapplication/fotaserver/FotaServer/data/fotaserver.rss	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-* Copyright (c)  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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Resource file
-*
-*/
-
-
-
-//  RESOURCE IDENTIFIER
-NAME    FOTS // 4 letter ID
-
-
-//  INCLUDES
-#include <bldvariant.hrh>
-#include <eikon.rh>
-#include <uikon.rh>
-#include <avkon.rsg>
-#include <avkon.rh>
-#include <avkon.mbg>
-#include <avkon.hrh>
-#include <AvkonIcons.hrh>
-#include <avkon.loc>
-//#include <CommonDialogs.rh>
-//#include <CommonDialogs.hrh>
-#include <data_caging_paths_strings.hrh>
-#include <fotaserver.loc>
-
-//
-// AIF icons/files
-//
-#include <appinfo.rh>
-
-//  CONSTANTS  
-
-//  RESOURCE DEFINITIONS 
-
-RESOURCE RSS_SIGNATURE { }
-RESOURCE TBUF { buf = "fotaserver"; }
-
-
-RESOURCE EIK_APP_INFO
-	{
-	}
-
-//
-// AIF icons/files
-//
-RESOURCE LOCALISABLE_APP_INFO r_fotaserver_localisable_app_info
-    {
-    short_caption = qtn_fota_title;
-    caption_and_icon = 
-    CAPTION_AND_ICON_INFO
-        {
-        caption = qtn_fota_title;
-
-    #ifdef __SCALABLE_ICONS
-        number_of_icons = 1;
-        icon_file = "Z:\\resource\\apps\\fotaserver_aif.mif";
-    #else
-        number_of_icons = 2;
-        icon_file = "Z:\\resource\\apps\\fotaserver.mbm";
-    #endif  // __SCALABLE_ICONS
-
-        };
-    }
-
-RESOURCE DIALOG r_fotaserver_dl_progress_dialog
-    {
-    flags = EAknProgressNoteFlags;
-    buttons = R_AVKON_SOFTKEYS_CANCEL;
-    items =
-        {
-        DLG_LINE
-            {
-            type = EAknCtNote;
-            id = EAknNoteProgressBar;
-            control = AVKON_NOTE
-                {
-                singular_label= qtn_fota_wait_downloading;
-                layout = EProgressLayout;                            
-                };
-            }
-        };
-    }
-
-RESOURCE DIALOG r_connection_note
-  {
-  flags = EAknProgressNoteFlags;
-  buttons = R_AVKON_SOFTKEYS_CANCEL;
-  items= 
-    {
-    DLG_LINE
-      {
-      type = EAknCtNote;
-      id = EAknNoteProgressBar;
-      control = AVKON_NOTE 
-        {
-        animation = R_QGN_GRAF_WAIT_BAR_ANIM;
-        layout = EProgressLayout;
-        singular_label =  "\n \n";
-        };
-      }
-    };
-  }
-
-
-RESOURCE LISTBOX r_setting_app_listbox
-    {
-    flags = EEikListBoxMultipleSelection;
-    }
-
-RESOURCE AVKON_SETTING_PAGE r_setting_remainder 
-    {
-    label= qtn_fota_reminder_setting;
-    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
-    type =  EAknSetListBox;
-    editor_resource_id= r_setting_app_listbox;
-    }
-
-
-
-////////////////////////////////////////////////////
-//	Strings
-//
-
-STRUCT STRING
-	{
-	LTEXT text;
-	}
-
-RESOURCE TBUF r_apps_fota_updating			{ buf = qtn_fota_wait_installing;}
-RESOURCE TBUF r_apps_fota_restarting		{ buf = qtn_fota_restarting_phone;}
-RESOURCE TBUF r_qtn_dm_title_settings_dialog				{ buf=qtn_apps_dm_title; }
-RESOURCE TBUF r_fota_radio_dialog_1hour_remainder		{ buf=qtn_fota_reminder_1_hour;}
-RESOURCE TBUF r_fota_radio_dialog_4hours_remainder	{ buf=qtn_fota_reminder_4_hours; }
-RESOURCE TBUF r_fota_radio_dialog_1day_remainder		{ buf=qtn_fota_reminder_1_day; }
-RESOURCE TBUF r_fota_radio_dialog_3days_remainder		{ buf=qtn_fota_reminder_3_days; }
-RESOURCE TBUF r_fota_radio_dialog_no_remainder			{ buf=qtn_fota_no_reminder;}
-RESOURCE TBUF r_qtn_fota_reminder_1_minute          { buf=qtn_fota_reminder_1_minute; }    
-RESOURCE TBUF r_qtn_fota_reminder_minutes           { buf=qtn_fota_reminder_minutes ; }
-RESOURCE TBUF r_qtn_fota_reminder_hours             { buf=qtn_fota_reminder_hours ; }
-RESOURCE TBUF r_qtn_fota_reminder_days              { buf=qtn_fota_reminder_days ; }
-RESOURCE TBUF r_fotaserver_decryption_progress_dialog { buf=qtn_fota_decrypting_encrypt_process ; }
-RESOURCE TBUF r_fotaserver_encryption_progress_dialog { buf=qtn_fota_encrypting_encrypt_process ; }
--- a/fotaapplication/fotaserver/FotaServer/data/fotaserver_reg.rss	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c)  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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-#include <appinfo.rh>
-#include <fotaserver.rsg>
-#include "fotaserver_service.rh"
-#include <data_caging_paths_strings.hrh>
-
-UID2 KUidAppRegistrationResourceFile
-UID3 0x102072C4 // Define your application UID here
-
-RESOURCE APP_REGISTRATION_INFO
-    {
-    app_file 			= "fotaserver";
-    localisable_resource_file = APP_RESOURCE_DIR "\\fotaserver";
-    localisable_resource_id = R_FOTASERVER_LOCALISABLE_APP_INFO;
-    hidden					= KAppIsHidden;
-	embeddability			= KAppNotEmbeddable;
-    newfile 				= KAppSupportsNewFile;
-	launch					= KAppLaunchInBackground;
-
-    }
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Project definition file for project fotaserver
-*
-*/
-
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-//MACRO  _FOTA_DEBUG
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-
-#ifdef __SERIES60_30__
-MACRO  ___USE_SYNCML_NOTIFIER_
-#endif
-
-TARGET          fotaserver.exe
-TARGETTYPE      exe
-
-EPOCSTACKSIZE 0x5400
-UID             0x100039CE  0x102072C4
-CAPABILITY      CAP_SERVER NetworkControl PowerMgmt DiskAdmin
-VENDORID        VID_DEFAULT
-
-START RESOURCE ../data/fotaserver.rss
-HEADER
-	TARGETPATH APP_RESOURCE_DIR
-	LANGUAGE_IDS
-END
-
-START RESOURCE ../data/fotaserver_reg.rss
-DEPENDS fotaserver.rsg
-// Do not change the UID below.
-TARGETPATH /private/10003a3f/apps
-END
-
-
-SOURCEPATH  ../src
-
-SOURCE      FotaSrvApp.cpp 
-SOURCE      FotaSrvUi.cpp
-SOURCE      FotaSrvDocument.cpp
-SOURCE      FotaServer.cpp
-SOURCE		fotadownload.cpp
-SOURCE		fotaupdate.cpp
-SOURCE 		fotaSrvSession.cpp
-SOURCE		FotaDB.cpp
-SOURCE		FotaDLProgressDlg.cpp
-SOURCE		FotaReminderDlg.cpp
-SOURCE		FotaNetworkRegStatus.cpp
-SOURCE		DevEncController.cpp
-SOURCE 		DevEncProgressObserver.cpp
-SOURCE 		DevEncProgressDlg.cpp
-
-SOURCEPATH	../../inc
-SOURCE		  FotaIPCTypes.cpp
-USERINCLUDE    ../inc  ../../inc ../../cenrep ../../../inc ../../fmsclient/inc
-
-//help
-SYSTEMINCLUDE   /epoc32/include/cshelp
-SYSTEMINCLUDE   /epoc32/include/ecom
-SYSTEMINCLUDE   /epoc32/include/libc
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY     aknskins.lib
-LIBRARY     apgrfx.lib
-LIBRARY     apparc.lib
-LIBRARY     avkon.lib
-LIBRARY     bafl.lib
-LIBRARY     cone.lib
-LIBRARY     commdb.lib
-LIBRARY     commonengine.lib
-LIBRARY     edbms.lib
-LIBRARY     efsrv.lib
-LIBRARY     eikctl.lib
-LIBRARY     eikcore.lib
-LIBRARY     eikcoctl.lib 
-LIBRARY     eikdlg.lib
-LIBRARY     estor.lib
-LIBRARY     euser.lib
-LIBRARY     featmgr.lib
-LIBRARY     hlplch.lib      //help
-LIBRARY     ws32.lib
-LIBRARY		downloadmgr.lib
-LIBRARY		commonui.lib 		// dochandler
-LIBRARY		apmime.lib			// TDataType
-LIBRARY		syncmlclientapi.lib	//  RSyncMLSession
-LIBRARY     ecom.lib
-LIBRARY		bitgdi.lib			// fbsbitmapdevice
-LIBRARY		fbscli.lib			// fbsbitmap
-LIBRARY		gdi.lib				// TFontSpec
-library		etelmm.lib
-LIBRARY		etel.lib
-LIBRARY		centralrepository.lib
-LIBRARY		esock.lib
-LIBRARy		schsvr.lib 
-LIBRARY			  sysversioninfo.lib //For reading software version
-LIBRARY     nsmldmtreedbclient.lib
-LIBRARY		akncapserverclient.lib // AknUiServer
-LIBRARY		starterclient.lib
-LIBRARY		connmon.lib
-LIBRARY		featmgr.lib
-LIBRARY		fmsclient.lib	//FMS Client
-LIBRARY     	cmmanager.lib 	//Connection Manager
-
-LIBRARY		devenccommonutils.lib
-LIBRARY		aknnotify.lib
-// #ifdef _FOTA_DEBUG
-LIBRARY    flogger.lib
-// #endif
-
--- a/fotaapplication/fotaserver/FotaServer/inc/DevEncController.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   CDevEncController class declaration
-*
-*/
-
-#ifndef __DEVENCCONTROLLER_H__
-#define __DEVENCCONTROLLER_H__
-
-// INCLUDES
-#include <e32base.h>
-#include <DevEncSession.h>
-#include <DevEncConstants.h>
-#include "DevEncProgressDlg.h"
-#define KDevEncUIUid 0x2000259A
-
-//Forward declaration
-class CFotaServer;
-
-
-class CDevEncStarterStarter;
-class CDevEncProgressObserver;
-
-class CDevEncController : public CBase
-    {
-    public:
-        static CDevEncController* NewL( CFotaServer* aCallback );
-        static CDevEncController* NewLC( CFotaServer* aCallback );
-        ~CDevEncController();
-
-    public:
-        TBool NeedToDecryptL(const TDriveNumber &aDrive);
-    
-        void DoStartDecryptionL(const TDriveNumber &aDrive);
-        
-        TBool NeedToEncryptL(TDriveNumber &aDrive);
-        
-        void DoStartEncryptionL(const TDriveNumber &aDrive );
-        
-        void ReportDevEncStartCompleteL(TInt aResult);
-        
-        void ReportDevEncOpnCompleteL(TInt aResult);
-        
-        TInt GetDEOperation();
-        
-    private:
-    // Functions
-        CDevEncController(CFotaServer* aCallback);
-
-        void ConstructL();
-        
-        TBool IsDeviceEncryptionSupportedL();
-        
-        void StartDecryptionL();
-        
-        void StartEncryptionL();
-        
-        TBool CheckBatteryL();
-        
-    // Data
-        CFotaServer* iCallback; // parent
-        
-        CDevEncSession*     iEncMemorySession; // Device Encryption engine session
-
-        CDevEncProgressObserver* iDevEncObserver; //Observer for the encryption/decryption operation
-        
-        TDriveNumber iStorageDrive; //Holds the storage drive id
-        
-        TInt iDevEncOperation; //TOperations values
-        
-    };
-
-#endif //__DEVENCCONTROLLER_H__
-
-// End of file
--- a/fotaapplication/fotaserver/FotaServer/inc/DevEncProgressDlg.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   header file fot CDevEncProgressDlg class
-*
-*/
-
-
-
-#ifndef __DEVENCPROGRESSDLG_H__
-#define __DEVENCPROGRESSDLG_H__
-
-// INCLUDES
-#include <stringresourcereader.h>
-#include <AknGlobalNote.h>
-
-// Set to progress bar, when download starts
-const TInt  KInitialDEProgressFinalValue( 100 );
-
-// FORWARD DECLARATIONS
-class CAknGlobalProgressDialog;
-// CLASS DECLARATION
-
-
-/**
- *  Dialog observer interface
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-class MDEProgressDlgObserver
-    {
-public:
-    
-    /**
-    * Called when the dialog is going to be closed.
-    *
-    * @since S60 v3.1
-    * @param aButtonId    Id of the button, which was used to cancel 
-    *                       the dialog.
-    * @return TBool Can dlg be exited
-    */
-    virtual TBool HandleDEProgressDialogExitL( TInt aButtonId ) = 0;    
-    };
-
-
-/**
- *  Progress dialog for download.
- *
- *  @lib    fotaserver.exe
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS(CDevEncProgressDlg) : public CActive
-    {
-
-public:
-
-    IMPORT_C static CDevEncProgressDlg* NewL(MDEProgressDlgObserver* aObserver, TInt aResource);
-    IMPORT_C static CDevEncProgressDlg* NewLC(MDEProgressDlgObserver* aObserver, TInt aResource);
-
-    virtual ~CDevEncProgressDlg();
-
-
-public: // from base classes
-    
-
-    void ShowProgressDialogL();
-    
-    void UpdateProgressDialogL(TInt aValue, TInt aFinalValue);
-    
-    void ProgressFinished();
-
-private:
-    void ConstructL(TInt aResource);
-    
-    virtual void RunL();
-    
-    virtual void DoCancel();
-    
-    CDevEncProgressDlg(MDEProgressDlgObserver* aObserver);
-
-private: // data
-
-   
-    CAknGlobalProgressDialog* iProgressDialog;
-    
-    HBufC* iStringResource;
-    
-    
-    /**
-     * Progress dialog observer. Not owned.
-     */
-    MDEProgressDlgObserver* iObserver;
-
-    };
-
-#endif // __DEVENCPROGRESSDLG_H__
-
-// End of file
--- a/fotaapplication/fotaserver/FotaServer/inc/DevEncProgressObserver.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   GPRS and Wlan status getter for sending Generic Alerts
-*
-*/
-
-
-
-#ifndef __NFEOBSERVER_H__
-#define __NFEOBSERVER_H__
-
-// SYSTEM INCLUDES
-#include <e32base.h>
-#include "DevEncProgressDlg.h"
-
-//Forward declarations
-class CDevEncController;
-class CDevEncSession;
-class CDevEncProgressDlg;
-//Constants used in this class
-
-const TTimeIntervalMicroSeconds32 KNfeTimeInterval = 500000; //0.5 second, duration between each retry.
-const KProgressComplete = 100; //100 percent
-
-/**
-* Actice object class that runs a timer for probing network status (GPRS & WLAN)
-*  @lib    fotaserver
-*  @since  S60 v3.2
-*/
-NONSHARABLE_CLASS (CDevEncProgressObserver) : public MDEProgressDlgObserver
-	{
-	public:
-		//Symbian 2-Phase construction
-		
-		IMPORT_C static CDevEncProgressObserver* NewL(CDevEncController* aObserver, TInt aResource);
-		IMPORT_C static CDevEncProgressObserver* NewLC(CDevEncController* aObserver, TInt aResource);
-
-       /**
-        * Destructor.
-        */      
-		virtual ~CDevEncProgressObserver();
-
-	public: 
-		/**
-	     * Starts monitoring for Network status before sending Generic Alert
-		 *
-     	 * @since   S60   v5.2
-     	 * @param   None
-     	 * @return  None
-     	 */
-
-		void StartMonitoringL(CDevEncSession* aSession);
-		
-    public: // Functions from base classes
-
-        void CheckProgressL();
-        
-		TBool HandleDEProgressDialogExitL(TInt aButtonId);
-		
-	private: //functions
-		
-		//Constructors
-		
-		CDevEncProgressObserver();
-		CDevEncProgressObserver(CDevEncController* aObserver);
-
-		//Symbian 2-Phase construction 
-		void ConstructL(TInt aResource);
-		
-		TInt GetStatusL();
-		
-	
-	private: // data
-	
-		
-		CDevEncController* iObserver;
-		
-        CDevEncProgressDlg* iProgressDlg;
-		
-        CPeriodic* iPeriodicTimer;
-		
-		//Not owned
-		CDevEncSession*     iEncMemorySession;
-	
-	};
-
-#endif // __NFEOBSERVER_H__
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaDB.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for fotadb
-*
-*/
-
-
-
-
-#ifndef __CFOTADB_H___
-#define __CFOTADB_H___
-
-// INCLUDES
-#include <d32dbms.h>
-#include <fotaengine.h>
-#include "FotaIPCTypes.h"
-
-
-// CONSTANTS
-// see fotaipctypes.h for field descriptions
-_LIT(KDatabaseName,"FotaState");
-
-_LIT(KSelectAll,"SELECT * FROM State" );
-_LIT(KSelect_where_packageid,"SELECT * FROM State WHERE PkgID=%d" );
-_LIT(KCreateTable, "CREATE TABLE State ( Id COUNTER, PkgID INTEGER NOT \
-     NULL, Result INTEGER, State INTEGER NOT NULL, ProfileID INTEGER,\
-	     PkgURL LONG VARCHAR, PkgName CHAR(255),Version CHAR(255), SmlTryCount INTEGER, \
-         SessionType INTEGER, IapId INTEGER, PkgSize UNSIGNED INTEGER, UpdateLtr BIT)");
-_LIT(KAlterTable, "ALTER TABLE State ADD (SessionType INTEGER, IapId INTEGER, PkgSize UNSIGNED INTEGER, UpdateLtr BIT)");
-_LIT(KTblState,     "State");
-
-_LIT(KColPkgId,     "PkgID");
-_LIT(KColResult,    "Result");
-_LIT(KColState,     "State");
-_LIT(KColProfileId, "ProfileID");
-_LIT(KColPkgUrl,    "PkgURL");
-_LIT(KColPkgName,   "PkgName");
-_LIT(KColVersion,   "Version");
-_LIT(KColSmlTryCount, "SmlTryCount");
-_LIT(KColSessionType, "SessionType");
-_LIT(KColIapId, "IapId");
-_LIT(KColPkgSize, "PkgSize");
-_LIT(KColUpdateLtr, "UpdateLtr");
-
-// DATATYPES
-enum TFDBFields
-{
-    EFDBResult      = 0x01,
-    EFDBState       = 0x02,
-    EFDBProfileId   = 0x04,
-    EFDBPkgUrl      = 0x08,
-    EFDBPkgName     = 0x10,
-    EFDBVersion     = 0x20,
-    EFDBSmlTryCount = 0x40,
-    EFDBSessionType = 0x80,
-    EFDBIapId 		= 0x100,
-    EFDBPkgSize 	= 0x200,
-    EFDBUpdateLtr 	= 0x400
-};
-//Number of attributes in fotastate table
-const TUint KNoOfDBFields = 13;
-
-// FORWARD DECLARATION
-class CPackageState;
-
-
-/**
- *  Database class
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS(CFotaDB): public CBase
-    {
-    friend class CPackageState;
-public:
-	CFotaDB();
-
-	virtual ~CFotaDB();
-
-    static CFotaDB* NewL();
-
-    /**
-     * Create database
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  none
-     */
-    void CreateDatabaseL();
-    
-
-    /**
-     * Open database
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  Error code
-     */
-    void OpenDBL();
-
-    /**
-     * Close database and commit changes
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  none
-     */
-    void CloseAndCommitDB();
-
-
-    /**
-     * Checks if DB is open
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  TBool - is database open
-     */
-    TBool IsOpen();
-    
-
-    /**
-     * Add new package state to database
-     *
-     * @since   S60   v3.1
-     * @param   aState      State
-     * @param   aPkgURL     URL
-     * @return  None
-     */    
-    void AddPackageStateL( const TPackageState& aState
-                                ,const TDesC8& aPkgURL );
-
-
-    /**
-     * Get state from db
-     *
-     * @since   S60   v3.1
-     * @param   aPkgId      Package ID
-     * @return  State object
-     */        
-    TPackageState   GetStateL( const TInt aPkgId );
-
-
-    /** Sets state of package specified by packageid. If state doesnt exist,
-     * it is added to db.
-     * @since   S60   v3.1
-     * @param   aState   source data to be set
-     * @param   aPkgURL  URL
-     * @param   aChangedFields  Changed fields. Tells what columns from aState
-     *                          are to be set.
-     * @return  None
-     */
-    void SetStateL( TPackageState& aState
-                        ,const TDesC8& aPkgURL, TUint aChangedFields );
-
-
-    /**
-     * Deletes state from database 
-     *
-     * @since   S60   v3.1
-     * @param   aPkgId      Package ID
-     * @return  Error code
-     */
-    TInt DeleteStateL( const TInt aPkgId);
-
-
-    /**
-     * Gets all states from database
-     *
-     * @since   S60   v3.1
-     * @param   aStates     On return, all  states
-     * @return  Error code
-     */
-    void GetAllL(RArray<TInt>& aStates);
-
-private:
-
-    void ConstructL();
-
-
-    /**
-     * Converts database row to TPackageState
-     *
-     * @since   S60   v3.1
-     * @param  aPkgUrl  URL
-     * @param  aView    Database view. Must be ready&prepared for data 
-     *                  extraction
-     * @return  State
-     */
-	TPackageState RowToStateL(HBufC8*& aPkgUrl,const RDbView& aView);
-
-
-    /**
-     * Inserts TPackageState to database view
-     *
-     * @since   S60   v3.1
-     * @param  aPkg    Source package
-     * @param  aPkgURL Url
-     * @param  aView   Database view. Must be ready&prepared for data writing
-     * @return  None
-     */
-    void StateToRowL (const TPackageState& aPkg, const TDesC8& aPkgURL
-                    ,RDbView& aView);
-    
-    /**
-     * Adds new attributes to fota table for enabling suspend and resume of download. They include - 
-     * DM session type, IAP used during download, total Package size and Update-after-download information.
-     * 
-     * @since   S60   v3.2
-     * @return  None
-     */
-    void AlterTableIfRequiredL();
-    
-    /**
-     * Sets the retry count from the cenrep
-     *
-     * @since   S60   v5.0
-     * @param   package state
-     * @return  None
-     */
-    
-    void SetRetryCount(TPackageState& aState);
-    
-    /**
-     * Determines the char need for db queries
-     *
-     * @since   S60   v5.0
-     * @param   aChangedFields change fields
-     * @param   aState package states
-     * @param   aPkgURL
-     * @return  None
-     */    
-    TInt DetermineCharNeeded(TInt aChangedFields,TPackageState& aState,const TDesC8& aPkgURL);
-
-private:
-
-    /**
-     * File server session
-     */
-    RFs iFSSession;
-
-    
-    /**
-     * Reference to database
-     */
-    RDbNamedDatabase iStateDB;
-
-
-    /**
-     * Columns
-     */
-    CDbColSet* iColSet;
-
-
-    /**
-     * Table
-     */
-    RDbTable iTable;
-
-    /**
-    * Is the db open?
-    */
-    TBool iIsOpen;
-
-    /**
-     * Is fota table alter done?
-     */
-    TBool iTableAltercheck;
-    };
-
-#endif // FOTADB_H
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaDLProgressDlg.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   header file fot CFotaDLProgressDlg class
-*
-*/
-
-
-
-#ifndef CFOTADLPROGRESSDLG_H
-#define CFOTADLPROGRESSDLG_H
-
-// INCLUDES
-#include <AknProgressDialog.h>
-
-// Set to progress bar, when download starts
-const TInt  KInitialProgressFinalValue( 100 );
-
-// Constant to identify the type of progress note displayed at that moment
-enum {
-	EDownloadingNote=0,	//downloading note is shown
-	EConnectingNote		//connecting note is shown
-};
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-
-/**
- *  Dialog observer interface
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-class MDLProgressDlgObserver
-    {
-public:
-    
-    /**
-    * Called when the dialog is going to be closed.
-    *
-    * @since S60 v3.1
-    * @param aButtonId    Id of the button, which was used to cancel 
-    *                       the dialog.
-    * @return TBool Can dlg be exited
-    */
-    virtual TBool HandleDLProgressDialogExitL( TInt aButtonId ) = 0;    
-    };
-
-
-/**
- *  Progress dialog for download.
- *
- *  @lib    fotaserver.exe
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS(CFotaDLProgressDlg) : public CAknProgressDialog
-    {
-
-public:
-
-    /**
-     * Constructor.
-     *
-     * @since S60 v3.1
-     * @param aSelfPtr              Pointer to self
-     * @param aVisibilityDelayOff   Visibility in delay
-     * @param aObserver             Observer
-     * @return None
-     */
-    CFotaDLProgressDlg( CEikDialog** aSelfPtr, TBool aVisibilityDelayOff
-                        , MDLProgressDlgObserver* aObserver, TInt aNoteType);
-
-    virtual ~CFotaDLProgressDlg();
-
-    /**
-     * Offers key event for progress dialog.
-     *
-     * @since S60 v3.1
-     * @param aKeyEvent             Key event
-     * @param aType                 Event type
-     * @return None
-     */
-    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
-
-public: // from base classes
-    
-
-    /**
-     * From CEikDialog, respond to softkey inputs.
-     *
-     * @since S60 v3.1
-     * @para aButtonId, type of pressed Button or Softkey
-     * @return TBool, ETrue if exit the dialog, otherwise EFalse.
-     */
-    TBool OkToExitL( TInt aButtonId );
-
-    /**
-     * Type of note shown or displayed
-     */
-    const TInt iNoteType;
-private: // data
-
-    /**
-     * Progress dialog observer
-     */
-    MDLProgressDlgObserver* iObserver;
-
-    };
-
-#endif //
-
-// End of file
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaNetworkRegStatus.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   GPRS and Wlan status getter for sending Generic Alerts
-*
-*/
-
-
-
-#ifndef __FOTANETWORKREGSTATUS_H__
-#define __FOTANETWORKREGSTATUS_H__
-
-// SYSTEM INCLUDES
-#include <e32base.h>
-#include <rconnmon.h>
-
-//Forward declarations
-class CFotaServer;
-
-//Constants used in this class
-
-const TTimeIntervalMicroSeconds32 KTimeInterval = 1000000; //1 second, duration between each retry.
-const TInt KRetries = 10; //Maximum number of retries.
-
-/**
-* Actice object class that runs a timer for probing network status (GPRS & WLAN)
-*  @lib    fotaserver
-*  @since  S60 v3.2
-*/
-NONSHARABLE_CLASS (CFotaNetworkRegStatus) : public CActive
-	{
-	public:
-		//Symbian 2-Phase construction
-		
-		static CFotaNetworkRegStatus* NewL(CFotaServer* aObserver);
-		static CFotaNetworkRegStatus* NewLC(CFotaServer* aObserver);
-
-       /**
-        * Destructor.
-        */      
-		virtual ~CFotaNetworkRegStatus();
-
-	public: 
-		/**
-	     * Starts monitoring for Network status before sending Generic Alert
-		 *
-     	 * @since   S60   v3.2
-     	 * @param   None
-     	 * @return  None
-     	 */
-
-		void StartMonitoringL();
-		
-		/** 
-	     * Checks whether the network connection possible with the IAP Id provided
-		 *
-     	 * @since   S60   v3.2
-     	 * @param   None
-     	 * @return  ETrue if yes, EFalse when not possible
-     	 */
-		TBool IsConnectionPossibleL(TInt aIapid);
-		
-    public: // Functions from base classes
-		/**
-        * From CActive,DoCancel.
-        */
-		void DoCancel();
-
-		/**
-        * From CActive,RunL.
-        */
-	    void RunL();
-
-		/**
-        * From CActive,RunError.
-        */
-		TInt RunError(TInt aError);
-		
-	private: //functions
-		
-		//Constructors
-		
-		CFotaNetworkRegStatus();
-		CFotaNetworkRegStatus(CFotaServer* aObserver);
-
-		//Symbian 2-Phase construction 
-		void ConstructL();
-		
-		/**
-	     * Checks GlobalRFs status
-		 *
-     	 * @since   S60   v3.2
-     	 * @param   None
-     	 * @return  ETrue if success, EFalse if failure
-     	 */
-		TBool CheckGlobalRFState();
-
-		/**
-	     * Checks Network status, basically Network Registration
-		 *
-     	 * @since   S60   v3.2
-     	 * @param   None
-     	 * @return  ETrue if success, EFalse if failure
-     	 */
-		TBool CheckNetworkRegStateL();
-		
-		
-		/**
-	     * Checks Wlan status
-		 *
-     	 * @since   S60   v3.2
-     	 * @param   None
-     	 * @return  ETrue if success, EFalse if failure
-     	 */
-		TBool IsWlanSupportedL();
-		
-	    /**
-	     * To find the bearer of the IapId
-	     *
-	     * @since   S60   v3.2
-	     * @param   aIapId
-	     * @return  ETrue/EFalse
-	     */
-	    TUint32 FindBearerL(TInt aIapId);
-
-	
-	private: // data
-	
-	    /**
-	     * timer used for monitoring
-	     */
-		RTimer iTimer;
-		
-	    /**
-	     * S60 monitory class used for monitoring network status
-	     */
-		RConnectionMonitor iMonitor;
-	
-	    /**
-	     * FotaServer
-    	 */
-		CFotaServer* iObserver;
-	
-	    /**
-	     * Number of retries
-    	 */
-		TInt iRetriesLeft;
-	
-		
-	    /**
-    	 * GlobalRFs state
-     	 */
-		TBool iGlobalRFState;
-	};
-
-#endif // __FOTANETWORKREGSTATUS_H__
-
-// End of File
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaReminderDlg.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for CFotaReminderDlg
-*
-*/
-
-
-
-#ifndef CFOTAREMINDERDLG_H
-#define CFOTAREMINDERDLG_H
-
-#include <AknCapServerClient.h>
-#include <aknradiobuttonsettingpage.h>
-
-
-class CFotaReminderDlg: public CAknRadioButtonSettingPage
-	{
-	public: //Constructors & destructors
-	
-	/**
-    * Two-phased constructor.
-    */
-	static CFotaReminderDlg* NewLC(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent);
-	static CFotaReminderDlg* NewL(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent);
-	
-	/**
-    * Destructor
-    */	
-	~CFotaReminderDlg();
-	
-	/**
-    * Two-phased constructor.
-    */
-	virtual	void ConstructL();
-	
-	public:	//other methods
-
-	/**
-    * Used to activate the radiobuttonsettingpage.
-    * @param None
-    * @return None
-    */
-	void ActivateL();
-
-	/**
-    * Process events from softkeys
-    * @param aCommandId is the command id
-    * @return None
-    */
-	virtual void ProcessCommandL( TInt aCommandId );
-	
-	/**
-	* This routine routes the keys to the editor.
-	* @param aKeyEvent is the key event
-	* @param aType is the type of key event
-	* @return indicates whether or not the key event was used by this control. 
-	*/
-	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-	
-	private:
-	
-	/**
-	* Constructor
-	*/
-	CFotaReminderDlg(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent);
-    
-    /**
-    * From CEikDialog: Determines if the dialog can be closed.
-    * @param aButtonId Identifier of the button pressed.
-    * @return whether to close the dialog or not.
-    */
-    TBool OkToExitL( TInt aButtonId );
-
-    /**
-    * Suppress the menu/app key when reminder dialog is displayed
-    * @param ETrue to Suppress, else EFalse
-    * @return None
-    */
-	
-	void SuppressAppKey(TBool aValue);
-
-	private:	//data
-	
-    CAknSetStyleListBox* iList;
-    
-	//UI Server used for suppressing the menu/app key
-	RAknUiServer iAppKeyClient;
-	
-	//Stores the user selected item on the radio button page
-	TInt& iSelectedItem;
-	
-	//Stores the key event generated on radio button page
-	TInt& iEvent;
-	
-	//Holds the state of menu/app key supress
-	TBool iIsAppKeySuppressed;
-	};
-
-#endif //CFOTAREMINDERDLG_H
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaServer.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,874 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for CFotaServer
-*
-*/
-
-
-
-#ifndef __FOTASERVER_H__
-#define __FOTASERVER_H__
-
-// INCLUDES
-#include <AknDoc.h>
-#include <aknapp.h>
-#include <AknServerApp.h>
-#include <coemain.h>
-#include <s32file.h>
-#include <DocumentHandler.h>
-#include <apmstd.h>
-#include <e32property.h>
-#include <SyncMLClient.h>
-#include <SyncMLClientDM.h>
-#include <hwrmpowerstatesdkpskeys.h>
-#include <SyncMLNotifier.h>
-#include <SyncMLNotifierParams.h>
-#include <SyncMLObservers.h>
-#include <fotastorage.h>
-#include <starterclient.h>
-
-#include "fotaserverPrivateCRKeys.h"
-
-#include "FotaIPCTypes.h"
-#include "FotaDB.h"
-#include "fotaConst.h"
-#include "fotadownload.h"
-#include "fotaupdate.h" 
-#include "fmsclient.h"	//The FMS Client header file
-
-
-//Forward declarations
-class CDevEncController;
-
-enum TOmaDmLrgObjDl
-{
-    EOmaDmLrgObjDlFail = 1,
-    EOmaDmLrgObjDlExec
-};
-_LIT (KSWversionFile, "swv.txt");
-/** Timeout to let cfotadownloader callstack to empty*/
-const TInt KDownloadFinalizerWaitTime(1000000);
-
-/** Time interval between syncml session retry attempts*/
-const TInt KSyncmlSessionRetryInterval(60000000);
-
-/** shutdown timer */
-const TTimeIntervalMicroSeconds32 KFotaTimeShutDown(10000000);
-
-/** How many times generic alert sending should be tried in row. */
-const TInt KSyncmlAttemptCount = 3;
-
-/** This P&S Key is used to notify DM UI on any download event. key=0 for idle and key=1 for download */ 
-const TUint32 KFotaDownloadState = 0x00000001;
-
-/** If download is active this P&S key is set to ETrue, otherwise EFalse. 
- * The key is owned by omadmappui**/
-const TUint32 KFotaDownloadActive = 0x0000008;
-
-/** The P&S key to say DM UI to perform refresh of UI elements */
-const TUint32 KFotaDMRefresh = 0x00000009;
-
-enum {
-	ENo=0,
-	EYes
-};
-
-//Constants used when update happen NSC/DM 
-enum {
-		EFotaUpdateNSC=1,
-		EFotaUpdateNSCBg,
-		EFotaUpdateDM
-};
-
-_LIT_SECURITY_POLICY_C1( KReadPolicy, ECapabilityReadDeviceData );
-_LIT_SECURITY_POLICY_C1( KWritePolicy, ECapabilityWriteDeviceData );
-
-//Constants for Device Encryption operation
-enum TDEOperations
-    {
-    EIdle = 0,
-    EEncryption,
-    EDecryption,
-    EDecryptionPending
-    };
-// FORWARD CLASS DECLARATION
-
-class CFotaServer;
-class CFotaDownload;
-class CFotaUpdate;
-class CFotaSrvApp;
-class CFotaNetworkRegStatus;
-/**
-* Fota server. Handles client requests. Starts download and/or update.
- *
- *  This class is 
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS( CFotaServer ) : public CAknAppServer, MSyncMLEventObserver
-	{
-    friend class  CFotaSrvSession;
-    friend class  CFotaDownload;
-    friend class  CFotaUpdate;
-
-public:
-
-    /**
-    * C++ default constructor.
-    */
-	CFotaServer();
-    
-    /**
-    * Destructor.
-    */		
-	virtual ~CFotaServer();
-
-public: // New functions
-
-
-    /**
-     * Create database
-     *
-     * @since   S60   v3.1
-     * @param   aLargObj    Is it largeobject download (or dlmgr download)
-     * @param   aPkgId      Packageid of the download
-     * @return  none
-     */
-    void UpdatePackageDownloadCompleteL( TBool aLargObj,const TInt aPkgId);
- 
- 
-    /**
-     * Check s/w version with the current version
-     *
-     * @since   S60   v3.2
-     * @param   none
-     * @return  Bool value(matches or not)
-     */
-     TBool CheckSWVersionL();
-     
-    /**
-     * Start download
-     *
-     * @since   S60   v3.1
-     * @param   aParams     Package state params to be save in db
-     * @param   aPkgURL     URL
-     * @return  none
-     */
-    void DownloadL(TDownloadIPCParams aParams,const TDesC8& aPkgURL);
-
-
-    /**
-     * Start download which finishes with update
-     *
-     * @since   S60   v3.1
-     * @param   aParams     Package state params to be save in db
-     * @param   aPkgURL     URL
-     * @return  none
-     */
-    void DownloadAndUpdateL(TDownloadIPCParams aParams
-            ,const TDesC8& aPkgURL);
-
-
-
-    /**
-     * Start update
-     *
-     * @since   S60   v3.1
-     * @param   aParams     Package state params to be save in db
-     * @return  none
-     */    
-    void UpdateL( const TDownloadIPCParams& aParams );
-
-
-
-    /**
-     * Update, triggered by scheduler
-     *
-     * @since   S60   v3.1
-     * @param   aUpdate     Update details
-     * @return  none
-     */ 
-    void ScheduledUpdateL( TFotaScheduledUpdate aUpdate );
-
-    /**
-     * Delete swupd package
-     *
-     * @since   S60   v3.1
-     * @param   aPkgId  Package id
-     * @return  none
-     */    
-    void DeletePackageL ( const TInt aPkgId);
-
-
-
-    /**
-     * Get state of a swupd package
-     *
-     * @since   S60   v3.1
-     * @param   aPkgId  Package id
-     * @return  Package state
-     */       
-    TPackageState GetStateL( const TInt aPkgId);
-
-
-    /**
-     * Open a store to save swupd into
-     *
-     * @since   S60   v3.1
-     * @param   aMessage    containing client side chunk handle  
-     * @return  None
-     */       
-    void OpenUpdatePackageStoreL ( const RMessage2& aMessage );
-
-    /**
-     * Gets the downloaded and complete size of the update package
-     *
-     * @since   S60   v3.2
-     * @param   aPkgId    Package id
-     * @param	aDownloadedSize		size of download package in bytes
-     * @param	aTotalSize	size of the complete package in bytes
-     * @return  None
-     */       
-    void GetDownloadUpdatePackageSizeL (const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize);
-
-    /**
-     * Tries to resume the download.
-     *
-     * @since   S60   v3.2
-     * @param   aQueryUser	Whether to query user for resume?
-     * @return  None
-     */       
-	void TryResumeDownloadL(TBool aQueryUser);
-
-    /**
-     * Invoke Fota Monitory Service when the download gets suspended
-     *
-     * @since   S60   v3.2
-     * @return  None
-     */       
-	void InvokeFmsL();
-	
-    /**
-     * Cancels any outstanding request for resume notification
-     *
-     * @since   S60   v3.2
-     * @return  None
-     */       
-	void CancelFmsL();
-	
-    /**
-     * Sets the phone's startup reason. This is used by Fota Startup Pluggin to any decision.
-     *
-     * @since   S60   v3.2
-     * @param   aReason		Startup reason, either download interrupted
-     * @return  None
-     */       
-	void SetStartupReason(TInt aReason);
-	
-	/**
-	 * Shutdown DM UI application
-	 * @since	S60	 v3.2
-	 * @return 	None
-	 */
-	void ShutApp();
-	
-	/**
-	 * Stops ongoing download, if any.
-	 * @since	S60	 v3.2
-	 * @param	aReason		Reason for stopping the download.
-	 * @return 	None
-	 */
-	void StopDownload(TInt aReason);
-	
-    /**
-     * Read data from chunk
-     *
-     * @since   S60   v3.1
-     * @param   aSize   Size of data
-     * @param   aError error caught while writing data into FS
-     * @return  none
-     */
-    void ReadChunkL ( const TInt aSize ,TInt aError );
-
-
-    /**
-     * Check if swupd package fits into store
-     *
-     * @since   S60   v3.1
-     * @param   aSize   Size of swupd
-     * @return  Does it fit?
-     */
-    TBool IsPackageStoreSizeAvailableL ( const TInt aSize );
-
-
-    /**
-     * Get ids of present swupd packages
-     *
-     * @since   S60   v3.1
-     * @param   aPackageIdList  On return, ids will be here
-     * @return  None
-     */
-    void  GetUpdatePackageIdsL(TDes16& aPackageIdList);
-
-
-    /**
-     * Get time of last update
-     *
-     * @since   S60   v3.1
-     * @param   aTime       On return, time of last update
-     * @return  None
-     */
-    void GetUpdateTimeStampL (TDes16& aTime) ; 
-
-
-    /**
-     * Set download to be finalized. 
-     *
-     * @since   S60   v3.1
-     * @param   aDLState    Final state of the download
-     * @return  None
-     */
-    void  FinalizeDownloadL( const TPackageState& aDLState );
-
-
-    /**
-     * Set update to be finalized. 
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    void  FinalizeUpdateL();
-
-    /**
-     * Monitors for the battery in case of USB charger
-     *
-     * @since   S60   v3.2.3
-     * @param   aLevel - level of the battery charge to monitor
-     * @return  None
-     */
-    void MonitorBattery(TInt aLevel);
-
-    /**
-     * Finalize download
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    void  DoFinalizeDownloadL();
-
-
-    /**
-     * Finalize Update
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    void  DoFinalizeUpdateL();
-
-
-    /**
-     * Read update result file and report result back to DM server
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    void  DoExecuteResultFileL();
-    
-    /**
-     * Deletes the update result file
-     *
-     * @since   S60   v3.2
-     * @param   None
-     * @return  None
-     */
-    void  DoDeleteUpdateResultFileL();
-
-    /**
-    * Close syncml session
-    *
-    * @since   S60 v3.1
-    * @param none
-    * @return none
-    */
-    void DoCloseSMLSessionL();
-
-    /**
-     * Shutdown fotaserver, if there's no operations in progress (
-     * download,update)
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  Error
-     */
-    TInt TryToShutDownFotaServer();
-
-
-    /**
-     * Get reference to storageplugin. Load it, if not existing
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  Reference to storage
-     */
-    CFotaStorage*   StoragePluginL();
-
-    
-    /**
-     * Do cleanup for package
-     *
-     * @since   S60   v3.1
-     * @param   aPackageID Packageid
-     * @return  None
-     */
-    void GenericAlertSentL( const TInt aPackageID );
-
-
-    /**
-     * Create DM session to DM server (identified by profileid)
-     *
-     * @since   S60   v3.1
-     * @param   aProfileId  DM profile id
-     * @param   aIapid		IAP id. If not kerrnone, will be used instead
-     *						of profiles' IAP id.
-     * @return  none
-     */
-    void CreateDeviceManagementSessionL( TPackageState& aState );
-    
-    
-    /**
-     * Get profiles' data.
-     *
-     * @since   S60   v3.1
-     * @param   aSyncml     syncml session. must be open.
-     * @param   aProf 	    profile id.
-     * @param   aIapid      iapid 
-     * @param   aSrvAA      server alerted action
-     * @param   aUIJob      is current dm job started from ui
-     * @param	aSanVal		the SAN bit set by server for the DM Session
-     * @return  none
-     */    
-    void GetProfileDataL( RSyncMLSession* aSyncml,const TSmlProfileId aProf
-        , TInt& aIapId, TSmlServerAlertedAction& aSrvAA,TBool& aUIJob, TInt& aSanVal);
-
-	/**
-	 * Gets the EikonEnv object
-	 *
-	 * @since S60	v3.1
-	 * @param None
-	 * @return CEikonEnv
-	 */ 
-	CEikonEnv* GetEikEnv();
-
-
-	/**
-	 * Callback function to notify the network status
-	 *
-	 * @since S60	v3.2
-	 * @param Status of network connection
-	 * @return None
-	 */ 
-	void ReportNetworkStatus(TBool status);
-
-
-
-  /**
-	 * Get the software version of the device
-	 * @since S60	v3.2
-	 * @param s/w version 
-	 * @return error
-	 */
-	TInt GetSoftwareVersion(TDes& aVersion);
-	
-	/**
-	 * Incase of large object download failure
-	 * Updates the fota database state & reason information
-	 * @since S60	v3.2
-	 * @param None
-	 * @return None
-	 */
-	void UpdateDBdataL();
-
-    /**
-     * stores the client id who triggered the update
-     * @since S60   v3.2
-     * @param aClient, client Id
-     * @return None
-     */ 	
-	void SetInstallUpdateClientL(TInt aClient);
-	
-	/**
-	 * returns the client id,who triggered the update
-	 * @since S60   v3.2
-	 * @param None
-	 * @return TInt
-	 */ 
-	TInt GetInstallUpdateClientL();	
-	
-	
-	/**
-	 * Checks for IAP Id exists or not in commsdb
-	 * IAPId used for resuming the paused download
-	 * @since S60   v5.0
-	 * @param IapId
-	 * @return ETrue/EFalse
-	 */
-	TBool CheckIapExistsL(TUint32 aIapId);
-	
-    /**
-     * This method is called to check if dencryption needs to be performed.
-     */
-	TBool NeedToDecryptL(const TInt &aPkgId, TDriveNumber &aDrive);
-	
-    /**
-     * This method is called to start the decryption operation.
-     */
-	void DoStartDecryptionL();
-	
-    /**
-     * This method is called once the decryption operation is complete.
-     */
-    void HandleDecryptionCompleteL(TInt aResult, TInt aValue = 0);
-    
-    /**
-     * This method is called to check if encryption needs to be performed.
-     */
-    TBool NeedToEncryptL(TDriveNumber &aDrive);
-    
-    /**
-     * This method is called to start the encryption operation.
-     */
-    void DoStartEncryptionL();
-	
-    /**
-     * This method is called once the encryption operation is complete.
-     */
-	void HandleEncryptionCompleteL(TInt aResult, TInt aValue = 0);
-	
-    /**
-     * Gets the device encryption operation
-     */
-	TInt GetDEOperation();
-	
-    
-    /**
-     * Is server initialized? Must be public for session to use.
-     */
-    TBool iInitialized;
-
-    /**
-    * Whether Fota server should close or not
-    */
-    TBool iNeedToClose;
-    
-    /**
-     * handles notifier completion
-     */
-    CFotaDownloadNotifHandler*  iNotifHandler;
-
-public: // from  base classes
-
-    /**
-     * Creator
-     * Not own
-     */
-    CFotaSrvApp* iParentApp;
-
-    /**
-    * CreateServiceL. Creates session.
-    * @param    aServiceType
-    * @return   CApaAppServiceBase*
-    */
-    CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const;
-    /**
-    * Handle syncml event
-    * @param    aEvent
-    * @param    aIdentifier
-    * @param    aError
-    * @param    aAdditionalData
-    * @return   none
-    */
-    void OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier, TInt aError, TInt aAdditionalData) ;
-
-    /**
-     * Reference to client side chunk.  Swupd comes this way.
-     */
-    RChunk iChunk;
-
-
-    /**
-     * Used for package state saving.
-     */
-    CFotaDB* iDatabase;
-
-
-    /**
-     * Used for downloading.
-     */
-    CFotaDownload* iDownloader;
-
-
-    /**
-     * Used for starting update of fw.
-     */
-    CFotaUpdate* iUpdater;
-
-
-    /**
-     * Used for deleting download.
-     */
-    CPeriodic* iDownloadFinalizer;
-
-
-    /**
-     * Used for deleting update.
-     */
-    CPeriodic*          iUpdateFinalizer;
-
-
-    /**
-     * Used for reading result file.
-     */
-    CPeriodic*          iTimedExecuteResultFile;
-
-
-    /**
-     * Used for closing syncml session
-     */
-    CPeriodic* iTimedSMLSessionClose;
-
-    /**
-     * ConstructL
-     *
-     * @since   S60   v3.1
-     * @param   aFixedServerName    Name of this app server 
-     * @return  none
-     */    
-    virtual void ConstructL(const TDesC &aFixedServerName);
-
-protected: // from base classes
-
-
-    /**
-     * DoConnect. 
-     *
-     * @since   S60   v3.1
-     * @param   aMessage    IPC message
-     * @return  none
-     */
-    void DoConnect(const RMessage2& aMessage);
-
-
-    /**
-     * When last client disconnects, this is called.
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void HandleAllClientsClosed();
-
-    
-private: // new functions
-
-
-    /**
-     * Latter part of constructing. It's ensured that parent fotaserver is 
-     * constructed only once, and child fotaserver is not constructed at all.
-     * Client fotaserver has a task of saving swupd as its only task. It should
-     * not update swupd states.
-     *
-     * @since   S60   v3.1
-     * @param   aMessage    Client process details
-     * @return  none
-     */
-    void ClientAwareConstructL( const RMessage2 &aMessage );
-
-
-    /**
-     * Loads storage plugin if not loaded.
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void            LoadStoragePluginL ();
-
-
-    /**
-     * Unloads storage plugin.
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void            UnLoadStoragePluginL ();
-
-
-
-/**
-	 * Resets the fota state
-	 * @since S60	v3.2
-	 * @param IPC params
-	 * @return None
-	 */
-	 
-	void ResetFotaStateL(const TDownloadIPCParams& aParams);
-	
-	/**
-	 * Starts network monitoring operaiton for defined interval and retries
-	 *
-	 * @since S60	v3.2
-	 * @param None
-	 * @return None
-	 */ 
-	void StartNetworkMonitorL();
-
-
-private: // Data
-
-
-    /**
-     * The state that iDownloader was in, when it called to be finalized.
-     */
-    TPackageState       iDLFinalizeState;
-
-    /**
-     * The state before sending generic alert.
-     */
-    TPackageState		iStoredState;
-
-
-    /**
-     * Storage class (plugin).
-     */
-    CFotaStorage*       iStorage;
-
-
-    /**
-     * Packageid of the swupd being stored. Used only by child fotaserver.
-     */
-    TInt                iStorageDownloadPackageId;
-
-
-    /**
-     * Destructor key of the storage plugin.
-     */
-    TUid                iStorageDtorKey;
-
-
-    /**
-     * Destructor key of the storage plugin.
-     */
-    RWriteStream*       iStorageStream;
-
-
-    /**
-     * File server session
-     */
-    RFs                 iFs;
-
-
-    /**
-     * Tries to periodically shut down fotaserver
-     */
-    CPeriodic*          iAppShutter;
-
-    /**
-     * Syncmlsession for creating dmsession
-     */
-    RSyncMLSession      iSyncMLSession;
-
-    /**
-     * Class that checks for network availability 
-     * 
-     */
-    CFotaNetworkRegStatus* iMonitor;
-
-    /**
-     * How many times to try dm session
-     */
-    TInt    iSyncMLAttempts;
-
-    /**
-     * sync job id
-     */
-    TSmlJobId iSyncJobId;
-
-    /**
-     * profile
-     */
-    TSmlProfileId iSyncProfile;
-
-    /**
-     * Reference to eikonenv. Used by other classes
-     * 
-     */
-    CEikonEnv*	iEikEnv;
-
-    /**
-     * To tell whether Generic Alert sending is being retried or not. This is checked before shutting down fota server
-     * 
-     */
-    TBool iRetryingGASend;
-
-    /**
-     * To tell whether network is available to send Generic Alert.
-     * 
-     */
-    TBool iNetworkAvailable;
-
-    /**
-     * The Fota Monitory Client object
-     */
-    RFMSClient	iFMSClient;
-    
-    /**
-     * For sending GA, this will set to fotastate's iapid
-     */
-    TInt iIapId;
-    /**
-     * Tells the session mode.
-     */
-    TInt iSessMode;
-    
-    /**
-     * Tells about who started resume.
-     */
-    TInt iUserResume;
-    
-    /**
-     * Tells which client triggered install update.
-     */
-    TInt iInstallupdClient;
-    
-    /**
-     * The pointer to encryption controller
-     */
-    CDevEncController *iDEController;
-    
-    /**
-     * Holds the storage drive of the package.
-     */
-    TDriveNumber iStorageDrive;
-    
-	};
-
-#endif 
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaSrvApp.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for CFotaSrvApp
-*
-*/
-
-
-
-
-#ifndef __FOTASRVAPP_H_
-#define __FOTASRVAPP_H_
-
-// INCLUDES
-#include <eikapp.h>
-#include <aknapp.h>
-#include "FotaServer.h"
-#include "FotaSrvUI.h"
-#include "fotaConst.h"
-
-// CLASS DECLARATION
-
-/**
-* Fota server application
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-class CFotaSrvApp : public CAknApplication
-    {
-
-public:
-	CFotaServer* Server();
-
-    CFotaSrvApp();
-
-    virtual ~CFotaSrvApp();
-
-    /**
-     * Show or hide UI
-     *
-     * @since   S60   v3.1
-     * @param   aVisible    Tells whether to hide / show the ui
-     * @return  none
-     */
-    void SetUIVisibleL( const TBool aVisible, const TBool aAlsoFSW=EFalse);
-
-private:
-    /**
-    * From CApaApplication, creates FotaSrvDocument document object.
-    * @since   S60   v3.1
-    * @param    None    
-	* @return A pointer to the created document object.
-	*/
-    CApaDocument* CreateDocumentL();
-    
-    /**
-    * From CApaApplication, returns application's UID (KUidFotaServer).
-    * @since   S60   v3.1
-    * @param    None
-	* @return   The value of KUidFotaServer.
-    */
-    TUid AppDllUid() const;
-    
-    /**
-    * From CApaApplication
-    * @since   S60   v3.1
-    * @param   aAppServer returned server
-	* @return  None
-    */
-    void NewAppServerL( CApaAppServer*& aAppServer );
-
-private:
-
-
-    /**
-     * Fota server.
-     * Own. 
-     */
-    CFotaServer*    iFotaServer;
-
-
-    /**
-     * Document
-     * Own. 
-     */
-    CFotaSrvDocument* iDocument;
-
-    };
-
-#endif
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaSrvDebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros 
-*
-*/
-
-
-
-#ifndef FOTADEBUG_H
-#define FOTADEBUG_H
-
-    // IMPORT_C static TInt Print(TRefByValue<const TDesC> aFmt,...);
-    #ifdef _DEBUG
-    #define _FOTA_DEBUG
-    #endif
-    #ifdef _FOTA_DEBUG
-
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fotaserver.log" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-#endif      // FOTADEBUG_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaSrvDocument.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for CFotaSrvDocument
-*
-*/
-
-
-
-
-#ifndef CFOTASRVDOCUMENT_H
-#define CFOTASRVDOCUMENT_H
-
-// INCLUDES
-#include <aknapp.h>
-#include <AknDoc.h>
-#include <eikenv.h>
-
-// FORWARD DECLARATIONS
-class CEikAppUi;
-class CEikEnv;
-class CNSmlDMSyncProfileList;
-
-// CLASS DECLARATION
-
-/**
- *  CFotaSrvDocument application class.
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-class CFotaSrvDocument : public CAknDocument
-    {
-public: 
-
-    /**
-    * Two-phased constructor.
-    */
-    static CFotaSrvDocument* NewL(CAknApplication& aApp);
-
-    /**
-    * Destructor.
-    */
-    virtual ~CFotaSrvDocument();
-
-public: // New functions
-
-	/**
-	* Getter fo CEikAppUi class
-	* @param    None
-	* @return   Pointer to the CEikAppUi
-	*/
-	CEikAppUi* AppUi() const { return iAppUi; }
-
-private:
-
-
-  	/**
-	* Constructor
-	* @param    aApp Used by akndocument
-	* @return   None
-	*/
-    CFotaSrvDocument( CEikApplication& aApp ): CAknDocument( aApp ) { }
-
-
-    void ConstructL();
-
-
-  	/**
-	* From CEikDocument, create CFotaSrvUi "App UI" object.
-	* @param    None
-	* @return   UI
-	*/
-    CEikAppUi* CreateAppUiL();
-
-    
-private:
-
-    /**
-     * Reference to eikonenv
-     * 
-     */
-	//CEikonEnv*                          iEikEnv;
-    };
-
-#endif
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotaSrvUI.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header file for CFotaSrvUi
-*
-*/
-
-
-
-#ifndef CFOTASRVUI_H
-#define CFOTASRVUI_H
-
-#include <bldvariant.hrh>
-
-// INCLUDES
-#include <eikapp.h>
-#include <eikdoc.h>
-#include <e32std.h>
-#include <coeccntx.h>
-#include <aknappui.h>
-#include <eikdialg.h>
-#include <eikmenup.h>
-#include <aknnavi.h>
-#include <aknnavide.h>
-#include <aknnavilabel.h>
-#include <akntitle.h>
-#include <AknProgressDialog.h>
-
-#include "FotaSrvDocument.h"
-#include "fotaConst.h"
-
-// FORWARD DECLARATIONS
-
-/**
- *  Application UI class 
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-class CFotaSrvUi : public CAknAppUi
-    {
-public: // Constructors and destructor
-
-    void ConstructL();
-
-    virtual ~CFotaSrvUi();
-    
-private: // from base classes
-   
-
-	/**
-    * @param aResourceId        
-	* @param aMenuPane
-    * @return none
-    */
-    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
-
-    /**
-    * From CEikAppUi, takes care of command handling.
-    * @param aCommand id of the  command to be handled
-	* @return None 
-    */
-    void HandleCommandL(TInt aCommand);
-
-
-    /**
-    * From CEikAppUi, handles key events.
-    * @param aKeyEvent  Event to handled.
-    * @param aType   Type of the key event. 
-    * @return Reponse code (EKeyWasConsumed, EKeyWasNotConsumed). 
-    */
-    virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent
-                    , TEventCode aType );
-
-    /**
-    * From CAknAppUi, handles file change.
-    * @param aFileName New file to be opened.
-    * @return None
-    */
-	void OpenFileL( const TDesC& aFileName );
-
-
-    /**
-    * From CAknAppUi, Preparing to close server
-    * @param None
-    * @return None
-    */
-   void PrepareToExit();
-
-private: //Data
-	
-	/**
-	 * Should Fota operation close on an system event (ex. MMC card removal)?
-	 */
-	TBool iNeedToClose;
-
-    };
-
-#endif
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/FotasrvSession.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Represent client's session at serverside
-*
-*/
-
-
-
-#ifndef CFOTASRVSESSION_H
-#define CFOTASRVSESSION_H
-
-// INCLUDES
-#include <eikdoc.h>
-#include <AknServerApp.h>
-#include <fotaengine.h>
-#include "FotaServer.h"
-
-// CLASS DECLARATION
-/**
- *  Fotaserver's session class
- *
- *  @lib    fotaserver.exe
- *  @since  S60 v3.1
- */
-class CFotaSrvSession : public CAknAppServiceBase
-	{
-public:
-
-    enum TClient
-	    {
-        EUnknown = 0,
-        EDMHostServer = 1,
-        EOMADMAppUi = 2,
-        EFotaServer  = 3,
-        EStarter  = 4,
-        EFMSServer = 5,
-        EFotaTestApp = 6,
-	ESoftwareChecker = 7,
-	ESoftwareCheckerBackground = 8
-        };
-
-	CFotaSrvSession( );
-	
-    /**
-	* C++ Destructor
-	*/
-	virtual ~CFotaSrvSession();
-
-    /**
-    * Getter for fotaserver
-    *
-    * @since   S60   v3.1
-    * @param   None
-    * @return  Fotaserver
-    */
-    CFotaServer*    FotaServer() const;
-
-public: // new functions
-
-    /**
-    * Checks client secure id (dmhostserver,fotaserver,fotatester) 
-    *
-    * @since   S60   v3.1
-    * @param   Message containing client details
-    * @return  is it fotaserver
-    */
-    static TClient CheckClientSecureIdL (const RMessage2& aMessage);
-
-protected: // from CSession2
-
-    /**
-    * CreateL
-    *
-    * @since   S60   v3.1
-    * @param   none
-    * @return  None
-    */
-    void CreateL();
-	
-	
-    /**
-    * service client request
-    *
-    * @since   S60   v3.1
-    * @param   aMessage     message containing client request details
-    * @return  None
-    */
-    void ServiceL( const RMessage2& aMessage );
-	
-
-    /**
-    * Handle service error
-    *
-    * @since   S60   v3.1
-	* @param aMessage  Msg that resulted in error
-	* @param aError    Error code
-	* @return None
-	*/
-	void ServiceError( const RMessage2& aMessage, TInt aError );
-
-private:
-     /**
-     * Error caught while writing data into FS
-     */ 
-     TInt iError ;
-
-    /**
-     * document
-     */
-	//CEikDocument*   iDoc;
-	};
-
-
-#endif 
--- a/fotaapplication/fotaserver/FotaServer/inc/fotaUpdateAgentComms.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Update agent result codes
-*
-*/
-
-
-
-
-#ifndef __COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__
-#define __COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__
-
-
-typedef enum
-{
-
-    /*
-        Everything is ok - update package were installed successfully and 
-        newer version of OS is running.
-    */
-	UPD_OK=0,
-    /*
-        Problem: The request sent to update installer were invalid - probable issue in
-        Download agent.
-        
-        Solutions:
-            - Probable: Download agent created an invalid file.
-              Fix download agent.
-            - Inprobable: Corrupted request file, or FAT
-    */
-    UPD_INSTALL_REQUEST_IS_INVALID=1,
-    /*
-        Problem: Update package is absent from specified location.
-
-        Solution: Incorrect user application actions. 
-        Read update application document / manual on how to switch to 
-        update mode.
-    */
-    UPD_UPDATE_PACKAGE_IS_ABSENT=2,
-    /*
-        Problem: Update package is corrupted. (Integrity or authenticity 
-        check failed)
-        Solution: End-user should try to download again update package.
-    */
-	UPD_UPDATE_PACKAGE_IS_CORRUPTED=3,
-    /*
-        Problem: Update package contents is invalid for some reason.
-        This problem normally refers to the fact that update package
-        were created incorrectly.
-    
-        Solution: Contact update package build team in order to find out the 
-        error cause.
-    */
-	UPD_UPDATE_PACKAGE_CONTENTS_IS_INVALID=4,
-    /*
-        Problem: Update package is not compatible with current mobile device.
-        Solution: End-user should try to download again update package.
-    */    
-
-	UPD_UPDATE_PACKAGE_IS_NOT_COMPATIBLE_WITH_CURRENT_MOBILE_DEVICE=5,
-    /*
-        Problem: This error code will be used to indicate fatal error 
-        code after which phone becomes dead.
-    
-        Solution: Phone should be taken to maintenance.
-        This error code cannot be seen by normal mode applications 
-        because OS cannot be started when phone became dead.
-    */
-	UPD_FATAL_ERROR=0xFFFFFFFF
-} InstallationResult;
-
-
-typedef enum
-{
-    UPD_InvalidBlockHeaderIdentifier    =1,
-    UPD_InvalidUpdatePackageVersion     =2,
-    UPD_GenericInvalidFileFormat        =3
-} DetailedInstallationResult;
-
-
-
-#endif //__COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__
--- a/fotaapplication/fotaserver/FotaServer/inc/fotadownload.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,608 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Swupd downloader.
-*
-*/
-
-
-
-#ifndef ___DOWNLOADER_H_
-#define ___DOWNLOADER_H_
-
-#include <DownloadMgrClient.h>
-#include <etelpckt.h> //To read GSM Error codes from symbian
-#include <exterror.h> //To read GSM Error codes from symbian
-#include <wlanerrorcodes.h> //To read WLAN Error codes from s60
-#include <AknWaitDialog.h>
-#include "FotaServer.h"
-#include "FotaSrvDebug.h"
-#include "FotaDLProgressDlg.h"
-
-// FORWARD DECLARATIONS
-class CFotaServer;
-class CAknWaitDialog;
-class CFotaDownloadNotifHandler;
-class CFotaNetworkRegStatus; 	//To know the network connectivity status while resuming suspended download
-// CONSTANTS
- // from coderror.h
-#define KErrCodInvalidDescriptor -1000
-#define KErrCodInsufficientSpace -1001
-#define KErrCodWapConnectionDropped -20041
-
-// If download times out, it must be tried again
-#define KFotaDownloadTimeoutRestartCount 5
-
-// For reading connecting resource from DM UI
-_LIT( KSCPResourceFilename, "\\Resource\\Apps\\NsmlDMSync.rsc" );
-_LIT( KDriveZ,"z:" );
-_LIT( KDDDirPath, "c:\\system\\fota\\" );
-_LIT( KDDFilename, "fotadownload.dd" );
-
-//Constants when SAN Bits are set
-enum {
-		ESanNotSpecified=0,
-		ESanSilent,
-		ESanInformative,
-		ESanInteractive
-};
-
-//Contants when SAN is Off. It refers to Accepted state in DM Profile Settings
-enum {
-	EAcceptedNo=0,
-	EAcceptedYes
-};
-
-// Constants for KSilentOmaDlUIBehavior cenrep key
- enum {
- 		EOmacdOffdlprgOff=0, //OMA CD View = Off, Download Progress Bar = Off
- 		EOmacdOffdlprgOn,    //OMA CD View = Off, Download Progress Bar = On
- 		EOmacdOndlprgOff,    //OMA CD View = On,  Download Progress Bar = Off
- 		EOmacdOndlprgOn,     //OMA CD View = On,  Download Progress Bar = On 
- 		EChooseFromSan		 //Choose behavior from SAN bits set during DM Session
- };
-/**
- *  Downloader 
- *
- *  Starts download and observes it.
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS (CFotaDownload ) 
-        : public CActive 
-        , MHttpDownloadMgrObserver
-        , MDLProgressDlgObserver
-    {
-    friend class CFotaDownloadNotifHandler;
-
-
-	enum TFotaDLProgress
-		{
-		EStarted,
-		EDescriptorDownloaded,
-		ESizeChecked
-		};
-		
-			
-public: // new functions
-
-    CFotaDownload ();
-
-    virtual ~CFotaDownload ();
-
-    static CFotaDownload* NewL (CFotaServer* aServer);
-
-public: // Functions from base classes:
-
-
-    /**
-     * Schedule update to be carried out after download
-     *
-     * @since   S60   v3.1
-     * @param   aButtonId Button pressed
-     * @return  None
-     */
-    TBool HandleDLProgressDialogExitL( TInt aButtonId );
-
-protected:  // Functions from base classes:
-    
-    /**
-     * Handle user action
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    virtual void RunL();
-
-
-     /**
-     * Handle leaving Runl
-     *
-     * @since   S60   v3.1
-     * @param   aError  error code
-     * @return  Error code
-     */
-    virtual TInt RunError(TInt aError);
-
-
-     /**
-     * Handle cancel of active object
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void DoCancel();
-
-public:
-
-
-    /**
-     * Handle Download manager event
-     *
-     * @since   S60   v3.1
-     * @param   aDownload       download 
-     * @param   aEvent          event
-     * @return  none
-     */
-    virtual void HandleDMgrEventL( RHttpDownload& aDownload
-                        , THttpDownloadEvent aEvent );
-
-
-    /**
-     * Handle Download manager event
-     *
-     * @since   S60   v3.1
-     * @param   aDownload       download 
-     * @param   aEvent          event
-     * @return  none
-     */
-    void DoHandleDMgrEventL( RHttpDownload* aDownload
-                        ,THttpDownloadEvent aEvent );
-
-
-    /**
-     * Start download of swupd
-     *
-     * @since   S60   v3.1
-     * @param   aParams     download parameters
-     * @param   aPkgURL     Url of swupd
-     * @param   aUpdateAfterDownload     Is update needed
-     * @param   aIapid      Iap
-     * @param   aRestartDownload Is this a retry download (counter)? 
-     *                            If yes, don't show descriptor.
-     * @return  none
-     */
-    void DownloadL(TDownloadIPCParams aParams,const TDesC8& aPkgURL
-        ,TBool aUpdateAfterDownload,const TInt aIapid=KErrNotFound
-        ,const TInt aRestartDownload=0 );
-
-
-    /**
-     * Cancel
-     *
-     * @since   S60   v3.1
-     * @param   aCancelProgressBar  Cancel progress bar also?
-     * @return  none
-     */
-    void CancelDownload( const TBool aCancelProgressBar );
-
-    /**
-     * Tries to resume any suspended fota download by quering the user. When the DM session is
-     * Silent, this method directly starts resuming of download by calling ResumeDownloadL.
-     *
-     * @since   S60   v3.2
-     * @param   aUserInitiated  Is user initiated resume?
-     * @return  none
-     */
-    void TryResumeDownloadL(TBool aUserInitiated);
-    
-    /**
-     * Resumes any suspended fota download. Firstly, it retrieves the RHttpDownload download object from Download Manager
-     * and then performs the following - 
-     * - sets the IAP ID to use
-     * - checks whether the connection is possible with that IAP ID
-     * - sets download ui behavior
-     *
-     * @since   S60   v3.2
-     * @return  none
-     */
-    void ResumeDownloadL();
-    /**
-     * Finds whether the download is resumable or not.
-     *
-     * @since   S60   v3.2
-     * @return  ETrue if download is resumable, else EFalse.
-     */
-    TBool IsDownloadResumable();
-    
-    /**
-     * Finds whether Fota Monitory Service is enabled or not.
-     *
-     * @since   S60   v3.2
-     * @return  ETrue if FMS is enabled, else EFalse.
-     */
-	TBool IsFMSEnabled();
-	
-    /**
-     * Sets the download activity state to the P&S Key used to sync with DM UI.
-     *
-     * @since   S60   v3.2
-     * @param	aValue	ETrue when download is active, else EFalse.
-     * @return  None
-     */
-	void SetDownloadActive(TBool aValue);
-	
-    /**
-     * Returns the download activity state
-     *
-     * @since   S60   v3.2
-     * @return	aValue	ETrue when download is active, else EFalse.
-     */
-
-	TBool IsDownloadActive();
-
-    /**
-     * Starts to suspend the ongoing download
-     *
-     * @since   S60   v3.2
-     * @param	aReason		Reason to suspend the download. Value is one of RFotaEngineSession::TResult.
-     * @param	aSilent		Is suspend operation to be silent?
-     * @return  None
-     */
-	void RunDownloadSuspendL(const TInt aReason, TBool aSilent=EFalse);
-		
-    /**
-     * Starts to cancel the ongoing download
-     *
-     * @since   S60   v3.2
-     * @param	aReason		Reason to cancel the download. Value is one of RFotaEngineSession::TResult.
-     * @param	aSilent		Is cancel operation to be silent?
-     * @return  None
-     */
-	void RunDownloadCancelL(const TInt aReason, TBool aSilent=EFalse);
-	
-    /**
-     * Should update be started after download completes
-     */
-    TBool iUpdateAfterDownload;
-
-    /**
-     * Download is to be restarted. (counter)
-     */
-    TInt iRestartCounter;
-    
-    /**
-     * Download state
-     */
-    TPackageState iDLState;
-
-
-    /**
-    * Download URL 
-    */
-    HBufC8* iUrl;
-
-
-  
-
-private:
-
-
-    /**
-     * Launch notifier. Also used to end download silently.
-     *
-     * @since   S60   v3.1
-     * @param   aNotetype    Notetype
-     * @param   aIntParam    int param
-     * @param   aMemoryneeded How much disk space needed for download
-     * @param   aFinishOnly  finish only, do not launch notifier
-     * @return  none
-     */
-    
-    void LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype
-                            ,const TInt aIntParam
-                            ,const TInt aMemoryNeeded
-                            ,TBool aFinishOnly=EFalse );
-
-    /**
-     * Reads the download variations from the Cenrep keys into instance variables.
-     * They include - Fota Suspend & Resume feature state (on/off) &
-     * Fota Monitory Service feature state (on/off)
-     * 
-     * @since   S60   v3.2
-     * @return  none
-     */
-	void CheckDownloadVariations();
-
-    /**
-     * Retrieves the RHttpDownload object from Download Manager for the suspended download.
-     * Since concurrent downloads are not possible, there will be always zero or one suspended download.
-     * 
-     * @since   S60   v3.2
-     * @return  RHttpDownload object. If NULL, it means that there is no suspended download or the retrieval has fails.
-     */
-	RHttpDownload* RetrieveDownloadL();
-	
-    /**
-     * Sets the IAP Id to use during download. The same API is used for fresh or resuming download.
-     * During resuming of download, the selection of IAP logic varies as below:
-     * 1. If IAP is always ask in DM profile, uses the earlier set during FMS trigger
-	 * 2. If IAP is always ask in DM profile, query user for IAP during user trigger
-	 * 3. If IAP has changed in DM profile after suspend, use the newer one during resume
-     * 
-     * @since   S60   v3.2
-     * @param	aParams		contains the download operation details
-     * @param	aIapid		Out param, the IAP Id is set here.
-     * @return  None
-     */
-	void SetIapToUseL(TPackageState aParams,const TInt aIapid);
-	
-    /**
-     * Sets the Download UI behavior for fresh or resuming download.
-     * 
-     * @since   S60   v3.2
-     * @param	aFreshDL	ETrue if the download is fresh, else EFalse.
-     * @return  None
-     */
-	void SetDownloadUiBehavior(TBool aFreshDL);
-	
-    /**
-     * Creates a fresh download
-     *
-     * @since   S60   v3.1
-     * @param   
-     * @return  none
-     */
-    void CreateDownloadL();
-	  /**
-     * SetDLResultdlErrorId Set the appropriate error codes.
-     *
-     * @since   S60   v5.0
-     * @param   adlErrorId  error id from DlMgr
-     * @param   asysErrorId error id from system
-     * @return  none
-     */   
-    void SetDLResultdlErrorId( THttpDownloadMgrError adlErrorId, TInt32 asysErrorId);
-    
-    /**
-     * ReSetDownloadL Reset the Fota state to Download failed
-     *
-     * @since   S60   v5.0
-     * @param   atoresetdl Bool value if ETrue the set the state to Download Failed
-     * @return  none
-     */   
-    void ReSetDownloadL(TBool atoresetdl);
-    
-    /**
-     * DetermineUISANOFF Determine UI behavior when SAN is OFF
-     *
-     * @since   S60   v5.0
-     * @param   aBehavior behavior depending upon whether SAN is supported or not
-     * @return  none
-     */    
-    void DetermineUISANOFF(TInt aBehavior);
-    
-     /**
-     * DetermineUISANOFF Determine UI behavior when SAN is OFF
-     *
-     * @since   S60   v5.0
-     * @param   aBehavior behavior depending upon whether SAN is supported or not
-     * @return  none
-     */
-    void DetermineUISANON(TInt aBehavior);
-    /**
-     * Reference to fotaserver.
-     * Not own
-     */
-    CFotaServer*            iFotaServer;
-
-    /**
-     * Reference to download mgr.
-     */
-    RHttpDownloadMgr        iDownloadMgr;
-
-    /**
-     * The download object for the current download.
-     */
-    RHttpDownload* iDownload;
-    
-    /**
-     * The downloaded content size in bytes.
-     */
-    TInt	iDownloadedContentSize;
-
-    /**
-     * Download progress dialog.
-     */
-    CFotaDLProgressDlg*     iDLProgressDlg;
-
-    /**
-     * Content size received in previous event
-     */
-    TInt                    iPreviousContentSize;
-
-    /**
-     * handles notifier completion
-     */
-	CFotaDownloadNotifHandler*  iNotifHandler;
-
-    
-    /**
-	* Indicates that this download should be reset. (could be inclded in progress)
-    */
-    TBool iDLNeedsReset;
-    
-    /**
-	* Progress state.
-    */
-    TFotaDLProgress iDLProgress;
-    
-    /**
-     * Showing OMA Content Descriptor
-     */
-    TBool iShowOMACDUI;
-
-    /**
-     * Showing Progress bar
-     */
-    TBool iShowDLPrgUI;
-    
-    /**
-     * Is download resumable?
-     */
-	TBool iDownloadResumable;
-	
-	/**
-	 * Is Fota Monitory service enabled?
-	 */
-	TBool iFMSEnabled;
-	
-	/**
-	 * Is Fota download active?
-	 */
-	TBool iDownloadActive;
-    /**
-     * Iap id to be used in download
-     */
-	TInt	iIapid;
-	
-	/**
-	 * Is download fresh?
-	 */
-	TBool iFreshDL;
-	
-	/**
-	 * Is user initiated resume?
-	 */
-	TBool iUserInitiatedResume;
-	
-	/**
-	 * Is fota operation started by user?
-	 */
-	TBool iIsjobStartedFromUI;
-	
-	/**
-	 * Value of SAN bit set by the remote Server
-	 */
-	TInt iSanValue;
-	
-	/**
-	 * Is suspend/cancel of download operation to be silent?
-	 */
-	TBool 	iSilentOpn;
-	
-	/**
-	 * to check whether downlaod is finalized or not 
-	 */
-	 TBool iDownloadFinalized;
-	 /**
-     * Class that checks for network availability 
-     */
-    CFotaNetworkRegStatus* iMonitor;
-
-    };
-
-
-
-
-
-NONSHARABLE_CLASS ( CFotaDownloadNotifHandler ) 
-        : public CActive 
-    {
-public: // new functions
-    static CFotaDownloadNotifHandler* NewL (CFotaDownload* aDownload);
-    
-    CFotaDownloadNotifHandler();
-    
-    ~CFotaDownloadNotifHandler();
-    /**
-     * Handle user action
-     *
-     * @since   S60   v3.1
-     * @param   None
-     * @return  None
-     */
-    virtual void RunL();
-
-
-     /**
-     * Handle leaving Runl
-     *
-     * @since   S60   v3.1
-     * @param   aError  error code
-     * @return  Error code
-     */
-    virtual TInt RunError(TInt aError);
-
-
-     /**
-     * Handle cancel of active object
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void DoCancel();
-
-     /**
-     * Shows notifier and/or ends download
-     *
-     * @since   S60   v3.1
-     * @param   aNotetype	type of the note as defined in syncmlnotifier
-     * @param   aIntParam  Generic parameter, defined in syncmlnotifier
-     * @param   aMemoryNeeded	Amount of disk space needed. Only one notifier
-	 *							type consumes this.
-     * @param   aFinishOnly		Do not show notifier, finish download only
-     * @return  none
-     */
-    void LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype
-                            ,const TInt aIntParam
-                            ,const TInt aMemoryNeeded
-                            ,TBool aFinishOnly=EFalse );
-
-     /**
-     * Is any notifier displayed?
-     *
-     * @since   S60   v3.2
-     * @param   none
-     * @return  ETrue if yes, otherwise EFalse
-     */
-    TBool IsOpen();
-private:
-
-	CFotaDownload* iDownload;
-
-    /**
-     * Notifier for showing notes
-     */
-    RNotifier               iNotifier;
-
-    /**
-     * Notifier input parameters
-     */
-    TSyncMLFwUpdNotifParams     iNotifParams;
-
-    /**
-     * Notifier response 
-     */
-    TSyncMLFwUpdNotifRetValPckg  iDummyResponsePckg;
-    
-
-    };
-
-
-
-#endif
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaServer/inc/fotaserverPrivatePSKeys.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   	PS keys for fotaserver
-*
-*/
-
-
-
-#ifndef FOTASERVER_PRIVATE_PSKEYS_H
-#define FOTASERVER_PRIVATE_PSKEYS_H
-
-// CONSTANTS
-
-// Reading the current or ongoing NSML Job Id from DM UI
-const TUint32 KNsmlCurrentJobId = 0x00000001;
-
-// Reading the Server Alert UI Mode Key
-const TUint32 KNsmlSanUIMode = 0x00000004;
-
-// Reading the OMA DM large object download status
-const TUint32 KFotaLrgObjDl = 0x00000005;
-
-// Reading the Server profile id used for OMA DM large object download
-const TUint32 KFotaLrgObjProfileId = 0x00000006;
-
-//PubSub key used to mark which application is handling the process of download
-//Sets by DM UI, NSC or NSCBackground
-const TUint32 KNSmlCurrentFotaUpdateAppName = 0x0000000A;
-
-//PubSub key used to define should "Install Now?" query be shown or not
-//Sets by DM UI or NSC
-const TUint32 KDevManShowInstallNowQuery = 0x0000000B;
-
-//Reading the DM Job status/error used for OMA DM large object download
-const TUint32  KDmJobCancel = 0x00000012; 
-
-#endif // FOTASERVER_PRIVATE_PSKEYS_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/inc/fotaserver_service.rh	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-STRUCT FOTASERVICE_STRUCT
-	{
-	LONG type = 0;
-	}
-
--- a/fotaapplication/fotaserver/FotaServer/inc/fotaupdate.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,404 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Header for updater active object
-*
-*/
-
-
-
-#ifndef __UPDATER_H___
-#define __UPDATER_H___
-
-// INCLUDES
-#include <etelmm.h>
-#include <mmtsy_names.h> // for etel
-#include <bautils.h>
-#include <schinfo.h>
-
-#include "FotaServer.h"
-#include "fotaUpdateAgentComms.h"
-#include "fotaengine.h"
-
-// CONSTANTS
-_LIT (KUpdateResultFile, "update.resp");
-_LIT (KUpdateRequestFile, "update.req");
-_LIT (KUpdateBitmap ,"installing.bmp");
-_LIT (KRestartingBitmap ,"restarting.bmp");
-_LIT (KUpdateTimeStampFileName, "updatetimestamp");
-_LIT8 (KSwupdPath8, "c:\\private\\102072C4\\");
-_LIT8 (KSwupdFileExt8, ".swupd");
-_LIT(KDefaultSched, "1h:4h:1d:3d");  
-_LIT(Ksep,";");  
-
-// FORWARD  DECLARATIONS
-class CFotaServer;
-class CFotaUpdate;
-
-// CLASS DECLARATION
-
-
-
-/**
- *  Update related activities
- *
- *  @lib    fotaserver
- *  @since  S60 v3.1
- */
-NONSHARABLE_CLASS( CFotaUpdate ): public CActive 
-    {
-public:
-
-    static CFotaUpdate* NewL (CFotaServer* aServer);
-
-    virtual ~CFotaUpdate ();
-
-
-    /**
-     * Start update
-     *
-     * @since   S60   v3.1
-     * @param   aParams         details
-     * @return  none
-     */
-    void StartUpdateL( const TDownloadIPCParams &aParams );
-
-
-    /**
-     * Update. boot.
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    void UpdateL();
-
-
-    /**
-     * Check update result written update agent. Is it there?
-     *
-     * @since   S60   v3.1
-     * @param   aRfs
-     * @return  is it there
-     */
-    static TBool CheckUpdateResults( RFs& aRfs );
-
-
-
-    /**
-     * Delete update result file
-     *
-     * @since   S60   v3.1
-     * @param   aRfs
-     * @return  none
-     */
-    static void DeleteUpdateResultFileL( RFs& aRfs );
-
-
-
-    /**
-     * Execute update result file. That is, read result code. Send it to srv.
-     *
-     * @since   S60   v3.1
-     * @param   aRfs
-     * @return  none
-     */
-    void ExecuteUpdateResultFileL( RFs& aRfs );
-    
-    /**
-     * Checks the FOTA Install update note variation     
-     * @since   S60   v3.2
-     * @param   None
-     * @return  TBool, ETrue / EFalse
-     */
-    TBool CheckUpdateVariations();
-
-    /**
-     * HandleUpdateAcceptStartL handle the update process when the user pressed Now
-     *
-     * @since   S60   v5.0
-     * @param   None
-     * @return  None
-     */
-    void HandleUpdateAcceptStartL(TBool aSkipBatteryChk = EFalse);
-    
-    /**
-     * This method handles any update related error.
-     *
-     * @since   S60   v5.2
-     * @param   the error code and value if applicable
-     * @return  None, can leave with system wide error.
-     */
-    void HandleUpdateErrorL(TInt aError, TInt aValue = 0);
-    
-    /**
-     * This method handles any encryption related error.
-     *
-     * @since   S60   v5.2
-     * @param   the error code
-     * @return  None, can leave with system wide error.
-     */
-    void HandleEncryptionErrorL(TInt aError);
-
-
-protected: // from base classes
-
-
-    /**
-     * Hanlde notifier clicking
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */    
-    virtual void RunL();
-
-
-    /**
-     * Cancel outstanding reqeust
-     *
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */    
-    void DoCancel();
-
-
-    /**
-     * Handle leaving runl
-     *
-     * @since   S60   v3.1
-     * @param   aError  error
-     * @return  none
-     */
-    virtual TInt RunError(TInt aError);
-    /**
-     * Enum for Interval type of scheduling
-     *
-     * @since   S60   v3.2
-     */   
-    enum TUpdateIntervalType
-	{
-	/** The interval is based on hours. */
-	EHourly,
-	/** The interval is based on days. */
-	EDaily,
-	/** The interval is based on months. */
-    EMonthly,
-	/** The interval is based on years. */
-	EYearly,
-    /**Show the No reminder             */  
-	ENoReminderOn,
-	/**Show the No reminder             */   
-    ENoReminderOff
-	};
-
-private:
-
-    CFotaUpdate ();
-
-    /**
-     * Check if there's enough battery power to update
-     *
-     * @since   S60   v3.1
-     * @param   aUSBCharger
-     * @return  TBool is there enough battery
-     */
-    TBool CheckBatteryL(TBool aUSBCharger);
-        
-    /**
-     * HandleUpdateAcceptLaterL handle the update process when the user pressed Later
-     *
-     * @since   S60   v5.0
-     * @param   None
-     * @return  None
-     */
-    void HandleUpdateAcceptLaterL();
-    
-    /**
-     * HandleErrorBasedonChargingTypeL handle the error based on chrager type 
-     *
-     * @since   S60   v5.0
-     * @param   None
-     * @return  None
-     */
-    void HandleErrorBasedonChargingTypeL();
-    
-    /**
-     * SetUpdateFailedStatesL Set the state to update failed
-     *
-     * @since   S60   v5.0
-     * @param   None
-     * @return  None
-     */
-    void SetUpdateFailedStatesL();
-    
-    /**
-     * GetSchedulesInfoL Get the schedule info of FOTA update
-     *
-     * @since   S60   v5.0
-     * @param   None
-     * @return  None
-     */
-    void GetSchedulesInfoL();
-
-
-    /**
-     * Launch notifier for user to interact with
-     *
-     * @since   S60   v3.1
-     * @param   aNotetype
-     * @param   aIntparam
-     * @return  none
-     */
-    void LaunchNotifierL(  const TSyncMLFwUpdNoteTypes aNotetype , const TInt aIntParam, const TInt aEnc=EFalse );
-
-	/**
-	 * Prepare and display Reminder Dialog using RFotaReminderDlg
-	 * on radio button setting page
-	 * @since 	S60	  v3.1
-	 * @param None
-	 * @return none
-	 */
-	void ShowReminderDialogL();
-	
-	/**
-	 * Create the Schedule 
-	 * @since 	S60	  v3.1
-	 *
-	 * @param package id 
-	 * @param interval type
-	 * @param interval
-	 * @return TInt 
-	 */
-    TInt CreateScheduleL ( const TInt aPackageId
-            ,const TIntervalType aIntervalType,const TInt aInterval);
-            
-            
-  /**
-	 * Create the new Schedule 
-	 * @since 	S60	  v3.1
-	 *
-	 * @param package id 
-	 * @param aRet
-	 * @param aRadioSelectionIndex
-	 * @return None
-	 */
-
-    void CreateNewScheduleL(TInt aRet, TInt aRadioSelectionIndex);
-    
-  /**
-	 * Fins the schedule or deletes it 
-	 * @since 	S60	  v3.1
-	 *
-	 * @param aDelete if true the delete the schedule 
-	 * @return TScheduleEntryInfo2
-	 */
-    TScheduleEntryInfo2 FindScheduleL ( const TBool aDelete );
-    /**  
-	 * Parse the schedule string from Cenrep
-	 * @since 	S60	  v3.2
-	 * @param None
-	 * @return none
-	 */
-    void ParseScheduleStringL();
-
-public:
-
-
-	/**
-	* Creates the Array of radio buttons and returns to the caller
-	*/
-	CDesCArray* CreateRadionButtonArrayLC(const TScheduleEntryInfo2 aScEntry,TInt& aSelectionIndex);
-
-private:
-
-    /**
-     * State of the update package. For convenience.
-     */
-    TPackageState iUpdateState;
-
-
-    /**
-     * reference to fotaserver.
-     * Not own
-     */
-    CFotaServer*    iFotaServer;
-
-
-    /**
-     * Notifier
-     */
-    RNotifier       iNotifier;
-
-
-   
-   /**
-     * Interval Type  
-     */
-    
-    RArray<TInt>  iIntervalType; 
-    
-    /**
-     * Interval  
-     */
-     RArray<TInt>  iInterval;
-    /**
-     * Notifier params
-     */
-    TSyncMLFwUpdNotifParams     iNotifParams;
-
-
-
-    /**
-     * NOtifier response
-     */    
-    TSyncMLFwUpdNotifRetValPckg  iDummyResponsePckg;
-
-    
-    /**
-     * file server session
-     * not own
-     */
-    RFs*            iFs; 
-    
-    /**
-     * scheduled  times
-     */
-    TBuf<255> iscInfo;
-	
-	/** 
-	* fota update reminder task
-	*/
-	TFotaScheduledUpdate* iScheduledUpdate;
-
-	/*
-	 * flag to handle showing the reminder dialog twice.
-	 */
-	TBool iHandleUpdateAcceptLater;
-	
-    /*
-     * tells the battery charge to monitor for.
-     */
-	TInt iChargeToMonitor;
-	
-	/*
-	 * to finalize update later
-	 */
-	TBool iFinalizeLater;
-    };
-
-
-
-
-#endif // __UPDATER_H___
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaServer/loc/fotaserver.loc	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* Copyright (c) 2002 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Localisation file. 
-*
-*/
-
-
-
-
-// l: param specified in Series_60_3_0_QVGA_Portrait_Application_LAF_Document_1.0.pdf
-
-//d:-----------------------------------------------------------
-//d:APPLICATION TITLES
-//d:-----------------------------------------------------------
-
-//d:Title of the application on the title pane
-//l:title_pane_t2/opt9
-//w:
-//r:3.1
-#define qtn_fota_title			"Download"
-
-//d:Updating progress bar
-//l:popup_note_wait_window
-//w:
-//r:3.1
-#define qtn_fota_wait_downloading	 "Downloading"
-
-//d:Updating progress bar
-//l:popup_note_wait_window
-//w:
-//r:3.1
-#define qtn_fota_wait_installing  "Updating..."
-
-//d:restarting note after updating
-//l:popup_note_window
-//w:
-//r:3.1
-#define qtn_fota_restarting_phone  "Restarting phone"
-
-
-//d:radio button item to display 1 hour
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_1_hour   	"1 hour"
-
-//d:radio button item to display 4 hour
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_4_hours 	"4 hours"
-
-//d:radio button item to display 1 day
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_1_day  	"1 day"
-
-//d:radio button item to display 3 days
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_3_days 	"3 days"
-
-//d:radio button item to display no remainder
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_no_reminder    	"No reminder"
-
-//d:Title of the radio button setting page on the title pane
-//l:title_pane_t2/opt9
-//w:
-//r:3.2
-#define qtn_apps_dm_title           "Device Manager"
-
-
-//d:Title of the radio button setting page, placed on control itself
-//l:list_setting_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_setting		"Remind after"
-
-
-//d:radio button item to display 1 minute
-//l:list_set_graphic_pane_t1
-//w:
-//r:5.0
-#define qtn_fota_reminder_1_minute 	"1 minute"
-
-//d:radio button item to display %N minutes
-//l:list_set_graphic_pane_t1
-//w:
-//r:5.0
-#define qtn_fota_reminder_minutes 	"%N minutes"
-
-//d:radio button item to display %N hours
-//l:list_set_graphic_pane_t1
-//w:
-//r:5.0
-#define qtn_fota_reminder_hours 	"%N hours"
-
-//d:radio button item to display %N days
-//l:list_set_graphic_pane_t1
-//w:
-//r:5.0
-#define qtn_fota_reminder_days 	"%N days"
-
-//d:Progress bar shown during decryption operation
-//l:popup_note_wait_window
-//w:
-//r:5.2
-#define qtn_fota_decrypting_encrypt_process "Decrypting"
-
-//d:Progress bar shown during encryption operation
-//l:popup_note_wait_window
-//w:
-//r:5.2
-#define qtn_fota_encrypting_encrypt_process "Encrypting"
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/src/DevEncController.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   CDevEncController definitions Part of ES System Application
-*
-*/
-
-#include <apgcli.h> // for RApaLsSession
-#include <apacmdln.h> // for CApaCommandLine
-#include <centralrepository.h>
-#include <featmgr.h> // for checking DE feature
-#include "DevEncController.h"
-#include "FotaServer.h"
-#include "FotaSrvDebug.h"
-#include "DevEncSession.h"
-#include <DevEncEngineConstants.h>
-#include "DevEncProgressObserver.h"
-#include <fotaserver.rsg>
-#include <DevEncProtectedPSKey.h>
-#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
-
-// ================= MEMBER FUNCTIONS =======================
-//
-// ----------------------------------------------------------
-// CDevEncController::NewL
-// Instancies CDevEncController object
-// ----------------------------------------------------------
-//
-CDevEncController* CDevEncController::NewL(CFotaServer* aCallback )
-    {
-    FLOG(_L("CDevEncController::NewL >>"));
-
-    CDevEncController* self = CDevEncController::NewLC(aCallback);
-    CleanupStack::Pop();
-
-    FLOG(_L("CDevEncController::NewL <<"));
-    return self;
-    }
-
-
-// ----------------------------------------------------------
-// CDevEncController::NewL
-// Instancies CDevEncController object
-// ----------------------------------------------------------
-//
-CDevEncController* CDevEncController::NewLC(CFotaServer* aCallback )
-    {
-    FLOG(_L("CDevEncController::NewLC >>"));
-
-    CDevEncController* self = new ( ELeave ) CDevEncController(aCallback);
-    CleanupStack::PushL ( self );
-    self->ConstructL();
-
-    FLOG(_L("CDevEncController::NewC <<"));
-    return self;
-    }
-
-// ----------------------------------------------------------
-// CDevEncController::ConstructL()
-// Initializes data objects
-// ----------------------------------------------------------
-//
-void CDevEncController::ConstructL()
-    {
-    FLOG(_L("CDevEncController::ConstructL >>"));
-
-    if (!IsDeviceEncryptionSupportedL())
-        {
-        FLOG(_L("Device doesn't support encryption!!"));
-        User::Leave(KErrNotSupported);
-        }
-    FLOG(_L("CDevEncController::ConstructL <<"));
-    }
-
-
-TBool CDevEncController::IsDeviceEncryptionSupportedL()
-    {
-    FLOG(_L("CDevEncController::IsDeviceEncryptionSupportedL >>"));
-
-    TBool ret(EFalse);
-
-    FeatureManager::InitializeLibL();
-    ret = FeatureManager::FeatureSupported( KFeatureIdFfDeviceEncryptionFeature);
-    FeatureManager::UnInitializeLib();
-
-    FLOG(_L("CDevEncController::IsDeviceEncryptionSupportedL, ret = %d <<"), ret);
-    return ret;
-    }
-// ----------------------------------------------------------
-// CDevEncController::CDevEncController()
-// Constructor
-// ----------------------------------------------------------
-//
-CDevEncController::CDevEncController(CFotaServer* aCallback): iCallback (aCallback),
-iEncMemorySession(NULL),
-iDevEncObserver (NULL),
-iDevEncOperation(EIdle)
-        {
-
-        }
-
-// ----------------------------------------------------------
-// CDevEncController::CDevEncController()
-// Destructor
-// ----------------------------------------------------------
-//
-CDevEncController::~CDevEncController()
-    {
-    FLOG(_L("CDevEncController::~CDevEncController >>"));
-
-    if (iEncMemorySession)
-        {
-        iEncMemorySession->Close();
-        delete iEncMemorySession;
-        iEncMemorySession = NULL;
-        }
-
-    if (iDevEncObserver)
-        {
-        delete iDevEncObserver;
-        iDevEncObserver = NULL;
-        }
-
-    FLOG(_L("CDevEncController::~CDevEncController <<"));
-    }
-
-TBool CDevEncController::NeedToDecryptL(const TDriveNumber &aDrive)
-    {
-    FLOG(_L("CDevEncController::NeedToDecryptL, drive = %d >>"), (TInt) aDrive);
-
-    TBool ret (EFalse);
-    TInt err (KErrNone);
-    TInt status (KErrNone);
-
-    TInt deoperation (EOpIdle);  
-
-    RProperty::Get(KDevEncProtectedUid, KDevEncOperationKey, deoperation );
-
-    if (deoperation != EOpIdle)
-        {
-        FLOG(_L("Some disk operation is ongoing. Hence Fota is not possible."));
-        User::Leave(KErrNotReady);
-        }
-
-    if (!iEncMemorySession)
-        iEncMemorySession = new (ELeave) CDevEncSession( aDrive );
-
-    err = iEncMemorySession->Connect();
-    if (err != KErrNone)
-        {
-        FLOG(_L("Error in connecting to devencdisk session = %d"), err);
-        User::Leave(err);
-        }
-
-    err = iEncMemorySession->DiskStatus(status);
-
-    if (!err && (status == EEncrypted || status == EEncrypting))
-        {
-        FLOG(_L("Drive %d is encrypted"), (TInt) aDrive);
-        ret = ETrue;
-        }
-    else
-        {
-        CRepository *centrep = CRepository::NewL( KCRUidFotaServer );
-        err = centrep->Set(  KDriveToEncrypt, KErrNotFound );
-        delete centrep; centrep = NULL;
-        }
-
-#if defined(__WINS__)
-    ret = ETrue;
-#endif
-
-    iEncMemorySession->Close();
-    delete iEncMemorySession; iEncMemorySession = NULL;
-
-    FLOG(_L("CDevEncController::NeedToDecrypt, ret = %d <<"), ret);
-    return ret;
-    }
-
-void CDevEncController::DoStartDecryptionL(const TDriveNumber &aDrive)
-    {
-    FLOG(_L("CDevEncController::DoStartDecryptionL >>"));
-
-    TInt deoperation (EOpIdle);  
-
-    RProperty::Get(KDevEncProtectedUid, KDevEncOperationKey, deoperation );
-
-    if (deoperation != EOpIdle)
-        {
-        FLOG(_L("Some disk operation is ongoing. Hence Fota is not possible."));
-        User::Leave(KErrNotReady);
-        }
-
-    iDevEncOperation = EDecryption;
-    iStorageDrive = aDrive;
-
-
-    StartDecryptionL();
-
-    FLOG(_L("CDevEncController::DoStartDecryptionL <<"));
-    }
-
-
-void CDevEncController::StartDecryptionL()
-    {
-    FLOG(_L("CDevEncController::StartDecryptionL >>"));
-
-    TInt status (KErrNone);
-
-    if (!iEncMemorySession)
-        iEncMemorySession = new (ELeave) CDevEncSession( iStorageDrive );
-
-    __LEAVE_IF_ERROR(iEncMemorySession->Connect());
-
-    __LEAVE_IF_ERROR(iEncMemorySession->DiskStatus(status));
-
-    FLOG(_L("Status = %d"), status);
-
-    if (status == EEncrypted)
-        {
-        if (CheckBatteryL())
-            {
-            FLOG(_L("Started decryption of drive %d..."), iStorageDrive);
-
-            if (!iDevEncObserver)
-                iDevEncObserver = CDevEncProgressObserver::NewL(this, R_FOTASERVER_DECRYPTION_PROGRESS_DIALOG);
-
-            __LEAVE_IF_ERROR(iEncMemorySession->StartDiskDecrypt());
-
-            FLOG(_L("Monitor for completion of the decryption operation..."));
-
-            iDevEncObserver->StartMonitoringL(iEncMemorySession);
-            }
-        else
-            {
-            FLOG(_L("Battery low for performing decryption!"));
-
-            iDevEncOperation = EIdle;
-            iEncMemorySession->Close();
-            delete iEncMemorySession;  iEncMemorySession = NULL;
-
-            iCallback->HandleDecryptionCompleteL(KErrBadPower, EBatteryLevelLevel4);
-            }
-        }
-    else if(status == EDecrypted)
-        {
-        FLOG(_L("Device is already decrypted"));
-
-        iDevEncOperation = EIdle;
-        iEncMemorySession->Close();
-        delete iEncMemorySession;  iEncMemorySession = NULL;
-
-        iCallback->HandleDecryptionCompleteL(KErrNone);
-        }
-    else
-        {
-        // status is either unmounted, encrypting, decrypting, wiping or corrupted
-        FLOG(_L("Can't proceed as disk status is %d"), status);
-
-        iDevEncOperation = EIdle;
-        iEncMemorySession->Close();
-        delete iEncMemorySession;  iEncMemorySession = NULL;
-
-        iCallback->HandleDecryptionCompleteL(KErrNotReady);
-        }
-
-    FLOG(_L("CDevEncController::StartDecryptionL <<"));
-    }
-
-void CDevEncController::ReportDevEncOpnCompleteL(TInt aResult)
-    {
-    FLOG(_L("CDevEncController::ReportDevEncOpnCompleteL, result = %d >>"), aResult);
-
-    TInt err (KErrNone);
-
-    if (iEncMemorySession)
-        {
-        iEncMemorySession->Close();
-        delete iEncMemorySession;  iEncMemorySession = NULL;
-        }
-
-    CRepository *centrep = CRepository::NewL( KCRUidFotaServer );
-
-    if (iDevEncOperation == EDecryption)
-        {
-        err = centrep->Set(  KDriveToEncrypt, iStorageDrive );
-        if (err != KErrNone)
-            {
-            FLOG(_L("Setting drive to encrypt as %d after firmware update, error = %d"), (TInt) iStorageDrive, err);
-            }
-        }
-    else if (iDevEncOperation == EEncryption)
-        {
-        err = centrep->Set(  KDriveToEncrypt, KErrNotFound );
-        if (err != KErrNone)
-            {
-            FLOG(_L("Setting no drive, error = %d"), err);
-            }
-        }
-    delete centrep; centrep = NULL;
-
-    if (iDevEncOperation == EDecryption)
-        {
-        FLOG(_L("Starting update..."));
-        iCallback->HandleDecryptionCompleteL(KErrNone);
-        iDevEncOperation = EIdle;
-        }
-    else if (iDevEncOperation == EEncryption)
-        {
-        FLOG(_L("Encryption ended"));
-        iCallback->HandleEncryptionCompleteL(KErrNone);
-        iDevEncOperation = EIdle;
-        }
-    else
-        {
-        //should not land here!
-        }
-
-    FLOG(_L("CDevEncController::ReportDevEncOpnCompleteL <<"));
-    }
-
-TBool CDevEncController::NeedToEncryptL(TDriveNumber &aDrive)
-    {
-    FLOG(_L("CDevEncController::NeedToEncryptL >> "));
-    TBool ret (EFalse);
-
-    CRepository *centrep = CRepository::NewL( KCRUidFotaServer );
-    TInt drive (KErrNotFound);
-    TInt err = centrep->Get(  KDriveToEncrypt, drive );
-    if (drive != KErrNotFound)
-        {
-        aDrive = (TDriveNumber) drive;
-        ret = ETrue;
-        }
-
-    delete centrep; centrep = NULL;
-
-    FLOG(_L("CDevEncController::NeedToEncryptL, ret = %d, err = %d << "), ret, err);
-    return ret;
-    }
-
-void CDevEncController::DoStartEncryptionL(const TDriveNumber &aDrive)
-    {
-    FLOG(_L("CDevEncController::DoStartEncryptionL, drive = %d >>"), (TInt) aDrive);
-
-    iDevEncOperation = EEncryption;
-    iStorageDrive = aDrive;
-    StartEncryptionL();
-
-    FLOG(_L("CDevEncController::DoStartEncryptionL <<"));
-    }
-
-void CDevEncController::StartEncryptionL()
-    {
-    FLOG(_L("CDevEncController::StartEncryptionL >>"));
-
-    TInt status (KErrNone);
-
-    if (!iEncMemorySession)
-        iEncMemorySession = new (ELeave) CDevEncSession( iStorageDrive );
-
-    __LEAVE_IF_ERROR(iEncMemorySession->Connect());
-
-    __LEAVE_IF_ERROR(iEncMemorySession->DiskStatus(status));
-
-    FLOG(_L("Status = %d"), status);
-
-    if (status == EDecrypted)
-        {
-        FLOG(_L("Started encryption of drive %d..."), iStorageDrive);
-
-        if (CheckBatteryL())
-            {
-            if (!iDevEncObserver)
-                iDevEncObserver = CDevEncProgressObserver::NewL(this, R_FOTASERVER_ENCRYPTION_PROGRESS_DIALOG);
-
-            __LEAVE_IF_ERROR(iEncMemorySession->StartDiskEncrypt());
-
-            FLOG(_L("Monitor for completion of the decryption operation..."));
-
-            iDevEncObserver->StartMonitoringL(iEncMemorySession);
-            }
-        else
-            {
-            FLOG(_L("Battery low for performing encryption!"));
-
-            iDevEncOperation = EIdle;
-            iEncMemorySession->Close();
-            delete iEncMemorySession;  iEncMemorySession = NULL;
-
-            iCallback->HandleEncryptionCompleteL(KErrBadPower);
-            }
-        }
-    else if (status == EEncrypted)
-        {
-        FLOG(_L("Memory is already encrypted"));
-
-        iDevEncOperation = EIdle;
-        iEncMemorySession->Close();
-        delete iEncMemorySession;  iEncMemorySession = NULL;
-
-        iCallback->HandleEncryptionCompleteL(KErrNone);
-        }
-    else
-        {
-        //status is either encrypting, decrypting, wiping, corrupted
-        FLOG(_L("Can't proceed as disk status is %d"), status);
-
-        iDevEncOperation = EIdle;
-        iEncMemorySession->Close();
-        delete iEncMemorySession;  iEncMemorySession = NULL;
-
-        iCallback->HandleEncryptionCompleteL(KErrNotReady);
-        }
-    FLOG(_L("CDevEncController::StartEncryptionL <<"));
-    }
-
-TBool CDevEncController::CheckBatteryL()
-    {
-    FLOG(_L("CDevEncController::CheckBatteryL >>"));
-#ifdef __WINS__
-
-    // In the emulator, the battery level is always 0 and the charger is never
-    // connected, so just return ETrue.
-    return ETrue;
-
-#else // __WINS__
-
-    // Running on target. Check the real battery and charger status
-
-    TInt chargingstatus( EChargingStatusError );
-    TInt batterylevel( 1 );
-    TBool enoughPower( EFalse );
-
-    // Read battery
-    FLOG( _L("CDevEncUiEncryptionOperator::CheckBatteryL" ));
-    RProperty pw;
-    User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
-    User::LeaveIfError( pw.Get( batterylevel ) );
-    pw.Close();
-
-    User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMChargingStatus ) );
-    User::LeaveIfError( pw.Get( chargingstatus ));
-    pw.Close();
-
-    // Too low battery, power insufficient
-    if ( batterylevel >= EBatteryLevelLevel4 )
-        {
-        enoughPower = ETrue;
-        }
-    // But charger is connected, power sufficient
-    if ( ( chargingstatus != EChargingStatusError ) &&
-            ( chargingstatus != EChargingStatusNotConnected ) )
-        {
-        enoughPower = ETrue;
-        }
-
-    FLOG( _L("Battery level: %d  (0..7), chargingstatus %d"),
-            batterylevel, chargingstatus );
-    FLOG( _L("CDevEncController::CheckBatteryL, ret=%d <<"), ( enoughPower ? 1 : 0 ) );
-    return enoughPower;
-
-#endif // __WINS__
-    }
-
-TInt CDevEncController::GetDEOperation()
-    {
-    return iDevEncOperation;
-    }
-
-// End of file
-
--- a/fotaapplication/fotaserver/FotaServer/src/DevEncProgressDlg.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Progress dlg for download
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "DevEncProgressDlg.h"
-#include <AknGlobalProgressDialog.h>
-#include <StringLoader.h>
-#include <stringresourcereader.h>
-#include <avkon.rsg>
-#include "FotaSrvDebug.h"
-
-// ========================= MEMBER FUNCTIONS ================================
-EXPORT_C CDevEncProgressDlg* CDevEncProgressDlg::NewL(MDEProgressDlgObserver* aObserver, TInt aResource)
-    {
-    FLOG(_L("CDevEncProgressDlg::NewL >>"));
-    
-    CDevEncProgressDlg* self = CDevEncProgressDlg::NewLC(aObserver, aResource);
-    CleanupStack::Pop();
-    
-    FLOG(_L("CDevEncProgressDlg::NewL <<"));
-    return self;
-    }
-
-EXPORT_C CDevEncProgressDlg* CDevEncProgressDlg::NewLC(MDEProgressDlgObserver* aObserver, TInt aResource)
-    {
-    FLOG(_L("CDevEncProgressDlg::NewLC >>"));
-    
-    CDevEncProgressDlg* self = new (ELeave) CDevEncProgressDlg(aObserver);
-    CleanupStack::PushL(self);
-    
-    self->ConstructL(aResource);
-    
-    FLOG(_L("CDevEncProgressDlg::NewL <<"));
-    return self;    
-    }
-
-void CDevEncProgressDlg::ConstructL(TInt aResource)
-    {
-    FLOG(_L("CDevEncProgressDlg::ConstructL >>"));
-    
-    iProgressDialog = CAknGlobalProgressDialog::NewL();
-    iStringResource = StringLoader::LoadL(aResource);
-    
-    FLOG(_L("CDevEncProgressDlg::ConstructL <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CDevEncProgressDlg::CDevEncProgressDlg
-// ---------------------------------------------------------------------------
-CDevEncProgressDlg::CDevEncProgressDlg(MDEProgressDlgObserver* aObserver) : CActive(EPriorityMore),
-                                                                            iProgressDialog (NULL),
-                                                                            iStringResource (NULL),
-                                                                            iObserver (aObserver)
-    {
-    CActiveScheduler::Add(this);
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-CDevEncProgressDlg::~CDevEncProgressDlg()
-    {
-    FLOG(_L("CDevEncProgressDlg::~CDevEncProgressDlg >>"));
-    
-    Cancel();
-    
-    delete iProgressDialog; iProgressDialog = NULL;
-    
-    delete iStringResource; iStringResource = NULL;
-    
-    iObserver = NULL;
-    
-    FLOG(_L("CDevEncProgressDlg::~CDevEncProgressDlg <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CDevEncProgressDlg::OkToExitL
-// Called by framework when the Softkey is pressed.
-// ---------------------------------------------------------------------------
-//
-void CDevEncProgressDlg::DoCancel()
-    {
-    FLOG(_L("CDevEncProgressDlg::DoCancel >>"));
-    
-    if (iProgressDialog)
-        {
-        iProgressDialog->CancelProgressDialog();
-        }
-    
-    FLOG(_L("CDevEncProgressDlg::DoCancel <<"));
-    }
-
-void CDevEncProgressDlg::RunL()
-    {
-    FLOG(_L("CDevEncProgressDlg::RunL >>"));
-    
-    if (iObserver)
-        {
-        iObserver->HandleDEProgressDialogExitL(iStatus.Int());
-        }
-    FLOG(_L("CDevEncProgressDlg::RunL <<"));
-    }
-
-void CDevEncProgressDlg::ShowProgressDialogL()
-    {
-    FLOG(_L("CDevEncProgressDlg::ShowProgressDialogL >>"));
-    
-    iProgressDialog->ShowProgressDialogL(iStatus,iStringResource->Des(),R_AVKON_SOFTKEYS_EMPTY);
-    FLOG(_L("Step...1"));
-    
-    SetActive();
-    FLOG(_L("Step...2"));
-    FLOG(_L("CDevEncProgressDlg::ShowProgressDialogL <<"));
-    }
-
-
-void CDevEncProgressDlg::UpdateProgressDialogL(TInt aValue, TInt aFinalValue)
-    {
-    FLOG(_L("CDevEncProgressDlg::UpdateProgressDialogL, value = %d >>"), aValue);
-    
-    iProgressDialog->UpdateProgressDialog(aValue, aFinalValue);
-    
-    FLOG(_L("CDevEncProgressDlg::UpdateProgressDialogL <<"));
-    }
-
-void CDevEncProgressDlg::ProgressFinished()
-    {
-    FLOG(_L("CDevEncProgressDlg::ProgressFinished >>"));
-   
-    iProgressDialog->ProcessFinished();
-    
-    FLOG(_L("CDevEncProgressDlg::ProgressFinished <<"));
-    }
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/src/DevEncProgressObserver.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2005 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"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:   
- *
- */
-
-
-
-// INCLUDE FILES
-
-//User Includes
-
-#include "DevEncProgressObserver.h"
-#include "DevEncController.h"
-#include "DevEncProgressDlg.h"
-#include "FotaSrvDebug.h"
-#include <eikprogi.h>
-#include <fotaConst.h>
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::NewL
-// Symbian 2-Phase construction, NewL used for creating object of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-EXPORT_C CDevEncProgressObserver* CDevEncProgressObserver::NewL(CDevEncController* aObserver, TInt aResource)
-    {
-    CDevEncProgressObserver* self = CDevEncProgressObserver::NewLC(aObserver, aResource);
-    CleanupStack::Pop(self);
-    return self;	
-    }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::NewLC
-// Symbian 2-Phase construction, NewLC used for creating object of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-EXPORT_C CDevEncProgressObserver* CDevEncProgressObserver::NewLC(CDevEncController* aObserver, TInt aResource)
-    {
-    CDevEncProgressObserver* self = new (ELeave) CDevEncProgressObserver (aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL(aResource);
-
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::ConstructL
-// Symbian 2-Phase construction, ConstructL used for constructing the members of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-void CDevEncProgressObserver::ConstructL(TInt aResource)
-    {
-    FLOG(_L("CDevEncProgressObserver::ConstructL >>"));
-    
-    iProgressDlg = CDevEncProgressDlg::NewL(this, aResource);
-    
-    FLOG(_L("CDevEncProgressObserver::ConstructL <<"));
-    }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::CDevEncProgressObserver
-// C++ Constructor
-// This method shouldn't leave
-// -----------------------------------------------------------------------------
-
-CDevEncProgressObserver::CDevEncProgressObserver(CDevEncController* aObserver) : 
-iObserver(aObserver), iProgressDlg (NULL), iPeriodicTimer(NULL), iEncMemorySession (NULL)
-            {
-
-            }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::~CDevEncProgressObserver
-// C++ Desctructor
-// This method shouldn't leave
-// -----------------------------------------------------------------------------
-
-CDevEncProgressObserver::~CDevEncProgressObserver()
-    {
-    FLOG(_L("CDevEncProgressObserver::~CDevEncProgressObserver >>"));
-
-    iEncMemorySession = NULL;
-
-    if (iPeriodicTimer)
-        {
-        FLOG(_L("1..........."));
-        iPeriodicTimer->Cancel();
-        FLOG(_L("2..........."));
-        delete iPeriodicTimer;
-        iPeriodicTimer = NULL;
-        }
-
-    if (iProgressDlg)
-        {
-        iProgressDlg->ProgressFinished();
-        delete iProgressDlg;
-        iProgressDlg = NULL;
-        }
-
-    FLOG(_L("CDevEncProgressObserver::~CDevEncProgressObserver <<"));
-    }
-
-static TInt StaticTimerExpiry(TAny *aPtr)
-    {
-    FLOG(_L("CDevEncProgressObserver StaticTimerExpiry() >>"));
-
-    CDevEncProgressObserver* obj = (CDevEncProgressObserver*) aPtr;
-    TRAPD( err,  obj->CheckProgressL());
-    FLOG(_L("ERROR =  %d"),err);
-    
-    FLOG(_L("CDevEncProgressObserver StaticTimerExpiry() <<"));
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::StartMonitoringL
-// Monitors for connection status
-// This method don't leave
-// -----------------------------------------------------------------------------
-
-void CDevEncProgressObserver::StartMonitoringL(CDevEncSession* aSession)
-    {
-    FLOG(_L("CDevEncProgressObserver::StartMonitoringL >>"));
-
-    __ASSERT_ALWAYS( aSession, User::Panic(KFotaPanic, KErrArgument) );
-    
-    iEncMemorySession = aSession;
-    iProgressDlg->ShowProgressDialogL();
-
-    iPeriodicTimer = CPeriodic::NewL (EPriorityMore) ;
-    iPeriodicTimer->Start (
-            TTimeIntervalMicroSeconds32(KNfeTimeInterval)
-            ,TTimeIntervalMicroSeconds32(KNfeTimeInterval)
-            ,TCallBack(StaticTimerExpiry,this) );
-
-    FLOG(_L("CDevEncProgressObserver::StartMonitoringL <<"));
-    }
-
-// -----------------------------------------------------------------------------
-// CDevEncProgressObserver::RunL()
-// Called when event accomplished
-// -----------------------------------------------------------------------------
-//
-void CDevEncProgressObserver::CheckProgressL()
-    {
-    FLOG(_L("CDevEncProgressObserver::CheckProgressL >>"));
-
-    TInt progress = GetStatusL();
-    FLOG(_L("NFE Progress = %d"),progress);
-    if (progress != KProgressComplete)
-        {
-        iProgressDlg->UpdateProgressDialogL(progress, 100);
-        FLOG(_L("nfe progress = %d"), progress);
-        }
-    else
-        {
-        FLOG(_L("nfe progress complete"));
-
-        if (iPeriodicTimer && iPeriodicTimer->IsActive())
-            {
-            iPeriodicTimer->Cancel();
-            }
-
-        iProgressDlg->UpdateProgressDialogL(progress, 100);
-        iProgressDlg->ProgressFinished();
-
-        delete iProgressDlg; iProgressDlg = NULL;
-
-        iObserver->ReportDevEncOpnCompleteL(KErrNone);
-        }
-    FLOG(_L("CDevEncProgressObserver::CheckProgressL <<"));
-    }
-
-
-
-
-TInt CDevEncProgressObserver::GetStatusL()
-    {
-    FLOG(_L("CDevEncProgressObserver::GetStatus >>"));
-    TInt ret (0);
-    User::LeaveIfError(iEncMemorySession->Progress(ret));
-
-    FLOG(_L("CDevEncProgressObserver::GetStatus << progress = %d"), ret);
-    return ret;
-    }
-
-TBool CDevEncProgressObserver::HandleDEProgressDialogExitL(TInt aButtonId)
-    {
-    //Do nothing
-    return ETrue;
-    }
-// End of File 
--- a/fotaapplication/fotaserver/FotaServer/src/FotaDB.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,640 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Fota package state preservation 
-*
-*/
-
-
-
-#include "FotaDB.h"
-#include "FotaSrvDebug.h"
-#include <centralrepository.h>
-#include "fotaserverPrivateCRKeys.h"
-
-#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
-
-// ====================== MEMBER FUNCTIONS ===================================
-
-// ---------------------------------------------------------------------------
-// CFotaDB::CFotaDB()
-// ---------------------------------------------------------------------------
-CFotaDB::CFotaDB() : iIsOpen( EFalse )
-	,iTableAltercheck(ETrue)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDB::~CFotaDB()
-// ---------------------------------------------------------------------------
-CFotaDB::~CFotaDB()
-    {
-    //Delete columns set
-    if (iColSet)
-    	{
-    	delete iColSet;
-    	iColSet = NULL;
-    	}
-    //Close table
-   	iTable.Close();
-   	
-   	//Close database
-   	iStateDB.Close();
-   	
-   	//Close file server session
-    if (iFSSession.Handle())
-    	iFSSession.Close();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::NewL()
-// ---------------------------------------------------------------------------
-CFotaDB* CFotaDB::NewL()
-    { 
-    CFotaDB* self=new(ELeave) CFotaDB();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::ConstructL()
-// ---------------------------------------------------------------------------
-void CFotaDB::ConstructL()
-    {
-    TInt err;
-    TBuf<KMaxPath>    tmp;
-    User::LeaveIfError( iFSSession.Connect() );
-    err = iFSSession.CreatePrivatePath( EDriveC );
-    if ( err != KErrNone && err != KErrAlreadyExists ) User::Leave( err );
-    User::LeaveIfError( iFSSession.SetSessionToPrivate( EDriveC ) );
-    User::LeaveIfError( iFSSession.SessionPath (tmp) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::CreateDatabaseL()
-// Creates db in private dir of fotaserver
-// ---------------------------------------------------------------------------
-void CFotaDB::CreateDatabaseL()
-    {
-    FLOG(_L("CFotaDB::CreateDatabaseL()  >>"));
-    TInt        err;
-    User::LeaveIfError( iStateDB.Create( iFSSession ,KDatabaseName ) );
-    User::LeaveIfError(iStateDB.Begin());
-    User::LeaveIfError(iStateDB.Execute(KCreateTable));
-    err = iStateDB.Commit();
-    if(err) 
-        {
-        FLOG(_L("      cdb err %d"),err);
-        iStateDB.Rollback();
-        User::Leave(err);
-        }
-    User::LeaveIfError( iStateDB.Compact() );
-    FLOG(_L("CFotaDB::CreateDatabaseL()  <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::AddPackageStateL
-// Adds state to db
-// ---------------------------------------------------------------------------
-void CFotaDB::AddPackageStateL(const TPackageState& aState
-                                ,const TDesC8& aPkgURL)
-    {
-    FLOG(_L("  CFotaDB::AddPackageStateL   >>"));
-    TInt            err;
-    RDbView         view;
-	CleanupClosePushL( view );
-    TPackageState   pkgstate(aState); 
-    pkgstate.iResult = -1; // result should be -1 if no Execs have been done
-	err = view.Prepare( iStateDB, TDbQuery(KSelectAll), RDbView::EInsertOnly);
-    __LEAVE_IF_ERROR(err);
-    FLOG(_L("  CFotaDB::AddPackageStateL   inserting. pkgid:%d result:%d \
-            state:%d"), pkgstate.iPkgId,pkgstate.iResult,pkgstate.iState);
-	view.InsertL();
-    StateToRowL( pkgstate,aPkgURL,view );
-	view.PutL();
-	CleanupStack::PopAndDestroy(); //view
-    FLOG(_L("  CFotaDB::AddPackageStateL   <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::GetAllL
-// Get all states
-// ---------------------------------------------------------------------------
-void CFotaDB::GetAllL( RArray<TInt>& aStates)
-	{
-	RDbView             view;
-	CleanupClosePushL( view );
-    
-	TInt err = view.Prepare( iStateDB, TDbQuery( KSelectAll ) );
-	__LEAVE_IF_ERROR(err);
-	view.EvaluateAll();
-
-	view.FirstL();
-    FLOG(_L("[fota DB] --- rows --------------------------------------------\
-        ----------------------- v"));		
-	while ( view.AtRow() )
-		{
-        view.GetL();
-        HBufC8*         url;
-        TPackageState   s = RowToStateL(url,view);
-        aStates.Append( s.iPkgId );
-        CleanupStack::PushL ( url );       
-        FLOG(_L("[fotaDB] pkgid: %d profid:%d state:%d  result:%d \
-        url: %d chars sessiontype:%d IapId:%d Pkgsize:%d UpdateLtr:%d"), s.iPkgId, s.iProfileId, s.iState,s.iResult
-        ,url->Des().Length(), s.iSessionType, s.iIapId, s.iPkgSize, s.iUpdateLtr );
-	    CleanupStack::PopAndDestroy(); // url
-		view.NextL();
-		}	
-    FLOG(_L("[fota DB] --- rows --------------------------------------------\
-        ----------------------- ^"));		
-    view.Close();
-	CleanupStack::PopAndDestroy(); //view
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::OpenDBL()
-// Opens database
-// ---------------------------------------------------------------------------
-void CFotaDB::OpenDBL()
-    {
-    FLOG(_L("CFotaDB::OpenDBL()"));
-    if (!iIsOpen)	//Prevents accidental opening of database twice
-    	{
-	    TInt        err;
-	    err     = iStateDB.Open ( iFSSession ,KDatabaseName);
-	    
-	    if ( err == KErrNotFound )
-	        {
-	        CreateDatabaseL();
-	        iTableAltercheck = EFalse; //Table created newly, hence no alteration required.
-	        }
-	    else if ( err != KErrNone )
-	        {
-	        FLOG(_L("[fota DB openDB]\t db open error: %d"), err);
-	        FLOG(_L("deleting fota DB and creating it again..."));
-	        err = iFSSession.Delete(KDatabaseName);
-	        CreateDatabaseL();
-	        User::LeaveIfError(err);
-	        }
-	    User::LeaveIfError( iTable.Open (iStateDB, KTblState) );
-	    iColSet = iTable.ColSetL();
-	    
-	   	//Check & correct if the table has wrong attributes - this is for data compatibility
-	    if (iTableAltercheck)
-	    	AlterTableIfRequiredL();
-	
-	    iIsOpen = ETrue;
-    	}
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDB::CloseAndCommitDB
-// Closes and commits DB
-// ---------------------------------------------------------------------------
-void CFotaDB::CloseAndCommitDB()
-    {
-    if ( iColSet )
-        {
-        delete iColSet;
-        iColSet = NULL;
-        }
-    iTable.Close();
-    iStateDB.Close();
-    iIsOpen = EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDB::IsOpen()
-// Chekcs if db is open
-// ---------------------------------------------------------------------------
-TBool CFotaDB::IsOpen()
-    {
-    return iIsOpen;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::GetStateL
-// Gets pkg state from db
-// ---------------------------------------------------------------------------
-TPackageState CFotaDB::GetStateL(const TInt aPkgId)
-    {   
-	RDbView             view;
-    TPackageState       s;
-	CleanupClosePushL( view ); 
-
-    s.iState = RFotaEngineSession::EIdle; // default state is idle
-
-    HBufC* select  = HBufC::NewLC( KSelect_where_packageid().Length() + 10); 
-    select->Des().Format (KSelect_where_packageid, aPkgId);
-
-    TInt err = view.Prepare( iStateDB, TDbQuery(*select) );
-	__LEAVE_IF_ERROR(err);
-	view.EvaluateAll();
-	view.FirstL();
-
-    while ( view.AtRow() )
-		{
-        view.GetL();
-        HBufC8* url;
-        s = RowToStateL( url,view ); 
-        CleanupStack::PushL( url );     
-        CleanupStack::PopAndDestroy(); // url
-		view.NextL();
-		}	
-	CleanupStack::PopAndDestroy(); //select
-	CleanupStack::PopAndDestroy(); //view
-    return s;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::SetStateL
-// Writes package state to DB. 
-// ---------------------------------------------------------------------------
-void CFotaDB::SetStateL( TPackageState& aState, const TDesC8& aPkgURL
-                        , TUint aChangedFields )
-    {
-    FLOG(_L("  CFotaDB::SetStateL  >>  id %d result %d  state %d sessiontype %d iapid %d pkgsize %d updateltr %d")
-                    ,aState.iPkgId, aState.iResult, aState.iState);
-    __ASSERT_ALWAYS( aChangedFields!=0, User::Panic(KFotaPanic, KErrArgument) );
-
-    TPackageState found = GetStateL( aState.iPkgId );
-    if ( found.iPkgId == KErrNotFound )
-        {
-        AddPackageStateL( aState, aPkgURL);
-        }
-    else
-        {
-        // sml try count must be reset, if state is set
-        if (aChangedFields & EFDBState )
-            {
-            aChangedFields = aChangedFields | EFDBSmlTryCount;
-            SetRetryCount(aState);
-            }
-
-        // Construct a SQL string for update. 
-        // Example: UPDATE State SET Result=40,State=4 WHERE pkgID=5
-        // 
-        TInt        sqlsize = 0;
-        _LIT8( KSqlbegin, "UPDATE State SET " );
-        TBuf<21>    sqlEnd;
-        HBufC8*     sql( NULL );
-        // determine characters needed 
-        sqlsize = DetermineCharNeeded(aChangedFields,aState,aPkgURL);
-        sqlEnd.AppendFormat( _L(" WHERE pkgID=%d"),aState.iPkgId );
-        
-        sql = HBufC8::NewLC( ((TDesC8)KSqlbegin).Length() + sqlsize 
-                                        + sqlEnd.Length() );
-
-        sql->Des().Append ( KSqlbegin );
-
-        if (aChangedFields & EFDBResult )   
-            {
-            // check FUMO compability
- 			__ASSERT_ALWAYS( aState.iResult>=KErrNotFound 
- 			&& aState.iResult<=600, User::Panic(KFotaPanic, KErrArgument) );
-            sql->Des().AppendFormat(_L8("Result=%d,"),aState.iResult);
-            }
-        if (aChangedFields & EFDBState )    
-            {
-            // check FUMO compability
- 			__ASSERT_ALWAYS( aState.iState>=0 && aState.iState<=100
- 				, User::Panic(KFotaPanic, KErrArgument) );
-            sql->Des().AppendFormat(_L8("State=%d,"),aState.iState);
-            }
-        if (aChangedFields & EFDBProfileId) 
-            {
-            sql->Des().AppendFormat(_L8("profileid=%d,"),aState.iProfileId);
-            }
-        if (aChangedFields & EFDBPkgUrl )   
-            {
-            sql->Des().AppendFormat(_L8("pkgurl='%S',"), &aPkgURL );
-            }
-        if (aChangedFields & EFDBPkgName )  
-            {
-            sql->Des().AppendFormat(_L8("pkgname='%S',") 
-                ,&(aState.iPkgName)) ;
-            }
-        if (aChangedFields & EFDBVersion )  
-            {
-            sql->Des().AppendFormat(_L8("Version='%S',")
-                    ,&(aState.iPkgVersion));
-            }
-        if ( aChangedFields & EFDBSmlTryCount )
-            {
- 			__ASSERT_ALWAYS( aState.iSmlTryCount>=0
- 				, User::Panic(KFotaPanic, KErrArgument) );            
-            sql->Des().AppendFormat(_L8("SmlTryCount=%d,")
-                , aState.iSmlTryCount );
-                    
-            }
-        if (aChangedFields & EFDBSessionType )    
-            {
-            sql->Des().AppendFormat(_L8("SessionType=%d,"),aState.iSessionType);
-            }
-        if (aChangedFields & EFDBIapId )    
-            {
-            // validate IAP ID
- 			__ASSERT_ALWAYS( aState.iIapId>=-1 ,User::Panic(KFotaPanic, KErrArgument) );
-            sql->Des().AppendFormat(_L8("IapId=%d,"),aState.iIapId);
-            }
-        if (aChangedFields & EFDBPkgSize )    
-            {
-            // validate size
- //			__ASSERT_ALWAYS( aState.iPkgSize>=0 ,User::Panic(KFotaPanic, KErrArgument) ); // to remove compiler warning
-            sql->Des().AppendFormat(_L8("PkgSize=%d,"),aState.iPkgSize);
-            }
-        if (aChangedFields & EFDBUpdateLtr )    
-            {
-            // validate bit
-            sql->Des().AppendFormat(_L8("UpdateLtr=%d,"),aState.iUpdateLtr);
-            }
-        // remove trailing ,
-        if ( aChangedFields )
-            {
-            sql->Des().SetLength ( sql->Des().Length()-1 );
-            }
-        sql->Des().Append ( sqlEnd );
-        HBufC*  sql2 = HBufC::NewLC( sql->Length() ); // to cleanupstack
-        sql2->Des().Copy(sql->Des());
-		FLOG(_L("  sql:%S"),sql2);
-        
-        User::LeaveIfError( iStateDB.Begin() );
-        User::LeaveIfError( iStateDB.Execute(*sql2) );
-        User::LeaveIfError( iStateDB.Commit() );
-        User::LeaveIfError( iStateDB.Compact() );
-
-        CleanupStack::PopAndDestroy( sql2 );  //sql2
-        CleanupStack::PopAndDestroy( sql );  //sql
-        }
-    FLOG(_L("  CFotaDB::SetStateL  <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDB::DetermineCharNeeded 
-// Returns the char needed fro the query 
-// ---------------------------------------------------------------------------
-
-TInt CFotaDB::DetermineCharNeeded(TInt aChangedFields,TPackageState& aState,const TDesC8& aPkgURL)
-
-{	 
-	
-	      TInt sqlsize=0;
-	      if (aChangedFields & EFDBResult )       sqlsize += 4 + 7 + 4; 
-        if (aChangedFields & EFDBState )        sqlsize += 4 + 5 + 4;
-        if (aChangedFields & EFDBProfileId )    sqlsize += 4 + 9 + 4;
-        if (aChangedFields & EFDBPkgUrl )       sqlsize += aPkgURL.Length() 
-                                                           + 6 + 4;
-        if (aChangedFields & EFDBPkgName )      sqlsize += 
-                                                   aState.iPkgName.Length() 
-                                                   + 7 + 4;
-        if (aChangedFields & EFDBVersion )      sqlsize += 
-                                                   aState.iPkgVersion.Length() 
-                                                   + 7 + 4;
-        if (aChangedFields & EFDBSmlTryCount )  sqlsize += 4 + 11 + 4;
-        
-        if (aChangedFields & EFDBSessionType )    sqlsize += 4 + 11 + 4;
-        if (aChangedFields & EFDBIapId )    sqlsize += 4 + 5 + 4;
-        if (aChangedFields & EFDBPkgSize )    sqlsize += 4 + 7 + 10;
-        if (aChangedFields & EFDBUpdateLtr ) sqlsize += 4 + 11 + 4;
-        
-        return sqlsize;
-	
-}
-
-// ---------------------------------------------------------------------------
-// CFotaDB::SetRetryCount
-// Sets the retry count
-// ---------------------------------------------------------------------------
-void CFotaDB::SetRetryCount(TPackageState& aState)
-{
-   CRepository* centrep( NULL);
-   TInt err = KErrNone;
-   TInt retry = 0;
-  
-   TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-   if ( centrep ) 
-     	   {
-        	err = centrep->Get( KGenericAlertRetries, retry );
-        	delete centrep; centrep = NULL;
-        	}
-        	if(err == KErrNone )
-        	    {
-            	    if(retry < 0 )
-            	    {
-            	    aState.iSmlTryCount = KDefaultSmlTryCount;
-            	    }
-                  	else if( retry == 0 )
-               	    {
-               	     aState.iSmlTryCount = 2 ;
-               	    }
-                	else if (retry > KMaximumSmlTryCount )
-               	    {
-               	     aState.iSmlTryCount = KMaximumSmlTryCount + 1;
-               	    }
-                   	else
-                    {
-                	  aState.iSmlTryCount = retry + 1;
-                    }
-        	    }
-        	 else
-        	    {
-        	    aState.iSmlTryCount = KDefaultSmlTryCount;
-        	    }
-}        	    
-        	    
-
-// ---------------------------------------------------------------------------
-// CFotaDB::DeleteStateL
-// Delete state
-// ---------------------------------------------------------------------------
-TInt CFotaDB::DeleteStateL(const TInt aPkgId)
-    {
-	FLOG(_L("[fota DB Delete]\tdeleting %d"),aPkgId);
-	TInt err( KErrNone );
-
-    if ( iStateDB.InTransaction() )
-    	{
-	    return ( KErrAccessDenied );
-	    }
-
-	_LIT( KSQLDeleteState,"DELETE FROM State WHERE PkgId = %d" );
-
-    HBufC*  del  = HBufC::NewLC( KSQLDeleteState().Length() + 10);
-    del->Des().Format (KSQLDeleteState, aPkgId);
-
-	iStateDB.Begin();
-
-	err = iStateDB.Execute( *del );
-	CleanupStack::PopAndDestroy( del );
-	if ( err < KErrNone )
-		{
-		iStateDB.Rollback();
-		return err;
-		}
-    FLOG(_L("[fota DB Delete]\tdeleted %d"),aPkgId);
-	return KErrNone;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDB::RowToStateL
-// Extracts db row contents to package state object and aPkgUrl
-// Returns url in aPkgURL parameter
-// ---------------------------------------------------------------------------
-TPackageState CFotaDB::RowToStateL(HBufC8*& aPkgUrl,const RDbView& aView)
-    {
-    TPackageState   s;
-    TInt            pkgid   = aView.ColInt( iColSet->ColNo(KColPkgId)  );
-	TInt            state   = aView.ColInt( iColSet->ColNo(KColState)  );
-	TInt            result  = aView.ColInt( iColSet->ColNo(KColResult)  );
-    TSmlProfileId   profileid(aView.ColInt( iColSet->ColNo(KColProfileId)));
-    TPtrC           pkgname = aView.ColDes( iColSet->ColNo(KColPkgName)  );
-    TPtrC           version = aView.ColDes( iColSet->ColNo(KColVersion)  );
-    TInt            smltrycount 
-                        = aView.ColInt( iColSet->ColNo(KColSmlTryCount) );
-    TInt            sessiontype = aView.ColInt( iColSet->ColNo(KColSessionType)  );
-    TInt            iapid = aView.ColInt( iColSet->ColNo(KColIapId)  );
-    TUint           pkgsize = aView.ColUint( iColSet->ColNo(KColPkgSize)  );
-    TBool			updateltr = aView.ColUint8( iColSet->ColNo(KColUpdateLtr));
-    
-    s.iPkgId            = pkgid;
-    s.iPkgName.Copy     (pkgname);
-    s.iPkgVersion.Copy  (version);
-    s.iProfileId        = profileid;
-    s.iResult           = result;
-    s.iState            = RFotaEngineSession::TState (state);
-    s.iSmlTryCount      = smltrycount;
-    s.iSessionType 		= sessiontype;
-    s.iIapId 			= iapid;
-    s.iPkgSize 			= pkgsize;
-    s.iUpdateLtr		= updateltr;
-
-    RDbColReadStream    rstream;
-    TInt                len = aView.ColLength(iColSet->ColNo(KColPkgUrl));
-    rstream.OpenLC(aView,iColSet->ColNo(KColPkgUrl) );
-    HBufC*             pkgurl         = HBufC::NewLC( len );
-    TPtr               ptr            = pkgurl->Des();
-    rstream.ReadL( ptr, len );
-
-    HBufC8*             tmp = HBufC8::NewL( pkgurl->Des().Length() );
-    tmp->Des().Copy ( pkgurl->Des() );
-    aPkgUrl = tmp;
-
-    CleanupStack::PopAndDestroy( pkgurl ); 
-    CleanupStack::PopAndDestroy( &rstream );
-    return s;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::StateToRowL
-// Converts state object to database row (into view object)
-// ---------------------------------------------------------------------------
-void CFotaDB::StateToRowL (const TPackageState& aPkg, const TDesC8& aPkgURL
-                                ,RDbView& aView)
-    {
-    HBufC*  pkgname = HBufC::NewLC(aPkg.iPkgName.Length());
-    HBufC*  version = HBufC::NewLC(aPkg.iPkgVersion.Length());
-
-    pkgname->Des().Copy(aPkg.iPkgName);
-    version->Des().Copy(aPkg.iPkgVersion);
-
-    aView.SetColL( iColSet->ColNo( KColPkgId ),      aPkg.iPkgId);
-	aView.SetColL( iColSet->ColNo( KColResult ),     aPkg.iResult);
-	aView.SetColL( iColSet->ColNo( KColState ),      aPkg.iState);
-	aView.SetColL( iColSet->ColNo( KColProfileId ),  aPkg.iProfileId);
-	aView.SetColL( iColSet->ColNo( KColPkgName ),    *pkgname );
-	aView.SetColL( iColSet->ColNo( KColVersion ),    *version );
-	aView.SetColL( iColSet->ColNo( KColSmlTryCount ), aPkg.iSmlTryCount );
-	aView.SetColL( iColSet->ColNo( KColSessionType ), aPkg.iSessionType );
-	aView.SetColL( iColSet->ColNo( KColIapId ), 	  aPkg.iIapId  );
-	aView.SetColL( iColSet->ColNo( KColPkgSize ), 	  aPkg.iPkgSize );
-	aView.SetColL( iColSet->ColNo( KColUpdateLtr ),	  aPkg.iUpdateLtr );
-
-    RDbColWriteStream wstream;
-    CleanupClosePushL( wstream );
-    wstream.OpenL( aView,iColSet->ColNo(KColPkgUrl) );
-    // Cannot write 8 bit descriptors to databae
-    HBufC* buf = HBufC::NewLC( aPkgURL.Length() );
-    buf->Des().Copy( aPkgURL );
-    wstream.WriteL( buf->Des() );
-
-    FLOG(_L("CFotaDB::StateToRowL  id:%d result:%d state:%d profileid:%d \
-    		name:%d chars version: %d chars url: %d chars sessiontype:%d iapid:%d pkgsize:%d updateltr = %d")
-    		,aPkg.iPkgId, aPkg.iResult, aPkg.iState, aPkg.iProfileId
-    		, pkgname->Des().Length(), version->Des().Length()
-    		, buf->Des().Length(),aPkg.iSessionType,aPkg.iIapId,aPkg.iPkgSize, aPkg.iUpdateLtr);
-
-    CleanupStack::PopAndDestroy( buf );
-    CleanupStack::PopAndDestroy( &wstream );
-    CleanupStack::PopAndDestroy( version );
-    CleanupStack::PopAndDestroy( pkgname );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDB::AlterTableIfRequiredL()
-// Adds the new attributes when fota state table is old.
-// ---------------------------------------------------------------------------
-void CFotaDB::AlterTableIfRequiredL()
-	{
-    FLOG(_L("CFotaDB::AlterTableIfRequired >>"));
-	TInt noofcol = iTable.ColCount();
-	//noofcol = 9 means old database; alteration is needed
-	if (noofcol!=KNoOfDBFields)
-		{
-		FLOG(_L("FotaState table is incompatible; needs alteration!"));
-	    User::LeaveIfError(iStateDB.Begin());
-
-
-	    TInt err (KErrNone);
-	    err = iStateDB.Execute(KAlterTable);
-	    if (!err)
-	    	{
-	    	err = iStateDB.Commit();
-		    if(err) 
-		        {
-		        FLOG(_L(" FotaState table alteration err2 %d, deleting it and recreating it again"),err);
-		    	CloseAndCommitDB();
-		        User::LeaveIfError (iFSSession.Delete(KDatabaseName));
-		        }
-	    	}
-	    else
-	    	{
-	    	FLOG(_L(" FotaState table alteration err1 %d, deleting it and recreating it again"),err);
-	    	CloseAndCommitDB();
-	    	User::LeaveIfError (iFSSession.Delete(KDatabaseName));
-	    	}
-	    if (!err)
-	    	{
-	    	User::LeaveIfError( iStateDB.Compact() );
-	    	CloseAndCommitDB();
-		    FLOG(_L("FotaState table altered successfully, reopening it again."));
-			iTableAltercheck = EFalse;
-	    	}
-	    OpenDBL();
-		}
-	else
-		iTableAltercheck = EFalse;
-
-    FLOG(_L("CFotaDB::AlterTableIfRequired <<"));
-	}
--- a/fotaapplication/fotaserver/FotaServer/src/FotaDLProgressDlg.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Progress dlg for download
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "FotaDLProgressDlg.h"
-
-// ========================= MEMBER FUNCTIONS ================================
-
-// ---------------------------------------------------------------------------
-// CFotaDLProgressDlg::CFotaDLProgressDlg
-// ---------------------------------------------------------------------------
-CFotaDLProgressDlg::CFotaDLProgressDlg( CEikDialog** aSelfPtr
-            , TBool aVisibilityDelayOff, MDLProgressDlgObserver* aObserver, TInt aNoteType)
-                : CAknProgressDialog( aSelfPtr, aVisibilityDelayOff )
-                    ,iNoteType(aNoteType)
-                    ,iObserver( aObserver )
-                    
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-CFotaDLProgressDlg::~CFotaDLProgressDlg()
-    {
-    if (iSelfPtr) 
-        {
-        *iSelfPtr = NULL;
-        iSelfPtr = NULL;
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDLProgressDlg::OkToExitL
-// Called by framework when the Softkey is pressed.
-// ---------------------------------------------------------------------------
-//
-TBool CFotaDLProgressDlg::OkToExitL( TInt aButtonId )
-    {
-    TBool result( ETrue );
-    iObserver->HandleDLProgressDialogExitL( aButtonId );
-    return result;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDLProgressDlg::OfferKeyEventL
-// ---------------------------------------------------------------------------
-TKeyResponse CFotaDLProgressDlg::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/
-                                                    ,TEventCode /*aType*/)
-    {
-    return EKeyWasNotConsumed;
-    }
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/src/FotaNetworkRegStatus.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,391 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   GPRS and Wlan status getter for sending Generic Alerts
-*
-*/
-
-
-
-// INCLUDE FILES
-
-//System Includes
-#include <startupdomainpskeys.h>	//GlobalRFsStates
-#include <rconnmon.h>	//RConnectionMonitor
-#include <featmgr.h>	//Feature Manager
-#include <features.hrh>	//Feature Manager
-#include <cmconnectionmethoddef.h>
-#include <cmmanagerext.h>
-#include <cmpluginwlandef.h>
-#include <cmpluginpacketdatadef.h>
-
-//User Includes
-#include "FotaServer.h"
-#include "FotaNetworkRegStatus.h"
-
-
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::NewL
-// Symbian 2-Phase construction, NewL used for creating object of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-CFotaNetworkRegStatus* CFotaNetworkRegStatus::NewL(CFotaServer* aObserver)
-	{
-	CFotaNetworkRegStatus* self = CFotaNetworkRegStatus::NewLC(aObserver);
-	CleanupStack::Pop(self);
-	return self;	
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::NewLC
-// Symbian 2-Phase construction, NewLC used for creating object of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-CFotaNetworkRegStatus* CFotaNetworkRegStatus::NewLC(CFotaServer* aObserver)
-	{
-	CFotaNetworkRegStatus* self = new (ELeave) CFotaNetworkRegStatus (aObserver);
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	
-	return self;
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::ConstructL
-// Symbian 2-Phase construction, ConstructL used for constructing the members of this class
-// This method can leave
-// -----------------------------------------------------------------------------
-
-void CFotaNetworkRegStatus::ConstructL()
-	{
-	iTimer.CreateLocal();
-	iMonitor.ConnectL();
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::CFotaNetworkRegStatus
-// C++ Constructor
-// This method shouldn't leave
-// -----------------------------------------------------------------------------
-
-CFotaNetworkRegStatus::CFotaNetworkRegStatus(CFotaServer* aObserver) : 
-    CActive( CActive::EPriorityStandard ), iObserver(aObserver), iRetriesLeft (KRetries), iGlobalRFState(EFalse)
-    {
-     CActiveScheduler::Add( this ); // Add AO to current active scheduler
-    }
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::~CFotaNetworkRegStatus
-// C++ Desctructor
-// This method shouldn't leave
-// -----------------------------------------------------------------------------
-
-CFotaNetworkRegStatus::~CFotaNetworkRegStatus()
-	{
-	Cancel();
-
-	iTimer.Close();
-	iMonitor.Close();
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::DoCancel()
-// Cancels currently active notifier, if such exists
-// -----------------------------------------------------------------------------
-//
-void CFotaNetworkRegStatus::DoCancel()
-	{
-	FLOG(_L("CFotaNetworkRegStatus::DoCancel >>"));
-	
-	if(IsActive())
-		{
-		iTimer.Cancel();
-//		Cancel();
-		}
-		
-	FLOG(_L("CFotaNetworkRegStatus::DoCancel <<"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::StartMonitoringL
-// Monitors for connection status
-// This method don't leave
-// -----------------------------------------------------------------------------
-
-void CFotaNetworkRegStatus::StartMonitoringL()
-    {
-    FLOG(_L("CFotaNetworkRegStatus::StartMonitoringL >>"));
-	
-	//Check offline state
-	FLOG(_L("Check GlobalRF state..."));
-	if (!iGlobalRFState)
-		{
-		iGlobalRFState = CheckGlobalRFState();	
-		}
-	
-	if (iGlobalRFState)
-		{
-		//Check registration state only if iGlobalRFState is true
-		FLOG(_L("Check registration state..."));
-		if (CheckNetworkRegStateL())
-			{
-			//If both are successful report complete
-			FLOG(_L("Network Registration is successful, sending Status as success to FotaServer"));
-			iObserver->ReportNetworkStatus(ETrue);
-			return;
-			}
-		}
-	//If one of them is not successful, start timer and retry KRetries times...
-	
-	if (--iRetriesLeft>=0)
-		{
-		FLOG(_L("Retry count... [%d]"),KRetries-iRetriesLeft);
-		iTimer.After(iStatus,KTimeInterval); 
-		if (!IsActive())
-			SetActive();
-		}
-	else
-		{
-		FLOG(_L("Maximum retries (%d) reached, sending Status as failure to FotaServer"), KRetries);
-		iObserver->ReportNetworkStatus(IsWlanSupportedL());		
-		}
-
-	FLOG(_L("CFotaNetworkRegStatus::StartMonitoringL <<"));
-    }
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::RunL()
-// Called when event accomplished
-// -----------------------------------------------------------------------------
-//
-void CFotaNetworkRegStatus::RunL()
-    {
-    FLOG(_L("CFotaNetworkRegStatus::RunL >>"));
-    
-	if (iStatus==KErrNone)
-		{
-		StartMonitoringL();
-		}
-	else
-		{
-		iObserver->ReportNetworkStatus(EFalse);	
-		}
-
-	FLOG(_L("CFotaNetworkRegStatus::RunL <<"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::RunError
-// Called when RunL leaves
-// This method can't leave
-// -----------------------------------------------------------------------------
-
-TInt CFotaNetworkRegStatus::RunError(TInt aError)
-	{
-	FLOG(_L("CFotaNetworkRegStatus::RunL >>"));
-	iObserver->ReportNetworkStatus(EFalse);			
-	FLOG(_L("CFotaNetworkRegStatus::RunL <<"));
-	return KErrNone;
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::CheckGlobalRFState
-// Checks for GlobalRFState, set by Starter
-// This method can't leave
-// -----------------------------------------------------------------------------
-
-TBool CFotaNetworkRegStatus::CheckGlobalRFState()
-{
-	FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState >>"));
-	
-	RProperty prop;
-	TInt val = KErrNone;
-	TInt err = KErrNone;
-	TInt status = EFalse;
-	
-	err = prop.Get(KPSUidStartup, KPSGlobalSystemState, val);
-	if (err==KErrNone && val==ESwStateNormalRfOn)
-		{
-		//Phone is not offline. Check for Network Registration status
-		FLOG(_L("Phone is online. Check for Network Registration status"));
-		status = ETrue;
-		}
-	else
-		{
-		//Phone is offline. No Network activities allowed.
-		FLOG(_L("Phone is offline. No Network activities allowed."));
-		status = EFalse;
-		}
-	FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState, status = %d <<"),status);	
-	return status;
-}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::CheckNetworkRegStatusL
-// Checks for Network registration status
-// This method can leave
-// -----------------------------------------------------------------------------
-
-TBool CFotaNetworkRegStatus::CheckNetworkRegStateL()
-	{
-	FLOG(_L("CFotaNetworkRegStatus::CheckNetworkRegStateL >>"));
-	
-	TBool status = EFalse;
-	
-	TInt registrationStatus (KErrNone);
-	TRequestStatus status1;
-	iMonitor.GetIntAttribute( EBearerIdGSM,  // See bearer ids from TConnMonBearerId
-	                         0, 
-	                         KNetworkRegistration, 
-	                         registrationStatus, 
-	                         status1 );
-	User::WaitForRequest( status1 );
-
-	if ( status1.Int() == KErrNone )
-	    {
-	    switch (registrationStatus)
-	    	{
-	    		case ENetworkRegistrationHomeNetwork:
-	    		case ENetworkRegistrationRoaming:
-						{
-						status = ETrue;
-						break;	
-						}
-				default:
-						{
-	    				/* Includes - 	ENetworkRegistrationNotAvailable:
-	    								ENetworkRegistrationUnknown:
-	    								ENetworkRegistrationNoService:
-	    								ENetworkRegistrationEmergencyOnly:
-	    								ENetworkRegistrationSearching:
-	    								ENetworkRegistrationBusy:
-	    								ENetworkRegistrationDenied:*/
-	    				status = EFalse;
-	    				break;
-	    				}
-	    	}
-	    }
-	    
-	FLOG(_L("CFotaNetworkRegStatus::CheckNetworkRegStateL, status = %d <<"),status);    
-	return status;
-	}
-	
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::IsWlanSupportedL
-// Checks whether Wlan supported on device and active
-// This method can leave
-// -----------------------------------------------------------------------------
-	
-TBool CFotaNetworkRegStatus::IsWlanSupportedL()
-	{
-	FLOG(_L("CFotaNetworkRegStatus::IsWlanSupportedL >>"));
-	
-	TBool status = EFalse;
-	
-	FeatureManager::InitializeLibL();
-	if (FeatureManager::FeatureSupported( KFeatureIdProtocolWlan  )) // check for feature enabled
-		{
-		status = ETrue;
-		}
-	
-	FeatureManager::UnInitializeLib();
-
-#if defined(__WINS__)
-	status = ETrue;
-#endif
-	
-	FLOG(_L("CFotaNetworkRegStatus::IsWlanSupportedL, status = %d <<"),status);
-	return status;
-	}
-
-// -----------------------------------------------------------------------------
-// CFotaNetworkRegStatus::IsConnectionPossibleL
-// Checks whether the network connection is possible in the given IAP Id
-// This method can leave
-// -----------------------------------------------------------------------------
-TBool CFotaNetworkRegStatus::IsConnectionPossibleL(TInt aIapid)
-	{
-	FLOG(_L("CFotaNetworkRegStatus::IsConnectionPossibleL >>"));
-	TBool status (EFalse);
-	
-	TUint32 bearer = FindBearerL(aIapid);
-	if( bearer == KUidPacketDataBearerType )
-	{
-	FLOG(_L("Bearer is Packet data"));
-	if( CheckGlobalRFState() && CheckNetworkRegStateL() )
-		{
-		FLOG(_L("Network is up and connection is possible "));
-		status = ETrue;
-		}
-	else
-		{
-		FLOG(_L("Network is not up and connection is not possible "));
-		status = EFalse;
-		}
-	}
-	else if( bearer == KUidWlanBearerType )//for wlan or other bearers
-		{
-		FLOG(_L("Bearer is wlan and proceeding for download "));
-		//proceed & this else loop to be removed
-		status = ETrue;
-		}
-	else
-		{
-		FLOG(_L("Bearer is not packet data or WLAN"));
-		}
-	
-	FLOG(_L("CFotaNetworkRegStatus::IsConnectionPossibleL, status = %d <<"),status);
-	return status;
-	}
-
-
-// ----------------------------------------------------------------------------------------
-// CFotaDownload::FindBearerId
-// Finds the Bearer Id for a given IAP Id
-// ----------------------------------------------------------------------------------------
-TUint32 CFotaNetworkRegStatus::FindBearerL(TInt aIapId)
-	{
-	FLOG(_L("CFotaNetworkRegStatus::FindBearerL: %d"),aIapId);
-	TUint32 bearer = 0;
-	TInt err( KErrNone );
-	 // Query CM Id
-	TInt cmId ( aIapId );			        
-	RCmManagerExt  CmManagerExt;
-	TRAP( err, CmManagerExt.OpenL() );
-	FLOG(_L("CmManagerExt.OpenL() with error as  %d"),err);	
-    if( err == KErrNone )
-    	{
-    	RCmConnectionMethodExt cm;
-    	TRAP( err, cm = CmManagerExt.ConnectionMethodL( cmId ) );			        	
-    	FLOG(_L("CmManagerExt.ConnectionMethodL with error as  %d"),err);
-	    if ( err == KErrNone )
-	        {	        
-	        CleanupClosePushL( cm );	  
-	        FLOG(_L("cm pushed to cleanupstack "));
-	        bearer = cm.GetIntAttributeL( CMManager::ECmBearerType );	        			        
-	        FLOG(_L("bearer is %d "),bearer);
-		    CleanupStack::PopAndDestroy();  // cm	  
-	        FLOG(_L("cm poped & destroyed from cleanupstack "));
-	        }	  
-	    
-	    CmManagerExt.Close();
-	    FLOG(_L("CmManagerExt closed "));
-    	}
-    FLOG(_L("CFotaNetworkRegStatus::FindBearerL end with bearer: %d"),bearer);				
-    return bearer;
-	}
-
-// End of File 
--- a/fotaapplication/fotaserver/FotaServer/src/FotaReminderDlg.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   methods for CFotaReminderDlg
-*
-*/
-
-
-
-#include <fotaserver.rsg>
-#include "FotaReminderDlg.h"
-
-#include "FotaDB.h"
-#include "FotaSrvDebug.h"
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::NewLC
-// Two-phase construction
-// ---------------------------------------------------------------------------
-//
-CFotaReminderDlg* CFotaReminderDlg::NewLC(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent)
-	{
-	CFotaReminderDlg* self = new (ELeave) CFotaReminderDlg(aSelectedItem, aItemArray, aEvent);
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	
-	return self;
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::NewL
-// Two-phase construction
-// ---------------------------------------------------------------------------
-//
-CFotaReminderDlg* CFotaReminderDlg::NewL(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent)
-	{
-	CFotaReminderDlg* self = CFotaReminderDlg::NewLC(aSelectedItem, aItemArray, aEvent);
-	CleanupStack::Pop(self);
-	return self;
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::~CFotaReminderDlg
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CFotaReminderDlg::~CFotaReminderDlg()
-	{
-	FLOG(_L("CFotaReminderDlg::~CFotaReminderDlg   >>"));
-	iAppKeyClient.Close();
-	FLOG(_L("CFotaReminderDlg::~CFotaReminderDlg   <<"));
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::CFotaReminderDlg
-// Constructor.
-// ---------------------------------------------------------------------------
-//	
-CFotaReminderDlg::CFotaReminderDlg(TInt& aSelectedItem, CDesCArray* aItemArray, TInt& aEvent):
-								CAknRadioButtonSettingPage( R_SETTING_REMAINDER, aSelectedItem, aItemArray ),
-    	                        iSelectedItem(aSelectedItem),
-								iEvent(aEvent),
-								iIsAppKeySuppressed(EFalse)
-	{
-		
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::~CFotaReminderDlg
-// Two-phase construction.
-// ---------------------------------------------------------------------------
-//	
-void CFotaReminderDlg::ConstructL()
-	{
-	FLOG(_L("CFotaReminderDlg::ConstructL   >>"));
-	
-	SuppressAppKey(ETrue);
-
-	CAknRadioButtonSettingPage::ConstructL();
-	iList = ListBoxControl();
-
-	FLOG(_L("CFotaReminderDlg::ConstructL   <<"));    
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::ActivateL
-// Used to activate the radiobuttonsettingpage.
-// ---------------------------------------------------------------------------
-//
-void CFotaReminderDlg::ActivateL()
-	{
-	FLOG(_L("CFotaReminderDlg::ActivateL   >>"));
-
-	//iList->SetCurrentItemIndexAndDraw(0);
-	CAknRadioButtonSettingPage::ActivateL();
-
-	FLOG(_L("CFotaReminderDlg::ActivateL   <<"));
-	}
-	
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::OkToExitL
-// Determines if the dialog can be closed.
-// ---------------------------------------------------------------------------
-//
-TBool CFotaReminderDlg::OkToExitL( TInt aButtonId )
-	{
-   	FLOG(_L("CFotaReminderDlg::OkToExitL   >>"));
-
-    TBool IsAccepted = aButtonId;
-
-    if ( IsAccepted )
-        {
-        iSelectedItem = iList->CurrentItemIndex();
-        }
-
-	SuppressAppKey(EFalse);
-	FLOG(_L("CFotaReminderDlg::OkToExitL   <<"));
-
-    return ETrue;
-    }
-    	
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::ProcessCommandL
-// Process events from softkeys
-// ---------------------------------------------------------------------------
-//
-void CFotaReminderDlg::ProcessCommandL( TInt aCommandId )
-	{
-   	FLOG(_L("CFotaReminderDlg::ProcessCommandL   >>"));
-
-    if ( aCommandId == EAknSoftkeyOk )
-    	{
-    	AttemptExitL(ETrue);
-    	}
-    	
-    if (aCommandId == EAknSoftkeyCancel ||
-         aCommandId == EAknCmdExit)
-        {
-        AttemptExitL( EFalse );
-        }
-
-   	FLOG(_L("CFotaReminderDlg::ProcessCommandL   <<"));
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::OfferKeyEventL
-// This routine routes the keys to the editor.
-// ---------------------------------------------------------------------------
-//	
-TKeyResponse CFotaReminderDlg::OfferKeyEventL(
-    const TKeyEvent& aKeyEvent,
-    TEventCode aType )
-    {
-	FLOG(_L("CFotaReminderDlg::OfferKeyEventL   >>"));
-   
-	/*if (iResumeOnFG && iIsDlgOpen)
-    {
-		TApaTaskList taskList(CEikonEnv::Static()->WsSession());
-		TApaTask task=taskList.FindApp(TUid::Uid(KFotaServerUid));
-		if(task.Exists())
-			task.BringToForeground();
-
-    }
-    
-    iResumeOnFG = EFalse;
-    //Menu key is pressed when reminder dialog is shown
- 	TBool aStartDmUi (EFalse);   
-    if (aKeyEvent.iCode == EKeyApplication0)
-    {
-    	iResumeOnFG = ETrue;
-		aStartDmUi = ETrue;	
-    }*/
-   
-    iEvent = aType;
-    TKeyResponse aResp (EKeyWasConsumed );
-    aResp = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
-    
-    FLOG(_L("CFotaReminderDlg::OfferKeyEventL   <<"));
-    return aResp;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaReminderDlg::SuppressAppKey
-// Used to suppress the menu/app key
-// ---------------------------------------------------------------------------
-//
-void CFotaReminderDlg::SuppressAppKey(TBool aValue)
-	{
-	FLOG(_L("CFotaReminderDlg::SuppressAppKey   >>"));
-
-	if (iIsAppKeySuppressed!=aValue)
-		{	
-		
-		TInt error = iAppKeyClient.ConnectAndSendAppsKeySuppress(aValue);
-		FLOG(_L("Return for suppress (%d)....%d"),aValue,error);
-		iIsAppKeySuppressed = aValue;
-		}
-
-	FLOG(_L("CFotaReminderDlg::SuppressAppKey   <<"));
-	}
-		
--- a/fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2585 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Fota server update and download functionality 
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <aknenv.h>
-#include <apgtask.h>
-#include <apgwgnam.h>
-#include <schtime.h>
-#include <csch_cli.h>
-#include <e32property.h>
-#include <nsmldmconst.h>
-#include <cmmanager.h>
-#include <cmconnectionmethod.h>
-#include <DevManInternalCRKeys.h>
-#include <nsmlconstants.h>
-#include <centralrepository.h>
-#include <sysversioninfo.h>
-#include "FotaSrvApp.h"
-#include "FotaServer.h"
-#include "FotaSrvDebug.h"
-#include "FotasrvSession.h"
-#include "fotaConst.h"
-#include "nsmldmtreedbclient.h"
-#include "fotaserverPrivatePSKeys.h"
-#include "FotaNetworkRegStatus.h"
-_LIT(KSizePass, "contentsize");
-#include "DevEncController.h"
-#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
-// ============================= LOCAL FUNCTIONS =============================
-
-// ---------------------------------------------------------------------------
-// ToDesC16LC
-// Converts to 16bit desc
-// ---------------------------------------------------------------------------
-HBufC* ToDesC16LC( const TDesC8& a )
-    {
-    HBufC* bf = HBufC::NewLC( a.Length() );
-    bf->Des().Copy(a);
-    return bf;
-    }
-// ---------------------------------------------------------------------------
-// GetPredefinedNodeL
-// function to get preconfigured node for FUMO
-// ---------------------------------------------------------------------------
-void GetPredefinedNodeL(TDes8& aNode)
-	{
-	FLOG(_L("GetPredefinedNodeL() Begin"));
-    CRepository* centrep( NULL);
-	aNode.Zero();
-   	centrep = CRepository::NewLC( TUid::Uid(0x101F9A0A) );
-
-    if ( centrep )
-	    {
-	    FLOG(_L("centralrepository found End"));
-    	TFullName temp;
-		
-    	if (centrep->Get( KDevManFUMOPredefinedNodes, temp )==KErrNone && temp.Length() )
-			{
-			temp.Trim();
-			aNode.Copy(temp);
-			}
-		CleanupStack::PopAndDestroy(centrep);
-	    }
-	FLOG(_L("GetPredefinedNodeL() End"));	    
-	}
-// ---------------------------------------------------------------------------
-// DeleteFUMOTreeL
-// function to get preconfigured node for FUMO
-// ---------------------------------------------------------------------------
-void DeleteFUMOTreeL ()
-    {
-    FLOG(_L("DeleteFUMOTreeL() Begin"));
-    const TUint32 KNSmlFotaAdapterUid = 0x101F9A09;
-    _LIT8( KNSmlFumoPath, "FUMO" );
-    _LIT8( KNSmlFumoSeparator, "/" );
-    const TInt KGranularity = 10;
-    TBuf8<KMaxFullName> temp;
-	GetPredefinedNodeL(temp);
-    RNSmlDMCallbackSession session;
-    User::LeaveIfError(session.Connect());
-    CleanupClosePushL(session);
-    
-    CBufBase *emptyList = CBufFlat::NewL(0);
-    CleanupStack::PushL(emptyList);
-    CArrayFixFlat <TSmlDmMappingInfo>* UriSegList;
-    UriSegList = new (ELeave) CArrayFixFlat <TSmlDmMappingInfo> (KGranularity);
-    
-    CleanupStack::PushL(UriSegList);
-			
-    session.GetUriSegListL(KNSmlFotaAdapterUid,KNSmlFumoPath,*UriSegList);
-    
-    for ( TUint16 i=0;i<UriSegList->Count();i++)
-        {
-        	if (temp.Length() && UriSegList->At(i).iURISeg.Find( temp ) != KErrNotFound)
-            {
-              FLOG(_L("DeleteFUMOTreeL predefined match =%S"), &temp);
-              continue;
-            }
-       
-       	TBuf8<KMaxFullName> tempFumo;
-       	tempFumo.Append(KNSmlFumoPath);
-       	tempFumo.Append(KNSmlFumoSeparator);
-       	tempFumo.Append(UriSegList->At(i).iURISeg);
-       	FLOG(_L("DeleteFUMOTreeL() call update mapping info for node %S"),&tempFumo);
-        session.UpdateMappingInfoL(KNSmlFotaAdapterUid,tempFumo,*emptyList);
-        
-        }
-    // session.UpdateMappingInfoL(KNSmlFotaAdapterUid,KNSmlFumoPath,*emptyList);
-	CleanupStack::PopAndDestroy(UriSegList); 
-    CleanupStack::PopAndDestroy(emptyList); 
-    CleanupStack::PopAndDestroy(&session); //session
-    FLOG(_L("DeleteFUMOTreeL() End"));
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaServer::GetProfileDataL
-// ---------------------------------------------------------------------------
-void CFotaServer::GetProfileDataL( RSyncMLSession* aSyncml
-    ,const TSmlProfileId aProf, TInt& aIapId, TSmlServerAlertedAction& aSrvAA
-    ,TBool& aUIJob, TInt& aSanVal)
-	{
-    FLOG(_L("CFotaServer::GetProfileDataL prof %d"),aProf);
-    __ASSERT_ALWAYS( aSyncml, User::Panic(KFotaPanic, KErrArgument) );
-    __ASSERT_ALWAYS( aSyncml->Handle(), User::Panic(KFotaPanic, KErrBadHandle) );
-    // GET IAP FROM PROFILE ----------------------------------------------
-    TSmlJobId               jobid( KErrNotFound );
-    TInt                    jobidFromUI( KErrNotFound );
-    RSyncMLDevManProfile    smlprof;
-    RArray<TSmlTransportId> connections;
-    TSmlTransportId         transport;
-    RSyncMLConnection       connection;
-                   
-    CleanupClosePushL(smlprof);
-    CleanupClosePushL(connections);
-    CleanupClosePushL(connection);
-    FLOG(_L("[FotaServer]   1"));
-    
-    FLOG(_L("[FotaServer]   1.1 opening syncml \
-                        profileid %d "), aProf);
-    smlprof.OpenL(*aSyncml, aProf, ESmlOpenRead);
-    FLOG(_L("[FotaServer]  1.1"));
-    smlprof.ListConnectionsL(connections);
-    FLOG(_L("[FotaServer]  1.3"));
-    transport = connections[0];
-    connection.OpenL(smlprof,transport);
-    TBuf8<20> iapid2 = connection.GetPropertyL ( KNSmlIAPId );
-    TLex8 iapid3(iapid2);
-    iapid3.Val(aIapId);
-
-    // 1. Profile's "accepted" field.
-    aSrvAA = smlprof.SanUserInteraction ();
-    FLOG(_L("[FotaServer]  1.4 \
-                    SanUserInteraction:%d"),aSrvAA );
-
-    // 2. Has job been started from omadmappui. That is, did user start the job
-    TSmlUsageType dmusagetype(ESmlDevMan);
-    aSyncml->CurrentJobL( jobid,dmusagetype );
-    RProperty::Get( TUid::Uid(KOmaDMAppUid), KNsmlCurrentJobId, jobidFromUI);
-    aUIJob = ( jobidFromUI == jobid && jobid!=KErrNotFound );
-    
-    aSanVal = KErrNotFound; 
-    if ( aUIJob )
-    	{
-    	//First for not server alert or SAN not supported value is -1
-    	RProperty::Get( TUid::Uid(KOmaDMAppUid), KNsmlSanUIMode, aSanVal);
-    	if ( aSanVal != -1 ) //SAN Supported
-    	    {
-   	    	aUIJob = 0;
-    	    }
-    	}
-    FLOG(_L("  jobidFromUI: %d jobid: %d, aUIJob: %d, aSanVal: %d"),jobidFromUI,jobid,aUIJob,aSanVal);
-    CleanupStack::PopAndDestroy (&connection); 
-    CleanupStack::PopAndDestroy (&connections);
-    CleanupStack::PopAndDestroy (&smlprof); 
-	}
-
-// --------------------------------------------------------------------------
-// CreateDeviceManagementSessionL       
-// Creates DM session 
-// --------------------------------------------------------------------------
-void CFotaServer::CreateDeviceManagementSessionL( TPackageState& aState )
-    {
-    FLOG(_L("[cfotasever]   CreateDeviceManagementSessionL dms >> profid %d\
-    %d counts left ,sml handle %d, iNetworkAvailable=%d"), aState.iProfileId, aState.iSmlTryCount 
-    , iSyncMLSession.Handle(),iNetworkAvailable);
-	
-    SetStartupReason(EFotaPendingGenAlert);
-
-	if (!iNetworkAvailable)
-		{
-		iRetryingGASend = ETrue;
-		iStoredState = aState;
-		StartNetworkMonitorL();
-		}
-	else 
-		{
-
-	    TBool dbAlreadyOpen = iDatabase->IsOpen();
-	    TBool triesLeft( EFalse );
- 		
- 		iNetworkAvailable = EFalse; // to check network again when GA is sent next time
- 		
-	    if ( iSyncMLSession.Handle() )
-	        {
-	        User::Leave( KErrAlreadyExists );
-	        }
-
-	    if ( !dbAlreadyOpen ) iDatabase->OpenDBL();
-	    // There is still tries left
-	    if ( aState.iSmlTryCount > 0 )
-	        {
-	        triesLeft = ETrue;
-	        FLOG(_L(" decrementing the retry count"));
-	        aState.iSmlTryCount = aState.iSmlTryCount - 1;
-	        iDatabase->SetStateL( aState, KNullDesC8, EFDBSmlTryCount );
-	        }
-	    // out of tries, set state to idle
-	    else
-	        {
-	        triesLeft = EFalse;
-	        FLOG(_L("   out of tries, resetting pkg state"));
-	        
-	        SetStartupReason(EFotaDefault);
-	        aState.iState = RFotaEngineSession::EIdle;
-	        aState.iResult = KErrNotFound;
-	        iDatabase->SetStateL( aState, KNullDesC8, EFDBState|EFDBResult );
-	        }
-	    if ( !dbAlreadyOpen ) iDatabase->CloseAndCommitDB();
-
-	    if ( triesLeft )
-	        {
-	        TInt iapid;
-	        TSmlServerAlertedAction tmp;
-	        TBool                   tmp2;
-	        TInt					tmp3;
-	        iSyncMLSession.OpenL(); 
-	        GetProfileDataL( &iSyncMLSession,aState.iProfileId,iapid,tmp,tmp2,tmp3);
-	        FLOG(_L("Using IAP: %d to send GA"),iapid);
-	        FLOG(_L("From Db Using IAP: %d to send GA"),aState.iIapId);
-	        RSyncMLDevManJob    dmJob;
-	        TBuf<10> genalertap,temp;
-	        genalertap.Zero();
-	        temp.Zero();	  
-	        genalertap.Append(KNSmlDMJobIapPrefix);
-	        temp.Num(aState.iIapId);//Decimal Iap
-	        if( temp.Length() <= KNSmlHalfTransportIdLength && 
-	            aState.iIapId > KErrNotFound && CheckIapExistsL(aState.iIapId) )
-	        	{
-	        	genalertap.AppendFill('0',KNSmlHalfTransportIdLength-temp.Length());
-	        	genalertap.Append(temp);
-	        	TLex gavalue(genalertap);
-	        	gavalue.Val(iIapId);
-	        	dmJob.CreateL( iSyncMLSession, aState.iProfileId,iIapId);	
-	        	iSyncMLAttempts = KSyncmlAttemptCount;
-	        	}
-	        else 
-	        	{
-	        	iSyncMLAttempts = 0;
-	        	dmJob.CreateL( iSyncMLSession, aState.iProfileId);
-	        	}
-
-			// If there's no iapid defined, sml will pop up connection dialog.
-			// In that case, only one connection attempt is allowed.
-	        iSyncJobId   = dmJob.Identifier();
-	        iSyncProfile = aState.iProfileId;
-	        dmJob.Close();
-	        iSyncMLSession.RequestEventL( *this ); 
-	        }
-	}
-
-    FLOG(_L("[cfotasever]   CreateDeviceManagementSessionL dms << profid %d")
-                            ,aState.iProfileId);
-    }
-
-
-// ============================= MEMBER FUNCTIONS ============================
-
-// --------------------------------------------------------------------------
-// CFotaServer::CFotaServer()   
-// --------------------------------------------------------------------------
-//
-CFotaServer::CFotaServer() : iInitialized(EFalse), iNeedToClose(0), iParentApp(0)
-, iDatabase(0),iDownloader(0), iUpdater(0)
- , iDownloadFinalizer(0), iUpdateFinalizer(0), iTimedExecuteResultFile(0)
- , iTimedSMLSessionClose(0), iStorage(0), iAppShutter(0), iMonitor (NULL), iSyncJobId(-1), iRetryingGASend (EFalse), iNetworkAvailable (EFalse)
- , iIapId(KErrNotFound),iSessMode(0),iUserResume(KErrNotFound), iInstallupdClient(EFalse), iDEController(NULL)
-	{
-    RProcess pr; TFullName fn = pr.FullName();  TUint prid = pr.Id();
-	FLOG(_L( "CFotaServer::CFotaServer process(id %d)%S. this 0x%x"),prid,&fn
-        ,this);
-
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoExecuteResultFileL
-// Interprets result of update (file update.resp)
-// --------------------------------------------------------------------------
-//
-void CFotaServer::DoExecuteResultFileL()
-    {
-    FLOG(_L("CFotaServer::DoExecuteResultFileL() >>"));
-
-    if ( iTimedExecuteResultFile ) 
-        {
-        iTimedExecuteResultFile->Cancel();
-        delete iTimedExecuteResultFile;
-        iTimedExecuteResultFile = NULL;
-        }
-    iUpdater = CFotaUpdate::NewL(this);
-    iUpdater->ExecuteUpdateResultFileL( iFs );
-    FLOG(_L("CFotaServer::DoExecuteResultFileL() <<"));
-    }
-
-// --------------------------------------------------------------------------
-// StaticDoExecuteResultFile
-// --------------------------------------------------------------------------
-//
-static TInt StaticDoExecuteResultFile(TAny *aPtr)
-    {
-    FLOG(_L("[cfotaserver] StaticDoExecuteResultFile() >>"));
-    __ASSERT_ALWAYS( aPtr, User::Panic(KFotaPanic, KErrBadHandle) );
-    CFotaServer* srv = (CFotaServer*) aPtr;
-    TRAPD( err,  srv->DoExecuteResultFileL() );
-    if(err) 
-        {
-        FLOG(_L("[cfotaserver] StaticDoExecuteResultFile ERROR %d"),err);
-        TRAP_IGNORE(srv->DoDeleteUpdateResultFileL());
-        }
-
-    FLOG(_L("[cfotaserver] StaticDoExecuteResultFile() <<"));
-    return err;
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::CFotaServer()   
-// Constructor. Can't do all constructing since fotaserver might call itself
-// recursively (via downloadmgr). 
-// --------------------------------------------------------------------------
-//
-void CFotaServer::ConstructL(const TDesC &aFixedServerName)
-    {
-    FLOG(_L("CFotaServer::ConstructL() >> name=%S"), &aFixedServerName);
-    TBool   updated (EFalse);
-    TInt    err;
-    CAknAppServer::ConstructL( aFixedServerName );
-
-    User::LeaveIfError( iFs.Connect() );
-    
-    err = iFs.CreatePrivatePath(EDriveC);
-    if ( err != KErrNone && err != KErrAlreadyExists ) { User::Leave (err); }
-    User::LeaveIfError( iFs.SetSessionToPrivate( EDriveC ) );
-
-    if ( !iDatabase )
-        {
-        TRAPD( err,iDatabase = CFotaDB::NewL() );
-        if ( err ) 
-            {
-            FLOG(_L("CFotaServer::  DB creationg error %d"), err);
-            User::Leave( err );
-            }
-        }
-
-    updated = CFotaUpdate::CheckUpdateResults( iFs );
-
-    // Update has happened, and result file is in place
-    if ( updated )
-        {
-        FLOG(_L("scheduling update result file execution"));
-        if ( iTimedExecuteResultFile ) 
-            {
-            iTimedExecuteResultFile->Cancel();
-            delete iTimedExecuteResultFile;
-            iTimedExecuteResultFile = NULL;
-            }
-        iTimedExecuteResultFile = CPeriodic::NewL (EPriorityNormal) ;
-        iTimedExecuteResultFile->Start (
-            TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-            , TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-            , TCallBack(StaticDoExecuteResultFile,this) ) ;
-        }
-
-	iEikEnv = CEikonEnv::Static();
-    FLOG(_L("CFotaServer::ConstructL() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::ClientAwareConstructL
-// Does rest of constructing, if not done. If parent of this fotaserver 
-// instance is another fotaserver, skip maintenance operations (since parent 
-// takes care of them). DmHOstserver triggers cleanup for states: 20,70,80
-// ,90,100 , must handle state 60 here
-// --------------------------------------------------------------------------
-void CFotaServer::ClientAwareConstructL( const RMessage2 &aMessage )
-    {
-    FLOG(_L("CFotaServer::ClientAwareConstructL >>"));
-    if ( iInitialized ) return;
-    CFotaSrvSession::TClient client 
-                    = CFotaSrvSession::CheckClientSecureIdL ( aMessage );
-	// temporary fix to keep FS from polluting FSW in case it was opened from omadmappui
-    if ( client == CFotaSrvSession::EOMADMAppUi || client == CFotaSrvSession::EFotaServer ||
-       client == CFotaSrvSession::ESoftwareChecker || client == CFotaSrvSession::ESoftwareCheckerBackground  ) 
-        {
-        //Loading the storage plugin (during DM UI launch) to adjust the reserved memory accordingly.
-        StoragePluginL();
-        iParentApp->SetUIVisibleL ( EFalse, ETrue ); // 
-        }
-
-    // Do constructing if client is other that fotaserver
-    if ( client != CFotaSrvSession::EFotaServer )
-        {
-        RArray<TInt>    states;
-        TPackageState   state;
-        CleanupClosePushL (states);
-        iDatabase->OpenDBL();
-        iDatabase->GetAllL ( states );
-    	TBool value (EFalse);
-    	if (iDownloader)
-    		{
-    		value = iDownloader->IsDownloadActive();
-    		}
-    	else
-    		{
-    		TInt err = RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaDownloadActive, value );
-    		FLOG(_L("value of KFotaDownloadActive & err as %d,%d "), (TInt)value,err);
-    		}
-    	FLOG(_L("Download active value is:%d "), (TInt)value);
-        // Loop states. 
-        for(TInt i = 0; i < states.Count(); ++i ) 
-            {
-            TPackageState   tmp;
-            TBool           toIdle(EFalse);
-            tmp = iDatabase->GetStateL(  states[i]  );
-            FLOG(_L("   1 got state id:%d state:%d result:%d"), tmp.iPkgId
-                , tmp.iState, tmp.iResult);
-            
-             if ( tmp.iState == RFotaEngineSession::EStartingUpdate )
-             
-             {
-             	TBool ispkgvalid= ETrue;
-             	TRAPD(err1,ispkgvalid= CheckSWVersionL()   )
-              if (!ispkgvalid && err1 == KErrNone)
-              {
-              StoragePluginL()->DeleteUpdatePackageL (  tmp.iPkgId );	
-             	tmp.iState    = RFotaEngineSession::EUpdateFailed;
-              tmp.iResult   = RFotaEngineSession::EResPackageMismatch;
-              iDatabase->SetStateL( tmp,KNullDesC8, EFDBState | EFDBResult );
-   
-             }	
-             }
-            // Update has been started (60)
-            // If there is no result file, means that update agent failed
-            // to run. Must get back to 50 to allow user to try again. 
-            if ( tmp.iState == RFotaEngineSession::EUpdateProgressing 
-                && iTimedExecuteResultFile==NULL )
-                {
-                FLOG(_L("     State 60 found, UA didnt run! id %d "), tmp.iPkgId);
-                tmp.iState    = RFotaEngineSession::EStartingUpdate;
-                iDatabase->SetStateL( tmp,KNullDesC8, EFDBState);
-                }
-
-            // These states need must trigger generic alert! (70+ )
-            if ( tmp.iState >= RFotaEngineSession::EUpdateFailed  )
-                {
-                if ( iSyncMLSession.Handle() == NULL )
-                    {
-                    iDatabase->CloseAndCommitDB();
-                    CreateDeviceManagementSessionL( tmp );
-                    iDatabase->OpenDBL();
-                    }
-                }
-
-            if (tmp.iState == RFotaEngineSession::EDownloadComplete && tmp.iResult == RFotaEngineSession::EResSuccessful )
-            	{
-                CreateDeviceManagementSessionL( tmp );
-            	}
-
-            if (value != 1) //if download is not active, EStartingDownload should be reset to EDownloadFailed
-            	{
-            	if (tmp.iState == RFotaEngineSession::EStartingDownload ||
-            			tmp.iState == RFotaEngineSession::EDownloadProgressing )
-            		{
-            		FLOG(_L("Resetting state %d to 20..."), tmp.iState);
-            		tmp.iState = RFotaEngineSession::EDownloadFailed;
-                    iDatabase->SetStateL( tmp,KNullDesC8, EFDBState ) ;
-                    iDatabase->CloseAndCommitDB();
-                    iDatabase->OpenDBL();
-            		}
-            	}
-
-            if ( tmp.iState == RFotaEngineSession::EDownloadFailed )
-                {
-                StoragePluginL()->DeleteUpdatePackageL( tmp.iPkgId ); 
-                tmp.iResult   = RFotaEngineSession::EResDLFailDueToNWIssues;
-                iDatabase->SetStateL( tmp,KNullDesC8, EFDBResult ) ;
-                iDatabase->CloseAndCommitDB();
-                CreateDeviceManagementSessionL( tmp );
-                iDatabase->OpenDBL();
-                }
-
-            // Reset package state to idle
-            if ( toIdle )
-                {
-                FLOG(_L("   2 resetting state %d to idle"), tmp.iPkgId);
-                tmp.iState    = RFotaEngineSession::EIdle;
-                iDatabase->SetStateL( tmp,KNullDesC8, EFDBState ) ;
-                DeleteFUMOTreeL();
-                }
-            }
-            iDatabase->CloseAndCommitDB();
-            CleanupStack::PopAndDestroy( &states );
-        }
-    else // client is child fotaserver
-        {
-        }
-    iInitialized = ETrue;
-    FLOG(_L("CFotaServer::ClientAwareConstructL <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaServer::StoragePluginL
-// Getter function for iStorage. If it doesn't exist, load it.
-// ---------------------------------------------------------------------------
-//
-CFotaStorage* CFotaServer::StoragePluginL()
-    {
-    if ( iStorage == NULL )
-        {
-        LoadStoragePluginL();
-        }
-    return iStorage;
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::LoadStoragePluginL 
-// Load update storage plugin via ecom framework.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::LoadStoragePluginL ()
-    {
-    FLOG(_L("CFotaServer::LoadStoragePluginL"));
-    if(iStorage)
-        {
-        UnLoadStoragePluginL ();
-        }
-    TUid                if_uid;
-    if_uid.iUid = ( KStorageIFUid );
-    RImplInfoPtrArray   pluginArray;
-    REComSession::ListImplementationsL( if_uid, pluginArray );
-    CleanupClosePushL( pluginArray );
-
-    if( pluginArray.Count() )
-        {
-        for( TInt i = 0; i < pluginArray.Count(); i++ )
-            {
-            CImplementationInformation* info = pluginArray[ i ];
-            TUid id = info->ImplementationUid();
-            delete info;
-            info = NULL;
-            iStorage =(CFotaStorage*) REComSession::CreateImplementationL( id
-                                        ,iStorageDtorKey); 
-            }
-        }
-    else
-        {
-        FLOG(_L("  storage plugin not found, ERROR"));
-        User::Leave ( KErrNotFound );
-        }
-    CleanupStack::PopAndDestroy( &pluginArray );
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::UnLoadStoragePluginL
-// Unloads storage plugin
-// --------------------------------------------------------------------------
-//
-void CFotaServer::UnLoadStoragePluginL ()
-    {
-    FLOG(_L("CFotaServer::UnLoadStoragePluginL"));
-    if ( iStorage ) 
-        {
-        delete iStorage;
-        iStorage=NULL;
-        }
-    FLOG(_L("    destroying"));
-    REComSession::DestroyedImplementation(iStorageDtorKey); // zeroes referenc
-                                                            // count of plugin
-    FLOG(_L("    finalclosing"));
-    REComSession::FinalClose();
-    }
-
-
-// --------------------------------------------------------------------------
-// StaticDoFinalizeUpdate
-// Intermediate function
-// --------------------------------------------------------------------------
-static TInt StaticDoFinalizeUpdate(TAny *aPtr)
-    {
-    FLOG(_L("[cfotaserver] StaticDoFinalizeUpdate() >>"));
-    CFotaServer* srv = (CFotaServer*) aPtr;
-    TRAPD( err,  srv->DoFinalizeUpdateL() );
-    if(err)
-        {
-        FLOG(_L("[cfotaserver] StaticDoFinalizeUpdate ERROR %d"),err);
-        }
-
-    FLOG(_L("[cfotaserver] StaticDoFinalizeUpdate() <<"));
-    return err;
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::FinalizeUpdate()
-// Initialize finalization of updater
-// --------------------------------------------------------------------------
-//
-void CFotaServer::FinalizeUpdateL()
-    {
-    FLOG(_L("CFotaServer::FinalizeUpdate() >>"));
-    if ( iUpdateFinalizer )
-        {
-        iUpdateFinalizer->Cancel();
-        delete iUpdateFinalizer;
-        iUpdateFinalizer=NULL;
-        }
-    iUpdateFinalizer = CPeriodic::NewL (EPriorityNormal) ;
-    iUpdateFinalizer->Start (
-                TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-                ,TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-                ,TCallBack(StaticDoFinalizeUpdate,this) ) ;
-    FLOG(_L("CFotaServer::FinalizeUpdate() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoFinalizeUpdateL
-// Finalize update. Free resources
-// --------------------------------------------------------------------------
-//
-void CFotaServer::DoFinalizeUpdateL()
-    {
-    FLOG(_L("CFotaServer::DoFinalizeUpdateL() >>"));
-
-    // Free resources
-    FLOG(_L("iupdater = %d"), iUpdater);
-    if ( iUpdater ) 
-        {
-        FLOG(_L("Deleting iupdater..."));
-        iUpdater->Cancel();
-        delete iUpdater; 
-        iUpdater=NULL;
-        }
-    
-    if ( iUpdateFinalizer ) 
-        {
-        iUpdateFinalizer->Cancel();
-        }
-    // Hide UI
-    iParentApp->SetUIVisibleL ( EFalse, ETrue );
-    FLOG(_L("CFotaServer::DoFinalizeUpdateL() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// StaticDoFinalizeDownload
-// Intermediate function
-// --------------------------------------------------------------------------
-static TInt StaticDoFinalizeDownload(TAny *aPtr)
-    {
-    FLOG(_L("[cfotaserver] StaticDoFinalizeDownload() >>"));
-    CFotaServer* srv = (CFotaServer*) aPtr;
-    TRAPD( err,  srv->DoFinalizeDownloadL() );
-    if(err)
-        {
-        FLOG(_L("[cfotaserver] StaticDoFinalizeDownload ERROR %d"),err);
-        }
-
-    FLOG(_L("[cfotaserver] StaticDoFinalizeDownload() <<"));
-    return err;
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::FinalizeDownload
-// Initialize finalization of download
-// --------------------------------------------------------------------------
-//
-void CFotaServer::FinalizeDownloadL( const TPackageState& aDLState )
-    {
-    FLOG(_L("CFotaServer::FinalizeDownload() >> state:%d result:%d")
-                ,aDLState.iState, aDLState.iResult);
-    __ASSERT_ALWAYS( iDownloader, User::Panic(KFotaPanic, KErrBadHandle ));
-    
-    SetStartupReason(EFotaDefault);
-          
-    if ( iDownloadFinalizer )
-        {
-        iDownloadFinalizer->Cancel();
-        delete iDownloadFinalizer;
-        iDownloadFinalizer=NULL;
-        }
-    iDownloadFinalizer = CPeriodic::NewL (EPriorityMuchMore) ;
-    iDLFinalizeState = aDLState;
-    
-    // Not restarting,quick finalize
-    if ( iDownloader->iRestartCounter<=0 )
-        {
-        iDownloadFinalizer->Start(
-                        TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-                        ,TTimeIntervalMicroSeconds32(KDownloadFinalizerWaitTime)
-                        ,TCallBack(StaticDoFinalizeDownload,this) ) ;
-        }
-    // Restarting, wait some time
-    else
-        {
-        iDownloadFinalizer->Start(
-                        TTimeIntervalMicroSeconds32(2000000)
-                        ,TTimeIntervalMicroSeconds32(2000000)
-                        ,TCallBack(StaticDoFinalizeDownload,this) ) ;
-        }
-    FLOG(_L("CFotaServer::FinalizeDownload() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoFinalizeDownloadL
-// Finalize download. Free resources
-// --------------------------------------------------------------------------
-//
-void CFotaServer::DoFinalizeDownloadL()
-    {
-    FLOG(_L("CFotaServer::DoFinalizeDownloadL() >> state:%d result:%d")
-            ,iDLFinalizeState.iState, iDLFinalizeState.iResult );
-    __ASSERT_ALWAYS( iDownloader, User::Panic(KFotaPanic, KErrBadHandle ));
-    
-    if ( iDownloadFinalizer ) 
-        {
-        iDownloadFinalizer->Cancel();
-        }
-
-    if (iDownloader->iDLState.iState == RFotaEngineSession::EDownloadFailed)
-        StoragePluginL()->DeleteUpdatePackageL ( iDownloader->iDLState.iPkgId );
-        
-    // Download not to be restarted, delete
-    if ( iDownloader ) 
-    {
-    	if ( iDownloader->iRestartCounter<=0 )
-        {
-        // Set downloader's ending state to DB
-        iDatabase->OpenDBL();
-        iDatabase->SetStateL(iDLFinalizeState
-                            ,KNullDesC8,EFDBState|EFDBResult);
-        iDatabase->CloseAndCommitDB();
-
-        iDownloader->SetDownloadActive(EFalse);
-        iParentApp->SetUIVisibleL( EFalse,ETrue);
-
-        // Initiate update 
-        if ( iDownloader && iDownloader->iUpdateAfterDownload )
-            {
-            UpdateL( iDownloader->iDLState );  
-            }
-        // Report status to DM server
-        else
-            {
-            if (iDownloader->iDLState.iState == RFotaEngineSession::EDownloadProgressingWithResume )
-            	{
-            	if (iDownloader->IsFMSEnabled())
-                	{
-                	FLOG(_L("Invoking FMS..."));
-                	InvokeFmsL();
-                	SetStartupReason(EFotaDownloadInterrupted);
-                	}
-            	}
-            else
-            	{
-            	CreateDeviceManagementSessionL( iDownloader->iDLState );
-            	}
-            }
-
-        // Free resources
-        if ( iDownloader ) 
-            {
-            iDownloader->Cancel();
-			iDownloader->CancelDownload (ETrue);
-            delete iDownloader; 
-            iDownloader=NULL;
-            }
-        TInt val (EFalse);
-        TInt err = RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaDMRefresh, val );
-        if (val!=EFalse)
-        	err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaDMRefresh, EFalse );
-        FLOG(_L("RProperty KFotaDMRefresh EFalse, err = %d"), err);
-        }
-      }
-    // Download to be restarted
-    else
-        {
-        __ASSERT_ALWAYS( iDownloader->iUrl
-                ,User::Panic(KFotaPanic, KErrBadHandle ));
-        FLOG(_L(" Restarting download(iRestartCounter %d)"),iDownloader->iRestartCounter);
-
-        // Reuse url and iapid
-        HBufC8* url = iDownloader->iUrl->AllocLC();
-        TInt    iapid = iDownloader->iDLState.iIapId;
-
-        TBool   update= iDownloader->iUpdateAfterDownload;
-        TInt    restart=iDownloader->iRestartCounter;
-        
-        iDownloader->CancelDownload( EFalse ); //Doesn't actually deletes downloads when S&R feature is supported.
-      
-        iDownloader->DownloadL( iDLFinalizeState , *url,update,iapid, restart);
-        CleanupStack::PopAndDestroy( url );
-        }
-
-
-    FLOG(_L("CFotaServer::DoFinalizeDownloadL() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// StaticDoCloseSMLSession 
-// Intermediate function
-// --------------------------------------------------------------------------
-static TInt StaticDoCloseSMLSession ( TAny *aPtr )
-    {
-    FLOG(_L("[cfotaserver] StaticDoCloseSMLSession() >>"));
-    CFotaServer* srv = (CFotaServer*) aPtr;
-    TRAPD( err,  srv->DoCloseSMLSessionL() );
-    if(err)
-        {
-        FLOG(_L("[cfotaserver] StaticDoCloseSMLSession ERROR %d"),err);
-        }
-
-    FLOG(_L("[cfotaserver] StaticDoCloseSMLSession() <<"));
-    return err;
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoCloseSMLSessionL
-// Close syncml session, or resync
-// --------------------------------------------------------------------------
-//
-void CFotaServer::DoCloseSMLSessionL()
-    {
-    FLOG(_L("CFotaServer::DoCloseSMLSessionL() >>"));
-
-    // Must still try to sync
-    if ( iSyncMLAttempts > 0 )
-        {
-        FLOG(_L("   trycount %d => creating new job"),iSyncMLAttempts);
-	    RSyncMLDevManJob    dmJob;
-    	if(iIapId > KErrNotFound)
-    		{
-    		FLOG(_L("DoCloseSMLSessionL new job uses iap from fotadb %d"),
-    				iIapId);
-    		dmJob.CreateL( iSyncMLSession, iSyncProfile,iIapId );
-    		}
-    	else
-    		{
-    		FLOG(_L("DoCloseSMLSessionL new job uses iap from profile"));
-    		dmJob.CreateL( iSyncMLSession, iSyncProfile );
-    		}
-			iSyncMLAttempts--;
-			iSyncJobId = dmJob.Identifier();
-	    dmJob.Close();
-        }
-    else 
-    // We ran out of attempts, close sml
-        {
-        if ( iSyncMLSession.Handle() ) 
-            {
-            FLOG(_L("   Closing syncml session"));
-            iSyncMLSession.CancelEvent();
-            iSyncMLSession.Close();
-            }
-        } 
-
-    if ( iTimedSMLSessionClose ) 
-        {
-        FLOG(_L("   closing smlsession timer"));
-        iTimedSMLSessionClose->Cancel();
-        delete iTimedSMLSessionClose;
-        iTimedSMLSessionClose = NULL;
-        }
-
-    FLOG(_L("CFotaServer::DoCloseSMLSessionL() <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::ReadChunkL
-// Read data from chunk created by client.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::ReadChunkL( const TInt aSize,TInt aError )
-	{
-    __ASSERT_ALWAYS( aSize>=0 , User::Panic(KFotaPanic, KErrArgument) );
-    TUint8* b = iChunk.Base();
-    TPtr8   data(b, aSize, aSize );
-
-    iStorage->iBytesWritten += aSize;
-    FLOG(_L("     CFotaServer::ReadChunkL  >>  reading %d bytes"),aSize);
-    if (iStorageStream && aError !=KErrServerTerminated &&
-    		aError !=KErrDiskFull )
-       {FLOG(_L("     CFotaServer::ReadChunkL  >>  inside if(iStorageStream)"));
-       TRAPD ( err, iStorageStream->WriteL(data) );
-
-       if ( !err ) 
-           {
-           iStorageStream->CommitL();
-           }
-       else
-    	  {
-          FLOG(_L("Error when writing pkg %d"), err);
-          iStorageStream->Close();
-          iStorageStream = NULL;
-          User::Leave ( err );
-          }
-       }  
-    FLOG(_L("     CFotaServer::ReadChunkL  << "));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::OpenUpdatePackageStoreL 
-// Opens package store. Calling chain in case of oma DL:  
-// fotaserver->downloadmgr->codhandler->fotaserver  (subject to change, 
-// depending on downloadmgr&codhandler changes)
-// Fotaadapter calls this function in direct way: fotaadapter->fotaserver
-//
-// --------------------------------------------------------------------------
-//
-void CFotaServer::OpenUpdatePackageStoreL ( const RMessage2& aMessage )
-    {
-    FLOG(_L("CFotaServer::OpenUpdatePackageStoreL  >>"));
-
-    // If chunk is already open, bail out
-    THandleInfo     info;
-    TInt            pkgid;
-    iChunk.HandleInfo(&info);
-    
-     
-    if(info.iNumOpenInProcess>0)
-        {
-        FLOG(_L("CFotaServer::SetChunkHandleL  chunk is open %d times by \
-            current process (%d times in thread)"),info.iNumOpenInProcess
-            ,info.iNumOpenInThread);
-        User::Leave(KErrInUse);
-        }
-
-    // Set package state 
-    pkgid = aMessage.Int0();
-    iStorageDownloadPackageId = pkgid;
-
-    TPackageState   state = GetStateL(pkgid);
-
-    // AS  16.02.05: must be in failed state until complete
-
-    FLOG(_L("CFotaServer::OpenUpdatePackageStoreL  opening update pkg storage\
-                ffor pkgid: %d "),pkgid);
-
-    TInt size2 = state.iPkgSize;
-    // Use storage api to save update pkg 
-    StoragePluginL()->OpenUpdatePackageStoreL(pkgid,size2, iStorageStream);
-
-    User::LeaveIfError( iChunk.Open(aMessage,1,EFalse) );
-	TInt err = RProperty::Define( TUid::Uid(KFotaServerUid),
-					KFotaLrgObjDl,RProperty::EInt,
-					KReadPolicy,  KWritePolicy );
-	TInt    err1 = RProperty::Set( TUid::Uid(KFotaServerUid),
-			KFotaLrgObjDl, KErrNotFound );
-	FLOG(_L("CFotaServer::OpenUpdatePackageStoreL err for KFotaLrgObjDl define is %d err is %d"),
-			err,err1 );  
-	err = RProperty::Define( TUid::Uid(KFotaServerUid),
-				KFotaLrgObjProfileId,RProperty::EInt,
-				KReadPolicy,KWritePolicy );
-	err1 = RProperty::Set( TUid::Uid(KFotaServerUid),
-						KFotaLrgObjProfileId, KErrNotFound );
-	FLOG(_L("CFotaServer::OpenUpdatePackageStoreL err for KFotaLrgObjProfileId define is %d err is %d"),
-			err,err1 );  
-    FLOG(_L("CFotaServer::OpenUpdatePackageStoreL  <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetDownloadUpdatePackageSizeL 
-// Gets the downloaded update package size in bytes
-// --------------------------------------------------------------------------
-//
-void CFotaServer::GetDownloadUpdatePackageSizeL (const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize)
-	{
-	FLOG(_L("CFotaServer::GetDownloadUpdatePackageSize, aPkgId = %d  >>"),aPkgId);
-	TPackageState temp;
-
-	//Getting the total package size from database.
-	iDatabase->OpenDBL();
-	temp = iDatabase->GetStateL(aPkgId);
-	iDatabase->CloseAndCommitDB();
-	
-	FLOG(_L("fota state for given pkg id is = %d"),temp.iState);
-	if (temp.iState == RFotaEngineSession::EDownloadProgressing
-			|| temp.iState == RFotaEngineSession::EDownloadProgressingWithResume
-			|| temp.iState == RFotaEngineSession::EDownloadComplete
-			|| temp.iState == RFotaEngineSession::EStartingUpdate)
-		{
-		aTotalSize = temp.iPkgSize;
-		//Getting the downloaded update package size from storage pluggin.
-		StoragePluginL()->GetDownloadedUpdatePackageSizeL(aPkgId, aDownloadedSize);
-		}
-	else
-		{
-		FLOG(_L("No progressing/suspended/completed download corresponding to the given pkgid (%d)"),aPkgId);
-		User::Leave (KErrNotFound);
-		}
-
-	
-	FLOG(_L("CFotaServer::GetDownloadUpdatePackageSize, aDownloadedSize = %d, aTotalSize = %d  <<"),aDownloadedSize, aTotalSize);
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::TryResumeDownloadL 
-// Tries to resume the download operation
-// --------------------------------------------------------------------------
-//
-void CFotaServer::TryResumeDownloadL(TBool aUserInitiated)
-	{
-	FLOG(_L("CFotaServer::TryResumeDownloadL, aUserInitiated = %d  >>"),aUserInitiated);
-	//Check whether there is a paused resume actually.
-	if(aUserInitiated)
-	    iUserResume = ETrue;
-	else
-	    iUserResume = EFalse;
-	TPackageState temp = GetStateL(-1); //Gets the state of the current/last fota download
-	iSessMode = temp.iSessionType;
-	FLOG(_L("iSessMode = %d ,temp.iSessionType=%d  "),iSessMode,
-	            temp.iSessionType);	
-	if ( temp.iState != RFotaEngineSession::EDownloadProgressingWithResume )
-		{
-		FLOG(_L("There are no paused downloads currently; hence leaving with KErrNotFound..."));
-		User::Leave (KErrNotFound);
-		}
-
-	//Resume download now
-    if(!iDownloader)
-        {
-        FLOG(_L("Creating new idownloader"));
-        iDownloader = CFotaDownload::NewL( this );
-        }
-    if (iDownloader->IsDownloadActive())
-    	{
-    	FLOG(_L("Another download is already active, hence returning..."));
-    	User::Leave (KErrAlreadyExists);
-    	}
-    iDownloader->iDLState = temp;
-	SetStartupReason(EFotaDownloadInterrupted);
-    iDownloader->TryResumeDownloadL(aUserInitiated);
-	
-	FLOG(_L("CFotaServer::TryResumeDownloadL  <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::InvokeFmsL 
-// Starts Fota Monitory Service with relevant parameters for monitoring.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::InvokeFmsL()
-	{
-	FLOG(_L("CFotaServer::InvokeFmsL  >>"));
-	//Collect all information needed to invoke FMS.
-	TPackageState temp = GetStateL(iDownloader->iDLState.iPkgId);
-	FLOG(_L("State as recorded in fota db:"));
-	FLOG(_L("iPkgId = %d"),temp.iPkgId);
-	FLOG(_L("iProfileId = %d"),temp.iProfileId);
-	FLOG(_L("iPkgName = %S"),&temp.iPkgName);
-	FLOG(_L("iPkgVersion = %S"),&temp.iPkgVersion);
-	FLOG(_L("iSendAlert = %d"),temp.iSendAlert);
-	FLOG(_L("iIapId = %d"),temp.iIapId);
-	FLOG(_L("iPkgSize = %d"),temp.iPkgSize);
-	FLOG(_L("iSessionType = %d"),temp.iSessionType);
-	FLOG(_L("iState = %d"),temp.iState);
-	FLOG(_L("iResult = %d"),temp.iResult);
-	
-	
-	//Finding the reason for download interrupt
-	TOmaDLInterruptReason reason (EGeneralInterrupt); // 3
-	
-	switch (iDownloader->iDLState.iResult)
-	{
-	case RFotaEngineSession::EResUserCancelled:
-		{
-		reason = EUserInterrupt; //0
-		break;
-		}
-	case RFotaEngineSession::EResDLFailDueToNWIssues:
-		{
-		reason = ENetworkInterrupt; //1
-		break;
-		}
-	case RFotaEngineSession::EResDLFailDueToDeviceOOM:
-		{
-		reason = EMemoryInterrupt;   //2
-		break;
-		}
-	default:
-		{
-		//reason is already EGeneralInterrupt
-		break;
-		}
-	}
-	//FotaState has the last successfully worked IAP. Hence use this for FMS monitoring.
-//	TInt apid = iDownloader->iDLState.iIapId;
-	TInt apid = temp.iIapId;
-	
-	//Finding the drive number
-	TBuf8<KMaxPath> path8;
-	path8.Zero();
-	StoragePluginL()->GetUpdatePackageLocationL(iDownloader->iDLState.iPkgId, path8);
-	TPath path16;
-	path16.Copy(path8);
-
-
-    TInt drive (EDriveC ); //Default drive is Phone Memory
-	TParse p;
-    if (!p.Set(path16,NULL,NULL))
-    	{
-    	TDriveName drivename(p.Drive());
-    	TDriveUnit driveunit(drivename);
-    	if (iFs.IsValidDrive((TInt) driveunit))
-    		drive = driveunit;
-    	}
-    else
-    	{
-    	FLOG(_L("Error while parsing for drive number! defaulting to Phone Memory (C)"));
-    	}
-
-    TInt dlsize, tsize;
-    GetDownloadUpdatePackageSizeL(iDownloader->iDLState.iPkgId, dlsize, tsize);
-	TInt neededsize = tsize - dlsize;
-	FLOG(_L("Launching FMS with params... reason = %d, iapid = %d, drive = %d, neededsize = %d"),reason, apid, drive, neededsize);
-	iFMSClient.OpenL();
-	iFMSClient.NotifyForResumeL( reason, apid, (TDriveNumber)drive, neededsize );
-	iFMSClient.Close();
-	
-	FLOG(_L("CFotaServer::InvokeFmsL  <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::CancelFmsL 
-// Cancels any outstanding monitoring requests in Fota Monitory Service
-// --------------------------------------------------------------------------
-//
-void CFotaServer::CancelFmsL()
-	{
-	FLOG(_L("CFotaServer::CancelFmsL  >>"));
-	
-	iFMSClient.OpenL();
-	iFMSClient.CancelNotifyForResume();
-	iFMSClient.Close();
-	
-	FLOG(_L("CFotaServer::CancelFmsL  <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::SetStartupReason 
-// Sets the startup reason for Fota. This is used in Fota Startup pluggin.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::SetStartupReason(TInt aReason)
-	{
-	FLOG(_L("CFotaServer::SetStartupReason, aReason = %d  >>"), aReason);
-	
-	CRepository* centrep = NULL;
-    TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) )
-    if (err==KErrNone ) 
-    	{
-         centrep->Set(  KFotaUpdateState, aReason );
-        }
-    delete centrep;
-    centrep = NULL;
-
-	FLOG(_L("CFotaServer::SetStartupReason  <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::~CFotaServer()
-// Frees database, download, chunk, filewriter, etc resources
-// --------------------------------------------------------------------------
-//
-CFotaServer::~CFotaServer()
-	{
-    FLOG(_L("CFotaServer::~CFotaServer  >>"));
-
-    if(iDatabase)
-        {
-        iDatabase->CloseAndCommitDB();
-        delete iDatabase;
-        iDatabase = NULL;
-        }
-
-    if(iDownloader)
-        {
-        iDownloader->Cancel();
-        delete iDownloader;
-        iDownloader = NULL;
-        }
-
-    if(iUpdater)
-        {
-        iUpdater->Cancel();
-        delete iUpdater;
-        iUpdater = NULL;
-        }
-
-    if(iDownloadFinalizer) 
-        {
-        iDownloadFinalizer->Cancel();
-        delete iDownloadFinalizer;
-        iDownloadFinalizer = NULL;
-        }
-
-    if(iUpdateFinalizer)
-        {
-        iUpdateFinalizer->Cancel();
-        delete iUpdateFinalizer;
-        iUpdateFinalizer = NULL;
-        }
-
-    if ( iTimedExecuteResultFile ) 
-        {
-        iTimedExecuteResultFile->Cancel();
-        delete iTimedExecuteResultFile;
-        iTimedExecuteResultFile = NULL;
-        }
-
-    if ( iAppShutter )
-        {
-        iAppShutter->Cancel();
-        delete iAppShutter;
-        iAppShutter=NULL;
-        }
-        
-    if ( iMonitor )    
-    	{
-    	delete iMonitor;
-    	iMonitor = NULL;
-    	}
-    //don't delete iEikEnv, fw will take care.
-    if (iChunk.Handle())
-    	iChunk.Close();
-    
-    if (iStorageStream) {
-    	TRAP_IGNORE(iStorageStream->CommitL());
-    	iStorageStream->Close();
-    	iStorageStream = NULL;
-    }
-    iSyncMLSession.Close();
-    TRAP_IGNORE( UnLoadStoragePluginL () );
-    iFs.Close();
-    
-    
-    if (iFMSClient.Handle())
-    	iFMSClient.Close();
-
-	if ( iNotifHandler ) 
-		{
-		iNotifHandler->Cancel();
-		delete iNotifHandler;        
-		}
-	TInt err = RProperty::Delete(TUid::Uid(KFotaServerUid),
-    		KFotaLrgObjDl);
-    FLOG( _L( "CFotaServer::~CFotaServer err for KFotaLrgObjDl is %d " ),err );  
-    err = RProperty::Delete(TUid::Uid(KFotaServerUid),
-    		KFotaLrgObjDl);
-    FLOG( _L( "CFotaServer::~CFotaServer err for KFotaLrgObjProfileId is %d " ),err );  
-    err = RProperty::Delete(TUid::Uid(KFotaServerUid),
-    		KFotaLrgObjProfileId);    
-    
-    if (iDEController)
-        {
-        delete iDEController;
-        iDEController = NULL;
-        }
- 
-	FLOG(_L("CFotaServer::~CFotaServer  <<"));  
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaServer::UpdatePackageDownloadCompleteL
-// Sets state and package streaming related objects. If this is child
-// fotaserver (not largeobject), don't set state since parent fotaserver does
-// it.
-// ---------------------------------------------------------------------------
-void CFotaServer::UpdatePackageDownloadCompleteL(TBool aLargObj
-                                                        , const TInt aPkgId)
-    {
-    FLOG(_L("CFotaServer::UpdatePackageDownloadCompleteL %d >>"),aPkgId);
-    TInt        pkgid(aPkgId);
-
-    // Set state in case of lrg obj download 
-    // If not lrg ob download, calling app sets state
-    if (aLargObj)
-        {
-        TPackageState s;
-        s.iPkgId = aPkgId;
-        s.iState = RFotaEngineSession::EStartingUpdate;
-        iDatabase->OpenDBL();
-        iDatabase->SetStateL( s,KNullDesC8,EFDBState );
-        iDatabase->CloseAndCommitDB();
-        //To refresh in DM UI for OMA DM large object
-        TInt err = RProperty::Define( TUid::Uid(KOmaDMAppUid),
-				KFotaDMRefresh,
-				RProperty::EInt,KReadPolicy,KWritePolicy);
-		FLOG(_L("CFotaServer::UpdatePackageDownloadCompleteL KFotaDMRefresh Define, err = %d")
-														, err);        
-		if (err != KErrAlreadyExists && err != KErrNone)
-			{
-			User::LeaveIfError(err);
-			}
-		//notify DM UI, EFalse indicates no Download going on 
-		err = RProperty::Set( TUid::Uid(KOmaDMAppUid),
-				KFotaDMRefresh,
-				EFalse );
-		FLOG(_L("RProperty KFotaDMRefresh Set ETrue, err = %d"), err);           
-        }
-    // Free resources
-    iChunk.Close();
-    iStorage->UpdatePackageDownloadCompleteL(pkgid);
-    FLOG(_L("CFotaServer::UpdatePackageDownloadCompleteL %d <<"),aPkgId);
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaServer::DeletePackageL 
-// Deletes update package from db
-// ---------------------------------------------------------------------------
-void CFotaServer::DeletePackageL ( const TInt aPkgId)
-    {
-    FLOG(_L("CFotaServer::DeletePackageL  >> id %d"),aPkgId );
-   // TInt err;
-
-    StoragePluginL()->DeleteUpdatePackageL ( aPkgId );
-//    User::LeaveIfError( err );
-    FLOG(_L("CFotaServer::DeletePackageL  <<") );
-    }
-
-
-// ---------------------------------------------------------------------------
-//  CFotaServer::DownloadL
-//  Create package downloader and download update package.
-// ---------------------------------------------------------------------------
-void CFotaServer::DownloadL(TDownloadIPCParams aParams, const TDesC8& aPkgURL)
-    {
-    FLOG(_L("[FotaServer]  Download >>"));
-
-    // If download already in progress, delete it
-    if ( iDownloader )
-        {
-        FLOG(_L("CFotaServer::DownloadL already downloading!"));
-        User::Leave (KErrAlreadyExists);
-        }
-    
-    if(!iDownloader)
-        {
-        iDownloader = CFotaDownload::NewL( this );
-        }
-        
-        TBuf<KSysVersionInfoTextLength> temp;
-    if (GetSoftwareVersion(temp) == KErrNone)
-        {
-        
-          RFileWriteStream    wstr;
-        	CleanupClosePushL ( wstr );
-        	TInt err1=wstr.Replace( iFs,KSWversionFile, EFileWrite  );
-        	if(err1==KErrNone)
-        	{
-           HBufC16*             swv;
-           swv = HBufC16::NewLC ( temp.Length() );
-           swv->Des().Copy( temp );
-           wstr.WriteInt16L( swv->Des().Length()); // length  
-           wstr.WriteL( swv->Des() );
-           wstr.WriteInt16L( 0 );
-           CleanupStack::PopAndDestroy( swv );
-               
-          }                           
-                                        
-        	CleanupStack::PopAndDestroy( &wstr ); // wstr      
-        }
-    
-    iDownloader->DownloadL(aParams,aPkgURL,EFalse);
-    FLOG(_L("[FotaServer]  Download <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::DownloadAndUpdateL
-// Downloads update package and updates fw
-// --------------------------------------------------------------------------
-//
-void CFotaServer::DownloadAndUpdateL(TDownloadIPCParams aParams 
-                                            ,const TDesC8& aPkgURL)
-    {
-    FLOG(_L("CFotaServer::DownloadAndUpdateL >>"));
-
-    // If download already in progress, delete it
-    if ( iDownloader )
-        {
-        FLOG(_L("CFotaServer::DownloadAndUpdateL already downloading!"));
-        User::Leave (KErrAlreadyExists);
-        }
-    if (!iDownloader)
-        {
-        iDownloader = CFotaDownload::NewL(this);
-        }
-        TBuf<KSysVersionInfoTextLength> temp;
-    if (GetSoftwareVersion(temp) == KErrNone)
-        {
-        	RFileWriteStream    wstr;
-        	CleanupClosePushL ( wstr );
-          TInt err = wstr.Replace( iFs ,KSWversionFile, EFileWrite );
-         if(err ==KErrNone) 
-          {
-          HBufC16*             swv;
-          swv = HBufC16::NewLC ( temp.Length( ) );
-          swv->Des().Copy( temp );
-          wstr.WriteInt16L( swv->Des().Length()); // length  
-          wstr.WriteL( swv->Des() );
-          wstr.WriteInt16L( 0 );
-          CleanupStack::PopAndDestroy( swv );
-                
-          }       
-                                 
-         CleanupStack::PopAndDestroy( &wstr ); // wstr                                   
-        	
-        }
-    iDownloader->DownloadL( aParams,aPkgURL,ETrue );
-    FLOG(_L("CFotaServer::DownloadAndUpdateL <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::UpdateL
-// Start update 
-// --------------------------------------------------------------------------
-//
-void CFotaServer::UpdateL( const TDownloadIPCParams &aParams )
-    {
-    FLOG(_L("CFotaServer::UpdateL  >>"));
-    
-     TBool isPkgvalid(ETrue);
-     isPkgvalid = CheckSWVersionL();
-      
-    if (isPkgvalid)
-        {
-        	
-        FLOG(_L("CFotaServer::UpdateL  package is valid >>"));	
-        if(!iUpdater)
-            {
-            iUpdater = CFotaUpdate::NewL(this);
-            }
-        iUpdater->StartUpdateL( aParams );
-        }
-    else
-        {
-        FLOG(_L("IMPORTANT:: Firmware version mismatch! Resetting fota state"));
-        ResetFotaStateL(aParams);
-        }
-       
-        FLOG(_L("CFotaServer::UpdateL  <<"));  
-    }
-
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::CheckSWVersionL
-// Check the s/w version
-// --------------------------------------------------------------------------
-//
-
-TBool CFotaServer::CheckSWVersionL()
-
-{
-	
-	
-	  FLOG(_L("CFotaServer::CheckSWVersionL  >>"));  
-	 TBuf<KSysVersionInfoTextLength> temp;
-    HBufC16*            message16=NULL;
-    TBool isPkgvalid(ETrue);
-    if (GetSoftwareVersion(temp) == KErrNone)
-        {
-          
-         //TBuf<KSysVersionInfoTextLength>swvfromfile;
-        //Fetch the software version ...
-        RFileReadStream     rstr;
-        TInt err1=rstr.Open(iFs,KSWversionFile ,EFileRead);
-        if(err1== KErrNone)
-        {
-         CleanupClosePushL( rstr );
-         TInt msglen = rstr.ReadInt16L(); 
-         if(msglen > 0)
-         { 
-          	message16         = HBufC16::NewLC(msglen + 1);
-        	 TPtr16 tempswv = message16->Des();
-        	 TRAPD(err, rstr.ReadL(tempswv,msglen ));
-        	        
-           if ( err != KErrNone && err != KErrEof)
-            {
-             FLOG(_L("  file read err %d"),err); //User::Leave( err ); 
-              msglen =0;
-            }
-           else
-           { 
-            FLOG(_L("  msglen  %d"),msglen); 
-            TPtr swvfromfile = message16->Des();
-                     
-            FLOG(_L("  swvfromfile=%S"),message16); 
-            
-             //Compare the software versions to decide whether the download is still valid or not.
-              if (msglen != temp.Length() || temp.Compare(tempswv)!=KErrNone)
-              {
-        	     isPkgvalid = EFalse;
-        	      FLOG(_L("CFotaServer::software not matching  >>"));
-        	
-              }
-            } 
-          
-             CleanupStack::PopAndDestroy( message16 );
-         }    
-            CleanupStack::PopAndDestroy( &rstr ); 
-            
-            
-        }
-        
-       } 
-       
-        FLOG(_L("CFotaServer::CheckSWVersionL  <<"));  
-       return isPkgvalid;
-	
-	
-}	
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::ScheduledUpdateL
-// Update, triggered by scheduler
-// --------------------------------------------------------------------------
-void CFotaServer::ScheduledUpdateL( TFotaScheduledUpdate aUpdate )
-    {
-    FLOG(_L("CFotaServer::ScheduledUpdateL"));
-    TPackageState s = GetStateL( aUpdate.iPkgId );
-
-    // If update is in progress, do not start new one (multiple popups)
-    if ( iUpdater )
-    	{
-    	FLOG(_L("\t\tupdate in progress"));
-		return;
-    	}
-	else
-		{
-		
-		//Check to find whether the user has already installed the package before the
-		//reminder could expire
-		
-		RFs aRfs;
-		RDir aDir;
-		TEntryArray anArray;
-		User::LeaveIfError(aRfs.Connect());
-		
-		
-		TBuf16<KMaxFileName> temp;
-		temp.Zero();
-		temp.Copy(KSwupdPath8);
-		
-		if(aDir.Open(aRfs,temp,KEntryAttNormal)==KErrNone)
-		{
-			TInt error = aDir.Read(anArray);	
-		}
-		aDir.Close();
-		aRfs.Close();
-	
-		temp.Zero();
-		temp.Copy(KSwupdFileExt8);
-		
-		TBool aStartUpdate(EFalse);
-		
-		for (TInt i=0; i<anArray.Count();i++)
-			{
-			if (anArray[i].iName.Find(temp)!=KErrNotFound)
-				{
-				aStartUpdate = ETrue;
-				break;
-				}
-			}
-		
-		if (aStartUpdate)
-			{
-			FLOG(_L("\t\tReminder expired and update packages found on dir"));
-			iUpdater = CFotaUpdate::NewL(this);
-	    	iUpdater->StartUpdateL( s );
-			}
-		else
-			{
-			FLOG(_L("\t\tReminder expired, but no update package is found on dir; skipping"));
-			}
-		}
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoConnect
-// From CServer2. Initializes class members. 
-// --------------------------------------------------------------------------
-void CFotaServer::DoConnect(const RMessage2 &aMessage)
-    {
-    FLOG(_L("CFotaServer::DoConnect(const RMessage2 &aMessage) >>") );
-
-    // In case shutdown is in progress, cancel it.
-    if ( iAppShutter )
-        {
-        iAppShutter->Cancel();
-        delete iAppShutter;
-        iAppShutter=NULL;
-        }
-
-    if ( iInitialized == EFalse )
-        {
-        TRAPD( err, ClientAwareConstructL( aMessage ) );
-        if ( err ) FLOG(_L("   ClientAwareConstructL err %d"),err);
-        }
-
-    CAknAppServer::DoConnect( aMessage );
-    FLOG(_L("CFotaServer::DoConnect(const RMessage2 &aMessage) <<"));
-    }   
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetStateL
-// Get state of a download package
-// --------------------------------------------------------------------------
-TPackageState CFotaServer::GetStateL( const TInt aPkgId)
-    {
-    TPackageState s=RFotaEngineSession::EIdle;
-
-    if (aPkgId >= 0) // Used by all clients
-    	{
-    	iDatabase->OpenDBL();
-    	s = iDatabase->GetStateL( aPkgId );
-   	    iDatabase->CloseAndCommitDB();
-    	}
-    else if (aPkgId == -2) //Used by DM UI to check if fota ui has to be in foreground
-    	{
-    	TBool value (EFalse);
-    	/** This P&S Key is used to notify DM UI on any download event. key=0 for idle and key=1 for download */     	
-    	TInt err = RProperty::Get(TUid::Uid(KOmaDMAppUid),
-                           KFotaDMRefresh,
-                           value);
-        FLOG(_L("RProperty KFotaDMRefresh Get, err = %d, val = %d"), err,value);
-		if (err==KErrNone && value)
-			{
-			FLOG(_L("Ongoing download operation detected!"));
-			s=RFotaEngineSession::EDownloadProgressing;
-			}
-    	}
-    else if ( aPkgId == -1) //Used by DM UI to get the state of last fota operation
-    	{
-		//Read status from fotastate last entry
-
-    	iDatabase->OpenDBL();
-
-		RArray<TInt>    states;
-        CleanupClosePushL (states);
-        iDatabase->GetAllL ( states );
-        // Loop states. 
-        for(TInt i = 0; i < states.Count(); ++i ) 
-            {
-            TPackageState   tmp;
-            tmp = iDatabase->GetStateL(  states[i]  );
-            FLOG(_L("***Package: %d, State = %d"),states[i],(TInt) tmp.iState);
-            if (tmp.iState!=RFotaEngineSession::EIdle)
-	            {
-            	s=tmp;
-    	        }
-            }
-			FLOG(_L("Status of current operation is %d"),(TInt)s.iState);
-		
-		CleanupStack::PopAndDestroy( &states );
-   	    iDatabase->CloseAndCommitDB();
-    	}
-    return s;
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::IsPackageStoreSizeAvailable 
-// Checks if update package fits into storage
-// --------------------------------------------------------------------------
-//
-TBool CFotaServer::IsPackageStoreSizeAvailableL ( const TInt aSize)
-    {
-    FLOG(_L("CFotaServer::IsPackageStoreSizeAvailableL >>"));
-    TInt size=aSize;
-
-		// Write content size for later use (flexible memory usage)
-		RFileWriteStream str;	
-		TUint32 				size2 = aSize;
-		User::LeaveIfError(str.Replace(iFs, KSizePass, EFileWrite)); 
-		CleanupClosePushL(str);
-		str.WriteUint32L(size2);
-		CleanupStack::PopAndDestroy(1);
-
-    
-    CFotaStorage::TFreeSpace avail = StoragePluginL()->IsPackageStoreSizeAvailableL(size);
-    FLOG(_L("CFotaServer::IsPackageStoreSizeAvailableL <<"));
-    return avail==CFotaStorage::EDoesntFitToFileSystem ? EFalse : ETrue;
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::OnSyncMLSessionEvent
-// --------------------------------------------------------------------------
-//
-void CFotaServer::OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier
-                                       , TInt aError, TInt /*aAdditionalData*/)
-    {
-    if ( iSyncJobId != aIdentifier ) return;
-    FLOG(_L("CFotaServer::OnSyncMLSessionEvent %d err:%d (id %d==%d?)")
-            , aEvent,aError,aIdentifier,iSyncJobId);
-
-    if ( iSyncJobId == aIdentifier )
-	    {
-        TTimeIntervalMicroSeconds32 close(0);
-        TBool end ( EFalse );
-	    switch( aEvent )
-		    {
-            //EJobStart = 0
-            case EJobStartFailed: // 1 E
-                {
-                end = ETrue;
-                }
-			    break;
-            case EJobStop: // 2 E
-                {
-                end = ETrue;
-                // Sync ok => do not try anymore
-                if ( aError == KErrNone ) 
-                    {
-                    iSyncMLAttempts=0;
-                    }
-                }
-			    break;
-            case EJobRejected: // 3 E
-                {
-                end = ETrue;
-                }
-			    break;
-            // ETransportTimeout , // 7
-    	    default:
-                {
-                }
-			    break;
-            }
-
-
-        // sml session OK,close it 
-        if ( end && iSyncMLAttempts == 0 ) 
-            {
-            FLOG(_L("   Sml OK, scheduling close"));
-        	if( aError == KErrNone ) //always ask session successful
-    		  {
-    		  TInt val = KErrNotFound;
-    		  TInt    err1 = RProperty::Get( TUid::Uid(KFotaServerUid),
-    				  KFotaLrgObjDl, val );
-    		  FLOG( _L( "CFotaSrvDocument::OnSyncMLSessionEvent KFotaLrgObjDl val & err is %d, %d" )
-    		  														,val,err1 );  
-    				  if( val == EOmaDmLrgObjDlFail ) //if large object
-    					{
-    					err1 = RProperty::Set( TUid::Uid(KFotaServerUid),
-    							KFotaLrgObjDl, KErrNotFound );
-    					FLOG( _L( "CFotaSrvDocument::OnSyncMLSessionEvent err for KFotaLrgObjDl is %d" )
-    							,err1 );  
-    					err1 = RProperty::Set( TUid::Uid(KFotaServerUid),
-    							KFotaLrgObjProfileId, KErrNotFound );
-    					FLOG( _L( "CFotaSrvDocument::OnSyncMLSessionEvent err for KFotaLrgObjProfileId is %d")
-    																							 ,err1 );  
-    							FLOG( _L( "[FotaServer] CFotaSrvDocument::OnSyncMLSessionEvent pkgid is %d" )
-    									,iStorageDownloadPackageId );  
-    							TRAP_IGNORE(GenericAlertSentL( iStorageDownloadPackageId ));
-    					}
-    		  }
-            close = TTimeIntervalMicroSeconds32( 100000 );
-            }
-        // sml session NOK, retry
-        if ( end && iSyncMLAttempts>0)
-            {
-            FLOG(_L("   Sml OK, scheduling retry"));
-            close = TTimeIntervalMicroSeconds32( KSyncmlSessionRetryInterval);
-            }
-
-        if ( close > TTimeIntervalMicroSeconds32(0) )
-            {
-            if ( iTimedSMLSessionClose ) 
-                {
-                FLOG(_L("   closing smlsession timer"));
-                iTimedSMLSessionClose->Cancel();
-                delete iTimedSMLSessionClose;
-                iTimedSMLSessionClose = NULL;
-                }
-            FLOG(_L("   starting smlsession timer"));
-            TRAPD( err2, iTimedSMLSessionClose = CPeriodic::NewL (EPriorityNormal) );
-            if ( !err2 )
-            	{
-							iTimedSMLSessionClose->Start (
-                close
-                , TTimeIntervalMicroSeconds32( KSyncmlSessionRetryInterval )
-                , TCallBack( StaticDoCloseSMLSession,this ) ) ;
-							}
-							else FLOG(_L(" iTimedSMLSessionClose err %d"),err2);
-            }
-        }
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::TryToShutDownFotaServer()
-// Try to shut down. After last client left, this is tried periodically.
-// --------------------------------------------------------------------------
-//
-TInt CFotaServer::TryToShutDownFotaServer()
-    {
-    RProcess pr; TFullName fn = pr.FullName();  TUint prid = pr.Id();
-	FLOG(_L( "CFotaServer::TryToShutDownFotaServer process(id %d)%S. this 0x%x")
-	                ,prid,&fn,this);
-    FLOG(_L("CFotaServer::TryToShutDownFotaServer()"));
-    FLOG(_L("iSessMode:%d,iUserResume:%d,iNeedToClose:%d"),iSessMode,
-                        iUserResume,iNeedToClose);
-    TBool val (EFalse);
-    if (iNotifHandler)
-    	val = iNotifHandler->IsOpen();
-    if( !iDownloader  && !iUpdater && !iTimedExecuteResultFile 
-        && !iSyncMLSession.Handle() && !iRetryingGASend  && !val
-        && !( iDownloader 
-             && iDownloader->IsDownloadActive() && iUserResume == EFalse /*FMS*/ 
-             && !iNeedToClose ))
-        {
-        
-        FLOG(_L("   shutting down fotaserver"));
-        if (iDownloader && iDownloader->IsDownloadActive() )
-            {
-            FLOG(_L("Shutting down active in TryToShutDownFotaServer..."));
-            StopDownload(RFotaEngineSession::EResUndefinedError);
-            }      
-       	CAknAppServer::HandleAllClientsClosed();
-       	return 1;
-        }
-    else
-        {
-        FLOG(_L("   shutdownwait:%d.%d.%d.%d.%d"), iDownloader,iUpdater
-            , iTimedExecuteResultFile,iSyncMLSession.Handle(),val);
-        }
-    return 0;
-    }
-
-
-// ---------------------------------------------------------------------------
-// StaticApplicationShutter
-// Intermediate function
-// ---------------------------------------------------------------------------
-static TInt StaticApplicationShutter(TAny *aPtr)
-    {
-    __ASSERT_ALWAYS( aPtr, User::Panic(KFotaPanic, KErrArgument) );
-    CFotaServer* srv = (CFotaServer*) aPtr;
-    srv->TryToShutDownFotaServer();
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaServer::HandleAllClientsClosed()
-// Tries to shut down fotaserver. If unsuccesfull, periodically try it again
-// and again and again ...
-// ---------------------------------------------------------------------------
-void CFotaServer::HandleAllClientsClosed()
-    {   
-    FLOG(_L("CFotaServer::HandleAllClientsClosed() >>"));
-
-    if ( TryToShutDownFotaServer() == 0) 
-        {
-        FLOG(_L("   starting application shutdown" ));
-        if ( iAppShutter )
-            {
-            iAppShutter->Cancel();
-            delete iAppShutter;
-            iAppShutter=NULL;
-            }
-        TRAPD ( err , iAppShutter = CPeriodic::NewL (EPriorityNormal) );
-        __ASSERT_ALWAYS( err == KErrNone , User::Panic(KFotaPanic, err) );
-        FLOG(_L("iSessMode = %d iUserResume:%d,iNeedToClose:%d"),
-                iSessMode,iUserResume,iNeedToClose);
-        if (iDownloader && iDownloader->IsDownloadActive() &&
-                !(iUserResume == EFalse /*FMS*/ 
-                  && !iNeedToClose ) )
-        	{
-            FLOG(_L("Shutting down active..."));
-        	StopDownload(RFotaEngineSession::EResUndefinedError);
-        	}
-
-        iAppShutter->Start( KFotaTimeShutDown , KFotaTimeShutDown
-                , TCallBack(StaticApplicationShutter,this) ) ;
-        }
-
-    FLOG(_L("CFotaServer::HandleAllClientsClosed() <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetUpdateTimeStampL 
-// Gets time of last update. It is stored in a file.
-// --------------------------------------------------------------------------
-void CFotaServer::GetUpdateTimeStampL (TDes16& aTime)
-    {
-    FLOG(_L("CFotaServer::GetUpdateTimeStampL  >>"));
-    TInt                err;
-
-    RFileReadStream     rstr;
-    err = rstr.Open( iFs, _L("updatetimestamp"), EFileRead );
-
-    if ( err == KErrNone) 
-        {
-        FLOG(_L(" update time stamp file found,reading"));
-        CleanupClosePushL (rstr);
-        TInt year   =  rstr.ReadInt32L();
-        TInt month  =  rstr.ReadInt32L();    
-        TInt day    =  rstr.ReadInt32L();
-        TInt hour   =  rstr.ReadInt32L();  
-        TInt minute =  rstr.ReadInt32L();
-        TInt year16   = year;
-        TInt month16  = month; 
-        TInt day16    = day;   
-        TInt hour16   = hour;  
-        TInt minute16 = minute;
-        CleanupStack::PopAndDestroy( &rstr );
-        aTime.Append (year16);
-        aTime.Append (month16);
-        aTime.Append (day16);
-        aTime.Append (hour16);
-        aTime.Append (minute16);
-        }
-    else if ( err != KErrNotFound )
-        {
-        User::Leave ( err );
-        }
-
-    if ( err == KErrNotFound ) 
-        {
-        FLOG(_L(" update time stamp not found "));
-        }
-
-    FLOG(_L("CFotaServer::GetUpdateTimeStampL  <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetUpdatePackageIdsL
-// --------------------------------------------------------------------------
-//
-void CFotaServer::GetUpdatePackageIdsL(TDes16& aPackageIdList)
-    {
-    FLOG(_L("CFotaServer::GetUpdatePackageIdsL()"));
-    StoragePluginL()->GetUpdatePackageIdsL( aPackageIdList );
-    }
-
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::GenericAlertSentL
-// Generic alert sent, do cleanup. FUMO spec specifies cleanup need to have 
-// for states 20,70,80,90,100. Called by syncml framework when it has sent
-// generic alert
-// --------------------------------------------------------------------------
-//
-void CFotaServer::GenericAlertSentL( const TInt aPackageID )
-    {
-    FLOG(_L("CFotaServer::GenericAlertSentL %d"), aPackageID);
-    TPackageState   state;
-    TBool           toidle(EFalse);
-    TBool           deletepkg(EFalse);
-
-    iDatabase->OpenDBL();
-    state = iDatabase->GetStateL( aPackageID );
-
-	switch( state.iState  )
-		{
-        case RFotaEngineSession::EDownloadFailed:
-            {
-            toidle = ETrue;
-            deletepkg = ETrue;
-            }
-			break;
-        case RFotaEngineSession::EUpdateFailed:
-            {
-            toidle = ETrue;
-            deletepkg = ETrue;
-            }
-			break;
-        case RFotaEngineSession::EUpdateFailedNoData:
-            {
-            toidle = ETrue;
-            }
-			break;
-        case RFotaEngineSession::EUpdateSuccessful:
-            {
-            toidle = ETrue;
-            deletepkg = ETrue;
-            }
-			break;
-        case RFotaEngineSession::EUpdateSuccessfulNoData:
-            {
-            toidle = ETrue;
-            }
-			break;
-        case RFotaEngineSession::EDownloadComplete:
-        	{
-        	state.iState = RFotaEngineSession::EStartingUpdate;
-        	state.iResult = KErrNotFound;
-            iDatabase->SetStateL( state,KNullDesC8, EFDBState );
-        	toidle = EFalse;
-        	}
-        	break;
-    	default:
-            {
-            FLOG(_L(" pkg %d (state:%d) doesnt need cleanup"), aPackageID
-                        ,state.iState );
-            }
-			break;
-        }
-    
-    if ( toidle )
-        {
-        state.iState = RFotaEngineSession::EIdle;
-        state.iResult = KErrNotFound;
-        iDatabase->SetStateL( state,KNullDesC8, EFDBState|EFDBResult );
-        DeleteFUMOTreeL();
-        }
-
-
-   	SetStartupReason(EFotaDefault);
-
-    iDatabase->CloseAndCommitDB();
-
-    if ( deletepkg )
-        {
-        StoragePluginL()->DeleteUpdatePackageL( aPackageID );
-        }
-
-    // this should already be done when user was notified 
-    // about update result
-    DoDeleteUpdateResultFileL();
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoDeleteUpdateResultFileL
-// Deletes the update resule file
-// --------------------------------------------------------------------------
-void CFotaServer::DoDeleteUpdateResultFileL()
-	{
-    CFotaUpdate::DeleteUpdateResultFileL( iFs );
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::CreateServiceL
-// Creates session object
-// --------------------------------------------------------------------------
-CApaAppServiceBase* CFotaServer::CreateServiceL( TUid aServiceType ) const
-	{
-    FLOG(_L( "CFotaServer::CreateServiceL 0x%x " ), aServiceType.iUid );
-    if ( aServiceType.iUid == KFotaServiceUid )
-        {
-	    return ((CApaAppServiceBase*) (new (ELeave) CFotaSrvSession));
-        }
-    else
-        {
-        return CAknAppServer::CreateServiceL ( aServiceType );
-        }
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetEikEnv
-// Gets the EikonEnv object
-// --------------------------------------------------------------------------
-CEikonEnv* CFotaServer::GetEikEnv()
-	{
-	return iEikEnv;
-	}
-	
-// --------------------------------------------------------------------------
-// CFotaServer::StartNetworkMonitorL       
-// Starts Network Monitoring operation for defined interval and retries (FotaNetworkRegMonitor.h)
-// --------------------------------------------------------------------------
-void CFotaServer::StartNetworkMonitorL()
-	{
-	FLOG(_L("CFotaServer::StartNetworkMonitorL >>"));
-	if (!iMonitor)
-		iMonitor = CFotaNetworkRegStatus::NewL (this);
-	iMonitor->StartMonitoringL();
-	
-	FLOG(_L("CFotaServer::StartNetworkMonitorL <<"));
-	}
-	
-// --------------------------------------------------------------------------
-// CFotaServer::ReportNetworkStatus       
-// called by CFotaNetworkRegStatus for reporting status
-// --------------------------------------------------------------------------
-void CFotaServer::ReportNetworkStatus(TBool status)
-	{
-	FLOG(_L("CFotaServer::ReportNetworkStatus, status = %d >>"),status);
-	iRetryingGASend = EFalse;
-	iNetworkAvailable = status;
-	
-	if (iNetworkAvailable)
-		{
-		TRAPD (err, CreateDeviceManagementSessionL (iStoredState));
-		if (err!=KErrNone)
-			{
-			FLOG(_L("Error %d occured while sending GA after retries"),err);
-			}
-		}
-	//No need of iMonitor anymore	
-    if ( iMonitor )    
-    	{
-    	delete iMonitor;
-    	iMonitor = NULL;
-    	}
-
-	FLOG(_L("CFotaServer::ReportNetworkStatus >>"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::ShutApp 
-// Shuts the DM App ui. This is used when End key is pressed during fota operation.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::ShutApp()
-	{
-	FLOG(_L("CFotaServer::ShutApp >>"));
-	FLOG(_L("Ending DM UI...."));
-	TApaTaskList taskList(GetEikEnv()->WsSession());
-	TApaTask task=taskList.FindApp(TUid::Uid(KOmaDMAppUid));
-	if(task.Exists())
-		{
-		task.EndTask();
-		}
-	FLOG(_L("CFotaServer::ShutApp <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::StopDownload 
-// Stops any ongoing download operation. Depending on the property of download, the later is either paused
-// or cancelled.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::StopDownload(TInt aReason)
-	{
-	FLOG(_L("CFotaServer::StopDownload, aReason = %d >>"), aReason);
-	iUserResume = KErrNotFound;
-	iSessMode = KErrNotFound;
-    if (iDownloader)
-    	{
-        FLOG(_L("stopping fota download"));
-        iNeedToClose  = EFalse;
-        if (iDownloader->IsDownloadResumable())
-    		{
-    		TRAP_IGNORE(iDownloader->RunDownloadSuspendL(aReason));
-    		}
-   		else
-   			{
-   			TRAP_IGNORE(iDownloader->RunDownloadCancelL(aReason));
-   			}
-    	}	
-	FLOG(_L("CFotaServer::StopDownload <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaServer::UpdateDBdataL 
-// For OMA DM large object download failure, this method updates the database
-// and sends the generic alert.
-// --------------------------------------------------------------------------
-//
-void CFotaServer::UpdateDBdataL()
-	{	
-	TInt val(KErrNotFound),UserCancel(KErrNotFound);
-	TInt err = RProperty::Get( TUid::Uid(KFotaServerUid),
-			KFotaLrgObjDl, val);
-	FLOG(_L("CFotaServer::UpdateDBdata KFotaLrgObjDl value & err is %d, %d "),val,err);	
-	//val = 1 means LrgObj Download & its failed , -1 means not lrg object download / stream commited
-	if( val == EOmaDmLrgObjDlFail ) 
-		{
-		err = RProperty::Get( TUid::Uid(KOmaDMAppUid),
-				KDmJobCancel, UserCancel);
-		FLOG(_L("CFotaServer::UpdateDBdataL KDmJobCancel value & err is %d, %d "),UserCancel,err);
-		if( UserCancel == KErrCancel )
-			{			
-			TInt ProfId(KErrNotFound);
-			err = RProperty::Get( TUid::Uid(KFotaServerUid),
-					KFotaLrgObjProfileId, ProfId);
-			FLOG(_L("CFotaServer::UpdateDBdataL KFotaLrgObjProfileId value & err is %d, %d,pkgid is %d "),
-					ProfId,err,iStorageDownloadPackageId);
-			if(iStorageDownloadPackageId > KErrNotFound && ProfId > KErrNotFound )
-				{
-				iDatabase->OpenDBL();
-				FLOG(_L("CFotaServer::UpdateDBdataL after iDatabase->OpenDBL() "));
-				TPackageState state;
-				state.iPkgId = iStorageDownloadPackageId;
-				state.iProfileId  = ProfId;
-				state.iState = RFotaEngineSession::EDownloadFailed;
-				state.iResult = RFotaEngineSession::EResUserCancelled;				
-				iDatabase->SetStateL( state,KNullDesC8, EFDBState | EFDBResult ) ;
-				FLOG(_L("CFotaServer::UpdateDBdataL after iDatabase->SetStateL"));
-				iDatabase->CloseAndCommitDB();		
-				FLOG(_L("CFotaServer::UpdateDBdataL after iDatabase->CloseAndCommitDB "));			    
-				// Free resources
-				iChunk.Close();
-				FLOG(_L("CFotaServer::UpdateDBdataL ,chunk released "));
-				iStorage->UpdatePackageDownloadCompleteL(iStorageDownloadPackageId);		    				
-				CreateDeviceManagementSessionL(state);
-				}
-
-			}
-		}	
-	}
-// --------------------------------------------------------------------------
-// CFotaServer::MonitorBatteryL()
-// Monitors for the battery 
-// 
-// --------------------------------------------------------------------------
-//
-void CFotaServer::MonitorBattery(TInt aLevel)
-{   FLOG(_L("CFotaServer::MonitorBatteryL(), level = %d >>"), aLevel);
-    SetStartupReason(EFotaUpdateInterrupted);
-	RFMSClient fmsclient;
-	TRAPD(err,fmsclient.OpenL());
-	if(err == KErrNone)
-	{ FLOG(_L("CFotaServer::going into FMS client side MonitorBatteryL() >>"));
-		//fmsclient.Cancel();
-	  TRAPD(err1,fmsclient.MonitorForBatteryL(aLevel));
-	   if(err1)
-	   {
-	   	FLOG(_L("CFotaServer:: MonitorBatteryL() left with error %d  >>"), err1);
-	   }
-	  fmsclient.Close();
-	
-	}
-	
-	FLOG(_L("CFotaServer::MonitorBatteryL() <<"));
-  	
-	
-}
-
-// --------------------------------------------------------------------------
-// CFotaServer::CheckIapExistsL 
-// Checks for IAP Id exists or not in commsdb
-// IAP Id used for resuming the download or for sending Generic alert
-// --------------------------------------------------------------------------
-//
-TBool CFotaServer::CheckIapExistsL(TUint32 aIapId)
-    {
-    FLOG(_L("CFotaServer::CheckIapExistsL >>"));
-    TBool exists = EFalse;  
-    RCmManager cmManager;    
-    cmManager.OpenLC();
-    RCmConnectionMethod conn;
-    TRAPD(err, conn = cmManager.ConnectionMethodL( aIapId ));
-    if(err == KErrNone)//connection method exists
-       exists = ETrue;
-    conn.Close();
-    CleanupStack::PopAndDestroy();//cmManager                    
-    FLOG(_L("CFotaServer::CheckIapExistsL <<"));
-    return exists;
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetSoftwareVersion
-// Gets the software version
-// 
-// --------------------------------------------------------------------------
-//
-TInt CFotaServer::GetSoftwareVersion(TDes& aVersion)
-    {
-    FLOG(_L("CFotaServer::GetSoftwareVersion >>"));
-    aVersion.Zero();
-    
-    SysVersionInfo::TVersionInfoType what = SysVersionInfo::EFWVersion;
-    TInt error (KErrNone);
-    error = SysVersionInfo::GetVersionInfo(what,aVersion);
-    FLOG(_L("CFotaServer::GetSoftwareVersion,SwV=%S <<"),&aVersion);
-    return error;
-    }
-    
-// --------------------------------------------------------------------------
-// CFotaServer::ResetFotaStateL
-// Resets the Fotastate
-// 
-// --------------------------------------------------------------------------
-//    
-void CFotaServer::ResetFotaStateL(const TDownloadIPCParams& aParams)
-    {
-    FLOG(_L("CFotaServer::ResetFotaStateL >>"));
-
-    TPackageState state;
-    if (!iDatabase->IsOpen()) iDatabase->OpenDBL();
-    //Fetch the software version that was before download from db.
-    state = iDatabase->GetStateL(aParams.iPkgId);
-    state.iState = RFotaEngineSession::EUpdateFailed;
-    state.iResult = RFotaEngineSession::EResPackageMismatch;
-    iDatabase->SetStateL( state,KNullDesC8, EFDBState | EFDBResult );
-    iDatabase->CloseAndCommitDB();
-    
-    StoragePluginL()->DeleteUpdatePackageL ( aParams.iPkgId );
-    
-    CreateDeviceManagementSessionL(state);
-    
-    FLOG(_L("CFotaServer::ResetFotaStateL <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::SetInstallUpdateClientL 
-// Set's who is the client triggering the update
-// --------------------------------------------------------------------------
-//
-void CFotaServer::SetInstallUpdateClientL(TInt aClient)
-    {    
-    iInstallupdClient = aClient;
-    FLOG(_L("CFotaServer::SetInstallUpdateClientL() client:%d<<"),iInstallupdClient);
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetInstallUpdateClientL 
-// returns the client who triggered the update
-// --------------------------------------------------------------------------
-//
-TInt CFotaServer::GetInstallUpdateClientL()
-    {
-    FLOG(_L("CFotaServer::GetInstallUpdateClientL() client:%d<<"),iInstallupdClient);
-    return iInstallupdClient ;
-    }
-
-// CFotaServer::NeedToDecryptL
-// This method is called to check if decryption is needed.
-// 
-// --------------------------------------------------------------------------
-// 
-TBool CFotaServer::NeedToDecryptL(const TInt &aPkgId, TDriveNumber &aDrive)
-    {
-    FLOG(_L("CFotaServer::NeedToDecryptL >>"));
-    
-    TBool ret (EFalse);
-
-    //Finding the drive number
-    TBuf8<KMaxPath> path8;
-    path8.Zero();
-    StoragePluginL()->GetUpdatePackageLocationL(aPkgId, path8);
-    TPath path16;
-    path16.Copy(path8);
-
-
-    TDriveNumber drive (EDriveC ); //Default drive is Phone Memory
-    TParse p;
-    if (!p.Set(path16,NULL,NULL))
-        {
-        TDriveName drivename(p.Drive());
-        TDriveUnit driveunit(drivename);
-        if (iFs.IsValidDrive((TInt) driveunit))
-            {
-            drive =  (TDriveNumber) driveunit.operator TInt();
-            iStorageDrive = drive;
-            }
-        }
-    else
-        {
-        FLOG(_L("Error while parsing for drive number! defaulting to Phone Memory (C)"));
-        }
-    FLOG(_L("Package storage drive is %d"), (TInt) drive);
-
-    if (!iDEController)
-        {
-        TRAPD(err, iDEController = CDevEncController::NewL(this));
-        if (err == KErrNotSupported)
-            {
-            //Encryption feature is not on.
-            return EFalse;
-            }
-        else
-            {
-            __LEAVE_IF_ERROR(err);
-            }
-        }
-    TRAPD(err, ret = iDEController->NeedToDecryptL(drive));
-    
-    delete iDEController; iDEController = NULL;
-    
-    if (err == KErrNotSupported)
-        {
-        //Encryption feature is ON, but the encryption adaptation is note present.
-        ret = EFalse;
-        }
-    else
-        {
-        __LEAVE_IF_ERROR(err);
-        }
-   
-    //Set the appropriate drive when ret is true
-    if (ret)
-        {
-        aDrive = drive;
-        }
-    
-    FLOG(_L("CFotaServer::NeedToDecryptL ret = %d, drive = %d <<"), ret, drive);
-    return ret;
-
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoStartDecryptionL
-// This method is called to start the decryption operation.
-// 
-// --------------------------------------------------------------------------
-// 
-void CFotaServer::DoStartDecryptionL()
-    {
-    FLOG(_L("CFotaServer::DoStartDecryptionL >>"));
-    
-    if (!iDEController)
-        iDEController = CDevEncController::NewL(this);
-    
-    iDEController->DoStartDecryptionL(iStorageDrive);
-    
-    FLOG(_L("CFotaServer::DoStartDecryptionL <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::HandleDecryptionCompleteL
-// This method is called to when decryption operation is complete.
-// 
-// --------------------------------------------------------------------------
-// 
-void CFotaServer::HandleDecryptionCompleteL(TInt aResult, TInt aValue)
-    {
-    FLOG(_L("CFotaServer::HandleDecryptionCompleteL, result = %d, value = %d >>"), aResult, aValue);
-    
-    if (aResult == KErrNone)
-        {
-        //Skip battery test as it is already performed before decryption
-        iUpdater->HandleUpdateAcceptStartL(ETrue);
-        }
-    else
-        {
-        FLOG(_L("Can't start update because of error %d"), aResult);
-        iUpdater->HandleUpdateErrorL(aResult, aValue);
-        }
-    
-    if (iDEController)
-        {
-        delete iDEController; iDEController = NULL;
-        }
-    
-    FLOG(_L("CFotaServer::HandleDecryptionCompleteL <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::NeedToEncryptL
-// This method is called to check if encryption is needed.
-// 
-// --------------------------------------------------------------------------
-// 
-TBool CFotaServer::NeedToEncryptL(TDriveNumber &aDrive)
-    {
-    FLOG(_L("CFotaServer::NeedToEncryptL >>"));
-    
-    TDriveNumber drive;
-    if (!iDEController)
-        {
-        TRAPD(err, iDEController = CDevEncController::NewL(this));
-        if (err == KErrNotSupported)
-            {
-            return EFalse;
-            }
-        else
-            {
-            __LEAVE_IF_ERROR(err);
-            }
-        }
-    
-    TBool ret = iDEController->NeedToEncryptL(drive);
-    delete iDEController; iDEController = NULL;
-    
-    if (ret)
-        {
-        aDrive = drive;
-        iStorageDrive = drive;
-        }
-    
-    FLOG(_L("CFotaServer::NeedToEncryptL, ret = %d drive = %d << "), ret, aDrive);
-    return ret;
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::DoStartEncryptionL
-// This method is called to start the encryption operation.
-// 
-// --------------------------------------------------------------------------
-// 
-void CFotaServer::DoStartEncryptionL()
-    {
-    FLOG(_L("CFotaServer::DoStartEncryptionL >>"));
-    
-    if (!iDEController)
-        iDEController = CDevEncController::NewL(this);
-    
-    iDEController->DoStartEncryptionL(iStorageDrive);
-    
-    FLOG(_L("CFotaServer::DoStartEncryptionL <<"));
-    }
-
-// --------------------------------------------------------------------------
-// CFotaServer::HandleEncryptionCompleteL
-// This method is called when the encryption operation is complete.
-// 
-// --------------------------------------------------------------------------
-// 
-void CFotaServer::HandleEncryptionCompleteL(TInt aResult, TInt aValue)
-    {
-    FLOG(_L("CFotaServer::HandleEncryptionCompleteL, result = %d, value = %d >>"), aResult, aValue);
-    
-    if (aResult == KErrNone)
-        {
-        //Do nothing
-        }
-    else
-        {
-        FLOG(_L("Can't start update because of error %d"), aResult);
-        iUpdater->HandleEncryptionErrorL(aResult);
-        }
-    
-    if (iDEController)
-        {
-        delete iDEController; iDEController = NULL;
-        }
-    
-    FLOG(_L("CFotaServer::HandleEncryptionCompleteL <<"));
-    }
-
-
-// --------------------------------------------------------------------------
-// CFotaServer::GetDEOperation
-// This method returns the device encryption operation.
-// 
-// --------------------------------------------------------------------------
-// 
-TInt CFotaServer::GetDEOperation()
-    {
-    FLOG(_L("CFotaServer::GetDEOperation >>"));
-    TInt ret (EIdle);
-
-    if (iDEController)
-        ret = iDEController->GetDEOperation();
-    
-    FLOG(_L("CFotaServer::GetDEOperation, ret = %d <<"), ret);
-    return ret;
-    }
-
--- a/fotaapplication/fotaserver/FotaServer/src/FotaSrvApp.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Methods for CFotaSrvApp
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <apgwgnam.h>
-#include <apgcli.h>
-#include "FotaSrvApp.h"
-#include "FotaSrvDocument.h"
-#include "FotaSrvDebug.h"
-#include "FotaServer.h"
-#include "fotaserverPrivatePSKeys.h"
-#include <apgtask.h>
-
-// ---------------------------------------------------------------------------
-// CFotaSrvApp::CFotaSrvApp
-// ---------------------------------------------------------------------------
-CFotaSrvApp::CFotaSrvApp() : iFotaServer(0), iDocument(0)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaSrvApp::AppDllUid()
-// Returns application UID
-// ---------------------------------------------------------------------------
-//
-TUid CFotaSrvApp::AppDllUid() const
-    {
-    TUid fotauid;
-    fotauid.iUid =  KFotaServerUid;
-    return fotauid;
-    }
-
-// --------------------------------------------------------------------------
-// CFotaSrvApp::SetUIVisibleL
-// Turns UI visible or hidden
-// --------------------------------------------------------------------------
-//
-void CFotaSrvApp::SetUIVisibleL( const TBool aVisible, const TBool aAlsoFSW )
-    {
-    CFotaSrvUi*  ui = (CFotaSrvUi*)iDocument->AppUi(); //CFotaSrvUi
-
-    FLOG(_L("[CFotaSrvApp]  CFotaSrvApp::SetUIVisibleL %d alsoFSW:%d")
-    	,aVisible?1:0,aAlsoFSW?1:0);
-    CCoeEnv*    coe = CCoeEnv::Static();
-
-    TApaTask                task = TApaTask(coe->WsSession());
-
-    task.SetWgId(coe->RootWin().Identifier());
-    
-    if ( aVisible )
-        {
-        //Launch DM UI Application
-        TApaTaskList taskList(coe->WsSession());
-        TApaTask task1(taskList.FindApp( TUid::Uid(KOmaDMAppUid)));
-        FLOG(_L("Checking whether DM UI is running..."));
-        TInt value (EFotaUpdateDM);
-        if (task1.Exists())
-	        {
-   		    FLOG(_L("Bring DM UI into FG")); 
-	        task1.BringToForeground(); //DM UI
-	        }
-        else
-        	{
-TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, value );
-
-    			if (value != EFotaUpdateNSC && value != EFotaUpdateNSCBg )
-					{
-						FLOG(_L("Launching DM UI into FG"));
-        		RApaLsSession apaLsSession;
-      			User::LeaveIfError(apaLsSession.Connect());
-      			TThreadId thread;
-           	User::LeaveIfError( apaLsSession.StartDocument(KNullDesC, TUid::Uid( KOmaDMAppUid), thread) );
-           	apaLsSession.Close();
-					}				     
-        	}
-        if(value == EFotaUpdateDM)
-        {
-        	if ( aAlsoFSW ) ui->HideApplicationFromFSW( EFalse );
-				}
-        else if (value == EFotaUpdateNSC || value == EFotaUpdateNSCBg )
-        {
-        	if ( aAlsoFSW ) ui->HideApplicationFromFSW( ETrue );
-        }
-				FLOG(_L("Bring FOTA into FG")); 
-      	task.BringToForeground();
-      }  
-    else
-        {
-        if ( aAlsoFSW ) ui->HideApplicationFromFSW( ETrue );
-
-        task.SendToBackground();      // the task whose wingroup is at next 
-                                      // ordinal position is brought to 
-                                      // foreground
-
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaSrvApp::~CFotaSrvApp()
-// ---------------------------------------------------------------------------
-//
-CFotaSrvApp::~CFotaSrvApp()
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaSrvApp::CreateDocumentL()
-// Creates FotaSrvDocument object
-// ---------------------------------------------------------------------------
-//
-CApaDocument* CFotaSrvApp::CreateDocumentL()
-    {
-    #ifdef _FOTA_DEBUG
-    RDebug::Print( _L( "[FotaServer] CFotaSrvApp::CreateDocumentL:" ) );
-    #endif 
-    iDocument = CFotaSrvDocument::NewL( *this );
-    return iDocument;
-    }
-
-#include <eikstart.h>
-
-// ---------------------------------------------------------------------------
-// NewApplication() 
-// Constructs CFotaSrvApp
-// Returns: CApaDocument*: created application object
-// ---------------------------------------------------------------------------
-//
-LOCAL_C CApaApplication* NewApplication()
-    {
-    #ifdef _FOTA_DEBUG
-    RDebug::Print( _L( "[FotaServer] CApaApplication* NewApplication:" ) );
-    #endif 
-    return new CFotaSrvApp;
-    }
-
-// ---------------------------------------------------------------------------
-// ServerL() 
-// Getter for server
-// ---------------------------------------------------------------------------
-//
-CFotaServer* CFotaSrvApp::Server()
-    {
-    return iFotaServer;
-    }
-
-// ---------------------------------------------------------------------------
-// NewAppServerL() 
-// Called by framwork
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvApp::NewAppServerL( CApaAppServer*& aAppServer )
-	{
-    #ifdef _FOTA_DEBUG
-	RDebug::Print( _L( "[FotaServer] CFotaSrvApp::NewAppServerL:" ) );
-    #endif 
-    iFotaServer =  new (ELeave) CFotaServer();
-    iFotaServer->iParentApp = this;
-    aAppServer  = iFotaServer;
-	}
-
-
-// ---------------------------------------------------------------------------
-// E32Main
-// ---------------------------------------------------------------------------
-//
-GLDEF_C TInt E32Main()
-    {
-    TInt err;
-    RProcess pr; TFullName fn = pr.FullName(); 
-    #ifdef _FOTA_DEBUG
-    RDebug::Print(_L("[FotaServer] E32Main:    >> called by %S"), &fn);
-    #endif
-    err = EikStart::RunApplication( NewApplication );
-    #ifdef _FOTA_DEBUG
-    RDebug::Print(_L("[FotaServer] E32Main:    <<"));
-    #endif
-    return err;
-    }
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/src/FotaSrvDocument.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Fotaserver document class
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <StringLoader.h>
-#include <collate.h>
-#include <featmgr.h>
-#include <fotaserver.rsg>
-#include "FotaSrvDocument.h"
-#include "FotaSrvUI.h"
-#include "FotaSrvDebug.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------------------------
-// Desctructor
-// ---------------------------------------------------------------------------
-//
-CFotaSrvDocument::~CFotaSrvDocument()
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaSrvDocument::ConstructL
-// 2nd phase constructor
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvDocument::ConstructL()
-    {
-	//iEikEnv = CEikonEnv::Static();	
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaSrvDocument::NewL
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CFotaSrvDocument* CFotaSrvDocument::NewL( CAknApplication& aApp )
-    {
-    FLOG( _L( "[FotaServer] CFotaSrvDocument::NewL:" ) );
-
-	CFotaSrvDocument* self = new (ELeave) CFotaSrvDocument( aApp );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();  //self
-    return self;
-	}
-
- 
-// ---------------------------------------------------------------------------
-// CFotaSrvDocument::CreateAppUiL
-// ---------------------------------------------------------------------------
-//
-CEikAppUi* CFotaSrvDocument::CreateAppUiL()
-    {
-    FLOG( _L( "[FotaServer] CFotaSrvDocument::CreateAppUiL:" ) );
-    return new (ELeave) CFotaSrvUi;
-	}
-
-
-// End of File
--- a/fotaapplication/fotaserver/FotaServer/src/FotaSrvUi.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Methods for CFotaSrvUi
-*
-*/
-
-
-
-// INCLUDES 
-
-#include <apgwgnam.h>
-#include <aknnotewrappers.h>
-#include <StringLoader.h>
-#include <textresolver.h>
-#include "FotaSrvUI.h"
-#include "FotaSrvApp.h"
-#include "FotaSrvDebug.h"
-
-// ============================ MEMBER FUNCTIONS =============================
-//
-
-// ---------------------------------------------------------------------------
-// CFotaSrvUi::ConstructL
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvUi::ConstructL()
-    {
-    FLOG( _L( "[FotaServer] CFotaSrvUi::ConstructL:" ) );
-    TInt        flags = EStandardApp|EAknEnableSkin|EAknEnableMSK;
-    CAknAppUi::BaseConstructL( flags );
-    CFotaSrvApp* app = (CFotaSrvApp*) Application();
-    app->SetUIVisibleL(EFalse);
-    iNeedToClose = EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-CFotaSrvUi::~CFotaSrvUi()
-    {
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvUi::DynInitMenuPaneL
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvUi::DynInitMenuPaneL( TInt /*aResourceId*/,
-                                         CEikMenuPane* /*aMenuPane*/ )
-    {
-    FLOG( _L( "[FotaServer] CFotaSrvUi::DynInitMenuPaneL:" ) );
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaSrvUi::HandleKeyEventL
-// ---------------------------------------------------------------------------
-//
-TKeyResponse CFotaSrvUi::HandleKeyEventL( const TKeyEvent& aKeyEvent,
-                                            	TEventCode aType )
-    {
-    FLOG(_L( "[FotaServer] CFotaSrvUi::HandleKeyEventL: %d  %d" ), aType
-            , aKeyEvent.iCode ); 
-    if (aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
-    	{
-    	FLOG(_L("Application requested to shutdown..."));
-        CFotaSrvApp* app = (CFotaSrvApp*) Application();
-        CFotaServer* server = app->Server();
-
-    	server->iNeedToClose = ETrue;
-    	}
-    return EKeyWasNotConsumed;
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvUi::HandleCommandL
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvUi::HandleCommandL( TInt aCommand )
-    {
-    FLOG(_L( "[FotaServer] CFotaSrvUi::HandleCommandL >> %d" ),aCommand  );
-    switch ( aCommand )
-        {
-	    case EAknCmdExit:
-        case EEikCmdExit:		// quit application
-		    {
-            
-	        CFotaSrvApp* app = (CFotaSrvApp*) Application();
-	        CFotaServer* server = app->Server();
-	        if (!server->GetDEOperation())
-	            {
-	            FLOG(_L("Exitting FotaServer!!"));
-	            server->iNeedToClose = ETrue;
-	            Exit();
-	            }
-	        else
-	            {
-	            FLOG(_L("Defering exit!"));
-	            }
-		    }
-		    break;
-
-        default:
-            break;      
-        }
-    FLOG(_L( "[FotaServer] CFotaSrvUi::HandleCommandL << %d" ),aCommand  );
-    }
-
-// ---------------------------------------------------------------------------
-// CIVAppUi::OpenFileL
-// This is called by framework when application is already open in background
-// and user open other file in eg. FileBrowse.
-// New file to been shown is passed via aFileName.
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvUi::OpenFileL(const TDesC& aFileName)
-    {
-    FLOG(_L("CFotaSrvUi::OpenFileL(%S)"),&aFileName);
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaAppUi::PrepareToExit
-// This is called by framework when application is about to exit
-// and server can prepare to stop any active downloads
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvUi::PrepareToExit()
-    {
-    FLOG(_L("CFotaSrvUi::PrepareToExit >>"));
-	
-    CFotaSrvApp* app = (CFotaSrvApp*) Application();
-    CFotaServer* server = app->Server();
-    server->iNeedToClose = ETrue;
-
-    FLOG(_L("CFotaSrvUi::PrepareToExit <<"));
-    }
--- a/fotaapplication/fotaserver/FotaServer/src/fotaSrvSession.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,458 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   fotaengines server side session
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "FotasrvSession.h"
-#include "FotaSrvDebug.h"
-#include <eikenv.h>
-#include <eikappui.h>
-#include <s32mem.h>
-#include <e32base.h>
-#include <centralrepository.h>
-#include "FotaServer.h"
-#include "FotaSrvApp.h"
-// ============================= MEMBER FUNCTIONS ============================
-
-class CFotaServer;
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::CheckClientSecureIdL 
-// Returns True if caller is syncml framework. False for fotasrv.
-// Leaves if client is unknown
-// ---------------------------------------------------------------------------
-//
-CFotaSrvSession::TClient CFotaSrvSession::CheckClientSecureIdL (
-                                                  const RMessage2& aMessage)
-    {
-    //TClient     client(EUnknown);
-    TUid    dmhostserver1   = TUid::Uid( KDMHostServer1Uid );
-    TUid    fota            = TUid::Uid( KFotaServerUid );
-    TUid    omadmappui      = TUid::Uid( KOmaDMAppUid );
-    TUid    starter         = TUid::Uid( KStarterUid );
-	TUid	fscheduler		= TUid::Uid( KFotaScheduler );
-	TUid	fms				= TUid::Uid( KFMSServerUid );
-	TUid    softwarechecker = TUid::Uid( 0x2000BB96 );    
-	TUid    softwarecheckerbackground = TUid::Uid( 0x2000BB97 );    
-   TUid    testapp =        TUid::Uid(  0x102073E4); 
-
-  TUid    iadclient = TUid::Uid( 0x2000F85A ); 
-
-	// Syncml
-	if ( aMessage.SecureId() == dmhostserver1.iUid )
-		{
-		FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is \
-		DmHostserver!"));
-		return EDMHostServer;
-		}
-
-	// OmaDMAPpui
-	if ( aMessage.SecureId() == omadmappui.iUid )
-		{
-		FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is \
-		omadmappui!"));
-		return EOMADMAppUi;
-		}
-
-	// Fotaserver
-	if ( aMessage.SecureId() == fota.iUid ) 
-		{
-		FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is \
-		fotaserver!"));
-		return EFotaServer;
-		}
-
-	// Starter
-	if ( aMessage.SecureId() == starter.iUid )
-		{
-		return EStarter;
-		}
-
-
-
-	// Software Checker app
-	if ( aMessage.SecureId() == softwarechecker.iUid || aMessage.SecureId() == iadclient.iUid)
-        {
-        return ESoftwareChecker;
-        }
-
-	// Software Checker Background app
-	if ( aMessage.SecureId() == softwarecheckerbackground.iUid )
-        {
-        return ESoftwareCheckerBackground;
-        }
-
-
-// *3* <-        
-
-
-	// Tester app for testing purp. 
-	if ( aMessage.SecureId() == 0x0323231 || aMessage.SecureId() == testapp.iUid)
-		{
-		return EFotaTestApp;
-		}
-	if ( aMessage.SecureId() == fms.iUid )
-		{
-		return EFMSServer;
-		}
-	// schedulehandler
-	if ( aMessage.SecureId() == fscheduler.iUid)
-		{
-		return EFotaTestApp;
-		}
-
-	FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client 0x%X is unknown \
-	(msg %d), bailing out"),aMessage.SecureId().iId, aMessage.Function());
-	User::Leave( KErrAccessDenied );    
-	return EFotaTestApp; // compiler warning otherwise
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::CFotaSrvSession
-// ---------------------------------------------------------------------------
-//
-CFotaSrvSession::CFotaSrvSession( )
-	{
-	FLOG( _L( "CFotaSrvSession::CFotaSrvSession( )" ) );
-	iError =  KErrNone;
-	//iDoc = CEikonEnv::Static()->EikAppUi()->Document();
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::~CFotaSrvSession
-// ---------------------------------------------------------------------------
-//
-CFotaSrvSession::~CFotaSrvSession()
-{
-}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::CreateL
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvSession::CreateL()
-	{
-	FLOG( _L( "CFotaSrvSession::CreateL() >>" ) );
-	CAknAppServiceBase::CreateL();		
-	FLOG( _L( "CFotaSrvSession::CreateL() <<" ) );
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::ServiceL
-// Handle client request
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvSession::ServiceL(const RMessage2& aMessage)
-	{
-	TInt        err(KErrNone);
-	TInt        pkgid = 0;
-	TPackageState       state;
-	RThread clt; aMessage.ClientL(clt); 
-	TFullName cltnm = clt.FullName();
-	FLOG(_L( "CFotaSrvSession::ServiceL      %d   serving for %S?" )
-			,aMessage.Function(), &cltnm );
-
-	TInt cmd = aMessage.Function();
-	if(( cmd!= EGetState ) && (cmd!= EGetResult ))
-	{
-		TInt fotaValue(1);    
-  	CRepository* centrep( NULL);
-  	TUid uidValue = {0x101F9A08}; // KCRFotaAdapterEnabled
-  	centrep = CRepository::NewL( uidValue); 
-  	if(centrep )
-  	{     
-  		FLOG(_L("centralrepository found "));
-    	centrep->Get( 1 , fotaValue ); // KCRFotaAdapterEnabled     
-    	delete centrep;
-  	}
-  	if ( ! fotaValue )
-  	{
-  		User::Leave( KErrNotSupported );   
-  	}
-  }
-  
-	TClient client = CheckClientSecureIdL ( aMessage );
-
-	switch( aMessage.Function() )
-	{
-	case EFotaFirstCommand:
-		{
-		}
-		aMessage.Complete(KErrNone);
-		break;
-	case EFotaDownload:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOAD") );
-		TDownloadIPCParams          ipc;
-		TPckg<TDownloadIPCParams>   pkg(ipc);
-		aMessage.Read (0, pkg);
-		TInt        deslen  = aMessage.GetDesLengthL (1);
-		HBufC8*     urlbuf  = HBufC8::NewLC(deslen);
-		TPtr8       urlptr  = urlbuf->Des();
-		aMessage.Read (1,urlptr);
-		FotaServer()->DownloadL(ipc,urlptr);
-		CleanupStack::PopAndDestroy(); // urlbuf
-		aMessage.Complete( KErrNone );
-		break;
-		}
-	case EFotaUpdate:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL UPDATE" ));
-		TDownloadIPCParams          ipc;
-		TPckg<TDownloadIPCParams>   pkg(ipc);
-		aMessage.Read( 0 ,pkg );
-		FotaServer()->SetInstallUpdateClientL(client);
-		// If update started from omadmappui, no alert should be sent if 
-		// update is cancelled
-		if ( client == EOMADMAppUi )
-			{
-			ipc.iSendAlert = EFalse;
-			}
-		FotaServer()->UpdateL(ipc);
-		aMessage.Complete( KErrNone );	
-		break;
-		}
-	case EFotaDownloadAndUpdate:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOADANDUPDATE" ));
-		TDownloadIPCParams          ipc;
-		TPckg<TDownloadIPCParams>   pkg(ipc);
-		aMessage.Read (0, pkg);
-		TInt        deslen  = aMessage.GetDesLengthL (1);
-		HBufC8*     urlbuf  = HBufC8::NewLC(deslen);
-		TPtr8       urlptr  = urlbuf->Des();
-		aMessage.Read (1,urlptr);
-		FotaServer()->DownloadAndUpdateL(ipc,urlptr);
-		CleanupStack::PopAndDestroy( urlbuf );
-		aMessage.Complete( KErrNone );	
-		}
-		break;
-	case EFotaOpenUpdatePackageStore:
-		{
-		FLOG(_L("CFotaSrvSession::ServiceL OPENUPDATEPACKAGESTORE"));
-		FotaServer()->OpenUpdatePackageStoreL( aMessage );
-		aMessage.Complete( KErrNone );
-		}
-		break;
-
-	case EFotaGetDownloadUpdatePackageSize:
-		{
-		TInt dlsize = 0;
-		TInt totalsize = 0;
-		pkgid = aMessage.Int0();
-		//err is already KErrNone.
-		FotaServer()->GetDownloadUpdatePackageSizeL( pkgid, dlsize, totalsize );
-		TPckg<TInt> pkg2(dlsize);
-		TPckg<TInt> pkg3 (totalsize);
-		aMessage.Write (1,pkg2);
-		aMessage.Write (2,pkg3);
-		aMessage.Complete( KErrNone );
-		}
-		break;
-
-	case EFotaSendChunk:
-		{
-		FotaServer()->ReadChunkL( aMessage.Int0(),iError );
-		iError =  KErrNone;
-		aMessage.Complete( KErrNone );
-		}
-		break;
-	case EFotaReleaseChunkHandle:
-		{
-		FLOG(_L("CFotaSrvSession::ServiceL  EFotaReleaseChunkHandle"));
-		FotaServer()->UpdateDBdataL();
-		aMessage.Complete( KErrNone );
-		}
-		break;
-
-	case EFotaTryResumeDownload:
-		{
-		if (client == EOMADMAppUi )
-			{
-			FotaServer()->TryResumeDownloadL(ETrue); // user initiated
-			aMessage.Complete( KErrNone );				
-			}
-		else if (client == EFMSServer)
-			{
-			FotaServer()->TryResumeDownloadL(EFalse); // fms initiated
-			aMessage.Complete( KErrNone );
-			}
-		else if(client == 	EFotaTestApp)
-		{
-			FotaServer()->TryResumeDownloadL(EFalse); // fms initiated
-			aMessage.Complete( KErrNone );
-		}
-		else
-			{
-			aMessage.Complete ( KErrAccessDenied );
-			}
-		}
-		break;	
-
-	case EUpdatePackageDownloadComplete:
-		{
-		FLOG(_L("CFotaSrvSession::ServiceL \
-		UPDATEPACKAGEDOWNLOADCOMPLETE"));
-		// If caller is syncmlDM framework, download is largeobject 
-		// download. If caller is other, download is Oma DL/http
-   
-		TBool largeobj = (client == EDMHostServer)? ETrue : EFalse;
-		pkgid = aMessage.Int0();
-		FotaServer()->UpdatePackageDownloadCompleteL(largeobj
-				, pkgid);
-		aMessage.Complete( KErrNone );
-		}
-		break;
-	case EDeletePackage:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL DELETEPACKAGE") );
-		pkgid = aMessage.Int0();
-		FotaServer()->DeletePackageL(pkgid);
-		aMessage.Complete( KErrNone );
-		}
-		break;
-	case EGetState:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE >>" ));
-		pkgid = aMessage.Int0();
-		
-		// NSC_DM: commented out 2 strings below, otherwise it crashes from NSC with Kern-Exec 44 -> 
-		if (client != EOMADMAppUi && client != ESoftwareChecker && client != ESoftwareCheckerBackground && client != EFotaTestApp && pkgid < 0)
-			aMessage.Complete (KErrArgument);
-		//	<-		
-		state = FotaServer()->GetStateL(pkgid);
-		//Protecting state 25. If any client other than DM UI queries for state, 25 should not be sent and 
-		//20 will be sent instead.
-		if (client != EOMADMAppUi && state.iState == RFotaEngineSession::EDownloadProgressingWithResume)
-			state.iState = RFotaEngineSession::EDownloadProgressing;
-		FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE << %d" )
-				,state.iState);
-		TPckg<RFotaEngineSession::TState>   pkg2(state.iState);
-		aMessage.Write (1, pkg2);
-		aMessage.Complete (KErrNone);
-		}
-		break;
-	case EGetResult:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT >>" ));
-		pkgid = aMessage.Int0();
-		state = FotaServer()->GetStateL(pkgid);
-		TPckg<TInt>     pkg2(state.iResult);
-		FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT << %d" )
-				,state.iResult);
-		aMessage.Write (1, pkg2);
-		aMessage.Complete (err);
-		break;
-		}
-	case EIsPackageStoreSizeAvailable:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL \
-		ISPACKAGESTORESIZEAVAILABLE" ));
-
-		TInt size   = aMessage.Int0();
-		TBool avail;
-		// In UI evolution, size of file will be checked by fotaserver itself. Keep following
-		// until codhandler skips size check itself 
-		//#ifdef RD_OMADMAPPUI_UI_EVOLUTION
-		if ( client == EFotaServer )	avail = ETrue;
-		else	avail = FotaServer()->IsPackageStoreSizeAvailableL( size );
-		/*#else
-						avail = FotaServer()->IsPackageStoreSizeAvailableL( size );
-			#endif*/
-		TPckg<TBool>     pavail(avail);
-		aMessage.Write (1, pavail);
-		aMessage.Complete (KErrNone);
-		break;
-		}
-
-	case EGetUpdatePackageIds:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATEPACKAGEIDS" ));
-		TPkgIdList                      pkgids;
-		FotaServer()->GetUpdatePackageIdsL(pkgids);
-		TPckg<TPkgIdList>               pkgids_pkg(pkgids);
-		aMessage.Write(0, pkgids_pkg);
-		aMessage.Complete(KErrNone);
-		}
-		break;
-
-	case EGetUpdateTimestamp:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATETIMESTAMP" ));
-		TBuf16<15>        timestamp;
-		FotaServer()->GetUpdateTimeStampL(timestamp);
-		aMessage.Write(0, timestamp );
-		aMessage.Complete(KErrNone);
-		}
-		break;
-
-	case EGenericAlertSentForPackage:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL EGENERICALERTSENT FOR PKGID" ));
-		TInt pkgid = aMessage.Int0();
-		FotaServer()->GenericAlertSentL( pkgid );
-		aMessage.Complete( err );
-		}
-		break;
-
-	case EScheduledUpdate:
-		{
-		FLOG(_L( "CFotaSrvSession::ServiceL ESCHEDULEDUPDATE" ));
-		TFotaScheduledUpdate           sched(-1,-1);
-		TPckg<TFotaScheduledUpdate>    p(sched);
-		aMessage.Read (0, p);
-		FotaServer()->SetInstallUpdateClientL(client);
-		FLOG(_L(" pkgid: %d   scheduleid:%d"), sched.iPkgId,sched.iScheduleId);
-		FotaServer()->ScheduledUpdateL( sched );
-		aMessage.Complete( KErrNone );
-		}
-		break;
-
-	default:
-		{
-		CAknAppServiceBase::ServiceL( aMessage );
-		}
-		break;
-	}		
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::ServiceError
-// ---------------------------------------------------------------------------
-//
-void CFotaSrvSession::ServiceError( const RMessage2& aMessage,TInt aError )
-	{
-	FLOG(_L( "CFotaSrvSession::ServiceError %d" ),aError );
-	iError = aError;
-	CFotaServer* f = FotaServer();
-	TRAPD(err2, f->iParentApp->SetUIVisibleL ( EFalse,ETrue ) );
-	if(err2); // remove compiler warning
-	CAknAppServiceBase::ServiceError( aMessage, aError );
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaSrvSession::FotaServer
-// Helper function
-// ---------------------------------------------------------------------------
-//
-
-CFotaServer*  CFotaSrvSession::FotaServer() const
-{
-return (CFotaServer* ) Server();
-}
--- a/fotaapplication/fotaserver/FotaServer/src/fotadownload.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1944 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   downloads upd pkg
-*
-*/
-
-
-
-// INCLUDES
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <es_enum_internal.h>
-#endif
-#include <centralrepository.h>
-#include <f32file.h>
-#include <AknWaitDialog.h>
-#include <fotaserver.rsg>
-#include <eikprogi.h>
-#include <eikenv.h>
-#include <apgtask.h>
-#include <apgwgnam.h>
-#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <es_sock.h>
-#else
-#include <es_sock.h>
-#include <es_sock_partner.h>
-#endif
-#include <es_enum.h>
-//Commented for resolving APP dependencyy
-//#include <nsmldmsync.rsg>	//OMA DM UI for reading resource
-//Comment ends here
-#include <bautils.h>
-#include <StringLoader.h>
-#include <DevManInternalCRKeys.h> //for reading san feature
-#include <e32property.h>
-#include "fotastorage.h"
-#include "FotaSrvApp.h"
-#include "fotadownload.h"
-#include "fotaserverPrivatePSKeys.h"
-#include "FotaNetworkRegStatus.h"
-#include <startupdomainpskeys.h>	//globalrfsstates
-#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
-#define __LEAVE(x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::NewL 
-// --------------------------------------------------------------------------
-CFotaDownload* CFotaDownload::NewL (CFotaServer* aServer)
-	{
-	__ASSERT_ALWAYS( aServer, User::Panic(KFotaPanic, KErrArgument) );
-	CFotaDownload* ao = new (ELeave) CFotaDownload();
-	ao->iFotaServer = aServer;
-	return ao;
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::RunL
-// Do operations started in HandleDmgrEvent
-// --------------------------------------------------------------------------
-void CFotaDownload::RunL()
-	{
-	FLOG(_L( "[FotaServer] CFotaDownload::RunL() >>"));
-	CancelDownload( ETrue );
-	CreateDownloadL();
-	FLOG(_L( "[FotaServer] CFotaDownload::RunL() <<" ) );
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::DoCancel()
-// Cancel notifier request
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::DoCancel()
-	{
-	FLOG(_L("CFotaDownload::DoCancel() >>"));
-	FLOG(_L("CFotaDownload::DoCancel() <<"));
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::RunError(TInt aError)
-// Handle active object run error.
-// --------------------------------------------------------------------------
-//
-TInt CFotaDownload::RunError(TInt aError)
-	{
-	if(aError)
-		{
-		FLOG(_L(" CFotaDownload::RunError err %d"), aError );
-		}
-	return aError;
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::CFotaDownload()
-// --------------------------------------------------------------------------
-//
-CFotaDownload::CFotaDownload() : CActive(EPriorityNormal)
-		, iUpdateAfterDownload (EFalse), iUrl( NULL ),
-		iDownload (NULL),
-		iDownloadedContentSize(0),
-		iPreviousContentSize ( 0 ), iShowOMACDUI(EFalse), iShowDLPrgUI(EFalse),
-		iDownloadResumable (EFalse),				
-		iFMSEnabled (EFalse),
-		iDownloadActive (EFalse),
-		iFreshDL(ETrue),
-		iUserInitiatedResume(EFalse),		
-		iSanValue(KErrNotFound),
-		iDownloadFinalized(EFalse)		
-	{
-	CActiveScheduler::Add( this ); 
-	FLOG(_L("CFotaDownload::CFotaDownload()"));
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::~CFotaDownload()
-// --------------------------------------------------------------------------
-//
-CFotaDownload::~CFotaDownload()
-	{
-	FLOG(_L("CFotaDownload::~CFotaDownload() >>"));
-	Cancel();
-	
-	//Sets download state inactive if accidently closed. This is anyhow taken care in FinalizeDownload in Server.
-	SetDownloadActive(EFalse);
-	CancelDownload( ETrue );
-	if ( iUrl )
-		{
-		delete iUrl; iUrl=NULL;
-		}
-/*	if ( iNotifHandler ) Deleted at server
-		{
-		iNotifHandler->Cancel();
-		delete iNotifHandler;        
-		}*/
-	if ( iDLProgressDlg )
-		{
-		delete iDLProgressDlg; iDLProgressDlg=NULL;
-		}
-
-	if (iDownloadMgr.Handle())
-		iDownloadMgr.Close();
-	//don't delete iFotaServer as it doesn't belong here.
-	
-	FLOG(_L("CFotaDownload::~CFotaDownload() <<"));
-}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::CancelDownload
-// Cancel download
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::CancelDownload( const TBool aCancelProgressBar )
-	{
-	FLOG(_L("CFotaDownload::CancelDownload() >>"));
-	
-	if( iDownloadMgr.Handle() )
-		{
-		iDownloadMgr.Close();
-		}
-
-	if ( aCancelProgressBar  && iDLProgressDlg )
-		{
-		TRAPD(err, iDLProgressDlg->ProcessFinishedL() ) ;// deletes
-		if(err); // remove compiler warning
-		delete iDLProgressDlg;
-		iDLProgressDlg = NULL;
-		}
-	FLOG(_L("CFotaDownload::CancelDownload() <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::CreateDownloadL
-// Create  download
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::CreateDownloadL()
-	{
-	FLOG(_L("CFotaDownload::CreateDownloadL() >>") );
-	__ASSERT_ALWAYS( iDownloadMgr.Handle()==0, User::Leave(KErrAlreadyExists) );
-	RHttpDownload*  d(NULL);
-	iDLNeedsReset = EFalse;
-	TBool       created;
-	iDownloadMgr.ConnectL( TUid::Uid(KFotaServerUid) , *this, EFalse); 
-	FLOG(_L("CFotaDownload::CreateDownloadL, Stage 1") );
-	iDownloadMgr.DeleteAll();
-
-	TRAPD(err, d = &iDownloadMgr.CreateDownloadL( *iUrl, created ) );
-	RFs fs;	
-	if(fs.Connect() == KErrNone)
-	    {
-	    RFile file;    
-	    CleanupClosePushL( fs );
-	    CleanupClosePushL( file );
-	    err=fs.MkDir(KDDDirPath);
-	    FLOG(_L("creating directory err as %d"),err);
-	    err=fs.SetSessionPath(KDDDirPath);
-	    FLOG(_L("setting session path err as %d"),err);
-	    err=fs.ShareProtected();
-	    FLOG(_L("ShareProtected err as %d"),err);
-	    err = file.Replace(fs,KDDFilename, EFileWrite|EFileShareAny);	
-	    FLOG(_L("creating rfile err as %d"),err);	
-	    err = d->SetFileHandleAttribute(file);
-	    FLOG(_L("setting dlmgr destfile attrib err as %d"),err);
-	    CleanupStack::PopAndDestroy( &file );
-	    CleanupStack::PopAndDestroy( &fs );
-	    }	
-	FLOG(_L("CFotaDownload::CreateDownloadL, Stage 2. err %d"),err);
-	if ( err  == KErrArgument ) User::Leave( KErrNotFound );
-	else if( err !=KErrNone)    User::Leave( err );
-
-	if ( iDLState.iIapId > KErrNotFound )
-		{
-		FLOG(_L("   Using internet access point iapid: %d"), iDLState.iIapId);
-		err = iDownloadMgr.SetIntAttribute( EDlMgrIap, iDLState.iIapId); // IAP id
-		User::LeaveIfError( err );        
-		//At this point the iIapId used in the SyncML Session is presumed working. Hence
-		//the same is stored in database for use during download.
-		FLOG(_L("Setting IAPID=%d is FotaState"),iDLState.iIapId);
-		iFotaServer->iDatabase->OpenDBL();
-		iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBIapId );
-		iFotaServer->iDatabase->CloseAndCommitDB();
-		}
-	FLOG(_L("CFotaDownload::CreateDownloadL, Stage 3") );
-	User::LeaveIfError( d->SetIntAttribute(EDlAttrFotaPckgId ,iDLState.iPkgId) );
-	FLOG(_L("CFotaDownload::CreateDownloadL, Stage 4") );
-	User::LeaveIfError( d->SetBoolAttribute(EDlAttrNoContentTypeCheck,ETrue) );
-
-	// If ui hidden or download restarting, do not show descriptor
-	if ( !iShowOMACDUI || iRestartCounter > 0 )
-		{
-		FLOG(_L("setting DD to hidden"));
-		User::LeaveIfError(iDownloadMgr.SetBoolAttribute( EDlMgrSilentMode,ETrue )) ;
-		}
-	//It's a fresh download
-	iFreshDL = ETrue;
-
-	// Start download 
-	User::LeaveIfError(iDownloadMgr.StartAll()); 
-	FLOG(_L("CFotaDownload::CreateDownloadL, Stage 5") );
-	iDLProgress = EStarted;
-
-	//This P&S Key is used to notify DM UI on any download event. key=0 for idle and key=1 for download
-	err = RProperty::Set( TUid::Uid(KOmaDMAppUid),
-			KFotaDMRefresh,
-			ETrue );
-	FLOG(_L("RProperty KFotaDMRefresh Set Etrue, err = %d"), err);
-
-	SetDownloadActive(ETrue);
-
-	User::LeaveIfError(err);
-	FLOG(_L("[FotaServer]  CFotaDownload::CreateDownloadL <<"));
-}
-
-	// --------------------------------------------------------------------------
-	// CFotaDownload::DownloadL
-	// Start download of swupd package.
-	// --------------------------------------------------------------------------
-	//
-void CFotaDownload::DownloadL(TDownloadIPCParams aParams,const TDesC8& aPkgURL
-		,TBool aUpdateAfterDownload,const TInt aIapid,const TInt aRestartDownload)
-	{
-	FLOG(_L("[FotaServer]  CFotaDownload::DownloadL >> restart %d"),aRestartDownload);
-
-	TInt err = RProperty::Define( TUid::Uid(KOmaDMAppUid),
-			KFotaDMRefresh,
-			RProperty::EInt,KReadPolicy,KWritePolicy);
-	FLOG(_L("RProperty KFotaDMRefresh Define, err = %d"), err);        
-	if (err != KErrAlreadyExists )
-		{
-		User::LeaveIfError(err);
-
-		err = RProperty::Set( TUid::Uid(KOmaDMAppUid),
-				KFotaDMRefresh,
-				KErrNotFound );
-
-		FLOG(_L("RProperty KFotaDMRefresh Set KErrNotFound, err = %d"), err);
-		User::LeaveIfError(err);
-		}
-
-	if ( iUrl ) {delete iUrl; iUrl=NULL;}
-	iUrl = aPkgURL.Alloc();
-	iUpdateAfterDownload = aUpdateAfterDownload;
-	iRestartCounter = aRestartDownload;
-
-	iDLState        = aParams;
-	FLOG(_L("CFotaDownload::DownloadL, Stage 1") );
-
-	// Set state -------------------------------------------------------------
-	iDLState.iState = RFotaEngineSession::EStartingDownload;
-
-	iDLState.iResult = KErrNotFound;
-	iDLState.iUpdateLtr = aUpdateAfterDownload;
-	iFotaServer->iDatabase->OpenDBL();
-	iFotaServer->iDatabase->SetStateL( iDLState, *iUrl,EFDBState|EFDBResult
-			| EFDBProfileId|EFDBPkgUrl|EFDBPkgName|EFDBVersion|EFDBUpdateLtr);
-	iFotaServer->iDatabase->CloseAndCommitDB();
-	FLOG(_L("CFotaDownload::DownloadL, Stage 2, pkgid:%d"),iDLState.iPkgId);
-
-	// 2. Get Iap Id to use for download. This would be set in iDLState.iIapId.
-	SetIapToUseL(aParams, aIapid);
-
-	// 3. Determine whether download should be visible or not
-	// Autoaccepted profile?
-
-	SetDownloadUiBehavior(ETrue);
-
-	CancelDownload( ETrue );
-
-	FLOG(_L("Setting SessionType=%d in FotaState"),iDLState.iSessionType);
-	iFotaServer->iDatabase->OpenDBL();
-	iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBSessionType );
-	iFotaServer->iDatabase->CloseAndCommitDB();
-	FLOG(_L("CFotaDownload::DownloadL, Stage 3") );
-	//Called to read the download variations in Fota (resume support & FMS)
-	CheckDownloadVariations();
-
-	//Create the download
-	CreateDownloadL( );
-	FLOG(_L("[FotaServer]  CFotaDownload::DownloadL <<"));
-	}
-
-// ---------------------------------------------------------------------------
-// CFotaDownload::HandleDLProgressDialogExitL
-// Handle canceling of download
-// ---------------------------------------------------------------------------
-TBool CFotaDownload::HandleDLProgressDialogExitL( TInt aButtonId ) 
-	{
-	FLOG(_L("CFotaDownload::HandleDLProgressDialogExitL %d, note = %d >>"),aButtonId, iDLProgressDlg->iNoteType);
-	// Cancel clicked during download
-	if ( aButtonId == KErrNotFound )
-		{
-		iRestartCounter = -1;
-		FLOG(_L("[FotaServer]  CFotaDownload::HandleDLProgressDialogExitL Hiding UI"));
-		iFotaServer->iParentApp->SetUIVisibleL ( EFalse, ETrue );
-		iUpdateAfterDownload = EFalse;
-
-		iDLState.iResult = RFotaEngineSession::EResUserCancelled;
-
-		if (iDLProgressDlg->iNoteType == EConnectingNote)
-			{
-			iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-
-			TInt active (KErrNotFound);
-			RProperty::Get( TUid::Uid(KOmaDMAppUid), KFotaDownloadActive, active );
-			FLOG(_L("active = %d"),active);
-			
-			if (active) //Resume operation has just begun and download request is submitted to dlmgr. Hence need to suspend.
-				{
-				RunDownloadSuspendL(RFotaEngineSession::EResUserCancelled, ETrue);
-				}
-			else //Resume operation has just begun, but download request is not submitted to dlmgr
-				{
-				LaunchNotifierL( ESyncMLFwUpdOmaDLPostponed, EFalse, EFalse );
-				iFotaServer->FinalizeDownloadL( iDLState );
-				}
-			}
-		else if (iDLProgressDlg->iNoteType == EDownloadingNote)
-			{
-			if (iDownloadResumable)
-				{
-				//Resume is supported. Query user whether to postpone or cancel download.
-				FLOG(_L("User pressed cancel. Resume is supported; hence pause download and query user if download has to be postponed or cancelled permanently."));
-				RunDownloadSuspendL(RFotaEngineSession::EResUserCancelled);
-				}
-			else
-				{
-				//Resume is not supported. Download is cancelled
-				FLOG(_L("User pressed cancel. Resume is not supported & hence download has to be cancelled"));
-				RunDownloadCancelL(RFotaEngineSession::EResUserCancelled);
-				}
-			}
-		}
-	FLOG(_L("CFotaDownload::HandleDLProgressDialogExitL <<"));
-	return ETrue;
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::DoHandleDMgrEventL
-// Handles download events. Updates package state accordingly
-// --------------------------------------------------------------------------
-void CFotaDownload::DoHandleDMgrEventL( RHttpDownload* aDownload
-		, THttpDownloadEvent aEvent )
-	{
-	__ASSERT_ALWAYS( aDownload, User::Panic(KFotaPanic, KErrArgument) );
-	TInt32                      sysErrorId( KErrNone );
-	TInt32                      contentsize;
-	TInt32                      downloadedsize;
-
-	TInt32                      tmp;
-	THttpDownloadMgrError       dlErrorId;
-	iDownload = aDownload;
-	// If DL is in final state (complete/fail), there's an error id available.
-	User::LeaveIfError( aDownload->GetIntAttribute( EDlAttrGlobalErrorId
-			,sysErrorId ) );
-	User::LeaveIfError( aDownload->GetIntAttribute( EDlAttrDownloadedSize
-			,downloadedsize ) );
-	User::LeaveIfError( aDownload->GetIntAttribute( EDlAttrLength
-			,contentsize ) );
-	User::LeaveIfError( aDownload->GetIntAttribute( EDlAttrErrorId
-			,tmp ) );
-	dlErrorId = (THttpDownloadMgrError)tmp;
-
-
-	// Update progress dlg progress
-	if ( !iDLProgressDlg && iRestartCounter>0)
-		{
-		FLOG(_L("reshowing progress..."));
-		iDLProgressDlg = new(ELeave) CFotaDLProgressDlg((CEikDialog** ) &iDLProgressDlg , EFalse, this, EDownloadingNote );
-		iDLProgressDlg->PrepareLC( R_FOTASERVER_DL_PROGRESS_DIALOG );
-		iDLProgressDlg->RunLD();
-		}
-	if (iDLProgressDlg)
-		{
-		CEikProgressInfo* progressInfo = iDLProgressDlg->GetProgressInfoL();
-		__ASSERT_ALWAYS( progressInfo, User::Panic(KFotaPanic, KErrBadHandle) );
-		if ( iPreviousContentSize!=contentsize )
-			{
-			iPreviousContentSize = contentsize;
-			if ( contentsize > 0 )
-				{
-				progressInfo->SetFinalValue( contentsize );
-				}
-			}
-		TInt incr = downloadedsize - iDownloadedContentSize;
-		if (incr<=0) incr=0; //Protection
-		progressInfo->IncrementAndDraw(incr);
-		iDownloadedContentSize = downloadedsize;
-		}
-	FLOG(_L("CFotaDownload::HandleDMgrEventL() >>   DLstate:%d  ProgressSt:%d\
-	globErr: %d DLError: %d (%d/%d)"),aEvent.iDownloadState
-	,aEvent.iProgressState,sysErrorId,dlErrorId,downloadedsize,contentsize );
-
-	if ( sysErrorId <= -25000)  { FLOG(_L("  error %d interpreted as http \
-	error %d") , sysErrorId, sysErrorId + 25000 ); }
-
-	switch ( aEvent.iDownloadState )
-	{
-	case EHttpDlCreated:		// 1
-		{
-		FLOG(_L("Download State: EHttpDlCreated"));
-		}
-		break;
-	case EHttpDlInprogress:     // 2
-		{
-		FLOG(_L("Download State: EHttpDlProgress"));
-
-
-		if (aEvent.iProgressState == EHttpProgCodDescriptorDownloaded)
-			{
-			if (iShowOMACDUI || iShowDLPrgUI)
-				{
-				iFotaServer->iParentApp->SetUIVisibleL ( ETrue, EFalse);
-				}
-			}
-
-		// Is ECodLoadEnd optimized out?
-		if ( aEvent.iProgressState == EHttpProgCodLoadEnd ) // 2503
-			{
-			TInt    err;
-			err = aDownload->Start();  // PPAR-6FRHFY fixed
-			if(err)
-				{
-				FLOG(_L(" ERROR when restarting DL %d"),err);
-				User::Leave(err);
-				}
-			FLOG( _L("          DL restarted") );
-			}
-
-		// Should tell user to free disk space. But how do we know that disk space is about be exceeded?
-
-		if ( iDLNeedsReset )
-			{
-			FLOG(_L("aDownload->Reset();"));
-			iDLNeedsReset = EFalse;
-			iStatus = KRequestPending;
-			SetActive();
-			TRequestStatus* status = &iStatus;
-			User::RequestComplete( status, KErrNone );
-			User::LeaveIfError( aDownload->Reset() );
-			}
-
-		// Body data of descriptor or payload pkg
-		if ( aEvent.iProgressState == EHttpProgResponseBodyReceived && iDLProgress==EDescriptorDownloaded/*2500*/)
-			{
-			// Now pkg size can be retrieved. must check size.
-			iDLState.iPkgSize = contentsize;
-			FLOG(_L("Setting PkgSize=%d in FotaState"),contentsize);
-			iFotaServer->iDatabase->OpenDBL();
-			iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBPkgSize );
-			iFotaServer->iDatabase->CloseAndCommitDB();
-			
-
-			TInt contentsize2 = contentsize;
-			
-			TInt dlsize (KErrNone);
-			TInt tlsize (KErrNone);
-
-			TRAPD(err, iFotaServer->GetDownloadUpdatePackageSizeL(iDLState.iPkgId, dlsize,tlsize));
-			if(err); // remove compiler warning
-			contentsize2 -= dlsize;
-			FLOG(_L("check pkg size = %d"),contentsize2 );
-
-			CFotaStorage::TFreeSpace avail = iFotaServer->StoragePluginL()->IsPackageStoreSizeAvailableL(contentsize2);
-
-			iDLProgress = ESizeChecked;
-
-			if ( avail==CFotaStorage::EDoesntFitToFileSystem )
-				{
-				FLOG(_L("CFotaStorage::EDoesntFitToFileSystem"));
-				if (iFreshDL)
-					{
-					if ( iShowDLPrgUI )
-						{
-						FLOG(_L("iDLNeedsReset = ETrue;"));
-						iDLNeedsReset = ETrue;
-						LaunchNotifierL( ESyncMLFwUpdOmaDLNotEnoughMemory, KErrDiskFull,contentsize2 );
-						}
-					else
-						{
-						iDLState.iResult = RFotaEngineSession::EResDLFailDueToDeviceOOM;
-						iDLState.iState  = RFotaEngineSession::EDownloadFailed;
-						iUpdateAfterDownload = EFalse;
-						LaunchNotifierL( ESyncMLFwUpdErrorNote, KErrGeneral, contentsize2,ETrue );
-						}
-					}
-				else //resuming download
-					{
-					FLOG(_L("Memory need in order to resume. Notify user..."));
-					LaunchNotifierL( ESyncMLFwUpdOmaDLNotEnoughMemory, KErrDiskFull,contentsize2 );
-					RunDownloadSuspendL(RFotaEngineSession::EResDLFailDueToDeviceOOM);
-					}
-					
-				}
-			}
-
-		// OMA DD download completed , must hide progress
-		if ( aEvent.iProgressState == EHttpProgContentTypeChanged ) // 2055
-			{
-			if ( iDLProgressDlg )
-				{
-				iDLProgressDlg->ProcessFinishedL(); // deletes itself
-				delete iDLProgressDlg;
-				iDLProgressDlg = NULL;
-				}
-			}
-		// OMA DD accepted,show progress
-		if ( aEvent.iProgressState == EHttpProgCodDescriptorAccepted ) // 2502
-
-			{
-			iDLProgress = EDescriptorDownloaded;
-			if ( iShowDLPrgUI )
-				{
-				FLOG(_L("SHOW PROGRESS"));
-				if ( iDLProgressDlg )
-					{
-					FLOG(_L("Removing Connecting progress note..."));
-					iDLProgressDlg->ProcessFinishedL();
-					delete iDLProgressDlg;
-					iDLProgressDlg = NULL;
-					}
-				if (!iDLProgressDlg)
-					{
-					
-					FLOG(_L("Creating iDLProgressDlg"));
-					iDLProgressDlg = new(ELeave) CFotaDLProgressDlg((CEikDialog** ) &iDLProgressDlg , EFalse, this, EDownloadingNote );
-					iDLProgressDlg->PrepareLC( R_FOTASERVER_DL_PROGRESS_DIALOG );
-					iDLProgressDlg->RunLD();
-					}
-				CEikProgressInfo* progressInfo = iDLProgressDlg->GetProgressInfoL();
-				progressInfo->SetFinalValue( 500 );
-				iPreviousContentSize = -1;
-				iDownloadedContentSize = 0;
-				iFotaServer->iParentApp->SetUIVisibleL ( ETrue , EFalse );
-				}
-			if (iDownloadResumable)
-				{
-				FLOG(_L("Setting download as resumable"));
-				iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-		    	iFotaServer->SetStartupReason(EFotaDownloadInterrupted);
-				}
-			else
-				{
-				FLOG(_L("Setting download as non resumable"));
-				iDLState.iState = RFotaEngineSession::EDownloadProgressing;
-				iFotaServer->SetStartupReason(EFotaPendingGenAlert);
-				}
-			iFotaServer->iDatabase->OpenDBL();
-			iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBState );
-			iFotaServer->iDatabase->CloseAndCommitDB();
-
-
-			if (iDLState.iIapId <= 0) //Read the IAP ID when not known, and set it into db.
-				{
-				TInt32 usedapid (KErrNotFound);
-				TInt er = iDownloadMgr.GetIntAttribute( EDlMgrIap, usedapid);
-				iDLState.iIapId = usedapid;
-				FLOG(_L("Setting IAPID=%d is FotaState"),iDLState.iIapId);
-				iFotaServer->iDatabase->OpenDBL();
-				iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBIapId );
-				iFotaServer->iDatabase->CloseAndCommitDB();
-				}
-			}
-		}
-		break;
-	case EHttpDlCompleted:      // 4
-		{
-		FLOG(_L("Download State: EHttpDlCompleted"));
-
-		iRestartCounter = -1;
-		if ( iDLProgressDlg )
-			{
-			iDLProgressDlg->ProcessFinishedL(); // deletes itself
-			delete iDLProgressDlg;
-			iDLProgressDlg = NULL;
-			}
-		iDLState.iState     = RFotaEngineSession::EDownloadComplete;
-
-		if (iUpdateAfterDownload)
-			iDLState.iResult = KErrNotFound;
-		else
-			iDLState.iResult    = RFotaEngineSession::EResSuccessful;
-		iFotaServer->FinalizeDownloadL( iDLState );
-		}
-		break;
-	case EHttpDlPaused: //Event thrown for any resumable download
-	case EHttpDlFailed: //Event thrown for any non-resumable download or critical error on resumable download
-		{
-		
-		if (aEvent.iProgressState != EHttpProgNone) //Accepting only events from COD
-			return;
-
-		if (aEvent.iDownloadState == EHttpDlPaused)
-			{
-			FLOG(_L("Download State: EHttpDlPaused"));
-			if (iDownloadResumable)
-				{
-				iDLState.iState     = RFotaEngineSession::EDownloadProgressingWithResume;
-				}
-			else 
-				{
-				// iDownloadResumable remains 0 even for resumable download.
-				iDLState.iState     = RFotaEngineSession::EDownloadFailed;
-				}
-			}
-		else //aEvent.iDownloadState = EHttpDlFailed
-			{
-			FLOG(_L("Download State: EHttpDlFailed"));
-			iDLState.iState     = RFotaEngineSession::EDownloadFailed;
-			iDownloadResumable = EFalse;
-			}
-		//Remove the download progress bar
-		if ( iDLProgressDlg && (iDLState.iResult != RFotaEngineSession::EResUserCancelled ))
-			{
-			FLOG(_L("Shd not come in EResUserCancelled"));
-			iDLProgressDlg->ProcessFinishedL(); // deletes itself
-			delete iDLProgressDlg;
-			iDLProgressDlg = NULL;
-			}
-		// This is restarted download => decrement counter
-		if ( iRestartCounter > 0 )
-			{
-			--iRestartCounter;
-			if ( iRestartCounter <=0 ) iRestartCounter = -1;
-			FLOG(_L("   iRestartCounter to %d"),iRestartCounter );
-			}
-		/*****************************/
-		//Handling all errors now...//
-		/****************************/
-		TInt notifType (KErrNotFound);
-		TInt notifParam (KErrNotFound);
-		//Handling User Cancel of Download Descriptor
-		if ( dlErrorId == EGeneral && (sysErrorId == KErrAbort || sysErrorId == KErrCancel ))
-			{
-			FLOG(_L("Reason: User cancelled download descriptor"));
-			//LaunchNotifierL(ESyncMLFwUpdOmaDLCancelled, EFalse, EFalse);
-			iRestartCounter = -1;
-			iDLState.iResult = RFotaEngineSession::EResUserCancelled;
-			notifType = ESyncMLFwUpdOmaDLCancelled;
-			notifParam = KErrNone;
-			}
-		//Handling User Cancel
-		else if ( iDLState.iResult == RFotaEngineSession::EResUserCancelled ) //This variable is set in RunDownloadCancelL or RunDownloadSuspendL
-			{
-			iRestartCounter = -1;
-			//If initial pause is successful, query user if he wants to postpone or cancel permanently.
-			iFotaServer->iDatabase->OpenDBL();
-			iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBState);
-			iFotaServer->iDatabase->CloseAndCommitDB();
-
-			if (iDownloadResumable)
-				{
-				if (!iSilentOpn)
-					{
-					FLOG(_L("Download has been paused successful. Query user if he wants to postpone or cancel permanently"));
-					LaunchNotifierL(ESyncMLFwUpdOmaDLUserCancel, KErrNone, KErrNone);
-					break;
-					}
-				else
-					{
-					notifType = ESyncMLFwUpdOmaDLPostponed;
-					notifParam = KErrNone;
-					}
-				}
-			else 
-				{
-				FLOG(_L("Error while initial pausing...%d Hence download has to be cancelled permanently!"));
-				RunDownloadCancelL(RFotaEngineSession::EResUserCancelled);
-        notifType = ESyncMLFwUpdOmaDLCancelled;
-        notifParam = KErrNone;
-				}
-			}
-		else if ( iDLState.iResult == RFotaEngineSession::EResDLFailDueToDeviceOOM )
-			{
-			FLOG(_L("Reason: Not enough memory to perform resume"));
-			iRestartCounter = -1;
-
-			if (iDownloadResumable)
-				iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-			else
-				iDLState.iState = RFotaEngineSession::EDownloadFailed;
-			}
-		//Handling user cancel IAP selection popup
-		else if ( dlErrorId == EConnectionFailed && sysErrorId == KErrCancel)
-			{
-			FLOG(_L("Reason: User canceled IAP selection popup"));
-			iDLState.iResult = RFotaEngineSession::EResUserCancelled;
-			iRestartCounter = -1;
-
-			notifType = ESyncMLFwUpdOmaDLPostponed;
-			notifParam = KErrNone;
-			}
-		//Handling temproary network timeout. This may either try resume or restart based on download.
-/*		else if ( dlErrorId == EGeneral && sysErrorId == KErrTimedOut )
-			{
-			FLOG(_L("Reason: Network timeout"));
-			// No restart issued yet, this is 1st download attempt
-			if ( iRestartCounter == 0 )
-				{
-				iRestartCounter = KFotaDownloadTimeoutRestartCount;
-				iDLState.iState     = RFotaEngineSession::EIdle;
-				FLOG(_L("Trying to restart download (iRestartCounter=%d)"),iRestartCounter );
-				}
-			
-			}*/
-		//Handling all Network interrupts
-		else if ( (dlErrorId == EConnectionFailed && sysErrorId == KErrCommsLineFail)|| 
-				  dlErrorId == ETransactionFailed || 
-				  (dlErrorId == KErrCodWapConnectionDropped && sysErrorId == KErrGeneral) ||
-				  (dlErrorId == EGeneral && sysErrorId == KErrTimedOut) ||
-				  (dlErrorId == EConnectionFailed && sysErrorId == KErrGprsServicesNotAllowed ) ||
-				  (dlErrorId == EConnectionFailed && sysErrorId == KErrGsmMMNetworkFailure ) ||
-				  (dlErrorId == EConnectionFailed && sysErrorId == KErrWlanNetworkNotFound )
-				  )
-			{
-			FLOG(_L("Reason: Network breakage"));
-			iRestartCounter = -1;
-			notifType = ESyncMLFwUpdErrorNote;
-			if (iDownloadResumable)
-				{
-				notifParam = KErrCommsLineFail2;
-				iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-				iDLState.iResult = RFotaEngineSession::EResDLFailDueToNWIssues;
-				}
-			else
-				{
-				notifParam = KErrCommsLineFail;
-				iDLState.iState = RFotaEngineSession::EDownloadFailed;
-				iDLState.iResult = RFotaEngineSession::EResDLFailDueToNWIssues;
-				}
-			}
-		//Handling Out Of Memory interrupt
-		else if ((dlErrorId == EGeneral && sysErrorId == KErrDiskFull ) || sysErrorId == KErrCodInsufficientSpace)
-			{
-			FLOG(_L("Reason: Disk full"));
-			iRestartCounter = -1;
-			notifType = KErrNotFound;
-			notifParam = KErrNotFound; // don't show anything
-			iDLState.iResult = RFotaEngineSession::EResDLFailDueToDeviceOOM;
-			}
-		//Handle unclassified (general) interrupts
-		else
-			{
-			iRestartCounter = -1;
-
-			
-			RProperty prop;
-			TInt val = KErrNone;
-		
-			TInt err = prop.Get(KPSUidStartup, KPSGlobalSystemState, val);
-			if (err==KErrNone && val!=ESwStateShuttingDown)
-				{
-				notifType = ESyncMLFwUpdErrorNote;				
-				}
-			else
-				{
-				FLOG(_L("Phone is powering down..."));
-				}
-
-			if (iDownloadResumable)
-				{
-				notifParam = KErrGeneralResume;
-				iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-				}
-			else
-				{
-				notifParam = KErrGeneralNoResume;
-				iDLState.iState = RFotaEngineSession::EDownloadFailed;
-				}
-
-
-        SetDLResultdlErrorId(dlErrorId ,sysErrorId  );
-			
-
-			}
-		if ( iRestartCounter <= 0)
-			{
-			iUpdateAfterDownload = EFalse;
-			SetDownloadActive(EFalse);
-			if ( iDLState.iSessionType!= ESanSilent && notifType!=KErrNotFound )
-				{
-				if ( iShowDLPrgUI )
-					LaunchNotifierL( (TSyncMLFwUpdNoteTypes)notifType, notifParam,0 );
-				else
-					LaunchNotifierL( (TSyncMLFwUpdNoteTypes)notifType, notifParam,0, ETrue);
-				}
-			FLOG(_L("Should  come here for nonpausable "));	
-			iDownloadFinalized = ETrue;
-			iFotaServer->FinalizeDownloadL( iDLState );
-			}
-		else
-			{
-			if (iDownloadResumable)
-				{
-				FLOG(_L("Resuming download..."));
-				iDownload->Start();
-				}
-			else
-				{
-				FLOG(_L("Restarting download..."));
-				iFotaServer->FinalizeDownloadL( iDLState );
-				}
-			}
-		}
-		break;
-
-	case EHttpDlPausable:
-		{
-		FLOG(_L("Download State: EHttpDlPausable"));
-		if (iDownloadResumable) //This is initially set by IsDownloadSuspendResumeSupported()
-			{
-			FLOG(_L("Download Suspend/Resume is supported!"));       				
-			}
-		else
-			{
-			FLOG(_L("Download Server support Suspend/Resume, but Fota doesn't!"));
-			//retain the state iDownloadResumable = EOmaDLResumeNotSupported;
-			}
-		}
-		break;
-
-	case EHttpDlNonPausable:
-		{
-		FLOG(_L("Download State: EHttpDlNonPausable"));
-		if (iDownloadResumable) //This is initially set by CheckDownloadVariations()
-			{
-			FLOG(_L("Download Server doesn't support Suspend/Resume, but Fota does!"));
-			//Reset the state to not supported.
-			iDownloadResumable = EFalse;
-			}
-		else
-			{
-			FLOG(_L("Download Server doesn't support Suspend/Resume, neither does Fota!"));
-			}
-		}
-		break;
-	case EHttpDlDeleting:	//13
-		{
-		FLOG(_L("Download State: EHttpDlDeleting"));
-		}
-		break;
-	case EHttpDlDeleted:	//11
-		{
-		FLOG(_L("Download State: EHttpDlDeleted"));
-		}
-		break;
-	default:
-		{
-		FLOG(_L("Default. No action performed for this Download State"));
-		}
-		break;
-	}
-	FLOG(_L("CFotaDownload::HandleDMgrEventL()  <<"));
-	}
-
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::SetDLResultdlErrorId
-// Sets the appropriate error
-// --------------------------------------------------------------------------
-//
-
-void CFotaDownload::SetDLResultdlErrorId( THttpDownloadMgrError adlErrorId, TInt32 asysErrorId)
-{
-      if ( adlErrorId == EInternal)
-				{
-				FLOG(_L("Reason:   error EInternal"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EContentFileIntegrity)
-				{
-				FLOG(_L("Reason:   error EContentFileIntegrity"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EMMCRemoved)
-				{
-				FLOG(_L("Reason:   error EMMCRemoved,"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EBadUrl) 
-				{
-				FLOG(_L("Reason:   error EBadUrl"));
-				iDLState.iResult = RFotaEngineSession::EResMalformedOrBadURL;
-				}
-			else if ( adlErrorId == EHttpUnhandled)
-				{
-				FLOG(_L("Reason:   error EHttpUnhandled, check global error id!"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EHttpAuthenticationFailed)
-				{
-				FLOG(_L("Reason:   error EHttpAuthenticationFailed"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EObjectNotFound)
-				{
-				FLOG(_L("Reason:   error EObjectNotFound"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EPartialContentModified)
-				{
-				FLOG(_L("Reason:   error EPartialContentModified"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EContentExpired)
-				{
-				FLOG(_L("Reason:   error EContentExpired"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( adlErrorId == EHttpRestartFailed)
-				{
-				FLOG(_L("Reason:   error EHttpRestartFailed"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-			else if ( asysErrorId == KErrCodInvalidDescriptor )
-				{
-				FLOG(_L("Reason:   error KErrCodInvalidDescriptor"));
-				iDLState.iResult  = RFotaEngineSession::EResMalformedOrBadURL;
-				}
-			else
-				{
-				FLOG(_L("Reason: unknown, check dlError!"));
-				iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-				}
-
-}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::HandleDMgrEventL
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::HandleDMgrEventL( RHttpDownload& aDownload
-		, THttpDownloadEvent aEvent )
-	{   
-	DoHandleDMgrEventL(&aDownload,aEvent);
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::LaunchNotifierL
-// Launches notifier. This method is also used to finalize erronous DL
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype
-		,const TInt aIntParam
-		,const TInt aMemoryNeeded
-		,TBool aFinishOnly )
-	{
-	if ( iNotifHandler ) iNotifHandler->Cancel();
-	else				 iNotifHandler = CFotaDownloadNotifHandler::NewL(this);
-	iNotifHandler->LaunchNotifierL( aNotetype,aIntParam,aMemoryNeeded
-			,aFinishOnly );
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::CheckDownloadVariations
-// Reads download variations - fota suspend & resume bahavior & FMS from cenrep keys
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::CheckDownloadVariations()
-	{
-	FLOG(_L("CFotaDownload::CheckDownloadVariations >>"));
-
-	CRepository* centrep( NULL);
-	TRAPD(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-	if (err) FLOG(_L("Error reading FotaServer cenrep... %d"),err);
-	TInt supported(KErrNone);
-	if (centrep ) 
-		{
-		err = centrep->Get( KSuspendResumeFeatureSupported, supported );
-		if (err) FLOG(_L("Error reading cenrep key... %d"),err);
-		iDownloadResumable = (supported==1)? ETrue:EFalse;
-
-		supported = KErrNone;
-		centrep->Get( KFotaMonitoryServiceEnabled, supported );
-		if (err) FLOG(_L("Error reading cenrep key... %d"),err);
-		iFMSEnabled = (supported > 0)? ETrue:EFalse;
-
-		delete centrep;
-		centrep = NULL;
-		}
-
-	FLOG(_L("Susp&Resume feature supported = %d, FMS feature supported = %d"),iDownloadResumable,iFMSEnabled);
-	FLOG(_L("CFotaDownload::CheckDownloadVariations <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::RunDownloadCancelL
-// Starts to cancel the download operation
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::RunDownloadCancelL(const TInt aReason, TBool aSilent)
-	{
-	FLOG(_L("CFotaDownload::RunDownloadCancelL, reason = %d, silent = %d >>"), aReason, aSilent);
-
-	iDLState.iState     = RFotaEngineSession::EDownloadFailed;
-	iDLState.iResult    = aReason;
-	iSilentOpn = aSilent;
-	
-	iRestartCounter = -1;
-	iUpdateAfterDownload = EFalse;
-	
-	if (!iDownload)
-		{
-		//iDownload is null when user cancels the download permanently when prompted to resume.
-		//hence retrieve the download object first 
-		iDownload = RetrieveDownloadL();
-		}
-	TInt err = iDownload->Delete(); //or Cancel or Reset?
-	FLOG(_L("Error = %d"),err);
-	
-	if(iDownloadFinalized == EFalse)
-	{
-	iFotaServer->FinalizeDownloadL( iDLState );
-	FLOG(_L("Should not come here fro nopausable "));
-	if (aReason == RFotaEngineSession::EResUserCancelled)
-		LaunchNotifierL(ESyncMLFwUpdOmaDLCancelled, EFalse, EFalse);
-	else if (aReason == RFotaEngineSession::EResUndefinedError)
-		LaunchNotifierL(ESyncMLFwUpdErrorNote, KErrGeneralNoResume, EFalse );
-  }
-	FLOG(_L("CFotaDownload::RunDownloadCancelL <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::RunDownloadSuspendL
-// Starts to suspend the download operation
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::RunDownloadSuspendL(const TInt aReason, TBool aSilent)
-	{
-	FLOG(_L("CFotaDownload::RunDownloadSuspendL, reason = %d, silent = %d >>"), aReason, aSilent);
-
-	iDLState.iState     = RFotaEngineSession::EDownloadProgressingWithResume;
-	iDLState.iResult    = aReason;
-	iSilentOpn = aSilent;
-	//First pause download, and later ask for user action.
-	TInt err = iDownload->Pause();
-
-	if (err)
-	{
-	//initial pausing becomes a problem.
-	FLOG(_L("Error while initial pausing...%d Hence download has to be cancelled permanently!"),err);
-	RunDownloadCancelL(aReason);
-	}
-
-	FLOG(_L("CFotaDownload::RunDownloadSuspendL <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::TryResumeDownloadL
-// Tries to resume the download operation
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::TryResumeDownloadL(TBool aUserInitiated)
-	{
-	FLOG(_L("CFotaDownload::TryResumeDownloadL >>"));
-
-	iUserInitiatedResume = aUserInitiated;
-	TInt err = RProperty::Define( TUid::Uid(KOmaDMAppUid),
-			KFotaDMRefresh,
-			RProperty::EInt,KReadPolicy,KWritePolicy);
-	FLOG(_L("RProperty KFotaDMRefresh Define, err = %d"), err);        
-	if (err != KErrAlreadyExists )
-		{
-		User::LeaveIfError(err);
-		}
-	//This P&S Key is used to notify DM UI on any download event. key=0 for idle and key=1 for download
-	err = RProperty::Set( TUid::Uid(KOmaDMAppUid),
-			KFotaDMRefresh,
-			ETrue );
-	FLOG(_L("RProperty KFotaDMRefresh Set ETrue, err = %d"), err);    
-
-	//Called to read the download variations in Fota (resume support & FMS)
-	CheckDownloadVariations();	
-	if (IsFMSEnabled() && iUserInitiatedResume)
-		iFotaServer->CancelFmsL();
-
-	//Query based on the type of DM session used earlier.
-	if (iUserInitiatedResume || iDLState.iSessionType != ESanSilent)
-		{
-		//Query user for resume
-		FLOG(_L("Quering user for resume..."));
-		if (iFotaServer->iNotifHandler)
-			{
-			iFotaServer->iNotifHandler->Cancel();
-			delete iFotaServer->iNotifHandler;
-			iFotaServer->iNotifHandler = NULL;
-			}
-		iNotifHandler = CFotaDownloadNotifHandler::NewL(this);
-
-		iNotifHandler->LaunchNotifierL(ESyncMLFwUpdOmaDLResume, EFalse, EFalse);
-		}
-	else //Only FMS initiated Silent Session download
-		{
-		//Resume directly
-		FLOG(_L("Resuming automatically..."));
-		ResumeDownloadL();
-		}
-	FLOG(_L("CFotaDownload::TryResumeDownloadL <<"));
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::ResumeDownloadL
-// Resume the download operation
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::ResumeDownloadL()
-	{
-	FLOG(_L("CFotaDownload::ResumeDownloadL >>"));
-	TBool toresetdl (EFalse);
-	TBool downloadiapvalid (ETrue);
-	//Find the download ui behavior from fota cenrep
-	TInt behavior(KErrNotFound);
-	CRepository* centrep = NULL;
-	TRAPD(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-	if (( centrep ) && ( err == KErrNone))
-	    {
-	    centrep->Get( KSilentOmaDlUIBehavior, behavior );
-	    delete centrep;
-	    }
-	centrep = NULL;
-//Commented for resolving APP dependency
-/*
-	if (iUserInitiatedResume || 
-	        (behavior == EOmacdOffdlprgOn || behavior == EOmacdOndlprgOn))
-		{
-		FLOG(_L("Showing Connecting progress note..."));
-		iFotaServer->iParentApp->SetUIVisibleL ( ETrue , EFalse );
-		
-		if ( !iDLProgressDlg )
-			{
-			iDLProgressDlg = new(ELeave) CFotaDLProgressDlg((CEikDialog** ) &iDLProgressDlg , EFalse, this, EConnectingNote );
-			iDLProgressDlg->PrepareLC( R_CONNECTION_NOTE );
-			}
-		// Load the resource files
-	    TInt err = KErrNone;
-	       
-	    // Localize the file name, and load the SCP resources
-	    TFileName resFile;
-	    resFile.Copy( KDriveZ );
-	    resFile.Append( KSCPResourceFilename );
-    	    
-	    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resFile );    
-
-	    TInt Res1(KErrNone);
-	    TRAP( err, Res1 =CCoeEnv::Static()->AddResourceFileL( resFile ) );        
-
-	    HBufC* buf = StringLoader::LoadLC(R_SYNCSTATUS_SYNC_CONN);
-	
-	    if( Res1 )
-	    	{
-	        iFotaServer->GetEikEnv()->DeleteResourceFile( Res1 );
-	    	}
-	    FLOG(_L("Reading txt as: %S"), &buf->Des());
-		iDLProgressDlg->SetTextL(buf->Des());
-		CleanupStack::PopAndDestroy(buf);
-	
-		iDLProgressDlg->RunLD();
-		}
-*/
-//Comment ends here
-	FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 1"));
-	
-	iDownload = RetrieveDownloadL();
-	if (iDownload)
-		{
-		FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 2: Successfully retrieved download object >>"));
-
-		SetIapToUseL(iDLState, iDLState.iIapId);
-
-		FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 3: Using iapid %d for resume..."), iDLState.iIapId);
-		downloadiapvalid = iFotaServer->CheckIapExistsL(iDLState.iIapId);
-		if (iDLState.iIapId > 0 && downloadiapvalid)
-			{
-			if (!iMonitor)
-				{
-				iMonitor = CFotaNetworkRegStatus::NewL (iFotaServer);
-				}
-			TBool val = iMonitor->IsConnectionPossibleL(iDLState.iIapId);
-			FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 4"));
-			delete iMonitor; iMonitor = NULL;
-			
-#if defined(__WINS__)
-			val =ETrue;
-#endif
-			if (!val)
-				{
-				FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 5.1: Disallowing resume operation as connection not possible"));
-				
-				if ( !iShowDLPrgUI && iDLProgressDlg )
-					{
-					FLOG(_L("Removing Connecting progress note..."));
-
-					iDLProgressDlg->ProcessFinishedL();
-					delete iDLProgressDlg;
-					iDLProgressDlg = NULL;
-					}
-				if (iUserInitiatedResume || iDLState.iSessionType!=ESanSilent)
-					LaunchNotifierL(ESyncMLFwUpdErrorNote, KErrCommsLineFail2,0);
-				iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-				iDLState.iResult = RFotaEngineSession::EResDLFailDueToNWIssues;
-				iUpdateAfterDownload = EFalse;
-				iFotaServer->FinalizeDownloadL(iDLState);
-				return;
-				}
-			}
-
-		if (iDLState.iIapId == KErrNotFound || !downloadiapvalid )
-		    {
-		    iDLState.iIapId = KErrNotFound;
-			User::LeaveIfError( iDownloadMgr.SetIntAttribute( EDlMgrIap, 0)); // Download mgr interprets 0 for Always Ask
-		    }
-		else
-			User::LeaveIfError( iDownloadMgr.SetIntAttribute( EDlMgrIap, iDLState.iIapId)); // IAP id
-
-		FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 5.2"));
-		SetDownloadUiBehavior(EFalse);		
-
-		if ( !iShowDLPrgUI && iDLProgressDlg )
-			{
-			FLOG(_L("Removing Connecting progress note..."));
-
-			iDLProgressDlg->ProcessFinishedL();
-			delete iDLProgressDlg;
-			iDLProgressDlg = NULL;
-			}
-		TInt dlsize, tlsize;
-		FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 6"));
-		iFotaServer->GetDownloadUpdatePackageSizeL(iDLState.iPkgId, dlsize,tlsize);
-		iDownloadedContentSize = dlsize; //for progress bar update only
-		iUpdateAfterDownload = iDLState.iUpdateLtr; //should update after reboot?
-		iRestartCounter = 0;
-		
-		//Set right states in fota db
-		iDLState.iState = RFotaEngineSession::EDownloadProgressingWithResume;
-		iDLState.iResult = KErrNotFound;
-		
-		iFotaServer->iDatabase->OpenDBL();
-		iFotaServer->iDatabase->SetStateL( iDLState, KNullDesC8, EFDBState|EFDBResult);
-		iFotaServer->iDatabase->CloseAndCommitDB();
-		iFreshDL = EFalse;
-		FLOG(_L("CFotaDownload::ResumeDownloadL, Stage 6: Starting to resume download now..."));
-		TInt err = iDownload->Start();
-		if (err == KErrNone)
-			{
-			//Set the P&S Key to active...
-			FLOG(_L("Resume operation is success!"));
-			SetDownloadActive(ETrue);
-			}
-		else
-			{
-			FLOG(_L("An error occured during resume, err = %d"),err);
-			toresetdl = ETrue;
-			}
-		}
-	else
-		{
-		FLOG(_L("Failed to get the paused download object"));
-		if ( iDLProgressDlg )
-			{
-			FLOG(_L("Removing Connecting progress note..."));
-			iDLProgressDlg->ProcessFinishedL(); // deletes itself
-			delete iDLProgressDlg;
-			iDLProgressDlg = NULL;
-			}
-		toresetdl = ETrue;
-		}
-      ReSetDownloadL(	toresetdl);
-	
-	FLOG(_L("CFotaDownload::ResumeDownloadL <<"));
-	}
-// --------------------------------------------------------------------------
-// CFotaDownload::ReSetDownloadL
-// Sets the download state to failed
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::ReSetDownloadL(TBool atoresetdl)
-{
-if (atoresetdl)
-		{
-		FLOG(_L("Resetting fota download !!!"));
-		if (iUserInitiatedResume || iDLState.iSessionType!=ESanSilent)
-			LaunchNotifierL(ESyncMLFwUpdErrorNote, KErrGeneralNoResume,0);
-		iDLState.iState = RFotaEngineSession::EDownloadFailed;
-		iDLState.iResult = RFotaEngineSession::EResUndefinedError;
-		iUpdateAfterDownload = EFalse;
-		iFotaServer->FinalizeDownloadL(iDLState);
-		}
-}
-
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::IsFMSEnabled
-// Returns FMS enabled state
-// --------------------------------------------------------------------------
-//
-TBool CFotaDownload::IsFMSEnabled()
-	{
-	FLOG(_L("CFotaDownload::IsFMSEnabled, iFMSEnabled = %d <<"), iFMSEnabled);
-	return iFMSEnabled;
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::IsDownloadResumable
-// Returns whether the download is resumable or not.
-// --------------------------------------------------------------------------
-//
-TBool CFotaDownload::IsDownloadResumable()
-	{
-	FLOG(_L("CFotaDownload::IsDownloadResumable, iDownloadResumable = %d <<"), iDownloadResumable);
-	return iDownloadResumable;
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::SetIapToUseL
-// Sets the IAP ID to use. This menthod is used in fresh and resume download.
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::SetIapToUseL(TPackageState aParams, const TInt aIapid)
-	{
-	FLOG(_L("CFotaDownload::SetIapToUseL >>"));
-
-	RSyncMLSession sml;
-	TInt profIapid( KErrNotFound );
-	TInt sockIapid( KErrNotFound );
-	TSmlServerAlertedAction saa(ESmlConfirmSync);
-
-	CleanupClosePushL( sml );
-	sml.OpenL();
-	iFotaServer->GetProfileDataL(&sml,aParams.iProfileId, profIapid, saa
-			,iIsjobStartedFromUI, iSanValue );
-	CleanupStack::PopAndDestroy( &sml );
-
-	// 2/3 GET IAP FROM ESOCK ----------------------------------------------
-	// resolve which accespoint is used for current DM session
-	if ( profIapid == KErrNotFound && aIapid==KErrNotFound)
-		{
-		RSocketServ serv;
-		CleanupClosePushL( serv );
-		User::LeaveIfError( serv.Connect() );
-
-		RConnection conn;
-		CleanupClosePushL( conn );
-		User::LeaveIfError( conn.Open( serv ) );
-
-		TUint count( 0 );
-		User::LeaveIfError( conn.EnumerateConnections ( count ) );
-		// enumerate connections
-		for( TUint idx=1; idx<=count; ++idx )
-			{
-			TConnectionInfo connectionInfo;
-			TConnectionInfoBuf connInfo( connectionInfo );
-
-			TInt err = conn.GetConnectionInfo( idx, connInfo ); // iapid
-			if( err != KErrNone )
-				{
-				CleanupStack::PopAndDestroy( 2 ); // conn, serv
-				User::Leave( err );
-				}
-			// enumerate connectionclients
-			TConnectionEnumArg	conArg;
-			conArg.iIndex = idx;
-			TConnEnumArgBuf conArgBuf(conArg);
-			err=conn.Control(KCOLConnection,KCoEnumerateConnectionClients
-					,conArgBuf);
-			if( err != KErrNone )
-				{
-				CleanupStack::PopAndDestroy( 2 ); // conn, serv
-				User::Leave( err );
-				}
-			TInt cliCount = conArgBuf().iCount;
-			for ( TUint j=1; j<=cliCount ;++j )
-				{
-				TConnectionGetClientInfoArg conCliInfo;
-				conCliInfo.iIndex = j;
-				TConnGetClientInfoArgBuf conCliInfoBuf(conCliInfo);
-				err=conn.Control(KCOLConnection, KCoGetConnectionClientInfo
-						, conCliInfoBuf);
-
-				if( err != KErrNone )
-					{
-					CleanupStack::PopAndDestroy( 2 ); // conn, serv
-					User::Leave( err );
-					}				
-				TConnectionClientInfo conCliInf = conCliInfoBuf().iClientInfo;
-				TUid uid = conCliInf.iUid;
-				if ( uid == TUid::Uid(KSosServerUid) )
-					{
-					sockIapid = connInfo().iIapId;
-					FLOG(_L("[FotaServer]  IAP found %x"),sockIapid);
-					}
-
-				FLOG(_L("[FotaServer]  CFotaDownload::DownloadL uid %x")
-						,uid.iUid);
-				}
-			}
-		CleanupStack::PopAndDestroy( 2 ); // conn, serv		
-		}
-	TInt newIapid( KErrNotFound );
-	if ( sockIapid!=KErrNotFound ) newIapid = sockIapid;
-	if ( profIapid!=KErrNotFound ) newIapid = profIapid;
-	if ( aIapid   !=KErrNotFound ) newIapid = aIapid;
-
-	//Do some intelligent work during resume
-	/* Some rules..
-	 * 1. If IAP is always ask in DM profile, use the earlier set during FMS trigger
-	 * 2. If IAP is always ask in DM profile, query user for IAP during user trigger
-	 * 3. If IAP has changed in DM profile after suspend, use the newer one during resume
-	 * 4. 
-	 */
-	TInt active (KErrNotFound);
-	RProperty::Get( TUid::Uid(KOmaDMAppUid), KFotaDownloadActive, active );
-	FLOG(_L("active = %d"),active);
-	if (active==EFalse && iDLState.iState == RFotaEngineSession::EDownloadProgressingWithResume)
-		{
-		//Actual resume only
-		if (!iUserInitiatedResume && profIapid == KErrNotFound  )
-			{
-			//FMS triggered resume, apply Rule 1
-			newIapid = iDLState.iIapId;
-			}
-		else if (profIapid == KErrNotFound)
-			{
-			//User triggered resume, apply Rule 2
-			newIapid = KErrNotFound;
-			}
-		else if (profIapid != iDLState.iIapId)
-			{
-			//IAP has changed in DM profile, apply Rule 3
-			newIapid = profIapid;
-			}
-		}
-	iDLState.iIapId = newIapid;
-
-
-	FLOG(_L("CFotaDownload::SetIapToUseL, iap = %d <<"), iDLState.iIapId);
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::SetDownloadUiBehavior
-// Sets Download UI behavior. ex: DD display and Progress note
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::SetDownloadUiBehavior(TBool aFreshDL)
-	{
-	FLOG(_L("CFotaDownload::SetDownloadUiBehavior, aFreshDL = %d >>"),aFreshDL);
-
-	if (aFreshDL) //Fresh download
-		{
-		iDLState.iSessionType = iSanValue;
-		}
-	else //resuming download
-		{
-		iSanValue = iDLState.iSessionType;
-		}
-
-	if ( !iIsjobStartedFromUI &&  iRestartCounter==0 ) //iRestartCounter to ensure that the UI behavior is read only once.
-		{
-		TInt behavior(KErrNotFound);
-		TInt sansupported(KErrNone);
-
-		//Find whether SAN is supported or not
-	    CRepository* centrep = NULL;
-
-	    TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) );    
-	    if( centrep ) centrep->Get( KDevManSANUIBitVariation, sansupported );
-	    delete centrep; centrep = NULL;
-	    FLOG(_L("...1..."));
-	    if (sansupported != 1) sansupported = 0;
-	    
-		//Find the download ui behavior from fota cenrep
-		TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-		if ( centrep ) 	centrep->Get( KSilentOmaDlUIBehavior, behavior );
-		delete centrep; centrep = NULL;
-
-		FLOG(_L("Values are... SAN enabled: %d, session type: %d, downloadbehavior: %d"),sansupported, iDLState.iSessionType,behavior);
-
-		if (sansupported) //SAN is supported
-			{
-				
-			DetermineUISANON(behavior)	;
-			
-			}
-		else //SAN not supported
-			{
-				DetermineUISANOFF(behavior);
-		
-			}
-		}
-	else// if (iRestartCounter==0) //Started from DM UI, but not retry
-		{
-		iShowOMACDUI = ETrue;
-		iShowDLPrgUI = ETrue;
-		if (aFreshDL)
-			iDLState.iSessionType = KErrNotFound;
-		}
-
-TInt value (EFotaUpdateDM);
-TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, value );
-if (!err && ((value == EFotaUpdateNSC) || (value == EFotaUpdateNSCBg)))
-{
-			iShowOMACDUI = EFalse;		
-			iShowDLPrgUI = ETrue;
-			FLOG(_L("CFotaDownload::DownloadL UI will not be shown!"));
-}
-	FLOG(_L("UI Behavior: OMA DD Display = %d, Download Progress = %d"),iShowOMACDUI,iShowDLPrgUI);
-
-	FLOG(_L("CFotaDownload::SetDownloadUiBehavior <<"));
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::DetermineUISANON
-// Determine UI when SAN is ON
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::DetermineUISANON(TInt aBehavior)
-{
-				switch (aBehavior)
-					{
-					case EOmacdOffdlprgOff: //0
-						{
-						iShowOMACDUI = EFalse;
-						iShowDLPrgUI = EFalse;
-						}
-						break;
-					case EOmacdOffdlprgOn: //1
-						{
-						iShowOMACDUI = EFalse;
-						iShowDLPrgUI = ETrue;
-						}
-						break;
-					case EOmacdOndlprgOff: //2
-						{
-						iShowOMACDUI = ETrue;
-						iShowDLPrgUI = EFalse;
-						}
-						break;
-					case EOmacdOndlprgOn: //3
-						{
-						iShowOMACDUI = ETrue;
-						iShowDLPrgUI = ETrue;
-						}
-						break;
-					default: //includes EChooseFromSan
-						{
-						if(iSanValue == ESanSilent)
-							{
-							iShowOMACDUI = EFalse;
-							iShowDLPrgUI = EFalse;
-							}
-						else if (iSanValue == ESanInformative)
-							{
-							iShowOMACDUI = EFalse;
-							iShowDLPrgUI = ETrue;
-							}
-						else //includes ESanInteractive, ESanNotSpecified
-							{
-							iShowOMACDUI = ETrue;
-							iShowDLPrgUI = ETrue;
-							}
-						}
-						break;
-					}
-	
-	
-}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::DetermineUISANOFF
-// Determine UI when SAN is OFF
-// --------------------------------------------------------------------------
-//
-
-void CFotaDownload::DetermineUISANOFF(TInt aBehavior)
-{
-			if (iSanValue==EAcceptedYes) //Accepted is Yes in Profile
-				{
-				switch (aBehavior)
-					{
-					case EOmacdOffdlprgOff: //0
-						{
-						iShowOMACDUI = EFalse;
-						iShowDLPrgUI = EFalse;
-						}
-						break;
-					case EOmacdOffdlprgOn: //1
-						{
-						iShowOMACDUI = EFalse;
-						iShowDLPrgUI = ETrue;
-						}
-						break;
-					case EOmacdOndlprgOff: //2
-						{
-						iShowOMACDUI = ETrue;
-						iShowDLPrgUI = EFalse;
-						}
-						break;
-					default: //includes EOmacdOndlprgOn
-						{
-						iShowOMACDUI = ETrue;
-						iShowDLPrgUI = ETrue;
-						}
-						break;
-					}
-				}
-			else // includes iSanValue = EAcceptedNo (Accepted is No in profile)
-				{
-				iShowOMACDUI = ETrue;
-				iShowDLPrgUI = ETrue;
-				}
-}
-
-
-
-
-
-
-
-// --------------------------------------------------------------------------
-// CFotaDownload::RetrieveDownloadL
-// Retrieves the RHttpDownload object from download manager during resume
-// --------------------------------------------------------------------------
-//
-RHttpDownload* CFotaDownload::RetrieveDownloadL()
-	{
-	FLOG(_L("CFotaDownload::RetrieveDownloadL >>"));
-	//Retrieve RHttpDownload object for the suspended download from Download Mgr.
-	if (!iDownloadMgr.Handle())
-		iDownloadMgr.ConnectL( TUid::Uid(KFotaServerUid) , *this, EFalse);
-	const CDownloadArray& downloads = iDownloadMgr.CurrentDownloads();
-	
-	TBuf8<KMaxPath> url8;
-	TInt32 val (KErrNone);
-	
-	RHttpDownload* aDownload (NULL);
-	for (TInt i = 0; i < downloads.Count(); i++ )
-		{
-		User::LeaveIfError( downloads[i]->GetStringAttribute( EDlAttrCurrentUrl, url8 ));
-		User::LeaveIfError( downloads[i]->GetIntAttribute( EDlAttrFotaPckgId, val));
-	
-		FLOG(_L("Current download(s) as per download mgr: %d, url = %S, pkgid = %d"), i+1, &url8, val);
-	
-		if (iDLState.iPkgId ==  val)
-			{
-			FLOG(_L("Successfully found the paused download object"));
-			aDownload = downloads[i];
-			if ( iUrl ) {delete iUrl; iUrl=NULL;}
-			iUrl = url8.Alloc();
-	
-			}
-		}
-	FLOG(_L("CFotaDownload::RetrieveDownloadL <<"));
-	return aDownload;
-	}
-
-// --------------------------------------------------------------------------
-// CFotaDownload::SetDownloadActive
-// Sets the download activity state P&S key
-// --------------------------------------------------------------------------
-//
-void CFotaDownload::SetDownloadActive(TBool aValue)
-	{
-	FLOG(_L("CFotaDownload::SetDownloadActive, aValue = %d"),aValue);
-	iDownloadActive = aValue;
-	TBool val (EFalse);
-	TInt err = RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaDownloadActive, val );
-
-	if (err == KErrNone && val != aValue)
-		{
-		err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaDownloadActive, aValue );
-		FLOG(_L("RProperty KFotaDownloadActive Set %d, err = %d"), aValue, err);
-		}
-	
-	FLOG(_L("CFotaDownload::SetDownloadActive <<"));
-	}
-
-// --------------------------------------------------------------------------
-// IsDownloadActive
-// Returns the activeness of the download
-// --------------------------------------------------------------------------
-//
-
-TBool CFotaDownload::IsDownloadActive()
-	{
-	FLOG(_L("CFotaDownload::IsDownloadActive, value = %d"),iDownloadActive);
-	return iDownloadActive;
-	}
-
-
-// --------------------------------------------------------------------------
-// CFotaDownloadNotifHandler::NewL 
-// --------------------------------------------------------------------------
-//
-CFotaDownloadNotifHandler* CFotaDownloadNotifHandler::NewL (CFotaDownload* aDownload)
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::NewL"));
-	__ASSERT_ALWAYS( aDownload, User::Panic(KFotaPanic, KErrArgument) );	
-	CFotaDownloadNotifHandler* h=new (ELeave)CFotaDownloadNotifHandler;
-	h->iDownload = aDownload;
-	h->iDownload->iFotaServer->iNotifHandler = h;
-	return h;
-	}
-
-// --------------------------------------------------------------------------
-CFotaDownloadNotifHandler::CFotaDownloadNotifHandler() : CActive(EPriorityNormal)
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::CFotaDownloadNotifHandler()"));
-	CActiveScheduler::Add( this ); 
-	}
-
-// --------------------------------------------------------------------------
-CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler()
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler >>"));
-	iNotifier.Close();
-	Cancel();
-	FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler <<"));
-	}
-
-// --------------------------------------------------------------------------
-void CFotaDownloadNotifHandler::RunL()
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::RunL() note:%d, param:%d" ),iNotifParams.iNoteType, iNotifParams.iIntParam);
-
-	TBool reset (ETrue);
-
-	iNotifier.Close();
-
-	iDownload->SetDownloadActive(EFalse);
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdErrorNote  ) // 1 
-		{
-		//do nothing here
-		}
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdOmaDLNotEnoughMemory ) // 7
-		{
-		//To be active as Flexible mem is in action.
-		if (iDownload->iFreshDL)
-			iDownload->SetDownloadActive(ETrue);
-		}
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdOmaDLUserCancel )
-		{
-		//At this point Download Mgr has already paused the download successfully.
-		if (iStatus.Int() == KErrCancel) //RSK Press
-			{
-			//User wants to cancel download permanently.
-			FLOG(_L("User choose to cancel download permanently!"));
-			iDownload->RunDownloadCancelL(RFotaEngineSession::EResUserCancelled);
-			}
-		else
-			{
-			//Other keys pressed, like LSK or Call termination key
-			FLOG(_L("User choose to resume download later, key press = %d"),iStatus.Int());
-			iDownload->iFotaServer->FinalizeDownloadL( iDownload->iDLState );
-			if (iStatus.Int() == KErrNone) //RSK is pressed
-				{
-				LaunchNotifierL(ESyncMLFwUpdOmaDLPostponed, EFalse, EFalse);
-				reset = EFalse;
-				}
-			else
-				iDownload->iFotaServer->ShutApp();
-			}
-		}
-
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdOmaDLPostponed )
-		{
-		//Nothing to do
-		}
-
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdOmaDLCancelled )
-		{
-		//Nothing to do
-		}
-
-	if ( iNotifParams.iNoteType == ESyncMLFwUpdOmaDLResume )
-		{
-		if (iStatus.Int() == KErrNone) // LSK Press
-			{
-			FLOG(_L("User choose to continue download now."));
-			iNotifParams.iNoteType = ESyncMLFwUpdUnknown;
-			iNotifParams.iIntParam = 0;
-			iDownload->ResumeDownloadL();
-			reset = EFalse;
-			}
-		else	//RSK or any other key
-			{
-			FLOG(_L("User cancelled to continue download now, key press = %d."),iStatus.Int());
-			if (iStatus.Int() == KErrCancel) //RSK is pressed
-				{
-				iDownload->iDLState.iResult = RFotaEngineSession::EResUserCancelled;
-				LaunchNotifierL(ESyncMLFwUpdOmaDLUserCancel, EFalse, EFalse);
-				reset = EFalse;
-				}
-			else
-				iDownload->iFotaServer->ShutApp();
-			}
-		}
-
-	if (reset)
-		{
-		iNotifParams.iNoteType = ESyncMLFwUpdUnknown;
-		iNotifParams.iIntParam = 0;
-		}
-	}
-
-// --------------------------------------------------------------------------
-TInt CFotaDownloadNotifHandler::RunError(TInt aError)
-	{	
-	FLOG(_L("CFotaDownloadNotifHandler::RunError %d"),aError);
-	return aError;
-	}
-
-// --------------------------------------------------------------------------
-void CFotaDownloadNotifHandler::DoCancel()
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::DoCancel >>"));
-	if (iNotifier.Handle())
-		{
-		iNotifier.CancelNotifier( KSyncMLFwUpdNotifierUid );
-		iNotifier.Close();
-		}
-		FLOG(_L("CFotaDownloadNotifHandler::DoCancel <<"));
-	}
-
-// --------------------------------------------------------------------------
-void CFotaDownloadNotifHandler::LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype
-		,const TInt aIntParam
-		, const TInt aMemoryNeeded
-		,TBool aFinishOnly)
-	{
-	FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL, aNoteType=%d, aParam=%d, aMemoryNeeded=%d aFinishOnly=%d >>  "), aNotetype, aIntParam, aMemoryNeeded, aFinishOnly?1:0);
-	
-	__ASSERT_ALWAYS( iNotifier.Handle()==0, User::Leave(KErrAlreadyExists) );
-	__ASSERT_ALWAYS( aMemoryNeeded>=0, User::Leave(KErrArgument) );
-
-
-	// Launch notifier
-	TSyncMLFwUpdNotifParams         params;
-	FLOG(_L("           1"));
-	params.iNoteType        = aNotetype;
-	params.iIntParam        = aIntParam;
-
-	TInt rem = 0;
-	rem = aMemoryNeeded % 1024 ;
-	if (rem)
-		{
-		params.iMemoryNeeded = (aMemoryNeeded /1024) + 1;   	
-		}
-	else
-		{  
-		params.iMemoryNeeded = (aMemoryNeeded /1024) ;
-		}
-
-	//    #endif    
-	TSyncMLFwUpdNotifParamsPckg     pckg(params);
-	iNotifParams.iNoteType  = params.iNoteType;
-	iNotifParams.iIntParam  = params.iIntParam;
-
-	iNotifParams.iMemoryNeeded = params.iMemoryNeeded;
-
-	iDummyResponsePckg = TSyncMLFwUpdNotifRetValPckg();
-	FLOG(_L("           2"));
-	if ( !aFinishOnly )
-		{
-		User::LeaveIfError( iNotifier.Connect() );
-		iNotifier.StartNotifierAndGetResponse( iStatus, KSyncMLFwUpdNotifierUid
-				, pckg, iDummyResponsePckg );
-		SetActive();
-		}
-	else
-		{
-		iStatus = KRequestPending;
-		SetActive();
-		TRequestStatus* status = &iStatus;
-		User::RequestComplete( status, KErrNone );
-		}
-	FLOG(_L("           3  %d"),iStatus.Int());
-	FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() <<"));	
-	}
-
-TBool CFotaDownloadNotifHandler::IsOpen()
-	{
-	FLOG(_L("Handle = %d"), iNotifier.Handle());
-	return (iNotifier.Handle())? ETrue:EFalse;
-	}
--- a/fotaapplication/fotaserver/FotaServer/src/fotaupdate.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1815 +0,0 @@
-/*
- * Copyright (c) 2005-2006 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"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:   starts update sequence
- *
- */
-
-
-
-// INCLUDE FILES
-#include <StringLoader.h>
-#include <fotaserver.rsg>
-#include <centralrepository.h>
-#include <AknUtils.h>
-#include <AknBidiTextUtils.h> 
-#include <biditext.h>
-#include <gdi.h>
-#include <fotaengine.h>
-#include <apgtask.h>
-#include <SyncMLNotifierParams.h>
-#include <aknradiobuttonsettingpage.h> 
-#include <akntitle.h>
-#include <schtime.h>
-#include <csch_cli.h>
-
-#include "fotaupdate.h"
-#include "fmsclient.h"
-#include "FotaReminderDlg.h"
-#include "FotasrvSession.h"
-#include "fotaserverPrivateCRKeys.h"
-#include "fotaserverPrivatePSKeys.h"
-
-
-
-
-
-// ============== LOCAL FUNCTIONS ============================================
-
-
-
-TInt WriteUpdateBitmapL( const TDesC& aText, const TDesC& aFile)
-    {
-    FLOG(_L("WriteUpdateBitmapL writing %S to %S w/ txtdir"),&aText,&aFile);
-
-    TSize   screensize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels();
-    TInt                width  = screensize.iWidth - KBmpMargin*2;
-    TInt                height =  screensize.iHeight;
-
-    CArrayFixSeg<TPtrC>*   lines = new CArrayFixSeg<TPtrC>(5);
-    CleanupStack::PushL(lines);
-    CFbsBitmap*         bitmap = new ( ELeave ) CFbsBitmap;
-    CleanupStack::PushL( bitmap );
-    bitmap->Create(  TSize(width,height), EColor64K );
-    CFbsBitmapDevice*   device = CFbsBitmapDevice::NewL( bitmap );
-    CleanupStack::PushL( device );
-    const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont);
-    CFbsBitGc*          context;
-    User::LeaveIfError( device->CreateContext( context ) );
-    CleanupStack::PushL( context );
-    TInt                ascent = font->AscentInPixels();
-    TInt                descent = font->DescentInPixels();
-    context->UseFont ( font );
-    context->Clear(); // bg color
-
-    // Visually ordered text
-    HBufC* wrappedstring = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(
-            aText, width,*font, *lines);
-    CleanupStack::PushL ( wrappedstring );
-    TBool dirfound (ETrue);
-    // direction of text, affects alignemnt
-    TBidiText::TDirectionality direction = TBidiText::TextDirectionality(
-            *wrappedstring, &dirfound );
-
-    // Print visual text to bitmap
-    for ( TInt i=0; i<lines->Count(); ++i ) 
-        {
-        TPtrC l = (*lines)[i];
-        TInt top = (ascent+descent)*(i);
-        TInt bot = (ascent+descent)*(i+1);
-        TRect rect (0, top ,width, bot );
-        CGraphicsContext::TTextAlign alignment = 
-        direction==TBidiText::ELeftToRight ? CGraphicsContext::ELeft 
-            : CGraphicsContext::ERight;
-        context->DrawText(l, rect, ascent, alignment);
-        }
-    height = (ascent+descent)*lines->Count() + descent;
-    bitmap->Resize( TSize(width,height));
-    bitmap->Save( aFile );
-    context->DiscardFont();
-    CleanupStack::PopAndDestroy( wrappedstring );
-    CleanupStack::PopAndDestroy( context );
-    CleanupStack::PopAndDestroy( device );
-    CleanupStack::PopAndDestroy( bitmap );
-    CleanupStack::PopAndDestroy( lines );
-    return 1;
-    }
-
-
-// ---------------------------------------------------------------------------
-// PackageFileName  Creates pgk filename ,like 5.swupd
-// ---------------------------------------------------------------------------
-void PackageFileName( TInt aPkgid, TDes8& aFileName )
-    {
-    aFileName.AppendNum(aPkgid);
-    aFileName.Append( KSwupdFileExt8 );
-    }
-
-
-// ---------------------------------------------------------------------------
-// PackageFilePath  Creates pk file path, like c:\\private\\102072C4\\5.swupd
-// ---------------------------------------------------------------------------
-void PackageFilePath( TInt aPkgid, TDes8& aPath )
-    {
-    TBuf8<20> fn;
-    PackageFileName ( aPkgid,fn);
-    aPath.Append(KSwupdPath8);
-    aPath.Append(fn);
-    }
-
-// ============================= MEMBER FUNCTIONS ============================
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CFotaUpdate()
-// ---------------------------------------------------------------------------
-//
-CFotaUpdate::CFotaUpdate() : CActive(EPriorityNormal) 
-,iScheduledUpdate(NULL),iHandleUpdateAcceptLater(EFalse)
-                {
-                CActiveScheduler::Add( this ); 
-                iNotifParams.iNoteType  = ESyncMLFwUpdUnknown;  
-                iNotifParams.iIntParam  = 0;
-                iChargeToMonitor = 0;
-                iFinalizeLater = EFalse;
-                }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::~CFotaUpdate()
-// ---------------------------------------------------------------------------
-//
-CFotaUpdate::~CFotaUpdate()
-    {
-    if(iScheduledUpdate)
-        {
-        delete iScheduledUpdate;
-        iScheduledUpdate = NULL;	
-        }
-    iIntervalType.Close();  
-    iInterval.Close();  
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::NewL 
-// ---------------------------------------------------------------------------
-//
-CFotaUpdate* CFotaUpdate::NewL (CFotaServer* aServer)
-    {
-    CFotaUpdate* ao = new (ELeave) CFotaUpdate();
-    ao->iFotaServer = aServer;
-    return ao;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CheckUpdateResults
-// Checks if there is update result file available (meaning that update just
-// took place)
-// ---------------------------------------------------------------------------
-//
-TBool CFotaUpdate::CheckUpdateResults( RFs& aRfs )
-    {
-    RFile   f;
-    TInt    err;
-    err = f.Open ( aRfs, KUpdateResultFile, EFileShareAny );
-    f.Close();
-    if ( err!=KErrNone )
-        {
-        return EFalse;
-        }
-    FLOG(_L(" CFotaUpdate::CheckUpdateResults  update result file Found! "));
-    return ETrue;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::ExecuteUpdateResultFileL
-// Read result code from update result file and update state accordingly. 
-// Show notifier "Update succesful". Do some cleanup.
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::ExecuteUpdateResultFileL( RFs& aRfs )
-    {
-    FLOG(_L("CFotaUpdate::ExecuteUpdateResultFileL >>"));
-    iFs = &aRfs;
-    TInt                err;
-    RFileReadStream     rstr;
-    TInt                result;
-    TInt                msglen;
-    HBufC8*             message=NULL;
-    HBufC16*            message16=NULL;
-    TBool               deleteData ( EFalse );
-
-    // Open update result file
-    FLOG(_L("opening rstr 1/2  "));
-    err = rstr.Open(*iFs,KUpdateResultFile ,EFileRead|EFileStream);
-    FLOG(_L("opened  rstr 2/2  "));
-    if(err) FLOG(_L("   update result file open err %d"), err);
-    User::LeaveIfError (err );
-    FLOG(_L("       0.1"));
-    CleanupClosePushL( rstr );
-    FLOG(_L("       0.2"));
-
-    // Read resultcode 
-    result = rstr.ReadUint32L();        FLOG(_L("       0.3"));
-    msglen = rstr.ReadUint32L();        FLOG(_L("       0.4  result: %d  \
-    msglen:%d "),  result, msglen);
-    if(msglen != 0)
-        {
-        FLOG(_L("       0.5  reading msg"));
-        message         = HBufC8::NewLC(msglen+1);
-        TPtr8  ptrdesc  = message->Des();
-        TRAPD ( err2, rstr.ReadL(ptrdesc) );
-        if ( err2 != KErrNone && err2 != KErrEof)
-            {
-            FLOG(_L("  file read err %d"),err2); User::Leave( err2 ); 
-            }
-
-        message16 = HBufC16::NewLC (message->Des().Length());
-        message16->Des().Copy( *message );
-        FLOG(_L("   1 update result: %d"),  result) ;
-        FLOG(_L("   2 dbg msg: %S"),message16);
-        CleanupStack::PopAndDestroy( message16 );
-        CleanupStack::PopAndDestroy( message );
-        }
-
-    FLOG(_L("       0.6 "));
-    CleanupStack::PopAndDestroy( &rstr ); 
-
-    // Map resultcode to FUMO result code
-    RFotaEngineSession::TState  fstate  
-    = RFotaEngineSession::EUpdateFailed;
-    RFotaEngineSession::TResult fresult 
-    = RFotaEngineSession::EResUpdateFailed;
-
-    TDriveNumber drive;
-    TBool toencrypt =   iFotaServer->NeedToEncryptL(drive);
-
-    FLOG(_L("   3"));
-    switch ( result )
-        {
-        case UPD_OK:
-            {
-            fstate = RFotaEngineSession::EUpdateSuccessfulNoData;
-            fresult = RFotaEngineSession::EResSuccessful;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNone, toencrypt );
-            }
-            break;
-        case UPD_INSTALL_REQUEST_IS_INVALID:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResUpdateFailed;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotFound, toencrypt );
-            }
-            break;
-        case UPD_UPDATE_PACKAGE_IS_ABSENT:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResUpdateFailed;
-            }
-            break;
-        case UPD_UPDATE_PACKAGE_IS_CORRUPTED:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResCorruptedFWUPD;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotSupported, toencrypt );
-            }
-            break;
-        case UPD_UPDATE_PACKAGE_CONTENTS_IS_INVALID:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResCorruptedFWUPD;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotSupported, toencrypt );
-            }
-            break;
-        case UPD_UPDATE_PACKAGE_IS_NOT_COMPATIBLE_WITH_CURRENT_MOBILE_DEVICE:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResPackageMismatch;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotSupported, toencrypt );
-            }
-            break;
-        case UPD_FATAL_ERROR:
-            {
-            fstate = RFotaEngineSession::EUpdateFailedNoData;
-            fresult = RFotaEngineSession::EResUpdateFailed;
-            deleteData = ETrue;
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotFound, toencrypt );
-            }
-            break;
-
-        default:
-            {
-            FLOG(_L("   3.1 invalid result: %d"), result);
-            LaunchNotifierL ( ESyncMLFwUpdResultNote, KErrNotFound, toencrypt );
-            }
-            break;      
-        }
-
-    // Find the state 60 (update  progressing) -> 100 (etc)
-    RArray<TInt>    states;
-    TPackageState   state;
-    CleanupClosePushL (states);
-    iFotaServer->iDatabase->OpenDBL();
-    iFotaServer->iDatabase->GetAllL(states);
-
-    FLOG(_L("   4.1 found %d states "),states.Count() );
-    for(TInt i=0;i<states.Count(); ++i ) 
-        {
-        TPackageState   tmp;
-        tmp = iFotaServer->iDatabase->GetStateL(  states[i]  );
-        FLOG(_L("   5 got state "));
-        if ( tmp.iState == RFotaEngineSession::EUpdateProgressing )
-            {
-            state = tmp;
-            state.iState    = fstate;
-            state.iResult   = fresult;
-            FLOG(_L("   6 Updating state id %d  to %d ,result %d  ")
-                    ,state.iPkgId, state.iState,state.iResult );
-            iFotaServer->iDatabase->SetStateL(state,KNullDesC8
-                    ,EFDBState|EFDBResult ) ;
-            }
-        }
-    iFotaServer->iDatabase->CloseAndCommitDB();
-    CleanupStack::PopAndDestroy(&states);
-
-
-    // Delete request file
-    err = BaflUtils::DeleteFile ( *iFs, KUpdateRequestFile );
-    if ( err != KErrNone && err != KErrNotFound ) 
-        {
-        FLOG(_L("   6.1  req file deleted, err %d"), err);
-        User::Leave(err); 
-        } 
-
-    // Write timestamp (shown to user in device management ui)
-    if( fresult == RFotaEngineSession::EResSuccessful )
-        {
-        RFileWriteStream    wstr;
-        TTime               time;
-        User::LeaveIfError( wstr.Replace( *iFs, KUpdateTimeStampFileName
-                ,EFileWrite ) );
-        CleanupClosePushL ( wstr );
-        time.HomeTime();
-        TInt                year   = time.DateTime().Year();
-        TInt                month  = time.DateTime().Month();    
-        TInt                day    = time.DateTime().Day();    
-        TInt                hour   = time.DateTime().Hour();    
-        TInt                minute = time.DateTime().Minute();    
-        wstr.WriteInt32L(year) ;
-        wstr.WriteInt32L(month) ;
-        wstr.WriteInt32L(day) ;
-        wstr.WriteInt32L(hour) ;
-        wstr.WriteInt32L(minute) ;   
-        CleanupStack::PopAndDestroy (1); // wstr
-        }
-    // Delete package content
-    if ( deleteData  && state.iPkgId > KErrNotFound )
-        {
-        iFotaServer->StoragePluginL()->DeleteUpdatePackageL( state.iPkgId ) ;
-        }
-
-
-    // Report state back to syncml server
-    if ( state.iPkgId >= 0 )
-        {
-        FLOG(_L("   6.1 creating device mgmt session for profile %d")
-                ,state.iProfileId);
-        iFotaServer->CreateDeviceManagementSessionL( state );
-        }
-    else 
-        {
-        FLOG(_L(" No state found in 'update progress' mode! cannot report\
-        status to DM server "));
-        }
-
-    FLOG(_L("CFotaUpdate::ExecuteUpdateResultFileL <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::DeleteUpdateResultsL
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::DeleteUpdateResultFileL( RFs& aRfs )
-    {
-    FLOG(_L("CFotaUpdate::DeleteUpdateResultsL "));
-    // Delete result file
-    BaflUtils::DeleteFile( aRfs, KUpdateResultFile );
-    BaflUtils::DeleteFile( aRfs, KUpdateRequestFile );
-    BaflUtils::DeleteFile( aRfs, KUpdateBitmap );
-    BaflUtils::DeleteFile( aRfs, KRestartingBitmap );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::RunL
-//  Handles user selection (button press: accept/ cancel update)
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::RunL()
-    {
-    FLOG(_L( "[FotaServer] CFotaUpdate::RunL() >> %d"  ),iStatus.Int() );
-    TBool       handled( EFalse );
-    User::LeaveIfError(iNotifier.CancelNotifier(KSyncMLFwUpdNotifierUid));
-    iNotifier.Close();
-
-    if (iStatus.Int() == KErrNotFound )
-        {
-        FLOG(_L("Exiting...."));
-        TApaTaskList taskList(iFotaServer->GetEikEnv()->WsSession());
-        TApaTask task=taskList.FindApp(TUid::Uid(KOmaDMAppUid));
-        if(task.Exists())
-            {
-            task.EndTask();
-            }
-        return;
-
-        }
-    // Handle update start query
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdStartQuery )
-        {
-        FLOG(_L("   update start query"));
-        // User pressed accept
-        if ( iStatus.Int() == KErrNone )
-            {
-            handled = ETrue;
-            HandleUpdateAcceptStartL();
-            }
-        // User pressed later
-        else if ( iStatus.Int() == KErrCancel )
-            {
-
-            FLOG(_L("USER PRESSED LATER"));
-            handled = ETrue;
-            HandleUpdateAcceptLaterL();
-            }
-        }
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdStartQueryEnc )
-        {
-        FLOG(_L("   update start query"));
-
-        if ( iStatus.Int() == KErrNone )
-            {
-            FLOG(_L(" user accepted query to decrypt memory"));
-            handled = ETrue;
-            TRAPD(err, iFotaServer->DoStartDecryptionL());
-            
-            if (err == KErrNotReady)
-                {
-                HandleUpdateErrorL(err);
-                }
-            }
-        else if (iStatus.Int() == KErrCancel )
-            {
-            FLOG(_L("User pressed cancel. Don't decrypt. Stop."));
-            handled = ETrue;
-            LaunchNotifierL( ESyncMLFwUpdNoReminder , KErrNone );
-            }
-
-        }
-    // Handle battery error
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdErrorNote )
-        {
-
-        if (iNotifParams.iIntParam == KErrBadPower || iNotifParams.iIntParam == KErrBadUsbPower)
-            {
-            FLOG(_L("       battery note"));
-            if ( iStatus.Int() == KErrNone )
-                {
-                handled = ETrue;
-
-                // Still check batt. (user might have connected charger)
-
-                HandleErrorBasedonChargingTypeL();
-
-                }
-            else if (iNotifParams.iIntParam == KErrDeviceMemoryBusy)
-                {
-                FLOG(_L("Do nothing. Stop the update."));
-                iFotaServer->FinalizeUpdateL();
-                }
-            else if (iNotifParams.iIntParam == KErrBadPowerForEnc)
-                {
-                if (iFinalizeLater)
-                    {
-                    FLOG(_L("Finalizing update now..."));
-                    iFinalizeLater = EFalse;
-                    iFotaServer->FinalizeUpdateL();
-                    }
-                }
-            }
-        }
-
-    //  Handle update complete notification
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdResultNote )
-        {
-        handled = ETrue;
-        DeleteUpdateResultFileL( iFotaServer->iFs );
-        if (!iNotifParams.iEncryptReq)
-            {
-            FLOG(_L("Going to finalize update..."));
-            iFotaServer->FinalizeUpdateL();
-            }
-
-        }
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdNoReminder )
-        {
-        FLOG(_L(" No Reminder selected"));
-        if ( iStatus.Int() == KErrNone )
-            {
-            handled = ETrue;
-
-            FindScheduleL( ETrue );
-            iUpdateState.iState = RFotaEngineSession::EStartingUpdate;
-            iFotaServer->iDatabase->OpenDBL();
-            iFotaServer->iDatabase->SetStateL(iUpdateState ,KNullDesC8,EFDBState);
-            iFotaServer->iDatabase->CloseAndCommitDB();
-
-            // Report state back to syncml server
-            if ( iUpdateState.iPkgId >= 0 && iUpdateState.iSendAlert )
-                {
-                FLOG(_L("   creating device mgmt session for profile %d")
-                        ,iUpdateState.iProfileId);
-                iFotaServer->CreateDeviceManagementSessionL( iUpdateState );
-                }
-            iFotaServer->FinalizeUpdateL();
-            }
-        }
-    if ( iNotifParams.iNoteType == ESyncMLFwUpdResultNote && iNotifParams.iEncryptReq)
-        {
-        if (iStatus.Int() == KErrNone)
-            {
-            FLOG(_L("User wanted to start encryption..."));
-            iFotaServer->DoStartEncryptionL();
-            }
-        else 
-            {
-            FLOG(_L("User do not want to start encryption."));
-            }
-        if (!iFinalizeLater)
-            iFotaServer->FinalizeUpdateL();
-        }
-    if ( !handled ) 
-        {
-        FLOG(_L("CANNOT INTERPRET NOTIFIER RESULT CODE: %d"), iStatus.Int() );
-        }
-
-    FLOG(_L( "[FotaServer] CFotaUpdate::RunL() <<" ) );
-    }
-
-
-
-
-
-// ---------------------------------------------------------------------------
-//  CFotaUpdate::HandleUpdateAcceptStartL()
-//  Handles user selection of NOW
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::HandleUpdateAcceptStartL(TBool aSkipBatteryChk)
-    {
-    FLOG(_L("USER PRESSED ACCEPT"));
-
-    TBool	enoughPower (EFalse);
-    TInt usbchargingsupport =0;
-    if (aSkipBatteryChk)
-        {
-        enoughPower = ETrue;
-        }
-    else
-        {
-        CRepository* centrep = NULL;
-        //centrep = CRepository::NewLC( TUid::Uid(KFotaServerUid));
-        TRAPD(err, centrep = CRepository::NewL( TUid::Uid(KFotaServerUid)));
-        if(err)
-            {
-            FLOG(_L("reading from cenrep failed"));
-            }
-
-        if(centrep)
-            {centrep->Get( KFotaUSBChargerEnabled , usbchargingsupport );
-            if(usbchargingsupport != 0 && usbchargingsupport != 1)
-                usbchargingsupport =0;
-            delete centrep;
-            } 
-        centrep = NULL;
-        enoughPower = CheckBatteryL(usbchargingsupport);
-#if defined(__WINS__)
-        enoughPower = ETrue;
-#endif
-        }
-    // Failure due to low battery
-    if ( !enoughPower )
-        {
-        FLOG(_L("Launching low battery notifier"));
-        if(!usbchargingsupport)
-            LaunchNotifierL( ESyncMLFwUpdErrorNote, KErrBadPower );
-        else
-            LaunchNotifierL( ESyncMLFwUpdErrorNote , KErrBadUsbPower );
-        }            
-    else
-        {
-        UpdateL();
-        }   
-    }
-
-
-void CFotaUpdate::HandleUpdateErrorL(TInt aError, TInt aValue)
-    {
-    FLOG(_L("CFotaUpdate::HandleUpdateErrorL, error = %d, value = %d >>"), aError, aValue);
-
-    switch (aError)
-        {
-        case KErrNotReady: //Called from within StartUpdate
-            {
-            LaunchNotifierL(ESyncMLFwUpdErrorNote,KErrDeviceMemoryBusy);
-            }
-            break;
-        case KErrBadPower: //Called from fotaserver when battery power is not enough
-            {
-            iChargeToMonitor = aValue;
-            CRepository* centrep = NULL;
-            TRAPD(err, centrep = CRepository::NewL( TUid::Uid(KFotaServerUid)));
-            if(err)
-                {
-                FLOG(_L("reading from cenrep failed"));
-                }
-            TInt usbchargingsupport =0;
-            if(centrep)
-                {centrep->Get( KFotaUSBChargerEnabled , usbchargingsupport );
-                if(usbchargingsupport != 0 && usbchargingsupport != 1)
-                    usbchargingsupport =0;
-                delete centrep;
-                } 
-            centrep = NULL;
-            FLOG(_L("Launching low battery notifier, usbsupport = %d, state = %d"), usbchargingsupport, iUpdateState.iState);
-            if(!usbchargingsupport )
-                {
-                FLOG(_L("Here 1"));
-                if (iUpdateState.iState == RFotaEngineSession::EStartingUpdate)
-                    {
-                    FLOG(_L("Here 2"));
-                    LaunchNotifierL( ESyncMLFwUpdErrorNote, KErrBadPower );
-                    }
-                }
-            else
-                {
-                LaunchNotifierL( ESyncMLFwUpdErrorNote , KErrBadUsbPower );
-                }
-
-            }
-            break;
-        default:
-            {
-            //Do nothing
-            }
-        }
-
-
-    FLOG(_L("CFotaUpdate::HandleUpdateErrorL <<"));
-    }
-
-void CFotaUpdate::HandleEncryptionErrorL(TInt aError)
-    {
-    FLOG(_L("CFotaUpdate::HandleEncryptionErrorL, error = %d >>"), aError);
-
-    if (aError == KErrBadPower)
-        {
-        iFinalizeLater = ETrue;
-        LaunchNotifierL(ESyncMLFwUpdErrorNote, KErrBadPowerForEnc);
-        }
-    else 
-        {
-        FLOG(_L("Unknown error. Ignored"));
-        }
-
-    FLOG(_L("CFotaUpdate::HandleEncryptionErrorL <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-//  CFotaUpdate::HandleUpdateAcceptLaterL
-//  Handles user selection of Later
-// ---------------------------------------------------------------------------
-void CFotaUpdate::HandleUpdateAcceptLaterL()
-    {
-    TInt fotaUpdateAppName (EFotaUpdateDM);
-    TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, fotaUpdateAppName );
-    FLOG(_L("Setting iHandleUpdateAcceptLater to True"));
-
-    if (!err && ((fotaUpdateAppName == EFotaUpdateNSC) || (fotaUpdateAppName == EFotaUpdateNSCBg )))
-        {
-        iFotaServer->FinalizeUpdateL();		//make sure it is not called 2 times				
-        }
-    else
-        {
-        iHandleUpdateAcceptLater = ETrue;
-        ShowReminderDialogL();				
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-//  CFotaUpdate::HandleErrorBasedonChargingTypeL
-//  Handles the error based on charger type supported by the device
-// ---------------------------------------------------------------------------
-
-void CFotaUpdate::HandleErrorBasedonChargingTypeL()
-    {
-    FLOG(_L("CFotaUpdate::HandleErrorBasedonChargingTypeL >>"));
-
-    if (iUpdateState.iState == RFotaEngineSession::EStartingUpdate)
-        {
-        if (iNotifParams.iIntParam == KErrBadUsbPower)
-            {  
-            FLOG(_L("handling usb charger error "));
-            SetUpdateFailedStatesL();
-            FLOG(_L("calling for monitoring  the battery"));
-            iFotaServer->MonitorBattery(iChargeToMonitor);
-            iFotaServer->FinalizeUpdateL();
-            }
-        else
-            {
-            TInt usbcharger = KErrNone; 
-            TBool enoughPower = CheckBatteryL(usbcharger);
-
-#if defined(__WINS__)
-            //It will not come here, just used for testing.
-            enoughPower = ETrue;
-#endif
-
-            if (enoughPower)
-                {
-                //User has connected the charger
-                FLOG(_L("User has connected the charger"));
-                UpdateL();
-                }
-            else
-                {
-                FLOG(_L("User hasn't connected the charger"));
-                //User hasn't connected the charger, hence notify user to update later.
-                SetUpdateFailedStatesL();
-                //Call reminder here
-                if(!iHandleUpdateAcceptLater)
-                    {
-                    FLOG(_L("calling HandleUpdateAcceptLaterL"));
-                    HandleUpdateAcceptLaterL();
-                    }
-                iHandleUpdateAcceptLater = EFalse;
-                }
-            }
-        }
-    else //must be during encryption after update
-        {
-        if (iNotifParams.iIntParam == KErrBadUsbPower)
-            {
-            iFotaServer->MonitorBattery(iChargeToMonitor);
-            }
-        else
-            {
-            //nothing to do for dynamo charging
-            }
-        iFotaServer->FinalizeUpdateL();
-        }
-    FLOG(_L("CFotaUpdate::HandleErrorBasedonChargingTypeL <<"));
-    }
-
-// ---------------------------------------------------------------------------
-//  CFotaUpdate::SetUpdateFailedStatesL
-//  Set the state to update failed
-// ---------------------------------------------------------------------------
-
-void CFotaUpdate::SetUpdateFailedStatesL()
-    {
-    FLOG(_L("CFotaUpdate::SetUpdateFailedStatesL >>"));
-
-    iUpdateState.iState = RFotaEngineSession::EStartingUpdate;
-    iUpdateState.iResult= RFotaEngineSession::EResUpdateFailed;
-    iFotaServer->iDatabase->OpenDBL();
-    iFotaServer->iDatabase->SetStateL( iUpdateState ,KNullDesC8
-            ,EFDBState|EFDBResult );
-    iFotaServer->iDatabase->CloseAndCommitDB();
-
-    FLOG(_L("CFotaUpdate::SetUpdateFailedStatesL <<"));
-
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::DoCancel()
-    {
-    FLOG(_L("CFotaUpdate::DoCancel() >>"));
-    iNotifier.CancelNotifier(KSyncMLFwUpdNotifierUid);
-    iNotifier.Close();
-    FLOG(_L("CFotaUpdate::DoCancel() <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::RunError(TInt aError)
-// ---------------------------------------------------------------------------
-//
-TInt CFotaUpdate::RunError(TInt aError)
-    {
-    FLOG(_L("CFotaUpdate::RunError >> err %d"),aError);
-    FLOG(_L("CFotaUpdate::RunError << err %d"),aError);
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------------------------
-// CSyncMLNTestAppAO::LaunchNotifierL
-// Shows one of the following queries: "update now?", "update success",
-//  "update fail", "too low battery"
-// ---------------------------------------------------------------------------
-void CFotaUpdate::LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype
-        ,const TInt aIntParam, const TBool aEnc )
-    {
-    FLOG(_L("CFotaUpdate::LaunchNotifierL() >>  prof.Id: %d")
-            ,iUpdateState.iProfileId);
-    if (!IsActive())
-        {
-        TSyncMLFwUpdNotifParams         params;
-        params.iNoteType        = aNotetype;
-        params.iIntParam        = aIntParam;
-        params.iEncryptReq = aEnc;
-        TSyncMLFwUpdNotifParamsPckg     pckg(params);
-        iNotifParams.iNoteType  = params.iNoteType;
-        iNotifParams.iIntParam  = params.iIntParam;
-        iNotifParams.iEncryptReq = params.iEncryptReq;
-        iDummyResponsePckg = TSyncMLFwUpdNotifRetValPckg();
-        User::LeaveIfError( iNotifier.Connect() );
-        iNotifier.StartNotifierAndGetResponse( iStatus,KSyncMLFwUpdNotifierUid
-                , pckg, iDummyResponsePckg );
-        SetActive();
-        }
-    FLOG(_L("CFotaUpdate::LaunchNotifierL() <<"));
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::UpdateL
-// Updates the fw: Creates input files for update agent and boots device to 
-// update mode.
-// ---------------------------------------------------------------------------
-void CFotaUpdate::UpdateL()
-    {
-    FLOG(_L("CFotaUpdate::UpdateL() >>"));
-    // Set state ........................................
-    iUpdateState.iState  = RFotaEngineSession::EUpdateProgressing;
-    iFotaServer->iDatabase->OpenDBL();
-    iFotaServer->iDatabase->SetStateL( iUpdateState ,KNullDesC8, EFDBState );
-    iFotaServer->iDatabase->CloseAndCommitDB();
-
-    // Write update request for update agent..............
-    FLOG(_L("CFotaUpdate::UpdateL  1 writing update.req "));
-    TBuf8<150>           dp2filepath;
-    HBufC16*             dp2;
-    RFileWriteStream    wstr;
-    CleanupClosePushL ( wstr );
-    FLOG(_L("CFotaUpdate::UpdateL  2 getting pkg location"));
-    iFotaServer->StoragePluginL()->GetUpdatePackageLocationL( 
-            iUpdateState.iPkgId,  dp2filepath  );
-    FLOG(_L("CFotaUpdate::UpdateL  3 craeting update.req") );
-    User::LeaveIfError( wstr.Replace( iFotaServer->iFs
-            ,KUpdateRequestFile, EFileWrite ) );
-    wstr.WriteInt16L( 1 ); // version number is  1
-    wstr.WriteInt32L( 1 ); // count   of cmds is 1
-    wstr.WriteInt16L( 0 ); // requestid is 0
-
-    dp2 = HBufC16::NewLC ( dp2filepath.Length( ) );
-    dp2->Des().Copy( dp2filepath );
-    wstr.WriteInt32L( dp2->Des().Length() + 1 ); // length of filename + null
-    wstr.WriteL( dp2->Des() );
-    wstr.WriteInt16L( 0 ); // null character
-    CleanupStack::PopAndDestroy( dp2 );
-    CleanupStack::PopAndDestroy( &wstr ); // wstr
-
-    FLOG(_L("CFotaUpdate::UpdateL  4 craeting update.bmp") );
-
-    // Write update graphic for update agent ...............
-    HBufC*              updatetxt;
-    HBufC*              restarttxt;
-    updatetxt  = StringLoader::LoadLC( R_APPS_FOTA_UPDATING );
-    restarttxt = StringLoader::LoadLC( R_APPS_FOTA_RESTARTING );
-    WriteUpdateBitmapL( updatetxt->Des(), KUpdateBitmap );
-    WriteUpdateBitmapL( restarttxt->Des(), KRestartingBitmap ); 
-    CleanupStack::PopAndDestroy( restarttxt );
-    CleanupStack::PopAndDestroy( updatetxt );
-    TRAPD(error,FindScheduleL( ETrue)); //deleting the schedule (fix for failed update) 
-    if(error)
-        {
-        FLOG(_L("CFotaUpdate::UpdateL  error in deleting previous schedule") );	
-
-        }  
-    // Simulate update agent by writing result file.
-    CRepository* centrep( NULL);
-    TInt err = KErrNone;
-    TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-    TInt simulate(KErrNotFound);
-    if ( centrep ) 
-        {
-        err = centrep->Get( KSimulateUpdateAgent, simulate );
-        }
-    delete centrep;
-    if ( simulate>0 )
-        {   
-        FLOG(_L("CFotaUpdate::UpdateL  5  - writing update.resp"));
-        RFileWriteStream    respstr;
-        CleanupClosePushL ( respstr );
-        User::LeaveIfError( respstr.Replace( iFotaServer->iFs, KUpdateResultFile
-                , EFileWrite ) );
-
-        respstr.WriteUint32L(UPD_OK);
-        respstr.WriteUint32L(15);
-        respstr.WriteL(_L("UPDATE DONE!"));
-        CleanupStack::PopAndDestroy( &respstr );
-        }
-
-    CRepository* centrep2 = NULL;
-    TRAP( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) )
-    if (err==KErrNone ) 
-        {
-        centrep2->Set(  KFotaUpdateState, EFotaPendingGenAlert );
-        }
-    delete centrep2;
-
-    // Boot to update mode 
-    LaunchNotifierL( ESyncMLFwUpdRebootNote, KErrNone);
-
-    FLOG(_L("   waiting 2 sec to keep 'restarting' visible"));
-    User::After(TTimeIntervalMicroSeconds32(2000000));
-
-    RStarterSession     starter;
-    FLOG(_L("           starter->Connect"));
-    User::LeaveIfError(starter.Connect());
-    starter.Reset(RStarterSession::EFirmwareUpdate);
-    starter.Close();
-    FLOG(_L("CFotaUpdate::UpdateL() <<"));
-    }   
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CheckBatteryL()
-// Cheks if there's enough battery power to update
-// ---------------------------------------------------------------------------
-//
-TBool CFotaUpdate::CheckBatteryL(TBool aUSBChargingsupported)
-    {
-    TInt        chargingstatus( EChargingStatusError );
-    TInt        batterylevel( 1 );
-    TBool       enoughPower( EFalse );
-    // Read battery
-    FLOG(_L("   0.9 checking batt level"));
-    RProperty   pw;
-    User::LeaveIfError(pw.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel));
-    User::LeaveIfError(pw.Get( batterylevel ));
-    pw.Close();
-    if(aUSBChargingsupported)
-        {
-        if ( batterylevel >= EBatteryLevelLevel2 ) 
-            enoughPower = ETrue;
-
-        //return enoughPower; 
-        }
-    else
-        {
-        User::LeaveIfError(pw.Attach(KPSUidHWRMPowerState,KHWRMChargingStatus));
-        User::LeaveIfError(pw.Get( chargingstatus ));
-        pw.Close();
-
-        // Too low battery, power insufficient
-        if ( batterylevel >= EBatteryLevelLevel2 ) 
-            {
-            enoughPower = ETrue;
-            }
-        // But charger is connected, power sufficient
-        if ( chargingstatus != EChargingStatusError
-                && chargingstatus != EChargingStatusNotConnected )
-            {
-            enoughPower = ETrue;
-            }
-        }
-
-    if (!enoughPower)
-        iChargeToMonitor = EBatteryLevelLevel2;
-    FLOG(_L("   1.0 batt level: %d  (0..7), chargingstatus %d")
-            ,batterylevel,chargingstatus);
-    FLOG(_L("CFotaUpdate::checkBattery %d"), enoughPower?1:0 );
-    return enoughPower;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::StartUpdateL
-// Starts fw updating (shows a notifier to user). 
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::StartUpdateL( const TDownloadIPCParams &aParams )
-    {
-    FLOG(_L("CFotaUpdate::StartUpdateL(TDownloadIPCParams aParams) >> \
-    pkig:%d"), aParams.iPkgId );
-    TSmlProfileId profile(KErrNotFound);
-
-    // Get update state from db
-    iFotaServer->iDatabase->OpenDBL( );
-    iUpdateState = iFotaServer->iDatabase->GetStateL( aParams.iPkgId );
-    iFotaServer->iDatabase->CloseAndCommitDB( );
-
-    FLOG(_L("   0 "));
-    if ( iUpdateState.iPkgId == KErrNotFound )
-        {
-        FLOG(_L("  STATE NOT FOUND pkgid %d"), aParams.iPkgId);
-        User::Leave(KErrNotFound);
-        }
-
-    // Resolve profile id
-    RSyncMLSession sml;
-    TInt                    tmp1;
-    TSmlServerAlertedAction tmp2;
-    TBool	                tmp3;
-    TInt					tmp4;
-    CleanupClosePushL( sml );
-    sml.OpenL();
-    // Use stored profile
-    if ( aParams.iProfileId == KErrNotFound )
-        {
-        iFotaServer->GetProfileDataL( &sml,iUpdateState.iProfileId
-                ,tmp1,tmp2,tmp3,tmp4);
-        profile = iUpdateState.iProfileId;
-        }
-    // Use passed profile. If error, then try to use stored profile
-    else
-        {
-        TRAPD(err, iFotaServer->GetProfileDataL( &sml,aParams.iProfileId
-                ,tmp1,tmp2, tmp3, tmp4 ) );
-        if ( err != KErrNone )
-            {
-            iFotaServer->GetProfileDataL( &sml,iUpdateState.iProfileId
-                    ,tmp1,tmp2,tmp3,tmp4);
-            profile = iUpdateState.iProfileId;
-            }
-        else
-            {
-            profile = aParams.iProfileId;
-            }
-        }
-    CleanupStack::PopAndDestroy( &sml );
-
-    // Must update package state with fresh params (it could be empty)
-    TUint fields = EFDBState | EFDBPkgName|EFDBVersion;
-    if ( profile != iUpdateState.iProfileId )
-        {  
-        fields |= EFDBProfileId;
-        }
-
-    iUpdateState.iProfileId     = profile;
-    iUpdateState.iPkgName       = aParams.iPkgName;
-    iUpdateState.iPkgVersion    = aParams.iPkgVersion;
-    iUpdateState.iState         = RFotaEngineSession::EStartingUpdate;
-    iUpdateState.iResult		= KErrNotFound;
-    iUpdateState.iSendAlert     = EFalse; // HJHA-6MJCFE . This operation will
-    // not reach any final state.
-    iFotaServer->iDatabase->OpenDBL( );
-    iFotaServer->iDatabase->SetStateL( iUpdateState, KNullDesC8, fields );
-    iFotaServer->iDatabase->CloseAndCommitDB( );
-
-    CRepository* centrep2 = NULL;
-    TRAPD( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) )
-    if (err==KErrNone ) 
-        {  TInt val;
-        //
-        centrep2->Get(  KFotaUpdateState, val );
-
-        if(val == EFotaUpdateInterrupted)
-            centrep2->Set(  KFotaUpdateState, EFotaDefault );
-        }
-    delete centrep2;
-
-    FLOG(_L("CFotaUpdate::StartUpdateL  2"));
-    //new code
-    	 TInt client = iFotaServer->GetInstallUpdateClientL();
-       if( CheckUpdateVariations() && 
-   			client!= CFotaSrvSession::EOMADMAppUi &&  
-         client != CFotaSrvSession::EFMSServer ) 
-       {
-       TInt callactive(EFalse);
-       RFMSClient fmsclient;    
-       TRAPD(err,fmsclient.OpenL());
-       if(err == KErrNone)
-           {
-           CleanupClosePushL(fmsclient);
-           FLOG(_L("CFotaUpdate::startupdate FMS for active call >>"));                
-           TInt err1 = fmsclient.IsPhoneCallActive(callactive);
-           FLOG(_L("IsPhoneCallActive returns %d  >>"),err1);       
-           }
-       if(callactive)
-           {
-           FLOG(_L(" active phone call found"));           
-           
-           FLOG(_L("putting call end Ao start pkgid=%d, profileid=%d"),iUpdateState.iPkgId,iUpdateState.iProfileId);
-           TInt err1 = fmsclient.MonitorActivePhoneCallEnd(iUpdateState.iPkgId,iUpdateState.iProfileId);
-           FLOG(_L("MonitorActivePhoneCallEnd returns %d  >>"),err1);    
-           }
-       else
-           {
-           FLOG(_L("CFotaUpdate::StartUpdateL  2"));
-           
-           TDriveNumber drive;
-
-    TBool ret (EFalse);
-    TRAPD(err2, ret = iFotaServer->NeedToDecryptL(iUpdateState.iPkgId, drive));
-    if ( err2 == KErrNone )
-        {
-        if (!ret)
-            {
-            //Drive is not encrypted
-            LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId );
-            }
-        else
-            {
-            //Drive is encrypted.
-            LaunchNotifierL( ESyncMLFwUpdStartQueryEnc, iUpdateState.iProfileId );
-            }
-        }
-    else
-        {
-        HandleUpdateErrorL(err2);
-        }
-       
-           }
-       if(err == KErrNone) //fms opening error
-           {
-           CleanupStack::PopAndDestroy(&fmsclient);
-           }
-       }
-   else
-       {
-       FLOG(_L("CFotaUpdate::StartUpdateL  2 DM UI Install update"));
-       //LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId );
-       
-           TDriveNumber drive;
-
-    TBool ret (EFalse);
-    TRAP(err, ret = iFotaServer->NeedToDecryptL(iUpdateState.iPkgId, drive));
-    if ( err == KErrNone )
-        {
-        if (!ret)
-            {
-            //Drive is not encrypted
-            LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId );
-            }
-        else
-            {
-            //Drive is encrypted.
-            LaunchNotifierL( ESyncMLFwUpdStartQueryEnc, iUpdateState.iProfileId );
-            }
-        }
-    else
-        {
-        HandleUpdateErrorL(err);
-        }
-       
-       }                   
-
-    //new code
-    
-
-    FLOG(_L("CFotaUpdate::StartUpdateL(TDownloadIPCParams aParams) << \
-    pkig:%d"),aParams.iPkgId);
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CreateRadionButtonArrayLC
-// Creates the array of radio buttons to display 
-// on radio button setting page
-// ---------------------------------------------------------------------------
-//
-
-CDesCArray* CFotaUpdate::CreateRadionButtonArrayLC( const TScheduleEntryInfo2 aScEntry,
-        TInt& aSelectionIndex)
-    {
-    // selection defaults to 0
-    FLOG(_L("CFotaUpdate::CreateRadionButtonArrayLC >>"));  
-    aSelectionIndex = 0;
-    CDesCArray* array = new (ELeave) CDesC16ArrayFlat(4);
-    CleanupStack::PushL(array);
-    for (TInt i=0;i<iInterval.Count();i++)   
-
-        {    
-        switch (iIntervalType[i])
-            {
-            case EHourly :
-                {
-
-                HBufC* string1 ;
-                if(iInterval[i] == 1)
-                    string1 = StringLoader::LoadLC(R_FOTA_RADIO_DIALOG_1HOUR_REMAINDER);
-                else
-                    string1 = StringLoader::LoadLC(R_QTN_FOTA_REMINDER_HOURS , iInterval[i] );
-
-                array->AppendL( string1->Des() );
-                CleanupStack::PopAndDestroy( string1 );
-                if(aScEntry.Interval() == iInterval[i] && aScEntry.IntervalType()== EHourly ) 
-                    aSelectionIndex = i; 
-                }
-                break; 
-
-            case EDaily:
-                {
-
-                HBufC* string1; //= StringLoader::LoadLC(R_QTN_FOTA_REMINDER_DAYS , iInterval[i] );
-                if(iInterval[i] == 1)
-                    string1 = StringLoader::LoadLC(R_FOTA_RADIO_DIALOG_1DAY_REMAINDER);
-                else
-                    string1 = StringLoader::LoadLC(R_QTN_FOTA_REMINDER_DAYS , iInterval[i] );
-
-                array->AppendL( string1->Des() );
-                CleanupStack::PopAndDestroy( string1 );
-                if(aScEntry.Interval() == iInterval[i] && aScEntry.IntervalType()== EDaily ) 
-                    aSelectionIndex = i;
-                }
-                break;
-            case EMonthly:
-                {
-
-                HBufC* string1 ;//== StringLoader::LoadLC(R_QTN_FOTA_REMINDER_MINUTES , iInterval[i] );
-                if(iInterval[i] == 1)
-                    string1 = StringLoader::LoadLC(R_QTN_FOTA_REMINDER_1_MINUTE);
-                else
-                    string1 = StringLoader::LoadLC(R_QTN_FOTA_REMINDER_MINUTES , iInterval[i] );
-
-                array->AppendL( string1->Des() );
-                CleanupStack::PopAndDestroy( string1 );
-                if(aScEntry.Interval() == iInterval[i] && aScEntry.IntervalType()== EMonthly) 
-                    aSelectionIndex = i;
-                }
-                break; 
-
-                /*case EYearly:
-    		     {
-    		     tempChar.Num(iInterval[i]);
-    		     HBufC* string1 = StringLoader::LoadLC(R_FOTA_RADIO_DIALOG_YEAR_REMAINDER , iInterval[i] );
-               	 array->AppendL( string1->Des() );
-               	 CleanupStack::PopAndDestroy( string1 );
-               	 if(aScEntry.Interval() == iInterval[i] ) 
-               	          aSelectionIndex = i;
-    		     }
-    		     break;*/
-            }
-        }
-
-    if(iIntervalType[iIntervalType.Count()-1] == ENoReminderOn )
-        {
-        HBufC* string1 = StringLoader::LoadLC( R_FOTA_RADIO_DIALOG_NO_REMAINDER);
-        array->AppendL( string1->Des() );
-        CleanupStack::PopAndDestroy( string1 );
-        }
-    FLOG(_L("CFotaUpdate::CreateRadionButtonArrayLC <<"));  
-    return array;
-    }
-// ---------------------------------------------------------------------------
-// CFotaUpdate::ParseScheduleString()
-// Parse the schedule string from cenrep
-// ---------------------------------------------------------------------------
-//
-//
-void CFotaUpdate::ParseScheduleStringL()
-    {    
-    FLOG(_L("CFotaUpdate::ParseScheduleString() >>")); 
-
-    GetSchedulesInfoL();
-
-
-
-    iInterval.Reset();
-    iIntervalType.Reset();
-    TBuf<5> aTime;
-    TBuf<9> aSched,tempChar;
-    aTime.Zero();
-    aSched.Zero();
-
-
-    //TText*sep =   (TText *)ksep.Ptr();
-    TBufC<1>ksep(Ksep);
-    TText *t = (TText *)ksep.Ptr();      //just for Initialization
-    for(TInt i = 0; i<iscInfo.Length();i++)
-        {
-
-        TChar ch = iscInfo[i];
-        if ( ch.IsDigit())            //separates digits from the string
-            {  aTime.Append(ch); 
-
-            }
-        else
-            {  
-            aSched.Append(ch);             
-            *t = ch;
-            if (*t ==     'h' || *t =='H')      //hour
-                { iIntervalType.Append(EHourly) ;
-                TInt val =1 ; 
-                TLex  lex(aTime);
-                TInt err = lex.Val(val);
-                if (err)
-                    {
-                    iInterval.Append(1);
-                    }
-                else
-                    {
-                    iInterval.Append(val); 	
-                    }
-
-                }
-            else if (*t ==     'd'|| *t =='D')      //daily
-                {iIntervalType.Append(EDaily);
-                TInt val =1 ; 
-                TLex  lex(aTime);
-                TInt err = lex.Val(val);
-                if (err)
-                    {
-                    iInterval.Append(1);
-                    }
-                else
-                    {
-                    iInterval.Append(val);  	
-                    }
-
-                }
-            else if (*t ==     'm'||  *t =='M')   //minute
-                {iIntervalType.Append( EMonthly);
-                TInt val =1 ; 
-                TLex  lex(aTime);
-                TInt err = lex.Val(val);
-                if (err)
-                    {
-
-                    iInterval.Append(1);
-                    }
-                else
-                    {
-                    iInterval.Append(val);  	
-                    }
-
-                }
-            /* else if (*t ==     'y')   //year
-                  {iIntervalType.Append( EYearly);
-                    TInt val =1 ; 
-               	    TLex  lex(aTime);
-               	    TInt err = lex.Val(val);
-               	    if (err)
-               	    {
-
-                        iInterval.Append(1);    
-               	    }
-               	    else
-               	    {
-               	     iInterval.Append(val); 	
-               	    }
-
-                  }*/
-            else if (*t == ':')   //colon
-                {
-                aTime.Zero();
-                aSched.Zero();
-                }
-            }
-        }
-    TBool  checkSchInfo =EFalse;
-
-    if(iInterval.Count() == iIntervalType.Count() )
-        {  
-        for (TInt j =0 ;j< iInterval.Count();j++ )
-            {                                                 //setting to default 1h:4h:1d:3d
-            if(iInterval[j] < 0 || iIntervalType[j] > 3 ) 
-                {   
-                iInterval.Reset();    iIntervalType.Reset();
-                iInterval.Append(1);  iIntervalType.Append(EHourly); 
-                iInterval.Append(4);  iIntervalType.Append(EHourly); 
-                iInterval.Append(1);  iIntervalType.Append(EDaily); 
-                iInterval.Append(3);  iIntervalType.Append(EDaily);     
-                checkSchInfo =ETrue;
-                break;
-                }
-            }
-        }
-    else
-        {        
-        iInterval.Reset();    iIntervalType.Reset();
-        iInterval.Append(1);  iIntervalType.Append(EHourly); 
-        iInterval.Append(4);  iIntervalType.Append(EHourly);  //setting to default 1h:4h:1d:3d
-        iInterval.Append(1);  iIntervalType.Append(EDaily); 
-        iInterval.Append(3);  iIntervalType.Append(EDaily);     
-        checkSchInfo =ETrue;
-        }
-
-    TPtrC16 lastFive =  iscInfo.Right(5);
-    _LIT( KNoRem , "NROFF");
-    TPtrC noRem( KNoRem );   //check for No Remainder
-    if (lastFive != noRem || checkSchInfo)
-        {
-        iIntervalType.Append(ENoReminderOn);
-        }
-    else
-        { 
-        iIntervalType.Append(ENoReminderOff);
-
-        }
-    FLOG(_L("CFotaUpdate::ParseScheduleString() <<"));
-
-    } 
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::GetSchedulesInfoL
-// Get the schedule info from the cenrep
-// ---------------------------------------------------------------------------
-//
-//
-void CFotaUpdate::GetSchedulesInfoL()
-    {
-
-    CRepository* centrep = NULL;
-    //TBuf<255> scInfo; 
-    centrep = CRepository::NewLC( TUid::Uid(KFotaServerUid));
-    if ( centrep )
-        {TBuf<255> temp;
-        if (centrep->Get( KFotaOptionsForReminderDuration , temp )==KErrNone && temp.Length() )
-            {   FLOG(_L("CFotaUpdate::ParseScheduleString taking from cenrep <<"));
-            temp.Trim();    //read from cenrep
-            iscInfo.Copy(temp);
-            }
-        else
-            {                               //else set to default
-            iscInfo.Copy(KDefaultSched);  
-
-            }
-        CleanupStack::PopAndDestroy(centrep);
-        }
-    else
-        {
-        iscInfo.Copy(KDefaultSched);    //else set to default
-        }	
-
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::ShowReminderDialogL
-// Prepare and display Reminder Dialog using RFotaReminderDlg
-// on radio button setting page
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::ShowReminderDialogL()
-    {
-    // Push default content to navigation pane and change title
-    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
-    CAknNavigationControlContainer* naviPane = NULL;
-    HBufC* originalTitle;
-    CAknTitlePane* titlePane = NULL;
-    originalTitle = HBufC::NewLC( 50 ); //KNsmlMaxTitleSize
-
-    if ( statusPane && statusPane->PaneCapabilities( 
-            TUid::Uid(EEikStatusPaneUidTitle) ).IsPresent() )
-        {
-        naviPane = ( CAknNavigationControlContainer* )
-        statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) );
-        naviPane->PushDefaultL();
-        titlePane = static_cast<CAknTitlePane*>
-        ( statusPane->ControlL( TUid::Uid(
-                EEikStatusPaneUidTitle) ) );
-        if ( titlePane->Text() ) 
-            {
-            originalTitle->Des().Copy( *titlePane->Text() );
-            HBufC* titleText = StringLoader::LoadLC(
-                    R_QTN_DM_TITLE_SETTINGS_DIALOG );
-            titlePane->SetTextL( *titleText );
-            CleanupStack::PopAndDestroy( titleText );
-            titleText = NULL;
-            }
-        }
-
-    TApaTaskList taskList(iFotaServer->GetEikEnv()->WsSession());
-    TApaTask task=taskList.FindApp(TUid::Uid(KFotaServerUid));
-
-    if(task.Exists())
-        task.BringToForeground();
-
-    // Construct radio btn list and launch radio button dlg
-    TScheduleEntryInfo2 en=FindScheduleL( EFalse );
-    TInt radioSelectionIndex( KErrNotFound );
-    TRAPD(error,ParseScheduleStringL());  
-    if (error)
-        {
-        iInterval.Reset();    iIntervalType.Reset();
-        iInterval.Append(1);  iIntervalType.Append(EHourly); 
-        iInterval.Append(4);  iIntervalType.Append(EHourly); 
-        iInterval.Append(1);  iIntervalType.Append(EDaily); 
-        iInterval.Append(3);  iIntervalType.Append(EDaily); 
-        iIntervalType.Append(ENoReminderOn);
-        }
-    if(iInterval.Count() > 4)
-        {
-        for(TInt i= 4;i <iInterval.Count();i++)
-            iInterval.Remove(i);
-        }  
-    CDesCArray* itemArray = CreateRadionButtonArrayLC( en,radioSelectionIndex );
-
-    TInt aEvent(KErrNone);
-    CFotaReminderDlg* aFotaReminderDlg = CFotaReminderDlg::NewL(radioSelectionIndex,itemArray,aEvent );
-    FLOG(_L("after creating fota reminder dialog"));   
-    CleanupStack::PushL(aFotaReminderDlg);
-    TInt presentPriotiry = CEikonEnv::Static()->RootWin().OrdinalPriority();
-    TInt presentPosition = CEikonEnv::Static()->RootWin().OrdinalPosition();
-    CEikonEnv::Static()->RootWin().SetOrdinalPosition(presentPosition, ECoeWinPriorityMedium);  //setting the priority to medium for activation on top of global notes
-
-    TInt ret = aFotaReminderDlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
-    CleanupStack::Pop(aFotaReminderDlg);	     							
-    CleanupStack::PopAndDestroy( itemArray );
-
-    CEikonEnv::Static()->RootWin().SetOrdinalPosition(presentPosition, presentPriotiry); //resetting to previous priority
-    FLOG(_L("****Event key = %d"),aEvent);
-
-    if (aEvent == EEventKey)
-        {
-        FLOG(_L("Exiting...."));
-        TApaTaskList taskList(iFotaServer->GetEikEnv()->WsSession());
-        TApaTask task=taskList.FindApp(TUid::Uid(KOmaDMAppUid));
-        if(task.Exists())
-            {
-            task.EndTask();
-            task.KillTask();
-            }
-
-        return;
-        }
-		if(naviPane)
-    	naviPane->Pop();
-    if(	titlePane )
-    {	
-    	if ( titlePane->Text() && originalTitle ) 
-        {
-        TRAP_IGNORE( titlePane->SetTextL( *originalTitle ) );
-        }
-    }
-    CleanupStack::PopAndDestroy( originalTitle );
-    task.SendToBackground();	
-
-    CreateNewScheduleL(ret,radioSelectionIndex);	
-
-
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CreateNewScheduleL
-// Creates the new schedule
-// ---------------------------------------------------------------------------
-//
-void CFotaUpdate::CreateNewScheduleL(TInt aRet, TInt aRadioSelectionIndex)
-    {
-
-    TScheduleEntryInfo2 en=FindScheduleL( EFalse );
-    TIntervalType   tIntervalType;    
-    TInt tInterval; 
-    if ( aRet && aRadioSelectionIndex== 0 ) 
-        {
-        FLOG(_L("Creating reminder: for 1st option"));
-        tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex];				
-        tInterval     = iInterval[aRadioSelectionIndex];
-        en=FindScheduleL( ETrue );
-        CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval );
-        iFotaServer->FinalizeUpdateL();
-        }
-    else if(aRet && aRadioSelectionIndex == 1 )
-        {
-        FLOG(_L("Creating reminder: 4 hours"));
-        tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex];				
-        tInterval     = iInterval[aRadioSelectionIndex];
-        en=FindScheduleL( ETrue );
-        CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval );
-        iFotaServer->FinalizeUpdateL();
-        }
-    else if(aRet && aRadioSelectionIndex == 2 )
-        {
-        FLOG(_L("Creating reminder: for 2nd option"));
-        tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex];				
-        tInterval     = iInterval[aRadioSelectionIndex];
-        en=FindScheduleL( ETrue );
-        CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval );
-        iFotaServer->FinalizeUpdateL();
-        }
-    else if(aRet && aRadioSelectionIndex == 3 )
-        {
-        FLOG(_L("Creating reminder: for 3rd option"));
-        tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex];				
-        tInterval     = iInterval[aRadioSelectionIndex];  
-        en=FindScheduleL( ETrue );
-        CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval );  
-        iFotaServer->FinalizeUpdateL();
-        }
-    else if (!aRet || aRadioSelectionIndex == 4)
-        {
-        FLOG(_L("Deleting reminder, btn press %d"),aRet);
-        TScheduleEntryInfo2 en=FindScheduleL( ETrue );
-
-        if ( !aRet ) // cancel pressed
-            {
-            LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId );
-            }
-        else			  // ok pressed
-            {
-            LaunchNotifierL( ESyncMLFwUpdNoReminder , KErrNone );
-            //iFotaServer->FinalizeUpdateL();
-            }
-        }
-
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::FindScheduleL
-// Finds fotaupdate schedule (named [102072c4])
-// ---------------------------------------------------------------------------
-//
-TScheduleEntryInfo2 CFotaUpdate::FindScheduleL( const TBool aDelete )
-    {
-    TScheduleEntryInfo2                     ret;
-    TInt                                    err;    
-    RScheduler                              sc;
-    
-    TTsTime                                 time;
-    TSchedulerItemRef                       scitem; 
-    CArrayFixFlat<TSchedulerItemRef>*     	aSchRefArray = new CArrayFixFlat <TSchedulerItemRef>(5);
-    TScheduleFilter                      	aFilter(EAllSchedules);
-    User::LeaveIfError( sc.Connect() );                             // xx
-    CleanupClosePushL( sc );
-    CleanupStack::PushL(aSchRefArray);
-
-    User::LeaveIfError( sc.GetScheduleRefsL( *aSchRefArray,aFilter) );  // xx
-    FLOG(_L("Schedule items: "));
-    for ( TInt i=0; i<aSchRefArray->Count(); ++i  )
-        {
-        TSchedulerItemRef it = (*aSchRefArray)[i];
-        if ( it.iName == TUid::Uid(KFotaServerUid).Name()  )
-            {
-            TScheduleState2 sc_state;
-            CArrayFixFlat<TScheduleEntryInfo2>*  sc_entries = new CArrayFixFlat <TScheduleEntryInfo2>(5);
-            CArrayFixFlat<TTaskInfo>*            sc_tasks  = new CArrayFixFlat <TTaskInfo>(5);
-            TTsTime                              sc_duetime;
-            CleanupStack::PushL( sc_entries );
-            CleanupStack::PushL( sc_tasks );
-            FLOG (_L("%d. schedule handle: %d name:'%S'"),i,it.iHandle, &(it.iName) );
-
-            err = sc.GetScheduleL ( it.iHandle , sc_state, *sc_entries,*sc_tasks,sc_duetime ); // xx
-
-            TDateTime  dtm = sc_duetime.GetLocalTime().DateTime();
-            FLOG(_L("   schedule duetime:%d:%d"), dtm.Hour(), dtm.Minute());
-
-            if ( err ) FLOG(_L("     schedule  sc get err %d"),err);
-            else 
-                {
-                for ( TInt k=0; k<sc_entries->Count();++k)
-                    {
-                    TScheduleEntryInfo2 sc_entry = (*sc_entries)[k];
-                    ret = sc_entry;
-                    TTime sctime = sc_entry.StartTime().GetLocalTime();
-                    FLOG(_L("         schedule entry %d int-type:%d int:%d start: %d:%d"),k,sc_entry.IntervalType(),sc_entry.Interval(),sctime.DateTime().Hour(),sctime.DateTime().Minute());
-                    }
-
-                for ( TInt j=0; j<sc_tasks->Count();++j)
-                    {
-                    TTaskInfo sc_task = (*sc_tasks)[j];
-                    FLOG(_L("         schedule task  %d  '%S'"),sc_task.iTaskId,&(sc_task.iName) );
-                    if ( aDelete && sc_task.iName==TUid::Uid(KFotaServerUid).Name() )
-                        {
-                        FLOG(_L("          schedule DeleteTask %d"),sc_task.iTaskId);
-                        User::LeaveIfError( sc.DeleteTask(sc_task.iTaskId) );       // xx
-                        }
-                    }
-                }
-            if ( aDelete )
-                {
-                FLOG(_L("     DeleteSchedule %d"),it.iHandle);
-                User::LeaveIfError(sc.DeleteSchedule(it.iHandle ));                 // xx
-                }
-            CleanupStack::PopAndDestroy( sc_tasks );
-            CleanupStack::PopAndDestroy( sc_entries );
-            }
-        }
-    CleanupStack::PopAndDestroy( aSchRefArray );
-    CleanupStack::PopAndDestroy(&sc);
-    return ret;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// CFotaUpdate::CreateScheduleL
-// Creates fotaupdate schedule (named [102072c4])
-// ---------------------------------------------------------------------------
-//
-TInt CFotaUpdate::CreateScheduleL ( const TInt aPackageId 
-        ,const TIntervalType  aIntervalType
-        ,const TInt aInterval)
-    {
-    FLOG(_L("CFotaUpdate::CreateScheduleL ()") );
-    const TInt KRepeatForever = 0;
-    const TInt KTaskPriority = 1;
-    _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe");
-    RScheduler                              sc;
-    TTime                                   t; 
-    TTsTime                                 time;
-    TSchedulerItemRef                       scitem; 
-    CArrayFixFlat<TScheduleEntryInfo2>*     scentries = new CArrayFixFlat <TScheduleEntryInfo2>(5);
-    User::LeaveIfError( sc.Connect() );                                       // xx
-    CleanupClosePushL( sc );
-    CleanupStack::PushL(scentries );
-    t.HomeTime(); 
-    switch (aIntervalType)  //create schedule based on the interval type 
-        {
-        case EHourly :
-            t = t + ((TTimeIntervalHours)aInterval);
-            break;
-        case EDaily  :
-            t = t + ((TTimeIntervalDays) aInterval);
-            break;
-        case EMonthly :
-            t = t + ((TTimeIntervalMinutes ) aInterval);
-            break; 
-        case EYearly  :
-            t = t + ((TTimeIntervalYears ) aInterval);
-            break;
-        default :
-            User::Panic(KFotaPanic, KErrArgument);
-
-        }  
-
-    time.SetLocalTime( t );
-    TScheduleEntryInfo2 scentry1(time, aIntervalType, aInterval, (TTimeIntervalMinutes)1440 ) ; // xx
-    scentries->AppendL( scentry1 );
-
-    scitem.iName = TUid::Uid(KFotaServerUid).Name();
-    User::LeaveIfError( sc.Register(TFileName( KFotaScheduleExe ), 0 ) );    // xxx
-    User::LeaveIfError( sc.CreatePersistentSchedule(scitem, *scentries) );   // xxx
-    FLOG(_L("created schedule %d  %d:%d"),scitem.iHandle, t.DateTime().Hour(),t.DateTime().Minute() );
-    TTaskInfo taskInfo;
-    taskInfo.iName      = TUid::Uid(KFotaServerUid).Name();
-    taskInfo.iRepeat    = KRepeatForever;
-    taskInfo.iPriority  = KTaskPriority;
-
-    TFotaScheduledUpdate fotareminder( aPackageId, scitem.iHandle );
-    TPckg<TFotaScheduledUpdate>   fotareminderpkg(fotareminder);
-
-    HBufC* data = HBufC::NewLC(fotareminderpkg.Length());
-    data->Des().Copy(fotareminderpkg);
-
-    User::LeaveIfError( sc.ScheduleTask(taskInfo, *data, scitem.iHandle) );  // xxx
-
-    CleanupStack::PopAndDestroy( data );
-    CleanupStack::PopAndDestroy( scentries );
-    CleanupStack::PopAndDestroy(&sc);                                         // xx
-    return scitem.iHandle;
-	}
-// --------------------------------------------------------------------------
-// CFotaUpdate::CheckUpdateVariations
-// Checks the Install update note display,when a phone call is active
-// --------------------------------------------------------------------------
-//
-TBool CFotaUpdate::CheckUpdateVariations()
-    {
-    FLOG(_L("CFotaUpdate::CheckUpdateVariations >>"));
-    CRepository* centrep( NULL);
-    TRAPD(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-    if (err) FLOG(_L("Error reading FotaServer cenrep... %d"),err);
-    TInt supported(KErrNone);
-    if (centrep ) 
-        {
-        err = centrep->Get( KFotaUpdateNoteDisplayAlways, supported );
-        if (err) FLOG(_L("Error reading cenrep key... %d"),err);                
-        delete centrep;
-        centrep = NULL;
-        }
-    if(supported) //means note to be displayed when a call is active
-        {
-        return EFalse;
-        }
-    FLOG(_L("CFotaUpdate::CheckUpdateVariations <<"));
-    return ETrue; //means note should not be displayed when a call is there
-    }
-
--- a/fotaapplication/fotaserver/FotaStorage/BWINS/fotadiskstorageu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
-
--- a/fotaapplication/fotaserver/FotaStorage/data/102072C6.rss	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-//  RESOURCE IDENTIFIER
-
-//  INCLUDES
-#include "registryinfo.rh"
-
-//  CONSTANTS  
-
-//  MACROS  
-
-//  RESOURCE DEFINITIONS 
-// -----------------------------------------------------------------------------
-//   
-// theInfo
-// ICL codec registeration file for codec selection using ECom and ICL resolver.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE REGISTRY_INFO theInfo
-    {
-    dll_uid = 0x102072C6;
-    interfaces = 
-        {
-        INTERFACE_INFO
-            {
-            interface_uid = 0x10207384;
-            implementations = 
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x10207385;
-                    version_no = 1;
-                    display_name = "Fota storage";
-                    default_data = "";
-                    opaque_data =  "";
-                    }  
-                };
-            }
-        };
-    }
-// End of File
--- a/fotaapplication/fotaserver/FotaStorage/group/fotadiskstorage.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Project definition file for project fotadiskstorage
-*
-*/
-
-
-
-#include <platform_paths.hrh>
-
-//MACRO  _FOTA_DEBUG
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-
-TARGET      fotadiskstorage.dll
-
-TARGETTYPE PLUGIN
-
-// MAGIC Dll recognition UID to support ECom.
-UID 0x10009D8D 0x102072C6
-
-CAPABILITY CAP_ECOM_PLUGIN
-
-VENDORID VID_DEFAULT
-
-SOURCEPATH  ../src
-SOURCE      fotaDiskStorage.cpp
-
-SOURCEPATH  ../data
-START RESOURCE 102072C6.rss
-TARGET fotadiskstorage.rsc
-LANGUAGE_IDS
-END
-
-USERINCLUDE     ../inc
-USERINCLUDE     ../../inc
-USERINCLUDE     ../../cenrep
-
-SYSTEMINCLUDE   /epoc32/include/ecom
-SYSTEMINCLUDE   /epoc32/include/icl
-SYSTEMINCLUDE   /epoc32/include/libc
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY			euser.lib
-LIBRARY			fbscli.lib
-LIBRARY			bafl.lib
-LIBRARY			estor.lib
-LIBRARY			efsrv.lib
-LIBRARY			centralrepository.lib
-LIBRARY			flogger.lib
-LIBRARY			sysutil.lib
-
-
--- a/fotaapplication/fotaserver/FotaStorage/group/fotastorage.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   xxxxxx
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET      fotastorage.dll
-
-TARGETTYPE PLUGIN
-
-// MAGIC Dll recognition UID to support ECom.
-UID 0x10009D8D 0x102072C6
-
-CAPABILITY CAP_ECOM_PLUGIN
-
-VENDORID VID_DEFAULT
-
-SOURCEPATH  ../src
-// SOURCE      fotastorage.cpp
-//SOURCE      fotadiskstorage.cpp
-
-SOURCEPATH  ../data
-START RESOURCE 102072C6.rss
-TARGET fotastorage.rsc
-LANGUAGE_IDS
-END
-
-USERINCLUDE     ../inc
-
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   /epoc32/include/ecom
-SYSTEMINCLUDE   /epoc32/include/icl
-SYSTEMINCLUDE   /epoc32/include/libc
-
-LIBRARY			euser.lib
-LIBRARY			fbscli.lib
-LIBRARY			bafl.lib
-LIBRARY			estor.lib
-LIBRARY			efsrv.lib
-
-
--- a/fotaapplication/fotaserver/FotaStorage/inc/fotaDiskStorage.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-#ifndef __FOTADISKSTORAGE_H_
-#define __FOTADISKSTORAGE_H_
-
-#include <s32file.h>
-
-
-#include "fotastorage.h"
-
-
-// CONSTANTTS
-// const TInt KDummyFileSize(2000000);   // total of 2MB should be reserved for fota pkgs
-
-#ifndef _FOTA_UNIT_TESTER
-_LIT( KDummyFilePath, "c:\\private\\102072C4\\" );
-#else
-_LIT( KDummyFilePath, "c:\\private\\10009cf4\\" );
-#endif 
-_LIT( KDummyFileName, "reserved");  // dummy file name 
-
-
-const TInt KFileReservationDefaultSize ( 5000000);
-const TInt KFileChunkDefaultSize ( 120000 );
-
-/*
-* Implementation of fotastorage. This implementation
-* directly stores the update package to user disk. 
-* Private directory of the calling process will be used
-* for storage.
-*/
-
-class CFotaDiskStorage : public CFotaStorage
-{
-    public:
-
-    /**
-     * NewL
-     * @since   S60   v3.1
-     * @param   none
-     * @return  New instance
-     */
-      static CFotaDiskStorage* NewL();
-
-
-    /**
-     * Two phase Constructor
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-		void ConstructL();
-     
-    // From base classes
-
-    /**
-     * Two phase Constructor
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-		TInt AdjustDummyStorageL();
-
-    /**
-     * Opens stream to package file
-     * @since   S60   v3.1
-     * @param   pkgid	Package id
-     * @param   aPkgStore	Stream to the file
-     * @return  err
-     */
-    TInt OpenUpdatePackageStoreL(const TInt aPkgId,TInt aNewDummySize
-                                  , RWriteStream*& aPkgStore);
-
-    /**
-     * Gets the update package size
-     * @since   S60   v3.2
-     * @param   aPkgid	Package id
-     * @param   aSize	Size in bytes
-     * @return  None
-     */
-
-     void GetDownloadedUpdatePackageSizeL(const TInt aPkgid, TInt& aSize);
-
-
-    /**
-     * Closes stream to package file
-     * @since   S60   v3.1
-     * @param   pkgid	Package id
-     * @return  none
-     */
-		void UpdatePackageDownloadCompleteL(const TInt aPkgId);
-
-    /**
-     * Gets path to package
-     * @since   S60   v3.1
-     * @param   pkgid	Package id
-     * @param   aPath	path to file
-     * @return  none
-     */
-		void GetUpdatePackageLocationL(const TInt aPkgId, TDes8& aPath );
-
-
-    /**
-     * Gets present packages
-     * @since   S60   v3.1
-     * @param   aPackageIdList	List of package ids
-     * @return  none
-     */
-		void GetUpdatePackageIdsL(TDes16& aPackageIdList);
-
-
-    /**
-     * Checks if there is space for pkg. If not (doesnt fit to filesystem)
-     * returns needed space in aSize.
-     * @since   S60   v3.1
-     * @param   aSize		Space of pkg. On return, needed space.
-     * @return  Whether there's free space
-     */
-		TFreeSpace IsPackageStoreSizeAvailableL(TInt& aSize);
-
-
-    /**
-     * Deletes update package
-     * returns needed space in aSize.
-     * @since   S60   v3.1
-     * @param   apPkgid Package id
-     * @return  none
-     */
-		void  DeleteUpdatePackageL (const TInt aPkgId);
-
-
-
-    /**
-     * Destructor
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-		virtual ~CFotaDiskStorage ();
-		
-public:
-
-
-    /**
-     * Stream to pkg file
-     */
-		RFileWriteStream    iFileWriteStream;
-
-
-    /**
-     * File server session
-     */
-		RFs                 iFs;
-
-    /**
-     * Size of reservation file. Configured via cenrep.
-     */
-		TInt                iDummySize;
-
-
-
-    /**
-     * Size of chunk used to separate update package file content from
-     * reservation file.
-     */
-		TInt                iChunkSize;
-
-private: // new functions
-
-
-    /**
-     * Constructor
-     * @since   S60   v3.1
-     * @param   none
-     * @return  none
-     */
-    CFotaDiskStorage ();
-
-
-    /**
-     * Deletes the update package so that total space reservation file
-     * stays the same (ie 5MB). 
-     * @since   S60   v3.1
-     * @param 	dummy Handle to reservation file
-     * @param   aPkgId package file to be deleted
-     * @param   aAlreadyAllocated Already allocated bytes by other pkg files
-     * @return  none
-     */
-    void DoDeleteUpdatePackageL ( RFile& dummy, TInt aPkgId
-                                      , TInt aAlreadyAllocated=0);
-
-
-    /**
-     * Checks how much space is allocated by package files
-     * @since   S60   v3.1
-     * @param 	aSwupdSize Size allocated by package files
-     * @param   aDummySize Size allocated by reservation file
-     * @return  none
-     */
-     void SpaceAllocatedBySWUPDFilesL( TInt& aSwupdSize, TInt& aDummySize);
-
-};
-
-
-#endif //__FOTADISKSTORAGE_H_
--- a/fotaapplication/fotaserver/FotaStorage/inc/fotadebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros 
-*
-*/
-
-
-
-#ifndef FOTADEBUG_H
-#define FOTADEBUG_H
-
-    // IMPORT_C static TInt Print(TRefByValue<const TDesC> aFmt,...);
-    #ifdef _FOTA_DEBUG
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fotadiskstorage.log" );
-        _LIT( KLogDirFullName, "c:\\logs\\" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-#endif      // FOTADEBUG_H
-            
-// End of File
--- a/fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   stores update package to filesystem
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <ecom.h>
-#include <implementationproxy.h>
-#include <centralrepository.h>
-#include <sysutil.h> 
-#include "fotadiskstoragePrivateCRKeys.h"
-#include "fotaDiskStorage.h"
-#include "fotadebug.h"
-
-// CONSTANTS
-// System Critical Level (128KB) plus 5KB for fota operations.
-const TInt KSystemCriticalWorkingspace = 136192;
-
-// MACROS
-#ifdef __EABI__
-#ifndef IMPLEMENTATION_PROXY_ENTRY
-typedef TAny*   TProxyNewLPtr;
-#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
-#endif
-#endif
-
-// ============================ MEMBER FUNCTIONS =============================
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::CFotaDiskStorage()
-// ---------------------------------------------------------------------------
-//
-CFotaDiskStorage::CFotaDiskStorage ()
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::NewL()
-// ---------------------------------------------------------------------------
-//
-CFotaDiskStorage* CFotaDiskStorage::NewL()
-    {
-    FLOG(_L("CFotaDiskStorage::NewL()"));
-    CFotaDiskStorage* self = new ( ELeave ) CFotaDiskStorage;
-    FLOG(_L("  CFotaDiskStorage created at %X "), self);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::ConstructL() 
-// ---------------------------------------------------------------------------
-//
-void CFotaDiskStorage::ConstructL() 
-    {
-    FLOG(_L("CFotaDiskStorage::ConstructL() >>"));
-    TInt err;
-    User::LeaveIfError ( iFs.Connect() );
-
-    // Ensures that fotaserver private dir exists
-    err = iFs.MkDirAll(KDummyFilePath);
-    if ( err!=KErrAlreadyExists && err != KErrNone )
-        {
-        FLOG(_L(" created priv dir err %d"),err);
-        User::Leave ( err ) ;
-        }
-    FLOG(_L("CFotaDiskStorage::ConstructL()  sessionpath to %S")
-                        , &KDummyFilePath,err);
-    User::LeaveIfError ( iFs.SetSessionPath ( KDummyFilePath ) );
-
-    // newdummy remains should not exist now. safety.
-    err = iFs.Delete ( _L("newdummy") ) ;
-    if ( err!=KErrNone && err!= KErrNotFound ) User::Leave (err);
-
-    // Get write limit 
-    TInt writelimit( KFileReservationDefaultSize );
-    TInt chunksize ( iChunkSize );
-    CRepository* centrep( NULL);
-    TRAP(err, centrep = CRepository::NewL( KCRUidFotaDiskStorage ) );
-    if ( centrep ) 
-        {
-        err = centrep->Get( KFotaDiskSpaceReservationKey, writelimit );
-        err = centrep->Get( KFotaDiskSpaceReservationChunkKey, chunksize );
-        }
-    iDummySize = writelimit;
-    iChunkSize = chunksize;
-    delete centrep;
-
-    AdjustDummyStorageL();
-    FLOG(_L("CFotaDiskStorage::ConstructL() <<"));
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::~CFotaDiskStorage ()
-// ---------------------------------------------------------------------------
-//
-CFotaDiskStorage::~CFotaDiskStorage ()
-    {
-    FLOG(_L("CFotaDiskStorage::~CFotaDiskStorage ()"));
-    iFileWriteStream.Close();
-    iFs.Close();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::IsPackageStoreSizeAvailableL
-// does the pkg fit to reservation or filesystem
-// ---------------------------------------------------------------------------
-//
-CFotaStorage::TFreeSpace CFotaDiskStorage::IsPackageStoreSizeAvailableL(TInt& aSize)
-    {
-    CFotaStorage::TFreeSpace isavailable;
-    TInt            swupdSize(0);
-    TInt            dummySize(0);
-    SpaceAllocatedBySWUPDFilesL( swupdSize, dummySize);
-
-    if ( aSize <= dummySize ) 
-        {        
-        // fits to reservation
-        isavailable = CFotaStorage::EFitsToReservation;
-        }
-    else
-        {
-        // doesnt fit to reservation, does it fit to filesystem?
-        TInt sizeNeededFromFS = aSize - dummySize ;
-        if ( sizeNeededFromFS < 0 ) sizeNeededFromFS = 0;
-        TBool critical = SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, sizeNeededFromFS );
-        if ( critical )
-        	{
-					// how much space would be needed
-					TVolumeInfo vi;
-        	iFs.Volume(vi,EDriveC);
-        	
-					TInt neededspace = sizeNeededFromFS - vi.iFree + KSystemCriticalWorkingspace;
-					FLOG(_L("neededspace = %d vi.iFree = %d "), neededspace , vi.iFree);		
-					FLOG(_L(" neededspace = sizeNeededFromFS - vi.iFree + KSystemCriticalWorkingspace;") );
-        	//= aSize - vi.iFree;
-        	aSize = neededspace;
-        	isavailable = CFotaStorage::EDoesntFitToFileSystem;
-        	}
-        else
-        	{
-					isavailable = CFotaStorage::EFitsToFileSystem;
-        	}
-        }
-        TInt fitstodummy = isavailable==CFotaStorage::EFitsToReservation?1:0 ;
-        TInt fitstoFS = isavailable==CFotaStorage::EFitsToFileSystem?1:0 ;
-        TInt DoesntFitToFS = 	isavailable==CFotaStorage::EDoesntFitToFileSystem?1:0 ; 
-        	
-    FLOG(_L("CFotaDiskStorage::IsPackageStoreSizeAvailableL %d<%d (sz vs dummy) => fitstodummy:%d fitstoFS:%d DoesntFitToFS:%d")
-        ,aSize,dummySize,fitstodummy,fitstoFS,DoesntFitToFS );
-
-    return isavailable;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::AdjustDummyStorageL()
-// Ensure that total of iDummySize bytes are reserved by .swupd files and 
-// dummy file.
-// ---------------------------------------------------------------------------
-//
-TInt CFotaDiskStorage::AdjustDummyStorageL  ( )
-    {
-    FLOG(_L("CFotaDiskStorage::AdjustDummyStorageL >>"));
-    // Count size reserved by .swupd files
-    // CDir*       list;
-    TInt        err;
-    TInt        swupdSize(0);
-    TInt        dummySize(0);
-    RFile       dummy;
-
-    TRAP(err,SpaceAllocatedBySWUPDFilesL( swupdSize, dummySize));
-
-    // Calculate space for dummy file
-    TInt targetsize = iDummySize - swupdSize;
-    if ( targetsize<0 ) 
-        {
-        targetsize=0;
-        }
-
-    // Reduce dummy file size 
-    if ( dummySize != targetsize || dummySize ==0 ) 
-        {
-        FLOG(_L("   dummy new size %d (old %d)"), targetsize,dummySize);
-
-        err = dummy.Open(iFs, KDummyFileName, EFileWrite|EFileShareExclusive);
-
-        if (err == KErrNotFound ) 
-            {
-            User::LeaveIfError(dummy.Replace(iFs, KDummyFileName
-                                , EFileWrite|EFileShareExclusive)); 
-            }
-        else
-            if ( err!=KErrNone) User::LeaveIfError (err);
-
-        CleanupClosePushL(dummy);
-        TInt err= dummy.SetSize (targetsize);
-        if (err!=KErrNone)
-        	{
-        	FLOG(_L("Error while creating reserved space:  %d "),err );
-        	}
-        CleanupStack::PopAndDestroy(1); // dummy
-        }
-    FLOG(_L("CFotaDiskStorage::AdjustDummyStorageL, reserved file size = %d <<"),targetsize);
-    return 0;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::OpenUpdatePackageStore
-// Open upd pkg store for writing (writes to dummy file).
-// ---------------------------------------------------------------------------
-TInt CFotaDiskStorage::OpenUpdatePackageStoreL(const TInt aPkgId,TInt aNewDummySize
-                                                , RWriteStream*& aPkgStore)
-	{
-    FLOG(_L("CFotaDiskStorage::OpenUpdatePackageStore"));
-    TInt        err (KErrNone);
-
-    // Remove reserved memory
-    RFile tmp;
-    err = tmp.Open(iFs, KDummyFileName, EFileWrite|EFileShareExclusive);
-    CleanupClosePushL(tmp);
-    if ( !err )
-    	{
-        FLOG(_L("Removing the reserved memory as download has started"), iDummySize);
-        tmp.SetSize( KErrNone );
-        }
-    CleanupStack::PopAndDestroy( &tmp ); 
-	// flexible mem handling: increase dummy size to receive over sized package
-    if (iDummySize < aNewDummySize)
-    	iDummySize = aNewDummySize;
-    FLOG(_L("Newer dummy size = %d"),iDummySize);
-
-    TBuf<KMaxFileName>    swupd;
-
-    swupd.AppendNum(aPkgId);
-    swupd.Append(_L(".swupd"));
-    err = iFileWriteStream.Open(iFs, swupd, EFileWrite) ;
-    if (err == KErrNotFound ) 
-        {
-        User::LeaveIfError(iFileWriteStream.Replace(iFs, swupd
-                                                            , EFileWrite));
-        }
-    else
-        if ( err!=KErrNone) User::LeaveIfError (err);
-
-    //Positioning the seek if the file is already present (in case of resume)
-	TEntry entry;
-	TInt size (KErrNone);
-	err = iFs.Entry(swupd,entry);
-	if (!err)
-		size = entry.iSize; 
-	if (size)
-		{
-	    MStreamBuf* x = iFileWriteStream.Sink();
-	    TStreamPos pos(0);
-	    TRAPD(err2, pos = x->TellL(MStreamBuf::EWrite));
-	    
-	    pos+=size;
-	    TRAP(err2, x->SeekL(MStreamBuf::EWrite,pos ));
-		}
-    aPkgStore = &iFileWriteStream;
-    return err;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::GetDownloadedUpdatePackageSizeL
-// Gets the downloaded update package size in bytes
-// ---------------------------------------------------------------------------
-
-void CFotaDiskStorage::GetDownloadedUpdatePackageSizeL(const TInt aPkgId, TInt& aSize)
-	{
-	FLOG(_L("CFotaDiskStorage::GetDownloadedUpdatePackageSizeL >>"));
-	aSize = 0;
-
-    TBuf<KMaxFileName>    swupd;
-
-    swupd.AppendNum(aPkgId);
-    swupd.Append(_L(".swupd"));
-
-	TInt err(KErrNone);
-	TEntry entry;
-	err = iFs.Entry(swupd,entry);
-	if (!err)
-	aSize = entry.iSize; 
-	FLOG(_L("CFotaDiskStorage::GetDownloadedUpdatePackageSizeL,err = %d, aSize = %d <<"),err, aSize);
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::UpdatePackageDownloadComplete
-// closes the stream and frees resources
-// ---------------------------------------------------------------------------
-void CFotaDiskStorage::UpdatePackageDownloadCompleteL(const TInt aPkgId)
-    {
-    FLOG(_L("CFotaDiskStorage::UpdatePackageDownloadComplete(const TInt aPkgId)"));
-    RFile       fswupd;
-    TBuf<KMaxFileName>    fn;
-    TInt        err;
-    iFileWriteStream.Close();
-    if(iBytesWritten<1) 
-        {
-        FLOG(_L("  no bytes received!"));
-//        User::Leave(KErrNotFound);
-        return;
-        }
-    TBuf<KMaxFileName>    swupd;
-
-    swupd.AppendNum(aPkgId);
-    swupd.Append(_L(".swupd"));
-
-    // open swupd file for reading
-    err = fswupd.Open(iFs, swupd, EFileWrite|EFileShareExclusive);
-    FLOG(_L("  open err %d"),err);
-    if (err == KErrNotFound ) 
-        {
-        FLOG(_L("swupd not found, creaeting"));
-        User::LeaveIfError(fswupd.Replace(iFs, swupd
-                                        ,EFileWrite|EFileShareExclusive)); 
-        }
-    else
-        if ( err!=KErrNone) User::LeaveIfError (err);
-    CleanupClosePushL(fswupd);
-
-    RFile       ND;
-    User::LeaveIfError ( ND.Replace ( iFs, KDummyFileName, EFileWrite ) );
-    CleanupClosePushL  ( ND);
-    CleanupStack::PopAndDestroy(2); // dummies
-    AdjustDummyStorageL();
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::GetUpdatePackageLocation
-// Gets update package location, that is , path.
-// ---------------------------------------------------------------------------
-void CFotaDiskStorage::GetUpdatePackageLocationL(const TInt aPkgId
-                                                        , TDes8& aPath )
-{
-    TBuf8<20> fn;
-    fn.AppendNum(aPkgId);
-    fn.Append(_L8(".swupd"));
-    TInt pathlength = ((TDesC16)KDummyFilePath).Length();
-    HBufC8* path = HBufC8::NewLC( pathlength );
-    path->Des().Copy( KDummyFilePath );
-
-    aPath.Append( path->Des() );
-    aPath.Append(fn);
-    CleanupStack::PopAndDestroy( path );
-}
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::GetUpdatePackageIds
-// getupdate package ids
-// ---------------------------------------------------------------------------
-void CFotaDiskStorage::GetUpdatePackageIdsL(TDes16& aPackageIdList)
-    {
-    FLOG(_L("CFotaDiskStorage::GetUpdatePackageIds"));
-    // Read all .swupd files and parse pkg ids from filenames
-    TInt err;
-    CDir*   list;
-    err=iFs.GetDir (_L("*.swupd"), KEntryAttNormal ,ESortByName, list  );
-    for(int i=0; i<list->Count() ;++i )
-        {
-        TEntry t = (*list)[i];
-        TParse  p;
-        TInt16  pkgid;
-        p.Set(t.iName,NULL,NULL);
-        TLex    lex(p.Name());
-        err = lex.Val(pkgid);
-        FLOG(_L("   %S"),&t.iName);
-        if(err==KErrNone)
-            {
-            TPtrC  filename(p.Name());
-            FLOG(_L("  pkig found: %d"), pkgid);
-            TDateTime d = t.iModified.DateTime();
-            aPackageIdList.Append (pkgid);   
-            }
-        }
-    delete list;
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::DeleteUpdatePackageL 
-// ---------------------------------------------------------------------------
-void  CFotaDiskStorage::DeleteUpdatePackageL (const TInt aPkgId)
-    {
-    FLOG(_L("CFotaDiskStorage::DeleteUpdatePackageL %d >>"),aPkgId);
-    RFile       dummy;
-    TInt err=    dummy.Open(iFs, KDummyFileName , EFileWrite|EFileShareExclusive);
-    FLOG(_L("Error opening the reserved file...%d"),err);
-    CleanupClosePushL ( dummy );
-    TRAP(err, DoDeleteUpdatePackageL ( dummy, aPkgId, 0 ));
-    CleanupStack::PopAndDestroy(1);
-    AdjustDummyStorageL();
-
-    FLOG(_L("CFotaDiskStorage::DeleteUpdatePackageL %d, err = %d <<"),aPkgId, err);
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::DoDeleteUpdatePackageL 
-// Delete swupd by chunking data to dummy (param) file. Will grow dummy 
-// independently, but takes already allocated bytes into account.
-// ---------------------------------------------------------------------------
-void  CFotaDiskStorage::DoDeleteUpdatePackageL ( RFile& dummy, TInt aPkgId
-                                                    , TInt aAlreadyAllocated)
-    {
-    // Open swupd file 
-    TInt      err;
-    TBuf8<KMaxFileName> swupdpath;
-    TBuf<KMaxFileName>  swupdpath16;
-    GetUpdatePackageLocationL ( aPkgId, swupdpath) ;
-    swupdpath16.Copy ( swupdpath );
-    RFile       swupd;
-    err = swupd.Open( iFs, swupdpath16, EFileWrite );
-    if ( err == KErrNotFound )      return; // no need to delete
-    if ( err != KErrNone )          User::Leave ( err );
-    CleanupClosePushL ( swupd );
-
-    // Reduce dummy size
-    TInt dummytargetsize = iDummySize - aAlreadyAllocated;
-    for ( TInt p=0; p<10000 ; ++p )
-        {
-        TInt        dsize;
-        TInt        swupdsize(0);
-        User::LeaveIfError( dummy.Size( dsize ) );
-        User::LeaveIfError( swupd.Size( swupdsize) );
-        TInt        chunk =  swupdsize > iChunkSize ? iChunkSize : swupdsize;
-
-        // Ensure that dummy dosnt get oversized
-        if ( dsize <= dummytargetsize  && dsize + chunk >= dummytargetsize ) 
-                    chunk = dummytargetsize - dsize;
-
-        // Safety
-        if ( dsize >= dummytargetsize ) break;
-
-        FLOG(_L("  deleting swupd:  dummy %d\t  swupd %d\t chunk%d"),dsize
-                                                ,swupdsize,chunk);
-        if (chunk>0)
-            {
-            User::LeaveIfError( dummy.SetSize( dsize + chunk ) );
-            User::LeaveIfError( swupd.SetSize( swupdsize - chunk ) );
-            }
-        else 
-            break;
-        }
-    CleanupStack::PopAndDestroy(1); // swupd 
-
-    // Delete swupd  (dummy file is big enough now)
-    err = iFs.Delete ( swupdpath16 ) ;
-    FLOG(_L("CFotaDiskStorage::DoDeleteUpdatePackageL deleted ,err %d"),err);
-    if ( err != KErrNone && err != KErrNotFound ) 
-        {
-        User::Leave ( err );
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL
-// Counts space allocated by swupd files
-// ---------------------------------------------------------------------------
-void CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL( TInt& aSwupdSize, TInt& aDummySize )
-    {
-    CDir*       list;
-    TInt        err;
-    // TInt        (0);
-    aSwupdSize = 0;
-    aDummySize = 0;
-    err = iFs.GetDir (_L("*.swupd"), KEntryAttNormal ,ESortByName, list );
-    User::LeaveIfError(err);
-    CleanupStack::PushL ( list );
-    
-    // get sizes of swupd files
-    for(int i=0; i<list->Count() ;++i )
-        {
-        TEntry t = (*list)[i];
-        TParse  p;
-        TInt16  pkgid;
-        
-        p.Set(t.iName,NULL,NULL);
-        TLex    lex(p.Name());
-        err = lex.Val(pkgid);
-        if(err==KErrNone)
-            {
-            TPtrC  filename(p.Name());
-            aSwupdSize += t.iSize;
-            }
-        }
-    CleanupStack::PopAndDestroy( list );
-
-    // get size of dummyfile
-    err = iFs.GetDir (KDummyFileName, KEntryAttNormal ,ESortByName, list );
-    User::LeaveIfError(err);
-    CleanupStack::PushL ( list );
-    if ( list->Count() >0 )
-        {
-        TEntry t = (*list)[0];
-        aDummySize = t.iSize;
-        }
-    CleanupStack::PopAndDestroy( list );
-    FLOG(_L("CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL dummy:%d swupd:%d")
-                        ,aDummySize,aSwupdSize);
-    }        
-
-// ---------------------------------------------------------------------------
-// Global implementation uid array
-// Define the Implementation UIDs for JP2K decoder.
-// (other items were commented in a header).
-// ---------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
-{
-    // implementation_uid
-    IMPLEMENTATION_PROXY_ENTRY( 0x10207385 , CFotaDiskStorage::NewL )
-};
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// ---------------------------------------------------------------------------
-// ImplementationGroupProxy Implements proxy interface for ECom
-// Exported proxy for instantiation method resolution.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(  //lint !e714 Used by ECom
-    TInt& aTableCount ) // Number of tables 
-    {
-    aTableCount = sizeof( ImplementationTable ) / sizeof( 
-                                                        TImplementationProxy );
-    return ImplementationTable;
-    }
--- a/fotaapplication/fotaserver/FotaStorage/src/fotastorage.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   stores update package to filesystem
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <ECom.h>
-#include <ImplementationProxy.h>
-
-#include "fotastorage.hrh"
-#include "fotastorage.h"
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES  
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-
-// -----------------------------------------------------------------------------
-// CFotaStorage::CFotaStorage() 
-// -----------------------------------------------------------------------------
-//
-
-EXPORT_C CFotaStorage::CFotaStorage() : iBytesWritten(0)
-    {
-    
-    }
-
-// -----------------------------------------------------------------------------
-// CFotaStorage::~CFotaStorage ()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CFotaStorage::~CFotaStorage ()
-    {
-    }
-
--- a/fotaapplication/fotaserver/cenrep/fotadiskstoragePrivateCRKeys.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   fotadiskstorage's cenrep keys
-*
-*/
-
-
-
-#ifndef FOTADISKSTORAGE_PRIVATE_KEYS_H
-#define FOTADISKSTORAGE_PRIVATE_KEYS_H
-
-// CONSTANTS
-
-// fotadiskstorage key UID
-const TUid KCRUidFotaDiskStorage = { 0x102072C6 };
-
-// How much space should be reserved for firmware update package
-const TUint32 KFotaDiskSpaceReservationKey = 0x00000001;
-
-// In how large blocks fw update pkg should be moved
-const TUint32 KFotaDiskSpaceReservationChunkKey = 0x00000002;
-
-
-#endif // FOTADISKSTORAGE_PRIVATE_KEYS_H
-            
-// End of File
--- a/fotaapplication/fotaserver/cenrep/fotaserverPrivateCRKeys.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2005 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   	CR keys for fotaserver
-*
-*/
-
-
-
-#ifndef FOTASERVER_PRIVATE_KEYS_H
-#define FOTASERVER_PRIVATE_KEYS_H
-
-// CONSTANTS
-
-// FS key UID
-const TUid KCRUidFotaServer = { 0x102072C4 };
-
-// Device manager key UID
-const TUid KPSUidNSmlDMSyncApp = {0x101f6de5};
-// Whether update agent should be simulated by FS
-const TUint32 KSimulateUpdateAgent = 0x00000001;
-
-// DM UI Silent feature variation
-const TUint32 KSilentOmaDlUIBehavior = 0x00000002;
-
-//Flag to enable/disable the  feature ,.."Send Generic alert after device reboots"
-//Allowed values   1  , 0 
-const TUint32 KGenericAlertResendAfterBoot = 0x00000003;
-
-//Flag to configure number of retries for sending GA in failure cases.
-
-const TUint32 KGenericAlertRetries = 0x00000004;
-
-//Determines state of fota update.
-//0 - Default , no action taken. 
-//1 - Firmware update/GA 
-//2. Download Interrupted
-
-const TUint32 KFotaUpdateState   = 0x00000005;
-
-//Determines whether the Fota Suspend and Resume Feature is supported or not.
-//0 (default) - Feature OFF 
-//1   - Feature ON
-
-const TUint32 KSuspendResumeFeatureSupported = 0x00000006;
-
-//Determines whether the Fota Monitory Service is enabled or not.
-//0 (default ) - Feature OFF
-//1   - Feature ON
-
-const TUint32  KFotaMonitoryServiceEnabled = 0x00000007;
-
-//This key is to configure  the reminder options .
-//Format :
-//1h:4h:1d:3m:NROFF
-//h - hour/s. 
-//d- day/s
-//m - minute/s
-//":" Is the separator.
-//Currently only first 4 options are read to show reminder duration.
-//5th option can have value NROFF which means that "No reminder" option  will not be shown.
-//if 5th option has any other value other than NROFF , "No reminder" option will be shown
-//Default value : NULL.  Which means current options  1h:4h:1d:3d are taken 
-//into consideration along with No Reminder option.
-
-const TUint32 KFotaOptionsForReminderDuration = 0x00000008;
-
-//This key is to enable feature to reset the timer after device reboot  .
-//If value is 0 : Feature is OFF. - Default value
-//If value is 1  : Feature is ON.
-//Any other value its feature OFF
-//If feature is ON then if there was a reminder  set once 
-//device reboots timer should be reset and note to install Firmware update is shown .
-
-const TUint32 KFotaReminderTimerReset = 0x00000009;
-//This key is to enable feature to reset the timer after device reboot  .
-//If value is 0 :  Dynamo charger
-//If value is 1  : USB charger
-//Any other value its feature OFF
-
-const TUint32 KFotaUSBChargerEnabled  = 0x0000000A; 
-
-//This key stores the drive id to encrypt after update.
-const TUint32 KDriveToEncrypt  = 0x0000000B;
-
-//Determines whether FOTA Install Update note to be displayed or not,
-//when a phone call is active
-//0 (default) - Install update note not displayed when a call is active 
-//1   - Install update note will be displayed when a call is active
-const TUint32 KFotaUpdateNoteDisplayAlways= 0x0000000C;
-
-#endif // FOTASERVER_PRIVATE_KEYS_H
-            
-// End of File
Binary file fotaapplication/fotaserver/cenrep/keys_fotadiskstorage.xls has changed
Binary file fotaapplication/fotaserver/cenrep/keys_fotaserver.xls has changed
Binary file fotaapplication/fotaserver/conf/fotadiskstorage.confml has changed
Binary file fotaapplication/fotaserver/conf/fotadiskstorage_102072C6.crml has changed
Binary file fotaapplication/fotaserver/conf/fotaserver.confml has changed
Binary file fotaapplication/fotaserver/conf/fotaserver_102072C4.crml has changed
--- a/fotaapplication/fotaserver/fmsclient/bwins/fmsclientu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-EXPORTS
-	?MonitorForBatteryL@RFMSClient@@QAEXI@Z @ 1 NONAME ; void RFMSClient::MonitorForBatteryL(unsigned int)
-	?NotifyForResumeL@RFMSClient@@QAEXABW4TOmaDLInterruptReason@@ABHABW4TDriveNumber@@1@Z @ 2 NONAME ; void RFMSClient::NotifyForResumeL(enum TOmaDLInterruptReason const &, int const &, enum TDriveNumber const &, int const &)
-	?Close@RFMSClient@@QAEXXZ @ 3 NONAME ; void RFMSClient::Close(void)
-	?Cancel@RFMSClient@@QAEXXZ @ 4 NONAME ; void RFMSClient::Cancel(void)
-	?OpenL@RFMSClient@@QAEHXZ @ 5 NONAME ; int RFMSClient::OpenL(void)
-	?CancelNotifyForResume@RFMSClient@@QAEXXZ @ 6 NONAME ; void RFMSClient::CancelNotifyForResume(void)
-	?IsPhoneCallActive@RFMSClient@@QAEHAAH@Z @ 7 NONAME ; int RFMSClient::IsPhoneCallActive(int &)
-	?MonitorActivePhoneCallEnd@RFMSClient@@QAEHHH@Z @ 8 NONAME ; int RFMSClient::MonitorActivePhoneCallEnd(int, int)
-
--- a/fotaapplication/fotaserver/fmsclient/eabi/fmsclientu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-EXPORTS
-	_ZN10RFMSClient16NotifyForResumeLERK21TOmaDLInterruptReasonRKiRK12TDriveNumberS4_ @ 1 NONAME
-	_ZN10RFMSClient18MonitorForBatteryLEj @ 2 NONAME
-	_ZN10RFMSClient21CancelNotifyForResumeEv @ 3 NONAME
-	_ZN10RFMSClient5CloseEv @ 4 NONAME
-	_ZN10RFMSClient5OpenLEv @ 5 NONAME
-	_ZN10RFMSClient6CancelEv @ 6 NONAME
-	_ZN10RFMSClient17IsPhoneCallActiveERi @ 7 NONAME
-	_ZN10RFMSClient25MonitorActivePhoneCallEndEii @ 8 NONAME
-
--- a/fotaapplication/fotaserver/fmsclient/group/bld.inf	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-// BLD.INF
-// Component description file 
-//
-
-PRJ_MMPFILES
-
-FMSClient.mmp
-
--- a/fotaapplication/fotaserver/fmsclient/group/fmsclient.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <platform_paths.hrh>
-#include "defaultcaps.hrh"
-
-//MACRO  _FOTA_DEBUG
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-CAPABILITY	CAP_CLIENT_DLL 
-
-TARGET        fmsclient.dll
-TARGETTYPE    dll
-UID 0x1000008D 0x200100C7
-VENDORID 			VID_DEFAULT
-
-SOURCEPATH    ../src
-SOURCE        fmsclient.cpp
-
-USERINCLUDE   ../inc
-USERINCLUDE   ../../inc
-USERINCLUDE   ../../cenrep
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY       euser.lib  
-LIBRARY 	  bafl.lib 
-LIBRARY 	  efsrv.lib 
-LIBRARY		  centralrepository.lib
-LIBRARY       flogger.lib
--- a/fotaapplication/fotaserver/fmsclient/inc/fmsclient.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef __FMS_CLIENT_H__
-#define __FMS_CLIENT_H__
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32cmn.h>
-#include <f32file.h>
-#include "fmsclientserver.h"
-
-
-class RFMSClient : public RSessionBase
-	{
-	public:
-		/**
-		 * Launches FMSServer
-		 * @param None
-		 * @return KErrNone Symbian error code
-		 */
-		IMPORT_C TInt OpenL();
-		
-		/**
-		 * Close server connection
-		 * @param None
-		 * @return None
-		 */
-		IMPORT_C void Close();
-		
-		/**
-		 * Sending the parameters to FMSServer
-		 * FotaServer or test app should use this
-		 * @param aReason
-		 * @param aBearer
-		 * @param aDrive
-		 * @param aSize
-		 * @return None
-		 */
-		IMPORT_C void NotifyForResumeL(const TOmaDLInterruptReason& aReason, 
-		  const TInt& aBearer, const TDriveNumber& aDrive, const TInt& aSize);						
-		
-		/*
-		 * Cancels the request on FMSServer
-		 * @param None
-		 * @return None
-		 */
-		IMPORT_C void CancelNotifyForResume();
-		
-		/**
-		 * Sending the parameters to FMSServer
-		 * to monitor for battery level during USB charging
-		 * @param aLevel - level of the battery charge to monitor
-		 * @return None
-		 */
-		IMPORT_C void MonitorForBatteryL(TUint aLevel);
-		
-		/**
-		 * Cancels the request on FMSServer
-		 * @param None
-		 * @return None
-		 */
-		 IMPORT_C void Cancel();
-		 
-		 /**
-		  * phone call active check to FMSServer
-		  * @param aCallActive, on return holds call status
-		  * @return TInt, error code
-		  */
-		 IMPORT_C TInt IsPhoneCallActive(TInt& aCallActive);
-		 
-		 /**
-		  * Monitor for active phone call end
-		  * @param aPkgId, Package id of interrupted update 
-		  * & Profile Id, Server profile Id
-		  * @return TInt, error code
-		  */
-		 IMPORT_C TInt MonitorActivePhoneCallEnd(TInt aPkgId,TInt aProfileId);
-		 
-	private:
-		/* 
-		 * FotaStartUp uses this at the time of reboot 
-		 * to trigger FMS server
-		 * @param None
-		 * @return None
-		 */
-		 void SendInterruptParamsL();
-};
-
-#endif
--- a/fotaapplication/fotaserver/fmsclient/inc/fmsclientdebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef FMS_CLIENT_DEBUG_H_
-#define FMS_CLIENT_DEBUG_H_
-   #ifdef _FOTA_DEBUG
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fmsclient.log" );
-        _LIT( KLogDirFullName, "c:\\logs\\" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-
-#endif /*FMSCLIENTDEBUG_H_*/
--- a/fotaapplication/fotaserver/fmsclient/src/fmsclient.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <f32file.h>
-#include <fotaConst.h>
-#include <fotaengine.h>
-#include "fmsclientserver.h"
-#include "fmsclient.h"
-#include "fmsclientdebug.h"
-
-#include "fotaserverPrivateCRKeys.h"
-#include <centralrepository.h>
-// ---------------------------------------------------------------------------
-// IsSecureClient()  
-// Checks who is trying to launch FMS
-// ---------------------------------------------------------------------------
-TBool IsSecureClient(TBool& aFotaStartUp)
-	{
-	FLOG(_L("IsSecureClient Started"));
-	RThread thread;
-	TUid fotaserver,fotastartup;
-	fotaserver.iUid = KFotaServerUid;
-	fotastartup.iUid = KStarterUid;	
-	if ( thread.SecureId() == fotaserver.iUid ) 
-		{
-		FLOG(_L("fmsclient fotaserver is using the service"));
-		return ETrue;
-		}
-	else if ( thread.SecureId() ==  fotastartup.iUid )
-		{
-		FLOG(_L("fmsclient fotastartupplugin is using the service"));
-		aFotaStartUp = ETrue;
-		return ETrue;    
-		}
-		else if (thread.SecureId() == 0x01D278B9 ) //test app
-		{
-		FLOG(_L("fmsclient test app is using the service"));		
-		return ETrue;
-		}
-	FLOG(_L("fmsclient not launched"));
-	return EFalse;
-	}
-
-// ---------------------------------------------------------------------------
-// StartServerL()  
-//	Starts Fota Downlaod Interrupt Monitory server
-// ---------------------------------------------------------------------------
-TInt StartServerL()
-	{
-	FLOG(_L("StartServerLt Started"));
-	TInt res = KErrNone;
-	RProcess server;
-	res=server.Create(KFMSServerName,KNullDesC);
-	FLOG(_L("StartServerL-- create server error as %d"),res);
-	if (res!=KErrNone)
-		{		
-		return res;
-		}
-	TRequestStatus stat;
-	server.Rendezvous(stat);
-	if (stat!=KRequestPending)
-		server.Kill(0);		// abort startup
-	else
-		server.Resume();	// logon OK - start the server
-	User::WaitForRequest(stat);		// wait for start or death
-	res=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
-	FLOG(_L("StartServerL-- server.ExitType() returns %d"),res);
-	server.Close();
-	return res;
-	}
-
-// ---------------------------------------------------------------------------
-// RFMSClient::OpenL()
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFMSClient::OpenL()
-	{	
-	FLOG(_L("RFMSClient::OpenL()- Begin"));
-	TInt res = KErrNone;
-	TBool FotaStartUp = EFalse;
-	if( IsSecureClient(FotaStartUp))
-		{
-		FLOG(_L("RFMSClient::OpenL()- Secured client"));
-		res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
-		if ( res != KErrNone )
-			{
-			FLOG(_L("RFMSClient::OpenL()- session not created"));
-			res = StartServerL();
-			User::LeaveIfError( res );
-			res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
-			}
-		User::LeaveIfError( res );
-		FLOG(_L("RFMSClient::OpenL()- session created"));
-		CRepository* centrep2 = NULL;
-    TRAPD( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) )
-    TInt val = KErrNone;
-    if (err==KErrNone ) 
-      {
-      	      centrep2->Get(  KFotaUpdateState, val );
-      	      delete centrep2;
-      }
-            
-            centrep2 = NULL;
-    
-		if( FotaStartUp && val == EFotaDownloadInterrupted )
-			{
-			FLOG(_L("RFMSClient::OpenL()- fotastartup using FMS session"));
-			SendInterruptParamsL();
-			}
-		}
-	else //not a secured client
-		{
-		FLOG(_L("fmsclient not launched--insecured client"));
-		res = KErrNotFound;
-		}
-	FLOG(_L("RFMSClient::OpenL()- End %d"),res);	
-	return res;
-	}
-
-// ---------------------------------------------------------------------------
-// RFMSClient::Close()
-// ---------------------------------------------------------------------------
-EXPORT_C void RFMSClient::Close()
-	{
-    FLOG(_L(" RFMSClient::Close"));
-	RSessionBase::Close();  //basecall
-	}
-	
-// ----------------------------------------------------------------------------
-// RFMSClient::NotifyForResumeL()
-// ----------------------------------------------------------------------------	
-EXPORT_C void RFMSClient::NotifyForResumeL(const TOmaDLInterruptReason& aReason,
-		const TInt& aBearer, const TDriveNumber& aDrive, const TInt& aSize)
-	{		
-    FLOG(_L(" RFMSClient::NotifyForResumeL--Begin"));
-    TInt Size(aSize),Drive((TInt)aDrive),Bearer(aBearer);
-    TInt err = SendReceive( (TInt)aReason, TIpcArgs(Bearer,Drive,Size));
-    FLOG(_L(" RFMSClient::NotifyForResumeL--End error as %d"),err);
-	}
-
-// ---------------------------------------------------------------------------
-// RFMSClient::SendInterruptParamsL() called only when fotastartup launched
-// ---------------------------------------------------------------------------	
-void RFMSClient::SendInterruptParamsL()
-	{
-	FLOG(_L(" RFMSClient::SendInterruptParamsL--Begin"));
-	TInt err = Send( EFotaStartUpPlugin );
-	FLOG(_L(" RFMSClient::SendInterruptParamsL--End as %d"),err);
-	}
-// ---------------------------------------------------------------------------
-// RFMSClient::CancelNotifyForResume() 
-// ---------------------------------------------------------------------------	
-EXPORT_C void RFMSClient::CancelNotifyForResume()
-	{
-	FLOG(_L(" RFMSClient::CancelNotifyForResume--Begin"));
-	TInt err = Send( ECancelOutstandingRequest );
-	FLOG(_L(" RFMSClient::CancelNotifyForResume--End as %d"),err);
-	}
-
-// ---------------------------------------------------------------------------
-// RFMSClient::MonitorForBatteryL() 
-// ---------------------------------------------------------------------------	
-EXPORT_C void RFMSClient::MonitorForBatteryL(TUint aLevel)
-    {
-    FLOG(_L(" RFMSClient::MonitorForBatteryL--Begin, level = %d"), aLevel);
-	TInt err = SendReceive( EMonitorbattery, TIpcArgs (aLevel));
-	FLOG(_L(" RFMSClient::MonitorForBatterL--End as %d"),err);
-	User::LeaveIfError(err);
-	}
-// ---------------------------------------------------------------------------
-// RFMSClient::Cancel() 
-// ---------------------------------------------------------------------------	
-EXPORT_C void RFMSClient::Cancel()
-	{
-	FLOG(_L(" RFMSClient::Cancel--Begin"));
-	TInt err = SendReceive( ECancelOutstandingRequest );
-	FLOG(_L(" RFMSClient::Cancel--End as %d"),err);
-	}
-	
-// ---------------------------------------------------------------------------
-// RFMSClient::ActivePhoneCallSync() 
-// ---------------------------------------------------------------------------  
-EXPORT_C TInt RFMSClient::IsPhoneCallActive(TInt& aCallActive)
-    {
-    FLOG(_L(" RFMSClient::IsPhoneCallActive--Begin"));
-    TPckgBuf<TInt> result(aCallActive);
-    TInt err = SendReceive( EPhoneCallActive,TIpcArgs(&result));    
-    aCallActive=result();
-    FLOG(_L(" RFMSClient::IsPhoneCallActive--End as %d,%d"),err,aCallActive);
-    return err;
-    }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::MonitorActivePhoneCallEnd() 
-// ---------------------------------------------------------------------------  
-EXPORT_C TInt RFMSClient::MonitorActivePhoneCallEnd(TInt aPkgId,TInt aProfileId)
-    {
-    FLOG(_L(" RFMSClient::MonitorActivePhoneCallEnd--Begin, pkgid:%d, \
-            / profileid:%d"),aPkgId,aProfileId);
-    TInt err = SendReceive( EMonitorPhoneCallEnd, TIpcArgs(aPkgId,aProfileId));
-    FLOG(_L(" RFMSClient::MonitorActivePhoneCallEnd--End as %d"),err);
-    return err;
-    }
-//End of file
--- a/fotaapplication/fotaserver/fmserver/group/bld.inf	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-// BLD.INF
-// Component description file 
-//
-
-PRJ_MMPFILES
-
-FMSServer.mmp
-
-
--- a/fotaapplication/fotaserver/fmserver/group/fmsserver.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <platform_paths.hrh>
-#include "defaultcaps.hrh"
-
-//MACRO  _FOTA_DEBUG
-//MACRO  _FOTA_DEBUG_RDEBUG
-
-CAPABILITY    CAP_SERVER
-
-TARGET        fmsserver.exe
-TARGETTYPE    exe
-
-UID 0 0x200100C8
-VENDORID 			VID_DEFAULT
-
-SOURCEPATH    ../src
-SOURCE        fmsserver.cpp
-SOURCE		  fmsserversession.cpp
-SOURCE		  fmsinterruptaob.cpp
-
-USERINCLUDE   ../inc
-USERINCLUDE   ../../inc
-USERINCLUDE   ../../cenrep
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY       euser.lib
-LIBRARY       connmon.lib // for connection monitoring
-LIBRARY       sysutil.lib 
-LIBRARY       efsrv.lib 
-LIBRARY       flogger.lib
-LIBRARY       centralrepository.lib 
-LIBRARY       fotaengine.lib 
-LIBRARY       cmmanager.lib 
-LIBRARY       etelmm.lib 
-LIBRARY       etel.lib 
-
--- a/fotaapplication/fotaserver/fmserver/inc/fmsdebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef FMSDEBUG_H_
-#define FMSDEBUG_H_
-
-	#ifdef _DEBUG
-	#define _FOTA_DEBUG
-	#endif
-
-   #ifdef _FOTA_DEBUG
-
-        #include <e32std.h>
-        #include <f32file.h>
-        #include <flogger.h>
-        #include <e32svr.h>
-
-        _LIT( KLogFile, "fmsserver.log" );
-        _LIT( KLogDirFullName, "c:\\logs\\" );
-        _LIT( KLogDir, "fota" );
-
-        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
-            {
-            VA_LIST list;
-            VA_START( list, aFmt );
-            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
-            }
-
-
-        #ifdef _FOTA_DEBUG_RDEBUG 
-            #ifndef __GNUC__          
-                #define FLOG            RDebug::Print
-            #else   // __GNUC__       
-                #define FLOG(arg...)    RDebug::Print(arg);
-            #endif // __GNUC__        
-        #else // _FOTA_DEBUG_RDEBUG
-            #ifndef __GNUC__          
-                #define FLOG            FWrite
-            #else   // __GNUC__       
-                #define FLOG(arg...)    FWrite(arg);
-            #endif // __GNUC__        
-        #endif // _FOTA_DEBUG_RDEBUG
-
-    #else   // _FOTA_DEBUG    
-        #ifndef __GNUC__
-            #define FLOG
-        #else
-            #define FLOG(arg...)
-        #endif // __GNUC__
-    #endif // _FOTA_DEBUG
-
-
-#endif /*FMSDEBUG_H_*/
--- a/fotaapplication/fotaserver/fmserver/inc/fmsinterruptaob.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,296 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef __FMS_AOB_H__
-#define __FMS_AOB_H__
-
-#include <e32base.h>
-#include <e32std.h>
-#include <e32property.h>
-#include <rconnmon.h>
-#include <etel.h>
-#include <fotaengine.h>
-#include "fmsserver.h"
-#include "fmsdebug.h"
-
-class CFMSServer;
-
-// CLASS DECLARATION     
-class CFMSInterruptAob : public CActive,private MConnectionMonitorObserver
-	{	
-	friend class CFMSServer;	
-	
-	public:
-	/**
-	 * Default constructor
-	 */
-	CFMSInterruptAob();
-	
-	/**
-	 * second phase constructor
-	 */
-	void ConstructL();
-	
-	/**     
-     * Logs the new request/interrupt to  be monitored  
-     * @param aType, interrupt reason
-     * @return None
-     */
-	void StartL(TOmaDLInterruptReason aType);
-	
-	/**
-	 * Starts Active object to monitor for the update interrupt in case of USB charger support
-	 * @param aType, Interrupt reason
-	 * @return None
-	 */
-	void StartBatteryMonitoringL(TOmaUpdInterruptReason aType, TUint aLevel);
-
-	/**     
-     * Sets the memory size member variable to be monitored 
-     * for the current interrupt 
-     * @param aSize, Memory space required
-     * @param aDrive, Drive used for download
-     * @return None
-     */
-	void MemoryToMonitorL(TInt aSize, TDriveNumber aDrive);
-	
-	/**     
-     * Sets the network type for the current interrupt 
-     * @param aBearer
-     * @return None
-     */
-	void NetworkTypeL(TInt aBearer);
-	/**     
-     * Launches FOTA install notifier 
-     * @param None
-     * @return None
-     */
-	void LaunchFotaScheduleUpdate();
-	
-	/*
-	 * Destructor
-	 */
-	virtual ~CFMSInterruptAob();
-	
-	/**     
-	 * Starts monitor for active call end 	
-	 * @param aType, Reason to be monitored	 
-	 * @return None
-	 */
-	void StartCallEndMonitoringL(TOmaUpdInterruptReason aType);
-	
-	private:
-	
-	/**
-     * From CActive
-     * Called by Active scheduler when the asynchronous 
-     * request completed     
-     * @param None
-     * @return None
-     */
-	void RunL();
-	
-	/**
-     * From CActive
-     * Called when a pending request has to be cancelled     
-     * @param None
-     * @return None
-     */
-	void DoCancel();
-	
-	 /**
-     * From CActive
-     * Handle a leave occurred in the RunL().
-     * Note: If RunError function pointer is not given in construction,
-     * the leave error is to be propagated back to the active scheduler!
-     *
-     * @since S60 v3.2
-     * @param aError the error code of leave
-     */
-    TInt RunError( TInt aError );
-    
-    /**
-     * Checks the package size is more than warning level of memory
-     * @param aCritical to set EFalse/ETrue
-     * @return TInt
-     */
-	TInt IsPkgSizeMoreThanWL(TBool& aCritical);
-	
-	/**
-	  * Starts network notification registry
-	  * @param None
-	  * @return None
-	  */
-	TBool CheckNetworkL();
-	
-	/**
-	  * Starts network notification registry
-	  * @param None
-	  * @return None
-	  */
-	void LaunchFotaEngineL();		
-	
-	/**
-	  * Starts network notification registry
-	  * @param None
-	  * @return None
-	  */
-	TBool CheckGlobalRFStateL();
-	
-	/**
-	  * Stops the FMS Server
-	  * @param None
-	  * @return None
-	  */
-	void StopServer();
-	
-	/**
-	  * Checks the memory size to be monitored
-	  * after adding the warning level
-	  * @param None
-	  * @return None
-	  */
-	void CheckMemSizeL();
-	
-	public: 
-    
-  	/**
-    * Starts network notification registry
-    * @param None
-    * @return None
-    */
-	void NotifyL() ;
-	
-    /**
-    * Stops network notifications.
-    * @param None
-    * @return None
-    */
-   	void StopNotify() ;
-   	
-   	/**
-     * sets n/w to 3G.
-     * @param None
-     * @return None
-     */
-   	void SetWcdma() ;
-   	
-   	/**
-     * Starts n/w registry check in Hard reeboot case
-     * uses CPeriodic variable to call static method
-     * @param None
-     * @return None
-     */
-   	void StartNetworkRegistryCheckL();
-   	
-   	/**
-     * checks n/w registry in Hard reeboot case
-     * and destroys the CPeriodic if connection is there
-     * and triggers fota engine
-     * @param None
-     * @return None
-     */
-	void NetworkRegistryCheckL();
-	
-	/**
-	 * Launches Fota update note	 
-	 * @param aPkgId, package Id of FOTA Update
-	 * @param aProfilleId, Profile ID of FOTA
-	 * @return None
-	 */
-	void LaunchFotaUpdate(TInt& aPkgId, TInt& aProfilleId);
-	
-	private : 
-	
-	/**
-	 * From MConnectionMonitorObserver
-	 * Method involed by connection monitor with current event. 
-	 * This method handles the events
-	 * @param aConnMonEvent says about the event
-	 * @return None
-	 */
-	void EventL( const CConnMonEventBase& aConnMonEvent ) ;
-	
-	/**
-	 *CheckNetworkstatus and takes action based on that 
-	 * @param none
-	 * @return None
-	 */
-	void CheckNetworkStatusL();
-	/**
-	 * HandleAboveCriticallevel handle memory interrupt when it is above critical level 
-	 * @param                   None
-	 * @return                  None
-	 */
-	void HandleAboveCriticallevelL();
-	
-	/**
-	 * HandleChargingInterruptL  handle charging interrupt when it is above critical level 
-	 * @param                   None
-	 * @return                  None
-	 */
-	
-	void HandleChargingInterruptL();
-	
-	private:	  
-	
-	RConnectionMonitor iConnMon;
-	RFs iFs;
-	RProperty iProperty;
-    TInt iConnStatus;	
-    TInt iSize;
-    TDriveNumber iDrive;
-    TInt iBearer;
-    TBool iWlanAvailable;
-    TBool iGPRSAvail;
-    TOmaDLInterruptReason iInterruptType;
-    TOmaUpdInterruptReason iUpdInterruptType;
-    CFMSServer* iServer;
-    RFotaEngineSession iFotaEngine;    
-    CPeriodic* iPeriodicNwCheck;
-    TBool iWcdma;
-    
-    /** 
-     * RTelServer object used to keep an asynchronous request
-     * for phone call end monitoring
-     */ 
-    RTelServer iTelServer;
-
-    /** 
-     * RPhone object used to keep an asynchronous request
-     * for phone call end monitoring
-     */
-    RPhone     iPhone;
-    
-    /** 
-     * RLine object used to keep an asynchronous request
-     * for phone call end monitoring
-     */
-    RLine      iLine;
-    
-    /** 
-     * To get hodl of current call status     
-     */
-    RCall::TStatus iCallStatus;
-
-    TInt iChargeToMonitor;
-
-	};
-	
-
-#endif
\ No newline at end of file
--- a/fotaapplication/fotaserver/fmserver/inc/fmsserver.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef __FMS_SERVER_H__
-#define __FMS_SERVER_H__
-
-#include <e32base.h>
-#include <e32std.h>
-#include <e32property.h>
-#include <flogger.h>
-#include <rconnmon.h>
-#include <f32file.h>
-#include <fotaengine.h>
-#include "fmsclientserver.h"
-#include "fmsinterruptaob.h"
-#include "fmsdebug.h"
-
-_LIT( KFotaInterruptFileName, "fotainterrupt.txt" );
-const TInt64 KThresholdDiskSpace = 305152;
-const TInt64 KDiskSpaceNotCL = 102400;
-const TInt KRequestTriggerWaitTime(1000000);
-
-class CFMSSession;
-class CFMSServer;
-class CFMSInterruptAob;
-
-	
-class CFMSServer: public CServer2
-	{
-	friend class CFMSSession;
-	friend class CFMSInterruptAob;
-	
-	public:
-	
-	/**
-	 * Destructor
-	 */ 
-	virtual ~CFMSServer();
-	
-	/**
-	 * Static method which creates the server instance
-	 * @param None
-	 * @return CServer2*
-	 */ 
-	static CServer2*  NewLC();
-	
-	/**
-	 * Stops the session and closes the server
-	 * @param None
-	 * @return None
-	 */
-	void DropSession();
-	
-	/**
-	 * Starts Active object to monitor for the interrupt
-	 * @param aType, Interrupt reason
-	 * @return None
-	 */
-	void StartMonitoringL(TOmaDLInterruptReason aType);
-
-	/**
-	 * Starts Active object to monitor for the update interrupt
-	 * @param aType, Interrupt reason
-	 * @param aLevel, Level of the battery charge to monitor
-	 * @return None
-	 */
-	void StartBatteryMonitoringL(TOmaUpdInterruptReason aType, TUint aLevel);
-
-/**
-	 * Starts Active object to monitor for the update interrupt
-	 * @param aType, Interrupt reason
-	 * @return None
-	 */
-	void StartUpdateInterruptMonitoringL(TOmaUpdInterruptReason aType);
-	/**
-	 * Calls Active object's method to set the drive & size 
-	 * for memory interrupt
-	 * @param aSize, Interrupt aDrive
-	 * @return None
-	 */
-	void MemoryToMonitorL(TInt aSize, TDriveNumber aDrive);
-	
-	/**
-	 * Calls Active object's method to set the network bearer
-	 * @param aBearer
-	 * @return None
-	 */
-	void NetworkTypeL(TInt aBearer);
-	
-	/**
-	 * Writes the file with all the interrupt information
-	 * @param aReason ,Interrupt reason
-	 * @param aBearer ,Bearer id
-	 * @param aDrive  ,Drive to Download
-	 * @param aSize   , memory size to monitor
-	 * @param aWcdmaBearer , 3G bearer or not
-	 * @return None
-	 */
-    void WriteToFile(TInt aReason, TInt aBearer, TDriveNumber aDrive, 
-    		TInt aSize, TBool aWcdmaBearer );
-    
-    /**
-	 * Reads the file for the interrupt information
-	 * @param aReason ,Interrupt reason
-	 * @param aBearer ,Bearer id
-	 * @param aDrive  ,Drive to Download
-	 * @param aSize   , memory size to monitor
-	 * @param aWcdmaBearer , 3G bearer or not
-	 * @return TBool, says reading success or not
-	 */
-    TBool ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize
-    		 , TInt& aWcdmaBearer );
-    
-    /**
-	 * Checks for any interrupt pending
-	 * @param None
-	 * @return TBool
-	 */
-    TBool RequestPending();
-    
-    /**
-	 * Checks the network as part of other interrupts
-	 * before triggering fota.
-	 * In case of network down, it keeps network interrupt
-	 * @param aBearer ,Bearer id
-	 * @param aDrive  ,Drive to Download
-	 * @param aSize   , memory size to monitor
-	 * @param aWcdmaBearer , 3G bearer or not
-	 * @return None
-	 */
-    void CheckNetworkL(TInt& aBearerId,TInt& aDrive, TInt& aSize,TBool& aWcdma);
-    
-    /**
-	 * Locks the session, so that new session will not be started
-	 * before the previous interrupt monitory completion
-	 * @param None
-	 * @return None
-	 */
-    void LockSession();
-    
-    /**
-	 * Computes the variation configured
-	 * @param None
-	 * @return None
-	 */
-    void FindVariation();
-    
-    /**
-	 * Checks Charger monitoring supported or not
-	 * @param None
-	 * @return TBool, which says Charger monitory support
-	 */
-    TBool ChargerTobeMonitered();
-    
-    /**
-	 * Checks  Network monitoring supported or not
-	 * @param None
-	 * @return TBool, which says  Network monitory support
-	 */
-    TBool NetworkTobeMonitered();
-    
-    /**
-	 * Checks Phone startup monitoring supported or not
-	 * @param None
-	 * @return TBool, which says Phone startup monitory support
-	 */
-    TBool MoniterAfterPhoneRestart();
-    
-    /**
-	 * Checks Memory monitoring supported or not
-	 * @param None
-	 * @return TBool, which says Memory monitory support
-	 */
-    TBool MemoryTobeMonitered();
-    
-    /**
-	 * Checks for WLAN
-	 * @param None
-	 * @return TBool, which says WLAN availability
-	 */
-    TBool CheckWlanL();
-    
-    /**
-	 * Sets the Bool value which decides file deletion
-	 * @param aValue, says whether the file to be deletd or not
-	 * @return None
-	 */
-    void DeleteFile(TBool aValue);
-    
-    /**
-	 * Checks network and trigger fota engine in hard reboot case
-	 * @param None
-	 * @return None
-	 */
-    void TriggerFotaL();
-    
-    /**
-	 * For asynchronous network request to be 
-	 * logged on active object, using CPeriodic
-	 * @param None
-	 * @return None
-	 */
-	void AsyncSessionRequestL();
-		
-	/**
-	 * Destroys the CPeriodic object
-	 * So that not to call the static method again
-	 * @param None
-	 * @return None
-	 */
-	void StopAsyncRequest();
-	
-	/**
-     * Calls Active objects SetWcdma to set the bearer to 3G
-     * @param None
-     * @return None
-     */
-   	void SetWcdma() ;
-   	
-   	/**
-   	 * Checks whether a phone call is active or not
-   	 * @param aStatus, on return contains the call status
-   	 * @return None
-   	 */
-   	void CheckPhoneCallActiveL(TInt& aStatus);
-   	
-   	/**
-   	 * Starts montioring for active phone call end
-   	 * @param aPkgId, package Id of FOTA Update
-   	 * @param aProfileId, Profile ID of FOTA
-   	 * @return phone call active or not at that moment
-   	 */
-   	TBool MonitorPhoneCallEndL(TInt aPkgId, TInt aProfileId);
-   	
-   	/**
-   	 * Logs Asynchronous montioring for active phone call end
-   	 * To avoid performance issues(like thread blocking call)
-   	 * @param None
-   	 * @return None
-   	 */
-   	void LogAsyncCallMonitorL();
-   	
-   	/**
-   	 * Returns the FOTA Update packaged Id
-   	 */ 
-   	TInt& PkgId();
-
-   	/**
-   	 * Returns the FOTA server profile Id
-   	 */
-   	TInt& ProfileId();
-   	
-	private:
-	
-	/**
-	 * second phase constructor
-	 */
-	void ConstructL();
-	
-	/**
-	 * Default constructor
-	 */
-	CFMSServer();
-	
-	protected:
-	
-	/**
-	 * Calls when a New session is getting created
-	 * @param aVersion
-	 * @param aMessage
-	 * @return CSession2*
-	 */
-	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage)  const;
-	
-	private:
-	RFs iFs; //for file creation, writing & Deleting
-	RFile iFile;
-	TInt iSessionCount;	
-	CFMSInterruptAob iFMSInterruptAob;
-    TBool iNetworkMon;
-    TBool iChargerMon;
-    TBool iPhoneRestartMon;
-    TBool iMemoryMon;	
-    TBool iDeleteFile;
-    CPeriodic* iLogAsyncRequest;
-    
-    //FOTA Server Profile Id
-    TInt iProfileId;
-    
-    //FOTA Update package Id
-    TInt iPkgId;
-	};
-	
-#endif
\ No newline at end of file
--- a/fotaapplication/fotaserver/fmserver/inc/fmsserversession.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#ifndef __FMS_SESSION_H__
-#define __FMS_SESSION_H__
-
-#include "fmsserver.h"
-
-class CFMSSession: public CSession2
-{
-	friend class CFMSServer;
-	public:
-		/**
-		 * Destructor
-		 */
-		virtual ~CFMSSession();		
-	
-	private:
-		/**
-		 * Constructor
-		 */ 
-		CFMSSession();
-		
-		/**
-		 * Provides FMS Server reference
-		 * @param None.
-		 * @return CFMSServer reference
-		 */ 
-		CFMSServer& Server();
-		
-		/**
-		 * Called by the framework to handle the request 	 
-		 * @param aMessage
-		 * @return None
-		 */
-		void ServiceL(const RMessage2& aMessage);
-		
-		/**
-		 * Called from ServiceL to handle the request 
-		 * @param aMessage
-		 * @return None
-		 */
-		void DispatchMessageL(const RMessage2& aMessage);
-		
-		/**
-		 * Called when ServiceL leaves
-		 * @param aMessage
-		 * @param aError
-		 * @return None
-		 */
-		void ServiceError(const RMessage2 &aMessage, TInt aError);
-		
-		/**
-		 * Checks whether the session started client is secured or not	 
-		 * @param aMessage
-		 * @return TBool
-		 */
-		TBool CheckClientSecureIdL( const RMessage2 &aMessage );
-		
-		/**
-		 * Finds the bearer id for the corresponding IAP Id		 
-		 * @param aIapId
-		 * @return TUint32, bearer id
-		 */
-		TUint32 FindBearerIdL(TInt aIapId);
-		
-		/**
-		 * Writes Dummy file in case of unsupported monitoring		 
-		 * @param None.
-		 * @return CFMSServer reference
-		 */
-		void WriteDummyFile();
-		
-		/**
-		 * Checks whether the phone is in 2G or 3G mode
-		 * sets the member variable iWcdmaBearer
-		 * @param None.
-		 * @return CFMSServer reference
-		 */
-		void PhoneModeL();
-		
-		/**
-		 * 
-		 * Handles the service based on bearer type
-		 * @param aMessage.
-		 * @return None
-		 */
-			void HandleBasedOnBearertypeL(const RMessage2& aMessage);
-	private:	
-		TBool iStopServer;
-		TBool iWlanbearer;
-		TBool iWcdmaBearer;
-};
-
-
-#endif
\ No newline at end of file
--- a/fotaapplication/fotaserver/fmserver/src/fmsinterruptaob.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,975 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <systemwarninglevels.hrh>
-#include <e32property.h>
-#include <startupdomainpskeys.h>
-#include <hwrmpowerstatesdkpskeys.h>
-#include <sysutil.h> 
-#include <fotaengine.h>
-#include "fotaserverPrivateCRKeys.h"
-#include "fmsserver.h"
-#include "fmsinterruptaob.h"
-#include "fmsclientserver.h"
-#include "FotaIPCTypes.h"
-
-
-// ----------------------------------------------------------------------------------------
-// static method StaticCheckNwRequestL() called to check n/w availability
-// ----------------------------------------------------------------------------------------
-static TInt StaticCheckNwRequestL(TAny* aPtr)
-	{
-	CFMSInterruptAob* ptr = (CFMSInterruptAob*) aPtr;
-	FLOG(_L("StaticCheckNwRequestL:-Begin"));	
-	TRAPD(err, ptr->NetworkRegistryCheckL() );	
-	FLOG(_L("StaticCheckNwRequestL:-end"));
-	return err;
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::CFMSInterruptAob()
-// -----------------------------------------------------------------------------
-CFMSInterruptAob::CFMSInterruptAob()
-:CActive(EPriorityStandard)
-	{
-	//CActiveScheduler::Add(this);
-	iConnStatus = KErrNone;
-	iWlanAvailable = EFalse;
-	iGPRSAvail = EFalse;
-	iWcdma = EFalse;
-	iUpdInterruptType = ENoUpdInterrupt;
-	iChargeToMonitor = 0;
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::ConstructL()
-// -----------------------------------------------------------------------------
-void CFMSInterruptAob::ConstructL()
-	{
-	CActiveScheduler::Add(this);	
-	User::LeaveIfError(iConnMon.ConnectL());
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::Start()
-// -----------------------------------------------------------------------------
-void CFMSInterruptAob::StartL(TOmaDLInterruptReason aType)
-	{	
-	FLOG(_L("CFMSInterruptAob::Start- begin"));
-	iInterruptType = aType;
-	if(iInterruptType == EUserInterrupt && iServer->ChargerTobeMonitered())
-		{
-		FLOG(_L("CFMSInterruptAob::Start--EUserInterrupt"));
-		if(!IsActive())
-			{
-			//RProperty pw;
-			iProperty.Attach(KPSUidHWRMPowerState,KHWRMChargingStatus);
-			iStatus=KRequestPending;
-			iProperty.Subscribe(iStatus);	
-			SetActive();	
-			}
-		}
-	else if(iInterruptType == ENetworkInterrupt && iServer->NetworkTobeMonitered())
-		{	  
-		FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt"));	
-		if(!IsActive())
-			{		  
-			iStatus=KRequestPending;			  
-			TBool phonenotoffline = CheckGlobalRFStateL();
-			if ( ( iBearer == EBearerIdGPRS || iBearer == EBearerIdWCDMA )
-					&& phonenotoffline )
-				{
-				FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt iBearer is %d"),iBearer);	
-				NotifyL();
-				return;			  
-				}
-			else if ( iBearer == EBearerIdWLAN )
-				{
-				//feature supported check
-				iWlanAvailable = EFalse;	  
-				iConnMon.GetBoolAttribute( EBearerIdWLAN, 
-						0, 
-						KBearerAvailability, 
-						iWlanAvailable, 
-						iStatus );
-				SetActive();
-				}
-			else
-				{
-				FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt--other then GPRS/ WLan bearer "));	  
-				//Stop the server	  
-				//Dont delete the file if interrupt is network + offline( to differentiate from hard reboot
-				iServer->DeleteFile(EFalse);
-				StopServer();
-				}	  
-			}
-		}
-	else if(iInterruptType == EMemoryInterrupt && iServer->MemoryTobeMonitered())
-		{
-		FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt on drive %d"),(TInt)iDrive );		  
-		if(!IsActive())
-			{
-			User::LeaveIfError(iFs.Connect());
-			TBool critical = EFalse;
-			TInt err = KErrNone;
-			err=IsPkgSizeMoreThanWL(critical);		  
-			if(critical)
-				{	 
-				FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--critical pkg dont fit on drive %d"),(TInt)iDrive );		  
-				iStatus=KRequestPending;					
-				iFs.NotifyDiskSpace( iSize, iDrive, iStatus ); 
-				FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt-setting as active") );		  
-				SetActive();	
-				}
-			else
-				{
-				if(err == KErrNone)
-					{
-					FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--critical pkg fits on drive %d"),(TInt)iDrive );
-					LaunchFotaEngineL();
-					}
-				else
-					{
-					FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--System error %d on memory drive %d"), err,(TInt)iDrive );
-					}
-				//Stop the server	 
-				StopServer();	   
-				}
-			}
-		}  
-	else //case where variation fails or by chance if a bad interrupt reason
-		{
-		StopServer();	  
-		}	 
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::RunL()
-// -----------------------------------------------------------------------------
-void CFMSInterruptAob::RunL()
-	{
-	FLOG(_L("CFMSInterruptAob::RunL()- begin"));
-	TInt value = 0;
-	if( EMonitorPhoneCallEnd == iUpdInterruptType)
-      {
-      FLOG(_L("RunL EPhoneCallActiveAsync--call status %d"),iCallStatus);
-      if(iStatus == KErrNone && RCall::EStatusIdle == iCallStatus )
-          {
-          //call fota scheduler & Stop the server          
-          LaunchFotaUpdate(iServer->PkgId(),iServer->ProfileId());
-          StopServer();
-          }
-      else //call in progress, subscribe again
-          {
-          FLOG(_L("call in progress, subscribing again"));
-          iLine.NotifyStatusChange(iStatus, iCallStatus);
-          SetActive();
-          }
-      }
-	else if( iUpdInterruptType == EMonitorbattery)
-	  {
-	  	 FLOG(_L("CFMSInterruptAob::RunL()- handling battery monitor"));
-	  	 iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel);
-		   TInt err=iProperty.Get(KPSUidHWRMPowerState,KHWRMBatteryLevel,value);
-		   if(err != KErrNone)
-		    { 
-		    	FLOG(_L("CFMSInterruptAob::RunL()- error  in getiing the battery level")); 
-		    	StopServer();
-		    }  
-		   if(value >= iChargeToMonitor)
-	    	{ iProperty.Cancel();
-			    iProperty.Close();	
-			  TRAPD(err, LaunchFotaScheduleUpdate());
-			  if(err)
-			  {
-			  	FLOG(_L("CFMSInterruptAob::RunL()- error in launch fota schedule"));
-			  }
-            iUpdInterruptType = ENoUpdInterrupt;
-            StopServer();
-			   
-		    }
-		
-	    	else 
-		   	{			
-		    	FLOG(_L("CFMSInterruptAob::RunL()--status charger not connected"));
-			   if(!IsActive())
-			  	{
-				  iStatus=KRequestPending;	
-				  iProperty.Subscribe(iStatus);
-				  FLOG(_L("CFMSInterruptAob::RunL()--waiting for charger Connectivity"));
-				  SetActive();
-				  }	
-	       }
-	  }     	
-  else if( iInterruptType == EUserInterrupt)
-		{
-		TInt value;	
-		//RProperty   pw;
-		iProperty.Attach(KPSUidHWRMPowerState,KHWRMChargingStatus);
-		iProperty.Get(KPSUidHWRMPowerState,KHWRMChargingStatus,value);
-		// charger connected or already charging going on
-		if( value == EChargingStatusCharging /*|| value == EChargingStatusChargingComplete ||
-				value == EChargingStatusAlmostComplete || value == EChargingStatusChargingContinued */)
-			{	
-			 	FLOG(_L("CFMSInterruptAob::RunL()--status charging"));
-			  HandleChargingInterruptL();			
-						
-			}
-		else 
-			{			
-			FLOG(_L("CFMSInterruptAob::RunL()--status charger not connected"));
-			if(!IsActive())
-				{
-				iStatus=KRequestPending;	
-				iProperty.Subscribe(iStatus);
-				FLOG(_L("CFMSInterruptAob::RunL()--waiting for charger Connectivity"));
-				SetActive();
-				}				
-			}
-		}
-	else if( iInterruptType == ENetworkInterrupt )
-		{
-		FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt" ));	
-		/*if( iBearer == EBearerIdGPRS || iBearer == EBearerIdWCDMA )
-			{
-			FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt:GPRS/WCDMA" ));
-			}*/
-		 if ( iBearer == EBearerIdWLAN )
-			{
-			TBuf<10> num;
-			FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt due to bearer id WLAN, iStatus %d"),iStatus.Int());	
-			/*if(iWlanAvailable)
-				FLOG(_L("iWlanAvailable :TRUE"));
-			else
-				FLOG(_L("iWlanAvailable :FALSE"));	*/				
-			if( iWlanAvailable && iStatus == KErrNone )
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--status WLAN networks found"));		
-				LaunchFotaEngineL();
-				StopServer();				
-				}
-			else if( iStatus == KErrNotSupported )//feture not supported
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--status WLAN feature not supported"));
-				StopServer();				
-				}
-			else 
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--status WLAN networks not found"));  			  
-				if(!IsActive())
-					{	
-					iWlanAvailable = EFalse;
-					iStatus=KRequestPending;	
-					iConnMon.GetBoolAttribute( EBearerIdWLAN, 
-							0, 
-							KBearerAvailability, 
-							iWlanAvailable, 
-							iStatus );
-					FLOG(_L("CFMSInterruptAob::RunL()--search for wlan availability"));
-					SetActive();
-					}		   
-				}	
-			}
-		}	
-	else if( iInterruptType == EMemoryInterrupt )
-		{
-		FLOG(_L("CFMSInterruptAob::RunL()--EMemoryInterrupt,iStatus %d"),iStatus.Int());			
-		if( iStatus == KErrNone  || iStatus == KErrCancel )
-			{
-			TBool critical = EFalse;
-			IsPkgSizeMoreThanWL(critical);
-			//if download size doesn't lead to memory less than critical level
-			if( !critical )	
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--Ok download not greater than critical level"));
-				//Check network status at this moment
-				
-				HandleAboveCriticallevelL();
-				
-				
-				}
-			else
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--Ok download greater than critical level"));
-				// space monitor for this		
-				if(!IsActive())
-					{
-					iStatus=KRequestPending;					
-					iFs.NotifyDiskSpace( iSize, iDrive, iStatus ); 
-					SetActive(); 	
-					}			
-				}
-			}			
-		else // for size request more than disk space
-			{
-			FLOG(_L("CFMSInterruptAob::RunL()--bad request size greater than the disk limit"));		
-			StopServer();			
-			}		
-		}
-	else //general
-		{
-		//Already ahandled in session class
-		}
-	FLOG(_L("CFMSInterruptAob::RunL()- End"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::DoCancel() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::DoCancel()
-	{
-	FLOG(_L("CFMSInterruptAob::::DoCancel()"));
-	if( iStatus == KRequestPending )
-		{
-		FLOG(_L("CFMSInterruptAob::::DoCancel()--request pending"));
-		TRequestStatus* status = &iStatus;
-		User::RequestComplete( status, KErrCancel );
-		}
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::MemoryToMonitorL() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::MemoryToMonitorL(TInt aSize, TDriveNumber aDrive)
-	{
-	FLOG(_L("CFMSInterruptAob::::MemoryToMonitorL()--Begin"));
-	if( aSize < 0 || (aDrive < EDriveA && aDrive > EDriveZ) )
-		{
-		FLOG(_L("CFMSInterruptAob::::MemoryToMonitorL()--Leving with KErrArgumnet"));
-		User::Leave(KErrArgument);
-		}
-	iDrive = aDrive;
-	iSize = aSize;
-	CheckMemSizeL();				
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::NetworkTypeL() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::NetworkTypeL(TInt aBearer)
-	{	
-	if( aBearer == EBearerIdGPRS || aBearer == EBearerIdWLAN
-									|| aBearer == EBearerIdWCDMA )
-		{
-		iBearer = aBearer;		
-		}
-	else
-		{
-		FLOG(_L("CFMSInterruptAob::::NetworkTypeL()--leaving with KErrArgument"));
-		User::Leave(KErrArgument);
-		}
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::IsPkgSizeMoreThanWL() 
-// ----------------------------------------------------------------------------------------
-TInt CFMSInterruptAob::IsPkgSizeMoreThanWL(TBool& aCritical)
-	{
-	FLOG(_L("CFMSInterruptAob::::IsPkgSizeMoreThanWL()--Begin"));
-	TInt err = KErrNone;	
-	//Already checked the drive is proper or not
-	//here the check happened for warning level
-	TRAP(err,aCritical = SysUtil::DiskSpaceBelowCriticalLevelL ( &iFs, iSize, iDrive ));
-	FLOG(_L("CFMSInterruptAob::::IsPkgSizeMoreThanWL() end %d"),err);
-	return err;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::CheckNetworkL() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSInterruptAob::CheckNetworkL()
-	{	
-	FLOG(_L("CFMSInterruptAob::CheckNetworkL--begin"));
-	TRequestStatus status=KRequestPending;	
-	iConnStatus = KErrNone; 	  
-	TBool phonenotoffline = CheckGlobalRFStateL();	  
-	if ( phonenotoffline && iBearer == EBearerIdGPRS )
-		{
-		TRequestStatus gsmstatus = KRequestPending;	
-		iConnStatus = KErrNotFound;		
-		FLOG(_L("CFMSInterruptAob::CheckNetworkL--check GSM registry"));	
-		iConnMon.GetIntAttribute( EBearerIdGSM, 0,KNetworkRegistration, iConnStatus, gsmstatus );
-		User::WaitForRequest(gsmstatus);
-		FLOG(_L("iConnStatus is %d gsmstatus is %d"),iConnStatus,gsmstatus.Int());
-		if( iConnStatus == ENetworkRegistrationHomeNetwork || 
-				iConnStatus == ENetworkRegistrationRoaming ) 
-			{
-			FLOG(_L("CFMSInterruptAob::CheckNetworkL--GSM available"));
-			FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking GPRS"));
-			iConnMon.GetBoolAttribute( EBearerIdGPRS, 0,KPacketDataAvailability,
-					iGPRSAvail, status );
-			User::WaitForRequest(status);
-			if( iGPRSAvail && status.Int()==KErrNone )
-				{
-				FLOG(_L("CFMSInterruptAob::CheckNetworkL--GPRS available"));
-				return ETrue;
-				}
-			}
-		}
-	else if ( phonenotoffline && iBearer == EBearerIdWCDMA )
-		{
-		TRequestStatus gsmstatus = KRequestPending;	
-		iConnStatus = KErrNotFound;		
-		FLOG(_L("CFMSInterruptAob::CheckNetworkL--check WCDMA sim registry"));	
-		iConnMon.GetIntAttribute( EBearerIdWCDMA, 0,KNetworkRegistration, iConnStatus, gsmstatus );
-		User::WaitForRequest(gsmstatus);
-		FLOG(_L("iConnStatus is %d WCDMA gsmstatus is %d"),iConnStatus,gsmstatus.Int());
-		if( iConnStatus == ENetworkRegistrationHomeNetwork || 
-				iConnStatus == ENetworkRegistrationRoaming ) 
-			{
-			FLOG(_L("CFMSInterruptAob::CheckNetworkL--WCDMA GSM available"));
-			FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking WCDMA GPRS"));
-			iConnMon.GetBoolAttribute( EBearerIdWCDMA, 0,KPacketDataAvailability,
-					iGPRSAvail, status );
-			User::WaitForRequest(status);
-			if( iGPRSAvail && status.Int()==KErrNone )
-				{
-				FLOG(_L("CFMSInterruptAob::CheckNetworkL--WCDMA GPRS available"));
-				return ETrue;
-				}
-			}
-		}
-	else if ( iBearer == EBearerIdWLAN )
-		{
-		FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking WLAN"));	  
-		iWlanAvailable = EFalse;	  
-		iConnMon.GetBoolAttribute( EBearerIdWLAN, 
-				0, 
-				KBearerAvailability, 
-				iWlanAvailable, 
-				status );	
-		User::WaitForRequest(status);//Synchronous call
-		if( iWlanAvailable && status == KErrNone )
-			{
-			FLOG(_L("CFMSInterruptAob::CheckNetworkL--wlan available"));
-			return ETrue;
-			}
-		}
-	else //phone is offline
-		{
-		FLOG(_L("CFMSInterruptAob::CheckNetworkL--phone is offline or invalid bearer"));
-		}
-	FLOG(_L("CFMSInterruptAob::CheckNetworkL--end"));
-	return EFalse;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::CheckGlobalRFStateL() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSInterruptAob::CheckGlobalRFStateL()
-	{		
-	TInt val = KErrNone;
-	TInt err = KErrNone;
-	TInt status = EFalse;
-	err = RProperty::Get(KPSUidStartup, KPSGlobalSystemState, val);
-	if ( err == KErrNone && val == ESwStateNormalRfOn )
-		{
-		//Phone is not offline. Check for Network Registration status
-		FLOG(_L("Phone is online. Check for Network Registration status"));		
-		status = ETrue;
-		}
-	else
-		{
-		//Phone is offline. No Network activities allowed.
-		FLOG(_L("Phone is offline. No Network activities allowed."));		
-		status = EFalse;
-		}
-	FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState, status = %d <<"),status);	
-	return status;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::StopServer() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::StopServer()
-	{
-	FLOG(_L("CFMSInterruptAob::StopServer begin"));	
-	iServer->iSessionCount = 0;
-	CActiveScheduler::Stop();//---for stopping the server
-	FLOG(_L("CFMSInterruptAob::StopServer:server stopped"));	
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::LaunchFotaEngineL() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::LaunchFotaEngineL()
-	{
-	FLOG(_L("CFMSInterruptAob::LaunchFotaEngineL call to iFotaEngine.OpenL() "));
-	TInt err = KErrNone;
-	TRAP(err,iFotaEngine.OpenL());
-	FLOG(_L("iFotaEngine.OpenL() launched withe error as %d"),err);
-	if(err == KErrNone)
-		{
-		err = iFotaEngine.TryResumeDownload();
-		FLOG(_L("iFotaEngine.TryResumeDownload() returns %d"),err);
-		iFotaEngine.Close();
-		FLOG(_L("CFMSInterruptAob::LaunchFotaEngineL END - fotaengine closed "));
-		}
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::CheckMemSizeL() 
-// ----------------------------------------------------------------------------------------
-void CFMSInterruptAob::CheckMemSizeL(/*TInt& aMemoryNeeded*/)
-	{
-	FLOG(_L("CFMSInterruptAob::CheckMemSizeL-begin"));
-	iSize = iSize + KDRIVECWARNINGTHRESHOLD; //irrespective of Drive
-	FLOG(_L(" neededspace = sizeNeededFromFS + KDRIVECWARNINGTHRESHOLD: %d"), iSize);
-	FLOG(_L("CFMSInterruptAob::CheckMemSizeL-end"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSInterruptAob::~CFMSInterruptAob() 
-// ----------------------------------------------------------------------------------------
-CFMSInterruptAob::~CFMSInterruptAob()
-	{ 
-	FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()"));  	
-	if(iPeriodicNwCheck)
-		{
-		FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--deleting iPeriodicNwCheck"));
-		delete iPeriodicNwCheck;
-		iPeriodicNwCheck = NULL;
-		}
-	StopNotify();
-	Cancel();
-	iConnMon.Close();
-	if(iProperty.Handle())
-		{    	
-		iProperty.Close();
-		FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--iProperty closed")); 
-		}
-	
-	if(iInterruptType == EMemoryInterrupt)
-		{
-		iFs.NotifyDiskSpaceCancel();
-		}
-	iFs.Close();	
-	if(iLine.SubSessionHandle())
-	    {
-	    iLine.Close();
-	    }
-	if(iPhone.SubSessionHandle())
-	    {
-	    iPhone.Close();
-	    }
-	if(iTelServer.Handle())
-	    {
-	    iTelServer.Close();
-	    }
-	FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--End"));  
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFMSInterruptAob::RunError
-// ---------------------------------------------------------------------------
-//
-TInt CFMSInterruptAob::RunError( TInt aError )
-	{
-	FLOG( _L("CAOConnectionImpl::RunError: aError: %d"), aError );        
-	return aError;
-	}
-
-
-//
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::NotifyL()
-// Registers with connection monitor for notification
-// -----------------------------------------------------------------------------
-//
-void CFMSInterruptAob::NotifyL()
-	{
-	FLOG(_L("CFMSInterruptAob::NotifyL Begin  "));
-	iConnMon.NotifyEventL( *this );
-	FLOG(_L("CFMSInterruptAob::NotifyL, after registering  "));
-	// Threholds
-	TInt    err = iConnMon.SetUintAttribute( iBearer, 
-			0, 
-			KBearerAvailabilityThreshold, 
-			1 );    
-	FLOG(_L("CFMSInterruptAob::NotifyL : END "));
-
-	}
-
-
-// -----------------------------------------------------------------------------
-// CFMSInterruptAob::StopNotify()
-// Cancels notification with connection monitor
-// -----------------------------------------------------------------------------
-//
-void CFMSInterruptAob::StopNotify()
-	{
-	FLOG(_L("CFMSInterruptAob::StopNotify Begin  "));
-	iConnMon.CancelNotifications();
-	FLOG(_L("CFMSInterruptAob::StopNotify end "));
-	}	
-
-// -----------------------------------------------------------------------------
-// CNsmlNetworkStatusEngine::EventL()
-// Method involed by connection monitor with current event. 
-// This method handles the events
-// -----------------------------------------------------------------------------
-//
-void CFMSInterruptAob::EventL( const CConnMonEventBase& aConnMonEvent )
-	{
-	FLOG(_L("CFMSInterruptAob::EventL, BEGIN"));
-	FLOG(_L("CFMSInterruptAob::EventL event is ==  %d"), aConnMonEvent.EventType()  );
-	switch ( aConnMonEvent.EventType() )
-	{
-	case EConnMonNetworkStatusChange:
-		{
-		CConnMonBearerAvailabilityChange* eventBearerAvailabilityChange;
-		eventBearerAvailabilityChange = ( CConnMonBearerAvailabilityChange* ) &aConnMonEvent;
-
-		if ( eventBearerAvailabilityChange->ConnectionId() == iBearer )
-			{
-			if ( eventBearerAvailabilityChange->Availability() )
-				{
-				// Available            				
-				if(CheckNetworkL())
-					{
-					FLOG(_L("CFMSInterruptAob::EventL()--status GPRS up"));
-					LaunchFotaEngineL();
-					StopServer();	
-					}
-				else 
-					{
-					FLOG(_L("CFMSInterruptAob::EventL()--status GPRS not up-- but connmon triggererd"));
-					NotifyL();
-					}         				
-				} 
-			else
-				{
-				//check the phone status
-				// Not available            
-				FLOG(_L("CFMSInterruptAob::EventL()--search for GPRS connection not up"));	    			
-				NotifyL();	    	
-				}
-			}
-		break;
-		}
-	case EConnMonPacketDataAvailable:
-		{
-		CConnMonPacketDataAvailable* eventAvailable;
-		eventAvailable = ( CConnMonPacketDataAvailable* ) &aConnMonEvent;
-
-		if ( eventAvailable->ConnectionId() == iBearer )
-			{
-			// Available            				
-			if(CheckNetworkL())
-				{
-				FLOG(_L("CFMSInterruptAob::EventL()--status GPRS up"));
-				LaunchFotaEngineL();
-				StopServer();	
-				}
-			else 
-				{
-				FLOG(_L("CFMSInterruptAob::EventL()--status GPRS not up-- but connmon triggererd"));
-				NotifyL();
-				}         				
-			} 
-		else
-			{
-			//check the phone status
-			// Not available            
-			FLOG(_L("CFMSInterruptAob::EventL()--search for GPRS connection not up"));	    			
-			NotifyL();	    	
-			}
-		break;
-		}
-	default:
-	break;
-	}
-	}
-
-//------------------------------------------------------------
-// CFMSInterruptAob::SetWcdma
-//------------------------------------------------------------
-void CFMSInterruptAob::SetWcdma()
-	{
-	iWcdma = ETrue;
-	}
-
-//------------------------------------------------------------
-// CFMSInterruptAob::CheckNetworkRegistryL
-//------------------------------------------------------------
-void CFMSInterruptAob::StartNetworkRegistryCheckL()
-	{
-	FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL- begin"));	
-	iPeriodicNwCheck = CPeriodic::NewL (EPriorityNormal) ;
-	FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL:-iPeriodicNwCheck created)"));
-	iPeriodicNwCheck->Start(
-			TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*20)
-			, TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*25)
-			, TCallBack(StaticCheckNwRequestL,this) ) ;
-	FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL- End"));
-	}
-
-//------------------------------------------------------------
-// CFMSInterruptAob::StopNetworkRegistryCheckL
-//------------------------------------------------------------
-void CFMSInterruptAob::NetworkRegistryCheckL()
-	{
-	FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL- begin"));	
-	if(CheckNetworkL())
-		{
-		FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL-n/w found"));
-		if(iPeriodicNwCheck)
-			{
-			delete iPeriodicNwCheck;
-			iPeriodicNwCheck = NULL;
-			FLOG(_L("CFMSInterruptAob::iPeriodicNwCheck-deleted"));
-			}
-		LaunchFotaEngineL();
-		StopServer();
-		}	
-	FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL- End"));
-	}
-
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::StartBatteryMonitoringL
-// Starts the monitoring of Battery
-//----------------------------------------------------------------------------
-void CFMSInterruptAob::StartBatteryMonitoringL(TOmaUpdInterruptReason aType, TUint aLevel)
-	{	
-	FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- begin"));
-	
-	__ASSERT_ALWAYS(aLevel > EBatteryLevelLevel0 && aLevel <=EBatteryLevelLevel7, User::Leave(KErrArgument));
-	
-	iUpdInterruptType = aType;
-if(iUpdInterruptType == EMonitorbattery)
-	{
-		FLOG(_L("CFMSInterruptAob::Start- EMonitorbattery"));
-		TInt value =0;
-		iChargeToMonitor = aLevel;
-		iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel);
-		TInt err=iProperty.Get(KPSUidHWRMPowerState,KHWRMBatteryLevel,value);
-		   if(err != KErrNone)
-		    { 
-		    	FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- error  in getiing the battery level")); 
-		    	StopServer();
-		    }  
-		if(value >= iChargeToMonitor)
-		{  
-			  iProperty.Cancel();
-			  iProperty.Close();	
-			TRAPD(err1, LaunchFotaScheduleUpdate());
-			if (err1)
-			{
-				FLOG(_L("CFMSInterruptAob::error in LaunchFotaScheduleUpdateL()"));
-		  }
-		  
-		  StopServer();
-	  }
-	 else
-	 { 	  
-		if(!IsActive())
-			{
-			//RProperty pw;
-			FLOG(_L("CFMSInterruptAob::Start- attaching for battery"));
-			
-			iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel);
-			iStatus=KRequestPending;
-			iProperty.Subscribe(iStatus);	
-			SetActive();	
-			}
-		}	
-	}
-	FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- end"));
-}	 
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::LaunchFotaScheduleUpdate
-// Launches the FOTA schedule dialog
-//----------------------------------------------------------------------------
-
-void CFMSInterruptAob::LaunchFotaScheduleUpdate()
-{
-	RFotaEngineSession fotaengine;
-	TRAPD(error,fotaengine.OpenL());
-	if(error == KErrNone)
-	  {
-		  	
-		  	
-	    FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- going for update again"));
-	    TFotaScheduledUpdate           sched(-1,-1);   //trigger the Fota remainder dialog here..
-        TPckg<TFotaScheduledUpdate>    p(sched);
-        TRAPD(err, fotaengine.ScheduledUpdateL(sched));
-        if(err)
-         {
-             	  FLOG( _L( "[LaunchFotaScheduleUpdate()] FirmwareUpdate scheduling failed   " ) );              	
-         }
-        FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- closing fota engine"));
-        iUpdInterruptType = ENoUpdInterrupt;
-        fotaengine.Close();	
-	   }
-	 else
-	  {
-		FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- error in opening the fota engine"));
-		  	
-	  }
-}
-
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::CheckNetworkStatusL
-// Checks the network status
-//----------------------------------------------------------------------------
-void CFMSInterruptAob::CheckNetworkStatusL()
-{
-      if(CheckNetworkL()) 
-					{
-					FLOG(_L("CFMSInterruptAob::RunL()--charging & network found"));				
-					LaunchFotaEngineL();
-					StopServer();
-					}
-				else 
-					{				
-					FLOG(_L("CFMSInterruptAob::RunL()--charging but no network found & started monitoring"));
-					//StartNetWorkMonitoring
-					iServer->WriteToFile(ENetworkInterrupt, iBearer, EDriveC, 0, iWcdma);
-					StartL(ENetworkInterrupt);	  
-					}
-}		
-
-
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::HandleChargingInterruptL
-// Handle the cherging interrupt
-//----------------------------------------------------------------------------
-void CFMSInterruptAob::HandleChargingInterruptL()
-{
-	    iProperty.Cancel();
-			iProperty.Close();		
-			//check variation
-			if(iServer->NetworkTobeMonitered())
-				{			
-				//Check network status at this moment	
-			  	CheckNetworkStatusL();
-			
-				}
-			else
-				{
-				FLOG(_L("CFMSInterruptAob::RunL()--charging & network found"));				
-				LaunchFotaEngineL();
-				StopServer();				
-				}
-}		
-
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::HandleAboveCriticallevelL
-// Handle the meory above critical level
-//----------------------------------------------------------------------------
-void CFMSInterruptAob::HandleAboveCriticallevelL()
-{
-        if(iServer->NetworkTobeMonitered())
-					{
-					if(CheckNetworkL())
-						{	
-						FLOG(_L("CFMSInterruptAob::RunL()--memory avail & network found"));
-						//Notify fota server
-						LaunchFotaEngineL();
-						StopServer();			   
-						}
-					else
-						{
-						FLOG(_L("CFMSInterruptAob::RunL()--memory avail but no network found"));
-						//StartNetWorkMonitoring
-						iServer->WriteToFile(ENetworkInterrupt, iBearer, iDrive, 0, iWcdma);
-						StartL(ENetworkInterrupt);
-						}
-					}
-				else
-					{
-					FLOG(_L("CFMSInterruptAob::RunL()--memory avail & no network monitor "));
-					//Notify fota server
-					LaunchFotaEngineL();
-					StopServer();				
-					}
-}										
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::LaunchFotaUpdate
-// Launches the FOTA update dialog
-//----------------------------------------------------------------------------
-
-void CFMSInterruptAob::LaunchFotaUpdate(TInt& aPkgId, TInt& aProfileId)
-    {
-    RFotaEngineSession fotaengine;
-    TRAPD(error,fotaengine.OpenL());
-    if(error == KErrNone)
-        {
-        FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- going for update pkgid:%d,profile:%d "),aPkgId,aProfileId);
-        TInt err=fotaengine.Update( aPkgId, aProfileId, KNullDesC8, KNullDesC8 );
-        if(err)
-            {
-            FLOG( _L( "LaunchFotaUpdate() failed   " ) );              	
-            }
-        FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- closing fota engine"));
-        iUpdInterruptType = ENoUpdInterrupt;
-        fotaengine.Close();	
-        }
-    else
-        {
-        FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- error in opening the fota engine"));
-        }
-    }
-
-
-
-//----------------------------------------------------------------------------
-// CFMSInterruptAob::StartCallEndMonitoringL
-// starts monitoring for call end 
-//----------------------------------------------------------------------------
-void CFMSInterruptAob::StartCallEndMonitoringL(TOmaUpdInterruptReason aType)
-    {    
-    if(!IsActive())
-        {
-        FLOG(_L("Starting Call End Monitoring:Begin"));
-        iUpdInterruptType = aType;        
-        User::LeaveIfError(iTelServer.Connect());
-        _LIT(KTsyName, "phonetsy.tsy");//TSY module names wouldn't change 
-        RTelServer::TPhoneInfo info;
-        RPhone::TLineInfo lineInfo;        
-        User::LeaveIfError(iTelServer.LoadPhoneModule(KTsyName));
-        // Get the details for the first (and only) phone.
-        User::LeaveIfError(iTelServer.GetPhoneInfo(0, info));
-        // Open the phone.
-        User::LeaveIfError(iPhone.Open(iTelServer, info.iName));
-        iPhone.Initialise();
-        TInt numberLines = 0;
-        User::LeaveIfError(iPhone.EnumerateLines(numberLines));
-        TBool foundLine = EFalse;
-        for (TInt a = 0; a < numberLines; a++)
-            {
-            User::LeaveIfError(iPhone.GetLineInfo(a, lineInfo));
-            if (lineInfo.iLineCapsFlags & RLine::KCapsVoice)
-                {
-                foundLine = ETrue;
-                break;
-                }
-            }
-        if (!foundLine)
-            {
-            User::Leave(KErrNotFound);
-            }
-        User::LeaveIfError(iLine.Open(iPhone, lineInfo.iName));
-        iCallStatus = RCall::EStatusIdle;
-        iLine.NotifyStatusChange(iStatus, iCallStatus);
-        SetActive();
-        }
-    FLOG(_L("Starting Call End Monitoring: end"));
-    }
-//End of File
--- a/fotaapplication/fotaserver/fmserver/src/fmsserver.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,723 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <systemwarninglevels.hrh>
-#include <e32property.h>
-#include <bldvariant.hrh>
-#include <startupdomainpskeys.h>
-#include <hwrmpowerstatesdkpskeys.h>
-#include <f32file.h>
-#include <sysutil.h> 
-#include <centralrepository.h>
-#include <ctsydomainpskeys.h>
-#include "fotaserverPrivateCRKeys.h"
-#include "fmsserver.h"
-#include "fmsinterruptaob.h"
-#include "fmsclientserver.h"
-#include "fmsserversession.h"
-
-
-// ----------------------------------------------------------------------------------------
-// Server startup code
-// ----------------------------------------------------------------------------------------
-static void RunServerL()
-	{
-	// naming the server thread after the server helps to debug panics
-	User::LeaveIfError(User::RenameThread(KFMSServerName)); 
-
-	// create and install the active scheduler
-	CActiveScheduler* s=new(ELeave) CActiveScheduler;
-	CleanupStack::PushL(s);
-	CActiveScheduler::Install(s);
-
-	// create the server (leave it on the cleanup stack)
-	CFMSServer::NewLC();
-
-	// Initialisation complete, now signal the client
-	RProcess::Rendezvous(KErrNone);
-
-	// Ready to run
-	CActiveScheduler::Start();
-
-	// Cleanup the server and scheduler
-	CleanupStack::PopAndDestroy(2);
-	}
-
-
-// ----------------------------------------------------------------------------------------
-// static method LogNwRequestL() called to submit async n/w request
-// ----------------------------------------------------------------------------------------
-static TInt LogNwRequestL(TAny* aPtr)
-	{
-	CFMSServer* ptr = (CFMSServer*) aPtr;
-	FLOG(_L("static LogNwRequestL:-Begin"));
-	TRAPD(err, ptr->StartMonitoringL(ENetworkInterrupt));
-	FLOG(_L("LogNwRequestL started monitoring"));
-	ptr->StopAsyncRequest();
-	FLOG(_L("static LogNwRequestL:-end"));
-	return err;
-	}
-
-
-// ----------------------------------------------------------------------------------------
-// static method LogCallEndMonitorRequestL() called to submit async call end monitor request
-// ----------------------------------------------------------------------------------------
-static TInt LogCallEndMonitorRequestL(TAny* aPtr)
-    {
-    CFMSServer* ptr = (CFMSServer*) aPtr;
-    FLOG(_L("static LogCallEndMonitorRequestL:-Begin"));
-    TRAPD(err, ptr->StartUpdateInterruptMonitoringL(EMonitorPhoneCallEnd));
-    FLOG(_L("LogCallEndMonitorRequestL started monitoring"));
-    ptr->StopAsyncRequest();
-    FLOG(_L("static LogCallEndMonitorRequestL:-end"));
-	return err;
-	}
-
-// ----------------------------------------------------------------------------------------
-// Server process entry-point
-// ----------------------------------------------------------------------------------------
-TInt E32Main()
-	{
-	__UHEAP_MARK;
-	CTrapCleanup* cleanup=CTrapCleanup::New();
-	TInt r=KErrNoMemory;
-	if (cleanup)
-		{
-		TRAP(r,RunServerL());
-		delete cleanup;
-		}
-	__UHEAP_MARKEND;
-	return r;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::NewLC
-// ----------------------------------------------------------------------------------------
-CServer2* CFMSServer::NewLC()
-{
-CFMSServer* self=new(ELeave) CFMSServer;
-CleanupStack::PushL(self);
-self->ConstructL();	
-return self;
-}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::ConstructL
-// ----------------------------------------------------------------------------------------
-void CFMSServer::ConstructL()
-	{
-	FLOG(_L("CFMSServer::ConstructL- begin"));
-	StartL(KFMSServerName);		
-	User::LeaveIfError( iFs.Connect() );
-	TInt err;
-	err = iFs.CreatePrivatePath(EDriveC);
-	if ( err != KErrNone && err != KErrAlreadyExists )
-		{ User::Leave (err); }
-	User::LeaveIfError( iFs.SetSessionToPrivate( EDriveC ) );
-	err = iFile.Create(iFs,KFotaInterruptFileName,EFileWrite);
-	if(err == KErrNone)//means file created now and opened
-		{
-		FLOG(_L("CFMSServer::ConstructL- file closed"));
-		iFile.Close();
-		}
-	else if( err != KErrAlreadyExists )
-		{
-		FLOG(_L("CFMSServer::ConstructL- leaving with err as %d"),err);
-		User::Leave(err);
-		}
-	FindVariation();
-	iFMSInterruptAob.ConstructL();
-	iFMSInterruptAob.iServer = this;  
-	FLOG(_L("CFMSServer::ConstructL- end"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::CFMSServer() 
-// ----------------------------------------------------------------------------------------
-CFMSServer::CFMSServer() :CServer2(EPriorityStandard, EUnsharableSessions) /*CServer2(0)*/
-	{	
-	iSessionCount = 0;
-	//iNetworkMon = ETrue; //Incase of cenrep key has problem
-	iNetworkMon = EFalse; 
-	iChargerMon = EFalse;
-	iPhoneRestartMon = EFalse;
-	iMemoryMon = EFalse;
-	iDeleteFile = ETrue;
-	iLogAsyncRequest = NULL;
-	iProfileId = EFalse;
-	iPkgId = EFalse;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::MemoryToMonitorL() 
-// ----------------------------------------------------------------------------------------
-void CFMSServer::MemoryToMonitorL(TInt aSize, TDriveNumber aDrive)
-	{
-	if( iSessionCount == 0 )// no pending request
-		{
-		iFMSInterruptAob.MemoryToMonitorL(aSize,aDrive);
-		}
-	}
-// ----------------------------------------------------------------------------------------
-// CFMSServer::NetworkTypeL() 
-// ----------------------------------------------------------------------------------------
-void CFMSServer::NetworkTypeL(TInt aBearer)
-	{
-	if( iSessionCount == 0 )// no pending request
-		{
-		iFMSInterruptAob.NetworkTypeL(aBearer);
-		}
-	}
-
-//------------------------------------------------------------
-// Call from session class in fotastartup  case 
-// CFMSServer::CheckNetworkL
-//------------------------------------------------------------
-void CFMSServer::CheckNetworkL(TInt& aBearerId, TInt& aDrive, TInt& aSize,
-		TBool& aWcdma)
-	{
-	if(iNetworkMon)//n/w monitoring supports
-		{
-		FLOG(_L("CFMSServer::CheckNetworkL- n/w monitor supported"));
-		if(iFMSInterruptAob.CheckNetworkL()) //not n/w interrupt + WLAN or GPRS
-			{
-			FLOG(_L("CFMSServer::CheckNetworkL- n/w mon supported & launch fota"));
-			iFMSInterruptAob.LaunchFotaEngineL();		
-			DropSession(); // to close the session & server
-			return;
-			}			
-		else //if network not up, monitor for that
-			{
-			//from session itself we set the bearer type
-			FLOG(_L("CFMSServer::CheckNetworkL- n/w not up beaerer 3G %d"),aWcdma);
-			WriteToFile(ENetworkInterrupt,aBearerId,
-					(TDriveNumber)aDrive, aSize, aWcdma );
-			StartMonitoringL(ENetworkInterrupt);
-			}
-		}
-	else //user interrupt or general interrupt dont check n/w call fota
-		{
-		FLOG(_L("CFMSServer::CheckNetworkL- n/w monitor not supported & launch fota"));		
-		iFMSInterruptAob.LaunchFotaEngineL();
-		FLOG(_L("CFMSServer::CheckNetworkL- stop server"));		
-		DropSession();
-		}
-	}
-
-//------------------------------------------------------------
-// Call from session class in hard reboot only 
-// CFMSServer::TriggerFotaL
-//------------------------------------------------------------
-void CFMSServer::TriggerFotaL()
-	{
-	FLOG(_L("CFMSServer::TriggerFotaL- begin"));	
-	if(iNetworkMon)//n/w monitoring supports
-		{
-		FLOG(_L("CFMSServer::TriggerFotaL- n/w monitor supported"));
-		if(iFMSInterruptAob.CheckNetworkL()) 
-			{
-			FLOG(_L("CFMSServer::TriggerFotaL- n/w mon supported & launch fota"));
-			iFMSInterruptAob.LaunchFotaEngineL();				
-			}
-		else if(iFMSInterruptAob.CheckGlobalRFStateL())
-			{
-			FLOG(_L("CFMSServer::TriggerFotaL- n/w check started"));
-			iFMSInterruptAob.StartNetworkRegistryCheckL();
-			return; //dont call drop session as it closes server
-			}
-		else
-			{
-			FLOG(_L("CFMSServer::TriggerFotaL- phone is offline"));			
-			}
-		}
-	else //user interrupt or general interrupt dont check n/w call fota
-		{
-		FLOG(_L("CFMSServer::TriggerFotaL- n/w monitor not supported & launch fota"));		
-		iFMSInterruptAob.LaunchFotaEngineL();		
-		FLOG(_L("CFMSServer::TriggerFotaL- stop server"));			
-		}
-	DropSession(); // to close the session & server in any case
-	FLOG(_L("CFMSServer::TriggerFotaL- End"));
-	}
-
-//------------------------------------------------------------
-// Called only in n/w interrupt+ WLAN case from session class
-// CFMSServer::CheckWlanL
-//------------------------------------------------------------
-TBool CFMSServer::CheckWlanL()
-	{
-	return iFMSInterruptAob.CheckNetworkL();
-	}
-
-//------------------------------------------------------------
-// CFMSServer::SetWcdma
-//------------------------------------------------------------
-void CFMSServer::SetWcdma()
-	{
-	iFMSInterruptAob.SetWcdma();
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::LockSession() 
-// ----------------------------------------------------------------------------------------
-void CFMSServer::LockSession()
-	{
-	iSessionCount++;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::WriteToFile() 
-// ----------------------------------------------------------------------------------------
-void CFMSServer::WriteToFile(TInt aReason, TInt aBearer,TDriveNumber aDrive,
-		TInt aSize, TBool aWcdmaBearer )
-	{
-	if(iSessionCount == 0)
-		{
-		FLOG(_L("CFMSServer::WriteToFile- begin"));
-		TInt err=iFile.Open(iFs,KFotaInterruptFileName,EFileWrite);
-		if(err == KErrNone)
-			{
-			FLOG(_L("CFMSServer::WriteToFile--passed"));
-			TBuf8<30> data;//size 30 or 32--as args is 16 bytes
-			TBuf8<30> temp;
-			temp.Num(aReason);
-			data.Append(temp);
-			data.Append(',');
-			temp.Num(aBearer);// or use iFMSinterruptAob's iBearer
-			data.Append(temp);
-			data.Append(',');
-			temp.Num((TInt)aDrive);
-			data.Append(temp);
-			data.Append(',');
-			temp.Num(aSize);  
-			data.Append(temp);
-			data.Append(',');
-			temp.Num(aWcdmaBearer);
-			data.Append(temp);
-			iFile.Write(data);
-			iFile.Close();
-			}
-		else
-			FLOG(_L("CFMSServer::WriteToFile- Failed"));
-		}
-	else
-		FLOG(_L("CFMSServer::WriteToFile- not done as another request is there"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::ReadFromFile() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize
-		, TInt& aWcdmaBearer )
-	{
-	TInt err = iFile.Open(iFs,KFotaInterruptFileName,EFileRead);
-	FLOG(_L("CFMSServer::ReadFromFile() error as %d"),err);
-	if(err == KErrNone)
-		{
-		TInt size = KErrNone;
-		err = iFile.Size(size);	
-		if(size == 0) //file empty
-			{
-			FLOG(_L("CFMSServer::ReadFromFile() file size is empty"));
-			iFile.Close();
-			return EFalse;		
-			}
-		TBuf8<30> data;
-		iFile.Read(data);
-		iFile.Close();	
-		TBuf8<30> data1;    
-		if(data.Length()>0)
-			{
-			TInt len =0 ;
-			if((len=data.LocateF(',')) > 0)
-				{
-				TLex8 value( data.Left(len));            
-				value.Val(aReason);
-				FLOG(_L("CFMSServer::ReadFromFile() retrieving reason as %d"),aReason);
-				data1.Insert(0,data.Right(data.Length()-(len+1)));
-				data.Zero();
-				//    len=data1.LocateF(',');
-				if( data1.Length() > 0 && (len=data1.LocateF(',')) > 0)
-					{
-					value=data1.Left(len);            
-					value.Val(aBearer);  
-					FLOG(_L("CFMSServer::ReadFromFile() retrieving aBearer as %d"),aBearer);
-					data.Insert(0,data1.Right(data1.Length()-(len+1)));            
-					data1.Zero();
-					//  len=data.LocateF(','); 
-					if(data.Length() > 0 && (  len=data.LocateF(','))> 0)
-						{
-						value=data.Left(len);            
-						value.Val(aDrive);
-						FLOG(_L("CFMSServer::ReadFromFile() retrieving aDrive as %d"),aDrive);
-						data1.Insert(0,data.Right(data.Length()-(len+1)));
-						data.Zero();
-						if(data1.Length() > 0 && (  len=data1.LocateF(','))> 0 )
-							{
-							value=data1.Left(len);
-							value.Val(aSize);
-							FLOG(_L("CFMSServer::ReadFromFile() retrieving aSize as %d"),aSize);
-							data.Insert(0,data1.Right(data1.Length()-len-1));
-							data1.Zero();
-							if(data.Length() > 0 )
-								{
-								value=data;  
-								value.Val(aWcdmaBearer);
-								FLOG(_L("CFMSServer::ReadFromFile() retrieving aWcdmaBearer as %d"),aWcdmaBearer);
-								}
-							}
-						} 
-					}
-				}    
-			}
-		}
-	else
-		{
-		return EFalse;
-		}
-	return ETrue;
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::DropSession()
-// -----------------------------------------------------------------------------
-
-void CFMSServer::DropSession()
-	{
-	// A session is being destroyed	
-	iSessionCount = 0;	
-	//Kill the server
-	CActiveScheduler::Stop();	
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::FindVariation() 
-// ----------------------------------------------------------------------------------------
-void CFMSServer::FindVariation()
-	{
-	FLOG(_L("CFMSServer::FindVariation()"));
-	CRepository* centrep = NULL;
-	TInt variation = 1;
-	TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-	if ( centrep )
-		{
-		FLOG(_L("CFMSServer::FindVariation()::Inside cenrep if"));
-		TInt err = centrep->Get( KFotaMonitoryServiceEnabled, variation );                 
-		if( err == KErrNone)
-			{ 
-			FLOG(_L("CFMSServer::FindVariation()::cenrep key found with %d"),variation);
-			}
-		delete centrep;
-		}
-	if ( err == KErrNone )
-		{
-		TBuf<10> var; //32-bit has max of 10 chars in Decimal
-		var.Num(variation,EBinary);
-		TInt size = var.Length(), maxlen = 4;
-		if( size < maxlen)
-			{
-			TBuf<4> temp;
-			temp.AppendFill('0',maxlen-size);
-			temp.Append(var);
-			var.Zero();
-			var.Append(temp);
-			}
-		var.AppendFill('0',6);
-		if( var[0] == '1' )//memory
-			{
-			FLOG(_L("CFMSServer::FindVariation():: memory monitor supported"));    		
-			iMemoryMon = ETrue;
-			}
-		if( var[1] == '1' ) //startup
-			{
-			FLOG(_L("CFMSServer::FindVariation()::Phone restart monitor supported"));
-			iPhoneRestartMon = ETrue;
-			}
-		if( var[2] == '1' )//user or charger
-			{			
-			FLOG(_L("CFMSServer::FindVariation()::charger monitor supported"));    		
-			iChargerMon = ETrue;
-			}
-		if( var[3] == '1' )//newtwork
-			{
-			FLOG(_L("CFMSServer::FindVariation()::network monitor supported"));
-			iNetworkMon = ETrue;
-			}    	
-		}	
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::ChargerTobeMonitered() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::ChargerTobeMonitered()
-	{
-	FLOG(_L("CFMSServer::ChargerTobeMonitered()::charger monitor check"));
-	return iChargerMon;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::NetworkTobeMonitered() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::NetworkTobeMonitered()
-	{
-	FLOG(_L("CFMSServer::NetworkTobeMonitered()::network monitor check"));
-	return iNetworkMon;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::MoniterAfterPhoneRestart() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::MoniterAfterPhoneRestart()
-	{
-	FLOG(_L("CFMSServer::MoniterAfterPhoneRestart()::phonerestart monitor check"));
-	return iPhoneRestartMon;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::MemoryTobeMonitered() 
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::MemoryTobeMonitered()
-	{
-	FLOG(_L("CFMSServer::MemoryTobeMonitered()::memory monitor check"));
-	return iMemoryMon;
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::StartMonitoring()
-// -----------------------------------------------------------------------------
-void CFMSServer::StartMonitoringL(TOmaDLInterruptReason aType)
-	{
-	// A new session is being created	
-	FLOG(_L("CFMSServer::StartMonitoringL>>"));
-	if( iSessionCount == 0 ) 
-		{
-		++iSessionCount;		
-		iFMSInterruptAob.StartL(aType);
-		}
-		FLOG(_L("CFMSServer::StartMonitoringL<<"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::DeleteFile()
-// -----------------------------------------------------------------------------
-void CFMSServer::DeleteFile(TBool aValue)
-	{	
-	iDeleteFile = aValue;
-	}
-// ----------------------------------------------------------------------------------------
-// CFMSServer::~CFMSServer() 
-// ----------------------------------------------------------------------------------------
-CFMSServer::~CFMSServer()
-{
-FLOG(_L("CFMSServer::~CFMSServer())"));
-//iFMSInterruptAob.Cancel();
-if(iDeleteFile)
-	{
-	TInt err = iFs.Delete(KFotaInterruptFileName);
-	FLOG(_L("CFMSServer::~CFMSServer() File Deleted with error as %d"),err);
-	}
-if(iLogAsyncRequest)
-	{
-	FLOG(_L("CFMSServer::~CFMSServer():-iLogAsyncRequest cancel)"));
-	iLogAsyncRequest->Cancel();
-	delete iLogAsyncRequest;
-	iLogAsyncRequest = NULL;
-	}
-iFs.Close();	
-}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::NewSessionL() 
-// ----------------------------------------------------------------------------------------
-CSession2* CFMSServer::NewSessionL(const TVersion&,const RMessage2&) const
-{
-return new (ELeave) CFMSSession();
-}
-
-// ----------------------------------------------------------------------------------------
-// CFMSServer::RequestPending() 
-// Any request pending
-// ----------------------------------------------------------------------------------------
-TBool CFMSServer::RequestPending()
-	{
-	if( iSessionCount > 0 )
-		{
-		return ETrue;
-		}
-	return EFalse;
-	}
-
-// ----------------------------------------------------------------------------
-// CFMSServer::AsyncSessionRequestL() 
-// Asynchronous request logging
-// ----------------------------------------------------------------------------
-void CFMSServer::AsyncSessionRequestL()
-	{
-	if(iLogAsyncRequest)
-		{
-		FLOG(_L("CFMSServer::AsyncSessionRequestL():-iLogAsyncRequest cancel)"));
-		iLogAsyncRequest->Cancel();
-		delete iLogAsyncRequest;
-		iLogAsyncRequest = NULL;
-		}
-	iLogAsyncRequest = CPeriodic::NewL (EPriorityNormal) ;
-	FLOG(_L("CFMSServer::AsyncSessionRequestL():-iLogAsyncRequest created)"));
-	iLogAsyncRequest->Start(
-			TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4)
-			, TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4)
-			, TCallBack(LogNwRequestL,this) ) ;
-	FLOG(_L("CFMSServer::AsyncSessionRequestL():-Request logged)"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::AsyncSessionRequestL() 
-// Asynchronous request logging
-// -----------------------------------------------------------------------------
-void CFMSServer::StopAsyncRequest()
-	{
-	FLOG(_L("CFMSServer::StopAsyncRequest():-Begin)"));
-	if(iLogAsyncRequest)
-		{
-		FLOG(_L("CFMSServer::StopAsyncRequest():-cancelling the request)"));
-		iLogAsyncRequest->Cancel();
-		delete iLogAsyncRequest;
-		iLogAsyncRequest = NULL;
-		}
-	FLOG(_L("CFMSServer::StopAsyncRequest():-End)"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::StartBatteryMonitoringL() 
-// Monitors for the battery
-// -----------------------------------------------------------------------------
-void CFMSServer::StartBatteryMonitoringL(TOmaUpdInterruptReason aType, TUint aLevel)
-	{
-	// A new session is being created	
-	FLOG(_L("CFMSServer::StartMonitoringL, level = %d>>"), aLevel);
-	if( iSessionCount == 0 ) 
-		{
-		++iSessionCount;		
-		iFMSInterruptAob.StartBatteryMonitoringL(aType, aLevel);
-		}
-		FLOG(_L("CFMSServer::StartMonitoringL<<"));
-	}
-// -----------------------------------------------------------------------------
-// CFMSServer::StartUpdateInterruptMonitoringL() 
-// Monitors for the update interrupt type
-// -----------------------------------------------------------------------------
-void CFMSServer::StartUpdateInterruptMonitoringL(TOmaUpdInterruptReason aType)
-	{
-	// A new session is being created	
-	FLOG(_L("CFMSServer::StartUpdateInterruptMonitoringL>>"));
-	if(EMonitorPhoneCallEnd == aType)
-	    {
-	    iFMSInterruptAob.StartCallEndMonitoringL(aType);
-	    }
-	else
-	    {
-	    FLOG(_L("reason unknown"));
-	    }
-		FLOG(_L("CFMSServer::StartUpdateInterruptMonitoringL<<"));
-	}
-
-// -----------------------------------------------------------------------------
-// CFMSServer::CheckPhoneCallActiveL() 
-// checks any phone call is there or not at this moment
-// -----------------------------------------------------------------------------
-void CFMSServer::CheckPhoneCallActiveL(TInt& aStatus)
-    {
-    FLOG(_L("CFMSServer::CheckPhoneCallActiveL>>"));
-    TInt callstatus(KErrNotFound);
-    RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callstatus);
-    //check ctsydomainpskeys.h for different combinations, below OR condition holds good
-    if(EPSCTsyCallStateUninitialized == callstatus || 
-            EPSCTsyCallStateNone == callstatus ) // call not active
-        {
-        aStatus = EFalse;
-        }
-    else // call active
-        {
-        aStatus = ETrue;
-        }
-    FLOG(_L("CFMSServer::CheckPhoneCallActiveL status is %d<<"),aStatus);
-    }
-
-// -----------------------------------------------------------------------------
-// CFMSServer::MonitorPhoneCallEndL() 
-// Monitors for active phone call end
-// -----------------------------------------------------------------------------
-TBool CFMSServer::MonitorPhoneCallEndL(TInt aPkgId, TInt aProfileId)
-    {
-    TInt CallState = KErrNotFound;
-    iPkgId=aPkgId;
-    iProfileId = aProfileId;
-    FLOG(_L(" iPkgId:%d,iProfileId:%d<<"),iPkgId,iProfileId);
-    CheckPhoneCallActiveL(CallState);
-    if(CallState)
-        {
-        //go for call end montioring
-        LogAsyncCallMonitorL();
-        return EFalse;
-        }
-    else //trigger fota to show install query
-        {
-        iFMSInterruptAob.LaunchFotaUpdate(iPkgId,iProfileId);
-        return ETrue;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CFMSServer::LogAsyncCallMonitorL() 
-// Async request to monitor active phone call end
-// -----------------------------------------------------------------------------
-void CFMSServer::LogAsyncCallMonitorL()
-    {
-    if(iLogAsyncRequest)
-        {
-        FLOG(_L("CFMSServer::LogAsyncCallMonitorL():- cancel)"));
-        iLogAsyncRequest->Cancel();
-        delete iLogAsyncRequest;
-        iLogAsyncRequest = NULL;
-        }
-    iLogAsyncRequest = CPeriodic::NewL (EPriorityNormal) ;
-    FLOG(_L("CFMSServer::LogAsyncCallMonitorL(): created)"));
-    iLogAsyncRequest->Start(
-            TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*1)
-            , TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4)
-            , TCallBack(LogCallEndMonitorRequestL,this) ) ;
-    FLOG(_L("CFMSServer::LogAsyncCallMonitorL():-Request logged)"));
-    }
-
-// -----------------------------------------------------------------------------
-// CFMSServer::PkgId()) 
-// returns the PkgId of the FOTA update
-// -----------------------------------------------------------------------------
-TInt& CFMSServer::PkgId()
-    {
-    return iPkgId;
-    }
-
-// -----------------------------------------------------------------------------
-// CFMSServer::ProfileId() 
-// returns the ProfileId of the FOTA
-// -----------------------------------------------------------------------------
-TInt& CFMSServer::ProfileId()
-    {
-    return iProfileId;
-    }
-//End of file
--- a/fotaapplication/fotaserver/fmserver/src/fmsserversession.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,496 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-#include <f32file.h>
-#include <cmconnectionmethoddef.h>
-#include <cmmanagerext.h>
-#include <cmpluginwlandef.h>
-#include <cmpluginpacketdatadef.h>
-#include <etel.h> //for telephone mode
-#include <etelmm.h> //for telephone mode
-#include <fotaConst.h> 
-#include "fmsserversession.h"
-#include "fmsclientserver.h"
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::CFMSSession
-// ----------------------------------------------------------------------------------------
-CFMSSession::CFMSSession()
-	{	
-	iStopServer  =  EFalse;
-	iWlanbearer  =  EFalse;
-	iWcdmaBearer =  EFalse;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::~CFMSSession
-// ----------------------------------------------------------------------------------------
-CFMSSession::~CFMSSession()
-	{	
-	FLOG(_L("CFMSSession::~CFMSSession-- begin"));
-	if( iStopServer )
-		{
-		FLOG(_L("Stop fmserver CFMSSession::~CFMSSession"));	
-		Server().DropSession();
-		}
-	FLOG(_L("CFMSSession::~CFMSSession-- end"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::Server
-// ----------------------------------------------------------------------------------------
-CFMSServer& CFMSSession::Server()
-	{
-	return *static_cast<CFMSServer*>(const_cast<CServer2*>(CSession2::Server()));
-	}
-
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::CheckClientSecureIdL
-// ----------------------------------------------------------------------------------------
-TBool CFMSSession::CheckClientSecureIdL (
-		const RMessage2& aMessage)
-	{
-	TUid    fota            = TUid::Uid( KFotaServerUid );
-	TUid    starter         = TUid::Uid( KStarterUid );
-
-	// Fotaserver
-	if ( aMessage.SecureId() == fota.iUid ) 
-		{
-		FLOG(_L("[CFMSSession] CheckClientSecureIdL client is \
-		fotaserver!"));
-		return ETrue;
-		}
-
-	// Starter
-	if ( aMessage.SecureId() == starter.iUid )
-		{
-		return ETrue;
-		}
-
-	// test app
-	if ( aMessage.SecureId() == 0x01D278B9 )
-		{
-		return ETrue;
-		}
-
-	FLOG(_L("[CFMSSession] CheckClientSecureIdL client 0x%X is unknown \
-	(msg %d), bailing out"),aMessage.SecureId().iId, aMessage.Function());
-	iStopServer = ETrue;
-	User::Leave( KErrAccessDenied );    
-	return EFalse; // compiler warning otherwise
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::ServiceL
-// ----------------------------------------------------------------------------------------
-void CFMSSession::ServiceL(const RMessage2& aMessage)
-	{	
-	RThread clt; aMessage.ClientL(clt); TFullName cltnm = clt.FullName();
-	FLOG(_L( "CFMSSession::ServiceL      %d   serving for %S?" )
-			,aMessage.Function(), &cltnm );
-	if( CheckClientSecureIdL( aMessage ) )
-		{
-		//already one request pending
-		if( Server().RequestPending() && 
-				aMessage.Function() !=  ECancelOutstandingRequest )
-			{
-			aMessage.Complete(KErrCancel);
-			}
-		else //For no pending request case
-			{
-			TRAPD(err,DispatchMessageL(aMessage));
-			if(err != KErrNone ) 
-				{
-				iStopServer = ETrue;
-				}
-			aMessage.Complete(err);
-			}
-		}
-	else
-		{
-		aMessage.Complete(KErrAccessDenied);
-		}
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::ServiceError
-// ----------------------------------------------------------------------------------------
-void CFMSSession::ServiceError(const RMessage2& aMessage,TInt aError)
-	{		
-	CSession2::ServiceError(aMessage,aError);
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::DispatchMessageL
-// ----------------------------------------------------------------------------------------
-void CFMSSession::DispatchMessageL(const RMessage2& aMessage)
-	{	
-	FLOG(_L("CFMSSession::DispatchMessageL-begin"));
-
-	if( aMessage.Function() != EFotaStartUpPlugin && 
-			aMessage.Function() != ECancelOutstandingRequest && 
-			aMessage.Function() != EMonitorbattery &&
-			aMessage.Function() != EPhoneCallActive &&
-	        aMessage.Function() != EMonitorPhoneCallEnd )
-		{
-		 
-		 HandleBasedOnBearertypeL(aMessage);
-		
-			
-						
-		}
-	switch(aMessage.Function())
-	{
-	case EUserInterrupt:
-		{
-		if(Server().ChargerTobeMonitered())
-			{	
-			FLOG(_L("FMSSErver::EUserInterrupt"));			
-			Server().WriteToFile(EUserInterrupt,aMessage.Int0(),
-					(TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer);
-			Server().StartMonitoringL(EUserInterrupt);					    
-			}
-		else
-			{
-			WriteDummyFile();
-			iStopServer = ETrue;
-			}
-		}
-		break;
-	case ENetworkInterrupt:
-		{
-		if(Server().NetworkTobeMonitered())
-			{
-			FLOG(_L("FMSSErver::ENetworkInterrupt"));						
-			//If wlan = on & network interrupt, then stop the server and dont monitor
-			//mean other wlan n/w's present but this wlan gone off
-			if(iWlanbearer && Server().CheckWlanL())
-				{
-				WriteDummyFile();
-				Server().DeleteFile(EFalse);
-				iStopServer = ETrue;
-				break;
-				}			
-			Server().WriteToFile(ENetworkInterrupt,aMessage.Int0(),
-					(TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer);			
-			Server().AsyncSessionRequestL();
-			}
-		else
-			{
-			WriteDummyFile();
-			iStopServer = ETrue;
-			}
-		}
-		break;
-	case EMemoryInterrupt:
-		{			
-		if(Server().MemoryTobeMonitered())
-			{
-			FLOG(_L("FMSSErver::EMemoryInterrupt"));				
-			Server().MemoryToMonitorL(aMessage.Int2(),(TDriveNumber)aMessage.Int1()); 		
-			Server().WriteToFile(EMemoryInterrupt,aMessage.Int0(),
-					(TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer);
-			Server().StartMonitoringL(EMemoryInterrupt);		
-			}
-		else
-			{
-			WriteDummyFile();
-			iStopServer = ETrue;
-			}
-		}
-		break;
-	case EGeneralInterrupt:
-		{
-		if(Server().ChargerTobeMonitered())
-			{
-			FLOG(_L("FMSSErver::GeneralInterrupt"));	
-			Server().WriteToFile(EUserInterrupt,aMessage.Int0(),
-					(TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer);
-			Server().StartMonitoringL(EUserInterrupt);
-			}
-		else
-			{
-			WriteDummyFile();
-			iStopServer = ETrue;
-			}
-		}
-		break;
-	case EFotaStartUpPlugin:
-		{	
-		if(Server().MoniterAfterPhoneRestart())				
-			{
-			FLOG(_L("CFMSSession::EFotaStartUpPlugin"));	
-			TInt intrreason(-1),bearer(-1),size(0);
-			TInt drive(-1), wcdmabearer(-1);
-			//if loop for Hard reboot--no file or size is empty
-			if(Server().ReadFromFile(intrreason,bearer,drive,size,wcdmabearer) == EFalse )
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin no file or size is empty"));
-				if(!Server().RequestPending())
-					{	
-					FLOG(_L("CFMSSession::EFotaStartUpPlugin-no request pending"));						  					  	
-					TRAPD(err,PhoneModeL());
-					if(err); // remove compiler warning
-					FLOG(_L("PhoneModeL() fotastartup returns err as %d"),err);
-					if(iWcdmaBearer)						 
-						Server().NetworkTypeL( (TInt)EBearerIdWCDMA );
-
-					else
-						Server().NetworkTypeL( (TInt)EBearerIdGPRS );	  					  					  
-					Server().LockSession();
-					Server().TriggerFotaL(); //checks n/w & trigger FOTA DL						
-					}
-				break;
-				}												
-			TUint32 BearerId = FindBearerIdL(bearer);
-			FLOG(_L("CFMSSession::EFotaStartUpPlugin wcdma bearer is %d"),wcdmabearer);
-			if( BearerId == KUidWlanBearerType )
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin-wlan bearer"));	
-				Server().NetworkTypeL(EBearerIdWLAN);
-				if(intrreason == ENetworkInterrupt)
-					{
-					//stop the server , but dont delete file to support in second reboot
-					FLOG(_L("wlan bearer & n/w interrupt--stopping the server"));
-					Server().DeleteFile(EFalse);
-					iStopServer = ETrue;
-					break;
-					}
-				}
-			else if( BearerId == KUidPacketDataBearerType )
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin-bearer is packet data"));	
-				if( wcdmabearer == 1 )
-					{
-					Server().NetworkTypeL(EBearerIdWCDMA);	
-					FLOG(_L("CFMSSession::EFotaStartUpPlugin-packet data and 3G"));
-					}
-				else
-					{
-					Server().NetworkTypeL(EBearerIdGPRS);
-					FLOG(_L("CFMSSession::EFotaStartUpPlugin-packet data and 2G"));
-					}
-				}
-			else
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin-unknown bearer"));
-				Server().DeleteFile(EFalse);
-				iStopServer = ETrue;
-				break;
-				}
-			//when there is dummy file in the store
-			if( intrreason < EUserInterrupt || intrreason > EGeneralInterrupt )
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin-Interrupt unknown"));	
-				Server().DeleteFile(EFalse); //used when variation support & reboot again
-				iStopServer = ETrue;
-				break;
-				}
-			if( intrreason == EUserInterrupt || intrreason == EGeneralInterrupt )
-				{
-				FLOG(_L("CFMSSession::EFotaStartUpPlugin-Check n/w & trigger fotaengine"));	
-				Server().CheckNetworkL(bearer,drive,size,wcdmabearer);//3 params used in monitoring if no n/w
-				break;
-				} 				
-			//for other interrupts it will monitor
-			Server().StartMonitoringL((TOmaDLInterruptReason)intrreason);
-			}
-		else
-			{
-			iStopServer = ETrue;
-			}
-		}
-		break;
-	case ECancelOutstandingRequest:
-		{					
-		FLOG(_L("CFMSSession::DispatchMessageL ECancelOutstandingRequest case:"));
-		iStopServer = ETrue; 
-		}
-		break;	
-
-	case EMonitorbattery:
-	   {
-	    FLOG(_L("CFMSSession::DispatchMessageL EMonitorbattery case:"));
-	 	Server().StartBatteryMonitoringL(EMonitorbattery, aMessage.Int0());
-	   }
-	 	break;
-	   
-	case EPhoneCallActive:
-	    {
-	    FLOG(_L("CFMSSession::DispatchMessageL EPhoneCallActiveSync case:"));
-	    Server().LockSession();
-	    TInt reason =EFalse;
-	    Server().CheckPhoneCallActiveL(reason);
-	    TPckgBuf<TInt> callactive(reason);
-	    aMessage.WriteL(0,callactive);
-	    Server().iSessionCount = 0;
-	    FLOG(_L("CFMSSession::DispatchMessageL EPhoneCallActiveSync case:%d"),reason);
-	    iStopServer = ETrue;
-	    }
-	    break;
-	    
-	case EMonitorPhoneCallEnd:
-	    {
-	    FLOG(_L("CFMSSession::DispatchMessageL EPhoneCallActiveAsync case:%d,%d"),aMessage.Int0(),aMessage.Int1());
-	    Server().LockSession();
-	    if(Server().MonitorPhoneCallEndL(aMessage.Int0(),aMessage.Int1()))
-	        {
-	        iStopServer = ETrue;
-	        Server().iSessionCount = 0;
-	        }
-	    else //let server monitor for active call end
-	        {
-	        iStopServer = EFalse;
-	        }
-	   }
-	 	break;
-	default:
-		{
-		FLOG(_L("CFMSSession::DispatchMessageL default case:and a leave happened"));
-		iStopServer = ETrue;
-		User::Leave(KErrArgument);			
-		}			
-	}
-	FLOG(_L("CFMSSession::DispatchMessageL:end"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::FindBearerId
-// ----------------------------------------------------------------------------------------
-TUint32 CFMSSession::FindBearerIdL(TInt aIapId)
-	{
-	FLOG(_L("CFMSSession::FindBearerId: % d"),aIapId);
-	TUint32 bearer = 0;
-	TInt err( KErrNone );
-	// Query CM Id
-	TInt cmId ( aIapId );			        
-	RCmManagerExt  CmManagerExt;
-	TRAP( err, CmManagerExt.OpenL() );
-	if( err == KErrNone )
-		{
-		RCmConnectionMethodExt cm;
-		TRAP( err, cm = CmManagerExt.ConnectionMethodL( cmId ) );			        	
-		if ( err == KErrNone )
-			{	        
-			CleanupClosePushL( cm );	  
-			bearer = cm.GetIntAttributeL( CMManager::ECmBearerType );	        			        
-			CleanupStack::PopAndDestroy();  // cm	        
-			}	    	        
-		CmManagerExt.Close();
-		}
-	return bearer;
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::WriteDummyFile
-// This method used when the variation wouldn't support and startup called
-// and also differentiates hard reeboot(with empty or no file)
-// ----------------------------------------------------------------------------------------
-void CFMSSession::WriteDummyFile()
-	{
-	FLOG(_L("CFMSSession::WriteDummyFile--begin"));
-	Server().WriteToFile(KErrNotFound,KErrNotFound,
-			(TDriveNumber)KErrNotFound,KErrNotFound,EFalse);
-	Server().DeleteFile(EFalse);
-	FLOG(_L("CFMSSession::WriteDummyFile--End"));
-	}
-
-// ----------------------------------------------------------------------------------------
-// CFMSSession::PhoneMode
-// This method used to know the current phone mode
-// If the phone is in dual mode it will check GPRS bearer only
-// ----------------------------------------------------------------------------------------
-void CFMSSession::PhoneModeL()
-	{
-	FLOG(_L("CFMSSession::PhoneModeL--begin"));	
-	// find out if we are in 2G or in 3G - it is needed for calculating bearer availability
-	__UHEAP_MARK; 
-	RTelServer telServer;
-	User::LeaveIfError( telServer.Connect());
-	FLOG(_L("CFMSSession::PhoneModeL--telServer Connected"));
-	RTelServer::TPhoneInfo teleinfo;
-	User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) );
-	FLOG(_L("CFMSSession::PhoneModeL--telServer getting tel info"));
-	RMobilePhone phone;
-	User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) );
-	FLOG(_L("CFMSSession::PhoneModeL--RMobilePhone opened"));
-	User::LeaveIfError(phone.Initialise());	
-	FLOG(_L("CFMSSession::PhoneModeL--phone.Initialise() success"));
-	RMobilePhone::TMobilePhoneNetworkMode mode;        	        	
-	TInt err = phone.GetCurrentMode( mode );
-	phone.Close();
-	telServer.Close();
-	__UHEAP_MARKEND;
-
-	if( KErrNone == err )
-		{
-		switch(mode)
-		{
-		case RMobilePhone::ENetworkModeGsm:
-		//case RMobilePhone::ENetworkModeUnknown:  // emulator default
-			{
-			FLOG(_L("CFMSSession::PhoneModeL-begin-GSM Mode"));	                		
-			iWcdmaBearer = EFalse;
-			Server().NetworkTypeL(EBearerIdGPRS);
-			break;		
-			}
-		case RMobilePhone::ENetworkModeWcdma:
-			{                		     		
-			FLOG(_L("CFMSSession::PhoneModeL-begin-3G Mode"));	
-			iWcdmaBearer = ETrue;
-			Server().SetWcdma();
-			Server().NetworkTypeL(EBearerIdWCDMA);
-			break;	
-			}	
-		default:        	
-		FLOG(_L("unknown"));
-		}        				
-		}
-	FLOG(_L("CFMSSession::PhoneModeL--end"));
-	}
-	
-//----------------------------------------------------------------------------------------
-// CFMSSession::HandleBasedOnBearertypeL
-// Handles based on bearer type
-//----------------------------------------------------------------------------------------	
-
-void  CFMSSession::HandleBasedOnBearertypeL(const RMessage2& aMessage)
-{
-    TUint32 bearer = FindBearerIdL(aMessage.Int0());
-		if( bearer == KUidPacketDataBearerType )
-			{
-			FLOG(_L("CFMSSession::DispatchMessageL bearer is packet data"));
-			TRAPD(err,PhoneModeL());
-			if(err); // remove compiler warning
-			FLOG(_L("PhoneModeL() returns err as %d"),err);
-			}
-		else if	(	bearer == KUidWlanBearerType )
-			{
-			FLOG(_L("CFMSSession::DispatchMessageL bearer is WLAN"));
-			iWlanbearer = ETrue;
-			Server().NetworkTypeL(EBearerIdWLAN);
-			}
-		else	
-			{
-			FLOG(_L("CFMSSession::DispatchMessageL bearer is not known and a leave happened "));
-			iStopServer = ETrue;
-			User::Leave(KErrArgument);
-			}
-}				
-//End of file
--- a/fotaapplication/fotaserver/fotacustcmds/bwins/fotacustcmdsu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
-	?FotaCustCmdAllReasonsNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL(void)
-	?FotaCustCmdFirmwareUpdateNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 2 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL(void)
-	?FotaCustCmdFirstBootNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 3 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdFirstBootNewL(void)
-
--- a/fotaapplication/fotaserver/fotacustcmds/eabi/fotacustcmdsu.def	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
-	_ZN19FotaCustCmdsFactory25FotaCustCmdAllReasonsNewLEv @ 1 NONAME
-	_ZN19FotaCustCmdsFactory29FotaCustCmdFirmwareUpdateNewLEv @ 2 NONAME
-	_ZN19FotaCustCmdsFactory24FotaCustCmdFirstBootNewLEv @ 3 NONAME
-
--- a/fotaapplication/fotaserver/fotacustcmds/group/bld.inf	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Build information file for the FotaCustCmds project.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-fotacustcmds.mmp
--- a/fotaapplication/fotaserver/fotacustcmds/group/fotacustcmds.mmp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Project definition file for the FotaCustCmds project.
-*
-*/
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-TARGET          fotacustcmds.dll
-TARGETTYPE      dll
-UID             0x1000008D 0x10205071 
-
-CAPABILITY      CAP_GENERAL_DLL
-VENDORID        VID_DEFAULT
-
-SOURCEPATH      ../src
-SOURCE          fotacustcmdsfactory.cpp
-SOURCE          fotacustcmdallreasons.cpp
-SOURCE          fotacustcmdfirmwareupdate.cpp
-SOURCE          fotacustcmdfirstboot.cpp
-
-USERINCLUDE     ../inc ../../cenrep ../../inc ../../fmsclient/inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY         euser.lib
-LIBRARY         ecom.lib
-#ifdef __SYNCML_DM_FOTA
-LIBRARY         fotaengine.lib
-LIBRARY		fmsclient.lib
-#endif
-DEBUGLIBRARY    flogger.lib
-LIBRARY         centralrepository.lib
-LIBRARY         schsvr.lib  
-LIBRARY		apgrfx.lib
-LIBRARY		apparc.lib
--- a/fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdallreasons.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Declaration of CFotaCustCmdAllReasons class.
-*
-*/
-
-#ifndef FOTACUSTCMDALLREASONS_H
-#define FOTACUSTCMDALLREASONS_H
-
-#include <e32base.h>
-#include <ssm/ssmcustomcommand.h>
-
-/**
- *  Each command is implemented in a class derived from MSsmCustomCommand.
- *  It is also possible to implement multiple similar command in the same
- *  class and differentiate between them based on constructor parameters
- *  from the factory method.
- */
-NONSHARABLE_CLASS( CFotaCustCmdAllReasons ) : public CBase, public MSsmCustomCommand
-    {
-
-public:
-
-    /**
-     * Two-phased constructor
-     */
-	static CFotaCustCmdAllReasons* NewL();
-
-    /**
-     * Destructor
-     */
-    virtual ~CFotaCustCmdAllReasons();
-
-private: // From MSsmCustomCommand
-
-    /**
-     * @see MSsmCustomCommand
-     */
-    TInt Initialize( CSsmCustomCommandEnv* aCmdEnv );
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Execute( const TDesC8& aParams, TRequestStatus& aRequest );
-
-    /**
-     * Takes action depending on the fota update state cenrep
-     * @Params None
-     * @return  None
-     *
-     */
-     
-  void ExecuteL( );  
-    
-    /**
-     * @see MSsmCustomCommand
-     */
-	void ExecuteCancel();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Close();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Release();
-	
-    /**
-     * Finds whether fota is schedduled or not 
-     * @Params None
-     * @return 
-     * ETrue if  fota is scheduled else EFalse
-     */
-  TBool FindScheduleL();
-  
-private: // data
-
-    /**
-    * If the command needs command env in Execute function, it should store it
-    * to member variable:
-    *
-    * Custom command environment. Not owned. Set in Initialize.
-    * CSsmCustomCommandEnv* iEnv;
-    */
-	
-	/*
-	* Function description:
-	* This function checks for dmEventNotifier. 
-	* This checks for the specific scenario "when MMC is removed/inserted when phone is 
-	* in switch off mode. Then it starts the DmEventNotifier.
-	*
-	* @params: None
-	* @Return: void
-	*/
-    void checkDMEventNotifierL();
-
-    };
-
-#endif // FOTACUSTCMDALLREASONS_H
--- a/fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdfirmwareupdate.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Declaration of CFotaCustCmdFirmwareUpdate class.
-*
-*/
-
-#ifndef FOTACUSTCMDFIRMWAREUPDATE_H
-#define FOTACUSTCMDFIRMWAREUPDATE_H
-
-#include <e32base.h>
-#include <ssm/ssmcustomcommand.h>
-
-/**
- *  Each command is implemented in a class derived from MSsmCustomCommand.
- *  It is also possible to implement multiple similar command in the same
- *  class and differentiate between them based on constructor parameters
- *  from the factory method.
- */
-NONSHARABLE_CLASS( CFotaCustCmdFirmwareUpdate ) : public CBase, public MSsmCustomCommand
-    {
-
-public:
-
-    /**
-     * Two-phased constructor
-     */
-	static CFotaCustCmdFirmwareUpdate* NewL();
-
-    /**
-     * Destructor
-     */
-    virtual ~CFotaCustCmdFirmwareUpdate();
-
-private: // From MSsmCustomCommand
-
-    /**
-     * @see MSsmCustomCommand
-     */
-    TInt Initialize( CSsmCustomCommandEnv* aCmdEnv );
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Execute( const TDesC8& aParams, TRequestStatus& aRequest );
-	
-	  /**
-     * invokes fotaengine after fota update
-     * @Params None
-     * @return  None
-     *
-     */
-	void ExecuteL();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void ExecuteCancel();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Close();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Release();
-
-private: // data
-
-    /**
-    * If the command needs command env in Execute function, it should store it
-    * to member variable:
-    *
-    * Custom command environment. Not owned. Set in Initialize.
-    * CSsmCustomCommandEnv* iEnv;
-    */
-
-    };
-
-#endif // FOTACUSTCMDFIRMWAREUPDATE_H
--- a/fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdfirstboot.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Declaration of CFotaCustCmdFirstBoot class.
-*
-*/
-
-#ifndef FOTACUSTCMDFIRSTBOOT_H
-#define FOTACUSTCMDFIRSTBOOT_H
-
-#include <e32base.h>
-#include <ssm/ssmcustomcommand.h>
-
-/**
- *  Each command is implemented in a class derived from MSsmCustomCommand.
- *  It is also possible to implement multiple similar command in the same
- *  class and differentiate between them based on constructor parameters
- *  from the factory method.
- */
-NONSHARABLE_CLASS( CFotaCustCmdFirstBoot ) : public CBase, public MSsmCustomCommand
-    {
-
-public:
-
-    /**
-     * Two-phased constructor
-     */
-	static CFotaCustCmdFirstBoot* NewL();
-
-    /**
-     * Destructor
-     */
-    virtual ~CFotaCustCmdFirstBoot();
-
-private: // From MSsmCustomCommand
-
-    /**
-     * @see MSsmCustomCommand
-     */
-    TInt Initialize( CSsmCustomCommandEnv* aCmdEnv );
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Execute( const TDesC8& aParams, TRequestStatus& aRequest );
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void ExecuteCancel();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Close();
-
-    /**
-     * @see MSsmCustomCommand
-     */
-	void Release();
-
-private: // data
-
-    /**
-    * If the command needs command env in Execute function, it should store it
-    * to member variable:
-    *
-    * Custom command environment. Not owned. Set in Initialize.
-    * CSsmCustomCommandEnv* iEnv;
-    */
-
-    };
-
-#endif // FOTACUSTCMDFIRSTBOOT_H
--- a/fotaapplication/fotaserver/fotacustcmds/inc/fotacustcmdsfactory.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Declaration of FotaCustCmdsFactory class.
-*
-*/
-
-#ifndef FOTACUSTCMDSFACTORY_H
-#define FOTACUSTCMDSFACTORY_H
-
-#include <e32def.h>
-
-class MSsmCustomCommand;
-
-/**
- *  Creates custom command objects.
- *
- *  Custom commands are loaded by system state manager based on DLL name and
- *  function ordinal.
- *  Each DLL containing custom commands must offer factory methods for each
- *  custom command.
- *  The function ordinals must be exactly the same in emulator and HW builds
- *  or loading the custom command may have unpredictable results.
- *
- *  FotaCustCmdsFactory is a static class containing factory method of one
- *  custom command. It can be easily extended to contain factory methods of
- *  multiple custom commands by adding more member functions.
- *
- *  It is better to implement own factory method for each separate command
- *  than to try to use parameters of Execute function to distinguish between
- *  them.
- *  Note that similar commands can be implemented in the same command class -
- *  just the factory methods need to be different.
- */
-
-class FotaCustCmdsFactory
-    {
-
-public:
-
-    /**
-     * Creates and returns a custom command of type CFotaCustCmdAllReasons.
-     * This method has function ordinal 1 in fotacustcmds.dll.
-     *
-     * @return A custom command object.
-     */
-	IMPORT_C static MSsmCustomCommand* FotaCustCmdAllReasonsNewL();
-
-    /**
-     * Creates and returns a custom command of type CFotaCustCmdFirmwareUpdate.
-     * This method has function ordinal 2 in fotacustcmds.dll.
-     *
-     * @return A custom command object.
-     */
-	IMPORT_C static MSsmCustomCommand* FotaCustCmdFirmwareUpdateNewL();
-
-    /**
-     * Creates and returns a custom command of type CFotaCustCmdFirstBoot.
-     * This method has function ordinal 3 in fotacustcmds.dll.
-     *
-     * @return A custom command object.
-     */
-	IMPORT_C static MSsmCustomCommand* FotaCustCmdFirstBootNewL();
-
-    // To add new custom commands to this DLL, add their factory methods here.
-
-    };
-
-#endif // FOTACUSTCMDSFACTORY
--- a/fotaapplication/fotaserver/fotacustcmds/inc/fotastartupDebug.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-* Copyright (c) 2007 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file defines logging macros for Fotastartupextension log
-*
-*/
-
-
-
-
-#ifndef FOTASTARTUPDEBUG_H
-#define FOTASTARTUPDEBUG_H
-
-#include <e32debug.h> 
-#include <f32file.h>
-
-//Examples
-//FLOG( _L( "[fotastartupextensionplugin] CFotaStartupExtensionPlugIn::NewL:" ) );
-//FTRACE(RDebug::Print(_L("[fotastartupextensionplugin] fotastartupextensionplugin::NewL: err (%d)"), err));
-#ifdef _DEBUG
-
-const TInt KBTHexDumpWidth=16;
-const TInt KBTLogBufferSize=100;
-const TText KFullStopChar='.';
-
-_LIT(KBTFirstFormatString,"%04x: ");
-_LIT(KBTSecondFormatString,"%02x ");
-_LIT(KBTThirdFormatString,"%c");
-_LIT(KBTThreeSpaces,"   ");
-_LIT(KBTSeparator," ");
-
-inline void HexDump(const TUint8* aPtr, TInt aLen)
-    {
-	if( aPtr != NULL )
-	    {
-    	TBuf<KBTLogBufferSize> line;
-	    TInt i = 0;
-
-    	while (aLen>0)
-    		{
-    		TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen);
-    		line.AppendFormat(KBTFirstFormatString,i);
-    		TInt j;
-    		for (j=0; j<n; j++)
-    			line.AppendFormat(KBTSecondFormatString,aPtr[i+j]);
-    		while (j++<KBTHexDumpWidth)
-    			line.Append(KBTThreeSpaces);
-    		line.Append(KBTSeparator);
-    		for (j=0; j<n; j++)
-    			line.AppendFormat(KBTThirdFormatString,(aPtr[i+j]<32 || aPtr[i+j]>126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]);
-
-    		RDebug::Print(line);
-
-            line.Zero();
-    		aLen-=n;
-    		i+=n;
-    	    }
-        }
-    }
-
-
-// ===========================================================================
-#ifdef __WINS__     // File logging for WINS
-// ===========================================================================
-#include <e32std.h>
-#include <f32file.h>
-#include <flogger.h>
-
-_LIT( KLogFile, "fotacustcmds.log" );
-_LIT( KLogDirFullName, "c:\\logs\\" );
-_LIT( KLogDir, "fota" );
-
-#define FLOG( a )   { FPrint(a); }
-#define FTRACE( a ) { a; }
-
-// Declare the FPrint function
-//
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    RFileLogger::WriteFormat( KLogDir,
-                              KLogFile,
-                              EFileLoggingModeAppend,
-                              aFmt,
-                              list );
-    }
-
-// ===========================================================================
-#else               // RDebug logging for target HW
-// ===========================================================================
-/*#include <e32svr.h>
-
-#define FLOG( a )   { RDebug::Print( a ); }
-#define FTRACE( a ) { a; }
-
-*/
-
-///////////////////////////////
-#include <e32std.h>
-#include <f32file.h>
-#include <flogger.h>
-
-_LIT( KLogFile, "fotacustcmds.log" );
-_LIT( KLogDirFullName, "c:\\logs\\" );
-_LIT( KLogDir, "fota" );
-
-#define FLOG( a )   { FPrint(a); }
-#define FTRACE( a ) { a; }
-
-// Declare the FPrint function
-//
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    RFileLogger::WriteFormat( KLogDir,
-                              KLogFile,
-                              EFileLoggingModeAppend,
-                              aFmt,
-                              list );
-    }
-
-////////////////////////////////
-
-
-#endif //__WINS__
-
-// ===========================================================================
-#else // // No loggings --> Reduced binary size
-// ===========================================================================
-#define FLOG( a )
-#define FTRACE( a )
-
-#endif // _DEBUG
-
-/////////  ///////////////////////
-inline void LOGX(TInt aSource)
-	{
-		HBufC *iMyBufNumber = HBufC::NewLC(255);
-   		TPtr bufNumberPtr(iMyBufNumber->Des());
-   		bufNumberPtr.FillZ();
-   		bufNumberPtr.AppendFormat(_L("%d"),aSource);
-    	FLOG(iMyBufNumber->Des());
-    	CleanupStack::PopAndDestroy();
-	}
-/////////  ///////////////////////
-	
-#endif      // FOTASTARTUP_H
-            
-// End of File
--- a/fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdallreasons.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Implementation of CFotaCustCmdAllReasons class.
-*
-*/
-
-#include "fotacustcmdallreasons.h"
-#include "fotastartupDebug.h"
-#ifdef __SYNCML_DM_FOTA
-#include <fotaengine.h>
-#include "fmsclient.h"
-#include "fotaserverPrivateCRKeys.h"
-#include "FotaIPCTypes.h"
-#include "fmsclientserver.h"
-#endif
-#include <schtime.h>      
-#include <csch_cli.h>    
-#include <centralrepository.h>
-// RProperty
-#include <e32base.h>
-#include <e32property.h>
-// Memory status PS key headers
-#include <UikonInternalPSKeys.h>
-// Loading application headers
-#include <apgcli.h>
-#include <apacmdln.h>
-//Middleware includes
-#include <dmeventnotifiercrkeys.h>
-#include <dmeventnotifiercommon.h>
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::NewL
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdAllReasons* CFotaCustCmdAllReasons::NewL()
-	{
-  FLOG( _L( "[CFotaCustCmdAllReasons::NewL() BEGIN " ) );
-	return new ( ELeave ) CFotaCustCmdAllReasons;
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons()
-    {
-      FLOG( _L( "[CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons()  " ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::Initialize
-// ---------------------------------------------------------------------------
-//
-TInt CFotaCustCmdAllReasons::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ )
-    {
-    FLOG( _L( "[CFotaCustCmdAllReasons::~Initialize()  " ) );
-
-    
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::Execute
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdAllReasons::Execute(
-    const TDesC8& /*aParams*/,
-    TRequestStatus& aRequest )
-    {
-     FLOG( _L( "[CFotaCustCmdAllReasons::~Execute() BEGIN " ) );
-      aRequest = KRequestPending;
- #ifdef __SYNCML_DM_FOTA
-    TRAP_IGNORE(ExecuteL());    
- #endif
-    TRequestStatus* request = &aRequest;
-    User::RequestComplete( request, KErrNone );
- FLOG( _L( "[CFotaCustCmdAllReasons::~Execute() END " ) ); 
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::ExecuteL
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdAllReasons::ExecuteL( )
-    {
-      FLOG( _L( "[CFotaCustCmdAllReasons]::ExecuteL() Boot reason AllReason BEGIN " ) );
-      
-        RFotaEngineSession fotaEngine;          
-       //CheckCenrep if GA feature in ON then start else nothing.
-       CRepository*    centrep( NULL);
-       TInt err= KErrNone;
-       TRAP( err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-       TInt sendGAAfterrebootfeature = 0;
-       TInt val (EFotaDefault);
-       
-       if ( err==KErrNone ) 
-           {
-           err = centrep->Get(  KFotaUpdateState, val );
-           
-           if(err == KErrNone)
-               {
-               // check if there is GA pending
-
-               FTRACE(RDebug::Print(_L("[CFotaCustCmdAllReasons]  startup reason is %d"), val));        
-               switch(val)
-                   {
-                   case EFotaDownloadInterrupted :
-                       {
-                       FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Start FMS server " ) ); 
-                       RFMSClient fmsClient;
-                       TRAPD(err, fmsClient.OpenL());
-                       if (err == KErrNone)
-                           {
-                           fmsClient.Close();
-                           FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Closing FMS server  " ) );
-                           }
-                       }
-                       break;
-                   case EFotaPendingGenAlert : 
-                       {
-                       FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Start fota server " ) );
-                       err = centrep->Get(  KGenericAlertResendAfterBoot, sendGAAfterrebootfeature );
-                       FTRACE(RDebug::Print(_L("[CFotaCustCmdAllReasons] feature sendGenericAlert is %d"), sendGAAfterrebootfeature));        
-
-                       if (sendGAAfterrebootfeature==1)
-                           {
-                           TRAPD(oError,fotaEngine.OpenL());
-                           if(oError == KErrNone)
-                               {
-                               fotaEngine.Close();
-                               FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Closing fota server  " ) );
-                               }
-                           }
-                       }
-                       break;
-                   case EFotaUpdateInterrupted :    
-                       {
-                           FLOG(_L(" update interrupted >>"));
-                           RFMSClient fmsclient;
-                           TRAPD(err,fmsclient.OpenL());
-                           if(err)
-                           {  FLOG(_L( " opening fms failed " ) ); 
-                                   
-                           }
-                           else
-                           {
-                           
-                           FLOG(_L("CFotaUpdate::going into FMS client side MonitorBatteryL() >>"));
-                           TRAPD(err1, fmsclient.MonitorForBatteryL(4)); // equal to EBatteryLevelLevel4
-                           if(err1)
-                           {
-                               FLOG(_L( " MonitorBatteryL failed "  ));
-                           }
-                            fmsclient.Close();
-                            FLOG(_L(" update interrupted <<"));
-                           }
-                       }
-                       break;
-                   default:
-                       {
-                       FLOG( _L( "[CFotaCustCmdAllReasons] pendingGAToSend is not SET " ) ); 
-                       }
-                       break;
-                   }
-               
-               }
-            //Changes for resetting of timer.....   
-            TInt timerResetfeature(KErrNone); 
-            
-            err = centrep->Get(  KFotaReminderTimerReset, timerResetfeature );
-             if((err == KErrNone) && (timerResetfeature==1)) //if reset timer feature on. 
-             {    
-                   
-                   TBool isFotaScheduled =EFalse;
-                   TRAPD(error , isFotaScheduled = FindScheduleL());           //check whether FOTA scheduled 
-                   if(error)
-                   {
-                       isFotaScheduled = EFalse;
-                    
-                   }
-                   if(isFotaScheduled)
-                   {   
-                     FLOG( _L( "[CFotaCustCmdAllReasons] fota operation is scheduled  " ) );   
-                     TRAPD(oError,fotaEngine.OpenL());
-                     if(oError)
-                      {
-                       FLOG( _L( "[CFotaCustCmdAllReasons] error in opening : so Closing fota server  " ) );
-
-                      }
-                     else
-                     {   
-                      
-                       TFotaScheduledUpdate           sched(-1,-1);   //trigger the Fota remainder dialog here..
-                       TPckg<TFotaScheduledUpdate>    p(sched);
-                       TRAPD(err, fotaEngine.ScheduledUpdateL(sched));
-                       if(err)
-                       {
-                         FLOG( _L( "[CFotaCustCmdAllReasons] FirmwareUpdate scheduling failed   " ) );                
-                       }
-                       fotaEngine.Close();
-                      }
-                       
-                    }
-                  
-                  
-               }     
-            
-           }
-       delete centrep;
-       {   // Write the code for starting the dmEventNotifier
-      	   TRAPD(err, checkDMEventNotifierL());
-        	 if(err)
-         	 {
-           		FLOG(_L("start DmEventNotifier.exe successfull"));
-         	 }
-         	 else
-           {
-           		FLOG(_L("start DmEventNotifier.exe un-successfull"));         
-         	 }
-     	 }
-       FLOG( _L( "[CFotaCustCmdAllReasons]::ExecuteL() Boot reason AllReason END " ) );      
-    }
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::ExecuteCancel
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdAllReasons::ExecuteCancel()
-    {
-   
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::Close
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdAllReasons::Close()
-    {
-     FLOG( _L( "[CFotaCustCmdAllReasons]::Close() " ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdAllReasons::Release
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdAllReasons::Release()
-    {
-    
-     FLOG( _L( "[CFotaCustCmdAllReasons]::Close() " ) );
-	   delete this;
-    }
-    
-    
-TBool  CFotaCustCmdAllReasons::FindScheduleL()
-{
-	FLOG( _L( "[CFotaCustCmdAllReasons]::FindScheduleL()BEGIN " ) );
-	TScheduleEntryInfo2                     ret;    
-	RScheduler                              sc;
-	
-	TTsTime                                 time;
-	TSchedulerItemRef                       scitem; 
-	CArrayFixFlat<TSchedulerItemRef>*     	aSchRefArray = new CArrayFixFlat <TSchedulerItemRef>(5);
-	TScheduleFilter                      	aFilter(EAllSchedules);
-	User::LeaveIfError( sc.Connect() );                             // xx
-	CleanupClosePushL( sc );
-	CleanupStack::PushL(aSchRefArray);
-
-	User::LeaveIfError( sc.GetScheduleRefsL( *aSchRefArray,aFilter) );  // xx
-	FLOG(_L("Schedule items: "));
-	for ( TInt i=0; i<aSchRefArray->Count(); ++i  )
-		{
-		  TSchedulerItemRef it = (*aSchRefArray)[i];
-		 if ( it.iName == TUid::Uid(KFotaServerUid).Name()  )
-	   {
-	   	  	 
-	   	  	 	CleanupStack::PopAndDestroy(aSchRefArray);  
-                CleanupStack::PopAndDestroy(&sc);
-	   	  	 	return ETrue;
-	  	
-	   }
-     }
-                 CleanupStack::PopAndDestroy(aSchRefArray);
-                 CleanupStack::PopAndDestroy(&sc);
-     FLOG( _L( "[CFotaCustCmdAllReasons]::FindScheduleL()END " ) );            
-                 return EFalse; 
-}
-
-
-void CFotaCustCmdAllReasons::checkDMEventNotifierL()
-{
-    FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - started"));
- 
-    const TUid KAppDmEventNotifierUid = TUid::Uid(KAppUidDmEventNotifier); //UID3 from .mmp file
-    CRepository* cenrep (NULL);
-    cenrep = CRepository::NewLC( KAppDmEventNotifierUid );
-    TInt value (KErrNone);
-    TBool tocontinue (EFalse);
-
-    FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for cenrep KDmEventNotifierEnabled"));
-    if ( ((cenrep->Get(KDmEventNotifierEnabled,value)) == KErrNone )
-            && (EHandlerRegistered == value || EHandlerNeedRegister == value )) // v alue != EHandlerNotRegistered 
-    {
-//        FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled exist, value = (%d) "), value);
-				FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled exist"));
-        tocontinue = ETrue;
-    }
-    else
-    {
-        //Log errors
-//        FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for cenrep KDmEventNotifierEnabled does not exist: error: (%d) "), err);
-				FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled does not exist or already registered"));
-        //delete cenrep; cenrep = NULL;
-        CleanupStack::PopAndDestroy(); // cenrep
-        return;
-    }
-    
-    TInt pMmcstatus = KErrNotFound;
-    TInt ret = RProperty::Get(KPSUidUikon, KUikMMCInserted, pMmcstatus);
-//    FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for present Memory status: ret = (%d) , MMCStatus = (%d) "), ret, pMmcStatus);
-		FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for memory status"));
-    if(!ret)
-    {
-
-        TInt sMMCStatus (KErrNotFound);
-        TInt error = cenrep->Get(KMMCStatus, sMMCStatus);
-				CleanupStack::PopAndDestroy(); // cenrep
-
-        //FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for previous Memory status, before phone off: error = (%d) , sMMCStatus = (%d) "), error, sMMCStatus);
-        if(error)
-        {
-        		FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - Error in memory status get"));
-            //CleanupStack::PopAndDestroy(); // cenrep
-            return;    
-        }
-        if (pMmcstatus == sMMCStatus && tocontinue) // if sMMCStatus is 0 && pMMCStatus is 0. Or sMMCStatus is 1 && pMMCStatus is 1
-        {
-        //start the dm event notifier
-                
-            RApaLsSession apaLsSession;
-            User :: LeaveIfError(apaLsSession.Connect());
-            TApaAppInfo appInfo;
-            FLOG(_L("RApaLsSession connection successful"));
-            FLOG(_L("Running dmeventnotifier.exe"));
-                    
-            _LIT(KExampleTaskHandlerExe, "dmeventnotifier.exe");
-        
-            appInfo.iFullName = KExampleTaskHandlerExe;
-            CApaCommandLine* cmdLine  = CApaCommandLine::NewLC();
-            cmdLine->SetExecutableNameL( appInfo.iFullName );
-            TBuf<KMaxFileName> temp;
-            temp.Copy (appInfo.iFullName);
-            TInt err = apaLsSession.StartApp(*cmdLine);
-            
-            User :: LeaveIfError(err);
-            CleanupStack :: PopAndDestroy(cmdLine);
-            apaLsSession.Close();
-            FLOG(_L("started dmeventnotifier.exe successfully"));
-        }
-    }
-    //CleanupStack::PopAndDestroy(); // cenrep
-    FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - ended"));
-}
--- a/fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdfirmwareupdate.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Implementation of CFotaCustCmdFirmwareUpdate class.
-*
-*/
-
-#include "fotacustcmdfirmwareupdate.h"
-#ifdef __SYNCML_DM_FOTA
-#include <fotaengine.h>
-#include "fmsclient.h"
-#include "fotaserverPrivateCRKeys.h"
-#include "FotaIPCTypes.h"
-#include "fmsclientserver.h"
-#endif
-#include "fotastartupDebug.h"
-#include <centralrepository.h>
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::NewL
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdFirmwareUpdate* CFotaCustCmdFirmwareUpdate::NewL()
-	{
-    FLOG( _L( "CFotaCustCmdFirmwareUpdate::NewL()  " ) );
-	return new ( ELeave ) CFotaCustCmdFirmwareUpdate;
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate()
-    {
-     FLOG( _L( "CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate()  " ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::Initialize
-// ---------------------------------------------------------------------------
-//
-TInt CFotaCustCmdFirmwareUpdate::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ )
-    {
-    
-     FLOG( _L( "CFotaCustCmdFirmwareUpdate::Initialize()  " ) );
-    
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::Execute
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirmwareUpdate::Execute(
-    const TDesC8& /*aParams*/,
-    TRequestStatus& aRequest )
-    {
-     aRequest = KRequestPending;
-       FLOG( _L( "CFotaCustCmdFirmwareUpdate::Execute() BEGIN " ) );
-     #ifdef __SYNCML_DM_FOTA
-     TRAP_IGNORE(ExecuteL());
-     #endif
-     TRequestStatus* request = &aRequest;
-     User::RequestComplete( request, KErrNone );
-     FLOG( _L( "CFotaCustCmdFirmwareUpdate::Execute() END " ) );
-     
-
-    }
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::ExecuteL
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirmwareUpdate::ExecuteL( )
-    
-   {
-   	FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteL( ) Boot reason KFirmwareUpdateReason BEGIN " ) );
-
-    CRepository*    centrep( NULL);
-    RFotaEngineSession fotaEngine;
-    TInt err= KErrNone;
-    TRAP( err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-    TInt sendGAAfterrebootfeature = 0;
-    	if( err == KErrNone && centrep )
-    	{
-    	  err = centrep->Get(  KGenericAlertResendAfterBoot, sendGAAfterrebootfeature );
-    	}
-    	 FTRACE(RDebug::Print(_L("[CFotaCustCmdFirmwareUpdate] feature sendGenericAlert is %d"), sendGAAfterrebootfeature));        
-        if( sendGAAfterrebootfeature != 1 )
-        {
-   	        FLOG( _L( "[CFotaCustCmdFirmwareUpdate] FirmwareUpdateReason: Starting fota server  " ) );
-            TRAPD(oError,fotaEngine.OpenL());
-            if(oError == KErrNone)
-            {
-            fotaEngine.Close();
-            FLOG( _L( "[CFotaCustCmdFirmwareUpdate] FirmwareUpdateReason: Closing fota server  " ) );
-            }
-       
-        }
-        
-        if(centrep)
-        {
-        	delete centrep;
-        }
-    
-  	FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteL( ) Boot reason KFirmwareUpdateReason END " ) );
-
-   }
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::ExecuteCancel
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirmwareUpdate::ExecuteCancel()
-    {
-  
-      FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteCancel() " ) );
-    
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::Close
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirmwareUpdate::Close()
-    {
-    
-       FLOG( _L( "CFotaCustCmdFirmwareUpdate::Close() " ) );
-    
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirmwareUpdate::Release
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirmwareUpdate::Release()
-    {
-    FLOG( _L( "CFotaCustCmdFirmwareUpdate::Release() " ) );
-
-	delete this;
-    }
--- a/fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdfirstboot.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Implementation of CFotaCustCmdFirstBoot class.
-*
-*/
-
-#include "fotacustcmdfirstboot.h"
-#include "fotastartupDebug.h"
-//#include "trace.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::NewL
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdFirstBoot* CFotaCustCmdFirstBoot::NewL()
-	{
-   FLOG( _L( "[CFotaCustCmdFirstBoot::NewL()  " ) );
-	return new ( ELeave ) CFotaCustCmdFirstBoot;
-	}
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot
-// ---------------------------------------------------------------------------
-//
-CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot()
-    {
-      FLOG( _L( "[CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot()  " ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::Initialize
-// ---------------------------------------------------------------------------
-//
-TInt CFotaCustCmdFirstBoot::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ )
-    {
-  
-  FLOG( _L( "[CFotaCustCmdFirstBoot::Initialize()  " ) );
-
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::Execute
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirstBoot::Execute(
-    const TDesC8& /*aParams*/,
-    TRequestStatus& aRequest )
-    {
-    	     aRequest = KRequestPending;
-   FLOG( _L( "[CFotaCustCmdFirstBoot::Execute()  " ) );
-    #ifdef __PLUG_AND_PLAY_MOBILE_SERVICES 
-      FLOG( _L( "NOTHING TO DO   " ) );
-    #endif
-      TRequestStatus* request = &aRequest;
-      User::RequestComplete( request, KErrNone );
-
-    
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::ExecuteCancel
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirstBoot::ExecuteCancel()
-    {
-      FLOG( _L( "[CFotaCustCmdFirstBoot::ExecuteCancel()  " ) );
-
-    
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::Close
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirstBoot::Close()
-    {
-     FLOG( _L( "[CFotaCustCmdFirstBoot::Close()  " ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CFotaCustCmdFirstBoot::Release
-// ---------------------------------------------------------------------------
-//
-void CFotaCustCmdFirstBoot::Release()
-    {
-     FLOG( _L( "[CFotaCustCmdFirstBoot::Release()  " ) );
-
-	delete this;
-    }
--- a/fotaapplication/fotaserver/fotacustcmds/src/fotacustcmdsfactory.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Implementation of FotaCustCmdsFactory class.
-*
-*/
-
-#include "fotacustcmdsfactory.h"
-#include "fotacustcmdallreasons.h"
-#include "fotacustcmdfirmwareupdate.h"
-#include "fotacustcmdfirstboot.h"
-#include "fotastartupDebug.h"
-//#include "trace.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL()
-    {
-   FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL() " ) );
-
-    return CFotaCustCmdAllReasons::NewL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL()
-    {
-    FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL() " ) );
-    return CFotaCustCmdFirmwareUpdate::NewL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// FotaCustCmdsFactory::FotaCustCmdFirstBootNewL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdFirstBootNewL()
-    {
-   
-    FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdFirstBootNewL() " ) );
-    return CFotaCustCmdFirstBoot::NewL();
-    }
--- a/fotaapplication/fotaserver/group/bld.inf	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   This file provides the information required for building fotaserver
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-
-PRJ_EXPORTS
-../rom/fotaserver.iby																							CORE_MW_LAYER_IBY_EXPORT_PATH(fotaserver.iby)
-../rom/fotaserverresources.iby																		LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(fotaserverresources.iby)
-
-../FotaServer/loc/fotaserver.loc																	MW_LAYER_LOC_EXPORT_PATH(fotaserver.loc)
-
-// Generic configuration interface for component cenrep settings  
-../conf/fotadiskstorage.confml                    MW_LAYER_CONFML(fotadiskstorage.confml)
-../conf/fotadiskstorage_102072C6.crml 	        MW_LAYER_CRML(fotadiskstorage_102072C6.crml)
-../conf/fotaserver.confml                    MW_LAYER_CONFML(fotaserver.confml)
-../conf/fotaserver_102072C4.crml 	        MW_LAYER_CRML(fotaserver_102072C4.crml)
-
-PRJ_EXTENSIONS
-START EXTENSION s60/mifconv
-  OPTION TARGETFILE fotaserver.mif
-  OPTION HEADERFILE fotaserver.mbg
-  OPTION SOURCES \
-	  -c8,8 qgn_prop_sml_http -c8,8 qgn_prop_sml_http_off -c8,8 qgn_prop_sml_bt \
-	  -c8,8 qgn_prop_sml_bt_off -c8,8 qgn_prop_sml_usb -c8,8 qgn_prop_sml_usb_off \
-	  -c8,8 qgn_menu_dm_cxt -c8,8 qgn_menu_dm_disabled_cxt -c8,8 qgn_note_sml \
-	  -c8,8 qgn_note_sml_server	  
-END
-
-START EXTENSION s60/mifconv
-  OPTION TARGETFILE fotaserver_aif.mif
-  OPTION SOURCES -c8,8 qgn_menu_dm
-END
-
-
-PRJ_MMPFILES
-/*
-gnumakefile fota_icons_dc.mk
-
-#ifdef __SCALABLE_ICONS
-gnumakefile fota_icons_aif_scalable_dc.mk
-#else
-gnumakefile fota_icons_aif_bitmaps_dc.mk
-#endif
-*/
-
-#ifdef __SYNCML_DM_FOTA
-../FotaEngine/group/fotaengine.mmp
-../fmsclient/group/fmsclient.mmp
-../FotaServer/group/fotaserver.mmp
-../FotaStorage/group/fotadiskstorage.mmp
-../FotaRfsPlugin/group/RfsFotaPlugin.mmp
-../fmserver/group/fmsserver.mmp
-
-../FotaScheduleHandler/group/fotaschedulehandler.mmp
-
-
-
-#endif
--- a/fotaapplication/fotaserver/group/fota_icons_aif_scalable_dc.mk	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#
-# Copyright (c) 2004 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"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Implementation of fotaserver component
-# 	This is part of fotaapplication.
-#
-
-ifeq (WINS,$(findstring WINS, $(PLATFORM)))
-ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
-else
-ZDIR=\epoc32\data\z
-endif
-
-# ----------------------------------------------------------------------------
-# Configure these
-# ----------------------------------------------------------------------------
-
-TARGETDIR=$(ZDIR)\RESOURCE\APPS
-ICONTARGETFILENAME=$(TARGETDIR)\fotaserver_aif.mif
-
-do_nothing :
-	@rem do_nothing
-
-MAKMAKE : do_nothing
-
-BLD : do_nothing
-
-CLEAN : do_nothing
-
-LIB : do_nothing
-
-CLEANLIB : do_nothing
-
-# ----------------------------------------------------------------------------
-# Configure these.
-#
-# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
-# MifConv if the mask detph is defined.
-#
-# NOTE 2: Usually, source paths should not be included in the bitmap
-# definitions. MifConv searches for the icons in all icon directories in a
-# predefined order, which is currently \s60\icons, \s60\bitmaps2.
-# The directory \s60\icons is included in the search only if the feature flag
-# __SCALABLE_ICONS is defined.
-# ----------------------------------------------------------------------------
-
-RESOURCE :
-	mifconv $(ICONTARGETFILENAME) \
-		/c8,8 qgn_menu_dm.svg
-
-FREEZE : do_nothing
-
-SAVESPACE : do_nothing
-
-RELEASABLES :
-	@echo $(ICONTARGETFILENAME)
-
-FINAL : do_nothing
-  
\ No newline at end of file
--- a/fotaapplication/fotaserver/group/fota_icons_dc.mk	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#
-# Copyright (c) 2004 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"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Implementation of fotaserver component
-# 	This is part of fotaapplication.
-#
-
-
-ifeq (WINS,$(findstring WINS, $(PLATFORM)))
-ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
-else
-ZDIR=\epoc32\data\z
-endif
-
-TARGETDIR=$(ZDIR)\resource\apps
-HEADERDIR=\epoc32\include
-ICONTARGETFILENAME=$(TARGETDIR)\fotaserver.mif
-HEADERFILENAME=$(HEADERDIR)\fotaserver.mbg
-
-
-do_nothing : 
-	@rem do_nothing
-
-MAKMAKE : do_nothing
-
-BLD : do_nothing
-
-CLEAN : do_nothing
-
-LIB : do_nothing
-
-CLEANLIB : do_nothing
-
-RESOURCE :
-	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
-	/c8,8 qgn_prop_sml_http.bmp \
-	/c8,8 qgn_prop_sml_http_off.bmp \
-	/c8,8 qgn_prop_sml_bt.bmp \
-	/c8,8 qgn_prop_sml_bt_off.bmp \
-	/c8,8 qgn_prop_sml_usb.bmp \
-	/c8,8 qgn_prop_sml_usb_off.bmp \
-	/c8,8 qgn_menu_dm_cxt.bmp \
-	/c8,8 qgn_menu_dm_disabled_cxt.bmp \
-	/c8,8 qgn_note_sml.bmp \
-	/c8,8 qgn_note_sml_server.bmp	
-	
-
-FREEZE : do_nothing
-
-SAVESPACE : do_nothing
-
-RELEASABLES :
-	@echo $(HEADERFILENAME)&& \
-	@echo $(ICONTARGETFILENAME)
-
-FINAL : do_nothing
--- a/fotaapplication/fotaserver/inc/FotaIPCTypes.cpp	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   interprocess messages
-*
-*/
-
-
-
-// INCLUDES
-#include "FotaIPCTypes.h"
-#include <centralrepository.h>
-#include "fotaserverPrivateCRKeys.h"
-
-// ======================= MEMBER FUNCTIONS ==================================
-
-// ---------------------------------------------------------------------------
-// TDownloadIPCParams::TDownloadIPCParams 
-// ---------------------------------------------------------------------------
-TDownloadIPCParams::TDownloadIPCParams () : iPkgId(-1),iProfileId(0)
-        , iSendAlert(ETrue)
-        , iIapId(-1), iPkgSize(0), iSessionType(0), iUpdateLtr (0)
-{
-    iPkgName        = KNullDesC8;
-    iPkgVersion     = KNullDesC8;
-}
-
-// ---------------------------------------------------------------------------
-// TDownloadIPCParams::TDownloadIPCParams 
-// ---------------------------------------------------------------------------
-TDownloadIPCParams::TDownloadIPCParams (const TDownloadIPCParams& p )
-                           : iPkgId ( p.iPkgId ), iProfileId (p.iProfileId )
-                           , iSendAlert( p.iSendAlert )
-                           , iIapId(p.iIapId), iPkgSize(p.iPkgSize), iSessionType(p.iSessionType), iUpdateLtr (p.iUpdateLtr)
-    {
-    iPkgName        = p.iPkgName;
-    iPkgVersion     = p.iPkgVersion;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::TPackageState
-// ---------------------------------------------------------------------------
-TPackageState::TPackageState( RFotaEngineSession::TState aState, TInt aResult)
-    : TDownloadIPCParams (),  iState(aState), iResult(aResult)
-    						,iSmlTryCount( KDefaultSmlTryCount )
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::TPackageState
-// ---------------------------------------------------------------------------
-TPackageState::TPackageState( RFotaEngineSession::TState aState) 
-    : TDownloadIPCParams (), iState(aState), iResult(-1) 
-    						,iSmlTryCount( KDefaultSmlTryCount )
-    {
-	SetSmlTryCount();
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::TPackageState
-// ---------------------------------------------------------------------------
-TPackageState::TPackageState( TDownloadIPCParams p) : 
-    TDownloadIPCParams(p),iState(RFotaEngineSession::EIdle), iResult(-1)
-    					 ,iSmlTryCount( KDefaultSmlTryCount )
-    {  
-    SetSmlTryCount();
-    
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::TPackageState
-// ---------------------------------------------------------------------------
-TPackageState::TPackageState() : TDownloadIPCParams () 
-            ,iState(RFotaEngineSession::EIdle), iResult(-1)
-            ,iSmlTryCount( KDefaultSmlTryCount )
-    {
-    SetSmlTryCount();
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::SetSmlTryCount()
-// ---------------------------------------------------------------------------
-void TPackageState::SetSmlTryCount()
-{
-	 TInt err = KErrNone;
-	 TInt retry = 0;
-	 CRepository *centrep = NULL;
-      TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) );
-    	    if ( centrep ) 
-        	{
-        	err = centrep->Get( KGenericAlertRetries, retry );
-        	delete centrep; centrep = NULL;
-        	}
-        	if(err == KErrNone)
-        	{
-        		
-            	    if(retry < 0 )
-            	    {
-            	    iSmlTryCount = KDefaultSmlTryCount;
-            	    }
-                  	else if( retry == 0 )
-               	    {
-               	     iSmlTryCount = 2 ;
-               	    }
-                	else if (retry > KMaximumSmlTryCount )
-               	    {
-               	     iSmlTryCount = KMaximumSmlTryCount + 1;
-               	    }
-                   	else
-                    {
-                	  iSmlTryCount = retry + 1;
-                    }
-        	    }
-        	 else
-        	    {
-        	    iSmlTryCount = KDefaultSmlTryCount;
-        	    }
-}
-// ---------------------------------------------------------------------------
-// TPackageState::ExternalizeL 
-// ---------------------------------------------------------------------------
-void TPackageState::ExternalizeL ( RWriteStream& aStream )
-    {
-    aStream.WriteInt16L (iState); aStream.WriteInt16L (iResult); 
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::InternalizeL
-// ---------------------------------------------------------------------------
-void TPackageState::InternalizeL(RReadStream& /*aStream*/) 
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::operator=
-// ---------------------------------------------------------------------------
-TPackageState& TPackageState::operator= ( const TDownloadIPCParams& a )
-    {
-    iPkgId      = a.iPkgId;
-    iProfileId  = a.iProfileId;
-    iPkgName    = a.iPkgName;
-    iPkgVersion = a.iPkgVersion;
-    iIapId		= a.iIapId;
-    iPkgSize	= a.iPkgSize;
-    iSessionType= a.iSessionType;
-    iUpdateLtr 	= a.iUpdateLtr;
-
-    return *this;
-    }
-
-
-// ---------------------------------------------------------------------------
-// TPackageState::operator=
-// ---------------------------------------------------------------------------
-TPackageState& TPackageState::operator=(const TPackageState& a)
-    {
-    iPkgId      = a.iPkgId; 
-    iProfileId  = a.iProfileId; 
-    iPkgName    = a.iPkgName; 
-    iPkgVersion = a.iPkgVersion;
-    iIapId		= a.iIapId;
-    iPkgSize	= a.iPkgSize;
-    iSessionType= a.iSessionType;
-    iUpdateLtr	= a.iUpdateLtr;
-    iState      = a.iState;  
-    iResult     = a.iResult;
-    iSmlTryCount= a.iSmlTryCount;
-    return *this;
-    }
- 
-            
-// End of File
--- a/fotaapplication/fotaserver/inc/FotaIPCTypes.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-
-
-#ifndef __FOTAIPCTYPES_H_
-#define __FOTAIPCTYPES_H_
-
-// INCLUDES 
-#include <e32std.h>
-#include <SyncMLDef.h>
-#include "fotaengine.h"
-
-// DATA TYPES
-typedef TBuf16<200> TPkgIdList;
-
-/**
- *  Inter process parameters for fotaserver
- *
- *  @lib    fotaengine.lib
- *  @since  S60 v3.1
- */
-class TDownloadIPCParams
-    {
-
-public:
-    TDownloadIPCParams (); 
-
-
-    /**
-     * Copy constructor.
-     *
-     * @since   S60 v3.1
-     * @param   p Copy of another ipc
-     * @return  None
-    */
-    TDownloadIPCParams (const TDownloadIPCParams& p ); 
-
-
-    /**
-     * Package id
-     */
-    TInt                            iPkgId;
-    
-    /**
-     * Profile id
-     */
-    TSmlProfileId                   iProfileId;
-
-    
-    /**
-     * Package name
-     */
-    TBuf8<KFotaMaxPkgNameLength>    iPkgName;
-
-    
-    /**
-     * Package version
-     */
-    TBuf8<KFotaMaxPkgVersionLength> iPkgVersion;
-
-
-    /**
-     * Should DM server be notified via generic alert.
-     * This is not saved to database!
-     */
-    TBool iSendAlert;
-
-
-    /**
-     * IAP Id used
-     */
-    TInt iIapId;
-
-    /**
-     * Total size of the package
-     */
-    TUint iPkgSize;
-
-
-    /**
-     * DM Session type
-     */
-    TInt iSessionType;
-
-
-    /**
-     * Should update happen later?
-     */
-    TBool iUpdateLtr;
-    };
-
-
-/**
- *  Extended inter process parameters for fotaserver
- *
- *  @lib    fotaengine.lib
- *  @since  S60 v3.1
- */
-class TPackageState : public TDownloadIPCParams
-    {
-
-public:
-
-
-    /**
-     * Constructor
-     *
-     * @since   S60 v3.1
-     * @param   aState  State
-     * @param   aResult Result
-     * @return  None
-    */
-    TPackageState( RFotaEngineSession::TState aState, TInt aResult);
-    
-
-    /**
-     * Constructor
-     *
-     * @since   S60 v3.1
-     * @param   aState  State
-     * @return  None
-    */
-    TPackageState( RFotaEngineSession::TState aState);
-
-
-    /**
-     * Constructor
-     *
-     * @since   S60 v3.1
-     * @param   p  Ipc params
-     * @return  None
-    */
-    TPackageState( TDownloadIPCParams p);
-
-    TPackageState();
-
-    /**
-     * Externalizes class to a stream
-     *
-     * @since   S60 v3.1
-     * @param   aStream Target stream
-     * @return  None
-    */
-    void ExternalizeL (RWriteStream& aStream);
-
-
-    /**
-     * Externalizes class from a stream
-     *
-     * @since   S60 v3.1
-     * @param   aStream Source stream
-     * @return  None
-    */
-    void InternalizeL(RReadStream& /*aStream*/);
-
-
-    /**
-     * Assignment operator
-     *
-     * @since   S60 v3.1
-     * @param   a  Source 
-     * @return  None
-    */
-    TPackageState& operator=(const TDownloadIPCParams& a);
-
-
-    /**
-     * Assignment operator
-     *
-     * @since   S60 v3.1
-     * @param   a  Source 
-     * @return  None
-    */
-    TPackageState& operator=(const TPackageState& a);
-
-
-public:
-
-    /**
-     * State (see FUMO specification)
-     */
-    RFotaEngineSession::TState  iState;
-
-
-    /**
-     * Result code (FUMO)
-     */
-    TInt iResult;
-
-    /**
-     * Counter for generic alert raporting. If raporting fails, try again in
-     * successive boots until counter runs to 0
-     */
-    TInt iSmlTryCount;
-
-private :
-	/*
-	* Method to set the iSmlTryCount depending on Cenrep settings
-	*/
-	void SetSmlTryCount();
-};
-
-
-
-/**
- *  Update reminder task
- *
- *  @lib    fotaengine.lib
- *  @since  S60 v3.1
- */
-class TFotaScheduledUpdate
-{
-    public:
-    TFotaScheduledUpdate(const TInt aPkgId, const TInt aScheduleId)
-        {
-        iPkgId      = aPkgId;
-        iScheduleId = aScheduleId;
-        }
-
-    TInt                            iPkgId;
-
-    TInt                            iScheduleId;
-};
-
-#endif      // __FOTAIPCTYPES_H_   
-            
-// End of File
--- a/fotaapplication/fotaserver/inc/fmsclientserver.h	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2009 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of fotaserver component
-* 	This is part of fotaapplication.
-*
-*/
-
-// FMSClientServer.h
-//
-//
-#ifndef __FMS_CLIENTSERVER_H__
-#define  __FMS_CLIENTSERVER_H__
-
-#include <e32std.h>
-#include <e32base.h>
-#include <f32file.h>
-// server name
-
-_LIT(KFMSServerName,"FMSServer");
-
-//const TUid KFMSServerUid={0x200100C8}; //To be moved to fotaconst.h
-
-enum TOmaDLInterruptReason
-{
-	EUserInterrupt,
-	ENetworkInterrupt,
-	EMemoryInterrupt,
-	EGeneralInterrupt	
-#ifdef __WINS__
-	,ELaunchFota = 6
-#endif	
-};
-
-enum TFMSLaunch //Proper name will be provided later
-{
-	EFotaStartUpPlugin = 4, //as continuation to upper enums
-	ECancelOutstandingRequest
-};
-
-enum TOmaUpdInterruptReason
-{
-	ENoUpdInterrupt=7,
-	EMonitorbattery, 
-    EPhoneCallActive,
-	EMonitorPhoneCallEnd
-};
-#endif
\ No newline at end of file
--- a/fotaapplication/fotaserver/rom/fotaserver.iby	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Image description file for project fotaserver
-*
-*/
-
-
-
-#ifndef ___FOTASERVER_IBY__
-#define ___FOTASERVER_IBY__
-
-
-#ifdef __SYNCML_DM_FOTA
-
-file=ABI_DIR\BUILD_DIR\fotaengine.dll    SHARED_LIB_DIR\fotaengine.dll
-file=ABI_DIR\BUILD_DIR\FMSClient.dll    SHARED_LIB_DIR\FMSClient.dll
-
-S60_APP_EXE(fotaserver)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,fotaserver)
-S60_APP_AIF_ICONS(fotaserver)
-S60_APP_AIF_RSC(fotaserver)
-
-
-file=ABI_DIR\BUILD_DIR\fotaschedulehandler.exe    PROGRAMS_DIR\fotaschedulehandler.exe
-file=ABI_DIR\BUILD_DIR\FMSServer.exe    PROGRAMS_DIR\FMSServer.exe
-
-ECOM_PLUGIN(fotadiskstorage.dll,fotadiskstorage.rsc)
-ECOM_PLUGIN(RfsFotaPlugin.dll,  RfsFotaPlugin.RSC)
-
-#if ( defined (__SYNCML_DM ) || defined (__PLUG_AND_PLAY_MOBILE_SERVICES) )
-
-file=ABI_DIR\BUILD_DIR\fotacustcmds.dll SHARED_LIB_DIR\fotacustcmds.dll
-
-#endif // __SYNCML_DM || __PLUG_AND_PLAY_MOBILE_SERVICES
-
-#endif // __SYNCML_DM_FOTA
-
-#endif
--- a/fotaapplication/fotaserver/rom/fotaserverresources.iby	Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2005-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Image description file for project fotaserver
-*
-*/
-
-
-
-#ifndef ___FOTASERVERRESOURCES_IBY__
-#define ___FOTASERVERRESOURCES_IBY__
-
-#ifdef __SYNCML_DM_FOTA
-S60_APP_RESOURCE(fotaserver)
-#endif // __SYNCML_DM_FOTA
-
-#endif