|
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: Contains implementation of the TRadioSettings class, which holds |
|
15 * the RadioEngine settings. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include "fmradioengine.h" |
|
22 #include "fmradioengineradiosettings.h" |
|
23 |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ---------------------------------------------------- |
|
28 // TRadioSettings::TRadioSettings |
|
29 // Default class constructor. |
|
30 // ---------------------------------------------------- |
|
31 // |
|
32 TRadioSettings::TRadioSettings(): |
|
33 iFMRadioHeadsetVolume( KDefaultRadioVolume ), |
|
34 iFMRadioSpeakerVolume( KDefaultRadioVolume ), |
|
35 iCurrentPreset( 0 ), |
|
36 iFrequency( KDefaultRadioFrequency ), |
|
37 iMaxFrequency( 0 ), |
|
38 iMinFrequency( 0 ), |
|
39 iFrequencyStepSize( 0 ), |
|
40 iDecimalCount( 0 ), |
|
41 iAudioMode( CRadioEngine::EFMRadioStereo ), |
|
42 iAudioOutput(CRadioEngine::EFMRadioOutputHeadset ), |
|
43 iMuteOn(EFalse), |
|
44 iRadioOn( EFalse), |
|
45 iRadioMode( CRadioEngine::ERadioPresetMode ), |
|
46 iIsHeadsetConnected( EFalse ), |
|
47 iFlightModeEnabled( EFalse ), |
|
48 iStartupCount( 0 ), |
|
49 iRdsAfSearchEnabled( EFalse ), |
|
50 iJapanRegionAllowed( ETrue ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------- |
|
55 // TRadioSettings::Volume |
|
56 // retrieve current headset volume level |
|
57 // Returns: iFMRadioHeadsetVolume: headset volume |
|
58 // ---------------------------------------------------- |
|
59 // |
|
60 TInt TRadioSettings::HeadsetVolume() const |
|
61 { |
|
62 return iFMRadioHeadsetVolume; |
|
63 } |
|
64 |
|
65 // ---------------------------------------------------- |
|
66 // TRadioSettings::SpeakerVolume |
|
67 // retrieve current speaker volume level |
|
68 // Returns: iFMRadioSpeakerVolume: speaker volume |
|
69 // ---------------------------------------------------- |
|
70 // |
|
71 TInt TRadioSettings::SpeakerVolume() const |
|
72 { |
|
73 return iFMRadioSpeakerVolume; |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------- |
|
77 // TRadioSettings::CurrentPreset |
|
78 // retrieve currently selected channel |
|
79 // Returns: iCurrentPreset: current preset index number |
|
80 // ---------------------------------------------------- |
|
81 // |
|
82 TInt TRadioSettings::CurrentPreset() const |
|
83 { |
|
84 return iCurrentPreset; |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------- |
|
88 // TRadioSettings::Frequency |
|
89 // retrieve current frequency |
|
90 // Returns: iFrequency: current frequency |
|
91 // ---------------------------------------------------- |
|
92 // |
|
93 TInt TRadioSettings::Frequency() const |
|
94 { |
|
95 return iFrequency; |
|
96 } |
|
97 |
|
98 // ---------------------------------------------------- |
|
99 // TRadioSettings::MaxFrequency |
|
100 // retrieve max frequency |
|
101 // ---------------------------------------------------- |
|
102 // |
|
103 TUint32 TRadioSettings::MaxFrequency() const |
|
104 { |
|
105 return iMaxFrequency; |
|
106 } |
|
107 |
|
108 // ---------------------------------------------------- |
|
109 // TRadioSettings::MinFrequency |
|
110 // retrieve min frequency |
|
111 // ---------------------------------------------------- |
|
112 // |
|
113 TUint32 TRadioSettings::MinFrequency() const |
|
114 { |
|
115 return iMinFrequency; |
|
116 } |
|
117 |
|
118 // ---------------------------------------------------- |
|
119 // TRadioSettings::FrequencyStepSize |
|
120 // return step size for tuning |
|
121 // ---------------------------------------------------- |
|
122 // |
|
123 TUint32 TRadioSettings::FrequencyStepSize() const |
|
124 { |
|
125 return iFrequencyStepSize; |
|
126 } |
|
127 |
|
128 // ---------------------------------------------------- |
|
129 // TRadioSettings::DecimalCount |
|
130 // Returns decimal count for current region MHz information |
|
131 // ---------------------------------------------------- |
|
132 // |
|
133 TInt TRadioSettings::DecimalCount() const |
|
134 { |
|
135 return iDecimalCount; |
|
136 } |
|
137 |
|
138 // ---------------------------------------------------- |
|
139 // TRadioSettings::AudioMode |
|
140 // retrieve current audio mode (stereo or mono) |
|
141 // Returns: iAudioMode: current mode |
|
142 // ---------------------------------------------------- |
|
143 // |
|
144 CRadioEngine::TFMRadioAudioMode TRadioSettings::AudioMode() const |
|
145 { |
|
146 return iAudioMode; |
|
147 } |
|
148 |
|
149 // ---------------------------------------------------- |
|
150 // TRadioSettings::AudioOutput |
|
151 // retrieve current audio output (headset/ihf) |
|
152 // Returns: iAudioOutput: current audio output |
|
153 // ---------------------------------------------------- |
|
154 // |
|
155 CRadioEngine::TFMRadioAudioOutput TRadioSettings::AudioOutput() const |
|
156 { |
|
157 return iAudioOutput; |
|
158 } |
|
159 |
|
160 // ---------------------------------------------------- |
|
161 // TRadioSettings::IsMuteOn |
|
162 // retrieve current mute state (on/off) |
|
163 // Returns: iMuteOn: mute flag |
|
164 // ---------------------------------------------------- |
|
165 // |
|
166 TBool TRadioSettings::IsMuteOn() const |
|
167 { |
|
168 return iMuteOn; |
|
169 } |
|
170 |
|
171 // ---------------------------------------------------- |
|
172 // TRadioSettings::IsRadioOn |
|
173 // retrieve current radio on state (on/off) |
|
174 // Returns: iRadioOn: a flag indicating radio on/off |
|
175 // ---------------------------------------------------- |
|
176 // |
|
177 TBool TRadioSettings::IsRadioOn() const |
|
178 { |
|
179 return iRadioOn; |
|
180 } |
|
181 |
|
182 // ---------------------------------------------------- |
|
183 // TRadioSettings::RadioMode |
|
184 // retrieve the current radio mode (preset or direct frequency) |
|
185 // Returns: iRadioMode: a flag indicating radio mode |
|
186 // ---------------------------------------------------- |
|
187 // |
|
188 CRadioEngine::TRadioMode TRadioSettings::RadioMode() const |
|
189 { |
|
190 return iRadioMode; |
|
191 } |
|
192 |
|
193 // ---------------------------------------------------- |
|
194 // TRadioSettings::IsHeadsetConnected |
|
195 // retrieve the current headset mode (connected or disconnected) |
|
196 // Returns: iIsHeadsetConnected: a flag indicating if headset is connected |
|
197 // ---------------------------------------------------- |
|
198 // |
|
199 TBool TRadioSettings::IsHeadsetConnected() const |
|
200 { |
|
201 return iIsHeadsetConnected; |
|
202 } |
|
203 |
|
204 // ---------------------------------------------------- |
|
205 // TRadioSettings::IsFlightModeEnabled |
|
206 // retrieve the current flight mode status (on/off) |
|
207 // Returns: iFlightModeEnabled: a flag indicating if flight mode is enabled |
|
208 // ---------------------------------------------------- |
|
209 // |
|
210 TBool TRadioSettings::IsFlightModeEnabled() const |
|
211 { |
|
212 return iFlightModeEnabled; |
|
213 } |
|
214 |
|
215 // ---------------------------------------------------- |
|
216 // TRadioSettings::IsRdsAfSearchEnabled |
|
217 // ---------------------------------------------------- |
|
218 // |
|
219 EXPORT_C TBool TRadioSettings::IsRdsAfSearchEnabled() |
|
220 { |
|
221 return iRdsAfSearchEnabled; |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------- |
|
225 // TRadioSettings::SetHeadsetVolume |
|
226 // set the current fm radio headset volume |
|
227 // Returns: none |
|
228 // ---------------------------------------------------- |
|
229 // |
|
230 void TRadioSettings::SetHeadsetVolume( |
|
231 const TInt aVolume) // the new volume |
|
232 { |
|
233 iFMRadioHeadsetVolume = aVolume; |
|
234 } |
|
235 |
|
236 // ---------------------------------------------------- |
|
237 // TRadioSettings::SetSpeakerVolume |
|
238 // set the current fm radio speaker volume |
|
239 // Returns: none |
|
240 // ---------------------------------------------------- |
|
241 // |
|
242 void TRadioSettings::SetSpeakerVolume( |
|
243 const TInt aVolume) // new volume |
|
244 { |
|
245 iFMRadioSpeakerVolume = aVolume; |
|
246 } |
|
247 |
|
248 |
|
249 // ---------------------------------------------------- |
|
250 // TRadioSettings::SetCurrentPreset |
|
251 // set the current preset |
|
252 // Returns: none |
|
253 // ---------------------------------------------------- |
|
254 // |
|
255 void TRadioSettings::SetCurrentPreset( |
|
256 const TInt aChannel) //new channel to be set |
|
257 { |
|
258 iCurrentPreset = aChannel; |
|
259 } |
|
260 |
|
261 // ---------------------------------------------------- |
|
262 // TRadioSettings::SetFrequency |
|
263 // set the current frequency |
|
264 // Returns: none |
|
265 // ---------------------------------------------------- |
|
266 // |
|
267 void TRadioSettings::SetFrequency( |
|
268 const TInt aFrequency) // new frequency |
|
269 { |
|
270 iFrequency = aFrequency; |
|
271 // if (iFrequency < 87500000 || iFrequency > 108000000) |
|
272 // iFrequency = 87500000; |
|
273 } |
|
274 |
|
275 // ---------------------------------------------------- |
|
276 // TRadioSettings::SetMaxFrequency |
|
277 // set the max frequency |
|
278 // Returns: none |
|
279 // ---------------------------------------------------- |
|
280 // |
|
281 void TRadioSettings::SetMaxFrequency( const TUint32 aMaxFrequency ) |
|
282 { |
|
283 iMaxFrequency = aMaxFrequency; |
|
284 } |
|
285 |
|
286 // ---------------------------------------------------- |
|
287 // TRadioSettings::SetMinFrequency |
|
288 // set min frequency |
|
289 // Returns: none |
|
290 // ---------------------------------------------------- |
|
291 // |
|
292 void TRadioSettings::SetMinFrequency( const TUint32 aMinFrequency ) |
|
293 { |
|
294 iMinFrequency = aMinFrequency; |
|
295 } |
|
296 |
|
297 // ---------------------------------------------------- |
|
298 // TRadioSettings::SetFrequencyStepSize |
|
299 // set step size for manual tuning. |
|
300 // Returns: none |
|
301 // ---------------------------------------------------- |
|
302 // |
|
303 void TRadioSettings::SetFrequencyStepSize( const TUint32 aFrequencyStepSize ) |
|
304 { |
|
305 iFrequencyStepSize = aFrequencyStepSize; |
|
306 } |
|
307 |
|
308 // ---------------------------------------------------- |
|
309 // TRadioSettings::SetDecimalCount |
|
310 // Set decimal count for current region MHz information |
|
311 // Returns: none |
|
312 // ---------------------------------------------------- |
|
313 // |
|
314 void TRadioSettings::SetDecimalCount( const TInt aDecimalCount ) |
|
315 { |
|
316 iDecimalCount = aDecimalCount; |
|
317 } |
|
318 |
|
319 // ---------------------------------------------------- |
|
320 // TRadioSettings::SetAudioMode |
|
321 // set the current audio mode |
|
322 // Returns: none |
|
323 // ---------------------------------------------------- |
|
324 // |
|
325 void TRadioSettings::SetAudioMode( |
|
326 const CRadioEngine::TFMRadioAudioMode aAudioMode) // new audio mode |
|
327 { |
|
328 iAudioMode = aAudioMode; |
|
329 } |
|
330 |
|
331 // ---------------------------------------------------- |
|
332 // TRadioSettings::SetAudioOutput |
|
333 // set the current audio output |
|
334 // Returns: none |
|
335 // ---------------------------------------------------- |
|
336 // |
|
337 void TRadioSettings::SetAudioOutput( |
|
338 const CRadioEngine::TFMRadioAudioOutput aAudioOutput) // new audio output |
|
339 { |
|
340 iAudioOutput = aAudioOutput; |
|
341 } |
|
342 |
|
343 // ---------------------------------------------------- |
|
344 // TRadioSettings::SetMuteOn |
|
345 // set mute state to on |
|
346 // Returns: none |
|
347 // ---------------------------------------------------- |
|
348 // |
|
349 void TRadioSettings::SetMuteOn() |
|
350 { |
|
351 iMuteOn = ETrue; |
|
352 } |
|
353 |
|
354 // ---------------------------------------------------- |
|
355 // TRadioSettings::SetMuteOff |
|
356 // set mute state to off |
|
357 // Returns: none |
|
358 // ---------------------------------------------------- |
|
359 // |
|
360 void TRadioSettings::SetMuteOff() |
|
361 { |
|
362 iMuteOn = EFalse; |
|
363 } |
|
364 |
|
365 // ---------------------------------------------------- |
|
366 // TRadioSettings::SetRadioOn |
|
367 // set radio state to "on" |
|
368 // Returns: none |
|
369 // ---------------------------------------------------- |
|
370 // |
|
371 void TRadioSettings::SetRadioOn() |
|
372 { |
|
373 iRadioOn = ETrue; |
|
374 } |
|
375 |
|
376 // ---------------------------------------------------- |
|
377 // TRadioSettings::SetRadioOff |
|
378 // set radio state to "off" |
|
379 // Returns: none |
|
380 // ---------------------------------------------------- |
|
381 // |
|
382 void TRadioSettings::SetRadioOff() |
|
383 { |
|
384 iRadioOn = EFalse; |
|
385 } |
|
386 |
|
387 // ---------------------------------------------------- |
|
388 // TRadioSettings::SetRadioMode |
|
389 // set radio mode |
|
390 // Returns: none |
|
391 // ---------------------------------------------------- |
|
392 // |
|
393 void TRadioSettings::SetRadioMode( |
|
394 const CRadioEngine::TRadioMode aRadioMode) // new radio mode |
|
395 { |
|
396 iRadioMode = aRadioMode; |
|
397 } |
|
398 |
|
399 // ---------------------------------------------------- |
|
400 // TRadioSettings::SetHeadsetConnected |
|
401 // set headset connected |
|
402 // Returns: none |
|
403 // ---------------------------------------------------- |
|
404 // |
|
405 void TRadioSettings::SetHeadsetConnected() |
|
406 { |
|
407 iIsHeadsetConnected = ETrue; |
|
408 } |
|
409 |
|
410 // ---------------------------------------------------- |
|
411 // TRadioSettings::SetHeadsetDisconnected |
|
412 // set headset disconnected |
|
413 // Returns: none |
|
414 // ---------------------------------------------------- |
|
415 // |
|
416 void TRadioSettings::SetHeadsetDisconnected() |
|
417 { |
|
418 iIsHeadsetConnected = EFalse; |
|
419 } |
|
420 |
|
421 // ---------------------------------------------------- |
|
422 // TRadioSettings::SetFlightMode |
|
423 // set flightmode status |
|
424 // Returns: none |
|
425 // ---------------------------------------------------- |
|
426 // |
|
427 void TRadioSettings::SetFlightMode( |
|
428 TBool aEnabled) // indicating enable/disable |
|
429 { |
|
430 iFlightModeEnabled = aEnabled; |
|
431 } |
|
432 |
|
433 // ---------------------------------------------------- |
|
434 // TRadioSettings::SetStartupCount |
|
435 // set startup count |
|
436 // ---------------------------------------------------- |
|
437 // |
|
438 void TRadioSettings::SetStartupCount( const TInt aStartupCount ) |
|
439 { |
|
440 iStartupCount = aStartupCount; |
|
441 } |
|
442 |
|
443 // ---------------------------------------------------- |
|
444 // TRadioSettings::StartupCount |
|
445 // return startup count |
|
446 // ---------------------------------------------------- |
|
447 // |
|
448 TInt TRadioSettings::StartupCount() const |
|
449 { |
|
450 return iStartupCount; |
|
451 } |
|
452 |
|
453 // ---------------------------------------------------- |
|
454 // TRadioSettings::SetRdsAfSearchEnabled |
|
455 // ---------------------------------------------------- |
|
456 // |
|
457 void TRadioSettings::SetRdsAfSearchEnabled() |
|
458 { |
|
459 iRdsAfSearchEnabled = ETrue; |
|
460 } |
|
461 |
|
462 // ---------------------------------------------------- |
|
463 // TRadioSettings::SetRdsAfSearchDisabled |
|
464 // ---------------------------------------------------- |
|
465 // |
|
466 void TRadioSettings::SetRdsAfSearchDisabled() |
|
467 { |
|
468 iRdsAfSearchEnabled = EFalse; |
|
469 } |
|
470 |
|
471 // ---------------------------------------------------- |
|
472 // TRadioSettings::SetJapanRegionAllowed |
|
473 // ---------------------------------------------------- |
|
474 // |
|
475 void TRadioSettings::SetJapanRegionAllowed( const TBool aAllowed ) |
|
476 { |
|
477 iJapanRegionAllowed = aAllowed; |
|
478 } |
|
479 |
|
480 // ---------------------------------------------------- |
|
481 // TRadioSettings::IsJapanRegionAllowed |
|
482 // ---------------------------------------------------- |
|
483 // |
|
484 TBool TRadioSettings::IsJapanRegionAllowed() const |
|
485 { |
|
486 return iJapanRegionAllowed; |
|
487 } |
|
488 |
|
489 // end of file |
|
490 |