camerauis/cameraapp/generic/inc/CamDriveChangeNotifier.h
branchRCL_3
changeset 13 38fb6f7eacd5
parent 0 1ddebce53859
child 15 bf64cebf4673
equal deleted inserted replaced
12:51dda465e618 13:38fb6f7eacd5
    20 #ifndef CAMDISKCHANGELISTENER_H
    20 #ifndef CAMDISKCHANGELISTENER_H
    21 #define CAMDISKCHANGELISTENER_H
    21 #define CAMDISKCHANGELISTENER_H
    22 
    22 
    23 //  INCLUDES
    23 //  INCLUDES
    24 #include <f32file.h>
    24 #include <f32file.h>
       
    25 #include "campropertywatcher.h"
       
    26 #include "campropertyobserver.h"
    25 
    27 
    26 // FORWARD DECLARATIONS
    28 // FORWARD DECLARATIONS
    27 class MCamDriveChangeNotifierObserver;
    29 class MCamDriveChangeNotifierObserver;
    28 
    30 
    29 // CLASS DECLARATION
    31 // CLASS DECLARATION
    37     {
    39     {
    38     public:
    40     public:
    39         enum TCamDriveChangeType
    41         enum TCamDriveChangeType
    40             {
    42             {
    41             EDriveDismount,
    43             EDriveDismount,
    42             EDriveMount
    44             EDriveMount,
       
    45             EDriveUSBMassStorageModeOn,
       
    46             EDriveUSBMassStorageModeOff
    43             };
    47             };
    44             
    48             
    45     public: // New functions
    49     public: // New functions
    46 
    50 
    47         /**
    51         /**
    62 /**
    66 /**
    63 *  Mmc Change Notifier.
    67 *  Mmc Change Notifier.
    64 *
    68 *
    65 *  @since 5.0
    69 *  @since 5.0
    66 */
    70 */
    67 class CCamDriveChangeNotifier : public CBase
    71 class CCamDriveChangeNotifier : public CBase, 
       
    72                                 public MPropertyObserver
    68 
    73 
    69     {
    74     {
    70     private:
    75     private:
    71         class CCamDiskChangeListener : public CActive
    76         class CCamDiskChangeListener : public CActive
    72             {            
    77             {            
    73             public:
    78             public:
    74                 static CCamDiskChangeListener* NewLC( 
    79                 static CCamDiskChangeListener* NewLC( 
    75                      RFs& aFs,
    80                      RFs& aFs,
    76                      TDriveNumber aDrive,
    81                      TDriveNumber aDrive,
    77                      MCamDriveChangeNotifierObserver::TCamDriveChangeType aType,
       
    78                      CCamDriveChangeNotifier& aObserver );
    82                      CCamDriveChangeNotifier& aObserver );
    79                 ~CCamDiskChangeListener();
    83                 ~CCamDiskChangeListener();
    80                 
    84                 
    81                 void Start();
    85                 void Start();
    82                 void Stop();
    86                 void Stop();
    83             
    87             
    84             protected:
    88             protected:
    85                 CCamDiskChangeListener( 
    89                 CCamDiskChangeListener( 
    86                      RFs& aFs,
    90                      RFs& aFs,
    87                      TDriveNumber aDrive,
    91                      TDriveNumber aDrive,
    88                      MCamDriveChangeNotifierObserver::TCamDriveChangeType aType,
       
    89                      CCamDriveChangeNotifier& aObserver );
    92                      CCamDriveChangeNotifier& aObserver );
    90                 
    93                 
    91             private:
    94             private:
    92                 /**
    95                 /**
    93                 * From CActive
    96                 * From CActive
   100                 void RunL();
   103                 void RunL();
   101                 
   104                 
   102             private:
   105             private:
   103                 RFs& iFs;
   106                 RFs& iFs;
   104                 TDriveNumber iDrive;
   107                 TDriveNumber iDrive;
   105                 MCamDriveChangeNotifierObserver::TCamDriveChangeType iType;
       
   106                 CCamDriveChangeNotifier& iObserver;
   108                 CCamDriveChangeNotifier& iObserver;
   107             };
   109             };
   108 
   110         
   109     public:  // Constructors and destructor
   111     public:  // Constructors and destructor
   110 
   112 
   111         /**
   113         /**
   112         * Two-phased constructor.
   114         * Two-phased constructor.
   113         */
   115         */
   135         // New functions
   137         // New functions
   136 
   138 
   137         void StartMonitoring();
   139         void StartMonitoring();
   138         void CancelMonitoring();
   140         void CancelMonitoring();
   139 
   141 
       
   142     public: // From MPropertyObserver
       
   143         /**
       
   144         * The value of a watched property has changed
       
   145         * @param aCategory The category of the property
       
   146         * @param aKey the Identifier of the property
       
   147         */    
       
   148         void HandlePropertyChangedL( const TUid& aCategory, const TUint aKey );
       
   149         
   140     private:
   150     private:
   141 
   151 
   142         /**
   152         /**
   143         * C++ default constructor.
   153         * C++ default constructor.
   144         */
   154         */
   145         CCamDriveChangeNotifier( 
   155         CCamDriveChangeNotifier( 
   146                                 RFs& aFs,
   156                                 RFs& aFs,
   147                                 MCamDriveChangeNotifierObserver& aObserver );
   157                                 MCamDriveChangeNotifierObserver& aObserver );
       
   158         
       
   159         void ConstructL();
   148 
   160 
   149     private:    // Data
   161     private:    // Data
   150         // Ref.
   162         // Ref.
   151         MCamDriveChangeNotifierObserver& iObserver;
   163         MCamDriveChangeNotifierObserver& iObserver;
   152 
   164 
   153         // Ref. File server session
   165         // Ref. File server session
   154         RFs& iFs;
   166         RFs& iFs;
   155 
   167 
   156         RPointerArray<CCamDiskChangeListener> iListeners;
   168         RPointerArray<CCamDiskChangeListener> iListeners;
       
   169         
       
   170         CCamPropertyWatcher* iUsbMSWatcher;
       
   171         
       
   172         TBool iMassStorageModeOn;
   157 
   173 
   158     };
   174     };
   159 
   175 
   160 #endif      // CAMDISKCHANGELISTENER_H
   176 #endif      // CAMDISKCHANGELISTENER_H
   161 
   177