|
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 #ifndef CMMCMONITOR_H |
|
19 #define CMMCMONITOR_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <e32property.h> |
|
24 #include <driveinfo.h> |
|
25 #include <common.h> |
|
26 #include "fastfindfileserverpluginclient.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CFilePlugin; |
|
30 |
|
31 /** |
|
32 * Mmc monitoring |
|
33 * Implements CActive |
|
34 */ |
|
35 class CMMCMonitor : public CActive |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * NewL |
|
40 * @param CFilePlugin& aFilePlugin File plugin handle |
|
41 * @param RFs* aFsSession File server handle |
|
42 * @return CMMCMonitor Monitor item |
|
43 */ |
|
44 static CMMCMonitor* NewL( CFilePlugin& aFilePlugin, RFs* aFsSession ); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 virtual ~CMMCMonitor(); |
|
50 |
|
51 /** |
|
52 * StartMonitoring |
|
53 * Start monitoring mmc |
|
54 * This function calls CMMCMonitor::RunL() to initiate the MMC status |
|
55 * checking. |
|
56 * @return TBool success status |
|
57 */ |
|
58 TBool StartMonitoring(); |
|
59 |
|
60 /** |
|
61 * MmcStatus |
|
62 * Utility function that checks the DriveInfo properties of drive |
|
63 * aDriveNumber to decide if aDriveNumber is an MMC drive or not. |
|
64 * @param aDriveNumber, the drive of the Mmc. |
|
65 * @return ETrue indicates that aDriveNumber is a MMC drive. |
|
66 */ |
|
67 TBool MmcStatus( TInt aDriveNumber ); |
|
68 |
|
69 protected: // CActive |
|
70 /** |
|
71 * From CActive. |
|
72 */ |
|
73 void DoCancel(); |
|
74 |
|
75 /** |
|
76 * From CActive. |
|
77 * |
|
78 */ |
|
79 void RunL(); |
|
80 |
|
81 /** |
|
82 * From CActive. |
|
83 * @param aError Leave code from RunL() |
|
84 * @return hard-coded KErrNone |
|
85 */ |
|
86 TInt RunError( TInt aError ); |
|
87 |
|
88 private: |
|
89 /** |
|
90 * Constructor |
|
91 * @param CFilePlugin& aFilePlugin File plugin |
|
92 */ |
|
93 CMMCMonitor( CFilePlugin& aFilePlugin ); |
|
94 |
|
95 /** |
|
96 * 2nd phase construction |
|
97 * @param RFs* aFsSession File server session |
|
98 */ |
|
99 void ConstructL( RFs* aFsSession ); |
|
100 |
|
101 private: // data members |
|
102 // handle to file plugin main class |
|
103 CFilePlugin& iFilePlugin; |
|
104 // file monitor client engine |
|
105 RFastFindFSPEngine iEngine; |
|
106 // File system handle |
|
107 RFs* iFsSession; |
|
108 // inserted/ejected status of mmc |
|
109 TBool iMmcStatus; |
|
110 // MMC Inserted/ejected property |
|
111 RProperty iProperty; |
|
112 }; |
|
113 |
|
114 #endif // CMMCMONITOR_H |
|
115 |