khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp
changeset 33 5e8b14bae8c3
parent 28 ebf79c79991a
child 38 9e9fc5ab059f
equal deleted inserted replaced
28:ebf79c79991a 33:5e8b14bae8c3
    84   if (iRadioUtility)
    84   if (iRadioUtility)
    85   {  
    85   {  
    86  		iRadioPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this ); 
    86  		iRadioPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this ); 
    87  	}   
    87  	}   
    88  	 
    88  	 
       
    89 //	SetForceMonoFlag();
       
    90 	iDefaultFrequency = RADIO_DEFAULT_FREQ;
       
    91 	iDefaultFreqRange = (TFmRadioFrequencyRange)RADIO_DEFAULT_FREQ_RANGE;  
       
    92 	iDefaultMinFreq = RADIO_DEFAULT_MIN_FREQ;
       
    93 	iDefaultMaxFreq = RADIO_DEFAULT_MAX_FREQ;
       
    94 	 	 
    89 }
    95 }
    90 void CMMFRadioBackendEngine::StationSeek(XAboolean aUpwards)
    96 void CMMFRadioBackendEngine::StationSeek(XAboolean aUpwards)
    91 {
    97 {
    92 	if (iFmTunerUtility)
    98 	if (iFmTunerUtility)
    93  	{
    99  	{
   109   DEBUG_API("CMMFRadioBackendEngine::GetFrequency");	
   115   DEBUG_API("CMMFRadioBackendEngine::GetFrequency");	
   110 	TInt ret = KErrNotFound;
   116 	TInt ret = KErrNotFound;
   111 	if (iFmTunerUtility)
   117 	if (iFmTunerUtility)
   112 	{
   118 	{
   113   	ret = iFmTunerUtility->GetFrequency(aFreq);
   119   	ret = iFmTunerUtility->GetFrequency(aFreq);
       
   120   	if (ret != KErrNone)
       
   121   	{
       
   122   		aFreq = iDefaultFrequency;
       
   123   		ret = KErrNone;
       
   124   	}
   114  	}	
   125  	}	
   115   DEBUG_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret);	 
   126   DEBUG_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret);	 
   116 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFrequency RET: %d"), ret);	 
   127 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFrequency RET: %d"), ret);	 
   117  	return ret; 	
   128  	return ret; 	
   118 }
   129 }
   160 	TInt maxFreq = 0;
   171 	TInt maxFreq = 0;
   161 		
   172 		
   162  	if (iFmTunerUtility)
   173  	if (iFmTunerUtility)
   163  	{
   174  	{
   164  		ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)minFreq, (TInt&)maxFreq);
   175  		ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)minFreq, (TInt&)maxFreq);
       
   176  		if (ret != KErrNone)
       
   177  		{
       
   178  			aRange = iDefaultFreqRange;
       
   179  			minFreq = iDefaultMinFreq;
       
   180  			maxFreq = iDefaultMaxFreq;
       
   181  			ret = KErrNone;
       
   182  		}
   165  	}	
   183  	}	
   166   DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret);	 
   184   DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret);	 
   167 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRange RET: %d"), ret);	   	
   185 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRange RET: %d"), ret);	   	
   168   return ret;
   186   return ret;
   169 }
   187 }
   172 {
   190 {
   173 	TInt ret = KErrNotFound;
   191 	TInt ret = KErrNotFound;
   174 		
   192 		
   175 	if (iFmTunerUtility)
   193 	if (iFmTunerUtility)
   176  	{
   194  	{
   177   	ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq);
   195   		ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq);
       
   196   		if (ret != KErrNone)
       
   197   		{
       
   198   			aRange = iDefaultFreqRange;
       
   199   			aMinFreq = iDefaultMinFreq;
       
   200   			aMaxFreq = iDefaultMaxFreq;
       
   201   			ret = KErrNone;
       
   202   		}
   178  	}	
   203  	}	
   179   DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret);	 	
   204   DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret);	 	
   180 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d"), ret);	   
   205 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d"), ret);	   
   181   return ret;
   206   return ret;
   182 }
   207 }
   230 	TBool forceMono;
   255 	TBool forceMono;
   231 
   256 
   232 	if (iFmTunerUtility)
   257 	if (iFmTunerUtility)
   233 	{
   258 	{
   234 		ret = iFmTunerUtility->GetForcedMonoReception(forceMono);
   259 		ret = iFmTunerUtility->GetForcedMonoReception(forceMono);
       
   260 		if (ret == KErrNotReady)
       
   261 		{
       
   262 			aForcedMono = XA_STEREOMODE_STEREO; // Radio Utility Default value
       
   263 			return KErrNone;
       
   264 		}
   235 	}		 
   265 	}		 
   236 		
   266 		
   237 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetForcedMonoReception RET: %d, aForcedMono = %d"), ret, aForcedMono);	 		
   267 	
   238 	if (forceMono)
   268 	if (forceMono)
   239 	{
   269 	{
   240 		aForcedMono = XA_STEREOMODE_MONO;
   270 		aForcedMono = XA_STEREOMODE_MONO;
   241 	}
   271 	}
   242 	else
   272 	else
   309   DEBUG_API_A1("CMMFRadioBackendEngine::ForceMonoReception RET: %d", ret);	
   339   DEBUG_API_A1("CMMFRadioBackendEngine::ForceMonoReception RET: %d", ret);	
   310  // RDebug::Print(_L("CMMFRadioBackendEngine::ForceMonoReception RET: %d"), ret);	   		
   340  // RDebug::Print(_L("CMMFRadioBackendEngine::ForceMonoReception RET: %d"), ret);	   		
   311   return ret;
   341   return ret;
   312 }
   342 }
   313 
   343 
       
   344 XAresult CMMFRadioBackendEngine::SetForceMonoFlag() 
       
   345 {
       
   346 	TInt ret = KErrNotFound;
       
   347 	TBool forceMono;
       
   348 
       
   349 	if (iFmTunerUtility)
       
   350 	{
       
   351 		ret = iFmTunerUtility->GetForcedMonoReception(forceMono);
       
   352 		if (ret == KErrNotReady)
       
   353 		{
       
   354 			// For Radio Utility Default value = XA_STEREOMODE_STEREO
       
   355 			iForceStereo = ETrue;
       
   356 			return KErrNone;
       
   357 		}
       
   358 				
       
   359 	}		 
       
   360 		
       
   361 	if (forceMono == XA_STEREOMODE_MONO)
       
   362 	{
       
   363 		iForceStereo = EFalse;
       
   364 	}
       
   365 	else
       
   366 	{
       
   367 		iForceStereo = ETrue;			
       
   368 	}
       
   369   return ret;
       
   370 }
   314 XAresult CMMFRadioBackendEngine::SetRadioAdaptContext(void * adaptcontext)
   371 XAresult CMMFRadioBackendEngine::SetRadioAdaptContext(void * adaptcontext)
   315 {
   372 {
   316 	iRadioAdaptContext = adaptcontext;
   373 	iRadioAdaptContext = adaptcontext;
   317 	return XA_RESULT_SUCCESS;
   374 	return XA_RESULT_SUCCESS;
   318 } 
   375 }