|
1 /* |
|
2 * Copyright (c) 2004 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: This file contains definitions of GlobalAudioSettings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef GLOBALAUDIOSETTINGSIMPL_H |
|
22 #define GLOBALAUDIOSETTINGSIMPL_H |
|
23 |
|
24 #include <e32property.h> |
|
25 #include <e32base.h> |
|
26 #include <e32debug.h> |
|
27 #include "GlobalAudioSettingsData.h" |
|
28 #include <GlobalAudioSettings.h> |
|
29 #include <MAudioClientsListObserver.h> |
|
30 |
|
31 class MAudioSettingsObserver; |
|
32 //class CGlobalAudioSettings; |
|
33 class CWarningTonesObserverAO; |
|
34 class CMessagingTonesObserverAO; |
|
35 class CSilentProfileObserverAO; |
|
36 class CVibraObserverAO; |
|
37 class CAudioClientsListManagerAO; |
|
38 |
|
39 |
|
40 /** |
|
41 * Defines functions that client uses to set phone profile settings. |
|
42 * |
|
43 * @lib GlobalAudioSettings.lib |
|
44 * @since Series 60 3.2 |
|
45 */ |
|
46 class CGlobalAudioSettingsImpl: public CBase |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * function for creating the GlobalAudioSettingsImpl |
|
51 * |
|
52 */ |
|
53 IMPORT_C static CGlobalAudioSettingsImpl* NewL( |
|
54 CGlobalAudioSettings& aGlobalAudioSettings, |
|
55 MAudioSettingsObserver& aAudioSettingsObserver); |
|
56 /** |
|
57 * Destructor. |
|
58 * |
|
59 */ |
|
60 ~CGlobalAudioSettingsImpl(); |
|
61 /** |
|
62 * Returns warning tones status. |
|
63 * |
|
64 * @since Series 60 3.2 |
|
65 * @return TBool aEnable. ETrue if warning tones are enabled else EFalse. |
|
66 */ |
|
67 IMPORT_C TBool IsWarningTonesEnabled(); |
|
68 /** |
|
69 * Returns message tones status. |
|
70 * |
|
71 * @since Series 60 3.2 |
|
72 * @return TBool aEnable. ETrue if message tones are enabled else EFalse. |
|
73 */ |
|
74 IMPORT_C TBool IsMessageTonesEnabled(); |
|
75 /** |
|
76 * Returns silent profile status. |
|
77 * |
|
78 * @since Series 60 3.2 |
|
79 * @return TBool aEnable. ETrue if current profile is silent profile else EFalse. |
|
80 */ |
|
81 IMPORT_C TBool IsSilentProfileEnabled(); |
|
82 /** |
|
83 * Returns vibra is enabled or not in the current profile status. |
|
84 * |
|
85 * @since Series 60 3.2 |
|
86 * @return TBool aEnable. ETrue if current profile vibra active else EFalse. |
|
87 */ |
|
88 IMPORT_C TBool IsVibraEnabled(); |
|
89 /** |
|
90 * Returns PublicSilence is enabled or not status. |
|
91 * |
|
92 * @since Series 60 3.2 |
|
93 * @return TBool aEnable. ETrue if PublicSilence active else EFalse. |
|
94 */ |
|
95 IMPORT_C TBool IsPublicSilenceEnabled(); |
|
96 |
|
97 /** |
|
98 * Registers audio clients list observer. |
|
99 * |
|
100 * When registered successfully, the observer will start receiveing |
|
101 * callback defined in MAudioClientsListObserver when audio clients list |
|
102 * changes. |
|
103 * |
|
104 * @since S60 3.2 |
|
105 * @param MAudioClientsListObserver& aObserver. A reference to class |
|
106 * implementing MAudioClientsListObserver interface. |
|
107 * @return TInt. KErrNone if successful. KErrAlreadyExists if the observer |
|
108 * is already registered. |
|
109 */ |
|
110 TInt RegisterAudioClientsListObserver( |
|
111 MAudioClientsListObserver& aObserver ); |
|
112 |
|
113 /** |
|
114 * Unregisters audio clients list observer. |
|
115 * |
|
116 * When unregistered, the observer will no longer receive callback when |
|
117 * audio clients list changes. |
|
118 * |
|
119 * @since S60 3.2 |
|
120 * @param MAudioClientsListObserver& aObserver. A reference to class |
|
121 * implementing MAudioClientsListObserver interface. |
|
122 * @return TInt. KErrNone if successful. KErrNotFound if the observer |
|
123 * is not registered. |
|
124 */ |
|
125 TInt UnregisterAudioClientsListObserver( |
|
126 MAudioClientsListObserver& aObserver); |
|
127 |
|
128 /** |
|
129 * Gets audio clients list. |
|
130 * |
|
131 * On return of this function, the parameter aList will contain active |
|
132 * audio client application process ids. |
|
133 * |
|
134 * The parameter aList will be reset in the case |
|
135 * |
|
136 * @since S60 3.2 |
|
137 * @param TAudioClientListType aFilter. Type of client list. |
|
138 * @param RArray<TProcessId>& aList. A reference to RArray. |
|
139 * @return TInt. KErrNone if successful. KErrBadName if |
|
140 * aType is not one of the TAudioClientListType enumeration. |
|
141 * Otherwise a systemwide error code. |
|
142 * In case of error, the array aList will be reset. |
|
143 */ |
|
144 TInt GetAudioClientsList( |
|
145 CGlobalAudioSettings::TAudioClientListType aType, |
|
146 RArray<TProcessId>& aList ); |
|
147 |
|
148 |
|
149 private: |
|
150 CGlobalAudioSettingsImpl(CGlobalAudioSettings &aGlobalAudioSettings, |
|
151 MAudioSettingsObserver& aAudioSettingsObserver); |
|
152 /** |
|
153 * Second Phase Costructor for GlobalAudioSettingsImpl Instance |
|
154 * @since 3.2 |
|
155 * @param void |
|
156 */ |
|
157 void ConstructL(); |
|
158 |
|
159 private: |
|
160 TGlobalAudioSettings iGlobalAudioSettingsData; |
|
161 CGlobalAudioSettings& iGlobalAudioSettings; |
|
162 MAudioSettingsObserver& iAudioSettingsObserver; |
|
163 CWarningTonesObserverAO* iWarningTonesObserverAO; |
|
164 CMessagingTonesObserverAO* iMessagingTonesObserverAO; |
|
165 CSilentProfileObserverAO* iSilentProfileObserverAO; |
|
166 CVibraObserverAO* iVibraObserverAO; |
|
167 // Object managing Audio Clients List implementation |
|
168 CAudioClientsListManagerAO* iCAudioClientsListManagerAO; |
|
169 // Object managing Paused Clients List implementation |
|
170 CAudioClientsListManagerAO* iPausedClientsListManagerAO; |
|
171 // List of Audio Clients List Observer objects |
|
172 RPointerArray<MAudioClientsListObserver> iAudioClientsListObserverArray; |
|
173 }; |
|
174 |
|
175 |
|
176 class CWarningTonesObserverAO : public CActive |
|
177 { |
|
178 public: |
|
179 // Ist Phase constr and Destr |
|
180 static CWarningTonesObserverAO* NewL(CGlobalAudioSettings &aGlobalAudioSettings, |
|
181 MAudioSettingsObserver& aAudioSettingsObserver, |
|
182 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
183 ~CWarningTonesObserverAO(); |
|
184 void Subscribe(); |
|
185 |
|
186 protected: |
|
187 // From CActive |
|
188 void RunL(); |
|
189 void DoCancel(); |
|
190 TInt RunError(TInt aError); |
|
191 |
|
192 private: |
|
193 // Constr and IInd phase constr |
|
194 CWarningTonesObserverAO(CGlobalAudioSettings &aGlobalAudioSettings, |
|
195 MAudioSettingsObserver& aAudioSettingsObserver, |
|
196 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
197 void ConstructL(); |
|
198 CGlobalAudioSettings& iGlobalAudioSettings; |
|
199 MAudioSettingsObserver& iAudioSettingsObserver; |
|
200 RProperty iWarningTonesProperty; |
|
201 TGlobalAudioSettings& iGlobalAudioSettingsData; |
|
202 }; |
|
203 |
|
204 class CMessagingTonesObserverAO : public CActive |
|
205 { |
|
206 public: |
|
207 // Ist Phase constr and Destr |
|
208 static CMessagingTonesObserverAO* NewL(CGlobalAudioSettings &aGlobalAudioSettings, |
|
209 MAudioSettingsObserver& aAudioSettingsObserver, |
|
210 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
211 ~CMessagingTonesObserverAO(); |
|
212 void Subscribe(); |
|
213 |
|
214 protected: |
|
215 // From CActive |
|
216 void RunL(); |
|
217 void DoCancel(); |
|
218 TInt RunError(TInt aError); |
|
219 |
|
220 private: |
|
221 // Constr and IInd phase constr |
|
222 CMessagingTonesObserverAO(CGlobalAudioSettings &aGlobalAudioSettings, |
|
223 MAudioSettingsObserver& aAudioSettingsObserver, |
|
224 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
225 void ConstructL(); |
|
226 CGlobalAudioSettings& iGlobalAudioSettings; |
|
227 MAudioSettingsObserver& iAudioSettingsObserver; |
|
228 RProperty iMessagingTonesProperty; |
|
229 TGlobalAudioSettings& iGlobalAudioSettingsData; |
|
230 }; |
|
231 |
|
232 class CSilentProfileObserverAO : public CActive |
|
233 { |
|
234 public: |
|
235 // Ist Phase constr and Destr |
|
236 static CSilentProfileObserverAO* NewL(CGlobalAudioSettings &aGlobalAudioSettings, |
|
237 MAudioSettingsObserver& aAudioSettingsObserver, |
|
238 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
239 ~CSilentProfileObserverAO(); |
|
240 void Subscribe(); |
|
241 |
|
242 protected: |
|
243 // From CActive |
|
244 void RunL(); |
|
245 void DoCancel(); |
|
246 TInt RunError(TInt aError); |
|
247 |
|
248 private: |
|
249 // Constr and IInd phase constr |
|
250 CSilentProfileObserverAO(CGlobalAudioSettings &aGlobalAudioSettings, |
|
251 MAudioSettingsObserver& aAudioSettingsObserver, |
|
252 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
253 void ConstructL(); |
|
254 CGlobalAudioSettings& iGlobalAudioSettings; |
|
255 MAudioSettingsObserver& iAudioSettingsObserver; |
|
256 RProperty iSilentProfileProperty; |
|
257 TGlobalAudioSettings& iGlobalAudioSettingsData; |
|
258 }; |
|
259 |
|
260 class CVibraObserverAO : public CActive |
|
261 { |
|
262 public: |
|
263 // Ist Phase constr and Destr |
|
264 static CVibraObserverAO* NewL(CGlobalAudioSettings &aGlobalAudioSettings, |
|
265 MAudioSettingsObserver& aAudioSettingsObserver, |
|
266 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
267 ~CVibraObserverAO(); |
|
268 void Subscribe(); |
|
269 |
|
270 protected: |
|
271 // From CActive |
|
272 void RunL(); |
|
273 void DoCancel(); |
|
274 TInt RunError(TInt aError); |
|
275 |
|
276 private: |
|
277 // Constr and IInd phase constr |
|
278 CVibraObserverAO(CGlobalAudioSettings &aGlobalAudioSettings, |
|
279 MAudioSettingsObserver& aAudioSettingsObserver, |
|
280 TGlobalAudioSettings& aGlobalAudioSettingsData); |
|
281 void ConstructL(); |
|
282 CGlobalAudioSettings& iGlobalAudioSettings; |
|
283 MAudioSettingsObserver& iAudioSettingsObserver; |
|
284 RProperty iVibraProperty; |
|
285 TGlobalAudioSettings& iGlobalAudioSettingsData; |
|
286 }; |
|
287 |
|
288 #endif // GLOBALAUDIOSETTINGSIMPL_H |
|
289 |
|
290 // End of file |