21
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CMMFRADIOBACKENDENGINE_H
|
|
19 |
#define CMMFRADIOBACKENDENGINE_H
|
|
20 |
|
|
21 |
#ifdef __cplusplus
|
|
22 |
|
|
23 |
#include <e32base.h>
|
25
|
24 |
#include <RadioUtility.h>
|
|
25 |
#include <RadioFmTunerUtility.h>
|
|
26 |
#include <RadioPlayerUtility.h>
|
|
27 |
#include <RadioPresetUtility.h>
|
|
28 |
#include <RadioFmPresetUtility.h>
|
21
|
29 |
#include <FMRadioTunerControl.h>
|
|
30 |
#include "xaadaptationmmf.h"
|
|
31 |
|
|
32 |
NONSHARABLE_CLASS(CMMFRadioBackendEngine) : public CBase,
|
|
33 |
public MRadioPlayerObserver,
|
|
34 |
public MRadioFmTunerObserver,
|
48
|
35 |
public MRadioPresetObserver
|
21
|
36 |
{
|
|
37 |
public:
|
|
38 |
|
|
39 |
static CMMFRadioBackendEngine* Instance();
|
|
40 |
void DeleteInstance();
|
|
41 |
~CMMFRadioBackendEngine();
|
|
42 |
|
48
|
43 |
void SetFrequency(TInt aFreq);
|
|
44 |
TInt GetFrequency(TInt& aFreq);
|
|
45 |
TInt GetSignalStrength(TInt& aFreq);
|
|
46 |
void StationSeek(TBool aUpwards);
|
|
47 |
void CancelSetFrequency();
|
|
48 |
void CancelStationSeek();
|
|
49 |
void SetFreqRange(TFmRadioFrequencyRange aRange);
|
|
50 |
TInt GetFreqRange(TFmRadioFrequencyRange& aRange);
|
|
51 |
TInt GetFreqRangeProperties(TFmRadioFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq);
|
|
52 |
TInt GetMaxVolume(TInt& aMaxVol);
|
|
53 |
TInt SetVolume(TInt aVol);
|
|
54 |
TInt GetVolume(TInt& aVol);
|
|
55 |
TInt SetMute(TBool aMute);
|
|
56 |
TInt GetForcedMonoReception(TUint& aForcedMono);
|
|
57 |
TInt ForceMonoReception(TUint aForcedMono);
|
|
58 |
void PlayRadio();
|
|
59 |
void StopRadio();
|
|
60 |
TInt GetSquelch(TBool& aSquelch);
|
|
61 |
TInt SetSquelch(TBool aSquelch);
|
|
62 |
void SetAdaptContext(void* adaptcontext);
|
|
63 |
|
21
|
64 |
/**
|
|
65 |
* From MRadioPlayerObserver.
|
|
66 |
* Called when Radio state changed.
|
|
67 |
*
|
|
68 |
* @since S60 3.2
|
|
69 |
* @param aState Radio player state
|
|
70 |
* @param aError A standard system error code, only used when aState is ERadioPlayerIdle
|
|
71 |
*/
|
|
72 |
void MrpoStateChange( TPlayerState aState, TInt aError );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* From MRadioPlayerObserver.
|
|
76 |
* Called when volume changes. This may be caused by other applications.
|
|
77 |
*
|
|
78 |
* @since S60 3.2
|
|
79 |
* @param aVolume Current volume.
|
|
80 |
*/
|
|
81 |
void MrpoVolumeChange( TInt aVolume );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* From MRadioPlayerObserver.
|
|
85 |
* Called when mute setting changes. This may be caused by other applications.
|
|
86 |
*
|
|
87 |
* @since S60 3.2
|
|
88 |
* @param aMute ETrue indicates audio is muted.
|
|
89 |
*/
|
|
90 |
void MrpoMuteChange( TBool aMute );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* From MRadioPlayerObserver.
|
|
94 |
* Called when mute setting changes. This may be caused by other applications.
|
|
95 |
*
|
|
96 |
* Called when balance setting changes. This may be caused by other applications.
|
|
97 |
*
|
|
98 |
* @since S60 3.2
|
|
99 |
* @param aLeftPercentage
|
|
100 |
* Left speaker volume percentage. This can be any value from zero to 100.
|
|
101 |
* Zero value means left speaker is muted.
|
|
102 |
* @param aRightPercentage
|
|
103 |
* Right speaker volume percentage. This can be any value from zero to 100.
|
|
104 |
* Zero value means right speaker is muted.
|
|
105 |
*/
|
|
106 |
void MrpoBalanceChange( TInt aLeftPercentage, TInt aRightPercentage );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From MRadioFmTunerObserver.
|
|
110 |
* Called when Request for tuner control completes.
|
|
111 |
*
|
|
112 |
* @since S60 3.2
|
|
113 |
* @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
|
|
114 |
*/
|
|
115 |
void MrftoRequestTunerControlComplete( TInt aError );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* From MRadioFmTunerObserver.
|
|
119 |
* Set frequency range complete event. This event is asynchronous and is received after
|
|
120 |
* a call to CRadioFmTunerUtility::SetFrequencyRange.
|
|
121 |
*
|
|
122 |
* @since S60 3.2
|
|
123 |
* @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
|
|
124 |
*/
|
|
125 |
void MrftoSetFrequencyRangeComplete( TInt aError );
|
|
126 |
|
|
127 |
/**
|
|
128 |
* From MRadioFmTunerObserver.
|
|
129 |
* Set frequency complete event. This event is asynchronous and is received after a call to
|
|
130 |
* CRadioFmTunerUtility::SetFrequency.
|
|
131 |
*
|
|
132 |
* @since S60 3.2
|
|
133 |
* @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
|
|
134 |
*/
|
|
135 |
void MrftoSetFrequencyComplete( TInt aError );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* From MRadioFmTunerObserver.
|
|
139 |
* Station seek complete event. This event is asynchronous and is received after a call to
|
|
140 |
* CRadioFmTunerUtility::StationSeek.
|
|
141 |
*
|
|
142 |
* @since S60 3.2
|
|
143 |
* @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
|
|
144 |
* @param aFrequency The frequency(Hz) of the radio station that was found.
|
|
145 |
*/
|
|
146 |
void MrftoStationSeekComplete( TInt aError, TInt aFrequency );
|
|
147 |
|
|
148 |
/**
|
|
149 |
* From MRadioFmTunerObserver.
|
|
150 |
* Called when FM Transmitter status changes (if one is present in the device). Tuner receiver
|
|
151 |
* is forced to be turned off due to hardware conflicts when FM transmitter is activated.
|
|
152 |
*
|
|
153 |
* @since S60 3.2
|
|
154 |
* @param aActive ETrue if FM transmitter is active; EFalse otherwise.
|
|
155 |
*/
|
|
156 |
void MrftoFmTransmitterStatusChange( TBool aActive );
|
|
157 |
|
|
158 |
/**
|
|
159 |
* From MRadioFmTunerObserver.
|
|
160 |
* Called when antenna status changes.
|
|
161 |
*
|
|
162 |
* @since S60 3.2
|
|
163 |
* @param aAttached ETrue if antenna is attached; EFalse otherwise.
|
|
164 |
*/
|
|
165 |
void MrftoAntennaStatusChange(TBool aAttached );
|
|
166 |
|
|
167 |
/**
|
|
168 |
* From MRadioFmTunerObserver.
|
|
169 |
* Called when offline mode status changes.
|
|
170 |
* @since S60 3.2
|
|
171 |
*
|
|
172 |
* @param aOfflineMode ETrue if offline mode is enabled; EFalse otherwise.
|
|
173 |
*/
|
|
174 |
void MrftoOfflineModeStatusChange(TBool aOfflineMode );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* From MRadioFmTunerObserver.
|
|
178 |
* Called when the frequency range changes. This may be caused by other applications.
|
|
179 |
*
|
|
180 |
* @since S60 3.2
|
|
181 |
* @param aBand New frequency range.
|
|
182 |
*/
|
|
183 |
void MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand );
|
|
184 |
|
|
185 |
/**
|
|
186 |
* From MRadioFmTunerObserver.
|
|
187 |
* Called when the tuned frequency changes. This may be caused by other
|
|
188 |
* applications or RDS if AF/TA is enabled.
|
|
189 |
*
|
|
190 |
* @since S60 3.2
|
|
191 |
* @param aNewFrequency The new tuned frequency(Hz).
|
|
192 |
*/
|
|
193 |
void MrftoFrequencyChange( TInt aNewFrequency );
|
|
194 |
|
|
195 |
/**
|
|
196 |
* From MRadioFmTunerObserver.
|
|
197 |
* Called when the forced mono status change. This may be caused by other applications.
|
|
198 |
*
|
|
199 |
* @since S60 3.2
|
|
200 |
* @param aForcedMono ETrue if forced mono mode is enabled; EFalse otherwise.
|
|
201 |
*/
|
|
202 |
void MrftoForcedMonoChange( TBool aForcedMono );
|
|
203 |
|
|
204 |
/**
|
|
205 |
* From MRadioFmTunerObserver.
|
|
206 |
* Called when the squelch (muting the frequencies without broadcast) status change.
|
|
207 |
* This may be caused by other applications.
|
|
208 |
*
|
|
209 |
* @since S60 3.2
|
|
210 |
* @param aSquelch ETrue if squelch is enabled; EFalse otherwise.
|
|
211 |
*/
|
|
212 |
void MrftoSquelchChange( TBool aSquelch );
|
|
213 |
|
|
214 |
/**
|
|
215 |
* From MRadioPresetObserver.
|
|
216 |
* Called when a preset changes.
|
|
217 |
*
|
|
218 |
* NOTE: EPresetDeleted with aIndex == 0, indicates that all presets have been deleted.
|
|
219 |
*
|
|
220 |
* @since S60 3.2
|
|
221 |
* @param aChange Change event type
|
|
222 |
* @param aIndex Index to the preset that has changed. Zero means all presets.
|
|
223 |
*/
|
48
|
224 |
void MrpeoPresetChanged( TPresetChangeEvent aChange, TInt aIndex );
|
21
|
225 |
|
|
226 |
private:
|
28
|
227 |
static CMMFRadioBackendEngine* s_instance;
|
21
|
228 |
CMMFRadioBackendEngine();
|
|
229 |
void ConstructL();
|
48
|
230 |
XAresult TranslateError(TInt error);
|
|
231 |
XAresult SetForceMonoFlag();
|
21
|
232 |
|
48
|
233 |
private:
|
|
234 |
CRadioUtility* iRadioUtility;
|
|
235 |
CRadioFmTunerUtility* iFmTunerUtility;
|
|
236 |
CRadioPlayerUtility* iRadioPlayerUtility;
|
|
237 |
TBool iForceStereo;
|
|
238 |
void* iAdaptContext;
|
|
239 |
TFmRadioFrequencyRange iDefaultFreqRange;
|
|
240 |
TUint iDefaultFrequency;
|
|
241 |
TInt iDefaultMinFreq;
|
|
242 |
TInt iDefaultMaxFreq;
|
21
|
243 |
|
|
244 |
};
|
48
|
245 |
|
21
|
246 |
#else /* __cplusplus */
|
|
247 |
|
48
|
248 |
extern void* cmmfradiobackendengine_init(void);
|
|
249 |
extern void cmmfradiobackendengine_delete(void* pContext);
|
|
250 |
extern void set_frequency(void* pContext, void* pAdaptcontext, XAuint32 freq);
|
|
251 |
extern void cancel_set_frequency(void* pContext);
|
|
252 |
extern void station_seek(void* pContext, void* pAdaptcontext, XAboolean upwards);
|
|
253 |
extern void cancel_station_seek(void* pContext);
|
|
254 |
extern XAresult get_frequency(void* pContext, XAuint32* pFreq);
|
|
255 |
extern XAresult get_signal_strength(void* pContext, XAuint32* pSignalStrength);
|
|
256 |
extern void set_freq_range(void* pContext, void* pAdaptcontext, XAuint8 range);
|
|
257 |
extern XAresult get_freq_range(void* pContext, XAuint8* pRange);
|
|
258 |
extern XAresult get_freq_range_properties(void* pContext, XAuint8 range, XAuint32* pMinFreq, XAuint32* pMaxFreq);
|
|
259 |
extern XAresult set_stereo_mode(void* pContext, void* pAdaptcontext, XAuint32 mode);
|
|
260 |
extern XAresult get_stereo_mode(void* pContext, XAuint32* pMode);
|
|
261 |
extern void stop_radio(void* pContext, void* pAdaptcontext);
|
|
262 |
extern void play_radio(void* pContext, void* pAdaptcontext);
|
|
263 |
extern XAresult set_volume(void* pContext, void* pAdaptcontext, XAuint32 vol);
|
|
264 |
extern XAresult get_volume(void* pContext, XAuint32* pVol);
|
|
265 |
extern XAresult set_mute(void* pContext, void* pAdaptcontext, XAboolean mute);
|
|
266 |
extern XAresult get_squelch(void* pContext, XAboolean* pSquelch);
|
|
267 |
extern XAresult set_squelch(void* pContext, void* pAdaptcontext, XAboolean squelch);
|
21
|
268 |
#endif /* __cplusplus */
|
|
269 |
|
|
270 |
#endif /* CMMFRADIOBACKENDENGINE_H */
|