|
1 /* |
|
2 * Copyright (c) 2009 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: Header file for Stylus Tap indicator eject usb drives |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MSMMDISMOUNTUSBDRIVES_H |
|
20 #define MSMMDISMOUNTUSBDRIVES_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #ifdef __OVER_DUMMYCOMPONENT__ |
|
24 #include "usb/hostms/dummycomponent/dummyfsclient.h" |
|
25 #else |
|
26 #include <f32file.h> |
|
27 #endif |
|
28 |
|
29 #include "msmm_pub_def.h" |
|
30 |
|
31 class CDismountTimer; |
|
32 class CMsmmPolicyPluginBase; |
|
33 |
|
34 /** |
|
35 * Timer callback interface to indicate USB drive in use |
|
36 * |
|
37 * This class specifies the function to be called when a timeout occurs. |
|
38 * Used in conjunction with CDismountTimer class |
|
39 * |
|
40 */ |
|
41 class MTimerNotifier |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * The function to be called when a timeout occurs. |
|
46 * |
|
47 */ |
|
48 virtual void TimerExpired() = 0; |
|
49 }; |
|
50 |
|
51 /** |
|
52 * An Active Object class to request dismount of usb specific drives and notify the result to MSMM plugin |
|
53 * |
|
54 */ |
|
55 NONSHARABLE_CLASS( CMsmmDismountUsbDrives ) : public CActive, |
|
56 public MTimerNotifier |
|
57 { |
|
58 public: |
|
59 virtual ~CMsmmDismountUsbDrives(); |
|
60 static CMsmmDismountUsbDrives* NewL(); |
|
61 static CMsmmDismountUsbDrives* NewLC(); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * Send dismount notifications for all usb drives. |
|
66 */ |
|
67 void DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice); |
|
68 |
|
69 protected: |
|
70 CMsmmDismountUsbDrives(); |
|
71 void ConstructL(); |
|
72 |
|
73 private: |
|
74 /** |
|
75 * Send dismount notification via RFs |
|
76 */ |
|
77 void DoDismount(); |
|
78 |
|
79 /** |
|
80 * Callback to CMsmmPolicyPluginBase |
|
81 */ |
|
82 void CompleteDismountRequest(const TInt aResult); |
|
83 |
|
84 private: //from CActive |
|
85 void RunL(); |
|
86 void DoCancel(); |
|
87 |
|
88 private: // from MTimerNotifier |
|
89 |
|
90 /** |
|
91 * Dismount timer callback |
|
92 */ |
|
93 void TimerExpired(); |
|
94 |
|
95 private: |
|
96 /** |
|
97 * Drive index |
|
98 */ |
|
99 TInt iDriveIndex; |
|
100 /** |
|
101 * RFs session |
|
102 */ |
|
103 #ifdef __OVER_DUMMYCOMPONENT__ |
|
104 RDummyFs iRFs; |
|
105 #else |
|
106 RFs iRFs; |
|
107 #endif |
|
108 /** |
|
109 * List of drives |
|
110 */ |
|
111 TDriveList iDriveList; |
|
112 |
|
113 /** |
|
114 * Dismount timer |
|
115 * Own |
|
116 */ |
|
117 CDismountTimer* iDismountTimer; |
|
118 |
|
119 /** |
|
120 * Callback API for dismount result |
|
121 * Do not own |
|
122 */ |
|
123 CMsmmPolicyPluginBase* iPlugin; |
|
124 |
|
125 /** |
|
126 * Device specific details, manufacturer and productid |
|
127 */ |
|
128 TPckgBuf<TUSBMSDeviceDescription> iDevicePkgInfo; |
|
129 }; |
|
130 |
|
131 |
|
132 /** |
|
133 * Timer interface for dismount request |
|
134 * |
|
135 * This class will notify an object after a specified timeout. |
|
136 * |
|
137 */ |
|
138 class CDismountTimer : public CTimer |
|
139 { |
|
140 public: |
|
141 static CDismountTimer* NewL( MTimerNotifier* aTimeOutNotify ); |
|
142 static CDismountTimer* NewLC( MTimerNotifier* aTimeOutNotify); |
|
143 virtual ~CDismountTimer(); |
|
144 void CancelTimer(); |
|
145 void StartTimer(); |
|
146 |
|
147 protected: |
|
148 /** |
|
149 * From CTimer |
|
150 * Invoked when a timeout occurs |
|
151 * |
|
152 */ |
|
153 virtual void RunL(); |
|
154 |
|
155 private: |
|
156 CDismountTimer( MTimerNotifier* aTimeOutNotify ); |
|
157 void ConstructL(); |
|
158 |
|
159 private: // Member variables |
|
160 |
|
161 /** |
|
162 * The observer for this objects events |
|
163 * Not own. |
|
164 */ |
|
165 MTimerNotifier* iNotify; |
|
166 }; |
|
167 |
|
168 |
|
169 #endif // MSMMDISMOUNTUSBDRIVES_H |