|
1 /* |
|
2 * Copyright (c) 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: Header file for Tuner component. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TUNER_H |
|
20 #define TUNER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <MCustomCommand.h> |
|
24 #include <mmf/common/mmfbase.h> |
|
25 #include <mmf/common/mmfutilities.h> |
|
26 #include <mmf/common/mmfcontrollerframework.h> |
|
27 #include <mmf/common/mmfstandardcustomcommands.h> |
|
28 #include <mmf/common/mmfaudio.h> |
|
29 #include <Mda/Common/audio.h> |
|
30 class RRadioSession; |
|
31 |
|
32 /** |
|
33 @file |
|
34 @publishedAll |
|
35 @prototype |
|
36 */ |
|
37 /** |
|
38 The Tuner Capabilities structure defines the capabilities of the tuner |
|
39 on the device, as retrieved using the function GetCapabilities. |
|
40 */ |
|
41 class TTunerCapabilities |
|
42 { |
|
43 public: |
|
44 inline TTunerCapabilities(); |
|
45 inline TTunerCapabilities(TUint32 aTunerBands, TUint32 aAdditionalFunctions); |
|
46 public: |
|
47 /** |
|
48 Bitfield (as defined by CMMTunerUtility::TTunerBand) with the bits of the |
|
49 supported bands set |
|
50 */ |
|
51 TUint32 iTunerBands; |
|
52 |
|
53 /** Tuner Function bit flags - may be extended in future */ |
|
54 enum TTunerFunctions |
|
55 { |
|
56 /** Recording of Tuner Audio is possible */ |
|
57 ETunerFunctionRecording = 0x01, |
|
58 /** Tuner can record and play back simultaneously */ |
|
59 ETunerFunctionSimultaneousPlayAndRecord = 0x02, |
|
60 /** The tuner requires an external antenna (e.g. a headset) to function */ |
|
61 ETunerFunctionRequiresAntenna = 0x04, |
|
62 /** CMMRdsTunerUtility supported */ |
|
63 ETunerFunctionRds = 0x08, |
|
64 /** The tuner can be used when the device is in flight mode */ |
|
65 ETunerFunctionAvailableInFlightMode = 0x10 |
|
66 }; |
|
67 |
|
68 /** Bitfield (as defined by ETunerFunctions) with the bits of the supported functions set */ |
|
69 TUint32 iAdditionalFunctions; |
|
70 }; |
|
71 |
|
72 /** |
|
73 Class representing a frequency. |
|
74 */ |
|
75 class TFrequency |
|
76 { |
|
77 public: |
|
78 inline TFrequency(); |
|
79 explicit inline TFrequency(TInt aFrequency); |
|
80 inline TInt operator==(const TFrequency& aFrequency) const; |
|
81 inline TInt operator!=(const TFrequency& aFrequency) const; |
|
82 inline TInt operator> (const TFrequency& aFrequency) const; |
|
83 inline TInt operator>=(const TFrequency& aFrequency) const; |
|
84 inline TInt operator< (const TFrequency& aFrequency) const; |
|
85 inline TInt operator<=(const TFrequency& aFrequency) const; |
|
86 public: |
|
87 /** |
|
88 The Frequency, in Hertz. A TInt is at least 32 bits, giving a maximum frequency |
|
89 of at least 2.4GHz (i.e. 0x7fffffff Hz) |
|
90 */ |
|
91 TInt iFrequency; |
|
92 }; |
|
93 |
|
94 |
|
95 class MMMTunerObserver; |
|
96 class MMMTunerChangeObserver; |
|
97 class MMMTunerStereoObserver; |
|
98 class MMMSignalStrengthObserver; |
|
99 class MMMTunerAudioPlayerObserver; |
|
100 class MMMTunerAudioRecorderObserver; |
|
101 class CMMTunerAudioPlayerUtility; |
|
102 class CMMTunerAudioRecorderUtility; |
|
103 class CMMTunerScannerUtility; |
|
104 class CMMRdsTunerUtility; |
|
105 |
|
106 /** |
|
107 The MMF Tuner API is present to allow clients to control |
|
108 the tuner hardware present on a device. |
|
109 */ |
|
110 class CMMTunerUtility : public CBase |
|
111 { |
|
112 friend class CMMTunerAudioPlayerUtility; |
|
113 friend class CMMTunerAudioRecorderUtility; |
|
114 friend class CMMTunerScannerUtility; |
|
115 friend class CMMRdsTunerUtility; |
|
116 public: |
|
117 /** Tuner Band bit flags - may be extended in future */ |
|
118 enum TTunerBand |
|
119 { |
|
120 ETunerNoBand = 0x00, |
|
121 /** Long Wave - uses frequencies */ |
|
122 ETunerBandLw = 0x01, |
|
123 /** Amplitude Modulation or Medium Wave - uses frequencies */ |
|
124 ETunerBandAm = 0x02, |
|
125 /** Frequency Modulation, European and American band - uses frequencies */ |
|
126 ETunerBandFm = 0x04, |
|
127 /** Frequency Modulation, Japanese band - uses frequencies */ |
|
128 ETunerBandJapaneseFm = 0x08, |
|
129 /** Digital Audio Broadcasting - uses channels */ |
|
130 ETunerBandDab = 0x10, |
|
131 /** Digital Video Broadcasting */ |
|
132 ETunerBandDvb = 0x20 |
|
133 }; |
|
134 /** |
|
135 Search direction enumeration |
|
136 */ |
|
137 enum TSearchDirection |
|
138 { |
|
139 /** Search for stations upwards - i.e. by increasing frequency */ |
|
140 ESearchDirectionUp = 1, |
|
141 /** Search for stations downwards - i.e. by decreasing frequency */ |
|
142 ESearchDirectionDown |
|
143 }; |
|
144 /** |
|
145 The Tuner Access Priority enables clients to correctly identify their needs |
|
146 when it comes to accessing the tuner. A process must have the MultimediaDD |
|
147 capability to use priorities greater than ETunerAccessPriorityNormal. |
|
148 */ |
|
149 enum TTunerAccessPriority |
|
150 { |
|
151 /** Radio accessible when device is idle */ |
|
152 ETunerAccessPriorityBackground = -100, |
|
153 /** Ordinary application priority */ |
|
154 ETunerAccessPriorityNormal = 0, |
|
155 /** Radio is to be used as an alarm sound */ |
|
156 ETunerAccessPriorityAlarm = 75, |
|
157 /** System use only */ |
|
158 ETunerAccessPrioritySystem = 100 |
|
159 }; |
|
160 /** |
|
161 Bitmasks to indicate what state the tuner is in. |
|
162 */ |
|
163 enum TTunerState |
|
164 { |
|
165 /** |
|
166 Tuner is active, and can therefore report frequency etc. If this bit is |
|
167 not set, none of the others should be set. |
|
168 */ |
|
169 ETunerStateActive = 0x01, |
|
170 /** The tuner is playing sound. */ |
|
171 ETunerStatePlaying = 0x02, |
|
172 /** The tuner is currently recording. */ |
|
173 ETunerStateRecording = 0x04, |
|
174 /** The tuner is currently retuning or searching for a new station. */ |
|
175 ETunerStateRetuning = 0x08, |
|
176 }; |
|
177 public: |
|
178 |
|
179 /** |
|
180 Factory function to create a new instance of the Tuner. Tuner access priority |
|
181 setting is required to ensure that applications such as alarms using the radio |
|
182 as an alarm sound are not prevented from doing so by other clients. Priority |
|
183 setting is needed for audio output when accessing the sound device. Tuner is |
|
184 ready for use on return from this function. |
|
185 |
|
186 @param aObserver The observer object for receiving async completion callbacks |
|
187 @param aTunerIndex An index from 0 to TunersAvailable() - 1 specifying the tuner |
|
188 device to use. |
|
189 @param aAccessPriority Tuner access priority value |
|
190 @leave KErrNoMemory Out of memory |
|
191 @leave KErrNotFound The specified tuner or tuner controller is not present |
|
192 @return A pointer and ownership of the fully constructed CMMTunerUtility object |
|
193 */ |
|
194 IMPORT_C static CMMTunerUtility* NewL(MMMTunerObserver& aObserver, |
|
195 TTunerBand aBand, |
|
196 TInt aTunerIndex, |
|
197 CMMTunerUtility::TTunerAccessPriority aAccessPriority = ETunerAccessPriorityNormal); |
|
198 |
|
199 IMPORT_C virtual ~CMMTunerUtility(); |
|
200 |
|
201 |
|
202 |
|
203 /** |
|
204 Set the current tuner access priority of this client. This priority is used to |
|
205 arbitrate between multiple tuner clients, determining who get control of the |
|
206 tuner. |
|
207 |
|
208 The platform security capability is MultimediaDD and a client with this capability |
|
209 is allowed to set the priority in preference to a client with a lower capability. |
|
210 |
|
211 @param aAccessPriority The new priority to use. |
|
212 @capability MultimediaDD |
|
213 @return A standard system error code. |
|
214 */ |
|
215 IMPORT_C TInt SetPriority(TTunerAccessPriority aAccessPriority); |
|
216 |
|
217 /** |
|
218 Get the current tuner access priority of this client. |
|
219 |
|
220 @param aAccessPriority A variable to which the current priority will be written. |
|
221 @return A standard system error code. |
|
222 */ |
|
223 IMPORT_C TInt GetPriority(TTunerAccessPriority& aAccessPriority) const; |
|
224 |
|
225 |
|
226 /** |
|
227 Get the current state of the tuner. |
|
228 |
|
229 @param aState A variable to set with the current state. Bits set according to |
|
230 TTunerState. |
|
231 @return A standard system error code. |
|
232 */ |
|
233 IMPORT_C TInt GetState(TUint32& aState) const; |
|
234 |
|
235 /** |
|
236 Indicates if the external antenna is currently attached or not. The tuner |
|
237 capabilties should be queried to determine if the external antenna is required |
|
238 to use the tuner or not; A value of false returned here does not necessarily |
|
239 imply that the tuner cannot be used. |
|
240 |
|
241 @param aAttached When this function returns, this will contain ETrue if and only |
|
242 if an external antenna is attached. |
|
243 @return A standard system error code. |
|
244 */ |
|
245 IMPORT_C TInt IsAntennaAttached(TBool& aAttached); |
|
246 |
|
247 /** |
|
248 Indicates if the device is currently in 'flight mode' or not. The tuner |
|
249 capabilities should be queried to determine in the tuner can be used in flight |
|
250 mode or not. |
|
251 |
|
252 @param aFlightMode On return, this will have been set to ETrue if and only if |
|
253 the device is in flight mode. |
|
254 @return A standard system error code. |
|
255 */ |
|
256 IMPORT_C TInt GetFlightMode(TBool& aFlightMode) const; |
|
257 |
|
258 /** |
|
259 Tune the tuner to the required frequency specified in Hertz. This is an asynchronous |
|
260 command and will result in a callback to MToTuneComplete or MToTunerError. |
|
261 |
|
262 If the session does not currently have control of the tuner, a request for control |
|
263 will be made. If control of the tuner is granted, a callback to MToTunerControlGranted |
|
264 will occur. If not, there will be a callback to MtoTunerError with error value |
|
265 KErrAccessDenied. |
|
266 |
|
267 Once control of the tuner has been granted, it will be retained until either a |
|
268 call to ReleaseTunerControl, or the session is preempted in which case there |
|
269 will be a callback to MToTunerError with error value KErrAccessDenied. |
|
270 |
|
271 @param aFrequency The frequency to tune to |
|
272 @param aBand The band to which aFrequency belongs |
|
273 */ |
|
274 IMPORT_C void Tune(TFrequency aFrequency); |
|
275 |
|
276 /** |
|
277 Find a radio station, starting at the start frequency and searching in the |
|
278 direction specified (i.e. Up or down) the search is limited to the specified |
|
279 band. If the session does not currently have control of the tuner, a request |
|
280 for control will be made. If control of the tuner is granted, a callback to |
|
281 MToTunerControlGranted will occur. If not, there will be a callback to MToTunerError |
|
282 with error value KErrAccessDenied. |
|
283 |
|
284 Once control of the tuner has been granted, it will be retained until either a |
|
285 call to ReleaseTunerControl, or the session is preempted in which case there |
|
286 will be a callback to MToTunerError with error value KErrAccessDenied. |
|
287 |
|
288 A callback to MToTuneComplete will occur if the Seek is successful. |
|
289 |
|
290 @param aBand The band |
|
291 @param aSearchDirect The direction to search in |
|
292 @param aCircularSeek If set to ETrue the station seek will loop back to the other |
|
293 end of the band once the end of the band has been reached. (Defaults to ETrue) |
|
294 If not set reaching the end of the band without finding a station will result |
|
295 in a callback to MToTuneComplete with error KErrNotFound. |
|
296 */ |
|
297 IMPORT_C void StationSeek(TSearchDirection aSearchDirection); |
|
298 |
|
299 /** |
|
300 Cancels an ongoing retune operation, as initiated by a call to Tune or StationSeek. |
|
301 The usual callback will not occur if this has been called. |
|
302 |
|
303 Has not affect if no tune or seek operation is ongoing. |
|
304 */ |
|
305 IMPORT_C void CancelRetune(); |
|
306 |
|
307 /** |
|
308 Makes a synchronous request for control of the tuner. If this method returns |
|
309 KErrNone, control of the tuner has been granted. Control of the tuner is kept |
|
310 until it is explically released using ReleaseTunerControl, or it is revoked |
|
311 in which case a callback to MToTunerError with an error of KErrAccessDenied |
|
312 will occur. |
|
313 |
|
314 If this method returns with KErrAccessDenied, a request to recieve a |
|
315 notifiaction when control could be granted can be made using |
|
316 NotifyTunerControl. |
|
317 |
|
318 Note that methods that require control of the tuner (such as Tune) will make |
|
319 a request for control themselves if control has not already been granted. |
|
320 |
|
321 @return A standard system error code. If control was granted, KErrNone, and if |
|
322 control was denied KErrAccessDenied. |
|
323 */ |
|
324 IMPORT_C TInt RequestTunerControl(); |
|
325 |
|
326 /** |
|
327 Makes an asyncronous request for control of the tuner. This method should be |
|
328 called after an control of the tuner has been denied to receive a notification |
|
329 when control of the tuner can be granted. A callback to MToTunerControlGranted |
|
330 will occur in this event. |
|
331 */ |
|
332 IMPORT_C TInt NotifyTunerControl(); |
|
333 |
|
334 /** |
|
335 Release control of the tuner, allowing other clients to tune it. Change |
|
336 notifications may still be received. A request for control of the tuner can be |
|
337 made again by calling RequestTunerControl, or any methods that require control |
|
338 of the tuner. |
|
339 */ |
|
340 IMPORT_C void ReleaseTunerControl(); |
|
341 |
|
342 /** |
|
343 Release the tuner. Any ongoing playing or recording activity will be stopped, |
|
344 control of the tuner will be released, and the hardware will be powered down if |
|
345 no other clients need it. |
|
346 */ |
|
347 IMPORT_C void Close(); |
|
348 |
|
349 /** |
|
350 Retrieve the current frequency that the tuner is tuned to |
|
351 |
|
352 @param aFrequency The variable to set to the current frequency, |
|
353 -1 if channels are in use |
|
354 @param aBand The variable used to set the current band. |
|
355 @return A standard system error code |
|
356 */ |
|
357 IMPORT_C TInt GetFrequency(TFrequency& aFrequency) const; |
|
358 |
|
359 /** |
|
360 Retrieve the signal strenth of the currently tuned signal |
|
361 |
|
362 @param aSignalStrength Variable into which the signal strength will be written. |
|
363 @return A standard system error code |
|
364 */ |
|
365 IMPORT_C TInt GetSignalStrength(TInt& aSignalStrength) const; |
|
366 |
|
367 /** |
|
368 Get the maximum possible signal strength of a tuned signal. |
|
369 |
|
370 @param aMaxSignalStrength A variable that will have the maximun signal strength |
|
371 written to. |
|
372 @return A standard system error code |
|
373 */ |
|
374 IMPORT_C TInt GetMaxSignalStrength(TInt& aMaxSignalStrength) const; |
|
375 |
|
376 /** |
|
377 Request notifications when the signal strength changes. Due to the potentially |
|
378 short intervals at which the signal strength may change at, notifications will |
|
379 only be sent when a relatively large change occurrs. This should allow a visual |
|
380 display of signal strength to be maintained fairly accurately. |
|
381 |
|
382 The first signal strength notification will be sent immediately after this |
|
383 request. |
|
384 |
|
385 @param aObserver The object which will receive notifications of signal strength |
|
386 changes. |
|
387 @return A standard system error code |
|
388 */ |
|
389 IMPORT_C TInt NotifySignalStrength(MMMSignalStrengthObserver& aObserver); |
|
390 |
|
391 /** |
|
392 Cancel an outstanding NotifySignalStrength request. |
|
393 */ |
|
394 IMPORT_C void CancelNotifySignalStrength(); |
|
395 |
|
396 /** |
|
397 Find out if the current signal is being received in stereo or not. |
|
398 |
|
399 @param aStereo On return, will be ETrue if and only if a stereo signal is |
|
400 currently being received. |
|
401 */ |
|
402 IMPORT_C TInt IsStereoSignal(TBool& aStereo); |
|
403 |
|
404 /** |
|
405 Request notifications when stereo reception is lost/restored. |
|
406 |
|
407 @param aObserver The object requiring notification when a stereo signal is lost |
|
408 or restored. The first notification will occur immediately. |
|
409 @return A standard system error code |
|
410 */ |
|
411 IMPORT_C TInt NotifyStereoChange(MMMTunerStereoObserver& aObserver); |
|
412 |
|
413 /** |
|
414 Cancels a stereo change notification request. |
|
415 */ |
|
416 IMPORT_C void CancelNotifyStereoChange(); |
|
417 |
|
418 /** |
|
419 Indicates whether the reception should be forced into monophonic mode. |
|
420 |
|
421 @param aMono If ETrue, all reception will be in mono mode even if a stereo |
|
422 signal is available. If EFalse, a stereo signal will be received when |
|
423 possible. |
|
424 @return A standard system error code. |
|
425 */ |
|
426 IMPORT_C TInt ForceMonoReception(TBool aMono); |
|
427 |
|
428 /** |
|
429 Find out whether reception is forced into monophonic mode or not. |
|
430 |
|
431 @param aMono This will be set to ETrue if all reception is forced to be mono. If |
|
432 this is EFalse, this does not imply that stereo reception is currently |
|
433 available. |
|
434 @return A standard system error code. |
|
435 */ |
|
436 IMPORT_C TInt GetForcedMonoReception(TBool& aMono) const; |
|
437 |
|
438 /** |
|
439 Sets the current squleching (muting in frequencies without reception) setting. |
|
440 |
|
441 @param aEnabled ETrue to enable squelching, EFalse to disable it. |
|
442 @return KErrNone if successful, else a system wide error code. |
|
443 */ |
|
444 IMPORT_C TInt SetSquelch(TBool aEnabled); |
|
445 |
|
446 /** |
|
447 Gets the current squleching (muting in frequencies without reception) setting. |
|
448 |
|
449 @param aEnabled This will be set to ETrue if squelching is enabled, EFalse otherwise. |
|
450 @return KErrNone if successful, else a system wide error code. |
|
451 */ |
|
452 IMPORT_C TInt GetSquelch(TBool& aEnabled) const; |
|
453 |
|
454 /** |
|
455 Get the capabilities of the tuner on the device |
|
456 |
|
457 @param aCaps The capabilities object to fill |
|
458 @return A standard system error code |
|
459 */ |
|
460 IMPORT_C TInt GetCapabilities(TTunerCapabilities& aCaps) const; |
|
461 |
|
462 /** |
|
463 Get the frequency range (in Hertz) of the specified band. |
|
464 This function should be used to enquire the frequency range |
|
465 of the bands that GetCapabilities reports as supported. |
|
466 |
|
467 @param aBand The band to query |
|
468 @param aBottomFrequency The variable to set to the lowest frequency allowed |
|
469 @param aTopFrequency The variable to set to the highest frequency allowed |
|
470 @return A standard system error code |
|
471 */ |
|
472 IMPORT_C TInt GetFrequencyBandRange(TFrequency& aBottomFrequency, TFrequency& aTopFrequency); |
|
473 |
|
474 /** |
|
475 Request to be notified when the tuned frequency or channel changes, or when the |
|
476 tuner changes state (e.g. starts playing or recording) |
|
477 |
|
478 @param aObserver The object wishing to receive tuning change events |
|
479 @return A standard system error code |
|
480 */ |
|
481 IMPORT_C TInt NotifyChange(MMMTunerChangeObserver& aObserver); |
|
482 |
|
483 /** |
|
484 Cancel request to be notified when the tuned frequency or channel changes |
|
485 */ |
|
486 IMPORT_C void CancelNotifyChange(); |
|
487 |
|
488 /** |
|
489 Send a synchronous custom command to the tuner. |
|
490 |
|
491 @param aFunction The function number to indicate which function is to be called |
|
492 on the interface defined by the first IPC argument |
|
493 @param aArgs The IPC arguments to send to the tuner. The first of these |
|
494 arguments must be the UID of the interface within the tuner to which the |
|
495 command is destined, represented as an integer. Failure to set the first |
|
496 argument properly will result in the command completing with |
|
497 KErrNotSupported at best, but possibly the client being panicked. |
|
498 @return A standard system error code |
|
499 */ |
|
500 IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs); |
|
501 |
|
502 /** |
|
503 Send an asynchronous custom command to the tuner. |
|
504 |
|
505 @param aFunction The function number to indicate which function is to be called |
|
506 on the interface defined by the first IPC argument |
|
507 @param aArgs The IPC arguments to send to the tuner. The first of these |
|
508 arguments must be the UID of the interface within the tuner to which the |
|
509 command is destined, represented as an integer. Failure to set the first |
|
510 argument properly will result in the command completing with |
|
511 KErrNotSupported at best, but possibly the client being panicked. |
|
512 @param aStatus The TRequestStatus of an active object. This will contain the |
|
513 result of the request on completion. The exact range of result values is |
|
514 dependent on the interface. |
|
515 */ |
|
516 IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus); |
|
517 |
|
518 /** |
|
519 Get the Tuner Player Utility |
|
520 |
|
521 @param aAccessPriority A variable to which the current priority will be written. |
|
522 @return A standard system error code. |
|
523 */ |
|
524 IMPORT_C CMMTunerAudioPlayerUtility* TunerPlayerUtilityL(MMMTunerAudioPlayerObserver& aObserver) ; |
|
525 /** |
|
526 Get the Tuner Recorder Utility |
|
527 |
|
528 @param aAccessPriority A variable to which the current priority will be written. |
|
529 @return A standard system error code. |
|
530 */ |
|
531 IMPORT_C CMMTunerAudioRecorderUtility* TunerRecorderUtilityL(MMMTunerAudioRecorderObserver& aObserver) ; |
|
532 |
|
533 /** |
|
534 Get the Tuner Scanner Utility |
|
535 |
|
536 @param aAccessPriority A variable to which the current priority will be written. |
|
537 @return A standard system error code. |
|
538 */ |
|
539 IMPORT_C CMMTunerScannerUtility* TunerScannerUtilityL() ; |
|
540 |
|
541 /** |
|
542 Get the Tuner Rds Utility |
|
543 |
|
544 @param aAccessPriority A variable to which the current priority will be written. |
|
545 @return A standard system error code. |
|
546 */ |
|
547 IMPORT_C CMMRdsTunerUtility* TunerRdsUtilityL() ; |
|
548 |
|
549 private: |
|
550 CMMTunerUtility(); |
|
551 protected: |
|
552 class CBody; |
|
553 private: |
|
554 CBody* iBody; |
|
555 }; |
|
556 |
|
557 /** |
|
558 The Tuner Observer mixin class defines asynchronous |
|
559 event completion function callbacks |
|
560 */ |
|
561 class MMMTunerObserver |
|
562 { |
|
563 public: |
|
564 /** |
|
565 Tune complete event. This event is asynchronous |
|
566 and is received after a call to the Tune method. |
|
567 |
|
568 @param aError A standard system error |
|
569 */ |
|
570 virtual void MToTuneComplete(TInt aError) = 0; |
|
571 |
|
572 }; |
|
573 |
|
574 /** |
|
575 The Tuner Change Observer mixin class defines the interface via which |
|
576 notification for changes to the tuned frequency, channel and other tuner |
|
577 state can be received. A client interested in these notifications |
|
578 should call the function CMMTunerUtility::NotifyChange. |
|
579 */ |
|
580 class MMMTunerChangeObserver |
|
581 { |
|
582 public: |
|
583 /** |
|
584 Called when the tuned frequency changes |
|
585 |
|
586 @param aOldFrequency The frequency in use before the change |
|
587 @param aNewFrequency The new tuned frequency |
|
588 */ |
|
589 virtual void MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency) = 0; |
|
590 |
|
591 /** |
|
592 Called when the state of the tuner changes. |
|
593 |
|
594 @param aOldState The old state. Bits are set according to TTunerState. |
|
595 @param aNewState The new state. Bits are set according to TTunerState. |
|
596 */ |
|
597 virtual void MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState) = 0; |
|
598 |
|
599 /** |
|
600 This function is called when an external antenna is detached from the device. |
|
601 This does not necessarily indicate that the tuner can no longer be used; the |
|
602 capabilities of the tuner indicate if the external antenna is required in order |
|
603 to use the tuner. |
|
604 */ |
|
605 virtual void MTcoAntennaDetached() = 0; |
|
606 |
|
607 /** |
|
608 This function is called when an external antenna is attached to the device. If |
|
609 the antenna is required to use the tuner, this indicates that the tuner can be |
|
610 used again. |
|
611 */ |
|
612 virtual void MTcoAntennaAttached() = 0; |
|
613 |
|
614 /** |
|
615 This function is called when the device enters or leaves flight mode. If the tuner |
|
616 cannot be used in flight mode when the device enters this mode, this indicates |
|
617 that the tuner can no longer be used; the capabilities of the tuner indicate if |
|
618 it can be used in flight mode or not. |
|
619 |
|
620 @param aFlightMode ETrue if the device has just entered flight mode, EFalse if |
|
621 flight mode has just been left. |
|
622 */ |
|
623 virtual void FlightModeChanged(TBool aFlightMode) = 0; |
|
624 }; |
|
625 |
|
626 /** |
|
627 The stereo observer mixin class defines the interface by which clients can be |
|
628 notified when a stereo signal is received/lost. An interested client should call |
|
629 the function CMMTunerUtility::NotifyStereoChange. |
|
630 */ |
|
631 class MMMTunerStereoObserver |
|
632 { |
|
633 public: |
|
634 /** |
|
635 Called when stereo reception is lost/restored. |
|
636 |
|
637 @param aStereo If true, indicates that stereo reception has just been restored. |
|
638 If false, indicates that stereo reception has just been lost. |
|
639 */ |
|
640 virtual void MTsoStereoReceptionChanged(TBool aStereo) = 0; |
|
641 |
|
642 /** |
|
643 Called when a client enables/disabled forced mono reception. |
|
644 |
|
645 @param aForcedMono ETrue if reception is forced to be mono, even when a stereo |
|
646 signal is available. |
|
647 */ |
|
648 virtual void MTsoForcedMonoChanged(TBool aForcedMono) = 0; |
|
649 }; |
|
650 |
|
651 /** |
|
652 This mixin class should be derived from by clients wishing to receive |
|
653 notifications when the signal strength changes. Such a client should call |
|
654 function CMMTunerUtility::NotifySignalStrength. |
|
655 */ |
|
656 class MMMSignalStrengthObserver |
|
657 { |
|
658 public: |
|
659 /** |
|
660 Callback indicating that the signal strength has changed by an amount meriting |
|
661 a notification. |
|
662 |
|
663 @param aNewSignalStrength The new signal strength. |
|
664 */ |
|
665 virtual void MssoSignalStrengthChanged(TInt aNewSignalStrength) = 0; |
|
666 }; |
|
667 |
|
668 |
|
669 class MMMAudioResourceNotificationCallback; |
|
670 |
|
671 /** |
|
672 The Tuner Audio Player Utility is used to initiate and control playback of audio |
|
673 from the tuner. |
|
674 */ |
|
675 class CMMTunerAudioPlayerUtility : public CBase, public MCustomCommand |
|
676 { |
|
677 friend class CMMTunerUtility::CBody; |
|
678 public: |
|
679 |
|
680 IMPORT_C ~CMMTunerAudioPlayerUtility(); |
|
681 |
|
682 /** |
|
683 Set-up the API for playing the output from tuner to the speaker asynchronously. |
|
684 Calls MMMTunerAudioPlayerObserver::MTapoInitializeComplete on completion. This must be |
|
685 called before Play. |
|
686 |
|
687 @param aPriority Sound device priority value |
|
688 @param aPref Sound device priority preference value |
|
689 */ |
|
690 IMPORT_C void InitializeL(TInt aAudioPriority = EMdaPriorityNormal, TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality); |
|
691 |
|
692 /** |
|
693 Start playback of the tuner output. To stop playback, call Mute, or Stop if |
|
694 play will not need to be restarted. InitializeL() must have already been |
|
695 called, and a callback to MTapoInitializeComplete with an error of KErrNone must |
|
696 have occurred; if this is not the case, this raises a TunerAudioPlay 1 panic. |
|
697 */ |
|
698 IMPORT_C void Play(); |
|
699 |
|
700 /** |
|
701 Mute or unmute playback. |
|
702 |
|
703 Raises a TunerAudioPlay 1 panic if the player is not properly initialized. |
|
704 |
|
705 @param aMute ETrue to mute the audio, EFalse to unmute it. |
|
706 @return A standard system error code |
|
707 */ |
|
708 IMPORT_C TInt Mute(TBool aMute); |
|
709 |
|
710 /** |
|
711 Stop playback, and release the output device for use by other clients |
|
712 |
|
713 Raises a TunerAudioPlay 1 panic if the player is not properly initialized. |
|
714 |
|
715 Playback should already be under way. |
|
716 */ |
|
717 IMPORT_C void Stop(); |
|
718 |
|
719 /** |
|
720 Set the current audio priority. This priority is used to arbitrate |
|
721 between multiple audio sources trying to access the audio hardware. |
|
722 |
|
723 @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax |
|
724 @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference |
|
725 @return A standard system error code |
|
726 */ |
|
727 IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); |
|
728 |
|
729 /** |
|
730 Get the current audio priority. This is used to arbitrate between simultaneous |
|
731 accesses to the sound hardware. |
|
732 |
|
733 @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return |
|
734 @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference |
|
735 @return A standard system error code |
|
736 */ |
|
737 IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const; |
|
738 |
|
739 /** |
|
740 Set the volume to the specified level |
|
741 |
|
742 Raises a TunerAudioPlay 1 panic if the player is not properly initialized. |
|
743 |
|
744 @param aVolume The volume level to set |
|
745 @return A standard system error code |
|
746 */ |
|
747 IMPORT_C TInt SetVolume(TInt aVolume); |
|
748 |
|
749 /** |
|
750 Return the current volume |
|
751 |
|
752 @param aVolume The variable to set to the current volume |
|
753 @return A standard system error code |
|
754 */ |
|
755 IMPORT_C TInt GetVolume(TInt& aVolume) const; |
|
756 |
|
757 /** |
|
758 Define a volume ramp, aRampInterval defining |
|
759 the interval between valid volume settings |
|
760 |
|
761 Raises a TunerAudioPlay 1 panic if the player is not properly initialized. |
|
762 |
|
763 @param aRampInterval The time interval over which the volume |
|
764 should be increased from zero to the current volume setting |
|
765 @return A standard system error code |
|
766 */ |
|
767 IMPORT_C TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampInterval); |
|
768 |
|
769 /** |
|
770 Return the maximum volume supported |
|
771 |
|
772 @return The maximum volume setting permitted |
|
773 */ |
|
774 IMPORT_C TInt MaxVolume() const; |
|
775 |
|
776 /** |
|
777 Set the stereo balance between left and right channels |
|
778 |
|
779 Raises a TunerAudioPlay 1 panic if the player is not properly initialized. |
|
780 |
|
781 @param aBalance The balance value to set - must be between |
|
782 KMMFBalanceMaxLeft and KMMFBalanceMaxRight |
|
783 @return A standard system error code |
|
784 */ |
|
785 IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter); |
|
786 |
|
787 /** |
|
788 Return the current stereo balance |
|
789 |
|
790 @param aBalance The variable to set to the current balance |
|
791 @return A standard system error code |
|
792 */ |
|
793 IMPORT_C TInt GetBalance(TInt& aBalance) const; |
|
794 |
|
795 /** |
|
796 Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption |
|
797 by a higher priority audio client. |
|
798 */ |
|
799 IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL); |
|
800 |
|
801 /** |
|
802 Cancel an outstanding audio resource notification. |
|
803 */ |
|
804 IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId); |
|
805 |
|
806 /** |
|
807 Returns the controller implementation information associated with the current controller, if any. |
|
808 |
|
809 @return The controller implementation structure associated with the controller |
|
810 @leave KErrNotFound if no controller is in use. |
|
811 */ |
|
812 IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); |
|
813 |
|
814 /** |
|
815 Send a synchronous custom command to the playback controller, if ones exists. |
|
816 |
|
817 @param aDestination The destination of the message, consisting of the uid of |
|
818 the interface of this message |
|
819 @param aFunction The function number to indicate which function is to be called |
|
820 on the interface defined in the aDestination parameter |
|
821 @param aDataTo1 The first chunk of data to be copied to the controller |
|
822 framework. The exact contents of the data are dependent on the |
|
823 interface being called. Can be KNullDesC8. |
|
824 @param aDataTo2 The second chunk of data to be copied to the controller |
|
825 framework. The exact contents of the data are dependent on the |
|
826 interface being called. Can be KNullDesC8. |
|
827 @return A standard system error code |
|
828 */ |
|
829 IMPORT_C TInt CustomCommandSync( |
|
830 const TMMFMessageDestinationPckg& aDestination, |
|
831 TInt aFunction, |
|
832 const TDesC8& aDataTo1, |
|
833 const TDesC8& aDataTo2); |
|
834 |
|
835 /** |
|
836 Send a synchronous custom command to the playback controller, if ones exists. |
|
837 |
|
838 @param aDestination The destination of the message, consisting of the uid of |
|
839 the interface of this message |
|
840 @param aFunction The function number to indicate which function is to be called |
|
841 on the interface defined in the aDestination parameter |
|
842 @param aDataTo1 The first chunk of data to be copied to the controller |
|
843 framework. The exact contents of the data are dependent on the |
|
844 interface being called. Can be KNullDesC8. |
|
845 @param aDataTo2 The second chunk of data to be copied to the controller |
|
846 framework. The exact contents of the data are dependent on the |
|
847 interface being called. Can be KNullDesC8. |
|
848 @param aDataFrom The area of memory to which the controller framework |
|
849 will write any data to be passed back to the client. Can't be KNullDesC8. |
|
850 @return A standard system error code |
|
851 */ |
|
852 IMPORT_C TInt CustomCommandSync( |
|
853 const TMMFMessageDestinationPckg& aDestination, |
|
854 TInt aFunction, |
|
855 const TDesC8& aDataTo1, |
|
856 const TDesC8& aDataTo2, |
|
857 TDes8& aDataFrom); |
|
858 |
|
859 /** |
|
860 Send an asynchronous custom command to the playback controller, if ones exists. |
|
861 |
|
862 @param aDestination The destination of the message, consisting of the uid of |
|
863 the interface of this message |
|
864 @param aFunction The function number to indicate which function is to be called |
|
865 on the interface defined in the aDestination parameter |
|
866 @param aDataTo1 The first chunk of data to be copied to the controller |
|
867 framework. The exact contents of the data are dependent on the |
|
868 interface being called. Can be KNullDesC8. |
|
869 @param aDataTo2 The second chunk of data to be copied to the controller |
|
870 framework. The exact contents of the data are dependent on the |
|
871 interface being called. Can be KNullDesC8. |
|
872 @param aStatus The TRequestStatus of an active object. This will contain the |
|
873 result of the request on completion. The exact range of result values is |
|
874 dependent on the interface. |
|
875 */ |
|
876 IMPORT_C void CustomCommandAsync( |
|
877 const TMMFMessageDestinationPckg& aDestination, |
|
878 TInt aFunction, |
|
879 const TDesC8& aDataTo1, |
|
880 const TDesC8& aDataTo2, |
|
881 TRequestStatus& aStatus); |
|
882 |
|
883 /** |
|
884 Send an asynchronous custom command to the playback controller, if ones exists. |
|
885 |
|
886 @param aDestination The destination of the message, consisting of the uid of |
|
887 the interface of this message |
|
888 @param aFunction The function number to indicate which function is to be called |
|
889 on the interface defined in the aDestination parameter |
|
890 @param aDataTo1 The first chunk of data to be copied to the controller |
|
891 framework. The exact contents of the data are dependent on the |
|
892 interface being called. Can be KNullDesC8. |
|
893 @param aDataTo2 The second chunk of data to be copied to the controller |
|
894 framework. The exact contents of the data are dependent on the |
|
895 interface being called. Can be KNullDesC8. |
|
896 @param aDataFrom The area of memory to which the controller framework |
|
897 will write any data to be passed back to the client. Can't be KNullDesC8. |
|
898 @param aStatus The TRequestStatus of an active object. This will contain the |
|
899 result of the request on completion. The exact range of result values is |
|
900 dependent on the interface. |
|
901 */ |
|
902 IMPORT_C void CustomCommandAsync( |
|
903 const TMMFMessageDestinationPckg& aDestination, |
|
904 TInt aFunction, |
|
905 const TDesC8& aDataTo1, |
|
906 const TDesC8& aDataTo2, |
|
907 TDes8& aDataFrom, |
|
908 TRequestStatus& aStatus); |
|
909 |
|
910 protected: |
|
911 /** |
|
912 Factory function to create a new Tuner Audio Player utility. Note that only one audio player |
|
913 utility may be created per instance of CMMTunerUtility. Multiple instances will result in an |
|
914 error of KErrAlreadyExists when InitializeL() is called. |
|
915 |
|
916 @param aTuner The tuner object which this utility will play the audio from. |
|
917 @param aObserver The observer of the player utility to receive asychronous completion and |
|
918 notifiction callbacks. |
|
919 @leave KErrNoMemory Out of memory |
|
920 @leave KErrNotSupported If the given tuner doesn't support audio playback. |
|
921 @return A new tuner audio player utility. |
|
922 */ |
|
923 static CMMTunerAudioPlayerUtility* NewL(CMMTunerUtility& aTuner, RRadioSession& aRadioSession, MMMTunerAudioPlayerObserver& aObserver); |
|
924 |
|
925 private: |
|
926 CMMTunerAudioPlayerUtility(); |
|
927 private: |
|
928 class CBody; |
|
929 CBody* iBody; |
|
930 }; |
|
931 |
|
932 class MMMTunerAudioPlayerObserver |
|
933 { |
|
934 public: |
|
935 /** |
|
936 The TEvent enumeration is used to indicate which type of event is being sent to the client. |
|
937 Each event will be associated with an error code and potentially some addition information, |
|
938 and will be passed to the client via method MTapoPlayEvent(). |
|
939 */ |
|
940 enum TEventType |
|
941 { |
|
942 /** An event relating to the tuner itself. Any error other than KErrNone associated |
|
943 with this event type may indicate that the tuner cannot be used anymore. |
|
944 |
|
945 No additional information is associated with this type of event. */ |
|
946 ETunerEvent, |
|
947 /** |
|
948 An event relating to audio playback. |
|
949 |
|
950 No additional information is associated with this type of event. |
|
951 */ |
|
952 EAudioEvent |
|
953 }; |
|
954 public: |
|
955 /** |
|
956 Initialize complete event. This event is asynchronous and is received after |
|
957 a call to CMMTunerAudioPlayerUtility::InitializeL(). |
|
958 |
|
959 @param aError A standard system error |
|
960 */ |
|
961 virtual void MTapoInitializeComplete(TInt aError) = 0; |
|
962 |
|
963 /** |
|
964 Passes an asychronous event to the tuner client. |
|
965 |
|
966 @param aEvent The type of event. See enumeration MMMTunerAudioPlayerObserver::TEventType |
|
967 for more information about when the event types mean. |
|
968 @param aError An error code associated with the event. |
|
969 @param aAdditionalInfo Any additional information associated with the event, or NULL if |
|
970 no such additional information exists. |
|
971 */ |
|
972 virtual void MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0; |
|
973 }; |
|
974 |
|
975 /** |
|
976 This class is used to perform recording of audio from the tuner. Many of the methods |
|
977 in this class have identical functionality to similarly names functions in class |
|
978 CMdaAudioRecorderUtility. |
|
979 */ |
|
980 class CMMTunerAudioRecorderUtility : public CBase |
|
981 { |
|
982 friend class CMMTunerUtility::CBody; |
|
983 public: |
|
984 |
|
985 IMPORT_C ~CMMTunerAudioRecorderUtility(); |
|
986 |
|
987 /** |
|
988 Initialize for recording from the tuner to the specified file |
|
989 asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion |
|
990 |
|
991 @param aRecordFilename The name of the file to create, if necessary, and record to |
|
992 @param "aDestinationDataType" Data type for recording |
|
993 @param "aControllerUid" The Uid of the controller to use for recording |
|
994 @param "aDestinationFormatUid" Uid of record format |
|
995 @param aPriority Sound device priority value |
|
996 @param aPref Sound device priority preference value |
|
997 */ |
|
998 IMPORT_C void InitializeL(const TDesC& aRecordFilename, |
|
999 TFourCC aDestinationDataType = KFourCCNULL, |
|
1000 TUid aControllerUid=KNullUid, |
|
1001 TUid aDestinationFormatUid=KNullUid, |
|
1002 TInt aAudioPriority = EMdaPriorityNormal, |
|
1003 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality); |
|
1004 |
|
1005 /** |
|
1006 Initialize for recording from the tuner to the specified descriptor |
|
1007 asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion |
|
1008 |
|
1009 @param aRecordDescriptor The descriptor to record to |
|
1010 @param "aDestinationDataType" Data type for recording |
|
1011 @param "aControllerUid" The Uid of the controller to use for recording |
|
1012 @param "aDestinationFormatUid" Uid of record format |
|
1013 @param aPriority Sound device priority value |
|
1014 @param aPref Sound device priority preference value |
|
1015 */ |
|
1016 IMPORT_C void InitializeL(TDes8& aRecordDescriptor, |
|
1017 TFourCC aDestinationDataType = KFourCCNULL, |
|
1018 TUid aControllerUid=KNullUid, |
|
1019 TUid aDestinationFormatUid=KNullUid, |
|
1020 TInt aAudioPriority = EMdaPriorityNormal, |
|
1021 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality); |
|
1022 |
|
1023 /** |
|
1024 Return a list of the supported data types for the record destination |
|
1025 @param "aSupportedDataTypes" list of four character codes, representing supported data |
|
1026 encodings for the record destination. |
|
1027 @leaves Can leave with one of the system-wide error codes |
|
1028 */ |
|
1029 IMPORT_C void GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const; |
|
1030 |
|
1031 /** |
|
1032 Set the data type of the destination audio clip |
|
1033 @param "aDataType" four character code, representing the encoding of the destination audio clip |
|
1034 @leaves Can leave with one of the system-wide error codes |
|
1035 */ |
|
1036 IMPORT_C void SetDestinationDataTypeL(TFourCC aDataType); |
|
1037 |
|
1038 /** |
|
1039 Return the data type of the destination audio clip |
|
1040 @returns four character code, representing the encoding of the destination audio clip |
|
1041 @leaves Can leave with one of the system-wide error codes |
|
1042 */ |
|
1043 IMPORT_C TFourCC DestinationDataTypeL() const; |
|
1044 |
|
1045 /** |
|
1046 Set the bit rate for recording |
|
1047 @param "aBitRate" destination bit rate in bits/second |
|
1048 @leaves Can leave with one of the system-wide error codes |
|
1049 */ |
|
1050 IMPORT_C void SetDestinationBitRateL(TUint aBitRate); |
|
1051 |
|
1052 /** |
|
1053 Return the recording bit rate |
|
1054 @returns destination bit rate in bits/second |
|
1055 @leaves Can leave with one of the system-wide error codes |
|
1056 */ |
|
1057 IMPORT_C TUint DestinationBitRateL() const; |
|
1058 |
|
1059 /** |
|
1060 Return a list of the supported bit rates for recording |
|
1061 @param "aSupportedBitRates" List of bit rates supported for the record |
|
1062 destination |
|
1063 @leaves Can leave with one of the system-wide error codes |
|
1064 */ |
|
1065 IMPORT_C void GetSupportedBitRatesL(RArray<TUint>& aSupportedBitRates) const; |
|
1066 |
|
1067 /** |
|
1068 Set the sample rate for the record destination |
|
1069 @param "aSampleRate" The sample rate of the record destination |
|
1070 @leaves Can leave with one of the system-wide error codes |
|
1071 */ |
|
1072 IMPORT_C void SetDestinationSampleRateL(TUint aSampleRate); |
|
1073 |
|
1074 /** |
|
1075 Return the sample rate of the record destination |
|
1076 @returns The sample rate of the record destination |
|
1077 @leaves Can leave with one of the system-wide error codes |
|
1078 */ |
|
1079 IMPORT_C TUint DestinationSampleRateL() const; |
|
1080 |
|
1081 /** |
|
1082 Get a list of supported recording sample rates. |
|
1083 @param "aSupportedSampleRates" List of the sample rates that are supported for |
|
1084 recording |
|
1085 @leaves Can leave with one of the system-wide error codes |
|
1086 */ |
|
1087 IMPORT_C void GetSupportedSampleRatesL(RArray<TUint>& aSupportedSampleRates) const; |
|
1088 |
|
1089 /** |
|
1090 Set the format of the audio clip. This can only be done if the audio clip does not |
|
1091 exist |
|
1092 |
|
1093 @param "aFormatUid" Uid of the audio clip format |
|
1094 @leaves KErrAlreadyExists if the clip already exists and the format is different |
|
1095 from the existing format, or can leave with one of the system-wide error codes |
|
1096 */ |
|
1097 IMPORT_C void SetDestinationFormatL(TUid aFormatUid); |
|
1098 |
|
1099 /** |
|
1100 Return the format of the audio clip |
|
1101 @returns Uid of the audio clip format |
|
1102 @leaves Can leave with one of the system-wide error codes |
|
1103 */ |
|
1104 IMPORT_C TUid DestinationFormatL() const; |
|
1105 |
|
1106 /** |
|
1107 Set the number of channels for the recorded audio clip |
|
1108 @param "aNumberOfChannels" The number of channels to record |
|
1109 @leaves Can leave with one of the system-wide error codes |
|
1110 */ |
|
1111 IMPORT_C void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels); |
|
1112 |
|
1113 /** |
|
1114 Return the number of channels in audio clip |
|
1115 @returns number of channels supported by audio clip |
|
1116 @leaves Can leave with one of the system-wide error codes |
|
1117 */ |
|
1118 IMPORT_C TUint DestinationNumberOfChannelsL() const; |
|
1119 |
|
1120 /** |
|
1121 Return a list of the supported number of channels for recording |
|
1122 @param "aSupportedNumChannels" List of the number of channels supported for |
|
1123 recording |
|
1124 @leaves Can leave with one of the system-wide error codes |
|
1125 */ |
|
1126 IMPORT_C void GetSupportedNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels) const; |
|
1127 |
|
1128 /** Start recording of the tuner output */ |
|
1129 IMPORT_C void RecordL(); |
|
1130 |
|
1131 /** |
|
1132 Pause recording. Recording can be resumed with another call to Record. |
|
1133 |
|
1134 @return A standard system error code |
|
1135 */ |
|
1136 IMPORT_C TInt PauseRecord(); |
|
1137 |
|
1138 /** |
|
1139 Stop recording, and release the output device for use by other clients |
|
1140 |
|
1141 Recording should already be under way. |
|
1142 */ |
|
1143 IMPORT_C void Stop(); |
|
1144 |
|
1145 /** |
|
1146 Stop recording, and release the output device for use by other clients |
|
1147 |
|
1148 Recording should already be under way. |
|
1149 */ |
|
1150 IMPORT_C void Close(); |
|
1151 |
|
1152 /** |
|
1153 Return the maximum value for the gain |
|
1154 |
|
1155 @return The maximum gain. For devices where automatic gain control is used, this value may be zero. |
|
1156 */ |
|
1157 IMPORT_C TInt MaxGain() const; |
|
1158 |
|
1159 /** |
|
1160 Sets the gain for the audio device to a specified value. |
|
1161 |
|
1162 @param aGain The gain setting. This can be any value from zero to the value returned by a call to |
|
1163 MaxGain(). A value which is less than zero is set to zero. A value which is greater than |
|
1164 MaxGain() is set to MaxGain(). |
|
1165 */ |
|
1166 IMPORT_C void SetGain(TInt aGain); |
|
1167 |
|
1168 /** |
|
1169 Sets the current recording balance setting between the left and right stereo channels |
|
1170 |
|
1171 The balance can be changed before or during recording and is effective immediately. |
|
1172 |
|
1173 @param aBalance The balance value to set. Any value between KMMFBalanceMaxLeft and |
|
1174 KMMFBalanceMaxRight, the default value being KMMFBalanceCenter. |
|
1175 @return An error code indicating if the call was successful. KErrNone on success, |
|
1176 otherwise another of the system-wide error codes. |
|
1177 */ |
|
1178 IMPORT_C TInt SetRecordBalance(TInt aBalance = KMMFBalanceCenter); |
|
1179 |
|
1180 /** |
|
1181 Returns the current recording balance setting between the left and right stereo channels. |
|
1182 |
|
1183 @param aBalance On return, contains the current recording balance between KMMFBalanceMaxLeft |
|
1184 and KMMFBalanceMaxRight. |
|
1185 @return An error code indicating if the call was successful. KErrNone on success, otherwise |
|
1186 another of the system-wide error codes. |
|
1187 */ |
|
1188 IMPORT_C TInt GetRecordBalance(TInt& aBalance) const; |
|
1189 |
|
1190 /** |
|
1191 Set the current audio priority. This priority is used to arbitrate |
|
1192 between multiple audio sources trying to access the audio hardware. |
|
1193 |
|
1194 @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax |
|
1195 @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference |
|
1196 @return A standard system error code |
|
1197 */ |
|
1198 IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); |
|
1199 |
|
1200 /** |
|
1201 Get the current audio priority. This is used to arbitrate between simultaneous |
|
1202 accesses to the sound hardware. |
|
1203 |
|
1204 @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return |
|
1205 @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference |
|
1206 @return A standard system error code |
|
1207 */ |
|
1208 IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const; |
|
1209 |
|
1210 /** |
|
1211 Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption |
|
1212 by a higher priority audio client. |
|
1213 */ |
|
1214 IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL); |
|
1215 |
|
1216 /** |
|
1217 Cancel an outstanding audio resource notification. |
|
1218 */ |
|
1219 IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId); |
|
1220 |
|
1221 |
|
1222 /** |
|
1223 Sets the maximum size for a file that is being recorded. |
|
1224 |
|
1225 When this limit is reached, MMF stops recording and notifies the client application. Notification is caused |
|
1226 by MMdaObjectStateChangeObserver::MoscoStateChangeEvent() with the error code KErrEof. |
|
1227 |
|
1228 This function is provided so that applications such as recorders can limit the amount of file storage/memory |
|
1229 that should be allocated. |
|
1230 |
|
1231 @param aMaxWriteLength |
|
1232 The maximum file size in kilobytes. If the default value is used, there is no maximum file size. |
|
1233 |
|
1234 */ |
|
1235 IMPORT_C void SetMaxWriteLength(TInt aMaxWriteLength = KMdaClipLocationMaxWriteLengthNone); |
|
1236 |
|
1237 /** |
|
1238 Returns the recording time available for the selected file or descriptor and encoding format. |
|
1239 */ |
|
1240 IMPORT_C const TTimeIntervalMicroSeconds& RecordTimeAvailable(); |
|
1241 |
|
1242 /** |
|
1243 Returns the duration of the audio sample data. |
|
1244 */ |
|
1245 IMPORT_C const TTimeIntervalMicroSeconds& Duration(); |
|
1246 |
|
1247 /** |
|
1248 Return the controller implementation information structure of the current controller |
|
1249 |
|
1250 @leave KErrNoMemory Out of memory |
|
1251 @return A reference to the current controller information |
|
1252 */ |
|
1253 IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); |
|
1254 |
|
1255 /* |
|
1256 Returns the number of meta data entries associated with this clip. |
|
1257 @return Number of metadata entries |
|
1258 */ |
|
1259 IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); |
|
1260 |
|
1261 /* |
|
1262 Returns the specified meta data entry from the current audio clip. |
|
1263 @return Metadata entry |
|
1264 */ |
|
1265 IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); |
|
1266 |
|
1267 /* |
|
1268 Adds a meta data entry to the audio clip. |
|
1269 */ |
|
1270 IMPORT_C void AddMetaDataEntryL(CMMFMetaDataEntry& aMetaDataEntry); |
|
1271 |
|
1272 /* |
|
1273 Removes a specified meta data entry from the audio clip |
|
1274 @return An error code indicating if the call was successful |
|
1275 */ |
|
1276 IMPORT_C TInt RemoveMetaDataEntry(TInt aMetaDataIndex); |
|
1277 |
|
1278 /* |
|
1279 Replaces the specified meta data entry with a new entry |
|
1280 */ |
|
1281 IMPORT_C void ReplaceMetaDataEntryL(TInt aMetaDataIndex, CMMFMetaDataEntry& aMetaDataEntry); |
|
1282 |
|
1283 |
|
1284 /** |
|
1285 Send a synchronous custom command to the recording controller |
|
1286 |
|
1287 @param aDestination The destination of the message, consisting of the uid of |
|
1288 the interface of this message |
|
1289 @param aFunction The function number to indicate which function is to be called |
|
1290 on the interface defined in the aDestination parameter |
|
1291 @param aDataTo1 The first chunk of data to be copied to the controller |
|
1292 framework. The exact contents of the data are dependent on the |
|
1293 interface being called. Can be KNullDesC8. |
|
1294 @param aDataTo2 The second chunk of data to be copied to the controller |
|
1295 framework. The exact contents of the data are dependent on the |
|
1296 interface being called. Can be KNullDesC8. |
|
1297 @return A standard system error code |
|
1298 */ |
|
1299 IMPORT_C TInt CustomCommandSync( |
|
1300 const TMMFMessageDestinationPckg& aDestination, |
|
1301 TInt aFunction, |
|
1302 const TDesC8& aDataTo1, |
|
1303 const TDesC8& aDataTo2); |
|
1304 |
|
1305 /** |
|
1306 Send a synchronous custom command to the recording controller |
|
1307 |
|
1308 @param aDestination The destination of the message, consisting of the uid of |
|
1309 the interface of this message |
|
1310 @param aFunction The function number to indicate which function is to be called |
|
1311 on the interface defined in the aDestination parameter |
|
1312 @param aDataTo1 The first chunk of data to be copied to the controller |
|
1313 framework. The exact contents of the data are dependent on the |
|
1314 interface being called. Can be KNullDesC8. |
|
1315 @param aDataTo2 The second chunk of data to be copied to the controller |
|
1316 framework. The exact contents of the data are dependent on the |
|
1317 interface being called. Can be KNullDesC8. |
|
1318 @param aDataFrom The area of memory to which the controller framework |
|
1319 will write any data to be passed back to the client. Can't be KNullDesC8. |
|
1320 @return A standard system error code |
|
1321 */ |
|
1322 IMPORT_C TInt CustomCommandSync( |
|
1323 const TMMFMessageDestinationPckg& aDestination, |
|
1324 TInt aFunction, |
|
1325 const TDesC8& aDataTo1, |
|
1326 const TDesC8& aDataTo2, |
|
1327 TDes8& aDataFrom); |
|
1328 |
|
1329 /** |
|
1330 Send an asynchronous custom command to the recording controller |
|
1331 |
|
1332 @param aDestination The destination of the message, consisting of the uid of |
|
1333 the interface of this message |
|
1334 @param aFunction The function number to indicate which function is to be called |
|
1335 on the interface defined in the aDestination parameter |
|
1336 @param aDataTo1 The first chunk of data to be copied to the controller |
|
1337 framework. The exact contents of the data are dependent on the |
|
1338 interface being called. Can be KNullDesC8. |
|
1339 @param aDataTo2 The second chunk of data to be copied to the controller |
|
1340 framework. The exact contents of the data are dependent on the |
|
1341 interface being called. Can be KNullDesC8. |
|
1342 @param aStatus The TRequestStatus of an active object. This will contain the |
|
1343 result of the request on completion. The exact range of result values is |
|
1344 dependent on the interface. |
|
1345 @return A standard system error code |
|
1346 */ |
|
1347 IMPORT_C void CustomCommandAsync( |
|
1348 const TMMFMessageDestinationPckg& aDestination, |
|
1349 TInt aFunction, |
|
1350 const TDesC8& aDataTo1, |
|
1351 const TDesC8& aDataTo2, |
|
1352 TRequestStatus& aStatus); |
|
1353 |
|
1354 /** |
|
1355 Send an asynchronous custom command to the recording controller |
|
1356 |
|
1357 @param aDestination The destination of the message, consisting of the uid of |
|
1358 the interface of this message |
|
1359 @param aFunction The function number to indicate which function is to be called |
|
1360 on the interface defined in the aDestination parameter |
|
1361 @param aDataTo1 The first chunk of data to be copied to the controller |
|
1362 framework. The exact contents of the data are dependent on the |
|
1363 interface being called. Can be KNullDesC8. |
|
1364 @param aDataTo2 The second chunk of data to be copied to the controller |
|
1365 framework. The exact contents of the data are dependent on the |
|
1366 interface being called. Can be KNullDesC8. |
|
1367 @param aDataFrom The area of memory to which the controller framework |
|
1368 will write any data to be passed back to the client. Can't be KNullDesC8. |
|
1369 @param aStatus The TRequestStatus of an active object. This will contain the |
|
1370 result of the request on completion. The exact range of result values is |
|
1371 dependent on the interface. |
|
1372 @return A standard system error code |
|
1373 */ |
|
1374 IMPORT_C void CustomCommandAsync( |
|
1375 const TMMFMessageDestinationPckg& aDestination, |
|
1376 TInt aFunction, |
|
1377 const TDesC8& aDataTo1, |
|
1378 const TDesC8& aDataTo2, |
|
1379 TDes8& aDataFrom, |
|
1380 TRequestStatus& aStatus); |
|
1381 |
|
1382 protected: |
|
1383 /** |
|
1384 Create a new audio recorder utility. Note that only one audio recorder utility may be created |
|
1385 per instance of CMMTunerUtility. Multiple instances will result in an error of KErrAlreadyExists |
|
1386 when InitializeL() is called. |
|
1387 */ |
|
1388 static CMMTunerAudioRecorderUtility* NewL(CMMTunerUtility& aTuner, MMMTunerAudioRecorderObserver& aObserver); |
|
1389 |
|
1390 private: |
|
1391 CMMTunerAudioRecorderUtility(); |
|
1392 private: |
|
1393 class CBody; |
|
1394 CBody* iBody; |
|
1395 |
|
1396 }; |
|
1397 |
|
1398 class MMMTunerAudioRecorderObserver |
|
1399 { |
|
1400 public: |
|
1401 /** |
|
1402 The TEvent enumeration is used to indicate which type of event is being sent to the client. |
|
1403 Each event will be associated with an error code and potentially some addition information, |
|
1404 and will be passed to the client via method MTaroRecordEvent(). |
|
1405 */ |
|
1406 enum TEventType |
|
1407 { |
|
1408 /** An event relating to the tuner itself. Any error other than KErrNone associated |
|
1409 with this event type may indicate that the tuner cannot be used anymore. |
|
1410 |
|
1411 No additional information is associated with this type of event. */ |
|
1412 ETunerEvent, |
|
1413 /** |
|
1414 An event relating to audio recording. |
|
1415 |
|
1416 No additional information is associated with this type of event. |
|
1417 */ |
|
1418 EAudioEvent |
|
1419 }; |
|
1420 public: |
|
1421 /** |
|
1422 Initialize complete event. This event is asynchronous and is received after |
|
1423 a call to CMMTunerAudioRecorderUtility::InitializeL. |
|
1424 |
|
1425 @param aError A standard system error |
|
1426 */ |
|
1427 virtual void MTaroInitializeComplete(TInt aError) = 0; |
|
1428 |
|
1429 /** |
|
1430 Passes an asychronous event to the tuner client. |
|
1431 |
|
1432 @param aEvent The type of event. See enumeration MMMTunerAudioRecorderObserver::TEventType |
|
1433 for more information about when the event types mean. |
|
1434 @param aError An error code associated with the event. |
|
1435 @param aAdditionalInfo Any additional information associated with the event, or NULL if |
|
1436 no such additional information exists. |
|
1437 */ |
|
1438 virtual void MTaroRecordEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0; |
|
1439 }; |
|
1440 |
|
1441 /** |
|
1442 This class augments CMMTunerUtility to provide station scanning functionality, |
|
1443 whereby the frequency spectrum is searched, pausing for a specified amount of |
|
1444 time when a station is found. |
|
1445 */ |
|
1446 class CMMTunerScannerUtility : public CBase |
|
1447 { |
|
1448 friend class CMMTunerUtility::CBody; |
|
1449 public: |
|
1450 |
|
1451 IMPORT_C ~CMMTunerScannerUtility(); |
|
1452 |
|
1453 /** |
|
1454 Continuously scan for a radio station, pausing for the time specified before |
|
1455 continuing on to the next station. Call StopScan to select the currently tuned |
|
1456 station. The search is limited to the specified band. |
|
1457 |
|
1458 @note The control of a CMMTunerUtility object must have been passed to this |
|
1459 class (using TransferTunerControl) before this function is called. |
|
1460 |
|
1461 @param aBand The band to which aStartFrequency belongs |
|
1462 @param aSearchDirect The direction to search in |
|
1463 @param aPauseDuration Time to pause at each station |
|
1464 @param aCircularScan If set to ETrue the station scan will loop back to the other |
|
1465 end of the band once the end of the band has been reached. (Defaults to ETrue) |
|
1466 */ |
|
1467 IMPORT_C void StationScan(CMMTunerUtility::TSearchDirection aSearchDirection, |
|
1468 TTimeIntervalMicroSeconds32 aPauseDuration |
|
1469 ); |
|
1470 |
|
1471 /** |
|
1472 Stop scanning and use the currently tuned station |
|
1473 |
|
1474 @return ETrue if a station is tuned, EFalse otherwise |
|
1475 */ |
|
1476 IMPORT_C TBool StopScan(); |
|
1477 |
|
1478 protected: |
|
1479 /** |
|
1480 Factory function to create a new CMMTunerScannerUtility. |
|
1481 |
|
1482 @param aTuner The tuner with which to perform the scanning. |
|
1483 @leave KErrNoMemory Out of memory. |
|
1484 @return A newly contructed tuner scanner utility. |
|
1485 */ |
|
1486 static CMMTunerScannerUtility* NewL(CMMTunerUtility& aTuner,CMMTunerUtility::TTunerBand aBand); |
|
1487 |
|
1488 private: |
|
1489 CMMTunerScannerUtility(); |
|
1490 private: |
|
1491 class CBody; |
|
1492 CBody* iBody; |
|
1493 |
|
1494 }; |
|
1495 |
|
1496 |
|
1497 /** Programme Station name, 8 characters */ |
|
1498 typedef TBuf<8> TRdsStationName; |
|
1499 /** Programme Type Name, 8 characters */ |
|
1500 typedef TBuf<8> TRdsProgrammeTypeName; |
|
1501 /** RDS Programme Identifier, a unique ID for each radio station */ |
|
1502 typedef TInt TRdsProgrammeIdentifier; |
|
1503 |
|
1504 /** |
|
1505 Programme Item Number - identifies the start time of the current programme, |
|
1506 as published by the broadcaster. |
|
1507 */ |
|
1508 class TRdsProgrammeItemNumber |
|
1509 { |
|
1510 public: |
|
1511 /** The day of the month of the broadcast, in the range 1-31 */ |
|
1512 TInt iDayOfMonth; |
|
1513 /** The hour of the day, in the range 0-23 */ |
|
1514 TInt iHour; |
|
1515 /** The minute past the hour, in the range 0-59 */ |
|
1516 TInt iMinute; |
|
1517 public: |
|
1518 inline TInt operator==(const TRdsProgrammeItemNumber& aPin) const; |
|
1519 inline TInt operator!=(const TRdsProgrammeItemNumber& aPin) const; |
|
1520 }; |
|
1521 |
|
1522 /** |
|
1523 An RDS extended country code. The meaning of a value of this type is defined |
|
1524 by the RDS specification, IEC62106. |
|
1525 */ |
|
1526 typedef TInt TRdsCountryCode; |
|
1527 |
|
1528 /** |
|
1529 An RDS language identification code. The meaning of a value of this type is |
|
1530 defined by the RDS specification, IEC62106. |
|
1531 */ |
|
1532 typedef TInt TRdsLanguageIdentifier; |
|
1533 |
|
1534 /** |
|
1535 RDS Programme Type. |
|
1536 |
|
1537 The interpretation of values of this type depends on the origin of the RDS |
|
1538 broadcast: in North America, a slightly different standard, RBDS, is used. |
|
1539 These PTY codes are defined by static values KRbdsPtyXxxxx, for example |
|
1540 KRbdsPtySoftRock. |
|
1541 |
|
1542 Elsewhere, including Europe, the RDS standard is used. In these areas, the |
|
1543 PTY codes are defined by static values KRdsPtyXxxxx, for example |
|
1544 KRdsPtyChildrensProgrammes. |
|
1545 |
|
1546 In all other important aspects, the European RDS and North American RBDS |
|
1547 standards are identical. |
|
1548 */ |
|
1549 typedef TInt TRdsProgrammeType; |
|
1550 |
|
1551 /** No programme type or undefined */ |
|
1552 const static TRdsProgrammeType KRdsPtyNone = 0; |
|
1553 /** News */ |
|
1554 const static TRdsProgrammeType KRdsPtyNews = 1; |
|
1555 /** CurrentAffairs */ |
|
1556 const static TRdsProgrammeType KRdsPtyCurrentAffairs = 2; |
|
1557 /** Information */ |
|
1558 const static TRdsProgrammeType KRdsPtyInformation = 3; |
|
1559 /** Sport */ |
|
1560 const static TRdsProgrammeType KRdsPtySport = 4; |
|
1561 /** Education */ |
|
1562 const static TRdsProgrammeType KRdsPtyEducation = 5; |
|
1563 /** Drama */ |
|
1564 const static TRdsProgrammeType KRdsPtyDrama = 6; |
|
1565 /** Culture */ |
|
1566 const static TRdsProgrammeType KRdsPtyCulture = 7; |
|
1567 /** Science */ |
|
1568 const static TRdsProgrammeType KRdsPtyScience = 8; |
|
1569 /** VariedSpeech */ |
|
1570 const static TRdsProgrammeType KRdsPtyVariedSpeech = 9; |
|
1571 /** PopMusic */ |
|
1572 const static TRdsProgrammeType KRdsPtyPopMusic = 10; |
|
1573 /** RockMusic */ |
|
1574 const static TRdsProgrammeType KRdsPtyRockMusic = 11; |
|
1575 /** EasyListening */ |
|
1576 const static TRdsProgrammeType KRdsPtyEasyListening = 12; |
|
1577 /** LightClassical */ |
|
1578 const static TRdsProgrammeType KRdsPtyLightClassical = 13; |
|
1579 /** SeriousClassics */ |
|
1580 const static TRdsProgrammeType KRdsPtySeriousClassical = 14; |
|
1581 /** OtherMusic */ |
|
1582 const static TRdsProgrammeType KRdsPtyOtherMusic = 15; |
|
1583 /** Weather */ |
|
1584 const static TRdsProgrammeType KRdsPtyWeather = 16; |
|
1585 /** Finance */ |
|
1586 const static TRdsProgrammeType KRdsPtyFinance = 17; |
|
1587 /** ChildrensProgrammes */ |
|
1588 const static TRdsProgrammeType KRdsPtyChildrensProgrammes = 18; |
|
1589 /** SocialAffairs */ |
|
1590 const static TRdsProgrammeType KRdsPtySocialAffairs = 19; |
|
1591 /** Religion */ |
|
1592 const static TRdsProgrammeType KRdsPtyReligion = 20; |
|
1593 /** PhoneIn */ |
|
1594 const static TRdsProgrammeType KRdsPtyPhoneIn = 21; |
|
1595 /** Travel */ |
|
1596 const static TRdsProgrammeType KRdsPtyTravel = 22; |
|
1597 /** Leisure */ |
|
1598 const static TRdsProgrammeType KRdsPtyLeisure = 23; |
|
1599 /** JazzMusic */ |
|
1600 const static TRdsProgrammeType KRdsPtyJazzMusic = 24; |
|
1601 /** CountryMusic */ |
|
1602 const static TRdsProgrammeType KRdsPtyCountryMusic = 25; |
|
1603 /** NationalMusic */ |
|
1604 const static TRdsProgrammeType KRdsPtyNationalMusic = 26; |
|
1605 /** OldiesMusic */ |
|
1606 const static TRdsProgrammeType KRdsPtyOldiesMusic = 27; |
|
1607 /** FolkMusic */ |
|
1608 const static TRdsProgrammeType KRdsPtyFolkMusic = 28; |
|
1609 /** Documentary */ |
|
1610 const static TRdsProgrammeType KRdsPtyDocumentary = 29; |
|
1611 /** AlarmTest */ |
|
1612 const static TRdsProgrammeType KRdsPtyAlarmTest = 30; |
|
1613 /** Alarm */ |
|
1614 const static TRdsProgrammeType KRdsPtyAlarm = 31; |
|
1615 |
|
1616 |
|
1617 /** No programme type or undefined */ |
|
1618 const static TRdsProgrammeType KRbdsPtyNone = 0; |
|
1619 /** News */ |
|
1620 const static TRdsProgrammeType KRbdsPtyNews = 1; |
|
1621 /** Informaion */ |
|
1622 const static TRdsProgrammeType KRbdsPtyInformation = 2; |
|
1623 /** Sports */ |
|
1624 const static TRdsProgrammeType KRbdsPtySports = 3; |
|
1625 /** Talk */ |
|
1626 const static TRdsProgrammeType KRbdsPtyTalk = 4; |
|
1627 /** Rock */ |
|
1628 const static TRdsProgrammeType KRbdsPtyRock = 5; |
|
1629 /** Classic Rock */ |
|
1630 const static TRdsProgrammeType KRbdsPtyClassicRock = 6; |
|
1631 /** Adult Hits */ |
|
1632 const static TRdsProgrammeType KRbdsPtyAdultHits = 7; |
|
1633 /** Soft Rock */ |
|
1634 const static TRdsProgrammeType KRbdsPtySoftRock = 8; |
|
1635 /** Top 40 */ |
|
1636 const static TRdsProgrammeType KRbdsPtyTop40 = 9; |
|
1637 /** Country */ |
|
1638 const static TRdsProgrammeType KRbdsPtyCountry = 10; |
|
1639 /** Oldies */ |
|
1640 const static TRdsProgrammeType KRbdsPtyOldies = 11; |
|
1641 /** Soft */ |
|
1642 const static TRdsProgrammeType KRbdsPtySoft = 12; |
|
1643 /** Nostalgia */ |
|
1644 const static TRdsProgrammeType KRbdsPtyNostalgia = 13; |
|
1645 /** Jazz */ |
|
1646 const static TRdsProgrammeType KRbdsPtyJazz = 14; |
|
1647 /** Classical */ |
|
1648 const static TRdsProgrammeType KRbdsPtyClassical = 15; |
|
1649 /** Rhythm and Blues */ |
|
1650 const static TRdsProgrammeType KRbdsPtyRhythmAndBlues = 16; |
|
1651 /** Soft Rhythm and Blues */ |
|
1652 const static TRdsProgrammeType KRbdsPtySoftRhythmAndBlues = 17; |
|
1653 /** Language */ |
|
1654 const static TRdsProgrammeType KRbdsPtyLanguage = 18; |
|
1655 /** Religious Music */ |
|
1656 const static TRdsProgrammeType KRbdsPtyReligiousMusic = 19; |
|
1657 /** Religious Talk */ |
|
1658 const static TRdsProgrammeType KRbdsPtyReligiousTalk = 20; |
|
1659 /** Personality */ |
|
1660 const static TRdsProgrammeType KRbdsPtyPersonality = 21; |
|
1661 /** Public */ |
|
1662 const static TRdsProgrammeType KRbdsPtyPublic = 22; |
|
1663 /** College */ |
|
1664 const static TRdsProgrammeType KRbdsPtyCollege = 23; |
|
1665 /** Unassigned */ |
|
1666 const static TRdsProgrammeType KRbdsPtyUnassigned1 = 24; |
|
1667 /** Unassigned */ |
|
1668 const static TRdsProgrammeType KRbdsPtyUnassigned2 = 25; |
|
1669 /** Unassigned */ |
|
1670 const static TRdsProgrammeType KRbdsPtyUnassigned3 = 26; |
|
1671 /** Unassigned */ |
|
1672 const static TRdsProgrammeType KRbdsPtyUnassigned4 = 27; |
|
1673 /** Unassigned */ |
|
1674 const static TRdsProgrammeType KRbdsPtyUnassigned5 = 28; |
|
1675 /** Weather */ |
|
1676 const static TRdsProgrammeType KRbdsPtyWeather = 29; |
|
1677 /** Emergency Test */ |
|
1678 const static TRdsProgrammeType KRbdsPtyEmergencyTest = 30; |
|
1679 /** Emergency */ |
|
1680 const static TRdsProgrammeType KRbdsPtyEmergency = 31; |
|
1681 |
|
1682 /** |
|
1683 The RDS Capabilities class defines the capabilities of the RDS tuner on the |
|
1684 device, as retrieved using the function GetRdsCapabilities. |
|
1685 */ |
|
1686 class TRdsCapabilities |
|
1687 { |
|
1688 public: |
|
1689 /** RDS Function Bit Flags */ |
|
1690 enum TRdsFunctions |
|
1691 { |
|
1692 /** Traffic Announcement */ |
|
1693 ERdsFunctionTa = 0x01, |
|
1694 /** Regional Links */ |
|
1695 ERdsFunctionRegLink = 0x02, |
|
1696 /** News Announcement */ |
|
1697 ERdsFunctionNa = 0x04, |
|
1698 /** Programme Type */ |
|
1699 ERdsFunctionPty = 0x08, |
|
1700 /** Clock Time */ |
|
1701 ERdsFunctionCt = 0x10, |
|
1702 /** Enhanced Other Networks */ |
|
1703 ERdsFunctionEon = 0x20, |
|
1704 /** Alternative Frequency */ |
|
1705 ERdsFunctionAf = 0x40 |
|
1706 }; |
|
1707 public: |
|
1708 /** Bitfield as defined by ERdsFunctions with the bits of the supported functions set */ |
|
1709 TUint32 iRdsFunctions; |
|
1710 }; |
|
1711 |
|
1712 class MMMRdsDataObserver; |
|
1713 class MMMRdsEonObserver; |
|
1714 class MMMRdsStateChangeObserver; |
|
1715 class MMMRdsAnnouncementObserver; |
|
1716 |
|
1717 /** |
|
1718 This class represents the basic RDS data associated with an RDS station. |
|
1719 */ |
|
1720 class TRdsData |
|
1721 { |
|
1722 public: |
|
1723 inline TRdsData(); |
|
1724 public: |
|
1725 /** |
|
1726 Enumeration to indicate a subset of the members of class TRdsData. These values should |
|
1727 be bitwise or'ed together to indicate which members belong in a set. |
|
1728 */ |
|
1729 enum TField |
|
1730 { |
|
1731 /** Indicates the the member iPi is in a set */ |
|
1732 EProgrammeIdentifier = 0x001, |
|
1733 /** Indicates the the member iPs is in a set */ |
|
1734 EStationName = 0x002, |
|
1735 /** Indicates the the member iTp is in a set */ |
|
1736 ETrafficProgramme = 0x004, |
|
1737 /** Indicates the the member iTa is in a set */ |
|
1738 ETrafficAnnouncement = 0x008, |
|
1739 /** Indicates the the member iPty is in a set */ |
|
1740 EProgrammeType = 0x010, |
|
1741 /** Indicates the the member iPtyn is in a set */ |
|
1742 EProgrammeTypeName = 0x020, |
|
1743 /** Indicates the the member iPin is in a set */ |
|
1744 EProgrammeItemNumber = 0x040, |
|
1745 /** Indicates the the member iMs is in a set */ |
|
1746 EMusicSpeech = 0x080, |
|
1747 /** Indicates the the member iBroadcastLanguage is in a set */ |
|
1748 EBroadcastLanguage = 0x100, |
|
1749 /** Indicates the the member iEcc is in a set */ |
|
1750 EExtendedCountryCode = 0x200 |
|
1751 }; |
|
1752 /** |
|
1753 A value indicating a set containig all RDS data encapsulated by class TRdsData. |
|
1754 */ |
|
1755 const static TUint32 KAllRdsData = (EProgrammeIdentifier | EStationName | ETrafficProgramme | ETrafficAnnouncement |
|
1756 | EProgrammeType | EProgrammeTypeName | EProgrammeItemNumber | EMusicSpeech |
|
1757 | EBroadcastLanguage | EExtendedCountryCode); |
|
1758 public: |
|
1759 /** Programme Identifier of the station */ |
|
1760 TRdsProgrammeIdentifier iPi; |
|
1761 /** Programme Station name of the station */ |
|
1762 TRdsStationName iPs; |
|
1763 /** Value of the Traffic Programme flag of the station */ |
|
1764 TBool iTp; |
|
1765 /** Value of the Traffic Announcement flag of the station */ |
|
1766 TBool iTa; |
|
1767 /** Programme Type of the station */ |
|
1768 TRdsProgrammeType iPty; |
|
1769 /** Programme Type Name of the station */ |
|
1770 TRdsProgrammeTypeName iPtyn; |
|
1771 /** Programme Item Number of the station */ |
|
1772 TRdsProgrammeItemNumber iPin; |
|
1773 /** Value of the Music Speech flag of the station. EFalse indicates the speech is being |
|
1774 broadcast at present. ETrue indicates that music is being broadcast, or that the flag is |
|
1775 not in use by the broadcaster. */ |
|
1776 TBool iMs; |
|
1777 /** The current language of the broadcast */ |
|
1778 TRdsLanguageIdentifier iBroadcastLanguage; |
|
1779 /** The Extended Country Code of the station */ |
|
1780 TRdsCountryCode iEcc; |
|
1781 }; |
|
1782 |
|
1783 /** |
|
1784 Class representing a station broadcast as an Enhanced Other Networks station. |
|
1785 */ |
|
1786 class TEonStation |
|
1787 { |
|
1788 public: |
|
1789 /** |
|
1790 Enumeration to indicate a subset of the members of class TEonStation. These values should |
|
1791 be bitwise or'ed together to indicate which members belong in a set. |
|
1792 */ |
|
1793 enum TField |
|
1794 { |
|
1795 /** Indicates that member iProgrammeIdentifier is valid. */ |
|
1796 EProgrammeIdentifier= 0x01, |
|
1797 /** Indicates that member iStationName is valid. */ |
|
1798 EStationName = 0x02, |
|
1799 /** Indicates that member iProgrammeType is valid. */ |
|
1800 EProgrammeType = 0x04, |
|
1801 /** Indicates that member iTrafficProgramme is valid. */ |
|
1802 ETrafficProgramme = 0x08, |
|
1803 /** Indicates that member iTrafficAnnouncement is valid. */ |
|
1804 ETrafficAnnouncement= 0x10, |
|
1805 /** Indicates that member iProgrammeItemNumber is valid. */ |
|
1806 EProgrammeItemNumber= 0x20, |
|
1807 /** Indicates that member iNoFrequencies is valid. */ |
|
1808 ENoFrequencies = 0x40, |
|
1809 /** Indicates that member iNoMappedFrequencies is valid. */ |
|
1810 ENoMappedFrequencies= 0x80 |
|
1811 }; |
|
1812 public: |
|
1813 /** The unique identifier of this station */ |
|
1814 TRdsProgrammeIdentifier iProgrammeIdentifier; |
|
1815 /** The textual name of this station */ |
|
1816 TRdsStationName iStationName; |
|
1817 /** The current programme type (PTY) of this station */ |
|
1818 TRdsProgrammeType iProgrammeType; |
|
1819 /** Indicates if this station broadcasts traffic programmes */ |
|
1820 TBool iTrafficProgramme; |
|
1821 /** Indicates if this station is currently broadcasting a traffic announcement */ |
|
1822 TBool iTrafficAnnouncement; |
|
1823 /** The programme item number (PIN) of the current broadcast on this station. */ |
|
1824 TRdsProgrammeItemNumber iProgrammeItemNumber; |
|
1825 /** |
|
1826 The number of frequencies associated with this station. If this number is zero, |
|
1827 it may be that the EON station uses the mapped frequencies method instead. See |
|
1828 iNoMappedFrequencies. |
|
1829 */ |
|
1830 TInt iNoFrequencies; |
|
1831 /** |
|
1832 The number of mapped frequencies associated with this station. If this number is |
|
1833 zero, it may be that the EON station uses a flat frequency list instead. See |
|
1834 iNoFrequencies. |
|
1835 */ |
|
1836 TInt iNoMappedFrequencies; |
|
1837 /** |
|
1838 Indicates the subset of fields of the class that are valid. Bits are set according to enumeration |
|
1839 TEonStation::TField |
|
1840 */ |
|
1841 TUint32 iValid; |
|
1842 }; |
|
1843 |
|
1844 /** |
|
1845 Mapped frequencies can be broadcast as a part of the EON information. They relate the |
|
1846 current tuning frequency with the frequency which the referred EON station will be |
|
1847 broadcast on. |
|
1848 */ |
|
1849 class TEonMappedFrequency |
|
1850 { |
|
1851 public: |
|
1852 inline TEonMappedFrequency(TFrequency aTuningFrequency, TFrequency aMappedFrequency); |
|
1853 public: |
|
1854 /** The current tuning frequency, relating to the station broadcasting the EON informarion. */ |
|
1855 TFrequency iTuningFrequency; |
|
1856 /** |
|
1857 The mapped frequency. If iTunedFrequency matches the currently tuned frequency, the |
|
1858 EON station will be broadcast on this frequency. |
|
1859 */ |
|
1860 TFrequency iMappedFrequency; |
|
1861 }; |
|
1862 |
|
1863 /** |
|
1864 The RDS class augments the tuner API to give access to the RDS capabilities |
|
1865 of the device. As such additional tuner technologies can be supported without |
|
1866 changing the Tuner API. |
|
1867 |
|
1868 Note that despite this class being names 'RDS', it is capable of supporting both |
|
1869 the RDS standard, and the North American equivilant RBDS. The only important difference |
|
1870 from the APIs perspective is the interpretation of the Programme Type (PTY) codes. See |
|
1871 TRdsProgrammeType for more information. |
|
1872 */ |
|
1873 class CMMRdsTunerUtility : public CBase |
|
1874 { |
|
1875 friend class CMMTunerUtility::CBody; |
|
1876 public: |
|
1877 /** RDS Announcement Type */ |
|
1878 enum TAnnouncementType |
|
1879 { |
|
1880 /** Traffic announcement */ |
|
1881 ERdsTrafficAnnouncement, |
|
1882 /** News announcement */ |
|
1883 ERdsNewsAnnouncement |
|
1884 }; |
|
1885 public: |
|
1886 /** |
|
1887 Factory function to create a new instance of the RDS Tuner API |
|
1888 |
|
1889 @param aTuner A RDS capable tuner object (check using CMMTunerUtility::GetCapabilities()) |
|
1890 @param aObserver The observer of the tuner to receive asynchronous completion messages. |
|
1891 @leave KErrNoMemory Out of memory |
|
1892 @leave KErrNotFound CMMRdsTunerUtility object is not present |
|
1893 @leave KErrNotSupported RDS is not supported by the tuner |
|
1894 @return A pointer and ownership of a fully constructed CMMRdsTunerUtility object |
|
1895 */ |
|
1896 IMPORT_C static CMMRdsTunerUtility* NewL(CMMTunerUtility& aTuner, MMMTunerObserver& aObserver, CMMTunerUtility::TTunerBand aBand); |
|
1897 |
|
1898 IMPORT_C ~CMMRdsTunerUtility(); |
|
1899 |
|
1900 /** |
|
1901 Get the RDS capabilities of the device |
|
1902 |
|
1903 @param aCaps The capabilities object to fill |
|
1904 @return A standard system error code |
|
1905 */ |
|
1906 IMPORT_C TInt GetRdsCapabilities(TRdsCapabilities& aCaps) const; |
|
1907 |
|
1908 /** |
|
1909 Find a radio station which contains RDS data starting at the start frequency |
|
1910 and searching in the direction specified (i.e. Up or down). |
|
1911 |
|
1912 @note this function is subject to the same access control scheme as the Tune |
|
1913 methods of CMMTunerUtility |
|
1914 |
|
1915 @param aStartFrequency The frequency to start searching from, or 0 to start at the |
|
1916 beginning of the stated band. |
|
1917 @param aBand The frequency band to search. This must be a FM band. |
|
1918 @param aSearchDirection The direction to search in |
|
1919 @param aCircularSeek If set to ETrue the station seek will loop back to the |
|
1920 other end of the band once the end of the band has been reached. |
|
1921 (Defaults to ETrue) If not set reaching the end of the band without |
|
1922 finding a station will result in a callback to MToTuneComplete with error |
|
1923 KErrNotFound. |
|
1924 */ |
|
1925 IMPORT_C void StationSearchByRds(TFrequency aStartFrequency, |
|
1926 CMMTunerUtility::TSearchDirection aSearchDirection |
|
1927 ); |
|
1928 |
|
1929 /** |
|
1930 Find a radio station, of the specified programme type starting at the start |
|
1931 frequency and searching in the direction specified (i.e. Up or down). |
|
1932 |
|
1933 @note this function is subject to the same access control scheme as the Tune |
|
1934 methods of CMMTunerUtility |
|
1935 |
|
1936 @param aProgType The type of programme to search for |
|
1937 @param aStartFrequency The frequency to start searching from, or 0 to start at the |
|
1938 beginning of the stated band. |
|
1939 @param aBand The frequency band to search. This must be a FM band. |
|
1940 @param aSearchDirection The direction to search in |
|
1941 @param aCircularSeek If set to ETrue the station seek will loop back to the |
|
1942 other end of the band once the end of the band has been reached. |
|
1943 (Defaults to ETrue) If not set reaching the end of the band without |
|
1944 finding a station will result in a callback to MToTuneComplete with error |
|
1945 KErrNotFound. |
|
1946 */ |
|
1947 IMPORT_C void StationSearchByProgrammeType( |
|
1948 TRdsProgrammeType aProgType, |
|
1949 TFrequency aStartFrequency, |
|
1950 CMMTunerUtility::TSearchDirection aSearchDirection |
|
1951 ); |
|
1952 |
|
1953 /** |
|
1954 Find a radio station, with the specified programme identifier starting at the |
|
1955 start frequency and searching in the direction specified (i.e. Up or down). |
|
1956 |
|
1957 @note this function is subject to the same access control scheme as the Tune |
|
1958 methods of CMMTunerUtility |
|
1959 |
|
1960 @param aPi The programme identifier of the station to search for |
|
1961 @param aStartFrequency The frequency to start searching from, or 0 to start at the |
|
1962 beginning of the stated band. |
|
1963 @param aBand The frequency band to search. This must be a FM band. |
|
1964 @param aSearchDirection The direction to search in |
|
1965 @param aCircularSeek If set to ETrue the station seek will loop back to the other |
|
1966 end of the band once the end of the band has been reached. (Defaults to ETrue) |
|
1967 If not set reaching the end of the band without finding a station will result |
|
1968 in a callback to MToTuneComplete with error KErrNotFound. |
|
1969 */ |
|
1970 IMPORT_C void StationSearchByProgrammeIdentifier( |
|
1971 TRdsProgrammeIdentifier aPi, |
|
1972 TFrequency aStartFrequency, |
|
1973 CMMTunerUtility::TSearchDirection aSearchDirection |
|
1974 ); |
|
1975 |
|
1976 /** |
|
1977 Find a radio station, with the specified traffic programme flag value starting at |
|
1978 the start frequency and searching in the direction specified (i.e. Up or down). |
|
1979 |
|
1980 @note this function is subject to the same access control scheme as the Tune |
|
1981 methods of CMMTunerUtility |
|
1982 |
|
1983 @param aTp The TP flag value of a station to search for |
|
1984 @param aStartFrequency The frequency to start searching from, or 0 to start at the |
|
1985 beginning of the stated band. |
|
1986 @param aBand The frequency band to search. This must be a FM band. |
|
1987 @param aSearchDirection The direction to search in |
|
1988 @param aCircularSeek If set to ETrue the station seek will loop back to the other |
|
1989 end of the band once the end of the band has been reached. (Defaults to ETrue) |
|
1990 If not set reaching the end of the band without finding a station will result |
|
1991 in a callback to MToTuneComplete with error KErrNotFound. |
|
1992 */ |
|
1993 IMPORT_C void StationSearchByTrafficProgramme( |
|
1994 TBool aTp, |
|
1995 TFrequency aStartFrequency, |
|
1996 CMMTunerUtility::TSearchDirection aSearchDirection |
|
1997 ); |
|
1998 |
|
1999 /** |
|
2000 Cancels an ongoing RDS search as initiated by one of the functions |
|
2001 StationSearchByRds, StationSearchByProgrammeType, |
|
2002 StationSearchByProgrammeIdentifier or StationSearchByTrafficProgramme. The |
|
2003 asynchronous callback will not occur if this is called. |
|
2004 |
|
2005 Has not affect if no RDS search operation is ongoing. |
|
2006 */ |
|
2007 IMPORT_C void CancelRdsSearch(); |
|
2008 |
|
2009 /** |
|
2010 Requests notifications when all RDS data become invalid due to the tuner being |
|
2011 retuned. |
|
2012 |
|
2013 @param aObserver The client to be notified. |
|
2014 @param aWhichData The subset of data for which change notifications are required. |
|
2015 @return A standard system wide error code. |
|
2016 */ |
|
2017 IMPORT_C TInt NotifyRdsDataChange(MMMRdsDataObserver& aObserver, TUint32 aWhichData = TRdsData::KAllRdsData); |
|
2018 |
|
2019 /** |
|
2020 Cancel a NotifyRdsDataChange request. |
|
2021 */ |
|
2022 IMPORT_C void CancelNotifyRdsDataChange(); |
|
2023 |
|
2024 /** |
|
2025 Request some RDS data. This will complete immediately with whatever RDS data have already been |
|
2026 received. |
|
2027 |
|
2028 When this function returns, and data that was requested but is not indicated to be |
|
2029 valid can be assumed not to have been received. |
|
2030 |
|
2031 @param aData The RDS data will be written to this variable. |
|
2032 @param aValid On return, indicates a subset of RDS data that are valid. |
|
2033 @param aWhichData The subset of RDS data that are being requested. |
|
2034 @return A standard system wide error code. |
|
2035 */ |
|
2036 IMPORT_C TInt GetRdsData(TRdsData& aData, TUint32& aValid, TUint32 aWhichData = TRdsData::KAllRdsData) const; |
|
2037 |
|
2038 /** |
|
2039 Converts an RDS language identifier into a Symbian TLanguage type. Note that not all |
|
2040 languages defined by the RDS specification IEC62106 are present in the TLanguage |
|
2041 enumeration; in these cases, a value of ELangOther will be returned. |
|
2042 |
|
2043 @param aRdsLangId An RDS language identification code |
|
2044 @return The corresponding TLanguage member, or ELangOther if none exists. |
|
2045 */ |
|
2046 IMPORT_C static TLanguage ConvertRdsLanguageId(TRdsLanguageIdentifier aRdsLangId); |
|
2047 |
|
2048 /** |
|
2049 Get the length of the available radio text. If no radio text is available this |
|
2050 function will return KErrNotFound. The maximum possible length for radio text is 64 characters. |
|
2051 |
|
2052 @param aLength The variable to set to the length of the avaiable radio text |
|
2053 @return A standard system error code. |
|
2054 */ |
|
2055 IMPORT_C TInt GetRadioTextLength(TUint& aLength) const; |
|
2056 |
|
2057 /** |
|
2058 Get the radio text. If no radio text is available, this will return KErrNotFound. In this |
|
2059 case, a client can call NotifyRadioText to receive a notification when it is received. |
|
2060 |
|
2061 The radio text will have been converted to unicode, eliminating any control characters |
|
2062 within it. |
|
2063 |
|
2064 @param aRadioText The descriptor to fill with the radio text |
|
2065 @return A standard system error code |
|
2066 */ |
|
2067 IMPORT_C TInt GetRadioText(TDes& aRadioText) const; |
|
2068 |
|
2069 /** |
|
2070 Request notification when the radio text is received or changes. |
|
2071 |
|
2072 @param aObserver The client to be notified when the radio text is received or changes. |
|
2073 @return A standard system wide error code. |
|
2074 */ |
|
2075 IMPORT_C TInt NotifyRadioText(MMMRdsDataObserver& aObserver); |
|
2076 |
|
2077 /** |
|
2078 Cancel a NotifyRadioText request. |
|
2079 */ |
|
2080 IMPORT_C void CancelNotifyRadioText(); |
|
2081 |
|
2082 /** |
|
2083 Turns regional link function on or off depending on the value of the parameter. |
|
2084 A value of ETrue should be passed if you wish to stay tuned to the currently |
|
2085 tuned local station regardless of signal quality and signal strength. |
|
2086 i.e. don't switch to another local station in the region. |
|
2087 |
|
2088 @param aRegOn ETrue to turn regional link on, EFalse to turn it off |
|
2089 @return A standard system error code |
|
2090 */ |
|
2091 IMPORT_C TInt SetRegionalLink(TBool aRegOn); |
|
2092 |
|
2093 /** |
|
2094 Finds out if the regional link function is currently on or off. |
|
2095 |
|
2096 @param aRegOn This will be set to ETrue on return if and only if the regional |
|
2097 link function is currently enabled. |
|
2098 @return A standard system error code. |
|
2099 */ |
|
2100 IMPORT_C TInt GetRegionalLink(TBool& aRegOn) const; |
|
2101 |
|
2102 /** |
|
2103 Turn the travel announcement function on or off depending on the value of the |
|
2104 parameter. A value of ETrue turns on Traffic Announcements, EFalse turns them off. |
|
2105 |
|
2106 If Traffic announcements are disabled while the tuner is retuned to a traffic |
|
2107 announcement, the tuner will not revert to the original frequency. To revert to |
|
2108 the original frequency, StopAnnouncement() must be called before the traffic |
|
2109 announcement feature is disabled. |
|
2110 |
|
2111 @param aTaOn ETrue to turn TA on, EFalse to turn it off |
|
2112 @return A standard system error code |
|
2113 */ |
|
2114 IMPORT_C TInt SetTrafficAnnouncement(TBool aTaOn); |
|
2115 |
|
2116 /** |
|
2117 Finds out if the traffic announcement function is currently enabled or not. |
|
2118 |
|
2119 @param aTaOn This is set to ETrue on return if and only if the traffic |
|
2120 announcement function is currenly enabled. |
|
2121 */ |
|
2122 IMPORT_C TInt GetTrafficAnnouncement(TBool& aTaOn) const; |
|
2123 |
|
2124 /** |
|
2125 Set the absolute volume to apply during a traffic or news announcement. |
|
2126 |
|
2127 @param aVolume The volume to use. Must be between 0 and MaxVolume. |
|
2128 @return A standard system error code. |
|
2129 */ |
|
2130 IMPORT_C TInt SetAnnouncementVolume(TInt aVolume); |
|
2131 |
|
2132 /** |
|
2133 Find the current absolute volume level used for news of traffic annoucements. |
|
2134 |
|
2135 @param aVolume This will be set to the current volume used for annoucements. |
|
2136 @return A standard system error code, KErrNotFound if a annoucement volume offset has been set. |
|
2137 use. |
|
2138 */ |
|
2139 IMPORT_C TInt GetAnnouncementVolume(TInt& aVolume) const; |
|
2140 |
|
2141 /** |
|
2142 Set the offset to the system volume level to apply during a traffic or news announcement |
|
2143 |
|
2144 @param aVolumeOffset The offset to the volume level to set for announcements. Must be between -MaxVolume and MaxVolume inclusive. |
|
2145 the actual volume with the offset applied will be clipped between 0 and MaxVolume if the offset would |
|
2146 otherwise result in a volume outside this range. |
|
2147 @return A standard system error code |
|
2148 */ |
|
2149 IMPORT_C TInt SetAnnouncementVolumeOffset(TInt aVolumeOffset); |
|
2150 |
|
2151 /** |
|
2152 Find the current offset of the system volume that applies during traffic and news announcements. |
|
2153 |
|
2154 @param aVolumeOffset This will be set to the current traffic and news announcement offset on return. |
|
2155 @return A standard system error code, KErrNotFound if an absolute annoucement volume has been set. |
|
2156 */ |
|
2157 IMPORT_C TInt GetAnnouncementVolumeOffset(TInt& aVolumeOffset) const; |
|
2158 |
|
2159 /** |
|
2160 Turn the news announcement function on or off depending on the value of the |
|
2161 parameter. The news announcement function when enabled causes the radio to |
|
2162 retune to a station when that station is broadcasting a news report. When the |
|
2163 news announcement is finished the radio will tune back to the original station. |
|
2164 A value of ETrue turns on News Announcements, EFalse turns them off. |
|
2165 |
|
2166 If News announcements are disabled while the tuner is retuned to a news |
|
2167 announcement, the tuner will not revert to the original frequency. To revert to |
|
2168 the original frequency, StopAnnouncement() must be called before the news |
|
2169 announcement feature is disabled. |
|
2170 |
|
2171 @param aNaOn ETrue to turn NA on, EFalse to turn it off |
|
2172 @return A standard system error code |
|
2173 */ |
|
2174 IMPORT_C TInt SetNewsAnnouncement(TBool aNaOn); |
|
2175 |
|
2176 /** |
|
2177 Finds out whether the news announcement function is on or off. |
|
2178 |
|
2179 @param aNaOn This will be set to ETrue if and only if the new announcement |
|
2180 function is currently on. |
|
2181 @return A standard system error code. |
|
2182 */ |
|
2183 IMPORT_C TInt GetNewsAnnouncement(TBool& aNaOn) const; |
|
2184 |
|
2185 /** |
|
2186 Cancels any current announcement, reverting to the original frequency. The announcement |
|
2187 feature will remain enabled. If no announcement is currently happening, this function |
|
2188 has no affect. This can be used for both News and Traffic announcements. |
|
2189 |
|
2190 @return A standard system error code. KErrNone if an announcement was successfully |
|
2191 stopped, or KErrNotReady if no announcement is currently happening. |
|
2192 */ |
|
2193 IMPORT_C TInt StopAnnouncement(); |
|
2194 |
|
2195 /** |
|
2196 Turns alternative frequency function on or off depending on the value of the parameter. |
|
2197 A value of ETrue should be passed if you wish to enable automatic retuning to the current |
|
2198 station on an alternative frequency. |
|
2199 |
|
2200 @param aAfOn ETrue to turn alternative frequency on, EFalse to turn it off |
|
2201 @return A standard system error code |
|
2202 */ |
|
2203 IMPORT_C TInt SetAlternativeFrequency(TBool aAfOn); |
|
2204 |
|
2205 /** |
|
2206 Finds out whether the alternative frequency function is on or off. |
|
2207 |
|
2208 @param aAfOn This will be set to ETrue if and only if the alternative frequency |
|
2209 function is currently on. |
|
2210 @return A standard system error code. |
|
2211 */ |
|
2212 IMPORT_C TInt GetAlternativeFrequency(TBool& aAfOn) const; |
|
2213 |
|
2214 /** |
|
2215 Requests a notification when RDS functionality is enabled or disabled, or when |
|
2216 the traffic announcement volume offset is changed. |
|
2217 |
|
2218 @param aObserver The class which is to be notified of the changes. |
|
2219 @return A standard system error code. |
|
2220 */ |
|
2221 IMPORT_C TInt NotifyRdsStateChange(MMMRdsStateChangeObserver& aObserver); |
|
2222 |
|
2223 /** |
|
2224 Cancels an outstanding RDS state change notification request. |
|
2225 */ |
|
2226 IMPORT_C void CancelNotifyRdsStateChange(); |
|
2227 |
|
2228 /** |
|
2229 Get the current RDS time. This is an asynchronous function due to the latency of |
|
2230 the RDS information becoming available. This information is broadcast at the start of |
|
2231 every minute, and is not cached for obvious reasons. Thus, whenever a request is made, |
|
2232 it will complete next time the Data and Time are broadcast. The RDS standard states |
|
2233 that this is broadcast within 0.1s of the start of a minute, and is accurate to one |
|
2234 minute. The latency of the notification reaching the application cannot be guarteed. |
|
2235 |
|
2236 @param aTimeAndDate The variable to set to the current RDS time and date |
|
2237 @param aStatus A TRequestStatus. This will be signalled when the request completes |
|
2238 and will contain the result of the request, this will be one of the system error codes. |
|
2239 */ |
|
2240 IMPORT_C void GetRdsTime(TPckg<TDateTime>& aTimeAndDate, TRequestStatus& aStatus) const; |
|
2241 |
|
2242 /** |
|
2243 Cancel the GetRdsTime request |
|
2244 */ |
|
2245 IMPORT_C void CancelGetRdsTime(); |
|
2246 |
|
2247 /** |
|
2248 Request notification when a retune caused by an announcement occurs. This will be |
|
2249 a traffic or news announcement. A notification will be provided both at |
|
2250 the start of the announcement and at the end. |
|
2251 |
|
2252 @param aObserver The object wishing to receive announcement events |
|
2253 @return A standard system error code |
|
2254 */ |
|
2255 IMPORT_C TInt NotifyAnnouncement(MMMRdsAnnouncementObserver& aObserver); |
|
2256 |
|
2257 /** |
|
2258 Cancel the NotifyAnnouncement request |
|
2259 */ |
|
2260 IMPORT_C void CancelNotifyAnnouncement(); |
|
2261 |
|
2262 /** |
|
2263 Returns a list containing information about other networks broadcast with the currently tuned |
|
2264 programmme. This call will return immediately with whatever EON information is currently available. |
|
2265 Note that is is possible for this function to return no EON stations when several are being broadcast |
|
2266 simply because not enough RDS frames have been received yet. An interested application should make a |
|
2267 call to NotifyEonInfo to receive notifications when EON information is received or changes. |
|
2268 |
|
2269 @param aEonInfo An array to which the EON information will be appended. |
|
2270 */ |
|
2271 IMPORT_C void GetEonInfoL(RArray<TEonStation>& aEonInfo) const; |
|
2272 |
|
2273 /** |
|
2274 Gets the frequencies assoicated with an EON station. This will complete immediately with whatever |
|
2275 frequencies are currently cached. An interested application should make a call to NotifyEonChange |
|
2276 to receive notifications when more frequencies are received. |
|
2277 |
|
2278 @param aEonStation the EON station to get the frequencies for |
|
2279 @param aFrequencies an array to which the frequencies associated with the given station will be |
|
2280 appended. |
|
2281 */ |
|
2282 IMPORT_C void GetEonFrequenciesL(const TEonStation& aEonStation, RArray<TFrequency>& aFrequencies) const; |
|
2283 |
|
2284 /** |
|
2285 Gets the mapped frequencies associated with an EON station. This will complete immediately with whatever |
|
2286 mapped frequencies are currently cached. An interested application should make a call to NotifyEonChange |
|
2287 to receive notifications when more frequencies are received. |
|
2288 |
|
2289 @param aEonStation the EON station to get the mapped frequencies for |
|
2290 @param aMappedFrequencies an array to which the mapped frequencies associated with the given station |
|
2291 will be appended. |
|
2292 */ |
|
2293 IMPORT_C void GetEonMappedFrequenciesL(const TEonStation& aEonStation, RArray<TEonMappedFrequency>& aMappedFrequencies) const; |
|
2294 |
|
2295 /** |
|
2296 Request notification when the Enhanced Other Networks (EON) information changes. |
|
2297 |
|
2298 @param aObserver The client to be notifier when EON information changes or an error occurs. |
|
2299 */ |
|
2300 IMPORT_C TInt NotifyEonInfo(MMMRdsEonObserver& aObserver); |
|
2301 |
|
2302 /** |
|
2303 Cancels a NotifyEonInfo request. |
|
2304 */ |
|
2305 IMPORT_C void CancelNotifyEonInfo(); |
|
2306 |
|
2307 /** |
|
2308 Tunes to a station represented by a TEonStation. This will result to a callback to MtoTuneComplete. |
|
2309 |
|
2310 @param aEonStation The EON station that is to be tuned to. |
|
2311 */ |
|
2312 IMPORT_C void TuneToEonStation(const TEonStation& aEonStation); |
|
2313 |
|
2314 /** |
|
2315 Send a synchronous custom command to the RDS tuner. |
|
2316 |
|
2317 @param aFunction The function number to indicate which function is to be called |
|
2318 on the interface defined by the first IPC argument |
|
2319 @param aArgs The IPC arguments to send to the RDS tuner. The first of these |
|
2320 arguments must be the UID of the interface within the tuner to which the |
|
2321 command is destined, represented as an integer. Failure to set the first |
|
2322 argument properly will result in the command completing with |
|
2323 KErrNotSupported at best, but possibly the client being panicked. |
|
2324 @return A standard system error code |
|
2325 */ |
|
2326 IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs); |
|
2327 |
|
2328 /** |
|
2329 Send an asynchronous custom command to the RDS tuner. |
|
2330 |
|
2331 @param aFunction The function number to indicate which function is to be called |
|
2332 on the interface defined by the first IPC argument |
|
2333 @param aArgs The IPC arguments to send to the RDS tuner. The first of these |
|
2334 arguments must be the UID of the interface within the tuner to which the |
|
2335 command is destined, represented as an integer. Failure to set the first |
|
2336 argument properly will result in the command completing with |
|
2337 KErrNotSupported at best, but possibly the client being panicked. |
|
2338 @param aStatus The TRequestStatus of an active object. This will contain the |
|
2339 result of the request on completion. The exact range of result values is |
|
2340 dependent on the interface. |
|
2341 */ |
|
2342 IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus); |
|
2343 |
|
2344 private: |
|
2345 CMMRdsTunerUtility(); |
|
2346 private: |
|
2347 class CBody; |
|
2348 CBody* iBody; |
|
2349 |
|
2350 }; |
|
2351 |
|
2352 /** |
|
2353 This mixin class should be implemented by applications wishing to receive notifications |
|
2354 when RDS data is received, changes or becomes invalid. Each method corresponds to a |
|
2355 particular request in CMMRdsTunerUtility. Only methods corresponding to requests in |
|
2356 CMMRdsTunerUtility that are used by a client need be implemented - empty default |
|
2357 implementations are provided. |
|
2358 */ |
|
2359 class MMMRdsDataObserver |
|
2360 { |
|
2361 public: |
|
2362 /** |
|
2363 Called when some error occurs which makes RDS data unavailable. |
|
2364 */ |
|
2365 virtual void MrdoError(TInt aError) = 0; |
|
2366 |
|
2367 /** |
|
2368 Called when some RDS data is received or has changed. |
|
2369 |
|
2370 Two subsets of the RDS data supplied are indicted: that which has changed and that which is |
|
2371 valid. This information can be interpreted as follows: |
|
2372 For an item of RDS data x: |
|
2373 valid(x) & !changed(x) => x was received before and has not changed |
|
2374 valid(x) & changed(x) => x has either just been received for the first time, or has just changed |
|
2375 !valid(x) & changed(x) => x is no longer available |
|
2376 !valid(x) & !changed(x) => x was not available before, and is still not available. |
|
2377 |
|
2378 When the tuner is retuned to a new station, all RDS data will be flushed. This will result in |
|
2379 a call to this function indicating that all RDS data has changed and is longer valid. |
|
2380 |
|
2381 @param aData The RDS data. |
|
2382 @param aValid Indicates a subset of aData that is valid (i.e. has been received) |
|
2383 @param aChanged Indicates a subset of aData that has changed since the last call to this function. |
|
2384 */ |
|
2385 virtual void MrdoDataReceived(const TRdsData& aData, TUint32 aValid, TUint32 aChanged) = 0; |
|
2386 |
|
2387 /** |
|
2388 Called when the RDS Radio Text (RT) is received, changes, or is no longer available. |
|
2389 |
|
2390 @param aRt The Radio Text message. This will be empty if aValid==EFalse. |
|
2391 @param aValid Indicates if the radio text is valid. |
|
2392 @param aChanges Indicates if the radio test has changed. |
|
2393 */ |
|
2394 virtual void MrdoRadioTextReceived(const TDesC& aRt, TBool aValid, TBool aChanged) = 0; |
|
2395 }; |
|
2396 |
|
2397 /** |
|
2398 The state change observer mixin class defines the interface via which changes to |
|
2399 the state of the RDS radio can be observed. These state changes will be a result |
|
2400 of a client enabling or disabling RDS functionality. |
|
2401 */ |
|
2402 class MMMRdsStateChangeObserver |
|
2403 { |
|
2404 public: |
|
2405 /** |
|
2406 Called when the regional link functionality is enabled/disabled. |
|
2407 |
|
2408 @param aNewRegLinkOn The new setting: ETrue if the regional link function has |
|
2409 just been enabled. |
|
2410 */ |
|
2411 virtual void MrscoRegionalLinkChanged(TBool aNewRegLinkOn) = 0; |
|
2412 |
|
2413 /** |
|
2414 Called when the traffic announcement functionality has just been enabled or |
|
2415 disabled. |
|
2416 |
|
2417 @param aNewTaOn ETrue if the TA function is now on, EFalse otherwise. |
|
2418 */ |
|
2419 virtual void MrscoTrafficAnnouncementChanged(TBool aNewTaOn) = 0; |
|
2420 |
|
2421 /** |
|
2422 Called when the traffic and news announcement volume offset is changed. A callback to |
|
2423 this method indicates the a volume offset is being used instead of an absolute volume. |
|
2424 |
|
2425 @param aOldOffset The announcement volume offset before the change |
|
2426 @param aNewOffset The announcement volume offset after the change |
|
2427 */ |
|
2428 virtual void MrscoAnnouncementVolumeOffsetChanged(TInt aOldOffset, TInt aNewOffset) = 0; |
|
2429 |
|
2430 /** |
|
2431 Called when the traffic an news announcement volume is changed. A callback to |
|
2432 this method indicates that an absolute volume is being used instead of volume offsets. |
|
2433 |
|
2434 @param aOldVolume The announcement volume before the change. |
|
2435 @param aNewVolume The announcement volume after the change. |
|
2436 */ |
|
2437 virtual void MrscoAnnouncementVolumeChanged(TInt aOldVolume, TInt aNewVolume) = 0; |
|
2438 |
|
2439 /** |
|
2440 Called when the news announcement functionality has just been enabled or |
|
2441 disabled. |
|
2442 |
|
2443 @param aNewNAOn ETrue if the NA function is now enabled, else EFalse. |
|
2444 */ |
|
2445 virtual void MrscoNewsAnnouncementChanged(TBool aNewNAOn) = 0; |
|
2446 |
|
2447 /** |
|
2448 Called when the alternative frequencies function is turned on or off. |
|
2449 |
|
2450 @param aNewAFOn ETrue if the AF function has just been turned on, else EFalse. |
|
2451 */ |
|
2452 virtual void MrscoAlternativeFrequenciesChanged(TBool aNewAFOn) = 0; |
|
2453 }; |
|
2454 |
|
2455 |
|
2456 /** |
|
2457 The Announcement Observer mixin class defines the interface via which |
|
2458 announcement events can be received. A client interested in such |
|
2459 information calls the function NotifyAnnouncement. |
|
2460 */ |
|
2461 class MMMRdsAnnouncementObserver |
|
2462 { |
|
2463 public: |
|
2464 /** |
|
2465 Called when an announcement starts |
|
2466 |
|
2467 @param aType The type of announcement (travel or news) |
|
2468 */ |
|
2469 virtual void MraoAnnouncementStart(CMMRdsTunerUtility::TAnnouncementType aType) = 0; |
|
2470 |
|
2471 /** |
|
2472 Called when an announcement ends |
|
2473 |
|
2474 @param aType The type of announcement (travel or news) |
|
2475 */ |
|
2476 virtual void MraoAnnouncementEnd(CMMRdsTunerUtility::TAnnouncementType aType) = 0; |
|
2477 |
|
2478 /** |
|
2479 Called when an error occurs which results in announcement notifications |
|
2480 becoming unavailable. |
|
2481 */ |
|
2482 virtual void MraoError(TInt aError) = 0; |
|
2483 }; |
|
2484 |
|
2485 /** |
|
2486 The enhanced other networks observer mixin class defines the interface via |
|
2487 which changes to the enhanced other networks information can be notified. A |
|
2488 client interested in such information calls the function NotifyEonChange. |
|
2489 */ |
|
2490 class MMMRdsEonObserver |
|
2491 { |
|
2492 public: |
|
2493 /** |
|
2494 Called when some details of an EON station change. The station can be referenced |
|
2495 to an existing one using it's Programme Identifier, which cannot change. |
|
2496 |
|
2497 @param aStation A TEonStation containing the new information about the station. |
|
2498 @param aChanged The subset of the members of aStation that have changed. Bits are |
|
2499 set according to TEonStation::TField. |
|
2500 */ |
|
2501 virtual void MreoEonStationChanged(const TEonStation& aStation, TUint32 aChanged) = 0; |
|
2502 |
|
2503 /** |
|
2504 Called when details of a new EON station are received. |
|
2505 |
|
2506 @param aStation A TEonStation containing the new information about the station. |
|
2507 */ |
|
2508 virtual void MreoNewEonStation(const TEonStation& aStation) = 0; |
|
2509 |
|
2510 /** |
|
2511 Called when details of <b>all</b> EON stations cease to be broadcast. This will |
|
2512 typically happen when the tuner is retuned. More EON stations may continue to be |
|
2513 recieved: this call does not indicate that EON information is no longer available. |
|
2514 */ |
|
2515 virtual void MreoAllEonStationsRemoved() = 0; |
|
2516 |
|
2517 /** |
|
2518 Called when details of an EON station cease to be broadcast. |
|
2519 |
|
2520 @param aPi The programme identifier of the EON station which has been removed. |
|
2521 */ |
|
2522 virtual void MreoEonStationRemoved(const TRdsProgrammeIdentifier& aPi) = 0; |
|
2523 |
|
2524 /** |
|
2525 Called when an error occurs resulting in EON notifications not being available. |
|
2526 */ |
|
2527 virtual void MreoError(TInt aError) = 0; |
|
2528 }; |
|
2529 |
|
2530 #include <tuner.inl> |
|
2531 |
|
2532 #endif // TUNER_H |
|
2533 |
|
2534 // End of file |
|
2535 |