|
1 /* |
|
2 * Copyright (c) 2002-2007 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 the header file of the class CPEAudioData |
|
15 * which is the interface class for Audio Handling Module |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPEAUDIODATA_H |
|
21 #define CPEAUDIODATA_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "mpeaudiodata.h" |
|
25 #include <PSVariables.h> |
|
26 |
|
27 #include <TelephonyAudioRouting.h> |
|
28 // CONSTANTS |
|
29 // None. |
|
30 |
|
31 // MACROS |
|
32 // None. |
|
33 |
|
34 // DATA TYPES |
|
35 // None. |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 // None. |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class MPEPhoneModelInternal; |
|
42 class CPEAudioDtmfTonePlayer; |
|
43 class CPEAudioRoutingMonitor; |
|
44 class CPECallAudioRoutingHandler; |
|
45 class CPEAudioFactory; |
|
46 class CTelephonyAudioRouting; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * This file contains the header file of the class CPEAudioData, |
|
52 * which is an interface class to audio |
|
53 * properties of the system |
|
54 * |
|
55 * @lib audiohandling.lib |
|
56 * @since S60_5.0 |
|
57 */ |
|
58 class CPEAudioData: |
|
59 public CBase, |
|
60 public MPEAudioData |
|
61 { |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 IMPORT_C virtual ~CPEAudioData(); |
|
69 |
|
70 protected: |
|
71 |
|
72 /** |
|
73 * C++ default constructor. |
|
74 */ |
|
75 CPEAudioData( MPEPhoneModelInternal& aPhoneModel ); |
|
76 |
|
77 public: // from MPEAudioData |
|
78 |
|
79 /** |
|
80 * Retrieves Audio mute synchronously. |
|
81 * @param aAudioMute, audio mute is returned in this parameter. |
|
82 */ |
|
83 IMPORT_C void GetAudioMuteSync( TBool& aAudioMute ) const; |
|
84 |
|
85 /** |
|
86 * Retrieves Audio volume synchronously. |
|
87 * @param aAudioVolume, audio volume is returned in this parameter. |
|
88 */ |
|
89 IMPORT_C void GetAudioVolumeSync( TInt& aAudioVolume ) const; |
|
90 |
|
91 /** |
|
92 * Makes synchronous request to set Audio Mute. |
|
93 * @param aAudioMute, mute to be set. |
|
94 */ |
|
95 IMPORT_C void SetAudioMuteSync( const TBool aAudioMute ); |
|
96 |
|
97 /** |
|
98 * Makes synchronous request to set Audio Volume. |
|
99 * @param aAudioVolume, volume to be set. |
|
100 */ |
|
101 IMPORT_C void SetAudioVolumeSync( const TInt aAudioVolume ); |
|
102 |
|
103 /** |
|
104 * Makes request to Telephony Audio Routing to set audio output path |
|
105 * @param aOutput, audio output path |
|
106 * @param aShowNote, audio note status |
|
107 * @return KErrNone or possible errorcode. |
|
108 */ |
|
109 IMPORT_C TInt SetAudioOutput( |
|
110 const TPEAudioOutput aOutput, |
|
111 TBool aShowNote ); |
|
112 |
|
113 /** |
|
114 * Gets volume levels, audio mute, audio mode and audio volume |
|
115 * at startup and starts monitors. |
|
116 * @param None. |
|
117 * @return None. |
|
118 */ |
|
119 IMPORT_C void StartUp(); |
|
120 |
|
121 /** |
|
122 * Sets default volume level if muted when call ended |
|
123 */ |
|
124 IMPORT_C void SetDefaultVolume(); |
|
125 |
|
126 /** |
|
127 * Handles call audio route preference changed |
|
128 */ |
|
129 IMPORT_C TInt CallAudioRoutePreferenceChanged(); |
|
130 |
|
131 /** |
|
132 * Initialises call audio route when call is alerting or answered |
|
133 */ |
|
134 IMPORT_C TInt HandleCallStarting( TBool aVideoCall ); |
|
135 |
|
136 /** |
|
137 * Initialises energency call audio route |
|
138 */ |
|
139 IMPORT_C TInt HandleEnergencyCallStarting(); |
|
140 |
|
141 /** |
|
142 * Ends call audio route when call disconnected |
|
143 */ |
|
144 IMPORT_C void HandleCallEnding(); |
|
145 |
|
146 public: // new |
|
147 |
|
148 /** |
|
149 * Sends AudioHandlingError message to PhoneEngine and saves |
|
150 * errorcode to member variable. |
|
151 * @param aErrorCode, errorcode that is saved to member variable. |
|
152 * @return None. |
|
153 */ |
|
154 void SendErrorMessage( const TInt aErrorCode ); |
|
155 |
|
156 /** |
|
157 * Forwards message given as parameter to PhoneEngine. |
|
158 * @param aMessage, message to be forwarded. |
|
159 * @return None. |
|
160 */ |
|
161 void SendMessage( |
|
162 const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage ); |
|
163 |
|
164 /** |
|
165 * Forwards message given as parameter to Phone Engine |
|
166 * @param aMessage, message to be forwarded. |
|
167 * @param aOutput, audio output path that is saved in member variable. |
|
168 * @return None. |
|
169 */ |
|
170 void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
171 const CTelephonyAudioRouting::TAudioOutput aOutput ); |
|
172 |
|
173 /** |
|
174 * Forwards message given as parameter to Phone Engine |
|
175 * @param aMessage, message to be forwarded. |
|
176 * @param aOutput, audio output path that is saved in member variable. |
|
177 * @return None. |
|
178 */ |
|
179 void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
180 CTelephonyAudioRouting& aTelephonyAudioRouting ); |
|
181 |
|
182 /** |
|
183 * Sets value of audio routing preference |
|
184 */ |
|
185 void SetRoutePreference( TBool aShowNote ); |
|
186 |
|
187 /** |
|
188 * Return value of audio routing preference |
|
189 */ |
|
190 CTelephonyAudioRouting::TAudioOutput RoutePreference(); |
|
191 |
|
192 /** |
|
193 * Return value of previous output |
|
194 */ |
|
195 CTelephonyAudioRouting::TAudioOutput PreviousOutput(); |
|
196 |
|
197 /** |
|
198 * Return value of current output |
|
199 */ |
|
200 CTelephonyAudioRouting::TAudioOutput Output(); |
|
201 |
|
202 /** |
|
203 * Return status of wired accessory availability |
|
204 */ |
|
205 TBool IsWiredAvailable(); |
|
206 |
|
207 /** |
|
208 * Return status of BT accessory availability |
|
209 */ |
|
210 TBool IsBTAvailable(); |
|
211 |
|
212 /** |
|
213 * Return status of TTY accessory availability |
|
214 */ |
|
215 TBool IsTTYAvailable(); |
|
216 |
|
217 /** |
|
218 * Set new audio route to TAR |
|
219 */ |
|
220 void SetTAROutput( CTelephonyAudioRouting::TAudioOutput aOutput, |
|
221 TBool aShowNote ); |
|
222 |
|
223 |
|
224 protected: |
|
225 |
|
226 /** |
|
227 * By default Symbian 2nd phase constructor is private, but we use |
|
228 * it at generalized class. |
|
229 */ |
|
230 void ConstructL( CPEAudioFactory& aAudioFactory ); |
|
231 |
|
232 protected: // New functions |
|
233 |
|
234 /** |
|
235 * Protected function for derived classes to implement for |
|
236 * extended volume handling. Default implementation is empty. |
|
237 * @since S60 v5.0 |
|
238 * @param aVolume New volume value. |
|
239 */ |
|
240 virtual void DoHandleVolumeChange( TInt aVolume ); |
|
241 |
|
242 private: |
|
243 |
|
244 /** |
|
245 * Gets all audio volume values from reporitory and update member variables |
|
246 */ |
|
247 void InitializeAudioVolumes(); |
|
248 |
|
249 |
|
250 /** |
|
251 * Makes request to Telephony Audio Routing to get available audio outputs |
|
252 * @return list of available outputs |
|
253 */ |
|
254 TArray< TPEAudioOutput> GetAvailableOutputs( |
|
255 CTelephonyAudioRouting& aTelephonyAudioRouting ); |
|
256 |
|
257 /** |
|
258 * Converts TAR route value to PE value |
|
259 */ |
|
260 TPEAudioOutput ConvertToPE( CTelephonyAudioRouting::TAudioOutput aOutput ); |
|
261 |
|
262 /** |
|
263 * Converts PE route value to TAR value |
|
264 */ |
|
265 CTelephonyAudioRouting::TAudioOutput ConvertToTAR( TPEAudioOutput aOutput ); |
|
266 /** |
|
267 * Return status of mic mute |
|
268 */ |
|
269 TBool IsMuted() const; |
|
270 |
|
271 protected: |
|
272 // CPhoneModel object which owns this object. |
|
273 MPEPhoneModelInternal& iPhoneModel; |
|
274 // Audio Routing Monitor |
|
275 CPEAudioRoutingMonitor* iAudioRoutingMonitor; |
|
276 // Audio Routing Handler |
|
277 CPECallAudioRoutingHandler* iAudioRoutingHandler; |
|
278 // Telephony Audio Routing interface |
|
279 CTelephonyAudioRouting* iAudioRouting; |
|
280 // Available Audio Outputs |
|
281 RArray<TPEAudioOutput> iPEavailableOutputs; |
|
282 //Flag to indicate whether is Call audio route initialized |
|
283 TBool iRouteInitialized; |
|
284 #ifdef __WINSCW__ |
|
285 // dummy implementation for WINSCW |
|
286 TInt iVolume; |
|
287 TBool iMute; |
|
288 #endif |
|
289 // HeadSet Mode Audio volume |
|
290 TInt iHeadSetVolume; |
|
291 // Loudspeaker Mode Audio volume |
|
292 TInt iLoudspeakerVolume; |
|
293 // ETrue when audio output changed |
|
294 TBool iAudioOutputChanged; |
|
295 }; |
|
296 |
|
297 #endif // CPEAUDIODATA_H |
|
298 |
|
299 // End of File |