fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp
branchRCL_3
changeset 9 57a65a3a658c
parent 0 b497e44ab2fc
child 14 9e9792ae22e3
equal deleted inserted replaced
5:3f7d9dbe57c8 9:57a65a3a658c
    22 #include <apgtask.h>
    22 #include <apgtask.h>
    23 #include <apgwgnam.h>
    23 #include <apgwgnam.h>
    24 #include <schtime.h>
    24 #include <schtime.h>
    25 #include <csch_cli.h>
    25 #include <csch_cli.h>
    26 #include <e32property.h>
    26 #include <e32property.h>
    27 #include <ApUtils.h> 
    27 #include <nsmldmconst.h>
    28 #include <commdb.h>
    28 #include <cmmanager.h>
       
    29 #include <cmconnectionmethod.h>
    29 #include <DevManInternalCRKeys.h>
    30 #include <DevManInternalCRKeys.h>
    30 #include <nsmlconstants.h>
    31 #include <nsmlconstants.h>
    31 #include <centralrepository.h>
    32 #include <centralrepository.h>
    32 #include <sysversioninfo.h>
    33 #include <sysversioninfo.h>
    33 #include "FotaSrvApp.h"
    34 #include "FotaSrvApp.h"
   251 	        iSyncMLSession.OpenL(); 
   252 	        iSyncMLSession.OpenL(); 
   252 	        GetProfileDataL( &iSyncMLSession,aState.iProfileId,iapid,tmp,tmp2,tmp3);
   253 	        GetProfileDataL( &iSyncMLSession,aState.iProfileId,iapid,tmp,tmp2,tmp3);
   253 	        FLOG(_L("Using IAP: %d to send GA"),iapid);
   254 	        FLOG(_L("Using IAP: %d to send GA"),iapid);
   254 	        FLOG(_L("From Db Using IAP: %d to send GA"),aState.iIapId);
   255 	        FLOG(_L("From Db Using IAP: %d to send GA"),aState.iIapId);
   255 	        RSyncMLDevManJob    dmJob;
   256 	        RSyncMLDevManJob    dmJob;
       
   257 	        
       
   258 	        RProperty::Define(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,RProperty::EInt,KAllowAllPolicy,KWritePolicy);
       
   259 	        TInt r2=RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,ESilent);
       
   260 			FLOG(_L("CFotaServer::CreateDeviceManagementSessionL KNSmlDMSilentJob set err %d"),r2);
   256 	        TBuf<10> genalertap,temp;
   261 	        TBuf<10> genalertap,temp;
   257 	        genalertap.Zero();
   262 	        genalertap.Zero();
   258 	        temp.Zero();	  
   263 	        temp.Zero();	  
   259 	        genalertap.Append(KNSmlDMJobIapPrefix);
   264 	        genalertap.Append(KNSmlDMJobIapPrefix);
   260 	        temp.Num(aState.iIapId);//Decimal Iap
   265 	        temp.Num(aState.iIapId);//Decimal Iap
   865     if ( iSyncMLAttempts > 0 )
   870     if ( iSyncMLAttempts > 0 )
   866         {
   871         {
   867         FLOG(_L("   trycount %d => creating new job"),iSyncMLAttempts);
   872         FLOG(_L("   trycount %d => creating new job"),iSyncMLAttempts);
   868 	    RSyncMLDevManJob    dmJob;
   873 	    RSyncMLDevManJob    dmJob;
   869     	if(iIapId > KErrNotFound)
   874     	if(iIapId > KErrNotFound)
   870     		{
   875     	    {
   871     		FLOG(_L("DoCloseSMLSessionL new job uses iap from fotadb %d"),
   876             FLOG(_L("DoCloseSMLSessionL new job uses iap from fotadb %d"),
   872     				iIapId);
   877                     iIapId);
   873     		dmJob.CreateL( iSyncMLSession, iSyncProfile,iIapId );
   878    	        RProperty::Define(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,RProperty::EInt,KAllowAllPolicy,KWritePolicy);
   874     		}
   879             TInt r2=RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,ESilent);
       
   880 			FLOG(_L("CFotaServer::DoCloseSMLSessionL() KNSmlDMSilentJob set err %d"),r2);
       
   881             dmJob.CreateL( iSyncMLSession, iSyncProfile,iIapId );
       
   882     	    }
   875     	else
   883     	else
   876     		{
   884     		{
   877     		FLOG(_L("DoCloseSMLSessionL new job uses iap from profile"));
   885     		FLOG(_L("DoCloseSMLSessionL new job uses iap from profile"));
   878     		dmJob.CreateL( iSyncMLSession, iSyncProfile );
   886     		dmJob.CreateL( iSyncMLSession, iSyncProfile );
   879     		}
   887     		}
  2273 // --------------------------------------------------------------------------
  2281 // --------------------------------------------------------------------------
  2274 //
  2282 //
  2275 TBool CFotaServer::CheckIapExistsL(TUint32 aIapId)
  2283 TBool CFotaServer::CheckIapExistsL(TUint32 aIapId)
  2276     {
  2284     {
  2277     FLOG(_L("CFotaServer::CheckIapExistsL >>"));
  2285     FLOG(_L("CFotaServer::CheckIapExistsL >>"));
  2278     CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
  2286     TBool exists = EFalse;  
  2279     CleanupStack::PushL( commDb );
  2287     RCmManager cmManager;    
  2280     CApUtils* aputils = CApUtils::NewLC(*commDb);
  2288     cmManager.OpenLC();
  2281     TBool exists = aputils->IAPExistsL( aIapId);      
  2289     RCmConnectionMethod conn;
  2282     CleanupStack::PopAndDestroy( aputils );
  2290     TRAPD(err, conn = cmManager.ConnectionMethodL( aIapId ));
  2283     CleanupStack::PopAndDestroy( commDb );
  2291     if(err == KErrNone)//connection method exists
       
  2292        exists = ETrue;
       
  2293     conn.Close();
       
  2294     CleanupStack::PopAndDestroy();//cmManager                    
  2284     FLOG(_L("CFotaServer::CheckIapExistsL <<"));
  2295     FLOG(_L("CFotaServer::CheckIapExistsL <<"));
  2285     return exists;
  2296     return exists;
  2286     }
  2297     }
  2287 
  2298 
  2288 // --------------------------------------------------------------------------
  2299 // --------------------------------------------------------------------------