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_CAWIDGETMMCWATCHER_H |
|
19 #define C_CAWIDGETMMCWATCHER_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 MWidgetMmcWatcherCallback |
|
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 class CCaWidgetMmcWatcher : 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 static CCaWidgetMmcWatcher* NewL( RFs& aFs, |
|
57 MWidgetMmcWatcherCallback* aObserver ); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @param aObserver Pointer to notifier interface. |
|
62 * @param aFs file server session. |
|
63 */ |
|
64 static CCaWidgetMmcWatcher* NewLC( RFs& aFs, |
|
65 MWidgetMmcWatcherCallback* aObserver ); |
|
66 |
|
67 /** |
|
68 * Destructor |
|
69 */ |
|
70 ~CCaWidgetMmcWatcher(); |
|
71 |
|
72 private: |
|
73 |
|
74 /** |
|
75 * C++ default constructor |
|
76 * @param aObserver Pointer to notifier interface. |
|
77 * @param aFs file server session. |
|
78 */ |
|
79 CCaWidgetMmcWatcher( RFs& aFs, MWidgetMmcWatcherCallback* 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 MWidgetMmcWatcherCallback* iObserver; |
|
119 }; |
|
120 |
|
121 |
|
122 #endif // C_CAWIDGETMMCWATCHER_H |
|