|
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: The class implements the core functionality of the |
|
15 * Radio Engine |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef FMRADIOENGINE_H |
|
21 #define FMRADIOENGINE_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <AccMonitorCapabilities.h> |
|
25 #include <fmradiointernalpskeys.h> |
|
26 #include <RadioUtility.h> |
|
27 #include <RadioFmTunerUtility.h> |
|
28 #include <RadioPlayerUtility.h> |
|
29 #include <RadioPresetUtility.h> |
|
30 #include <RadioFmPresetUtility.h> |
|
31 #include <etelmm.h> |
|
32 |
|
33 #include "fmradiosystemeventdetectorobserver.h" |
|
34 #include "fmradionetworkchangeobserver.h" |
|
35 #include "fmradiordsobserver.h" |
|
36 #include "fmradioengine.hrh" |
|
37 #include "fmradioheadseteventobserver.h" |
|
38 |
|
39 #ifndef __ACCESSORY_FW |
|
40 #include <DosSvrServices.h> |
|
41 #endif |
|
42 |
|
43 // CONSTANTS |
|
44 const TUint8 KPresetNameLength = 32; |
|
45 const TInt KDefaultRadioFrequency = 87500000; |
|
46 _LIT(KFMRadioEngineResourceFile, "fmradioengine.rsc"); |
|
47 const TInt KFMRadioFreqMultiplier = 1000; |
|
48 |
|
49 // FORWARD DECLARATIONS |
|
50 class CAudioOutput; |
|
51 class CCentralRepositoryHandler; |
|
52 class CDesC16Array; |
|
53 class CFMRadioAccessoryObserver; |
|
54 class CFMRadioContextPublisher; |
|
55 class CFMRadioMobileNetworkInfoListener; |
|
56 class CFMRadioPubSub; |
|
57 class CFMRadioRdsReceiverBase; |
|
58 class CFMRadioSystemEventDetector; |
|
59 class CRadioStateHandler; |
|
60 class MRadioEngineStateChangeCallback; |
|
61 class TRadioSettings; |
|
62 |
|
63 #ifndef __ACCESSORY_FW |
|
64 class RDosServer; |
|
65 class CDosServerObserver; |
|
66 #endif |
|
67 |
|
68 // CLASS DECLARATION |
|
69 |
|
70 /** |
|
71 * This class implements the core functionality of the Radio Engine |
|
72 * |
|
73 * @since S60 3.2 |
|
74 */ |
|
75 class CRadioEngine : public CBase, |
|
76 public MRadioPlayerObserver, |
|
77 public MRadioFmTunerObserver, |
|
78 public MRadioPresetObserver, |
|
79 public MFMRadioSystemEventDetectorObserver, |
|
80 public MFMRadioNetworkChangeObserver, |
|
81 public MFMRadioRdsObserver, |
|
82 public MFMRadioHeadsetEventObserver |
|
83 |
|
84 { |
|
85 public: |
|
86 |
|
87 typedef TBuf<KPresetNameLength> TStationName; |
|
88 |
|
89 enum TRadioMode |
|
90 { |
|
91 ERadioTunerMode, |
|
92 ERadioPresetMode |
|
93 }; |
|
94 |
|
95 enum TFMRadioAudioMode |
|
96 { |
|
97 EFMRadioStereo = 0, |
|
98 EFMRadioMono |
|
99 }; |
|
100 |
|
101 enum TFMRadioAudioOutput |
|
102 { |
|
103 EFMRadioOutputHeadset = 0, |
|
104 EFMRadioOutputIHF |
|
105 }; |
|
106 |
|
107 public: |
|
108 |
|
109 /** |
|
110 * Two-phased class constructor. |
|
111 * @return pointer to CRadioEngine class instance |
|
112 */ |
|
113 IMPORT_C static CRadioEngine* NewL( MRadioEngineStateChangeCallback& aCallback ); |
|
114 /** |
|
115 * Destructor of CRadioEngine class. |
|
116 */ |
|
117 IMPORT_C virtual ~CRadioEngine(); |
|
118 |
|
119 public: // New functions |
|
120 |
|
121 /** |
|
122 * Set radio settings to their default values. |
|
123 * @since Series 60 3.0 |
|
124 * @return none |
|
125 */ |
|
126 IMPORT_C void InitializeRadio(); |
|
127 /** |
|
128 * Retrieves the current radio mode . |
|
129 * @since Series 60 3.0 |
|
130 * @return tune/preset |
|
131 */ |
|
132 IMPORT_C TRadioMode GetRadioMode() const; |
|
133 |
|
134 /** |
|
135 * Gets the current audio mode. |
|
136 * @since Series 60 3.0 |
|
137 * @return stereo/mono |
|
138 * @retval 0 = stereo |
|
139 * @retval 1 = mono |
|
140 */ |
|
141 IMPORT_C TInt GetAudioMode() const; |
|
142 |
|
143 /** |
|
144 * Set the radio's audio mode. |
|
145 * @since Series 60 3.0 |
|
146 * @param aAudioMode the new audio mode |
|
147 * @return none |
|
148 */ |
|
149 IMPORT_C void SetAudioMode( const TFMRadioAudioMode aAudioMode ); |
|
150 |
|
151 /** |
|
152 * get the currently selected channel index. |
|
153 * @since Series 60 3.0 |
|
154 * @return none |
|
155 */ |
|
156 IMPORT_C TInt GetPresetIndex() const; |
|
157 |
|
158 /** |
|
159 * Update the channel located at the index to use the frequency specified. |
|
160 * @since Series 60 3.0 |
|
161 * @param aIndex index into the channel array. |
|
162 * @param aStationName name of the channel |
|
163 * @param aFrequency frequency value to be used. |
|
164 * @return none |
|
165 */ |
|
166 IMPORT_C void SetPresetNameFrequencyL( TInt aIndex, const TStationName& aStationName, TInt aFrequency ); |
|
167 |
|
168 /** |
|
169 * Retrieve the channel frequency at the index specified |
|
170 * @since Series 60 3.0 |
|
171 * @param aIndex index into the channel array. |
|
172 * @return the frequency |
|
173 */ |
|
174 IMPORT_C TInt GetPresetFrequencyL(TInt aIndex) const; |
|
175 |
|
176 /** |
|
177 * Retrieve the channel name at the index specified |
|
178 * @since Series 60 3.0 |
|
179 * @param aIndex index into the channel array. |
|
180 * @return the channel name |
|
181 */ |
|
182 IMPORT_C CRadioEngine::TStationName& GetPresetNameL( TInt aIndex ); |
|
183 |
|
184 /** |
|
185 * Retrieve the channel name and the frequency at the index specified |
|
186 * @param aIndex station index |
|
187 * @param aName stored station name |
|
188 * @param aFrequency preset frequency |
|
189 */ |
|
190 IMPORT_C void GetPresetNameAndFrequencyL( TInt aIndex, TDes& aName, TInt& aFrequency ); |
|
191 |
|
192 /** |
|
193 * Starts the radio. |
|
194 * @since Series 60 3.0 |
|
195 * @return none |
|
196 */ |
|
197 IMPORT_C void RadioOn(); |
|
198 |
|
199 /** |
|
200 * Stops the radio. |
|
201 * @since Series 60 3.0 |
|
202 * @return none |
|
203 */ |
|
204 IMPORT_C void RadioOff(); |
|
205 |
|
206 /** |
|
207 * Returns the radio status |
|
208 * @since ?? |
|
209 * @return ETrue = radio is on, EFalse = radio is off |
|
210 */ |
|
211 IMPORT_C TBool IsRadioOn(); |
|
212 |
|
213 /** |
|
214 * Checks if offine profile is current active profile |
|
215 * @since ?? |
|
216 * @return True / False |
|
217 */ |
|
218 IMPORT_C TBool IsOfflineProfileL(); |
|
219 |
|
220 /** |
|
221 * Tune to the specified frequency |
|
222 * @since Series 60 3.0 |
|
223 * @param aFrequency - frequency to lock onto. |
|
224 * @param aRadioMode - The radio mode to be used. Tuner mode by default |
|
225 * @return none |
|
226 */ |
|
227 IMPORT_C void Tune( TInt aFrequency, TRadioMode aRadioMode = ERadioTunerMode ); |
|
228 |
|
229 /* |
|
230 * Sets tuner mode on i.e. preset channel is not active. |
|
231 * Active preset Channel P&S data is also cleared. |
|
232 * Useful for example when preset channel is deleted. |
|
233 */ |
|
234 IMPORT_C void SetTunerModeOn(); |
|
235 |
|
236 /** |
|
237 * Scan up to the next available frequency. |
|
238 * @since Series 60 3.0 |
|
239 * @return none |
|
240 */ |
|
241 IMPORT_C void ScanUp(); |
|
242 |
|
243 /** |
|
244 * Scan down to the last available frequency. |
|
245 * @since Series 60 3.0 |
|
246 * @return none |
|
247 */ |
|
248 IMPORT_C void ScanDown(); |
|
249 |
|
250 /** |
|
251 * Cancel previously requested scan, and |
|
252 * return to the already tuned frequency. |
|
253 * @since Series 60 3.0 |
|
254 * @return none |
|
255 */ |
|
256 IMPORT_C void CancelScan(); |
|
257 |
|
258 /** |
|
259 * Sets the audio mute state |
|
260 * @since Series 60 3.0 |
|
261 * @param aMuteOn - flag to determine whether mute should be turned on or off |
|
262 * @return none |
|
263 */ |
|
264 IMPORT_C void SetMuteOn(TBool aMuteOn); |
|
265 |
|
266 /** |
|
267 * Gets the audio mute state |
|
268 * @since Series 60 3.0 |
|
269 * @return ETrue or EFalse to indicate whether mute is currently on. |
|
270 */ |
|
271 IMPORT_C TBool IsMuteOn() const; |
|
272 |
|
273 /** |
|
274 * Sets the volume level of the FM radio |
|
275 * @since Series 60 3.0 |
|
276 * @param aVolume - the volume to be used. |
|
277 * @return none |
|
278 */ |
|
279 IMPORT_C void SetVolume(TInt aVolume); |
|
280 |
|
281 /** |
|
282 * Gets the volumelevel. |
|
283 * @since Series 60 3.0 |
|
284 * @return the current volume |
|
285 */ |
|
286 IMPORT_C TInt GetVolume() const; |
|
287 |
|
288 /** |
|
289 * Gets the max volumelevel. |
|
290 * @since Series 60 3.0 |
|
291 * @return the max volume |
|
292 */ |
|
293 IMPORT_C TInt GetMaxVolume() const; |
|
294 |
|
295 /** |
|
296 * Sets the audio Output |
|
297 * @since Series 60 3.0 |
|
298 * @param aAudioOutput - where should the audio be routed? |
|
299 * @return none |
|
300 */ |
|
301 IMPORT_C void SetAudioOutput( const TFMRadioAudioOutput aAudioOutput ); |
|
302 |
|
303 /** |
|
304 * Sets the rds af search enabled |
|
305 * @param aEnabled ETrue if rds af search is enabled; EFalse otherwise. |
|
306 * @return none |
|
307 */ |
|
308 IMPORT_C void SetRdsAfSearchEnable( TBool aEnabled ); |
|
309 |
|
310 /** |
|
311 * Check whether flight mode is currently enabled |
|
312 * @since Series 60 3.0 |
|
313 * @return ETrue or EFalse dependent on whether flightmode is enabled |
|
314 */ |
|
315 IMPORT_C TBool IsRdsAfSearchEnabled() const; |
|
316 |
|
317 /** |
|
318 * @return reference to settings |
|
319 */ |
|
320 IMPORT_C TRadioSettings& RadioSettings( ); |
|
321 |
|
322 /** |
|
323 * Retrieve the current audio output |
|
324 * @since Series 60 3.0 |
|
325 * @return EFMRadioOutputIHF or EFMRadioOutputHeadset |
|
326 */ |
|
327 IMPORT_C TFMRadioAudioOutput GetAudioOutput() const; |
|
328 |
|
329 /** |
|
330 * Tunes to the chosen channel. |
|
331 * @since Series 60 3.0 |
|
332 * @param aIndex - the index number of the channel you wish to tune to. |
|
333 * @return none |
|
334 */ |
|
335 IMPORT_C void TunePresetL(TInt aIndex); |
|
336 |
|
337 /** |
|
338 * Retrieves the current frequency. |
|
339 * @since Series 60 3.0 |
|
340 * @return the frequency |
|
341 */ |
|
342 IMPORT_C TInt GetTunedFrequency() const; |
|
343 |
|
344 /** |
|
345 * Check whether flight mode is currently enabled |
|
346 * @since Series 60 3.0 |
|
347 * @return ETrue or EFalse dependent on whether flightmode is enabled |
|
348 */ |
|
349 IMPORT_C TBool IsFlightModeEnabled() const; |
|
350 |
|
351 /** |
|
352 * Get the frequency range (in Hertz) of the specified band. |
|
353 * This function should be used to enquire the frequency range |
|
354 * of the bands that GetCapabilities reports as supported. |
|
355 * @since Series 60 3.0 |
|
356 * @param aBottomFrequency The variable to set to the lowest frequency allowed |
|
357 * @param aTopFrequency The variable to set to the highest frequency allowed |
|
358 * @return A standard system error code |
|
359 **/ |
|
360 IMPORT_C TInt GetFrequencyBandRange( TInt& aBottomFrequency, TInt& aTopFrequency ); |
|
361 |
|
362 /** |
|
363 * Check whether call is in progress |
|
364 * @since Series 60 3.1 |
|
365 * @return ETrue or EFalse to indicate whether call is in progress |
|
366 */ |
|
367 IMPORT_C TBool IsInCall() const; |
|
368 |
|
369 /** |
|
370 * Has the frequency been set by RDS AF search or not. |
|
371 * |
|
372 * @return ETrue if frequency was set by RDS AF, otherwise EFalse |
|
373 */ |
|
374 IMPORT_C TBool FrequencySetByRdsAf() const; |
|
375 |
|
376 /** |
|
377 * Getter for RDS receiver |
|
378 * |
|
379 * @return Reference to CFMRadioRdsReceiver |
|
380 */ |
|
381 IMPORT_C CFMRadioRdsReceiverBase& RdsReceiver(); |
|
382 /** |
|
383 * Notifies UI that the headset button has been pressed |
|
384 */ |
|
385 void HandleHeadsetButtonPress(); |
|
386 /** |
|
387 * Switches the engine into flight mode, and notifies the UI of |
|
388 * the change in status. |
|
389 */ |
|
390 void HandleFlightModeEnabled(); |
|
391 /** |
|
392 * Switches the engine out of flight mode, and notifies the UI of |
|
393 * the change in status |
|
394 */ |
|
395 void HandleFlightModeDisabled(); |
|
396 /** |
|
397 * Calls the User Interface callback function, indicating the event code and |
|
398 * error code. |
|
399 */ |
|
400 void HandleCallback(TInt aEventCode, TInt aErrorCode ); |
|
401 |
|
402 /** |
|
403 * Gets the headset status |
|
404 * @return ETrue if headset connected |
|
405 */ |
|
406 IMPORT_C TBool IsHeadsetConnected() const; |
|
407 |
|
408 /** |
|
409 * From MRadioPlayerObserver. |
|
410 * Called when Radio state changed. |
|
411 * |
|
412 * @since S60 3.2 |
|
413 * @param aState Radio player state |
|
414 * @param aError A standard system error code, only used when aState is ERadioPlayerIdle |
|
415 */ |
|
416 void MrpoStateChange( TPlayerState aState, TInt aError ); |
|
417 |
|
418 /** |
|
419 * From MRadioPlayerObserver. |
|
420 * Called when volume changes. This may be caused by other applications. |
|
421 * |
|
422 * @since S60 3.2 |
|
423 * @param aVolume Current volume. |
|
424 */ |
|
425 void MrpoVolumeChange( TInt aVolume ); |
|
426 |
|
427 /** |
|
428 * From MRadioPlayerObserver. |
|
429 * Called when mute setting changes. This may be caused by other applications. |
|
430 * |
|
431 * @since S60 3.2 |
|
432 * @param aMute ETrue indicates audio is muted. |
|
433 */ |
|
434 void MrpoMuteChange( TBool aMute ); |
|
435 |
|
436 /** |
|
437 * From MRadioPlayerObserver. |
|
438 * Called when mute setting changes. This may be caused by other applications. |
|
439 * |
|
440 * Called when balance setting changes. This may be caused by other applications. |
|
441 * |
|
442 * @since S60 3.2 |
|
443 * @param aLeftPercentage |
|
444 * Left speaker volume percentage. This can be any value from zero to 100. |
|
445 * Zero value means left speaker is muted. |
|
446 * @param aRightPercentage |
|
447 * Right speaker volume percentage. This can be any value from zero to 100. |
|
448 * Zero value means right speaker is muted. |
|
449 */ |
|
450 void MrpoBalanceChange( TInt aLeftPercentage, TInt aRightPercentage ); |
|
451 |
|
452 |
|
453 /** |
|
454 * From MRadioFmTunerObserver. |
|
455 * Called when Request for tuner control completes. |
|
456 * |
|
457 * @since S60 3.2 |
|
458 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). |
|
459 */ |
|
460 void MrftoRequestTunerControlComplete( TInt aError ); |
|
461 |
|
462 /** |
|
463 * From MRadioFmTunerObserver. |
|
464 * Set frequency range complete event. This event is asynchronous and is received after |
|
465 * a call to CRadioFmTunerUtility::SetFrequencyRange. |
|
466 * |
|
467 * @since S60 3.2 |
|
468 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). |
|
469 */ |
|
470 void MrftoSetFrequencyRangeComplete( TInt aError ); |
|
471 |
|
472 /** |
|
473 * From MRadioFmTunerObserver. |
|
474 * Set frequency complete event. This event is asynchronous and is received after a call to |
|
475 * CRadioFmTunerUtility::SetFrequency. |
|
476 * |
|
477 * @since S60 3.2 |
|
478 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). |
|
479 */ |
|
480 void MrftoSetFrequencyComplete( TInt aError ); |
|
481 |
|
482 /** |
|
483 * From MRadioFmTunerObserver. |
|
484 * Station seek complete event. This event is asynchronous and is received after a call to |
|
485 * CRadioFmTunerUtility::StationSeek. |
|
486 * |
|
487 * @since S60 3.2 |
|
488 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). |
|
489 * @param aFrequency The frequency(Hz) of the radio station that was found. |
|
490 */ |
|
491 void MrftoStationSeekComplete( TInt aError, TInt aFrequency ); |
|
492 |
|
493 /** |
|
494 * From MRadioFmTunerObserver. |
|
495 * Called when FM Transmitter status changes (if one is present in the device). Tuner receiver |
|
496 * is forced to be turned off due to hardware conflicts when FM transmitter is activated. |
|
497 * |
|
498 * @since S60 3.2 |
|
499 * @param aActive ETrue if FM transmitter is active; EFalse otherwise. |
|
500 */ |
|
501 void MrftoFmTransmitterStatusChange( TBool aActive ); |
|
502 |
|
503 /** |
|
504 * From MRadioFmTunerObserver. |
|
505 * Called when antenna status changes. |
|
506 * |
|
507 * @since S60 3.2 |
|
508 * @param aAttached ETrue if antenna is attached; EFalse otherwise. |
|
509 */ |
|
510 void MrftoAntennaStatusChange( TBool aAttached ); |
|
511 |
|
512 /** |
|
513 * From MRadioFmTunerObserver. |
|
514 * Called when offline mode status changes. |
|
515 * @since S60 3.2 |
|
516 * |
|
517 * @param aOfflineMode ETrue if offline mode is enabled; EFalse otherwise. |
|
518 */ |
|
519 void MrftoOfflineModeStatusChange( TBool aOfflineMode ); |
|
520 |
|
521 /** |
|
522 * From MRadioFmTunerObserver. |
|
523 * Called when the frequency range changes. This may be caused by other applications. |
|
524 * |
|
525 * @since S60 3.2 |
|
526 * @param aBand New frequency range. |
|
527 */ |
|
528 void MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand ); |
|
529 |
|
530 /** |
|
531 * From MRadioFmTunerObserver. |
|
532 * Called when the tuned frequency changes. This may be caused by other |
|
533 * applications or RDS if AF/TA is enabled. |
|
534 * |
|
535 * @since S60 3.2 |
|
536 * @param aNewFrequency The new tuned frequency(Hz). |
|
537 */ |
|
538 void MrftoFrequencyChange( TInt aNewFrequency ); |
|
539 |
|
540 /** |
|
541 * From MRadioFmTunerObserver. |
|
542 * Called when the forced mono status change. This may be caused by other applications. |
|
543 * |
|
544 * @since S60 3.2 |
|
545 * @param aForcedMono ETrue if forced mono mode is enabled; EFalse otherwise. |
|
546 */ |
|
547 void MrftoForcedMonoChange( TBool aForcedMono ); |
|
548 |
|
549 /** |
|
550 * From MRadioFmTunerObserver. |
|
551 * Called when the squelch (muting the frequencies without broadcast) status change. |
|
552 * This may be caused by other applications. |
|
553 * |
|
554 * @since S60 3.2 |
|
555 * @param aSquelch ETrue if squelch is enabled; EFalse otherwise. |
|
556 */ |
|
557 void MrftoSquelchChange( TBool aSquelch ); |
|
558 |
|
559 /** |
|
560 * From MRadioPresetObserver. |
|
561 * Called when a preset changes. |
|
562 * |
|
563 * NOTE: EPresetDeleted with aIndex == 0, indicates that all presets have been deleted. |
|
564 * |
|
565 * @since S60 3.2 |
|
566 * @param aChange Change event type |
|
567 * @param aIndex Index to the preset that has changed. Zero means all presets. |
|
568 */ |
|
569 void MrpeoPresetChanged( TPresetChangeEvent aChange, TInt aIndex ); |
|
570 /** |
|
571 * From base class MFMRadioSystemEventDetectorObserver |
|
572 * This callback notifies when networks comes up. |
|
573 */ |
|
574 void NetworkUpCallbackL(); |
|
575 /** |
|
576 * From base class MFMRadioSystemEventDetectorObserver |
|
577 * This callback notifies when network goes down. |
|
578 */ |
|
579 void NetworkDownCallbackL(); |
|
580 |
|
581 /** |
|
582 * From base class MFMRadioSystemEventDetectorObserver |
|
583 * This callback notifies when audio resources become available. |
|
584 */ |
|
585 void AudioResourcesAvailableL(); |
|
586 |
|
587 /** |
|
588 * From base class MFMRadioSystemEventDetectorObserver |
|
589 * This callback notifies when audio auto resuming is forbidden. |
|
590 */ |
|
591 void AudioAutoResumeForbiddenL(); |
|
592 /** |
|
593 * From base class MFMRadioSystemEventDetectorObserver |
|
594 * This callback notifies when call becomes active. |
|
595 */ |
|
596 void CallActivatedCallbackL(); |
|
597 |
|
598 /** |
|
599 * From base class MFMRadioSystemEventDetectorObserver |
|
600 * This callback notifies when call becomes deactive. |
|
601 */ |
|
602 void CallDeactivatedCallbackL(); |
|
603 /** |
|
604 * From base class MFMRadioNetworkChangeObserver |
|
605 * |
|
606 * @see MFMRadioNetworkChangeObserver::NetworkIdChanged(); |
|
607 */ |
|
608 void NetworkIdChanged(); |
|
609 |
|
610 // from base class MFMRAdioRdsObserver |
|
611 void RdsDataProgrammeService( const TDesC& aProgramService ); |
|
612 void RdsDataPsNameIsStatic( TBool aStatic ); |
|
613 void RdsDataRadioText( const TDesC& aRadioText ); |
|
614 void RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioTextPlus ); |
|
615 |
|
616 void RdsAfSearchBegin(); |
|
617 void RdsAfSearchEnd( TUint32 aFrequency, TInt aError ); |
|
618 void RdsAfSearchStateChange( TBool aEnabled ); |
|
619 void RdsAvailable( TBool aAvailable ); |
|
620 |
|
621 // from MFMRadioHeadsetEventObserver |
|
622 void HeadsetAccessoryConnectedCallbackL(); |
|
623 void HeadsetAccessoryDisconnectedCallbackL(); |
|
624 |
|
625 /** |
|
626 * Initialize fmradioengine resource file information |
|
627 */ |
|
628 void InitializeResourceLoadingL(); |
|
629 /** |
|
630 * Convert FMRadio region info to frequency range used by fmradiotunerutility |
|
631 * @param aRegionId fmradio region |
|
632 * @return frequency range used by fmradiotunerutility |
|
633 */ |
|
634 TFmRadioFrequencyRange TunerFrequencyRangeForRegionId( const TInt aRegionId ) const; |
|
635 /** |
|
636 * Determine current region |
|
637 * @return fmradio region |
|
638 */ |
|
639 IMPORT_C TFMRadioRegionSetting GetRegionL() const; |
|
640 /** |
|
641 * fill the given list with fmradio regions |
|
642 * @param aArray array to add regions |
|
643 */ |
|
644 IMPORT_C void FillListWithRegionDataL( CDesC16Array& aArray ) const; |
|
645 /** |
|
646 * Returns region from the array of supported regions |
|
647 * @param aIndex index for region |
|
648 * @return fmradio region |
|
649 */ |
|
650 IMPORT_C TFMRadioRegionSetting RegionIdAtIndex( const TInt aIndex ) const; |
|
651 /** |
|
652 * Returns current region Id |
|
653 * @return current region Id. |
|
654 */ |
|
655 IMPORT_C TInt RegionId() const; |
|
656 /** |
|
657 * Change current region |
|
658 * @param aRegion region to set |
|
659 */ |
|
660 IMPORT_C void SetRegionIdL( TInt aRegion ) const; |
|
661 /** |
|
662 * Request tuner control from fmradiotunerutility |
|
663 */ |
|
664 IMPORT_C void RequestTunerControl() const; |
|
665 /** |
|
666 * Returns decimal count for current region MHz information |
|
667 * @return decimal count for current region |
|
668 */ |
|
669 IMPORT_C TInt DecimalCount() const; |
|
670 /** |
|
671 * Return step size for tuning. |
|
672 * @return step size |
|
673 */ |
|
674 IMPORT_C TUint32 FrequencyStepSize() const; |
|
675 /** |
|
676 * Returns a reference to P&S interface. |
|
677 * Method leaves if iPubSub is not allocated |
|
678 * |
|
679 * @return PS& interface. |
|
680 */ |
|
681 IMPORT_C CFMRadioPubSub& PubSubL() const; |
|
682 /** |
|
683 * increases startup count by one and returns amount of app startups. |
|
684 * |
|
685 * @return app startup count |
|
686 */ |
|
687 IMPORT_C TInt UpdatedStartupCount() const; |
|
688 /** |
|
689 * Cancel seek and notify UI |
|
690 */ |
|
691 IMPORT_C void CancelScanLocalStationsScan(); |
|
692 /** |
|
693 * Is routing between loudspeaker and headset possible |
|
694 * |
|
695 * @return ETrue, if routing is possible |
|
696 */ |
|
697 IMPORT_C TBool IsAudioRoutingPossible() const; |
|
698 |
|
699 /** |
|
700 * Has RT+ interaction tutorial dialog been shown to user. |
|
701 * |
|
702 * @return ETrue after the first time user sees the dialog. |
|
703 */ |
|
704 IMPORT_C TBool MusicStoreNoteDisplayed(); |
|
705 |
|
706 /** |
|
707 * Sets music store tutorial note displayed value to true. |
|
708 * It needs to be false only before supported RT+ features |
|
709 * become available for the first time. |
|
710 */ |
|
711 IMPORT_C void SetMusicStoreNoteDisplayed(); |
|
712 |
|
713 /** |
|
714 * Get level of support for RT+ interactions. |
|
715 * Values are defined in fmradioengine.hrh:TFMRadioRTPlusLevel. |
|
716 * |
|
717 * @return which interactions are supported as a TFMRadioRTPlusLevel value |
|
718 */ |
|
719 IMPORT_C TFMRadioRTPlusLevel GetRTPlusSupportLevel(); |
|
720 |
|
721 /** |
|
722 * Sets the currently active preset index |
|
723 * @param aIndex new active preset index |
|
724 */ |
|
725 IMPORT_C void SetCurrentPresetIndex( const TInt aIndex ); |
|
726 |
|
727 private: |
|
728 |
|
729 /** |
|
730 * Default class constructor. |
|
731 */ |
|
732 CRadioEngine( MRadioEngineStateChangeCallback& aCallback ); |
|
733 |
|
734 /** |
|
735 * Second phase class constructor. |
|
736 */ |
|
737 void ConstructL(); |
|
738 |
|
739 /** |
|
740 * ConnectLineL |
|
741 */ |
|
742 void ConnectLineL(); |
|
743 |
|
744 /** |
|
745 * Updates the frequency into settings and P&S |
|
746 * |
|
747 * @param aFrequency The frequency to be set |
|
748 */ |
|
749 void StoreAndPublishFrequency( TInt aFrequency ); |
|
750 |
|
751 /** |
|
752 * Scans all current presets and sets stored frequencies to KErrNotFound |
|
753 * if the preset name is empty. |
|
754 */ |
|
755 void ResetPresetsL(); |
|
756 |
|
757 /** |
|
758 * Resolves if BT audio accessory is connected |
|
759 * @return ETrue if BT Audio connected |
|
760 */ |
|
761 TBool IsBTAccessoryConnectedL(); |
|
762 private: |
|
763 |
|
764 //the internal radio engine states |
|
765 enum TRadioEngineState |
|
766 { |
|
767 EStateRadioOff, |
|
768 EStateRadioOn, |
|
769 }; |
|
770 |
|
771 // The Radio Utility |
|
772 CRadioUtility* iRadioUtility; // own |
|
773 // The Tuner Utility |
|
774 CRadioFmTunerUtility* iFmTunerUtility; |
|
775 // The Player Utility |
|
776 CRadioPlayerUtility* iPlayerUtility; |
|
777 // The Preset Utility |
|
778 CRadioFmPresetUtility* iPresetUtility; // own |
|
779 // Receives and notifies of the RDS data |
|
780 CFMRadioRdsReceiverBase* iRdsReceiver; |
|
781 // Capabilities of the tuner |
|
782 TFmTunerCapabilities iTunerCaps; |
|
783 // Multiplier used to scale UI volume setting to volume level used by the player utility |
|
784 TReal iUiVolumeFactor; |
|
785 // pointer to DosServerObserver |
|
786 #ifndef __ACCESSORY_FW |
|
787 CDosServerObserver *iDosServerObserver; //own |
|
788 #endif |
|
789 // Audio routing API |
|
790 CAudioOutput* iAudioOutput; //own |
|
791 // pointer to CCentralRepositoryHandler |
|
792 CCentralRepositoryHandler* iCentralRepositoryHandler; // own |
|
793 // Used to provide async behavior in some callbacks |
|
794 CRadioStateHandler *iStateHandler; |
|
795 // flag to indicate if auto resume is supported |
|
796 TBool iAutoResume; |
|
797 // flag to indicate if a call is in progress |
|
798 TBool iInCall; |
|
799 // pointer to TRadioSettings |
|
800 TRadioSettings* iRadioSettings; // own |
|
801 // the current radio state |
|
802 TRadioEngineState iCurrentRadioState; |
|
803 // a reference of MRadioEngineStateChangeCallback object |
|
804 MRadioEngineStateChangeCallback& iCallback; |
|
805 // temperary frequency |
|
806 TInt iTempFrequency; |
|
807 // a flag indicating if tune prset is requestd |
|
808 TBool iTunePresetRequested; |
|
809 // Indicates a request to initialized the radio is pending |
|
810 TBool iInitializeRadioRequestExists; |
|
811 // Indicates if the tuner control has been granted. |
|
812 TBool iTunerControl; |
|
813 // High and low frequency of the current band. |
|
814 TInt iBottomFrequency; |
|
815 TInt iTopFrequency; |
|
816 // ETrue if frequency was set by RDS AF |
|
817 TBool iFrequencySetByRdsAf; |
|
818 //Listens changes in network availability |
|
819 CFMRadioSystemEventDetector* iSystemEventDetector; |
|
820 // for fmradio engine resource file |
|
821 TInt iFMRadioEngineResourceOffset; |
|
822 //Listens changes in network ID and country code |
|
823 CFMRadioMobileNetworkInfoListener* iNetworkInfoListener; |
|
824 //P&S interaction interface for FMRadio actions. |
|
825 CFMRadioPubSub* iPubSub; |
|
826 // accessory observer |
|
827 CFMRadioAccessoryObserver* iHeadsetObserver; |
|
828 // tel server session |
|
829 RTelServer iTelServer; |
|
830 // phone |
|
831 RMobilePhone iPhone; |
|
832 // line |
|
833 RMobileLine iLine; |
|
834 // tsy name |
|
835 TFileName iTsyName; |
|
836 // conrrectly constructer |
|
837 TBool ilineConstructed; |
|
838 // for storing station name for method GetPresetNameL |
|
839 TStationName iStationName; |
|
840 // Local cache for tuning state so that it doesn't get published before should |
|
841 TFMRadioPSTuningState iTuningState; |
|
842 // If last time audio is set to IHF with no headset connected. |
|
843 TBool iHFOptionActivated; |
|
844 }; |
|
845 |
|
846 #endif //FMRADIOENGINE_H |
|
847 |
|
848 // End of file |