equal
deleted
inserted
replaced
49 const TInt KRadioVolumeStepsDividinglimit = 20; |
49 const TInt KRadioVolumeStepsDividinglimit = 20; |
50 /** If CMMTunerUtility has 200 volume steps, AknVolume control has 20 steps */ |
50 /** If CMMTunerUtility has 200 volume steps, AknVolume control has 20 steps */ |
51 const TInt KRadioVolumeStepsDivider = 500; |
51 const TInt KRadioVolumeStepsDivider = 500; |
52 /** amount of volume steps used previously */ |
52 /** amount of volume steps used previously */ |
53 #if defined __WINS__ |
53 #if defined __WINS__ |
54 const TInt KRadioVolumeStepsOld = 10; |
54 const TInt KRadioVolumeStepsWins = 20; |
55 #endif // defined __WINS__ |
55 #endif // defined __WINS__ |
56 |
56 |
57 /** KRadioRadioSwitchDelay value must not be too small, otherwise problems with |
57 /** KRadioRadioSwitchDelay value must not be too small, otherwise problems with |
58 radioserver will occur, when swithing between valid and invalid presets */ |
58 radioserver will occur, when swithing between valid and invalid presets */ |
59 const TInt KRadioRadioSwitchDelay = 300; // In milliseconds |
59 const TInt KRadioRadioSwitchDelay = 300; // In milliseconds |
230 TRadioRegion CRadioEngineImp::DetermineRegion() |
230 TRadioRegion CRadioEngineImp::DetermineRegion() |
231 { |
231 { |
232 LEVEL3( LOG_METHOD_AUTO ); |
232 LEVEL3( LOG_METHOD_AUTO ); |
233 TRadioRegion region = ERadioRegionNone; |
233 TRadioRegion region = ERadioRegionNone; |
234 |
234 |
|
235 //TODO: Reimplement in QT side and remove the mobile network functionality |
235 MRadioEngineSettings& engineSettings = iSettings->EngineSettings(); |
236 MRadioEngineSettings& engineSettings = iSettings->EngineSettings(); |
236 if ( iSystemEventCollector->IsMobileNetworkCoverage() ) |
237 if ( iSystemEventCollector->IsMobileNetworkCoverage() ) |
237 { |
238 { |
238 region = RegionFromMobileNetwork(); |
239 region = RegionFromMobileNetwork(); |
239 } |
240 } |
298 } |
299 } |
299 |
300 |
300 // Utilities have been created now |
301 // Utilities have been created now |
301 iRadioInitializationState = ERadioUtilitiesConstructed; |
302 iRadioInitializationState = ERadioUtilitiesConstructed; |
302 |
303 |
303 // Before first RequestTunerControl() call it is ok to enable offline mode without checking capabilities |
304 RequestTunerControl(); |
304 iTunerUtility->EnableTunerInOfflineMode( ETrue ); |
|
305 iTunerUtility->RequestTunerControl(); |
|
306 } |
305 } |
307 |
306 |
308 // --------------------------------------------------------------------------- |
307 // --------------------------------------------------------------------------- |
309 // |
308 // |
310 // --------------------------------------------------------------------------- |
309 // --------------------------------------------------------------------------- |
333 if ( !RadioInitialized() && |
332 if ( !RadioInitialized() && |
334 iRadioInitializationState == ERadioUtilitiesConstructed && |
333 iRadioInitializationState == ERadioUtilitiesConstructed && |
335 iRadioEnabled && |
334 iRadioEnabled && |
336 OkToPlay( iSettings->EngineSettings().TunedFrequency() ) ) |
335 OkToPlay( iSettings->EngineSettings().TunedFrequency() ) ) |
337 { |
336 { |
338 iTunerUtility->RequestTunerControl(); |
337 RequestTunerControl(); |
339 } |
338 } |
340 else |
339 else |
341 { |
340 { |
342 PowerOn(); |
341 PowerOn(); |
343 } |
342 } |
484 else if ( aPowerOn && |
483 else if ( aPowerOn && |
485 iRadioInitializationState == ERadioUtilitiesConstructed && |
484 iRadioInitializationState == ERadioUtilitiesConstructed && |
486 iRadioEnabled && |
485 iRadioEnabled && |
487 OkToPlay( iSettings->EngineSettings().TunedFrequency() ) ) |
486 OkToPlay( iSettings->EngineSettings().TunedFrequency() ) ) |
488 { |
487 { |
489 iTunerUtility->RequestTunerControl(); |
488 RequestTunerControl(); |
490 } |
489 } |
491 else |
490 else |
492 { |
491 { |
493 LOG( "CRadioEngineImp::SwitchPower - Unhandled case" ); |
492 LOG( "CRadioEngineImp::SwitchPower - Unhandled case" ); |
494 LOG_FORMAT( "PowerOn: %d, InitializationState: %d, Enabled: %d, Frequency: %d", |
493 LOG_FORMAT( "PowerOn: %d, InitializationState: %d, Enabled: %d, Frequency: %d", |
587 } |
586 } |
588 else // This shouldn't occur normally, just a recovery action |
587 else // This shouldn't occur normally, just a recovery action |
589 { |
588 { |
590 HandlePowerEvent( EFalse, KErrNone ); |
589 HandlePowerEvent( EFalse, KErrNone ); |
591 } |
590 } |
|
591 } |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // Requests tuner control from tuner utility |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CRadioEngineImp::RequestTunerControl() |
|
599 { |
|
600 LOG_METHOD_AUTO; |
|
601 |
|
602 if ( iRadioInitializationState < ERadioTunerControlRequested ) |
|
603 { |
|
604 LOG( "Requesting tuner control" ); |
|
605 // Before first RequestTunerControl() say that it is ok to enable offline mode without checking capabilities |
|
606 iTunerUtility->EnableTunerInOfflineMode( ETrue ); |
|
607 iTunerUtility->RequestTunerControl(); |
|
608 |
|
609 iRadioInitializationState = ERadioTunerControlRequested; |
|
610 } |
|
611 else |
|
612 { |
|
613 LOG( "Tuner control already requested" ); |
592 } |
614 } |
593 } |
615 } |
594 |
616 |
595 // --------------------------------------------------------------------------- |
617 // --------------------------------------------------------------------------- |
596 // |
618 // |
921 MrftoAntennaStatusChange( aAntennaAttached ); |
943 MrftoAntennaStatusChange( aAntennaAttached ); |
922 #endif |
944 #endif |
923 } |
945 } |
924 |
946 |
925 // --------------------------------------------------------------------------- |
947 // --------------------------------------------------------------------------- |
926 // If CRadioPlayerUtility has 10 steps, CAknVolumeControl has also 10 steps and also |
948 // Determine the meximum volume level by dividing the maximum volume setting |
927 // the maximum volume level of Visual radio is 10. Otherwise CRadioPlayerUtility has |
949 // received from player utility to get the desired 20 volume steps |
928 // 200 steps, and CAknVolumeControl has 20 steps, so maximum volume level of Visual radio |
|
929 // is 20. |
|
930 // --------------------------------------------------------------------------- |
950 // --------------------------------------------------------------------------- |
931 // |
951 // |
932 TInt CRadioEngineImp::MaxVolumeLevel() const |
952 TInt CRadioEngineImp::MaxVolumeLevel() const |
933 { |
953 { |
934 LEVEL3( LOG_METHOD_AUTO ); |
954 LEVEL3( LOG_METHOD_AUTO ); |
935 TInt maxLevel = 0; |
955 TInt maxLevel = 0; |
936 |
956 |
937 #if defined __WINS__ |
957 #if defined __WINS__ |
938 maxLevel = KRadioVolumeStepsOld; |
958 maxLevel = KRadioVolumeStepsWins; |
939 #else |
959 #else |
940 if ( RadioInitialized() ) |
960 if ( RadioInitialized() ) |
941 { |
961 { |
942 iPlayerUtility->GetMaxVolume( maxLevel ); |
962 iPlayerUtility->GetMaxVolume( maxLevel ); |
943 } |
963 } |
1001 void CRadioEngineImp::DoNotifyRadioEventL( TInt aRadioEvent, TInt aErrorCode ) |
1021 void CRadioEngineImp::DoNotifyRadioEventL( TInt aRadioEvent, TInt aErrorCode ) |
1002 { |
1022 { |
1003 LOG_METHOD_AUTO; |
1023 LOG_METHOD_AUTO; |
1004 TInt count = iObservers.Count(); |
1024 TInt count = iObservers.Count(); |
1005 |
1025 |
1006 for ( TInt i = 0; i<count; i++) |
1026 for ( TInt i = 0; i < count; ++i ) |
1007 { |
1027 { |
1008 MRadioEngineObserver * observer = iObservers[i]; |
1028 MRadioEngineObserver* observer = iObservers[i]; |
1009 |
1029 |
1010 switch ( aRadioEvent ) |
1030 switch ( aRadioEvent ) |
1011 { |
1031 { |
1012 case ERadioEventPower: |
1032 case ERadioEventPower: |
1013 { |
1033 { |
1249 iRadioInitializationState = ERadioUtilitiesConstructed; |
1269 iRadioInitializationState = ERadioUtilitiesConstructed; |
1250 } |
1270 } |
1251 |
1271 |
1252 iSeekingState = RadioEngine::ERadioNotSeeking; |
1272 iSeekingState = RadioEngine::ERadioNotSeeking; |
1253 |
1273 |
1254 if ( aFrequency == 0 ) { |
1274 if ( aFrequency == 0 ) |
|
1275 { |
1255 NotifyRadioEvent( ERadioEventFrequency, aError ); |
1276 NotifyRadioEvent( ERadioEventFrequency, aError ); |
1256 } |
1277 } |
1257 |
|
1258 // if ( aError != KErrNone ) |
|
1259 // { |
|
1260 // iFreqEventReason = RadioEngine::ERadioFrequencyEventReasonImplicit; |
|
1261 // NotifyRadioEvent( ERadioEventFrequency, KErrNone ); // Frequency change is not otherwise notified when seeking fails. |
|
1262 // } |
|
1263 // else |
|
1264 // { |
|
1265 // // sometimes frequency change is not reported even if seeking succeeds |
|
1266 // if ( !iFrequencySetByRdsAf ) |
|
1267 // { |
|
1268 // NotifyRadioEvent( ERadioEventFrequency, KErrNone ); |
|
1269 // } |
|
1270 // } |
|
1271 } |
1278 } |
1272 |
1279 |
1273 // --------------------------------------------------------------------------- |
1280 // --------------------------------------------------------------------------- |
1274 // |
1281 // |
1275 // --------------------------------------------------------------------------- |
1282 // --------------------------------------------------------------------------- |
1638 { |
1645 { |
1639 iRdsReceiver->StopReceiver(); |
1646 iRdsReceiver->StopReceiver(); |
1640 } |
1647 } |
1641 } |
1648 } |
1642 |
1649 |
1643 if ( !iSettings->EngineSettings().IsPowerOn() ) |
1650 if ( !aPowerOn ) |
1644 { |
1651 { |
1645 CancelSeek(); |
1652 CancelSeek(); |
1646 } |
1653 } |
1647 |
1654 |
1648 // If we are seeking, power event starts seeking |
1655 // If we are seeking, power event starts seeking |
1649 if ( iSeekingState != RadioEngine::ERadioNotSeeking && iSettings->EngineSettings().IsPowerOn() ) |
1656 if ( iSeekingState != RadioEngine::ERadioNotSeeking && aPowerOn ) |
1650 { |
1657 { |
1651 // Reset seeking state to enable seeking start |
1658 // Reset seeking state to enable seeking start |
1652 LOG( "PowerOn event in seekingstate. Restart seeking" ); |
1659 LOG( "PowerOn event in seekingstate. Restart seeking" ); |
1653 RadioEngine::TRadioSeeking oldSeeking = iSeekingState; |
1660 RadioEngine::TRadioSeeking oldSeeking = iSeekingState; |
1654 iSeekingState = RadioEngine::ERadioNotSeeking; |
1661 iSeekingState = RadioEngine::ERadioNotSeeking; |