1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CRADIOENGINE_H_ |
|
19 #define CRADIOENGINE_H_ |
|
20 |
|
21 // User includes |
|
22 #include "cradioroutableaudio.h" |
|
23 #include "radioenginedef.h" |
|
24 #include "radioengine.hrh" |
|
25 |
|
26 // Forward declarations |
|
27 class MRadioEngineInitializer; |
|
28 class CRadioAudioRouter; |
|
29 class CRadioSettings; |
|
30 class MRadioApplicationSettings; |
|
31 class MRadioEngineSettings; |
|
32 class CRadioSystemEventCollector; |
|
33 class CRadioRepositoryManager; |
|
34 class MRadioPresetSettings; |
|
35 class MRadioSettingsSetter; |
|
36 class MRadioEngineObserver; |
|
37 class MRadioRdsReceiver; |
|
38 |
|
39 /** |
|
40 * Convenience class to handle engine startup and the ownership of the related classes |
|
41 */ |
|
42 NONSHARABLE_CLASS( CRadioEngine ) : public CRadioRoutableAudio |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Starts the radio engine initialization. |
|
48 * Asks the given initializer to create the member variables |
|
49 */ |
|
50 IMPORT_C static CRadioEngine* NewL( MRadioEngineInitializer& aInitializer ); |
|
51 |
|
52 IMPORT_C ~CRadioEngine(); |
|
53 |
|
54 /** |
|
55 * Returns a reference to the audio router |
|
56 * |
|
57 * @return Reference to the audio router |
|
58 */ |
|
59 virtual CRadioAudioRouter& AudioRouter() const = 0; |
|
60 |
|
61 /** |
|
62 * Returns the system event collector |
|
63 * |
|
64 * @return The system event collector |
|
65 */ |
|
66 virtual CRadioSystemEventCollector& SystemEventCollector() const = 0; |
|
67 |
|
68 /** |
|
69 * Returns a reference to the application settings |
|
70 * |
|
71 * @return Reference to the application settings |
|
72 */ |
|
73 virtual CRadioSettings& Settings() const = 0; |
|
74 |
|
75 /** |
|
76 * Determines radio region |
|
77 */ |
|
78 virtual TRadioRegion DetermineRegion() = 0; |
|
79 |
|
80 /** |
|
81 * ( Re )initializes the radio. |
|
82 * |
|
83 * @param aRegionId Region id |
|
84 */ |
|
85 virtual void InitRadioL( TInt aRegionId ) = 0; |
|
86 |
|
87 /** |
|
88 * Has the radio been initialized |
|
89 * |
|
90 * @return ETrue if radio is initialized, otherwise EFalse |
|
91 */ |
|
92 virtual TBool RadioInitialized() const = 0; |
|
93 |
|
94 /** |
|
95 * Sets the state for radio audio |
|
96 * This is the public interface to manage radio power state |
|
97 * This method should be called before radio can turn itself on |
|
98 * |
|
99 * @param aEnable ETrue if radio audio can be played, |
|
100 * EFalse if audio should be disabled |
|
101 * @param aDelay ETrue if radio is played/disabled with delay |
|
102 * EFalse if radio is played/disabled without delay |
|
103 */ |
|
104 virtual void EnableAudio( TBool aEnable, TBool aDelay = ETrue ) = 0; |
|
105 |
|
106 /** |
|
107 * Gets the state for radio audio. |
|
108 * |
|
109 * This returns the information if radio could be played when |
|
110 * other conditions are valid. This should be false only when |
|
111 * some other application has cause disabling of auto resume. |
|
112 * |
|
113 * @return ETrue if radio audio could be played, |
|
114 * EFalse if radio audio couldn't be played |
|
115 */ |
|
116 virtual TBool RadioAudioEnabled() const = 0; |
|
117 |
|
118 /** |
|
119 * Sets the audio overriding flag |
|
120 * |
|
121 * @param aOverride ETrue if other audio resources are tried to be overriden. |
|
122 */ |
|
123 virtual void SetAudioOverride( TBool aOverride ) = 0; |
|
124 |
|
125 /** |
|
126 * Adds an observer wich will be notified of the radio state changes |
|
127 * If observer already exists, it is not added |
|
128 * |
|
129 * @param aObserver pointer of the observer instance. |
|
130 */ |
|
131 virtual void AddObserverL( MRadioEngineObserver* aObserver ) = 0; |
|
132 |
|
133 /** |
|
134 * Removes a radio state change observer. |
|
135 */ |
|
136 virtual void RemoveObserver( MRadioEngineObserver* aObserver ) = 0; |
|
137 |
|
138 /** |
|
139 * Sets audio mode ( Stereo/Mono ) |
|
140 * |
|
141 * @param aAudioMode actual new radio mode |
|
142 */ |
|
143 virtual void SetAudioMode( TInt aAudioMode ) = 0; |
|
144 |
|
145 /** |
|
146 * Compares if frequency is within limits range. |
|
147 * |
|
148 * @param aFrequency The frequency that is checked. |
|
149 * If omitted, current frequency is checked. |
|
150 * @return ETrue, if frequency is within radio range. |
|
151 */ |
|
152 virtual TBool IsFrequencyValid( TUint32 aFrequency = 0 ) const = 0; |
|
153 |
|
154 /** |
|
155 * Sets or unsets the manual seek mode |
|
156 * |
|
157 * @param aManualSeekActive ETrue if active EFalse if not |
|
158 */ |
|
159 virtual void SetManualSeekMode( TBool aManualSeekActive ) = 0; |
|
160 |
|
161 /** |
|
162 * Returns the manual seek mode status |
|
163 */ |
|
164 virtual TBool IsInManualSeekMode() const = 0; |
|
165 |
|
166 /** |
|
167 * Tunes to frequency |
|
168 * If radio is not initialized by InitRadioL, frequency is just |
|
169 * set to settings. |
|
170 * |
|
171 * @param aFrequency frequency to tune to |
|
172 * @param aReason reason for the frequency setting |
|
173 */ |
|
174 virtual void SetFrequency( TUint32 aFrequency, |
|
175 RadioEngine::TRadioFrequencyEventReason aReason = RadioEngine::ERadioFrequencyEventReasonUnknown ) = 0; |
|
176 |
|
177 /** |
|
178 * Performs seeking operation. |
|
179 * |
|
180 * @param aDirection direction of seeking operation. |
|
181 */ |
|
182 virtual void Seek( RadioEngine::TRadioTuneDirection aDirection ) = 0; |
|
183 |
|
184 /** |
|
185 * Cancels an ongoing request to seek up/down. |
|
186 */ |
|
187 virtual void CancelSeek() = 0; |
|
188 |
|
189 /** |
|
190 * Is the radio seeking up/down, or at all. |
|
191 * |
|
192 * @return Seeking state. |
|
193 */ |
|
194 virtual RadioEngine::TRadioSeeking Seeking() const = 0; |
|
195 |
|
196 /** |
|
197 * Changes volume by one level. |
|
198 * |
|
199 * @param aDirection Direction of the volume change. |
|
200 */ |
|
201 virtual void AdjustVolume( RadioEngine::TRadioVolumeSetDirection aDirection ) = 0; |
|
202 |
|
203 /** |
|
204 * Sets volume level |
|
205 * |
|
206 * @param aVolume new volume level. |
|
207 */ |
|
208 virtual void SetVolume( TInt aVolume ) = 0; |
|
209 |
|
210 /** |
|
211 * Sets volume to be muted. |
|
212 * |
|
213 * @param aMute mute status. |
|
214 */ |
|
215 virtual void SetVolumeMuted( TBool aMute, TBool aUpdateSettings = ETrue ) = 0; |
|
216 |
|
217 /** |
|
218 * Retrieves current antenna state. |
|
219 * |
|
220 * @return ETrue if antenna is attached, EFalse otherwise. |
|
221 */ |
|
222 virtual TBool IsAntennaAttached() = 0; |
|
223 |
|
224 /** |
|
225 * Retrieves current state of fm transmitter. |
|
226 * |
|
227 * @return ETrue if fm transmitter is active, EFalse otherwise. |
|
228 */ |
|
229 virtual TBool IsFmTransmitterActive() const = 0; |
|
230 |
|
231 /** |
|
232 * Changes the antenna state. |
|
233 * This should only be used when faking the antenna |
|
234 * state in emulator environment. |
|
235 * Thus this should work only in WINS. |
|
236 * |
|
237 * @param aAntennaAttached The new antenna state. |
|
238 */ |
|
239 virtual void SetAntennaAttached( TBool aAntennaAttached ) = 0; |
|
240 |
|
241 /** |
|
242 * Returns the maximum volume level |
|
243 * |
|
244 * @return maximum volume level |
|
245 */ |
|
246 virtual TInt MaxVolumeLevel() const = 0; |
|
247 |
|
248 /** |
|
249 * Has the frequency been set by RDS AF search or not. |
|
250 * |
|
251 * @return ETrue if frequency was set by RDS AF, otherwise EFalse |
|
252 */ |
|
253 virtual TBool FrequencySetByRdsAf() const = 0; |
|
254 |
|
255 /** |
|
256 * Getter for RDS receiver |
|
257 * |
|
258 * @return Reference to CRadioRdsReceiver |
|
259 */ |
|
260 virtual MRadioRdsReceiver& RdsReceiver() = 0; |
|
261 |
|
262 /** |
|
263 * Is routing between loudspeaker and headset possible |
|
264 * |
|
265 * @return ETrue, if routing is possible |
|
266 */ |
|
267 virtual TBool IsAudioRoutingPossible() const = 0; |
|
268 |
|
269 /** |
|
270 * Checks if the radio playing parameters are OK |
|
271 * |
|
272 * @param aFrequency The frequency that is wanted to play. |
|
273 * @return ETrue if audio can be played, otherwise EFalse |
|
274 */ |
|
275 virtual TBool OkToPlay( TUint32 aFrequency ) const = 0; |
|
276 |
|
277 protected: |
|
278 |
|
279 CRadioEngine( CRadioAudioRouter* aAudioRouter ); |
|
280 |
|
281 }; |
|
282 |
|
283 #endif // CRADIOENGINE_H_ |
|