|
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: Definition for CMSMemoryCardMonitor class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MSMMCMONITOR_H__ |
|
20 #define __MSMMCMONITOR_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 |
|
25 // Memory card events |
|
26 enum TMemoryCardEvent |
|
27 { |
|
28 EMemoryCardInsert = 0, //Insert memorycard |
|
29 EMemoryCardRemove, //Remove memorycard |
|
30 EMemoryCardOthers //Other event such as write, read, etc. |
|
31 }; |
|
32 |
|
33 /** |
|
34 * Observer class for memory slot events |
|
35 * |
|
36 * @since S60 5.1 |
|
37 */ |
|
38 class MMSMemoryCardObserver |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Implement this method to be notified when Memory Card status |
|
43 * changes. |
|
44 * |
|
45 * @since S60 5.1 |
|
46 * @param aEvent, memory slot event |
|
47 * @return None; |
|
48 */ |
|
49 virtual void MemoryCardChangedL( TMemoryCardEvent aEvent ) = 0; |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Memory card monitor class |
|
54 * |
|
55 * @since S60 5.1 |
|
56 */ |
|
57 NONSHARABLE_CLASS( CMSMemoryCardMonitor ) : public CActive |
|
58 { |
|
59 public: |
|
60 |
|
61 /** |
|
62 * two-phase constructor |
|
63 * |
|
64 * @since S60 5.1 |
|
65 * @param aObserver, memorycard |
|
66 * @param aFs, file server session |
|
67 * @return pointer to CMSMemoryCardMonitor |
|
68 */ |
|
69 static CMSMemoryCardMonitor* NewL( MMSMemoryCardObserver* aObserver, |
|
70 RFs& aFs ); |
|
71 |
|
72 /** |
|
73 * two-phase constructor |
|
74 * |
|
75 * @since S60 5.1 |
|
76 * @param aObserver, memorycard |
|
77 * @param aFs, file server session |
|
78 * @return pointer to CMSMemoryCardMonitor |
|
79 */ |
|
80 static CMSMemoryCardMonitor* NewLC( MMSMemoryCardObserver* aObserver, |
|
81 RFs& aFs ); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 */ |
|
86 virtual ~CMSMemoryCardMonitor(); |
|
87 |
|
88 /** |
|
89 * Start monitoring memory card slot |
|
90 * |
|
91 * @since S60 5.1 |
|
92 * @param None |
|
93 * @return None |
|
94 */ |
|
95 void StartMonitor(); |
|
96 |
|
97 protected: |
|
98 |
|
99 // From base class CActive |
|
100 |
|
101 /** |
|
102 * From CActive |
|
103 * See base class definition |
|
104 */ |
|
105 void RunL(); |
|
106 |
|
107 /** |
|
108 * From CActive |
|
109 * See base class definition |
|
110 */ |
|
111 void DoCancel(); |
|
112 |
|
113 /** |
|
114 * From CActive |
|
115 * See base class definition |
|
116 */ |
|
117 TInt RunError( TInt aError ); |
|
118 |
|
119 private: |
|
120 |
|
121 /** |
|
122 * Performs the first phase of two phase construction. |
|
123 * |
|
124 * @since S60 5.1 |
|
125 * @param aObserver, memorycard |
|
126 * @param aFs, file server session |
|
127 * @return None; |
|
128 */ |
|
129 CMSMemoryCardMonitor( MMSMemoryCardObserver* aObserver, RFs& aRfs ); |
|
130 |
|
131 /** |
|
132 * Performs the second phase construction. |
|
133 * |
|
134 * @since S60 5.1 |
|
135 * @param aObserver, memorycard |
|
136 * @param aFs, file server session |
|
137 * @return None |
|
138 */ |
|
139 void ConstructL(); |
|
140 |
|
141 /** |
|
142 * Checks if memory card is available |
|
143 * |
|
144 * @since S60 5.1 |
|
145 * @return TBool, ETrue if found, EFalse otherwise |
|
146 */ |
|
147 TBool MemoryCardExist() const; |
|
148 |
|
149 private: |
|
150 |
|
151 /** |
|
152 * Memorycard observer class |
|
153 */ |
|
154 MMSMemoryCardObserver* iObserver; // not owned |
|
155 |
|
156 /** |
|
157 * Reference to file server session |
|
158 */ |
|
159 RFs& iFsSession; |
|
160 |
|
161 /** |
|
162 * Memorycard exist or not |
|
163 */ |
|
164 TBool iMemoryCardExist; |
|
165 }; |
|
166 |
|
167 #endif // __MSMMCMONITOR_H__ |
|
168 |
|
169 // End of File |