testexecfw/useremul/inc/NotifyFileChange.h
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*------------------------------------------------------------------
       
     2  -
       
     3  * Software Name : UserEmulator
       
     4  * Version       : v4.2.1309
       
     5  * 
       
     6  * Copyright (c) 2009 France Telecom. All rights reserved.
       
     7  * This software is distributed under the License 
       
     8  * "Eclipse Public License - v 1.0" the text of which is available
       
     9  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10  *
       
    11  * Initial Contributors:
       
    12  * France Telecom 
       
    13  *
       
    14  * Contributors:
       
    15  *------------------------------------------------------------------
       
    16  -
       
    17  * File Name: NotifyFileChange.h
       
    18  * 
       
    19  * Created: 13/08/2009
       
    20  * Author(s): Marcell Kiss, Reshma Sandeep Das
       
    21  *   
       
    22  * Description:
       
    23  * Active object implementation for notification of file changes
       
    24  *------------------------------------------------------------------
       
    25  -
       
    26  *
       
    27  */
       
    28 #ifndef NOTIFYFILECHANGE__
       
    29 #define NOTIFYFILECHANGE__
       
    30 
       
    31 //System Includes
       
    32 #include <e32std.h>
       
    33 #include <e32base.h>
       
    34 #include <f32file.h>
       
    35 
       
    36 //User Includes
       
    37 #include "Constants.h"
       
    38 
       
    39 /**
       
    40  * MFileChangeObserver 
       
    41  * Interface class for file change notifications
       
    42  */
       
    43 class MFileChangeObserver
       
    44 {
       
    45 public:
       
    46 	/**
       
    47 	 * FileChangeEventL 
       
    48 	 * Callback function that notifies any file change events
       
    49 	 */
       
    50 	virtual void FileChangeEventL() = 0;
       
    51 };
       
    52 
       
    53 /**
       
    54  * CNotifyFileChange 
       
    55  * Class implementation for notification of file changes
       
    56  */
       
    57 
       
    58 class CNotifyFileChange : public CActive
       
    59 {
       
    60 public:
       
    61    /**
       
    62 	* Static constructor
       
    63 	* @param aObserver Reference to the MFileChangeObserver class
       
    64 	* @param aPath file path
       
    65 	* @return CNotifyFileChange* A pointer to the newly alocated CNotifyFileChange class.
       
    66 	*                          NULL, if the class cannot be created
       
    67 	*/
       
    68 	static  CNotifyFileChange*  NewL(  MFileChangeObserver& aObserver, const TDesC& aPath );
       
    69    /**
       
    70 	* Static constructor
       
    71 	* @param aObserver Reference to the MFileChangeObserver class
       
    72 	* @param aPath file path
       
    73 	* @return CNotifyFileChange* A pointer to the newly alocated CNotifyFileChange class.
       
    74 	*                          NULL, if the class cannot be created
       
    75 	*/
       
    76 	static  CNotifyFileChange*  NewLC( MFileChangeObserver& aObserver, const TDesC& aPath );
       
    77 	
       
    78    /**
       
    79 	* Destructor
       
    80 	*/
       
    81 	virtual ~CNotifyFileChange();
       
    82 
       
    83    /**
       
    84 	* Function that requests a notification of change to files or directories
       
    85 	* @param aPath File path
       
    86 	*/
       
    87 	void RefreshPath(TDes& aPath);
       
    88 	
       
    89 private: // from CActive
       
    90    /**
       
    91 	* Cancels any outstanding request.
       
    92 	*/
       
    93 	void DoCancel();
       
    94 	
       
    95    /**
       
    96 	* Handles the completion of the active request.
       
    97 	*/
       
    98 	void RunL();
       
    99    /**
       
   100 	* Handles a leave occurring in the request completion event handler CActive::RunL().
       
   101 	*/  	
       
   102 	TInt RunError(TInt aError);
       
   103 
       
   104 private:
       
   105    /**
       
   106 	* Constructor
       
   107 	* @param aObserver Reference to the MFileChangeObserver class
       
   108 	* @param aPath file path
       
   109 	*/
       
   110 	CNotifyFileChange( MFileChangeObserver& aObserver,const TDesC& aPath );
       
   111 	/**
       
   112 	 * ConstructL
       
   113 	 */
       
   114 	void ConstructL();
       
   115 
       
   116 private:
       
   117    /**
       
   118 	* Reference to the MFileChangeObserver class
       
   119 	*/
       
   120 	MFileChangeObserver&		iObserver;	
       
   121   /**
       
   122 	* Reference to file server session
       
   123 	*/
       
   124     RFs 						iFs;
       
   125    /**
       
   126   	* File path
       
   127   	*/
       
   128     TDes16&                     iPath;
       
   129 };
       
   130 
       
   131 #endif	//NOTIFYFILECHANGE__