1 /* |
|
2 * Copyright (c) 2006-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: TM Shutdown Observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TMSHUTDOWNOBSERVER_H |
|
20 #define TMSHUTDOWNOBSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 |
|
27 /** |
|
28 * Observer interface for signaling the need for shutdown |
|
29 */ |
|
30 class MTMShutdownObserver |
|
31 { |
|
32 public: |
|
33 |
|
34 virtual void ShutdownNotification() = 0; |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Active object for observing P&S keys |
|
39 * |
|
40 * @since S60 v5.0 |
|
41 */ |
|
42 class CTMShutdownObserver: public CActive |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * |
|
49 * @since S60 v5.0 |
|
50 * @return Instance of CTMShutdownObserver. |
|
51 */ |
|
52 static CTMShutdownObserver* NewL( MTMShutdownObserver& aObserver, const TUid& aKeyCategory, |
|
53 const TInt aPropertyKey, TBool aDefineKey); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 * |
|
58 * @since S60 v5.0 |
|
59 */ |
|
60 virtual ~CTMShutdownObserver(); |
|
61 |
|
62 protected: |
|
63 |
|
64 /** |
|
65 * Handles an active object's request completion event. |
|
66 * |
|
67 * @since S60 v5.0 |
|
68 */ |
|
69 void RunL(); |
|
70 |
|
71 /** |
|
72 * Implements cancellation of an outstanding request. |
|
73 * |
|
74 * @since S60 v5.0 |
|
75 */ |
|
76 void DoCancel(); |
|
77 |
|
78 private: |
|
79 |
|
80 /** |
|
81 * C++ default constructor |
|
82 * |
|
83 * @since S60 v5.0 |
|
84 * @return Instance of CTMShutdownObserver. |
|
85 */ |
|
86 CTMShutdownObserver( MTMShutdownObserver& aObserver, const TUid& aKeyCategory, |
|
87 const TInt iPropertyKey, TBool aDefineKey); |
|
88 |
|
89 /** |
|
90 * Symbian 2nd phase constructor can leave. |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 private: |
|
97 |
|
98 // not own |
|
99 MTMShutdownObserver& iObserver; |
|
100 |
|
101 const TUid& iKeyCategory; |
|
102 RProperty iProperty; |
|
103 TInt iPropertyKey; |
|
104 |
|
105 TBool iDefineKey; |
|
106 }; |
|
107 |
|
108 #endif // TMSHUTDOWNOBSERVER_H |
|