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 |
#include "cmmfradiobackendengine.h"
|
|
19 |
|
|
20 |
extern "C" {
|
|
21 |
#include "xaradioitfadaptation.h"
|
|
22 |
#include "xanokiavolumeextitfadaptationmmf.h"
|
|
23 |
#include "xanokialinearvolumeitfadaptationmmf.h"
|
|
24 |
#include "xaplayitfadaptationmmf.h"
|
|
25 |
}
|
|
26 |
|
|
27 |
CMMFRadioBackendEngine *CMMFRadioBackendEngine::s_instance = 0;
|
|
28 |
|
|
29 |
CMMFRadioBackendEngine* CMMFRadioBackendEngine::Instance()
|
|
30 |
{
|
|
31 |
if (!s_instance)
|
|
32 |
{
|
|
33 |
s_instance = new CMMFRadioBackendEngine();
|
|
34 |
s_instance->ConstructL();
|
|
35 |
}
|
|
36 |
return s_instance;
|
|
37 |
}
|
|
38 |
|
|
39 |
void CMMFRadioBackendEngine::DeleteInstance()
|
|
40 |
{
|
|
41 |
if (iFmTunerUtility)
|
|
42 |
{
|
|
43 |
iFmTunerUtility->Close();
|
|
44 |
iFmTunerUtility = NULL;
|
|
45 |
}
|
|
46 |
if (iPlayerUtility)
|
|
47 |
{
|
|
48 |
iPlayerUtility->Close();
|
|
49 |
iPlayerUtility = NULL;
|
|
50 |
}
|
|
51 |
|
|
52 |
if (iRadioUtility)
|
|
53 |
{
|
|
54 |
delete iRadioUtility;
|
|
55 |
iRadioUtility = NULL;
|
|
56 |
}
|
|
57 |
|
|
58 |
}
|
|
59 |
|
|
60 |
CMMFRadioBackendEngine::~CMMFRadioBackendEngine()
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
CMMFRadioBackendEngine::CMMFRadioBackendEngine()
|
|
65 |
{
|
|
66 |
|
|
67 |
}
|
|
68 |
|
|
69 |
void CMMFRadioBackendEngine::ConstructL()
|
|
70 |
{
|
|
71 |
iAutoFlag = ETrue;
|
|
72 |
|
|
73 |
iRadioUtility = CRadioUtility::NewL( ETrue );
|
|
74 |
iFmTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
|
|
75 |
iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
|
|
76 |
iFmTunerUtility->RequestTunerControl();
|
|
77 |
|
|
78 |
iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
|
|
79 |
|
|
80 |
}
|
|
81 |
void CMMFRadioBackendEngine::StationSeek(XAboolean aUpwards)
|
|
82 |
{
|
|
83 |
if (iFmTunerUtility)
|
|
84 |
{
|
|
85 |
iFmTunerUtility->StationSeek(aUpwards);
|
|
86 |
}
|
|
87 |
}
|
|
88 |
|
|
89 |
void CMMFRadioBackendEngine::SetFrequency(TInt aFreq)
|
|
90 |
{
|
|
91 |
DEBUG_API_A1("CMMFRadioBackendEngine::SetFrequency: %d", aFreq);
|
|
92 |
if (iFmTunerUtility)
|
|
93 |
{
|
|
94 |
iFmTunerUtility->SetFrequency(aFreq);
|
|
95 |
}
|
|
96 |
}
|
|
97 |
|
|
98 |
TInt CMMFRadioBackendEngine::GetFrequency(TInt& aFreq)
|
|
99 |
{
|
|
100 |
DEBUG_API("CMMFRadioBackendEngine::GetFrequency");
|
|
101 |
TInt ret = KErrNotFound;
|
|
102 |
if (iFmTunerUtility)
|
|
103 |
{
|
|
104 |
ret = iFmTunerUtility->GetFrequency(aFreq);
|
|
105 |
}
|
|
106 |
DEBUG_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret);
|
|
107 |
// RDebug::Print(_L("CMMFRadioBackendEngine::GetFrequency RET: %d"), ret);
|
|
108 |
return ret;
|
|
109 |
}
|
|
110 |
|
|
111 |
TInt CMMFRadioBackendEngine::GetSignalStrength(TInt& aSignalStrength)
|
|
112 |
{
|
|
113 |
TInt ret = KErrNotFound;
|
|
114 |
if (iFmTunerUtility)
|
|
115 |
{
|
|
116 |
ret = iFmTunerUtility->GetSignalStrength(aSignalStrength);
|
|
117 |
}
|
|
118 |
DEBUG_API_A1("CMMFRadioBackendEngine::GetSignalStrength RET: %d", ret);
|
|
119 |
// RDebug::Print(_L("CMMFRadioBackendEngine::GetSignalStrength RET: %d"), ret);
|
|
120 |
return ret;
|
|
121 |
}
|
|
122 |
|
|
123 |
void CMMFRadioBackendEngine::CancelSetFrequency()
|
|
124 |
{
|
|
125 |
if (iFmTunerUtility)
|
|
126 |
{
|
|
127 |
iFmTunerUtility->CancelSetFrequency();
|
|
128 |
}
|
|
129 |
}
|
|
130 |
|
|
131 |
void CMMFRadioBackendEngine::CancelStationSeek()
|
|
132 |
{
|
|
133 |
if (iFmTunerUtility)
|
|
134 |
{
|
|
135 |
iFmTunerUtility->CancelStationSeek();
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
void CMMFRadioBackendEngine::SetFreqRange(TFmRadioFrequencyRange aRange)
|
|
140 |
{
|
|
141 |
if (iFmTunerUtility)
|
|
142 |
{
|
|
143 |
iFmTunerUtility->SetFrequencyRange(aRange);
|
|
144 |
}
|
|
145 |
}
|
|
146 |
|
|
147 |
TInt CMMFRadioBackendEngine::GetFreqRange(TFmRadioFrequencyRange& aRange)
|
|
148 |
{
|
|
149 |
TInt ret = KErrNotFound;
|
|
150 |
TInt minFreq = 0;
|
|
151 |
TInt maxFreq = 0;
|
|
152 |
|
|
153 |
if (iFmTunerUtility)
|
|
154 |
{
|
|
155 |
ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)minFreq, (TInt&)maxFreq);
|
|
156 |
}
|
|
157 |
DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret);
|
|
158 |
// RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRange RET: %d"), ret);
|
|
159 |
return ret;
|
|
160 |
}
|
|
161 |
|
|
162 |
TInt CMMFRadioBackendEngine::GetFreqRangeProperties(TFmRadioFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq)
|
|
163 |
{
|
|
164 |
TInt ret = KErrNotFound;
|
|
165 |
|
|
166 |
if (iFmTunerUtility)
|
|
167 |
{
|
|
168 |
ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq);
|
|
169 |
}
|
|
170 |
DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret);
|
|
171 |
// RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d"), ret);
|
|
172 |
return ret;
|
|
173 |
}
|
|
174 |
TInt CMMFRadioBackendEngine::GetMaxVolume(TInt& aMaxVol)
|
|
175 |
{
|
|
176 |
TInt ret = KErrNotFound;
|
|
177 |
|
|
178 |
if (iPlayerUtility)
|
|
179 |
{
|
|
180 |
ret = iPlayerUtility->GetMaxVolume(aMaxVol);
|
|
181 |
}
|
|
182 |
return ret;
|
|
183 |
}
|
|
184 |
|
|
185 |
TInt CMMFRadioBackendEngine::SetVolume(TInt aVol)
|
|
186 |
{
|
|
187 |
TInt ret = KErrNotFound;
|
|
188 |
|
|
189 |
if (iPlayerUtility)
|
|
190 |
{
|
|
191 |
ret = iPlayerUtility->SetVolume(aVol);
|
|
192 |
}
|
|
193 |
return ret;
|
|
194 |
}
|
|
195 |
|
|
196 |
TInt CMMFRadioBackendEngine::SetMute(XAboolean aMute)
|
|
197 |
{
|
|
198 |
TInt ret = KErrNotFound;
|
|
199 |
|
|
200 |
if (iPlayerUtility)
|
|
201 |
{
|
|
202 |
ret = iPlayerUtility->Mute(aMute);
|
|
203 |
}
|
|
204 |
return ret;
|
|
205 |
}
|
|
206 |
|
|
207 |
TInt CMMFRadioBackendEngine::GetVolume(TInt& aVol)
|
|
208 |
{
|
|
209 |
TInt ret = KErrNotFound;
|
|
210 |
|
|
211 |
if (iPlayerUtility)
|
|
212 |
{
|
|
213 |
ret = iPlayerUtility->GetVolume(aVol);
|
|
214 |
}
|
|
215 |
return ret;
|
|
216 |
}
|
|
217 |
|
|
218 |
TInt CMMFRadioBackendEngine::GetForcedMonoReception(XAuint32& aForcedMono)
|
|
219 |
{
|
|
220 |
TInt ret = KErrNotFound;
|
|
221 |
TBool forceMono = EFalse;
|
|
222 |
|
|
223 |
if (iFmTunerUtility)
|
|
224 |
{
|
|
225 |
ret = iFmTunerUtility->GetForcedMonoReception(forceMono);
|
|
226 |
if (ret != KErrNone)
|
|
227 |
return ret;
|
|
228 |
}
|
|
229 |
|
|
230 |
// RDebug::Print(_L("CMMFRadioBackendEngine::GetForcedMonoReception RET: %d, aForcedMono = %d"), ret, aForcedMono);
|
|
231 |
if (forceMono)
|
|
232 |
{
|
|
233 |
aForcedMono = XA_STEREOMODE_MONO;
|
|
234 |
}
|
|
235 |
else
|
|
236 |
{
|
|
237 |
if (iAutoFlag)
|
|
238 |
aForcedMono = XA_STEREOMODE_AUTO;
|
|
239 |
else
|
|
240 |
aForcedMono = XA_STEREOMODE_STEREO;
|
|
241 |
}
|
|
242 |
return ret;
|
|
243 |
}
|
|
244 |
|
|
245 |
void CMMFRadioBackendEngine::PlayRadio()
|
|
246 |
{
|
|
247 |
if (iPlayerUtility)
|
|
248 |
{
|
|
249 |
iPlayerUtility->Play();
|
|
250 |
}
|
|
251 |
}
|
|
252 |
|
|
253 |
void CMMFRadioBackendEngine::StopRadio()
|
|
254 |
{
|
|
255 |
if (iPlayerUtility)
|
|
256 |
{
|
|
257 |
iPlayerUtility->Stop();
|
|
258 |
}
|
|
259 |
}
|
|
260 |
|
|
261 |
TInt CMMFRadioBackendEngine::ForceMonoReception(XAuint32 aForcedMono)
|
|
262 |
{
|
|
263 |
TInt ret = KErrNotFound;
|
|
264 |
|
|
265 |
if (iFmTunerUtility)
|
|
266 |
{
|
|
267 |
if (aForcedMono == XA_STEREOMODE_MONO)
|
|
268 |
{
|
|
269 |
iAutoFlag = EFalse;
|
|
270 |
ret = iFmTunerUtility->ForceMonoReception(ETrue);
|
|
271 |
}
|
|
272 |
else if (aForcedMono == XA_STEREOMODE_STEREO)
|
|
273 |
{
|
|
274 |
iAutoFlag = EFalse;
|
|
275 |
ret = iFmTunerUtility->ForceMonoReception(EFalse);
|
|
276 |
}
|
|
277 |
else // (aForcedMono == XA_STEREOMODE_AUTO)
|
|
278 |
{
|
|
279 |
iAutoFlag = ETrue;
|
|
280 |
ret = iFmTunerUtility->ForceMonoReception(EFalse);
|
|
281 |
}
|
|
282 |
}
|
|
283 |
DEBUG_API_A1("CMMFRadioBackendEngine::ForceMonoReception RET: %d", ret);
|
|
284 |
// RDebug::Print(_L("CMMFRadioBackendEngine::ForceMonoReception RET: %d"), ret);
|
|
285 |
return ret;
|
|
286 |
}
|
|
287 |
|
|
288 |
XAresult CMMFRadioBackendEngine::SetRadioAdaptContext(void * adaptcontext)
|
|
289 |
{
|
|
290 |
iRadioAdaptContext = adaptcontext;
|
|
291 |
return XA_RESULT_SUCCESS;
|
|
292 |
}
|
|
293 |
|
|
294 |
XAresult CMMFRadioBackendEngine::SetPlayerAdaptContext(void * adaptcontext)
|
|
295 |
{
|
|
296 |
iPlayerAdaptContext = adaptcontext;
|
|
297 |
return XA_RESULT_SUCCESS;
|
|
298 |
}
|
|
299 |
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
// CMMFRadioBackendEngine::MrpeoPresetChanged
|
|
302 |
// Observer for Presets
|
|
303 |
// -----------------------------------------------------------------------------
|
|
304 |
void CMMFRadioBackendEngine::MrpeoPresetChanged(
|
|
305 |
TPresetChangeEvent /*aChange*/,
|
|
306 |
TInt /*aIndex*/ )
|
|
307 |
{
|
|
308 |
|
|
309 |
}
|
|
310 |
|
|
311 |
// ----------------------------------------------------
|
|
312 |
// CMMFRadioBackendEngine::MrftoSquelchChange
|
|
313 |
//
|
|
314 |
// ----------------------------------------------------
|
|
315 |
//
|
|
316 |
void CMMFRadioBackendEngine::MrftoSquelchChange(
|
|
317 |
TBool /*aSquelch*/ )
|
|
318 |
{
|
|
319 |
|
|
320 |
}
|
|
321 |
|
|
322 |
// ----------------------------------------------------
|
|
323 |
// CMMFRadioBackendEngine::MTsoForcedMonoChanged
|
|
324 |
// Called when a client enables/disabled forced mono reception
|
|
325 |
// ----------------------------------------------------
|
|
326 |
//
|
|
327 |
void CMMFRadioBackendEngine::MrftoForcedMonoChange(
|
|
328 |
TBool aForcedMono )
|
|
329 |
{
|
|
330 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoForcedMonoChange: aForcedMono = %d", aForcedMono);
|
|
331 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoForcedMonoChange: aForcedMono = %d"), aForcedMono);
|
|
332 |
XARadioItfAdapt_StereoStatusChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aForcedMono);
|
|
333 |
}
|
|
334 |
|
|
335 |
// ----------------------------------------------------
|
|
336 |
// CMMFRadioBackendEngine::MrftoFrequencyChange
|
|
337 |
// Called when the tuned frequency changes
|
|
338 |
// ----------------------------------------------------
|
|
339 |
//
|
|
340 |
void CMMFRadioBackendEngine::MrftoFrequencyChange(
|
|
341 |
TInt aNewFrequency)
|
|
342 |
{
|
|
343 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoFrequencyChange: aNewFrequency = %d", aNewFrequency);
|
|
344 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrequencyChange aNewFrequency = %d"), aNewFrequency);
|
|
345 |
XARadioItfAdapt_FrequencyChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aNewFrequency);
|
|
346 |
}
|
|
347 |
|
|
348 |
// ----------------------------------------------------
|
|
349 |
// CMMFRadioBackendEngine::MrftoFrequencyRangeChange
|
|
350 |
//
|
|
351 |
// ----------------------------------------------------
|
|
352 |
//
|
|
353 |
void CMMFRadioBackendEngine::MrftoFrequencyRangeChange(
|
|
354 |
TFmRadioFrequencyRange aNewRange )
|
|
355 |
{
|
|
356 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoFrequencyRangeChange: aNewRange = %d", aNewRange);
|
|
357 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrequencyRangeChange: aNewRange = %d"), aNewRange);
|
|
358 |
XARadioItfAdapt_FrequencyRangeChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aNewRange);
|
|
359 |
}
|
|
360 |
|
|
361 |
// ----------------------------------------------------
|
|
362 |
// CMMFRadioBackendEngine::MrftoOfflineModeStatusChange
|
|
363 |
// Called when offline mode status changes
|
|
364 |
// ----------------------------------------------------
|
|
365 |
//
|
|
366 |
void CMMFRadioBackendEngine::MrftoOfflineModeStatusChange(
|
|
367 |
TBool /*aOfflineMode*/ )
|
|
368 |
{
|
|
369 |
|
|
370 |
}
|
|
371 |
|
|
372 |
// ----------------------------------------------------
|
|
373 |
// CMMFRadioBackendEngine::MrftoAntennaStatusChange
|
|
374 |
// Called when antenna status changes.
|
|
375 |
// ----------------------------------------------------
|
|
376 |
//
|
|
377 |
void CMMFRadioBackendEngine::MrftoAntennaStatusChange(
|
|
378 |
TBool /*aAttached*/ )
|
|
379 |
{
|
|
380 |
|
|
381 |
}
|
|
382 |
|
|
383 |
// ----------------------------------------------------
|
|
384 |
// CMMFRadioBackendEngine::MrftoFmTransmitterStatusChange
|
|
385 |
// The FM tuner is turned off when FM transmitter is on.
|
|
386 |
// ----------------------------------------------------
|
|
387 |
//
|
|
388 |
void CMMFRadioBackendEngine::MrftoFmTransmitterStatusChange(
|
|
389 |
TBool /*aActive*/ )
|
|
390 |
{
|
|
391 |
|
|
392 |
}
|
|
393 |
|
|
394 |
// ----------------------------------------------------
|
|
395 |
// CMMFRadioBackendEngine::MrftoStationSeekComplete
|
|
396 |
//
|
|
397 |
// ----------------------------------------------------
|
|
398 |
//
|
|
399 |
void CMMFRadioBackendEngine::MrftoStationSeekComplete(
|
|
400 |
TInt aError,
|
|
401 |
TInt aFrequency )
|
|
402 |
{
|
|
403 |
XARadioItfAdapt_SeekComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError, aFrequency);
|
|
404 |
}
|
|
405 |
|
|
406 |
// ----------------------------------------------------
|
|
407 |
// CMMFRadioBackendEngine::MrftoSetFrequencyComplete
|
|
408 |
// ----------------------------------------------------
|
|
409 |
//
|
|
410 |
void CMMFRadioBackendEngine::MrftoSetFrequencyComplete(
|
|
411 |
TInt aError )
|
|
412 |
{
|
|
413 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: aError = %d", aError);
|
|
414 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrrequencyComplete: aError = %d"), aError);
|
|
415 |
TInt freq = 0;
|
|
416 |
if (!aError)
|
|
417 |
{
|
|
418 |
iFmTunerUtility->GetFrequency(freq);
|
|
419 |
}
|
|
420 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: new freq is: %d", freq);
|
|
421 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: new freq is: %d"), freq);
|
|
422 |
XARadioItfAdapt_SetFrequencyComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError, freq);
|
|
423 |
}
|
|
424 |
|
|
425 |
// ----------------------------------------------------
|
|
426 |
// CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete
|
|
427 |
//
|
|
428 |
// ----------------------------------------------------
|
|
429 |
//
|
|
430 |
void CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete(
|
|
431 |
TInt aError )
|
|
432 |
{
|
|
433 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete: aError = %d", aError);
|
|
434 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete: aError = %d"), aError);
|
|
435 |
XARadioItfAdapt_SetFrequencyRangeComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError);
|
|
436 |
}
|
|
437 |
|
|
438 |
// ----------------------------------------------------
|
|
439 |
// CMMFRadioBackendEngine::MrftoRequestTunerControlComplete
|
|
440 |
// ----------------------------------------------------
|
|
441 |
//
|
|
442 |
void CMMFRadioBackendEngine::MrftoRequestTunerControlComplete(
|
|
443 |
TInt aError)
|
|
444 |
{
|
|
445 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrftoRequestTunerControlComplete: aError = %d"), aError);
|
|
446 |
}
|
|
447 |
|
|
448 |
// ----------------------------------------------------
|
|
449 |
// CMMFRadioBackendEngine::MrpoBalanceChange
|
|
450 |
//
|
|
451 |
// ----------------------------------------------------
|
|
452 |
//
|
|
453 |
void CMMFRadioBackendEngine::MrpoBalanceChange(
|
|
454 |
TInt /*aLeftPercentage*/,
|
|
455 |
TInt /*aRightPercentage*/ )
|
|
456 |
{
|
|
457 |
|
|
458 |
}
|
|
459 |
|
|
460 |
// ----------------------------------------------------
|
|
461 |
// CMMFRadioBackendEngine::MrpoMuteChange
|
|
462 |
//
|
|
463 |
// ----------------------------------------------------
|
|
464 |
//
|
|
465 |
void CMMFRadioBackendEngine::MrpoMuteChange(
|
|
466 |
TBool aMute )
|
|
467 |
{
|
|
468 |
XANokiaVolumeExtItfAdapt_MuteChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, aMute);
|
|
469 |
}
|
|
470 |
|
|
471 |
// ----------------------------------------------------
|
|
472 |
// CMMFRadioBackendEngine::MrpoVolumeChange
|
|
473 |
//
|
|
474 |
// ----------------------------------------------------
|
|
475 |
//
|
|
476 |
void CMMFRadioBackendEngine::MrpoVolumeChange(
|
|
477 |
TInt aVolume )
|
|
478 |
{
|
|
479 |
XANokiaLinearVolumeItfAdapt_VolumeChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, aVolume);
|
|
480 |
}
|
|
481 |
|
|
482 |
// ----------------------------------------------------
|
|
483 |
// CMMFRadioBackendEngine::MrpoStateChange This is Tuner State
|
|
484 |
// Called when the state of the tuner changes
|
|
485 |
// ----------------------------------------------------
|
|
486 |
//
|
|
487 |
void CMMFRadioBackendEngine::MrpoStateChange(
|
|
488 |
TPlayerState aState,
|
|
489 |
TInt aError )
|
|
490 |
{
|
|
491 |
if ( aError )
|
|
492 |
{
|
|
493 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrpoStateChange: aError = %d", aError);
|
|
494 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrpoStateChange: aError = %d"), aError);
|
|
495 |
}
|
|
496 |
|
|
497 |
DEBUG_API_A1("CMMFRadioBackendEngine::MrpoStateChange: new state = %d", aState);
|
|
498 |
// RDebug::Print(_L("CMMFRadioBackendEngine::MrpoStateChange: new state = %d"), aState);
|
|
499 |
|
|
500 |
if ( aState == ERadioPlayerPlaying )
|
|
501 |
{
|
|
502 |
XAPlayItfAdaptMMF_StateChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, ETrue);
|
|
503 |
}
|
|
504 |
else // ERadioPlayerIdle
|
|
505 |
{
|
|
506 |
XAPlayItfAdaptMMF_StateChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, EFalse);
|
|
507 |
}
|
|
508 |
}
|
|
509 |
|
|
510 |
extern "C" {
|
|
511 |
|
|
512 |
void* cmmfradiobackendengine_init()
|
|
513 |
{
|
|
514 |
return CMMFRadioBackendEngine::Instance();
|
|
515 |
}
|
|
516 |
|
|
517 |
void cmmfradiobackendengine_delete(void* context)
|
|
518 |
{
|
|
519 |
((CMMFRadioBackendEngine*)(context))->DeleteInstance();
|
|
520 |
}
|
|
521 |
|
|
522 |
void set_frequency(void* context, XAuint32 freq)
|
|
523 |
{
|
|
524 |
((CMMFRadioBackendEngine*)(context))->SetFrequency((TInt)freq);
|
|
525 |
}
|
|
526 |
|
|
527 |
XAresult get_frequency(void* context, XAuint32* freq)
|
|
528 |
{
|
|
529 |
return ((CMMFRadioBackendEngine*)(context))->GetFrequency((TInt&)*freq);
|
|
530 |
}
|
|
531 |
|
|
532 |
XAresult get_signal_strength(void* context, XAuint32* signalStrength)
|
|
533 |
{
|
|
534 |
return ((CMMFRadioBackendEngine*)(context))->GetSignalStrength((TInt&)*signalStrength);
|
|
535 |
}
|
|
536 |
|
|
537 |
void station_seek(void* context, XAboolean upwards)
|
|
538 |
{
|
|
539 |
((CMMFRadioBackendEngine*)(context))->StationSeek(upwards);
|
|
540 |
}
|
|
541 |
|
|
542 |
void cancel_set_frequency(void* context)
|
|
543 |
{
|
|
544 |
((CMMFRadioBackendEngine*)(context))->CancelSetFrequency();
|
|
545 |
}
|
|
546 |
|
|
547 |
void cancel_station_seek(void* context)
|
|
548 |
{
|
|
549 |
((CMMFRadioBackendEngine*)(context))->CancelStationSeek();
|
|
550 |
}
|
|
551 |
|
|
552 |
void set_freq_range(void* context, XAuint8 range)
|
|
553 |
{
|
|
554 |
((CMMFRadioBackendEngine*)(context))->SetFreqRange((TFmRadioFrequencyRange)range);
|
|
555 |
}
|
|
556 |
|
|
557 |
XAresult get_freq_range(void* context, XAuint8* range)
|
|
558 |
{
|
|
559 |
return ((CMMFRadioBackendEngine*)(context))->GetFreqRange((TFmRadioFrequencyRange&)*range);
|
|
560 |
}
|
|
561 |
|
|
562 |
XAresult get_freq_range_properties(void* context, XAuint8 range, XAuint32* aMinFreq, XAuint32* aMaxFreq)
|
|
563 |
{
|
|
564 |
return ((CMMFRadioBackendEngine*)(context))->GetFreqRangeProperties((TFmRadioFrequencyRange&)range, (TInt&) *aMinFreq, (TInt&) *aMaxFreq);
|
|
565 |
}
|
|
566 |
|
|
567 |
XAresult get_max_volume(void* context, XAmillibel* maxVol)
|
|
568 |
{
|
|
569 |
return ((CMMFRadioBackendEngine*)(context))->GetMaxVolume((TInt&)*maxVol);
|
|
570 |
}
|
|
571 |
|
|
572 |
XAresult set_volume(void* context, XAuint32 vol)
|
|
573 |
{
|
|
574 |
return ((CMMFRadioBackendEngine*)(context))->SetVolume((TInt)vol);
|
|
575 |
}
|
|
576 |
|
|
577 |
XAresult get_volume(void* context, XAuint32* vol)
|
|
578 |
{
|
|
579 |
return ((CMMFRadioBackendEngine*)(context))->GetVolume((TInt&)*vol);
|
|
580 |
}
|
|
581 |
|
|
582 |
XAresult set_mute(void* context, XAboolean mute)
|
|
583 |
{
|
|
584 |
return ((CMMFRadioBackendEngine*)(context))->SetMute(mute);
|
|
585 |
}
|
|
586 |
|
|
587 |
XAresult get_stereo_mode(void* context, XAuint32* mode)
|
|
588 |
{
|
|
589 |
return ((CMMFRadioBackendEngine*)(context))->GetForcedMonoReception(*mode);
|
|
590 |
}
|
|
591 |
|
|
592 |
XAresult set_stereo_mode(void* context, XAuint32 mode)
|
|
593 |
{
|
|
594 |
return ((CMMFRadioBackendEngine*)(context))->ForceMonoReception(mode);
|
|
595 |
}
|
|
596 |
|
|
597 |
void play_radio(void* context)
|
|
598 |
{
|
|
599 |
((CMMFRadioBackendEngine*)(context))->PlayRadio();
|
|
600 |
}
|
|
601 |
|
|
602 |
void stop_radio(void* context)
|
|
603 |
{
|
|
604 |
((CMMFRadioBackendEngine*)(context))->StopRadio();
|
|
605 |
}
|
|
606 |
|
|
607 |
XAresult mmf_set_radio_adapt_context(void * context, void * adaptcontext)
|
|
608 |
{
|
|
609 |
return ((CMMFRadioBackendEngine*)(context))->SetRadioAdaptContext(adaptcontext);
|
|
610 |
}
|
|
611 |
|
|
612 |
XAresult mmf_set_player_adapt_context(void * context, void * adaptcontext)
|
|
613 |
{
|
|
614 |
return ((CMMFRadioBackendEngine*)(context))->SetPlayerAdaptContext(adaptcontext);
|
|
615 |
}
|
|
616 |
}
|