1 /* |
|
2 * Copyright (c) 2005 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: Control for tuner |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMMSTUNERCONTROL_H |
|
20 #define CAMMSTUNERCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <tuner.h> |
|
25 |
|
26 #include <CMMAControl.h> |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CAMMSTunerPlayer; |
|
31 class CAMMSTunerPresetsHandler; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Control for tuner |
|
36 */ |
|
37 |
|
38 NONSHARABLE_CLASS(CAMMSTunerControl) : public CMMAControl, |
|
39 public MMMTunerObserver, |
|
40 public MMMTunerChangeObserver, |
|
41 public MMMTunerStereoObserver |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CAMMSTunerControl* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CAMMSTunerControl(); |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 /** |
|
58 * Getter for CMMTunerUtility |
|
59 * @return CMMTunerUtility |
|
60 */ |
|
61 CMMTunerUtility* TunerUtility(); |
|
62 |
|
63 /** |
|
64 * Gets the minimum frequency supported by this tuner |
|
65 * with the given modulation. |
|
66 * @return minimum frequency supported by this tuner |
|
67 */ |
|
68 TInt MinFreqL(); |
|
69 |
|
70 /** |
|
71 * Gets the maximum frequency supported by this tuner |
|
72 * with the given modulation. |
|
73 * @return maximum frequency supported by this tuner |
|
74 */ |
|
75 TInt MaxFreqL(); |
|
76 |
|
77 /** |
|
78 * Tunes to the given frequency or to the closest supported frequency. |
|
79 * @param aFreq - the frequency in Hertzs that will be taken into use |
|
80 * @return the frequency in 100 Hertzs that was taken into use |
|
81 |
|
82 */ |
|
83 void SetFrequencyL(TInt aFreq); |
|
84 |
|
85 /** |
|
86 * Gets the frequency which the tuner has been tuned to. |
|
87 * @return the frequency to which the device has been tuned, |
|
88 * in 100 Hertzs |
|
89 */ |
|
90 TInt FrequencyL(); |
|
91 |
|
92 /** |
|
93 * Seeks for the next broadcast signal. |
|
94 * @param aStartFreq - the frequency in Hertzs wherefrom the scan starts |
|
95 * @param aUpwards - if true, the scan proceeds towards higher |
|
96 * frequencies, otherwise towards lower frequencies |
|
97 * @return the found frequency |
|
98 */ |
|
99 TInt SeekL(TInt aStartFreq, TBool aUpwards); |
|
100 |
|
101 /** |
|
102 * Gets the current squelching (muting in frequencies without broadcast) |
|
103 * setting. |
|
104 * @return true if squelch is on or false if squelch is off |
|
105 */ |
|
106 TBool SquelchL(); |
|
107 |
|
108 /** |
|
109 * Sets squelching on or off. |
|
110 * @param aSquelch - true to turn the squelch on or false |
|
111 * to turn the squelch off |
|
112 */ |
|
113 void SetSquelchL(TBool aSquelch); |
|
114 |
|
115 /** |
|
116 * Gets the strength of the recepted signal. |
|
117 * @return a value between 0 and 100 where 0 means the faintest |
|
118 * and 100 the strongest possible signal strength |
|
119 */ |
|
120 TInt SignalStrengthL(); |
|
121 |
|
122 /** |
|
123 * Gets the stereo mode in use. |
|
124 * @return stereo mode in use |
|
125 */ |
|
126 TInt StereoModeL(); |
|
127 |
|
128 /** |
|
129 * Sets the stereo mode. |
|
130 * @param aMode - the stereo mode to be used |
|
131 */ |
|
132 void SetStereoModeL(TInt aMode); |
|
133 |
|
134 /** |
|
135 * Tunes the tuner by using settings specified in the preset. |
|
136 * @param aPreset - the preset to be used. |
|
137 */ |
|
138 void UsePresetL(TInt aPreset); |
|
139 |
|
140 /** |
|
141 * Configures the preset using current frequency and modulation |
|
142 * and stereo mode. |
|
143 * @param aPreset - the preset to be set. |
|
144 */ |
|
145 void SetPresetL(TInt aPreset); |
|
146 |
|
147 /** |
|
148 * Configures the preset using given settings. |
|
149 * @param aPreset - the preset to be set. |
|
150 * @param aFrequency - the frequency to be set. |
|
151 * @param aStereoMode - the stereo mode to be set. |
|
152 */ |
|
153 void SetPresetL(TInt aPreset, TInt aFrequency, TInt aStereoMode); |
|
154 |
|
155 /** |
|
156 * Gets preset frequency |
|
157 * @param aPreset - the preset whose frequency is to be returned |
|
158 . * @return the frequency of the preset in 100 Hertzs |
|
159 */ |
|
160 TInt PresetFrequencyL(TInt aPreset); |
|
161 |
|
162 /** |
|
163 * Gets preset stereo mode |
|
164 * @param aPreset - the preset whose stereo mode is to be returned |
|
165 . * @return the stereo mode of the preset. |
|
166 */ |
|
167 TInt PresetStereoModeL(TInt aPreset); |
|
168 |
|
169 /** |
|
170 * Set preset name |
|
171 * @param aPreset - the preset whose name is to be set |
|
172 * @param aPresetName - the name of the preset |
|
173 */ |
|
174 void SetPresetNameL(TInt aPreset, const TDesC* aPresetName); |
|
175 |
|
176 /** |
|
177 * Get preset name |
|
178 * @param aPreset - the preset whose name is asked |
|
179 * @param aPresetName - the name of the preset |
|
180 */ |
|
181 void GetPresetNameL(TInt aPreset, TPtrC* aPresetName); |
|
182 |
|
183 public: // functions from base classes |
|
184 |
|
185 // from CMMAControl |
|
186 |
|
187 const TDesC& ClassName() const; |
|
188 |
|
189 const TDesC& PublicClassName() const; |
|
190 |
|
191 // from MMMTunerObserver |
|
192 |
|
193 void MToTuneComplete(TInt aError); |
|
194 |
|
195 // from class MMMTunerChangeObserver |
|
196 |
|
197 /** |
|
198 Called when the tuned frequency changes |
|
199 |
|
200 @param aOldFrequency The frequency in use before the change |
|
201 @param aNewFrequency The new tuned frequency |
|
202 */ |
|
203 void MTcoFrequencyChanged(const TFrequency& aOldFrequency, |
|
204 const TFrequency& aNewFrequency); |
|
205 |
|
206 /** |
|
207 Called when the state of the tuner changes. |
|
208 |
|
209 @param aOldState The old state. Bits are set according to TTunerState. |
|
210 @param aNewState The new state. Bits are set according to TTunerState. |
|
211 */ |
|
212 void MTcoStateChanged(const TUint32& aOldState, |
|
213 const TUint32& aNewState); |
|
214 |
|
215 /** |
|
216 This function is called when an external antenna is detached from the device. |
|
217 This does not necessarily indicate that the tuner can no longer be used; the |
|
218 capabilities of the tuner indicate if the external antenna is required in order |
|
219 to use the tuner. |
|
220 */ |
|
221 void MTcoAntennaDetached(); |
|
222 |
|
223 /** |
|
224 This function is called when an external antenna is attached to the device. If |
|
225 the antenna is required to use the tuner, this indicates that the tuner can be |
|
226 used again. |
|
227 */ |
|
228 void MTcoAntennaAttached(); |
|
229 |
|
230 /** |
|
231 This function is called when the device enters or leaves flight mode. If the tuner |
|
232 cannot be used in flight mode when the device enters this mode, this indicates |
|
233 that the tuner can no longer be used; the capabilities of the tuner indicate if |
|
234 it can be used in flight mode or not. |
|
235 |
|
236 @param aFlightMode ETrue if the device has just entered flight mode, EFalse if |
|
237 flight mode has just been left. |
|
238 */ |
|
239 void FlightModeChanged(TBool aFlightMode); |
|
240 |
|
241 // from class MMMTunerStereoObserver |
|
242 |
|
243 /** |
|
244 Called when stereo reception is lost/restored. |
|
245 |
|
246 @param aStereo If true, indicates that stereo reception has just been restored. |
|
247 If false, indicates that stereo reception has just been lost. |
|
248 */ |
|
249 void MTsoStereoReceptionChanged(TBool aStereo); |
|
250 |
|
251 /** |
|
252 Called when a client enables/disabled forced mono reception. |
|
253 |
|
254 @param aForcedMono ETrue if reception is forced to be mono, even when a stereo |
|
255 signal is available. |
|
256 */ |
|
257 void MTsoForcedMonoChanged(TBool aForcedMono); |
|
258 |
|
259 |
|
260 private: |
|
261 |
|
262 /** |
|
263 * C++ default constructor. |
|
264 */ |
|
265 CAMMSTunerControl(); |
|
266 |
|
267 /** |
|
268 * By default Symbian 2nd phase constructor is private. |
|
269 */ |
|
270 void ConstructL(); |
|
271 |
|
272 // Prohibit copy constructor if not deriving from CBase. |
|
273 // CAMMSTunerControl( const CAMMSTunerControl& ); |
|
274 // Prohibit assigment operator if not deriving from CBase. |
|
275 // CAMMSTunerControl& operator=( const CAMMSTunerControl& ); |
|
276 |
|
277 |
|
278 private: // Data |
|
279 |
|
280 TInt iMinFreq; |
|
281 TInt iMaxFreq; |
|
282 |
|
283 CMMTunerUtility* iTunerUtility; |
|
284 CActiveSchedulerWait* iActiveSchedulerWait; |
|
285 CAMMSTunerPresetsHandler* iPresetsHandler; |
|
286 }; |
|
287 |
|
288 #endif // CAMMSTUNERCONTROL_H |
|
289 |
|
290 // End of File |
|