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