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