|
1 /* |
|
2 * Copyright (c) 2007 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_CCHSWIUSBOBSERVER_H |
|
19 #define C_CCHSWIUSBOBSERVER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 // FORWARD DECLARATION |
|
27 class CCHSwiUsbHandler; |
|
28 |
|
29 /* |
|
30 * Observes RFs for RawDiskWrite events (these are also triggered when |
|
31 * (un)mounting drive; RFs does not provide better, more specific |
|
32 * notifications for mount and dismount). |
|
33 * |
|
34 * After receiving notification, calls |
|
35 * CCHSwiUsbHandler::PostponedDriveScan() and does not subscribe to |
|
36 * further notifcations. It is up to the plugin to call |
|
37 * CCHSwiUsbObserver::Start() after a successful drive scan. |
|
38 * |
|
39 * @since 3.1 |
|
40 */ |
|
41 class CCHSwiUsbObserver : public CActive |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * @param aFs File session. |
|
47 */ |
|
48 static CCHSwiUsbObserver* NewL( CCHSwiUsbHandler* aHandler, RFs& aFs ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CCHSwiUsbObserver(); |
|
54 |
|
55 /** |
|
56 * Active object start. |
|
57 */ |
|
58 void Start(); |
|
59 |
|
60 protected: |
|
61 |
|
62 /** |
|
63 * Handle RFs notifications. |
|
64 */ |
|
65 void RunL(); |
|
66 |
|
67 /** |
|
68 * RunL error handling. |
|
69 * @param aError Error. |
|
70 */ |
|
71 TInt RunError( TInt aError ); |
|
72 |
|
73 /** |
|
74 * Cancels notifications. |
|
75 */ |
|
76 void DoCancel(); |
|
77 |
|
78 private: |
|
79 |
|
80 /** |
|
81 * no copy constructor |
|
82 */ |
|
83 CCHSwiUsbObserver( const CCHSwiUsbObserver& ); |
|
84 |
|
85 /** |
|
86 * no assignment |
|
87 */ |
|
88 CCHSwiUsbObserver& operator=( const CCHSwiUsbObserver& ); |
|
89 |
|
90 /** |
|
91 * C++ default constructor |
|
92 */ |
|
93 CCHSwiUsbObserver( CCHSwiUsbHandler* aHandler, RFs& aFs ); |
|
94 |
|
95 /** |
|
96 * Symbian default constructor. |
|
97 */ |
|
98 void ConstructL(); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * File Session. |
|
104 */ |
|
105 RFs iFs; |
|
106 |
|
107 /** |
|
108 * Usb handler to perform postponed checks for mass storage mode. |
|
109 */ |
|
110 CCHSwiUsbHandler* iUsbHandler; |
|
111 }; |
|
112 |
|
113 #endif // #ifndef C_CCHSWIUSBOBSERVER_H |