|
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: Shutdown observer |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef WDSELFSHUTDOWNOBSERVER_H |
|
19 #define WDSELFHUTDOWNOBSERVER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <w32std.h> |
|
23 #include <e32property.h> |
|
24 |
|
25 |
|
26 /** |
|
27 * Observer interface for signaling the need for shutdown |
|
28 */ |
|
29 class MWDSelfShutdownObserver |
|
30 { |
|
31 public: |
|
32 |
|
33 virtual void SelfShutdownNotification() = 0; |
|
34 |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Active object for observing P&S keys |
|
39 * |
|
40 * @since S60 v5.0 |
|
41 */ |
|
42 class CWDSelfShutdownObserver : public CActive |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * |
|
49 * @since S60 v5.0 |
|
50 * @return Instance of CTMShutdownObserver. |
|
51 */ |
|
52 IMPORT_C static CWDSelfShutdownObserver* NewL( MWDSelfShutdownObserver& aObserver/*, const TUid& aKeyCategory*/ ); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 * |
|
57 * @since S60 v5.0 |
|
58 */ |
|
59 virtual ~CWDSelfShutdownObserver(); |
|
60 |
|
61 protected: |
|
62 |
|
63 /** |
|
64 * Handles an active object's request completion event. |
|
65 * |
|
66 * @since S60 v5.0 |
|
67 */ |
|
68 void RunL(); |
|
69 |
|
70 /** |
|
71 * Implements cancellation of an outstanding request. |
|
72 * |
|
73 * @since S60 v5.0 |
|
74 */ |
|
75 void DoCancel(); |
|
76 |
|
77 TInt RunError( TInt aError ); |
|
78 |
|
79 private: |
|
80 |
|
81 /** |
|
82 * C++ default constructor |
|
83 * |
|
84 * @since S60 v5.0 |
|
85 * @return Instance of CShutdownObserver. |
|
86 */ |
|
87 CWDSelfShutdownObserver( MWDSelfShutdownObserver& aObserver/*, const TUid& aKeyCategory*/ ); |
|
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 MWDSelfShutdownObserver& iObserver; |
|
100 |
|
101 /*const TUid& iKeyCategory;*/ |
|
102 RProperty iProperty; |
|
103 }; |
|
104 |
|
105 #endif // SHUTDOWNOBSERVER_H |