syncmlfw/ds/syncagent/src/nsmldsagent.cpp
branchRCL_3
changeset 30 2de6635c154b
parent 13 06f47423ecee
child 59 13d7c31c74e0
equal deleted inserted replaced
28:915074efc433 30:2de6635c154b
    61 #pragma diag_remark 174
    61 #pragma diag_remark 174
    62 #endif
    62 #endif
    63 
    63 
    64 // CONSTANTS
    64 // CONSTANTS
    65 const TInt KNSmlDsHTTPErrCodeBase = 1400;
    65 const TInt KNSmlDsHTTPErrCodeBase = 1400;
    66 const TInt KNSmlDsHTTPErrCodeRangeFirst = 1800;
    66 const TInt KNSmlDsErrCodeFirst = 400;
    67 const TInt KNSmlDsHTTPErrCodeRangeLast = 1905;
    67 const TInt KNSmlDsErrCodeLast = 516;
    68 
    68 
    69 // ============================ MEMBER FUNCTIONS ===============================
    69 // ============================ MEMBER FUNCTIONS ===============================
    70 
    70 
    71 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    72 // CNSmlDSAgent::CNSmlDSAgent
    72 // CNSmlDSAgent::CNSmlDSAgent
   133 	iIsExtendedServerErrorCodesSupported = EFalse;
   133 	iIsExtendedServerErrorCodesSupported = EFalse;
   134 	if(FeatureManager::FeatureSupported(KFeatureIdFfSyncmlStatusExtendedErrorCodes))
   134 	if(FeatureManager::FeatureSupported(KFeatureIdFfSyncmlStatusExtendedErrorCodes))
   135 	  {
   135 	  {
   136       InitializeServerStatusCodeList();
   136       InitializeServerStatusCodeList();
   137 	  }
   137 	  }
       
   138 	TRAP_IGNORE( iErrorReportingRep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
   138 	DBG_FILE(_S8("CNSmlDSAgent::ConstructL ends"));
   139 	DBG_FILE(_S8("CNSmlDSAgent::ConstructL ends"));
   139 	}
   140 	}
   140 
   141 
   141 // -----------------------------------------------------------------------------
   142 // -----------------------------------------------------------------------------
   142 // CNSmlDSAgent::NewL
   143 // CNSmlDSAgent::NewL
   181 	    delete iServerStatusCodeArray;
   182 	    delete iServerStatusCodeArray;
   182 	    }
   183 	    }
   183 	if(iRepositorySSC)
   184 	if(iRepositorySSC)
   184 	    {
   185 	    {
   185 	    delete iRepositorySSC;
   186 	    delete iRepositorySSC;
       
   187 	    }
       
   188 	
       
   189 	if(iErrorReportingRep)
       
   190 	    {
       
   191 	    delete iErrorReportingRep;
   186 	    }
   192 	    }
   187 	FeatureManager::UnInitializeLib();
   193 	FeatureManager::UnInitializeLib();
   188 	}
   194 	}
   189 
   195 
   190 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
  1682         RProperty::Set( KPSUidDataSynchronizationInternalKeys,
  1688         RProperty::Set( KPSUidDataSynchronizationInternalKeys,
  1683                         KDataSyncStatus,
  1689                         KDataSyncStatus,
  1684                         EDataSyncRunning12 );	    
  1690                         EDataSyncRunning12 );	    
  1685         }
  1691         }
  1686     
  1692     
  1687 	CRepository* rep = NULL;
  1693 	if ( iErrorReportingRep )
  1688 	TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
       
  1689 	if ( err == KErrNone )
       
  1690 	    {
  1694 	    {
  1691 	    rep->Set( KNsmlOpDsErrorCode, KErrNone );
  1695         iErrorReportingRep->Set( KNsmlOpDsErrorCode, KErrNone );
  1692 	    rep->Set( KNsmlOpDsSyncProfUid, profile->IntValue( EDSProfileId ) );
  1696         iErrorReportingRep->Set( KNsmlOpDsSyncProfUid, profile->IntValue( EDSProfileId ) );
  1693 	    rep->Set( KNsmlOpDsSyncInitiation, iSyncInitiation );
  1697         iErrorReportingRep->Set( KNsmlOpDsSyncInitiation, iSyncInitiation );
  1694 
       
  1695 	    delete rep;
       
  1696 	    }
  1698 	    }
  1697 
  1699 
  1698 	TBool ifInternet = ETrue ; // CR: 403-1188
  1700 	TBool ifInternet = ETrue ; // CR: 403-1188
  1699 	if ( iMediumType == KUidNSmlMediumTypeInternet )
  1701 	if ( iMediumType == KUidNSmlMediumTypeInternet )
  1700 		{
  1702 		{
  2937 		}
  2939 		}
  2938     
  2940     
  2939     // Set sync stopped to P&S
  2941     // Set sync stopped to P&S
  2940     RProperty::Set( KPSUidDataSynchronizationInternalKeys, KDataSyncStatus, EDataSyncNotRunning );
  2942     RProperty::Set( KPSUidDataSynchronizationInternalKeys, KDataSyncStatus, EDataSyncNotRunning );
  2941   
  2943   
  2942     CRepository* rep = NULL;
  2944     if ( iErrorReportingRep )
  2943     TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
       
  2944     if ( err == KErrNone )
       
  2945         {
  2945         {
  2946         rep->Set( KNsmlOpDsSyncInitiation, EDataSyncNotRunning );
  2946         iErrorReportingRep->Set( KNsmlOpDsSyncInitiation, EDataSyncNotRunning );
  2947         delete rep;
       
  2948         }
  2947         }
  2949 	
  2948 	
  2950 	ResetDSSessionInfoL();
  2949 	ResetDSSessionInfoL();
  2951 	}
  2950 	}
  2952 
  2951 
  3109 		default:
  3108 		default:
  3110 			error = ETrue;
  3109 			error = ETrue;
  3111 		}
  3110 		}
  3112 		
  3111 		
  3113     // Store status code to cenrep in case of error
  3112     // Store status code to cenrep in case of error
  3114     if ( error )
  3113     if ( error && iErrorReportingRep
       
  3114          && (  status >= KNSmlDsErrCodeFirst && status <= KNSmlDsErrCodeLast ) )
  3115         {
  3115         {
  3116         CRepository* rep = NULL;
  3116         iErrorReportingRep->Set( KNsmlOpDsErrorCode, status );
  3117         TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
       
  3118         if ( err == KErrNone )
       
  3119             {
       
  3120             rep->Set( KNsmlOpDsErrorCode, status );
       
  3121             delete rep;
       
  3122             }       
       
  3123         }
  3117         }
  3124         
  3118         
  3125 	if ( cmd == KNSmlAgentSyncHdr )
  3119 	if ( cmd == KNSmlAgentSyncHdr )
  3126 		{
  3120 		{
  3127 		SaveIfNonceL( *iSyncMLCmds->ResponseController(), aEntryID );
  3121 		SaveIfNonceL( *iSyncMLCmds->ResponseController(), aEntryID );
  3457 void CNSmlDSAgent::FinaliseWhenErrorL()
  3451 void CNSmlDSAgent::FinaliseWhenErrorL()
  3458 	{
  3452 	{
  3459 	DBG_FILE(_S8("CNSmlDSAgent::FinaliseWhenErrorL begins"));
  3453 	DBG_FILE(_S8("CNSmlDSAgent::FinaliseWhenErrorL begins"));
  3460 	
  3454 	
  3461 	// Store error code to cenrep
  3455 	// Store error code to cenrep
  3462 	CRepository* rep = NULL;
  3456 	if ( iErrorReportingRep )
  3463 	TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
       
  3464 	if ( err == KErrNone )
       
  3465 	    {
  3457 	    {
  3466 	    TInt errCode = iError->SyncLogErrorCode();
  3458         TInt errCode = iError->SyncLogErrorCode();
  3467 
  3459 
  3468 	    if ( errCode >= KNSmlDsHTTPErrCodeRangeFirst && 
  3460         if ( errCode >= ( KNSmlDsHTTPErrCodeBase + KNSmlDsErrCodeFirst ) && 
  3469 	       errCode <= KNSmlDsHTTPErrCodeRangeLast )
  3461                 errCode <= ( KNSmlDsHTTPErrCodeBase + KNSmlDsErrCodeLast ) )
  3470 	       {
  3462             {
  3471 	       errCode -= KNSmlDsHTTPErrCodeBase;
  3463             errCode -= KNSmlDsHTTPErrCodeBase;
  3472 	       }
  3464             }
  3473 
  3465 
  3474 	    rep->Set( KNsmlOpDsErrorCode, errCode );
  3466         if ( errCode >= KNSmlDsErrCodeFirst && errCode <= KNSmlDsErrCodeLast )
  3475 	    delete rep;
  3467             {
       
  3468             iErrorReportingRep->Set( KNsmlOpDsErrorCode, errCode );    	    
       
  3469             }
  3476 	    }
  3470 	    }
  3477 
  3471 
  3478 // <MAPINFO_RESEND_MOD_BEGIN>
  3472 // <MAPINFO_RESEND_MOD_BEGIN>
  3479 	if( iDSContent->ResendUsed() )
  3473 	if( iDSContent->ResendUsed() )
  3480 		{
  3474 		{