×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Jakarta, Indonesia
    Posts
    269

    How to use MSyncMLEventObserver ?

    Hi FN


    I'm trying to notify my application when a sync job i started has finished syncing. So i used MSyncMLEventObserver just like this.

    Code:
    	// Open syncML session
    	RSyncMLSession syncMLSession;
    	syncMLSession.OpenL();
    	syncMLSession.RequestProgressL(*this);
    	// Need instance of data sync class
    	RSyncMLDataSyncJob job;
    	// For creating a data sync job, need to specify id of the profile used for synchronization
    	// If profile selected is PCSuite, it searches for the bluetooth device to sync with
    	job.CreateL( syncMLSession,aActiveProfile);
    	// close the job
    	job.Close();
    	// close the syncML session
    	syncMLSession.Close();

    But the OnSyncMLSyncProgress, OnSyncMLSyncError, OnSyncMLDataSyncModifications of MSyncMLEventObserver is never called.

    How to make the MSyncMLEventObserver's functions called?

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: How to use MSyncMLEventObserver ?

    When a session is closed, the event observer will also be cancelled so you need to keep the session open until the job is at least complete, though in practice you just keep the session open throughout the lifetime of the application.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  3. #3
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Jakarta, Indonesia
    Posts
    269

    Re: How to use MSyncMLEventObserver ?

    Hi Paul


    Yes i need to keep the session open until the job is finished.

    So i changed it to this

    Code:
    	RSyncMLSession iSyncMLSession;
    	iSyncMLSession.OpenL();
    	iSyncMLSession.RequestProgressL(*this);
    	RSyncMLDataSyncJob iJob;
    	iJob.CreateL( iSyncMLSession,aActiveProfile);
    	iJob.Close();
    	
    	if(iWaitDialog)
    	{
    		iWaitDialog->ProcessFinishedL(); 
    		iWaitDialog = NULL;
    	}
    	iWaitDialog = new (ELeave) CAknWaitDialog(
         (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), 
         ETrue);
    	iWaitDialog->PrepareLC(R_FILELIST_WAIT_NOTE);
    	iWaitDialog->SetTextL(KNullDesC);
    	iWaitDialog->RunLD();
    The app panicked with KERN-EXEC 0. Then i cleared all the MSyncMLProgressObserver but it still panicked with KERN-EXEC 0, unless i commented "iSyncMLSession.RequestProgressL(*this);"

    Code:
    void CSyncHandler::OnSyncMLSyncError (TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2)
    	{
    	}
    
    void CSyncHandler::OnSyncMLSyncProgress (TStatus aStatus, TInt aInfo1, TInt aInfo2)
    	{
    	}
    
    void CSyncHandler::OnSyncMLDataSyncModifications (TInt aTaskId, const TSyncMLDataSyncModifications &aClientModifications, const TSyncMLDataSyncModifications &aServerModifications)
    	{
    	}
    What could be wrong here?

  4. #4
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Jakarta, Indonesia
    Posts
    269

    Re: How to use MSyncMLEventObserver ?

    Hmm it worked now. I got some stupid mistakes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •