browserutilities/feedsengine/FeedsServer/Server/src/UpdateManager.cpp
branchRCL_3
changeset 37 ac77f89b1d9e
parent 10 a359256acfc6
child 46 30342f40acbf
equal deleted inserted replaced
36:c711bdda59f4 37:ac77f89b1d9e
    53     CActiveScheduler::Add(this);
    53     CActiveScheduler::Add(this);
    54     iUpdateAllFeedTask = CUpdateAllFeedsTask::NewL( iFeedsServer, iFolderListId , *this ); 
    54     iUpdateAllFeedTask = CUpdateAllFeedsTask::NewL( iFeedsServer, iFolderListId , *this ); 
    55     iLazyCaller = CIdle::NewL(CActive::EPriorityIdle );
    55     iLazyCaller = CIdle::NewL(CActive::EPriorityIdle );
    56     iHttpConnection = CServerHttpConnection::NewL( aAutoUpdateAP );
    56     iHttpConnection = CServerHttpConnection::NewL( aAutoUpdateAP );
    57     iRoamingInfo = CRoamingInfo::NewL(this);
    57     iRoamingInfo = CRoamingInfo::NewL(this);
       
    58     iRoamingInfo->IssueRequestL();
    58     iAutoUpdateAp = aAutoUpdateAP;
    59     iAutoUpdateAp = aAutoUpdateAP;
    59     iLastAutoUpdate.HomeTime();
    60     iLastAutoUpdate.HomeTime();
    60     }
    61     }
    61 
    62 
    62  // -----------------------------------------------------------------------------
    63  // -----------------------------------------------------------------------------
   137     iLastAutoUpdate.HomeTime();
   138     iLastAutoUpdate.HomeTime();
   138 
   139 
   139     if (iStatus.Int() == KErrNone || iStatus.Int() == KErrAbort)
   140     if (iStatus.Int() == KErrNone || iStatus.Int() == KErrAbort)
   140         {      
   141         {      
   141         StartTimer();
   142         StartTimer();
   142         if(iAutoUpdateWhileRoaming)
   143         if(iAutoUpdateWhileRoaming || !iRoamingInfo->Roaming())
   143             {
   144             {
   144             UpdateL();
   145             UpdateL();
   145             }
       
   146         else
       
   147             {
       
   148             iRoamingInfo->CheckForRoaming();
       
   149             }
   146             }
   150         }      
   147         }      
   151     }
   148     }
   152 
   149 
   153 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   363 // C++ default constructor can NOT contain any code that
   360 // C++ default constructor can NOT contain any code that
   364 // might leave.
   361 // might leave.
   365 // -----------------------------------------------------------------------------
   362 // -----------------------------------------------------------------------------
   366 //
   363 //
   367 CRoamingInfo::CRoamingInfo(CUpdateManager *aUpdateManager)
   364 CRoamingInfo::CRoamingInfo(CUpdateManager *aUpdateManager)
   368 	:CActive(CActive::EPriorityStandard),iUpdateManager(aUpdateManager)
   365 	:CActive(CActive::EPriorityStandard),iUpdateManager(aUpdateManager),iNetworkRegistrationV1Pckg(iNetworkRegistrationV1)
   369     {
   366     {
   370     }
   367     }
   371 
   368 
   372 // -----------------------------------------------------------------------------
   369 // -----------------------------------------------------------------------------
   373 // CRoamingInfo::~CRoamingInfo
   370 // CRoamingInfo::~CRoamingInfo
   381     delete iTelephony;
   378     delete iTelephony;
   382     iTelephony = NULL;
   379     iTelephony = NULL;
   383     }
   380     }
   384 
   381 
   385 // -----------------------------------------------------------------------------
   382 // -----------------------------------------------------------------------------
   386 // CRoamingInfo::CheckForRoaming
   383 // CRoamingInfo::Roaming
   387 // 
   384 // 
   388 // Check for roaming.
   385 // Check for roaming. Returns true if in roaming
   389 // -----------------------------------------------------------------------------
   386 // -----------------------------------------------------------------------------
   390 void CRoamingInfo::CheckForRoaming()
   387 TBool CRoamingInfo::Roaming()
   391     {
   388     {
   392 
   389     return (iNetworkRegistrationV1.iRegStatus == CTelephony::ERegisteredRoaming);	  
   393 #ifndef __WINSCW__
       
   394 
       
   395     CTelephony::TNetworkRegistrationV1Pckg RegStatusPkg(iRegStatus);
       
   396     iTelephony->GetNetworkRegistrationStatus(iStatus, RegStatusPkg);
       
   397     SetActive();
       
   398 
       
   399 #else
       
   400     TRAP_IGNORE( iUpdateManager->UpdateL() );
       
   401 #endif
       
   402     }
   390     }
   403 
   391 
   404 // -----------------------------------------------------------------------------
   392 // -----------------------------------------------------------------------------
   405 // CRoamingInfo::RunL
   393 // CRoamingInfo::RunL
   406 //
   394 //
   407 // Handles an active object's request completion event.
   395 // Handles an active object's request completion event.
   408 // -----------------------------------------------------------------------------
   396 // -----------------------------------------------------------------------------
   409 //
   397 //
   410 void CRoamingInfo::RunL()
   398 void CRoamingInfo::RunL()
   411     {  
   399     {
   412     if (iStatus.Int() == KErrNone)
   400     IssueRequestL();
   413         {
   401     }
   414         if(iRegStatus.iRegStatus != CTelephony::ERegisteredRoaming)
   402  
   415         	{
   403 // -----------------------------------------------------------------------------
   416         	iUpdateManager->UpdateL();
   404 // CRoamingInfo::IssueRequestL
   417         	}
   405 //
   418 		}
   406 // Issue the request for change in network registration
       
   407 // -----------------------------------------------------------------------------
       
   408 void CRoamingInfo::IssueRequestL()
       
   409     {   
       
   410     if (iStatus.Int() == KErrNone || iStatus.Int() == KErrAbort)
       
   411         {
       
   412         iTelephony->NotifyChange( iStatus, CTelephony::ENetworkRegistrationStatusChange,
       
   413             iNetworkRegistrationV1Pckg);
       
   414         SetActive();
       
   415         }
   419     }
   416     }
   420 
   417 
   421 // -----------------------------------------------------------------------------
   418 // -----------------------------------------------------------------------------
   422 // CRoamingInfo::DoCancel
   419 // CRoamingInfo::DoCancel
   423 //
   420 //
   424 // Implements cancellation of an outstanding request.
   421 // Implements cancellation of an outstanding request.
   425 // -----------------------------------------------------------------------------
   422 // -----------------------------------------------------------------------------
   426 //
   423 //
   427 void CRoamingInfo::DoCancel()
   424 void CRoamingInfo::DoCancel()
   428     {
   425     {
   429     iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel );
   426     iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel );
   430     }
   427     }