contentstorage/srvinc/cammcwatcher.h
changeset 66 32469d7d46ff
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CAMMCWATCHER_H
       
    19 #define C_CAMMCWATCHER_H
       
    20 
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 /**
       
    26  *  Interface for observing MMC events.
       
    27  *
       
    28  *  @since S60 S60 v3.1
       
    29  */
       
    30 class MMmcWatcherCallback
       
    31     {
       
    32 
       
    33 public:
       
    34     /**
       
    35      * MmcChangeL is called when the MMC is removed or inserted.
       
    36      */
       
    37     virtual void MmcChangeL() = 0;
       
    38 
       
    39     };
       
    40 
       
    41 /**
       
    42  *  This active object waits for an indication that the media has changed.
       
    43  *
       
    44  *  @since S60 S60 v3.1
       
    45  */
       
    46 NONSHARABLE_CLASS( CCaMmcWatcher ) : public CActive
       
    47     {
       
    48 
       
    49 public:
       
    50 
       
    51     /**
       
    52     * Two-phased constructor.
       
    53     * @param aObserver Pointer to notifier interface.
       
    54     * @param aFs file server session.
       
    55     */
       
    56 IMPORT_C static CCaMmcWatcher* NewL( RFs& aFs,
       
    57             MMmcWatcherCallback* aObserver );
       
    58 
       
    59     /**
       
    60     * Two-phased constructor.
       
    61     * @param aObserver Pointer to notifier interface.
       
    62     * @param aFs file server session.
       
    63     */
       
    64 IMPORT_C static CCaMmcWatcher* NewLC( RFs& aFs,
       
    65             MMmcWatcherCallback* aObserver );
       
    66 
       
    67     /**
       
    68     * Destructor
       
    69     */
       
    70     ~CCaMmcWatcher();
       
    71 
       
    72 private:
       
    73 
       
    74     /**
       
    75     * C++ default constructor
       
    76     * @param aObserver Pointer to notifier interface.
       
    77     * @param aFs file server session.
       
    78     */
       
    79     CCaMmcWatcher( RFs& aFs, MMmcWatcherCallback* aObserver );
       
    80 
       
    81     /**
       
    82     * By default Symbian OS constructor is private.
       
    83     */
       
    84     void ConstructL();
       
    85 
       
    86     /**
       
    87     * Set notification request
       
    88     */
       
    89     void WaitForChangeL();
       
    90 
       
    91     /**
       
    92     * From CActive.
       
    93     */
       
    94     void DoCancel();
       
    95 
       
    96     /**
       
    97     * From CActive.
       
    98     */
       
    99     void RunL();
       
   100 
       
   101     /**
       
   102      * From CActive.
       
   103      */
       
   104     TInt RunError( TInt aError );
       
   105 
       
   106 private:
       
   107 
       
   108     /**
       
   109      * File server session.
       
   110      * Not Own
       
   111      */
       
   112     RFs iFs;
       
   113 
       
   114     /**
       
   115      * MMC events observer
       
   116      * Not own.
       
   117      */
       
   118     MMmcWatcherCallback* iObserver;
       
   119     };
       
   120 
       
   121 
       
   122 #endif      // C_CAMMCWATCHER_H