fmradio/fmradioengine/src/fmradioengine.cpp
branchRCL_3
changeset 13 4f2584af5a29
parent 11 97dcae98e602
equal deleted inserted replaced
12:9f3ff466f56b 13:4f2584af5a29
    19 //  INCLUDE FILES
    19 //  INCLUDE FILES
    20 #include <AudioOutput.h>
    20 #include <AudioOutput.h>
    21 #include <AccMonitor.h>
    21 #include <AccMonitor.h>
    22 #include <bautils.h>
    22 #include <bautils.h>
    23 #include <coemain.h>
    23 #include <coemain.h>
    24 #include <ctsydomainpskeys.h>
       
    25 #include <data_caging_path_literals.hrh>
    24 #include <data_caging_path_literals.hrh>
    26 #include <e32property.h>
       
    27 
    25 
    28 #include "fmradioengine.h"
    26 #include "fmradioengine.h"
    29 #include "fmradioenginestatechangecallback.h"
    27 #include "fmradioenginestatechangecallback.h"
    30 #include "debug.h"
    28 #include "debug.h"
    31 #include "fmradioengineradiosettings.h"
    29 #include "fmradioengineradiosettings.h"
    54 // ----------------------------------------------------
    52 // ----------------------------------------------------
    55 //
    53 //
    56 CRadioEngine::CRadioEngine(
    54 CRadioEngine::CRadioEngine(
    57     MRadioEngineStateChangeCallback& aCallback)
    55     MRadioEngineStateChangeCallback& aCallback)
    58     :
    56     :
    59     iAutoResume(EFalse),
    57     iCurrentRadioState( EStateRadioOff ),
    60     iCurrentRadioState(EStateRadioOff),
    58     iCallback( aCallback ),
    61     iCallback(aCallback),
    59     iTempFrequency( KDefaultRadioFrequency ),
    62     iTempFrequency(KDefaultRadioFrequency),
    60     iTunePresetRequested( EFalse ),
    63     iTunePresetRequested(EFalse),
    61     iInitializeRadioRequestExists( EFalse ),
    64     iInitializeRadioRequestExists(EFalse),
    62     iTunerControl( EStateRadioTunerControlUninitialized )
    65     ilineConstructed( EFalse ),
       
    66     iHFOptionActivated ( EFalse )
       
    67     {
    63     {
    68     }
    64     }
    69 
    65 
    70 // ----------------------------------------------------
    66 // ----------------------------------------------------
    71 // CRadioEngine::ConstructL
    67 // CRadioEngine::ConstructL
    73 // ----------------------------------------------------
    69 // ----------------------------------------------------
    74 //
    70 //
    75 void CRadioEngine::ConstructL()
    71 void CRadioEngine::ConstructL()
    76     {
    72     {
    77     FTRACE(FPrint(_L("CRadioEngine::ConstructL()")));
    73     FTRACE(FPrint(_L("CRadioEngine::ConstructL()")));
    78     
    74         
    79     TRAP_IGNORE( ConnectLineL() );
       
    80     
       
    81     InitializeResourceLoadingL(); 
    75     InitializeResourceLoadingL(); 
    82 
    76 
    83     iRadioSettings = new ( ELeave ) TRadioSettings;
    77     iRadioSettings = new ( ELeave ) TRadioSettings;
    84     
    78     
    85     iCentralRepositoryHandler = CCentralRepositoryHandler::NewL( *iRadioSettings );
    79     iCentralRepositoryHandler = CCentralRepositoryHandler::NewL( *iRadioSettings );
    96     // FM Radio is a primary client
    90     // FM Radio is a primary client
    97     iRadioUtility = CRadioUtility::NewL( ETrue );
    91     iRadioUtility = CRadioUtility::NewL( ETrue );
    98 
    92 
    99     // Get a tuner utility
    93     // Get a tuner utility
   100     iFmTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
    94     iFmTunerUtility = &iRadioUtility->RadioFmTunerUtilityL( *this );
       
    95     iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
   101     
    96     
   102     // Get a player utility
    97     // Get a player utility
   103     iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
    98     iPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
   104 
    99 
   105     TInt maxVolume = 0;
   100     TInt maxVolume = 0;
   132 #endif
   127 #endif
   133     
   128     
   134     iTopFrequency = 0;
   129     iTopFrequency = 0;
   135     iBottomFrequency = 0;
   130     iBottomFrequency = 0;
   136 
   131 
   137     TInt callState = KErrUnknown;
   132     if ( iSystemEventDetector->IsCallActive() )
   138     RMobileCall::TMobileCallStatus linestatus;
   133         {
   139    	iLine.GetMobileLineStatus( linestatus );
   134         // Pre-empted due to phone call
   140     RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
       
   141                 
       
   142     // check status from line
       
   143     if ( linestatus != RMobileCall::EStatusIdle &&
       
   144          linestatus != RMobileCall::EStatusUnknown )
       
   145         {
       
   146         // Pre-empted due to phone call, start Call State Observer
       
   147         iInCall = ETrue;
   135         iInCall = ETrue;
   148         }
   136         }
   149     // accessory observer
   137     // accessory observer
   150     iHeadsetObserver = CFMRadioAccessoryConnection::NewL();
   138     iHeadsetObserver = CFMRadioAccessoryConnection::NewL();
   151     iHeadsetObserver->SetObserver( this );    
   139     iHeadsetObserver->SetObserver( this );    
   171     iPubSub->PublishFrequencyDecimalCountL( 
   159     iPubSub->PublishFrequencyDecimalCountL( 
   172             TFMRadioPSFrequencyDecimalCount( iRadioSettings->DecimalCount() ) );
   160             TFMRadioPSFrequencyDecimalCount( iRadioSettings->DecimalCount() ) );
   173 
   161 
   174     FTRACE(FPrint(_L("CRadioEngine::ConstructL() End ")));
   162     FTRACE(FPrint(_L("CRadioEngine::ConstructL() End ")));
   175     }
   163     }
   176     
       
   177 // ----------------------------------------------------
       
   178 // CRadioEngine::ConnectLineL
       
   179 // Connects etel server
       
   180 // ----------------------------------------------------
       
   181 //
       
   182 void CRadioEngine::ConnectLineL()
       
   183 	{
       
   184 	User::LeaveIfError( iTelServer.Connect() );
       
   185 
       
   186 	iTelServer.GetTsyName( 0, iTsyName );
       
   187 
       
   188 	User::LeaveIfError( iTelServer.LoadPhoneModule( iTsyName ) );
       
   189 	TInt numberOfPhones( 0 );
       
   190 	User::LeaveIfError( iTelServer.EnumeratePhones( numberOfPhones ) );
       
   191 
       
   192 	RTelServer::TPhoneInfo phoneInfo;
       
   193 
       
   194 	// Only possible thing to do is leave. We definately need phone.
       
   195 	User::LeaveIfError( iTelServer.GetPhoneInfo( 0, phoneInfo ) );
       
   196 	    
       
   197 	// Only possible thing to do is leave. We definately need phone.
       
   198 	User::LeaveIfError( iPhone.Open( iTelServer, phoneInfo.iName ));
       
   199 	
       
   200 
       
   201 	RPhone::TLineInfo lineInfo;
       
   202 	
       
   203 	User::LeaveIfError( iPhone.GetLineInfo( 0, lineInfo ) );
       
   204 	
       
   205 	User::LeaveIfError( iLine.Open( iPhone, lineInfo.iName ) );
       
   206 	
       
   207 	ilineConstructed = ETrue;
       
   208 	}
       
   209 
   164 
   210 // ----------------------------------------------------
   165 // ----------------------------------------------------
   211 // CRadioEngine::NewL
   166 // CRadioEngine::NewL
   212 // Two-phased class constructor.
   167 // Two-phased class constructor.
   213 // ----------------------------------------------------
   168 // ----------------------------------------------------
   282         
   237         
   283 	if ( iFMRadioEngineResourceOffset > 0 )
   238 	if ( iFMRadioEngineResourceOffset > 0 )
   284         {
   239         {
   285         CCoeEnv::Static()->DeleteResourceFile( iFMRadioEngineResourceOffset );
   240         CCoeEnv::Static()->DeleteResourceFile( iFMRadioEngineResourceOffset );
   286         }
   241         }
   287          
       
   288 	if ( ilineConstructed )
       
   289 		{	        
       
   290 		iLine.Close();
       
   291 	    iPhone.Close();
       
   292 	    iTelServer.UnloadPhoneModule( iTsyName );    
       
   293 	    iTelServer.Close();
       
   294 	    }
       
   295     }
   242     }
   296 
   243 
   297 // ----------------------------------------------------
   244 // ----------------------------------------------------
   298 // CRadioEngine::InitializeRadio
   245 // CRadioEngine::InitializeRadio
   299 // Set radio settings to their default values.
   246 // Set radio settings to their default values.
   396     {
   343     {
   397     FTRACE(FPrint(_L("CRadioEngine::Tune()")));
   344     FTRACE(FPrint(_L("CRadioEngine::Tune()")));
   398     iTempFrequency = aFrequency;
   345     iTempFrequency = aFrequency;
   399 
   346 
   400     iRadioSettings->SetRadioMode( aRadioMode );
   347     iRadioSettings->SetRadioMode( aRadioMode );
   401     if ( iTunerControl && iRadioSettings->IsHeadsetConnected() )
   348     if ( iTunerControl == EStateRadioTunerControlOn && iRadioSettings->IsHeadsetConnected() )
   402         {
   349         {
   403         iFmTunerUtility->SetFrequency( aFrequency );
   350         iFmTunerUtility->SetFrequency( aFrequency );
   404         }
   351         }
   405     else
   352     else
   406         {
   353         {
  1021 
   968 
  1022 // ----------------------------------------------------
   969 // ----------------------------------------------------
  1023 // CRadioEngine::MrftoRequestTunerControlComplete
   970 // CRadioEngine::MrftoRequestTunerControlComplete
  1024 // ----------------------------------------------------
   971 // ----------------------------------------------------
  1025 //
   972 //
  1026 void CRadioEngine::MrftoRequestTunerControlComplete(
   973 void CRadioEngine::MrftoRequestTunerControlComplete( TInt aError )
  1027     TInt aError )
       
  1028     {
   974     {
  1029     FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - Error = %d"), aError));
   975     FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - Error = %d"), aError));
  1030 
   976 
  1031     if ( aError == KErrNone )
   977     if ( aError == KErrNone )
  1032         {
   978         {
  1033         iTunerControl = ETrue;
   979         iTunerControl = EStateRadioTunerControlOn;
  1034         // Headset must be connected
   980         // Headset must be connected
  1035         iRadioSettings->SetHeadsetConnected();
   981         iRadioSettings->SetHeadsetConnected();
  1036         iFmTunerUtility->GetCapabilities( iTunerCaps );
   982         iFmTunerUtility->GetCapabilities( iTunerCaps );
  1037 
       
  1038         if( iTunerCaps.iTunerFunctions & TFmTunerCapabilities::ETunerRdsSupport )
   983         if( iTunerCaps.iTunerFunctions & TFmTunerCapabilities::ETunerRdsSupport )
  1039 	        {
   984             {
  1040 	        TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
   985             TRAP_IGNORE( iRdsReceiver->InitL( *iRadioUtility, iPubSub ) )
  1041 	        }
   986             }
  1042         
   987         
  1043 		TFmRadioFrequencyRange japanFreqRange = EFmRangeJapan;
   988         TFmRadioFrequencyRange japanFreqRange = EFmRangeJapan;
  1044 		
   989         if ( TunerFrequencyRangeForRegionId( RegionId() ) == japanFreqRange )
  1045 		if ( TunerFrequencyRangeForRegionId( RegionId() ) == japanFreqRange )
   990             {
  1046 			{
   991             // region is Japan so we need to change the freq range from the default
  1047 			// region is Japan so we need to change the freq range from the default
   992             iFmTunerUtility->SetFrequencyRange( japanFreqRange );
  1048 			iFmTunerUtility->SetFrequencyRange( japanFreqRange );		
   993             }
  1049 			}
   994         else
  1050 		else
   995             {
  1051 			{
   996             // allready on correct freq range
  1052 			// allready on correct freq range
   997             HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
  1053 			HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
   998             }
  1054 			}		        
   999         
  1055         }
  1000         }
  1056     else if ( aError == KFmRadioErrAntennaNotConnected )
  1001     else if ( aError == KFmRadioErrAntennaNotConnected )
  1057         {
  1002         {
  1058         FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - KFmRadioErrAntennaNotConnected")));
  1003         FTRACE(FPrint(_L("CRadioEngine::MrftoRequestTunerControlComplete() - KFmRadioErrAntennaNotConnected")));
       
  1004         iTunerControl = EStateRadioTunerControlOff;
  1059         iRadioSettings->SetHeadsetDisconnected();
  1005         iRadioSettings->SetHeadsetDisconnected();
  1060         HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventHeadsetDisconnected, KErrNone );
  1006         HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventHeadsetDisconnected, KErrNone );
  1061         }
  1007         }
  1062     else if ( aError == KErrAlreadyExists )
  1008     else if ( aError == KErrAlreadyExists )
  1063         {
  1009         {
  1064         iTunerControl = ETrue;
  1010         iTunerControl = EStateRadioTunerControlOn;
  1065         // Headset must be connected
  1011         // Headset must be connected
  1066         iRadioSettings->SetHeadsetConnected();
  1012         iRadioSettings->SetHeadsetConnected();
  1067         iFmTunerUtility->GetCapabilities( iTunerCaps );
  1013         iFmTunerUtility->GetCapabilities( iTunerCaps );
  1068         TInt frequency;
  1014         TInt frequency;
  1069         iFmTunerUtility->GetFrequency( frequency );
  1015         iFmTunerUtility->GetFrequency( frequency );
  1070         StoreAndPublishFrequency( frequency );
  1016         StoreAndPublishFrequency( frequency );
  1071         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, KErrNone );
  1017         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, KErrNone );
  1072         }
  1018         }
  1073     else if ( aError == KFmRadioErrFmTransmitterActive )
  1019     else if ( aError == KFmRadioErrFmTransmitterActive )
  1074         {
  1020         {
  1075         iTunerControl = EFalse;
  1021         iTunerControl = EStateRadioTunerControlOff;
  1076         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMTransmitterOn, KErrNone );
  1022         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFMTransmitterOn, KErrNone );
  1077         }
  1023         }
  1078     else if ( aError == KFmRadioErrOfflineMode )
  1024     else if ( aError == KFmRadioErrOfflineMode )
  1079         {
  1025         {
  1080         iTunerControl = EFalse;
  1026         iTunerControl = EStateRadioTunerControlOff;
  1081         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFlightModeEnabled, KErrNone );
  1027         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventFlightModeEnabled, KErrNone );
  1082         }
  1028         }
  1083     else
  1029     else
  1084         {
  1030         {
  1085         //pass
  1031         iTunerControl = EStateRadioTunerControlOff;
  1086         }
  1032         }
  1087     }
  1033     }
  1088 
  1034 
  1089 // ----------------------------------------------------
  1035 // ----------------------------------------------------
  1090 // CRadioEngine::MrftoSetFrequencyRangeComplete
  1036 // CRadioEngine::MrftoSetFrequencyRangeComplete
  1091 //
  1037 //
  1092 // ----------------------------------------------------
  1038 // ----------------------------------------------------
  1093 //
  1039 //
  1094 void CRadioEngine::MrftoSetFrequencyRangeComplete(
  1040 void CRadioEngine::MrftoSetFrequencyRangeComplete( TInt aError )
  1095     TInt aError )
       
  1096     {
  1041     {
  1097     if ( aError == KErrNone )
  1042     if ( aError == KErrNone )
  1098     	{
  1043         {
  1099     	HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
  1044         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTunerReady, KErrNone );
  1100     	}
  1045         }
  1101     	  	
  1046         
  1102     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyRangeComplete() - error = %d"), aError));
  1047     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyRangeComplete() - error = %d"), aError));
  1103     }
  1048     }
  1104 
  1049 
  1105 // ----------------------------------------------------
  1050 // ----------------------------------------------------
  1106 // CRadioEngine::MrftoSetFrequencyComplete
  1051 // CRadioEngine::MrftoSetFrequencyComplete
  1107 // ----------------------------------------------------
  1052 // ----------------------------------------------------
  1108 //
  1053 //
  1109 void CRadioEngine::MrftoSetFrequencyComplete(
  1054 void CRadioEngine::MrftoSetFrequencyComplete( TInt aError )
  1110     TInt aError )
       
  1111     {
  1055     {
  1112     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - aError = %d"), aError));
  1056     FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - aError = %d"), aError));
  1113 
       
  1114 
  1057 
  1115     if ( !aError )
  1058     if ( !aError )
  1116         {
  1059         {
  1117         iRdsReceiver->ClearRdsInformation();
  1060         iRdsReceiver->ClearRdsInformation();
  1118         StoreAndPublishFrequency( iTempFrequency );
  1061         StoreAndPublishFrequency( iTempFrequency );
  1134         iInitializeRadioRequestExists = EFalse;
  1077         iInitializeRadioRequestExists = EFalse;
  1135 
  1078 
  1136         FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - Sending event to UI")));
  1079         FTRACE(FPrint(_L("CRadioEngine::MrftoSetFrequencyComplete() - Sending event to UI")));
  1137         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
  1080         HandleCallback( MRadioEngineStateChangeCallback::EFMRadioEventTune, aError );
  1138         }
  1081         }
  1139 
       
  1140     }
  1082     }
  1141 
  1083 
  1142 // ----------------------------------------------------
  1084 // ----------------------------------------------------
  1143 // CRadioEngine::MrftoStationSeekComplete
  1085 // CRadioEngine::MrftoStationSeekComplete
  1144 //
  1086 //
  1198     {
  1140     {
  1199     FTRACE(FPrint(_L("CRadioEngine::MrftoFmTransmitterStatusChange() - Active = %d"), aActive));
  1141     FTRACE(FPrint(_L("CRadioEngine::MrftoFmTransmitterStatusChange() - Active = %d"), aActive));
  1200     if ( aActive )
  1142     if ( aActive )
  1201         {
  1143         {
  1202         // loses tuner control
  1144         // loses tuner control
  1203         iTunerControl = EFalse;
  1145         iTunerControl = EStateRadioTunerControlOff;
  1204         }
  1146         }
  1205     }
  1147     }
  1206 
  1148 
  1207 
  1149 
  1208 // ----------------------------------------------------
  1150 // ----------------------------------------------------
  1214     TBool aAttached )
  1156     TBool aAttached )
  1215     {
  1157     {
  1216     FTRACE(FPrint(_L("CRadioEngine::MrftoAntennaStatusChange() - Antenna Status = %d"), aAttached));
  1158     FTRACE(FPrint(_L("CRadioEngine::MrftoAntennaStatusChange() - Antenna Status = %d"), aAttached));
  1217     if ( aAttached )
  1159     if ( aAttached )
  1218         {
  1160         {
  1219         if ( !iTunerControl )
  1161         if ( iTunerControl == EStateRadioTunerControlOff )
  1220             {
  1162             {
  1221             iFmTunerUtility->RequestTunerControl();
  1163             iFmTunerUtility->RequestTunerControl();
  1222             }
  1164             }
  1223         iRadioSettings->SetHeadsetConnected();
  1165         iRadioSettings->SetHeadsetConnected();
  1224         TRAP_IGNORE( iPubSub->PublishAntennaStatusL( EFMRadioPSHeadsetConnected ) );
  1166         TRAP_IGNORE( iPubSub->PublishAntennaStatusL( EFMRadioPSHeadsetConnected ) );
  1236 // ----------------------------------------------------
  1178 // ----------------------------------------------------
  1237 // CRadioEngine::FlightModeChanged
  1179 // CRadioEngine::FlightModeChanged
  1238 // Called when offline mode status changes
  1180 // Called when offline mode status changes
  1239 // ----------------------------------------------------
  1181 // ----------------------------------------------------
  1240 //
  1182 //
  1241 void CRadioEngine::MrftoOfflineModeStatusChange(
  1183 void CRadioEngine::MrftoOfflineModeStatusChange( TBool aOfflineMode )
  1242     TBool aOfflineMode )
       
  1243     {
  1184     {
  1244     FTRACE(FPrint(_L("CRadioEngine::MrftoOfflineModeStatusChange() - Offline Mode = %d"), aOfflineMode));
  1185     FTRACE(FPrint(_L("CRadioEngine::MrftoOfflineModeStatusChange() - Offline Mode = %d"), aOfflineMode));
  1245 
  1186 
  1246     if( aOfflineMode )
  1187     if ( aOfflineMode )
  1247         {
  1188         {
  1248         HandleFlightModeEnabled();
  1189         HandleFlightModeEnabled();
  1249         }
  1190         }
  1250     else
  1191     else
  1251         {
  1192         {
  1252         if ( !iTunerControl )
  1193         if ( iTunerControl == EStateRadioTunerControlOff )
  1253             {
  1194             {
  1254             iFmTunerUtility->RequestTunerControl();
  1195             iFmTunerUtility->RequestTunerControl();
  1255             }
  1196             }
  1256         HandleFlightModeDisabled();
  1197         HandleFlightModeDisabled();
  1257         }
  1198         }
  1359             if ( ( aError == KErrDied ) ||
  1300             if ( ( aError == KErrDied ) ||
  1360                     ( aError == KErrAccessDenied ) ||
  1301                     ( aError == KErrAccessDenied ) ||
  1361                     ( aError == KErrNotReady ) ||
  1302                     ( aError == KErrNotReady ) ||
  1362                     ( aError == KErrInUse ) )
  1303                     ( aError == KErrInUse ) )
  1363                 {
  1304                 {
  1364                 TInt callState = KErrUnknown;
  1305                 // check call status
  1365                 
  1306                 if ( iSystemEventDetector->IsCallActive() )
  1366                 RMobileCall::TMobileCallStatus linestatus;
       
  1367                 
       
  1368                 if ( ilineConstructed )
       
  1369 					{
       
  1370                 	iLine.GetMobileLineStatus( linestatus );
       
  1371                 	}
       
  1372                 FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() linestatus = %d"), linestatus));
       
  1373                 
       
  1374                 TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
       
  1375                 FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() callState = %d"), callState));
       
  1376                                 
       
  1377                 // check status from line
       
  1378                 if ( linestatus != RMobileCall::EStatusIdle &&
       
  1379                      linestatus != RMobileCall::EStatusUnknown ||
       
  1380                      iSystemEventDetector->IsCallActive() )
       
  1381                     {
  1307                     {
  1382                     FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() EFMRadioEventCallStarted")  ) );
  1308                     FTRACE(FPrint(_L("CRadioEngine::MrpoStateChange() EFMRadioEventCallStarted") ) );
  1383                     iInCall = ETrue;
  1309                     iInCall = ETrue;
  1384                     ret = MRadioEngineStateChangeCallback::EFMRadioEventCallStarted;
  1310                     ret = MRadioEngineStateChangeCallback::EFMRadioEventCallStarted;
  1385                     }
  1311                     }
  1386                 }
  1312                 }
  1387             else if ( aError == KErrHardwareNotAvailable ) // Radio is interrupted by FM Transmitter activation.
  1313             else if ( aError == KErrHardwareNotAvailable ) // Radio is interrupted by FM Transmitter activation.
  1502 // CRadioEngine::AudioResourcesAvailableL
  1428 // CRadioEngine::AudioResourcesAvailableL
  1503 // This callback notifies when audio resources become available.
  1429 // This callback notifies when audio resources become available.
  1504 // -----------------------------------------------------------------------------
  1430 // -----------------------------------------------------------------------------
  1505 //
  1431 //
  1506 void CRadioEngine::AudioResourcesAvailableL()
  1432 void CRadioEngine::AudioResourcesAvailableL()
  1507 	{
  1433     {
  1508 	FTRACE( FPrint( _L("CRadioEngine::AudioResourcesAvailableL()" ) ) );
  1434     FTRACE( FPrint( _L("CRadioEngine::AudioResourcesAvailableL()" ) ) );
  1509 	if ( iPubSub && !iInCall && iTunerControl ) // if iPubSub exists, then the ConstructL has been successfully completed
  1435     // if iPubSub exists, then the ConstructL has been successfully completed
  1510 		{
  1436     if ( iPubSub && !iInCall && iTunerControl == EStateRadioTunerControlOn ) 
  1511 	    HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceAvailable, KErrNone );
  1437         {
  1512 		}
  1438         HandleCallback(MRadioEngineStateChangeCallback::EFMRadioEventAudioResourceAvailable, KErrNone );
  1513 	}
  1439         }
       
  1440     }
  1514 
  1441 
  1515 // -----------------------------------------------------------------------------
  1442 // -----------------------------------------------------------------------------
  1516 // CRadioEngine::AudioAutoResumeForbiddenL
  1443 // CRadioEngine::AudioAutoResumeForbiddenL
  1517 // This callback notifies when audio auto resuming is forbidden.
  1444 // This callback notifies when audio auto resuming is forbidden.
  1518 // -----------------------------------------------------------------------------
  1445 // -----------------------------------------------------------------------------
  1530 // CRadioEngine::CallActivatedCallbackL
  1457 // CRadioEngine::CallActivatedCallbackL
  1531 // This callback notifies when call becomes active.
  1458 // This callback notifies when call becomes active.
  1532 // -----------------------------------------------------------------------------
  1459 // -----------------------------------------------------------------------------
  1533 //
  1460 //
  1534 void CRadioEngine::CallActivatedCallbackL()
  1461 void CRadioEngine::CallActivatedCallbackL()
  1535 	{
  1462     {
  1536 	FTRACE( FPrint( _L("CRadioEngine::CallActivatedCallbackL()" ) ) );
  1463     FTRACE( FPrint( _L("CRadioEngine::CallActivatedCallbackL()" ) ) );
  1537 	// no implementation needed, CRadioEngine::MrpoStateChange handles call startup		
  1464     iInCall = ETrue;
  1538 	}
  1465     }
  1539 	
  1466 
  1540 // -----------------------------------------------------------------------------
  1467 // -----------------------------------------------------------------------------
  1541 // CRadioEngine::CallDeactivatedCallbackL
  1468 // CRadioEngine::CallDeactivatedCallbackL
  1542 // This callback notifies when call becomes deactive.
  1469 // This callback notifies when call becomes deactive.
  1543 // -----------------------------------------------------------------------------
  1470 // -----------------------------------------------------------------------------
  1544 //
  1471 //
  1825 // CRadioEngine::RequestTunerControl
  1752 // CRadioEngine::RequestTunerControl
  1826 // request tuner control from RadioFmTunerUtility
  1753 // request tuner control from RadioFmTunerUtility
  1827 // ----------------------------------------------------
  1754 // ----------------------------------------------------
  1828 //
  1755 //
  1829 EXPORT_C void CRadioEngine::RequestTunerControl() const
  1756 EXPORT_C void CRadioEngine::RequestTunerControl() const
  1830 	{
  1757     {
  1831 	// Before first RequestTunerControl() call it is ok to enable offline mode without checking capabilities 
  1758     FTRACE( FPrint( _L("CRadioEngine::RequestTunerControl()")) );
  1832     iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
  1759     if ( iTunerControl == EStateRadioTunerControlUninitialized )
  1833     iFmTunerUtility->RequestTunerControl();	
  1760         {
  1834 	}
  1761         // first request for tuner control.
       
  1762         iFmTunerUtility->RequestTunerControl();
       
  1763         }
       
  1764     }
  1835 
  1765 
  1836 // ----------------------------------------------------
  1766 // ----------------------------------------------------
  1837 // CRadioEngine::DecimalCount
  1767 // CRadioEngine::DecimalCount
  1838 // return decimal count for current region MHz information
  1768 // return decimal count for current region MHz information
  1839 // ----------------------------------------------------
  1769 // ----------------------------------------------------