|
1 |
|
2 /* |
|
3 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: Shutdown observer |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef WDSHUTDOWNOBSERVER_H |
|
20 #define WDSHUTDOWNOBSERVER_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 MWDShutdownObserver |
|
31 { |
|
32 public: |
|
33 |
|
34 virtual void ShutdownNotification() = 0; |
|
35 |
|
36 virtual void RestartNotification() = 0; |
|
37 }; |
|
38 |
|
39 /** |
|
40 * Active object for observing P&S keys |
|
41 * |
|
42 * @since S60 v5.0 |
|
43 */ |
|
44 class CWDShutdownObserver : public CActive |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * |
|
51 * @since S60 v5.0 |
|
52 * @return Instance of CTMShutdownObserver. |
|
53 */ |
|
54 IMPORT_C static CWDShutdownObserver* NewL( MWDShutdownObserver& aObserver/*, const TUid& aKeyCategory*/ ); |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 * |
|
59 * @since S60 v5.0 |
|
60 */ |
|
61 virtual ~CWDShutdownObserver(); |
|
62 |
|
63 protected: |
|
64 |
|
65 /** |
|
66 * Handles an active object's request completion event. |
|
67 * |
|
68 * @since S60 v5.0 |
|
69 */ |
|
70 void RunL(); |
|
71 |
|
72 /** |
|
73 * Implements cancellation of an outstanding request. |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 */ |
|
77 void DoCancel(); |
|
78 |
|
79 TInt RunError( TInt aError ); |
|
80 |
|
81 private: |
|
82 |
|
83 /** |
|
84 * C++ default constructor |
|
85 * |
|
86 * @since S60 v5.0 |
|
87 * @return Instance of CShutdownObserver. |
|
88 */ |
|
89 CWDShutdownObserver( MWDShutdownObserver& aObserver/*, const TUid& aKeyCategory*/ ); |
|
90 |
|
91 /** |
|
92 * Symbian 2nd phase constructor can leave. |
|
93 * |
|
94 * @since S60 v5.0 |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 private: |
|
99 |
|
100 // not own |
|
101 MWDShutdownObserver& iObserver; |
|
102 |
|
103 /*const TUid& iKeyCategory;*/ |
|
104 RProperty iProperty; |
|
105 }; |
|
106 |
|
107 #endif // SHUTDOWNOBSERVER_H |