|
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: It manages incall indicator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHONEAUDIOCONTROLLER_H |
|
20 #define CPHONEAUDIOCONTROLLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CPhoneStatusPane; |
|
27 class TPhoneCommandParam; |
|
28 class CPhoneTimer; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * It manages navi pane audio indicators |
|
34 * |
|
35 * @since 1.0 |
|
36 */ |
|
37 class CPhoneAudioController : public CBase, public MCoeControlObserver, |
|
38 public MCoeForegroundObserver |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @return new instance. |
|
45 */ |
|
46 static CPhoneAudioController* NewL(); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CPhoneAudioController(); |
|
52 |
|
53 public: // New functions |
|
54 |
|
55 /** |
|
56 * Activates voice volume control. |
|
57 */ |
|
58 void ActivateVolumeControlL(); |
|
59 |
|
60 /** |
|
61 * Deactivate voice volume control. |
|
62 */ |
|
63 void DeactivateVolumeControl(); |
|
64 |
|
65 /** |
|
66 * Update control using the specified data |
|
67 * @param aCommandParam command parameter |
|
68 */ |
|
69 void HandleVolumeChangeL( TPhoneCommandParam* aCommandParam ); |
|
70 |
|
71 /** |
|
72 * Update control using the specified data |
|
73 * @param aCommandParam command parameter |
|
74 */ |
|
75 void HandleIhfChange( TPhoneCommandParam* aCommandParam ); |
|
76 |
|
77 /** |
|
78 * Update control using the specified data |
|
79 * @param aCommandParam command parameter |
|
80 */ |
|
81 void HandleMuteChange( TPhoneCommandParam* aCommandParam ); |
|
82 |
|
83 /** |
|
84 * Gets volume level from navi pane control. |
|
85 * @return Volume level. |
|
86 */ |
|
87 TInt VolumeLevelFromControl(); |
|
88 |
|
89 private: // MCoeControlObserver |
|
90 |
|
91 void HandleControlEventL( CCoeControl* aControl, |
|
92 TCoeEvent aEventType ); |
|
93 |
|
94 private: // MCoeForegroundObserver |
|
95 |
|
96 /** |
|
97 * Handles the application coming to the foreground. |
|
98 */ |
|
99 void HandleGainingForeground(); |
|
100 |
|
101 /** |
|
102 * Handles the application going into the background. |
|
103 */ |
|
104 void HandleLosingForeground(); |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * C++ constructor. |
|
110 */ |
|
111 CPhoneAudioController(); |
|
112 |
|
113 /** |
|
114 * Symbian OS constructor. |
|
115 */ |
|
116 void ConstructL(); |
|
117 |
|
118 /** |
|
119 * Update indicator. |
|
120 */ |
|
121 void ActivateL(); |
|
122 |
|
123 /** |
|
124 * Recovery system callback |
|
125 */ |
|
126 static TInt DoRecoverActivateL( TAny* aAny ); |
|
127 |
|
128 /** |
|
129 * Pushes new decorator to navi pane replacing the |
|
130 * previous one if needed. |
|
131 * @param aNew new to replace the old one. |
|
132 */ |
|
133 void PushL(CAknNavigationDecorator& aNew); |
|
134 |
|
135 /** |
|
136 * Callback function. Called when navi pane should be updated |
|
137 * back to default. |
|
138 * @param aAny pointer to instance of this class. |
|
139 * @return KErrNone always. |
|
140 */ |
|
141 static TInt DoUpdateNaviPaneToDefault( TAny* aAny ); |
|
142 |
|
143 /** |
|
144 * Get current volume decorator (Ihf or Ear) |
|
145 * @return Current volume decorator |
|
146 */ |
|
147 CAknNavigationDecorator& VolumeDecorator(); |
|
148 |
|
149 /** |
|
150 * Get current volume control (Ihf or Ear) |
|
151 * @return Current volume control (Ihf or Ear) |
|
152 */ |
|
153 CAknVolumeControl& VolumeControl(); |
|
154 |
|
155 /** |
|
156 * Get current volume level (Ihf or Ear) |
|
157 * @return Current Ihf or Ear volume level |
|
158 */ |
|
159 TInt VolumeLevel(); |
|
160 |
|
161 /** |
|
162 * Select decorator based on current audio status |
|
163 * @return Selected decorator (Ihf, Ear or Muted). |
|
164 */ |
|
165 CAknNavigationDecorator& SelectDecoratorL(); |
|
166 |
|
167 /** |
|
168 * Set volume level for given volume control |
|
169 * @param aVolumeControl Volume control |
|
170 * @param aVolumeLevel New volume level |
|
171 */ |
|
172 void SetVolumeLevel(CAknVolumeControl& aVolumeControl, TInt aVolumeLevel); |
|
173 |
|
174 private: // Data |
|
175 |
|
176 // Recovery id for activating volume control |
|
177 TInt iActivateRecoveryId; |
|
178 |
|
179 CPhoneStatusPane* iStatusPane; |
|
180 |
|
181 // Count the volume control activations |
|
182 TInt iVolumeControlCount; |
|
183 |
|
184 // Owned IHF volume control |
|
185 CAknNavigationDecorator* iIhfVolumeControl; |
|
186 |
|
187 // IHF volume, from 1 to 10 |
|
188 TInt iIhfVolume; |
|
189 |
|
190 // ETrue IHF is active |
|
191 TBool iIhfMode; |
|
192 |
|
193 // ETrue if transfer to or from IHF pending |
|
194 TBool iIhfTransferPending; |
|
195 |
|
196 // Owned non-IHF volume control. |
|
197 CAknNavigationDecorator* iEarVolumeControl; |
|
198 |
|
199 // Non-IHF volume, from 1 to 10 |
|
200 TInt iEarVolume; |
|
201 |
|
202 // Owned muted indicator |
|
203 CAknNavigationDecorator* iMutedControl; |
|
204 |
|
205 // ETrue phone is muted |
|
206 TBool iMuted; |
|
207 |
|
208 // ETrue if timed control transfer to muted is pending |
|
209 TBool iTimedMuteTransferPending; |
|
210 |
|
211 // Pointer the current control that is in navi pane |
|
212 CAknNavigationDecorator* iOldControl; |
|
213 |
|
214 // Owned timer to update navi pane |
|
215 CPhoneTimer* iNaviPaneUpdateTimer; |
|
216 |
|
217 /** |
|
218 * ETrue if Telephony is the foreground application, |
|
219 * otherwise EFalse. |
|
220 */ |
|
221 TBool iPhoneInForeground; |
|
222 |
|
223 }; |
|
224 |
|
225 #endif // CPHONEAUDIOCONTROLLER_H |
|
226 |
|
227 // End of File |