|
1 /* |
|
2 * Copyright (c) 2002-2006 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: An active object class that is used to receive |
|
15 * phone call related events from PS API and forward them |
|
16 * to an MVRSystemEventObserver instance. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CVRSYSTEMEVENTHANDLER_H |
|
24 #define __CVRSYSTEMEVENTHANDLER_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <e32property.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MVRSystemEventObserver; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * An active object class that is used to receive |
|
37 * phone call related events from RSystemAgent and forward them |
|
38 * to an MVRSystemEventObserver instance. |
|
39 */ |
|
40 NONSHARABLE_CLASS( CVRSystemEventHandler ): public CActive |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * @return A pointer to fully constructed instance of CVRSystemEventHandler |
|
47 */ |
|
48 static CVRSystemEventHandler* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CVRSystemEventHandler(); |
|
54 |
|
55 public: // New functions |
|
56 /** |
|
57 * Get the current state of any pubsub key |
|
58 * @param aUid The UID of the PS category |
|
59 * @param aKey The id identifying the PS key |
|
60 * @return The value of the state variable |
|
61 */ |
|
62 TInt StateL( TUid aUid, TUint aKey ); |
|
63 |
|
64 /** |
|
65 * Start listening to system events |
|
66 * @param aUid The UID identifying the system agent's state variable |
|
67 * @param aObserver The observer who will be notified of events |
|
68 */ |
|
69 void Listen( TUid aUid, TUint aKey, MVRSystemEventObserver* aObserver ); |
|
70 |
|
71 public: // from CActive |
|
72 |
|
73 /** |
|
74 * When this method is called, an event has been received. |
|
75 * Notify the observer. |
|
76 */ |
|
77 void RunL(); |
|
78 |
|
79 /** |
|
80 * Cancel the request for event notifications. |
|
81 */ |
|
82 void DoCancel(); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * Ask system agent to notify us about events |
|
88 */ |
|
89 void IssueRequest(); |
|
90 |
|
91 /** |
|
92 * Default constructor. |
|
93 */ |
|
94 CVRSystemEventHandler(); |
|
95 |
|
96 /** |
|
97 * 2nd phase constructor. |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 private: // Data |
|
102 |
|
103 /** |
|
104 * For observing the system events |
|
105 */ |
|
106 RProperty iProperty; |
|
107 |
|
108 /** |
|
109 * Pointer to the observer. Not owned. |
|
110 */ |
|
111 MVRSystemEventObserver* iObserver; |
|
112 }; |
|
113 |
|
114 #endif // __CVRSYSTEMEVENTHANDLER_H |
|
115 |
|
116 // End of File |