harvesterplugins/media/mediautils/inc/mmcmonitor.h
changeset 0 ccd0fd43f247
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Mmc monitor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MMCMONITORUTIL_H
       
    21 #define MMCMONITORUTIL_H
       
    22 
       
    23 //  INCLUDES 
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 #include <driveinfo.h>
       
    27 #include <common.h>
       
    28 #include <f32file.h>
       
    29 #include "mmceventobserver.h"
       
    30 
       
    31 /**
       
    32  * Mmc monitoring
       
    33  * Implements CActive
       
    34  */
       
    35 class CMMCMonitorUtil : public CActive
       
    36     {
       
    37 public:
       
    38     /**
       
    39      * NewL
       
    40      * @param MMMCEventObserver* aObserver event observer
       
    41      * @return CMMCMonitorUtil Monitor item
       
    42      */
       
    43     static CMMCMonitorUtil* NewL( MMMCEventObserver* aObserver);
       
    44 
       
    45     /**
       
    46      * Destructor
       
    47      */
       
    48     virtual ~CMMCMonitorUtil();
       
    49 
       
    50     /**
       
    51      * StartMonitoring
       
    52      * Start monitoring mmc
       
    53      * This function calls CMMCMonitorUtil::RunL() to initiate the MMC status 
       
    54      * checking.
       
    55      * @return TBool success status
       
    56      */
       
    57     TBool StartMonitoring();
       
    58 protected: // CActive
       
    59     /**
       
    60      * From CActive.
       
    61      */
       
    62     void DoCancel();
       
    63 
       
    64     /**
       
    65      * From CActive.
       
    66      * 
       
    67      */
       
    68     void RunL();
       
    69 
       
    70     /**
       
    71      * From CActive.
       
    72      * @param aError Leave code from RunL()
       
    73      * @return hard-coded KErrNone
       
    74      */
       
    75     TInt RunError( TInt aError );
       
    76 private:
       
    77     /**
       
    78      * MmcStatus
       
    79      * Utility function that checks the DriveInfo properties of drive
       
    80      * aDriveNumber to decide if aDriveNumber is an MMC drive or not.
       
    81      * @param aDriveNumber, the drive of the Mmc.
       
    82      * @return ETrue indicates that aDriveNumber is a MMC drive.
       
    83      */
       
    84     TBool MmcStatus( TInt aDriveNumber );
       
    85     
       
    86     /**
       
    87      * Constructor
       
    88      * @param MMMCEventObserver* aObserver event observer
       
    89      */
       
    90     CMMCMonitorUtil( MMMCEventObserver* aObserver );
       
    91 
       
    92     /**
       
    93      * 2nd phase construction
       
    94      * @param RFs* aFsSession File server session
       
    95      */
       
    96     void ConstructL();
       
    97 private: // data members
       
    98     // File system handle
       
    99     RFs iFsSession;
       
   100     // inserted/ejected status of mmc
       
   101     TBool iMmcStatus;
       
   102     // MMC Inserted/ejected property
       
   103     RProperty iProperty;
       
   104     //Notify MMC event back to observer
       
   105     MMMCEventObserver* iObserver;
       
   106     };
       
   107 #endif // MMCMONITORUTIL_H
       
   108