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