1 /* |
|
2 * Copyright (c) 2006-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: Declaration of CIRSystemEventCollector |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIRSYSTEMEVENTCOLLECTOR_H |
|
20 #define CIRSYSTEMEVENTCOLLECTOR_H |
|
21 |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "iraudioroutingobserver.h" |
|
27 #include "irdiskspacewatcherobserver.h" |
|
28 #include "irheadseteventobserver.h" |
|
29 #include "irsystemeventdetectorobserver.h" |
|
30 #include "irsystemeventobserver.h" |
|
31 |
|
32 class CIRAccessoryObserver; |
|
33 class CIRDiskSpaceWatcher; |
|
34 class CIRSystemEventDetector; |
|
35 |
|
36 /** |
|
37 * Collects system events and forwards them to observers |
|
38 * Class also wraps up the getters for some system states |
|
39 * |
|
40 * @lib vrsystemutils.lib |
|
41 */ |
|
42 NONSHARABLE_CLASS(CIRSystemEventCollector) : |
|
43 public CBase, |
|
44 public MIRAudioRoutingObserver, |
|
45 public MIRDiskSpaceWatcherObserver, |
|
46 public MIRHeadsetEventObserver, |
|
47 public MIRSystemEventDetectorObserver |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 IMPORT_C static CIRSystemEventCollector* NewL(); |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 ~CIRSystemEventCollector(); |
|
60 |
|
61 /** |
|
62 * Adds a system event observer |
|
63 * |
|
64 * @param aSystemObserver The observer to be added |
|
65 */ |
|
66 IMPORT_C void AddObserverL( MIRSystemEventObserver* aSystemObserver ); |
|
67 |
|
68 /** |
|
69 * Removes a system event observer |
|
70 * |
|
71 * @param aSystemObserver The observer to be removed |
|
72 */ |
|
73 IMPORT_C void RemoveObserver( MIRSystemEventObserver* aSystemObserver ); |
|
74 |
|
75 /** |
|
76 * Returns data network coverage state (wlan or mobile). |
|
77 * |
|
78 * @return ETrue if there is network coverage |
|
79 */ |
|
80 IMPORT_C TBool IsNetworkCoverage() const; |
|
81 |
|
82 /** |
|
83 * Returns mobile network coverage state. |
|
84 * |
|
85 * @return ETrue if there is network coverage |
|
86 */ |
|
87 IMPORT_C TBool IsMobileNetworkCoverage() const; |
|
88 |
|
89 /** |
|
90 * Returns current call state. |
|
91 * |
|
92 * @return ETrue if call is active |
|
93 */ |
|
94 IMPORT_C TBool IsCallActive() const; |
|
95 |
|
96 /** |
|
97 * Returns current audio resources state. |
|
98 * |
|
99 * @return ETrue if audio resources are available |
|
100 */ |
|
101 IMPORT_C TBool IsAudioResourcesAvailable() const; |
|
102 |
|
103 /** |
|
104 * Returns current headset connection status |
|
105 * |
|
106 * @return |
|
107 */ |
|
108 IMPORT_C TBool IsHeadsetConnected() const; |
|
109 |
|
110 /** |
|
111 * Returns the state of disk space |
|
112 */ |
|
113 IMPORT_C TBool IsDiskSpaceBelowCriticalLevel() const; |
|
114 |
|
115 /** |
|
116 * Returns current Voice UI state. |
|
117 * |
|
118 * @return ETrue if Voice UI is active, EFalse otherwise |
|
119 */ |
|
120 IMPORT_C TBool IsVoiceUiActive() const; |
|
121 |
|
122 private: |
|
123 |
|
124 CIRSystemEventCollector(); |
|
125 |
|
126 void ConstructL(); |
|
127 |
|
128 void NotifyObserversL(TIRSystemEventType aEvent); |
|
129 |
|
130 // from base class MIRSystemEventDetectorObserver |
|
131 void NetworkUpCallbackL(); |
|
132 void NetworkDownCallbackL(); |
|
133 void CallActivatedCallbackL(); |
|
134 void CallDeactivatedCallbackL(); |
|
135 void AudioResourcesAvailableL(); |
|
136 void AudioAutoResumeForbiddenL(); |
|
137 void ErrorCallbackL(TInt aError); |
|
138 |
|
139 // from base class MIRHeadsetEventObserver |
|
140 void HeadsetConnectedCallbackL(); |
|
141 void HeadsetDisconnectedCallbackL(); |
|
142 |
|
143 // from base class MIRDiskSpaceWatcherObserver |
|
144 void NotifyLowDiskSpaceL(); |
|
145 |
|
146 // from base class MIRAudioRoutingObserver |
|
147 void AudioRoutingChangedL(TVROutputDestination aOutputDestination); |
|
148 |
|
149 private: // data |
|
150 |
|
151 /** |
|
152 * Array of system event observers |
|
153 */ |
|
154 RPointerArray<MIRSystemEventObserver> iSystemEventObservers; |
|
155 |
|
156 /** |
|
157 * Detects system events |
|
158 */ |
|
159 CIRSystemEventDetector* iSystemEventDetector; |
|
160 |
|
161 /** |
|
162 * Detects low disk space |
|
163 */ |
|
164 CIRDiskSpaceWatcher* iDiskSpaceWatcher; |
|
165 |
|
166 /** |
|
167 * Observer for accessory events |
|
168 */ |
|
169 CIRAccessoryObserver* iHeadsetObserver; |
|
170 }; |
|
171 |
|
172 #endif // CIRSYSTEMEVENTCOLLECTOR_H |
|