fotaapplication/fotaserver/src/FotaDlMgrClient.cpp
changeset 73 ae69c2e8bc34
parent 51 2e64dc50f295
equal deleted inserted replaced
71:d2517372cc44 73:ae69c2e8bc34
    34 //  Two phase construction
    34 //  Two phase construction
    35 // --------------------------------------------------------------------------
    35 // --------------------------------------------------------------------------
    36 DownloadManagerClient* DownloadManagerClient::NewL(CFotaServer* aServer)
    36 DownloadManagerClient* DownloadManagerClient::NewL(CFotaServer* aServer)
    37     {
    37     {
    38     DownloadManagerClient* self = new (ELeave) DownloadManagerClient(aServer);
    38     DownloadManagerClient* self = new (ELeave) DownloadManagerClient(aServer);
       
    39     CleanupStack::PushL( self );
    39     self->ConstructL();
    40     self->ConstructL();
       
    41     CleanupStack::Pop(self);
    40     return self;
    42     return self;
    41     }
    43     }
    42 
    44 
    43 // --------------------------------------------------------------------------
    45 // --------------------------------------------------------------------------
    44 //  The constructor
    46 //  The constructor
    66 
    68 
    67     UninitDownloadMgr(); //Closes the RFs session and iDownloadManager.
    69     UninitDownloadMgr(); //Closes the RFs session and iDownloadManager.
    68 
    70 
    69     iFs.Close();
    71     iFs.Close();
    70     
    72     
    71     	/*
    73 
       
    74     
       
    75     if (iNotifier)
       
    76         {
       
    77         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier >>"));
       
    78         delete iNotifier;
       
    79         iNotifier = NULL;
       
    80         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier <<"));
       
    81         }
    72     if (iNotifParams)
    82     if (iNotifParams)
    73         {
    83         {
    74         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams >>"));
    84         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams >>"));
    75         delete iNotifParams;
    85         delete iNotifParams;
    76         iNotifParams = NULL;
    86         iNotifParams = NULL;
    77         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams <<"));
    87         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams <<"));
    78         }
    88         }    
    79     if (iNotifier)
    89         
    80         {
       
    81         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier >>"));
       
    82         delete iNotifier;
       
    83         iNotifier = NULL;
       
    84         FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier <<"));
       
    85         }*/
       
    86     FLOG(_L("DownloadManagerClient::~DownloadManagerClient <<"));
    90     FLOG(_L("DownloadManagerClient::~DownloadManagerClient <<"));
    87     }
    91     }
    88 
    92 
    89 // --------------------------------------------------------------------------
    93 // --------------------------------------------------------------------------
    90 //  Two phase construction
    94 //  Two phase construction
   102         err = centrep->Get(KFotaDiskSpaceReservationKey, iReservedSize);
   106         err = centrep->Get(KFotaDiskSpaceReservationKey, iReservedSize);
   103         }
   107         }
   104 
   108 
   105     delete centrep;
   109     delete centrep;
   106     centrep = NULL;
   110     centrep = NULL;
   107 
   111     
       
   112     iNotifier = CFotaDownloadNotifHandler::NewL(this);
       
   113     
   108     __LEAVE_IF_ERROR(iFs.Connect());
   114     __LEAVE_IF_ERROR(iFs.Connect());
   109 
   115 
   110     iProgress = EFalse;
   116     iProgress = EFalse;
   111 
   117 
   112     FLOG(_L("DownloadManagerClient::ConstructL, reservation needed is %d <<"),iReservedSize);
   118     FLOG(_L("DownloadManagerClient::ConstructL, reservation needed is %d <<"),iReservedSize);
   658     else if (err0 >= ConnectionFailed && err0 <= TransactionFailed)
   664     else if (err0 >= ConnectionFailed && err0 <= TransactionFailed)
   659         {
   665         {
   660         //No network coverage
   666         //No network coverage
   661         iFotaServer->iPackageState.iResult
   667         iFotaServer->iPackageState.iResult
   662                 = RFotaEngineSession::EResDLFailDueToNWIssues;
   668                 = RFotaEngineSession::EResDLFailDueToNWIssues;
   663         }
   669         }    
   664     else if (err0 >= HttpRestartFailed && err0 <= ContentExpired)
       
   665         {
       
   666         iFotaServer->iPackageState.iResult
       
   667                 = RFotaEngineSession::EResUndefinedError;
       
   668         }
       
   669     else if (err0 == ObjectNotFound)
   670     else if (err0 == ObjectNotFound)
   670         {
   671         {
   671         iFotaServer->iPackageState.iResult
   672         iFotaServer->iPackageState.iResult
   672                 = RFotaEngineSession::EResAlternateDLServerUnavailable;
   673                 = RFotaEngineSession::EResAlternateDLServerUnavailable;
   673         }
   674         }
  1009         TInt aValue)
  1010         TInt aValue)
  1010     {
  1011     {
  1011     FLOG(_L("DownloadManagerClient::ShowDialog, dialogid = %d >>"), adialogid);
  1012     FLOG(_L("DownloadManagerClient::ShowDialog, dialogid = %d >>"), adialogid);
  1012     iFotaServer->ServerCanShut(EFalse);
  1013     iFotaServer->ServerCanShut(EFalse);
  1013     if (iFotaServer->FullScreenDialog())
  1014     if (iFotaServer->FullScreenDialog())
  1014         iFotaServer->FullScreenDialog()->Close();
  1015         iFotaServer->FullScreenDialog()->close();
  1015 
  1016 
  1016     if (iFotaServer->iPackageState.iSessionType && adialogid
  1017     if (iFotaServer->iPackageState.iSessionType && adialogid
  1017             != EFwDLNeedMoreMemory)
  1018             != EFwDLNeedMoreMemory)
  1018         {
  1019         {
  1019         FLOG(_L("Differing showing dialog as session is silent."));
  1020         FLOG(_L("Differing showing dialog as session is silent."));
  1028 
  1029 
  1029     HBufC* keyParam1 = HBufC::NewL(10);
  1030     HBufC* keyParam1 = HBufC::NewL(10);
  1030     CleanupStack::PushL(keyParam1);
  1031     CleanupStack::PushL(keyParam1);
  1031     *keyParam1 = KKeyParam1;
  1032     *keyParam1 = KKeyParam1;
  1032 
  1033 
  1033     HBufC* keyParam2 = HBufC::NewL(10);
       
  1034     CleanupStack::PushL(keyParam2);
       
  1035     *keyParam2 = KKeyParam2;
       
  1036 
       
  1037     HBufC* keyParam3 = HBufC::NewL(10);
       
  1038     CleanupStack::PushL(keyParam3);
       
  1039     *keyParam3 = KKeyParam3;
       
  1040 
       
  1041     //adialogid = EFwUpdResumeUpdate;
  1034     //adialogid = EFwUpdResumeUpdate;
  1042     CHbSymbianVariant* dialogId = CHbSymbianVariant::NewL(&adialogid,
  1035     CHbSymbianVariant* dialogId = CHbSymbianVariant::NewL(&adialogid,
  1043             CHbSymbianVariant::EInt);
  1036             CHbSymbianVariant::EInt);
  1044     CleanupStack::PushL(dialogId);
  1037     //CleanupStack::PushL(dialogId);
  1045     iNotifParams->Add(*keyDialog, dialogId);
  1038     iNotifParams->Add(*keyDialog, dialogId);
  1046     iNotifier = CFotaDownloadNotifHandler::NewL(this);
  1039     
  1047 
  1040 
  1048     switch (adialogid)
  1041     switch (adialogid)
  1049         {
  1042         {
  1050         case EFwDLNeedMoreMemory: //For Flexible memory
  1043         case EFwDLNeedMoreMemory: //For Flexible memory
  1051             {
  1044             {
  1076             {
  1069             {
  1077 
  1070 
  1078             }
  1071             }
  1079             break;
  1072             break;
  1080         }
  1073         }
  1081     CleanupStack::PopAndDestroy(5);
  1074     CleanupStack::PopAndDestroy(2);
  1082 
  1075 
  1083     FLOG(_L("DownloadManagerClient::ShowDialog <<"));
  1076     FLOG(_L("DownloadManagerClient::ShowDialog <<"));
  1084     }
  1077     }
  1085 
  1078 
  1086 // --------------------------------------------------------------------------
  1079 // --------------------------------------------------------------------------