syncmlfw/dm/syncagent/src/nsmldmagent.cpp
branchRCL_3
changeset 61 b183ec05bd8c
parent 19 86979fe66c4c
child 62 19bba8228ff0
equal deleted inserted replaced
59:13d7c31c74e0 61:b183ec05bd8c
    48 // FOTA
    48 // FOTA
    49 #include "NSmlDMGenericAlert.h"
    49 #include "NSmlDMGenericAlert.h"
    50 #include "NSmlPrivateAPI.h"
    50 #include "NSmlPrivateAPI.h"
    51 // FOTA end
    51 // FOTA end
    52 #include <featmgr.h>
    52 #include <featmgr.h>
    53 const TUid KUidNotifier = { 0x101F8769 };
       
    54 const TInt KNotifierTimeout = 300000000; // 5 min timeout
    53 const TInt KNotifierTimeout = 300000000; // 5 min timeout
    55 _LIT8 ( KNSmlDMFotaNode, "FUMO" );
    54 _LIT8 ( KNSmlDMFotaNode, "FUMO" );
    56 
    55 
    57 // ================= MEMBER FUNCTIONS =======================
    56 // ================= MEMBER FUNCTIONS =======================
    58 
    57 
   206         aAlertCode == KNSmlDMAgentClientInitAlert ||
   205         aAlertCode == KNSmlDMAgentClientInitAlert ||
   207         aAlertCode == KNSmlDMAgentResultAlert ||
   206         aAlertCode == KNSmlDMAgentResultAlert ||
   208         aAlertCode == KNSmlDMAgentNextMessage ||
   207         aAlertCode == KNSmlDMAgentNextMessage ||
   209         aAlertCode == KNSmlDMAgentSessionAbortAlert ||
   208         aAlertCode == KNSmlDMAgentSessionAbortAlert ||
   210         aAlertCode == KNSmlDMAgentDisplayAlert ||
   209         aAlertCode == KNSmlDMAgentDisplayAlert ||
   211         aAlertCode == KNSmlDMAgentContinueOrAbortAlert 
   210         aAlertCode == KNSmlDMAgentContinueOrAbortAlert )
   212 		 || aAlertCode == KNSmlDMAgentUserInputAlert 
       
   213 		 || aAlertCode == KNSmlDMAgentSingleChoiceAlert
       
   214 		 || aAlertCode == KNSmlDMAgentMultipleChoiceAlert )
       
   215 		{
   211 		{
   216 		return ETrue;
   212 		return ETrue;
   217 		}
   213 		}
   218 	return EFalse;
   214 	return EFalse;
   219 	}
   215 	}
  1875 CNSmlAgentNotifierObserver::~CNSmlAgentNotifierObserver()
  1871 CNSmlAgentNotifierObserver::~CNSmlAgentNotifierObserver()
  1876 	{
  1872 	{
  1877 	// StartNotifier called to avoid Notifier server panic, if 
  1873 	// StartNotifier called to avoid Notifier server panic, if 
  1878 	// notifier does not exist anymore.
  1874 	// notifier does not exist anymore.
  1879 	TBuf8<1> dummy;	
  1875 	TBuf8<1> dummy;	
  1880 	iNotifier.StartNotifier(KNullUid, dummy, dummy); // KNullUid should do also..
  1876 //	iNotifier.StartNotifier(KNullUid, dummy, dummy); // KNullUid should do also..
  1881 	iNotifier.CancelNotifier( KUidNotifier );
  1877 //	iNotifier.CancelNotifier( KUidNotifier );
  1882 	iNotifier.Close();
  1878 //	iNotifier.Close();
  1883 	iNotifierTimeOut.Cancel();
  1879 	iNotifierTimeOut.Cancel();
  1884 	Cancel();
  1880 	Cancel();
  1885 	}
  1881 	}
  1886 
  1882 
  1887 // --------------------------------------------------------------------------
  1883 // --------------------------------------------------------------------------
  1897 	if ( !IsActive() )
  1893 	if ( !IsActive() )
  1898 		{
  1894 		{
  1899 		SetActive();
  1895 		SetActive();
  1900 		}
  1896 		}
  1901 
  1897 
  1902 	//connect to repository		
       
  1903 	CRepository* rep = CRepository::NewLC( KCRUidPolicyManagementUtilInternalKeys );
       
  1904 		
       
  1905 	//get parameters 	
       
  1906 	TSyncMLAppLaunchNotifParams params;
       
  1907     TPckg<TSyncMLAppLaunchNotifParams> data( params );
       
  1908 	User::LeaveIfError( rep->Get( KSyncMLSessionParamsKey, data)); 
       
  1909 
       
  1910 	CleanupStack::PopAndDestroy( rep);
       
  1911 
       
  1912     iNotifierTimeOut.LaunchNotifierTimer( this );
  1898     iNotifierTimeOut.LaunchNotifierTimer( this );
  1913     User::LeaveIfError( iNotifier.Connect() );
  1899 //    User::LeaveIfError( iNotifier.Connect() );
  1914     iNotifier.StartNotifierAndGetResponse( iStatus, KUidNotifier, data, iResBuf );
  1900 //   iNotifier.StartNotifierAndGetResponse( iStatus, KUidNotifier, data, iResBuf );
  1915 	}
  1901 	}
  1916 
  1902 
  1917 // --------------------------------------------------------------------------
  1903 // --------------------------------------------------------------------------
  1918 // CNSmlNotifierObserver::NotifierTimeOut()
  1904 // CNSmlNotifierObserver::NotifierTimeOut()
  1919 // Starts notifier time out timer
  1905 // Starts notifier time out timer
  1923 	{
  1909 	{
  1924 	iTimeOut = ETrue;
  1910 	iTimeOut = ETrue;
  1925 	// StartNotifier called to avoid Notifier server panic, if 
  1911 	// StartNotifier called to avoid Notifier server panic, if 
  1926 	// notifier does not exist anymore.
  1912 	// notifier does not exist anymore.
  1927 	TBuf8<1> dummy;	
  1913 	TBuf8<1> dummy;	
  1928 	iNotifier.StartNotifier(KNullUid, dummy, dummy); // KNullUid should do also..
  1914 //	iNotifier.StartNotifier(KNullUid, dummy, dummy); // KNullUid should do also..
  1929 	
  1915 	
  1930 	iNotifier.CancelNotifier( KUidNotifier );
  1916 //	iNotifier.CancelNotifier( KUidNotifier );
  1931 	}
  1917 	}
  1932 
  1918 
  1933 // --------------------------------------------------------------------------
  1919 // --------------------------------------------------------------------------
  1934 // CNSmlNotifierObserver::DoCancel()
  1920 // CNSmlNotifierObserver::DoCancel()
  1935 // From base class
  1921 // From base class
  1955     else
  1941     else
  1956     {
  1942     {
  1957 	    if ( ret == KErrNone )
  1943 	    if ( ret == KErrNone )
  1958     	{	   
  1944     	{	   
  1959         
  1945         
  1960 	  		TInt sid = iResBuf().iSecureId.iUid; // read secure id from notifier.
       
  1961 	   	
  1946 	   	
  1962 	    	// Check the response and error code. If there is a fail, dump the job.        
  1947 	    	// Check the response and error code. If there is a fail, dump the job.        
  1963 	    	// Also compare sid to creator id saved for current job to secure that listener owns the job.
  1948 	    	// Also compare sid to creator id saved for current job to secure that listener owns the job.
  1964 /*		    if ( ret != KErrNone || sid != iThreadParams.iCurrentJob.CreatorId() )
  1949 /*		    if ( ret != KErrNone || sid != iThreadParams.iCurrentJob.CreatorId() )
  1965 	       	{
  1950 	       	{