fotaapplication/fotaserver/FotaServer/src/fotadownload.cpp
branchRCL_3
changeset 59 13d7c31c74e0
parent 58 4af31167ea77
equal deleted inserted replaced
58:4af31167ea77 59:13d7c31c74e0
    45 #include "FotaSrvApp.h"
    45 #include "FotaSrvApp.h"
    46 #include "fotadownload.h"
    46 #include "fotadownload.h"
    47 #include "fotaserverPrivatePSKeys.h"
    47 #include "fotaserverPrivatePSKeys.h"
    48 #include "FotaNetworkRegStatus.h"
    48 #include "FotaNetworkRegStatus.h"
    49 #include <startupdomainpskeys.h>	//globalrfsstates
    49 #include <startupdomainpskeys.h>	//globalrfsstates
       
    50 #include <uri8.h>
    50 #define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
    51 #define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
    51 #define __LEAVE(x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
    52 #define __LEAVE(x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); }
    52 
    53 
    53 
    54 
    54 // --------------------------------------------------------------------------
    55 // --------------------------------------------------------------------------
   292 		User::LeaveIfError(err);
   293 		User::LeaveIfError(err);
   293 		}
   294 		}
   294 
   295 
   295 	if ( iUrl ) {delete iUrl; iUrl=NULL;}
   296 	if ( iUrl ) {delete iUrl; iUrl=NULL;}
   296 	iUrl = aPkgURL.Alloc();
   297 	iUrl = aPkgURL.Alloc();
   297 	iUpdateAfterDownload = aUpdateAfterDownload;
   298 	
   298 	iRestartCounter = aRestartDownload;
   299 	iRestartCounter = aRestartDownload;
   299 
   300 
   300 	iDLState        = aParams;
   301 	iDLState        = aParams;
   301 	FLOG(_L("CFotaDownload::DownloadL, Stage 1") );
   302 	FLOG(_L("CFotaDownload::DownloadL, Stage 1") );
   302 
   303 
   311 	iFotaServer->iDatabase->CloseAndCommitDB();
   312 	iFotaServer->iDatabase->CloseAndCommitDB();
   312 	FLOG(_L("CFotaDownload::DownloadL, Stage 2, pkgid:%d"),iDLState.iPkgId);
   313 	FLOG(_L("CFotaDownload::DownloadL, Stage 2, pkgid:%d"),iDLState.iPkgId);
   313 
   314 
   314 	// 2. Get Iap Id to use for download. This would be set in iDLState.iIapId.
   315 	// 2. Get Iap Id to use for download. This would be set in iDLState.iIapId.
   315 	SetIapToUseL(aParams, aIapid);
   316 	SetIapToUseL(aParams, aIapid);
       
   317 
       
   318 
       
   319 	if ( iDLState.iIapId > KErrNotFound )
       
   320 		{
       
   321 		iFotaServer->iDatabase->OpenDBL();
       
   322 		iFotaServer->iDatabase->SetStateL(iDLState,KNullDesC8, EFDBIapId );
       
   323 		iFotaServer->iDatabase->CloseAndCommitDB();
       
   324 		}
       
   325 		
       
   326 	/*
       
   327 	TBuf8<100> test;
       
   328 	//_LIT8( KNSmlDMFotaNode,"http://2IND02230.noe.nokia.com8080/myspace/ddv1.dd" );
       
   329 	_LIT8( KNSmlDMFotaNode,"http://fdsqa.nokia.com/fdp/interface?fid=A0A19HMCUHWRU" );
       
   330 	test.Copy(KNSmlDMFotaNode);
       
   331 	
       
   332 	
       
   333     TUriParser8 parser;
       
   334 
       
   335     if (!parser.Parse(test) && !parser.IsSchemeValid()) */ 
       
   336 		
       
   337 	TUriParser8 parser;
       
   338 	
       
   339 	
       
   340 
       
   341     if((parser.Parse(aPkgURL) == KErrNone) && !parser.IsSchemeValid() )
       
   342 	
       
   343 	{
       
   344         FLOG(_L("URL is malformed.. finalizing download"));
       
   345         iDLState.iResult = RFotaEngineSession::EResMalformedOrBadURL;
       
   346         iDLState.iState  = RFotaEngineSession::EDownloadFailed;
       
   347         iFotaServer->iDatabase->OpenDBL();
       
   348         iFotaServer->iDatabase->SetStateL(iDLState, KNullDesC8, EFDBState | EFDBResult);
       
   349         iFotaServer->iDatabase->CloseAndCommitDB();
       
   350         iFotaServer->FinalizeDownloadL(iDLState);
       
   351         LaunchNotifierL(ESyncMLFwUpdErrorNote, KErrGeneralNoResume, EFalse );
       
   352         return;
       
   353 	}
       
   354 	iUpdateAfterDownload = aUpdateAfterDownload;
   316 
   355 
   317 	// 3. Determine whether download should be visible or not
   356 	// 3. Determine whether download should be visible or not
   318 	// Autoaccepted profile?
   357 	// Autoaccepted profile?
   319 
   358 
   320 	SetDownloadUiBehavior(ETrue);
   359 	SetDownloadUiBehavior(ETrue);