--- a/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp Tue Feb 02 01:08:46 2010 +0200
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp Fri Apr 16 15:29:42 2010 +0300
@@ -20,14 +20,14 @@
// INCLUDE FILES
#include <mmf/common/mmfstandardcustomcommands.h>
#include <centralrepository.h>
-#include <coreapplicationuissdkcrkeys.h>
-#include <audiopreference.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <AudioPreference.h>
#include "RadioServer.h"
#include "RadioServerSession.h"
#include "RadioServerShutdown.h"
#include "RadioServerSettings.h"
-#include "RadioServerFmTuner.h"
+#include "RadioServerFMTuner.h"
#include "RadioDebug.h"
// CONSTANTS
@@ -70,7 +70,8 @@
iMaxSigStrength(0),
iEnableTunerInOffline(EFalse),
iSquelch(EFalse),
- iPreEmpted(EFalse)
+ iPreEmpted(EFalse),
+ iSchedulerWait( NULL )
{
}
@@ -127,6 +128,8 @@
iMapper = CTspClientMapper::NewL();
iTspState = CTspClientMapper::ERegisteredClients;
#endif // RD_TSP_CLIENT_MAPPER
+
+ iSchedulerWait = new (ELeave) CActiveSchedulerWait;
RADIO_RDEBUG(_L("[RADIO-SVR] ConstructL() - End"));
}
@@ -166,6 +169,7 @@
delete iTunerControl;
delete iTunerControlObserver;
delete iAsyncRequest;
+ delete iSchedulerWait;
ClearQueue();
iRdsNotifyClientIdArray.Close();
@@ -619,6 +623,11 @@
}
break;
case EStateTunerOff:
+ if( iSchedulerWait->IsStarted() )
+ {
+ // let the PlayError() continue after this callback
+ iSchedulerWait->AsyncStop();
+ }
if ( iAsyncRequest && iAsyncRequest->iType == ERadioServSetFrequencyRange )
{
if ( aError == KErrNone )
@@ -639,6 +648,14 @@
CompleteAsyncRequest(aError);
}
}
+ else
+ {
+ if( aError == KRadioServErrDuplicateRequest )
+ {
+ // tuner off and duplicate request going on, trace it out
+ RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - EStateTunerOff - KRadioServErrDuplicateRequest"));
+ }
+ }
break;
default:
// should never happen
@@ -1387,7 +1404,7 @@
iDevSound->SetVolume(iSettings->Volume());
iSquelch = EFalse;
}
- CompleteAsyncRequest(KRadioServErrTuning);
+ // do not yet complete async request with KRadioServErrTuning
}
// We are being pre-empted by another application with higher priority.
@@ -1395,8 +1412,18 @@
iState = EStateTunerOff;
iPreEmpted = ETrue;
iSettings->SetRadioOff(aError);
- iTunerControl->TunerOff();
+ iTunerControl->TunerOff(); //The adaptation is expected to call TunerOffComplete() upon completion
+ // wait for TunerOffComplete callback
+ iSchedulerWait->Start();
SetTspTargetClient( ERsPlayerIdle );
+
+ if ( iAsyncRequest && ( (iAsyncRequest->iType == ERadioServStationSeek) ||
+ (iAsyncRequest->iType == ERadioServStationSeekByPTY) ||
+ (iAsyncRequest->iType == ERadioServStationSeekByTA) ||
+ (iAsyncRequest->iType == ERadioServStationSeekByTP) ) )
+ {
+ CompleteAsyncRequest(KRadioServErrTuning);
+ }
}
}
@@ -1901,6 +1928,7 @@
{
// Client has requested stop only if the requesting client is the only primary client.
// There are other clients, so don't stop the audio in this case.
+ CompleteAsyncRequest(KErrNone); //the request needs to be completed though
return;
}
iState = EStateTunerOn;