|
1 /* |
|
2 * Copyright (c) 2008-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: |
|
15 */ |
|
16 |
|
17 #ifndef UNMOUNTHANDLERAO_H |
|
18 #define UNMOUNTHANDLERAO_H |
|
19 |
|
20 #include <e32base.h> // For CActive, link against: euser.lib |
|
21 #include <e32std.h> // For RTimer, link against: euser.lib |
|
22 #include <e32msgqueue.h> |
|
23 |
|
24 class MUnmountObserver |
|
25 { |
|
26 public: |
|
27 virtual void HandleUnmount( TUint32 aMediaId ) = 0; |
|
28 }; |
|
29 |
|
30 class CUnmountHandlerAO : public CActive |
|
31 { |
|
32 public: |
|
33 // Cancel and destroy |
|
34 ~CUnmountHandlerAO(); |
|
35 |
|
36 // Two-phased constructor. |
|
37 static CUnmountHandlerAO* NewL( MUnmountObserver& aObserver ); |
|
38 |
|
39 // Two-phased constructor. |
|
40 static CUnmountHandlerAO* NewLC( MUnmountObserver& aObserver ); |
|
41 |
|
42 public: // New functions |
|
43 // Function for making the initial request |
|
44 void WaitForUnmountL(); |
|
45 |
|
46 private: |
|
47 // C++ constructor |
|
48 CUnmountHandlerAO( MUnmountObserver& aObserver ); |
|
49 |
|
50 // Second-phase constructor |
|
51 void ConstructL(); |
|
52 |
|
53 private: // From CActive |
|
54 // Handle completion |
|
55 void RunL(); |
|
56 |
|
57 // How to cancel me |
|
58 void DoCancel(); |
|
59 |
|
60 // Override to handle leaves from RunL(). Default implementation causes |
|
61 // the active scheduler to panic. |
|
62 TInt RunError( TInt aError ); |
|
63 |
|
64 private: |
|
65 MUnmountObserver* iUnmountObserver; |
|
66 RMsgQueue<TUint32> iMsgQueue; |
|
67 }; |
|
68 |
|
69 #endif // UNMOUNTHANDLERAO_H |