Revision: 201035
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 17 Sep 2010 08:33:15 +0300
changeset 52 4ce423f34688
parent 47 c2e43643db4c
child 55 e267340986c9
Revision: 201035 Kit: 201037
khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp
khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h
khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c
khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h
khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c
khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h
khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c
khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h
khronosfws/openmax_al/src/mmf_adaptation/xaradioadaptctx.c
khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c
khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h
khronosfws/openmax_al/src/radio/xaradiodevice.c
khronosfws/openmax_al/src/radio/xaradioitf.c
khronosfws/openmax_al/src/radio/xaradioitf.h
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpDataSourceAdapter/Src/3gpDataSourceAdapter.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Bwins/DataSourceAdapteru.def
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/EABI/DataSourceAdapteru.def
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Inc/DataSourceAdapter.h
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Src/DataSourceAdapter.cpp
mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp
mmfenh/enhancedmediaclient/Plugins/FileSource/src/FileSource.cpp
mmfenh/enhancedmediaclient/Plugins/FileSource/src/MmffilePriv.h
mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg
mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h
mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp
mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp
mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg
mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.pkg
mmmw_plat/system_tone_service_api/tsrc/init/testframework.ini
mmserv/sts/group/systemtoneservice.mmp
mmserv/sts/inc/stsdebug.h
mmserv/sts/src/systemtoneservice.cpp
mmserv/sts/sts/group/sts.mmp
mmserv/sts/sts/src/sts.cpp
mmserv/sts/sts/src/stsplayer.cpp
mmserv/sts/sts/src/stssettingsmanager.cpp
package_definition.xml
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -19,9 +19,8 @@
 
 extern "C" {
 #include "xaradioitfadaptation.h"
-#include "xanokiavolumeextitfadaptationmmf.h"
-#include "xanokialinearvolumeitfadaptationmmf.h"
-#include "xaplayitfadaptationmmf.h"
+#include "xaadaptationmmf.h"
+#include "xaadptbasectx.h"
 }
 
 CMMFRadioBackendEngine *CMMFRadioBackendEngine::s_instance = 0;
@@ -42,22 +41,21 @@
 void CMMFRadioBackendEngine::DeleteInstance()
 {
     if (iFmTunerUtility)
-  {
-    iFmTunerUtility->Close();
-    iFmTunerUtility = NULL;
-  }
-  if (iRadioPlayerUtility)
-  {
-    iRadioPlayerUtility->Close();
-    iRadioPlayerUtility = NULL;
-  }
+    {
+        iFmTunerUtility->Close();
+        iFmTunerUtility = NULL;
+    }
+    if (iRadioPlayerUtility)
+    {
+        iRadioPlayerUtility->Close();
+        iRadioPlayerUtility = NULL;
+    }
 
-  if (iRadioUtility)
-  {
+    if (iRadioUtility)
+    {
         delete iRadioUtility;
         iRadioUtility = NULL;
     }
-
 }
 
 CMMFRadioBackendEngine::~CMMFRadioBackendEngine()
@@ -79,10 +77,10 @@
     if (iFmTunerUtility)
     {
         iFmTunerUtility->EnableTunerInOfflineMode( ETrue );
-        iFmTunerUtility->RequestTunerControl();
+        iFmTunerUtility->RequestTunerControl();  
     }
-  if (iRadioUtility)
-  {
+    if (iRadioUtility)
+    {
         iRadioPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this );
     }
 
@@ -92,40 +90,41 @@
     iDefaultMinFreq = RADIO_DEFAULT_MIN_FREQ;
     iDefaultMaxFreq = RADIO_DEFAULT_MAX_FREQ;
 
+    iAdaptContext = (XAAdaptationBaseCtx*)CMMFRadioBackendEngine::Instance();
+
 }
-void CMMFRadioBackendEngine::StationSeek(XAboolean aUpwards)
+void CMMFRadioBackendEngine::StationSeek(TBool aUpwards)
 {
     if (iFmTunerUtility)
     {
-    iFmTunerUtility->StationSeek(aUpwards);
+        iFmTunerUtility->StationSeek(aUpwards);
     }
 }
 
 void CMMFRadioBackendEngine::SetFrequency(TInt aFreq)
 {
-  DEBUG_API_A1("CMMFRadioBackendEngine::SetFrequency: %d", aFreq);
+//  DEBUG_CPP_API_A1("CMMFRadioBackendEngine::SetFrequency: %d", aFreq);
 
     if (iFmTunerUtility)
     {
-    iFmTunerUtility->SetFrequency(aFreq);
+        iFmTunerUtility->SetFrequency(aFreq);
     }
 }
 
 TInt CMMFRadioBackendEngine::GetFrequency(TInt& aFreq)
 {
-  DEBUG_API("CMMFRadioBackendEngine::GetFrequency");
+//    DEBUG_CPP_API("CMMFRadioBackendEngine::GetFrequency");
     TInt ret = KErrNotFound;
     if (iFmTunerUtility)
     {
-    ret = iFmTunerUtility->GetFrequency(aFreq);
-    if (ret != KErrNone)
-    {
-        aFreq = iDefaultFrequency;
-        ret = KErrNone;
+        ret = iFmTunerUtility->GetFrequency(aFreq);
+        if (ret != KErrNone)
+        {
+            aFreq = iDefaultFrequency;
+            ret = KErrNone;
+        }
     }
-    }
-  DEBUG_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::GetFrequency RET: %d"), ret);
+//  DEBUG_CPP_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret);
     return ret;
 }
 
@@ -134,9 +133,9 @@
     TInt ret = KErrNotFound;
     if (iFmTunerUtility)
     {
-    ret = iFmTunerUtility->GetSignalStrength(aSignalStrength);
+        ret = iFmTunerUtility->GetSignalStrength(aSignalStrength);
     }
-  DEBUG_API_A1("CMMFRadioBackendEngine::GetSignalStrength RET: %d", ret);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::GetSignalStrength RET: %d", ret);
 //  RDebug::Print(_L("CMMFRadioBackendEngine::GetSignalStrength RET: %d"), ret);
     return ret;
 }
@@ -182,15 +181,13 @@
             ret = KErrNone;
         }
     }
-  DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRange RET: %d"), ret);
-  return ret;
+ //   DEBUG_CPP_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret);
+    return ret;
 }
 
 TInt CMMFRadioBackendEngine::GetFreqRangeProperties(TFmRadioFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq)
 {
     TInt ret = KErrNotFound;
-
     if (iFmTunerUtility)
     {
         ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq);
@@ -202,55 +199,50 @@
             ret = KErrNone;
         }
     }
-  DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d"), ret);
-  return ret;
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret);
+    return ret;
 }
 TInt CMMFRadioBackendEngine::GetMaxVolume(TInt& aMaxVol)
 {
     TInt ret = KErrNotFound;
-
     if (iRadioPlayerUtility)
     {
         ret = iRadioPlayerUtility->GetMaxVolume(aMaxVol);
     }
-  return ret;
+    return ret;
 }
 
 TInt CMMFRadioBackendEngine::SetVolume(TInt aVol)
 {
-    TInt ret = KErrNotFound;
-
+    TInt ret = KErrNotFound; 
     if (iRadioPlayerUtility)
     {
         ret = iRadioPlayerUtility->SetVolume(aVol);
     }
-  return ret;
+    return ret;
 }
 
-TInt CMMFRadioBackendEngine::SetMute(XAboolean aMute)
+TInt CMMFRadioBackendEngine::SetMute(TBool aMute)
 {
     TInt ret = KErrNotFound;
-
     if (iRadioPlayerUtility)
     {
         ret = iRadioPlayerUtility->Mute(aMute);
     }
-  return ret;
+    return ret;
 }
 
 TInt CMMFRadioBackendEngine::GetVolume(TInt& aVol)
 {
     TInt ret = KErrNotFound;
-
     if (iRadioPlayerUtility)
     {
         ret = iRadioPlayerUtility->GetVolume(aVol);
     }
-  return ret;
+    return ret;
 }
 
-TInt CMMFRadioBackendEngine::GetForcedMonoReception(XAuint32& aForcedMono)
+TInt CMMFRadioBackendEngine::GetForcedMonoReception(TUint& aForcedMono)
 {
     TInt ret = KErrNotFound;
     TBool forceMono(EFalse);
@@ -265,7 +257,6 @@
         }
     }
 
-
     if (forceMono)
     {
         aForcedMono = XA_STEREOMODE_MONO;
@@ -277,7 +268,7 @@
         else
             aForcedMono = XA_STEREOMODE_AUTO;
     }
-  return ret;
+    return ret;
 }
 
 void CMMFRadioBackendEngine::PlayRadio()
@@ -296,10 +287,10 @@
     }
 }
 
-TInt CMMFRadioBackendEngine::ForceMonoReception(XAuint32 aForcedMono)
+TInt CMMFRadioBackendEngine::ForceMonoReception(TUint aForcedMono)
 {
     TInt ret = KErrNotFound;
-    XAuint32 currentMode;
+    TUint currentMode;
 
     ret = GetForcedMonoReception(currentMode);
     if (ret != XA_RESULT_SUCCESS)
@@ -337,15 +328,14 @@
             }
         }
     }
-  DEBUG_API_A1("CMMFRadioBackendEngine::ForceMonoReception RET: %d", ret);
- // RDebug::Print(_L("CMMFRadioBackendEngine::ForceMonoReception RET: %d"), ret);
-  return ret;
+ //   DEBUG_CPP_API_A1("CMMFRadioBackendEngine::ForceMonoReception RET: %d", ret);
+    return ret;
 }
 
-XAresult CMMFRadioBackendEngine::SetForceMonoFlag()
+XAresult CMMFRadioBackendEngine::SetForceMonoFlag() 
 {
     TInt ret = KErrNotFound;
-    TBool forceMono(EFalse);
+    TBool forceMono;
 
     if (iFmTunerUtility)
     {
@@ -356,9 +346,7 @@
             iForceStereo = ETrue;
             return KErrNone;
         }
-
     }
-
     if (forceMono == XA_STEREOMODE_MONO)
     {
         iForceStereo = EFalse;
@@ -369,16 +357,30 @@
     }
   return ret;
 }
-XAresult CMMFRadioBackendEngine::SetRadioAdaptContext(void * adaptcontext)
+
+TInt CMMFRadioBackendEngine::GetSquelch(TBool& aSquelch)
 {
-    iRadioAdaptContext = adaptcontext;
-    return XA_RESULT_SUCCESS;
+    TInt ret = KErrNotFound;
+    if (iFmTunerUtility)
+    {
+        ret = iFmTunerUtility->GetSquelch(aSquelch);
+    }
+    return ret;
 }
 
-XAresult CMMFRadioBackendEngine::SetPlayerAdaptContext(void * adaptcontext)
+TInt CMMFRadioBackendEngine::SetSquelch(TBool aSquelch)
 {
-    iPlayerAdaptContext = adaptcontext;
-    return XA_RESULT_SUCCESS;
+    TInt ret = KErrNotFound;
+    if (iFmTunerUtility)
+    {
+        ret = iFmTunerUtility->SetSquelch(aSquelch);
+    }
+    return ret;
+}
+
+void CMMFRadioBackendEngine::SetAdaptContext(void * adaptcontext)
+{
+    iAdaptContext = (XAAdaptationBaseCtx*)adaptcontext;
 }
 
 XAresult TranslateError(TInt error)
@@ -390,9 +392,9 @@
             status = XA_RESULT_SUCCESS;
             break;
         // to do: investigate and add other possible errors:
-
+            
        /* case XA_RESULT_PRECONDITIONS_VIOLATED:
-
+ 
             break;
         case XA_RESULT_PARAMETER_INVALID:
 
@@ -404,7 +406,7 @@
 
             break;
         case XA_RESULT_RESOURCE_LOST:
-
+ 
             break;
         case XA_RESULT_IO_ERROR:
 
@@ -416,7 +418,7 @@
 
             break;
         case XA_RESULT_CONTENT_UNSUPPORTED:
-
+ 
             break;
         case XA_RESULT_CONTENT_NOT_FOUND:
 
@@ -441,7 +443,7 @@
             break;
             */
         default:
-            break;
+        	break;
         } // end switch
     return status;
     }
@@ -462,9 +464,10 @@
 // ----------------------------------------------------
 //
 void CMMFRadioBackendEngine::MrftoSquelchChange(
-    TBool /*aSquelch*/ )
+    TBool aSquelch)
 {
-
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoSquelchChange: aSquelch =  %d", aSquelch);
+// Currently, Openmaxal doesn't have event defined to handle this callback
 }
 
 // ----------------------------------------------------
@@ -475,9 +478,8 @@
 void CMMFRadioBackendEngine::MrftoForcedMonoChange(
     TBool aForcedMono )
 {
-  DEBUG_API_A1("CMMFRadioBackendEngine::MrftoForcedMonoChange: aForcedMono =  %d", aForcedMono);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoForcedMonoChange: aForcedMono = %d"), aForcedMono);
-    XARadioItfAdapt_StereoStatusChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aForcedMono);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoForcedMonoChange: aForcedMono =  %d", aForcedMono);
+    XARadioItfAdapt_StereoStatusChange((XAAdaptationBaseCtx*)iAdaptContext, aForcedMono);
 }
 
  // ----------------------------------------------------
@@ -488,9 +490,8 @@
 void CMMFRadioBackendEngine::MrftoFrequencyChange(
     TInt aNewFrequency)
 {
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrftoFrequencyChange: aNewFrequency =  %d", aNewFrequency);
- // RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrequencyChange aNewFrequency = %d"), aNewFrequency);
-    XARadioItfAdapt_FrequencyChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aNewFrequency);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoFrequencyChange: aNewFrequency =  %d", aNewFrequency);
+    XARadioItfAdapt_FrequencyChange((XAAdaptationBaseCtx*)iAdaptContext, aNewFrequency);
 }
 
 // ----------------------------------------------------
@@ -501,9 +502,8 @@
 void CMMFRadioBackendEngine::MrftoFrequencyRangeChange(
     TFmRadioFrequencyRange aNewRange )
 {
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrftoFrequencyRangeChange: aNewRange =  %d", aNewRange);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrequencyRangeChange: aNewRange = %d"), aNewRange);
-    XARadioItfAdapt_FrequencyRangeChange((XAAdaptationBaseCtx*)iRadioAdaptContext, aNewRange);
+ //   DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoFrequencyRangeChange: aNewRange =  %d", aNewRange);
+    XARadioItfAdapt_FrequencyRangeChange((XAAdaptationBaseCtx*)iAdaptContext, aNewRange);
 }
 
 // ----------------------------------------------------
@@ -548,9 +548,9 @@
     TInt aError,
     TInt aFrequency )
 {
-    XARadioItfAdapt_SeekComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError, aFrequency);
+    XARadioItfAdapt_SeekComplete((XAAdaptationBaseCtx*)iAdaptContext, aError, aFrequency);
 }
-
+ 
 // ----------------------------------------------------
 // CMMFRadioBackendEngine::MrftoSetFrequencyComplete
 // ----------------------------------------------------
@@ -558,16 +558,15 @@
 void CMMFRadioBackendEngine::MrftoSetFrequencyComplete(
     TInt aError )
 {
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: aError =  %d", aError);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: aError =  %d", aError);
 //  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoFrrequencyComplete: aError = %d"), aError);
     TInt freq = 0;
-  if (!aError)
+    if (!aError)
     {
         iFmTunerUtility->GetFrequency(freq);
     }
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: new freq is: %d", freq);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: new freq is: %d"), freq);
-    XARadioItfAdapt_SetFrequencyComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError, freq);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyComplete: new freq is: %d", freq);
+    XARadioItfAdapt_SetFrequencyComplete((XAAdaptationBaseCtx*)iAdaptContext, aError, freq);
 }
 
 // ----------------------------------------------------
@@ -578,9 +577,8 @@
 void CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete(
     TInt aError )
 {
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete: aError =  %d", aError);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete: aError = %d"), aError);
-    XARadioItfAdapt_SetFrequencyRangeComplete((XAAdaptationBaseCtx*)iRadioAdaptContext, aError);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrftoSetFrequencyRangeComplete: aError =  %d", aError);
+    XARadioItfAdapt_SetFrequencyRangeComplete((XAAdaptationBaseCtx*)iAdaptContext, aError);
 }
 
 // ----------------------------------------------------
@@ -590,7 +588,7 @@
 void CMMFRadioBackendEngine::MrftoRequestTunerControlComplete(
     TInt aError)
 {
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrftoRequestTunerControlComplete: aError = %d"), aError);
+
 }
 
 // ----------------------------------------------------
@@ -613,7 +611,7 @@
 void CMMFRadioBackendEngine::MrpoMuteChange(
     TBool aMute )
 {
-    XANokiaVolumeExtItfAdapt_MuteChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, aMute);
+    XARadioItfAdapt_MuteChange((XAAdaptationBaseCtx*)iAdaptContext, aMute);
 }
 
 // ----------------------------------------------------
@@ -624,7 +622,7 @@
 void CMMFRadioBackendEngine::MrpoVolumeChange(
     TInt aVolume )
 {
-    XANokiaLinearVolumeItfAdapt_VolumeChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, aVolume);
+    XARadioItfAdapt_VolumeChange((XAAdaptationBaseCtx*)iAdaptContext, aVolume);
 }
 
 // ----------------------------------------------------
@@ -636,129 +634,135 @@
     TPlayerState aState,
     TInt aError )
 {
-    if ( aError )
-    {
-        DEBUG_API_A1("CMMFRadioBackendEngine::MrpoStateChange: aError =  %d", aError);
- //     RDebug::Print(_L("CMMFRadioBackendEngine::MrpoStateChange: aError = %d"), aError);
-    }
+//    if ( aError )
+//    {
+ //       DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrpoStateChange: aError =  %d", aError);
+//    }
 
-    DEBUG_API_A1("CMMFRadioBackendEngine::MrpoStateChange: new state =  %d", aState);
-//  RDebug::Print(_L("CMMFRadioBackendEngine::MrpoStateChange: new state = %d"), aState);
+//    DEBUG_CPP_API_A1("CMMFRadioBackendEngine::MrpoStateChange: new state =  %d", aState);
 
     if ( aState == ERadioPlayerPlaying )
     {
-    XAPlayItfAdaptMMF_StateChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, ETrue);
-    }
+        XARadioItfAdapt_StateChange((XAAdaptationBaseCtx*)iAdaptContext, ETrue);
+    }  
     else  // ERadioPlayerIdle
     {
-    XAPlayItfAdaptMMF_StateChange((XAAdaptationBaseCtx*)iPlayerAdaptContext, EFalse);
+        XARadioItfAdapt_StateChange((XAAdaptationBaseCtx*)iAdaptContext, EFalse);
     }
+
 }
 
 extern "C" {
 
     void* cmmfradiobackendengine_init()
     {
-        return CMMFRadioBackendEngine::Instance();
+    return CMMFRadioBackendEngine::Instance();
     }
 
-    void cmmfradiobackendengine_delete(void* context)
-    {
-        ((CMMFRadioBackendEngine*)(context))->DeleteInstance();
+    void cmmfradiobackendengine_delete(void* pContext)
+    { 
+        ((CMMFRadioBackendEngine*)(pContext))->DeleteInstance();
     }
 
-    void  set_frequency(void* context, XAuint32 freq)
+    void  set_frequency(void* pContext, void* pAdaptcontext, XAuint32 freq)
     {
-        ((CMMFRadioBackendEngine*)(context))->SetFrequency((TInt)freq);
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->SetFrequency((TInt)freq);
     }
 
-    XAresult  get_frequency(void* context, XAuint32* freq)
+    XAresult  get_frequency(void* pContext, XAuint32* pFreq)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetFrequency((TInt&)*freq);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetFrequency((TInt&)*pFreq);
     }
 
-    XAresult  get_signal_strength(void* context, XAuint32* signalStrength)
+    XAresult  get_signal_strength(void* pContext, XAuint32* pSignalStrength)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetSignalStrength((TInt&)*signalStrength);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetSignalStrength((TInt&)*pSignalStrength);
     }
 
-    void station_seek(void* context, XAboolean upwards)
+    void station_seek(void* pContext, XAboolean upwards)
     {
-        ((CMMFRadioBackendEngine*)(context))->StationSeek(upwards);
+        ((CMMFRadioBackendEngine*)(pContext))->StationSeek(upwards);
     }
 
-    void cancel_set_frequency(void* context)
+    void cancel_set_frequency(void* pContext, void* pAdaptcontext)
     {
-        ((CMMFRadioBackendEngine*)(context))->CancelSetFrequency();
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->CancelSetFrequency();
     }
 
-    void cancel_station_seek(void* context)
+    void cancel_station_seek(void* pContext)
     {
-        ((CMMFRadioBackendEngine*)(context))->CancelStationSeek();
+        ((CMMFRadioBackendEngine*)(pContext))->CancelStationSeek();
     }
 
-    void set_freq_range(void* context, XAuint8 range)
+    void set_freq_range(void* pContext, void* pAdaptcontext, XAuint8 range)
     {
-        ((CMMFRadioBackendEngine*)(context))->SetFreqRange((TFmRadioFrequencyRange)range);
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->SetFreqRange((TFmRadioFrequencyRange)range);
     }
 
-    XAresult  get_freq_range(void* context, XAuint8* range)
+    XAresult  get_freq_range(void* pContext, XAuint8* pRange)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetFreqRange((TFmRadioFrequencyRange&)*range);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetFreqRange((TFmRadioFrequencyRange&)*pRange);
     }
 
-    XAresult  get_freq_range_properties(void* context, XAuint8 aRange, XAuint32* aMinFreq, XAuint32* aMaxFreq)
+    XAresult  get_freq_range_properties(void* pContext, XAuint8 aRange, XAuint32* pMinFreq, XAuint32* pMaxFreq)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetFreqRangeProperties((TFmRadioFrequencyRange&) aRange, (TInt&) *aMinFreq, (TInt&) *aMaxFreq);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetFreqRangeProperties((TFmRadioFrequencyRange&) aRange, (TInt&) *pMinFreq, (TInt&) *pMaxFreq);
     }
 
-    XAresult  get_max_volume(void* context, XAmillibel* maxVol)
+    XAresult  get_max_volume(void* pContext, XAmillibel* pMaxVol)
     {
-        return  ((CMMFRadioBackendEngine*)(context))->GetMaxVolume((TInt&)*maxVol);
+        return  ((CMMFRadioBackendEngine*)(pContext))->GetMaxVolume((TInt&)*pMaxVol);
     }
 
-    XAresult  set_volume(void* context, XAuint32 vol)
+    XAresult  set_volume(void* pContext, void* pAdaptcontext, XAuint32 vol)
     {
-        return ((CMMFRadioBackendEngine*)(context))->SetVolume((TInt)vol);
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        return ((CMMFRadioBackendEngine*)(pContext))->SetVolume((TInt)vol);
     }
 
-    XAresult  get_volume(void* context, XAuint32* vol)
+    XAresult  get_volume(void* pContext, XAuint32* pVol)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetVolume((TInt&)*vol);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetVolume((TInt&)*pVol);
     }
 
-    XAresult  set_mute(void* context, XAboolean mute)
+    XAresult  set_mute(void* pContext, void* pAdaptcontext, XAboolean mute)
     {
-        return ((CMMFRadioBackendEngine*)(context))->SetMute(mute);
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        return ((CMMFRadioBackendEngine*)(pContext))->SetMute(mute);
     }
 
-    XAresult  get_stereo_mode(void* context, XAuint32* mode)
+    XAresult  get_stereo_mode(void* pContext, XAuint32* pMode)
     {
-        return ((CMMFRadioBackendEngine*)(context))->GetForcedMonoReception(*mode);
+        return ((CMMFRadioBackendEngine*)(pContext))->GetForcedMonoReception((TUint&)*pMode);
     }
 
-    XAresult  set_stereo_mode(void* context, XAuint32 mode)
+    XAresult  set_stereo_mode(void* pContext, void* pAdaptcontext, XAuint32 mode)
     {
-        return ((CMMFRadioBackendEngine*)(context))->ForceMonoReception(mode);
-    }
-
-    void play_radio(void* context)
-    {
-        ((CMMFRadioBackendEngine*)(context))->PlayRadio();
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        return ((CMMFRadioBackendEngine*)(pContext))->ForceMonoReception(mode);
     }
 
-    void stop_radio(void* context)
+    void play_radio(void* pContext, void* pAdaptcontext)
     {
-        ((CMMFRadioBackendEngine*)(context))->StopRadio();
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->PlayRadio();
     }
 
-    XAresult mmf_set_radio_adapt_context(void * context, void * adaptcontext)
+    void stop_radio(void* pContext, void* pAdaptcontext)
     {
-        return ((CMMFRadioBackendEngine*)(context))->SetRadioAdaptContext(adaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->StopRadio();
     }
-
-    XAresult mmf_set_player_adapt_context(void * context, void * adaptcontext)
+    void get_squelch(void* pContext, XAboolean* pSquelch)
     {
-        return ((CMMFRadioBackendEngine*)(context))->SetPlayerAdaptContext(adaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->GetSquelch((TBool&)*pSquelch);
+    }
+    void set_squelch(void* pContext, void* pAdaptcontext, XAboolean squelch)
+    {
+        ((CMMFRadioBackendEngine*)(pContext))->SetAdaptContext(pAdaptcontext);
+        ((CMMFRadioBackendEngine*)(pContext))->SetSquelch((TBool)squelch);
     }
 }
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h	Fri Sep 17 08:33:15 2010 +0300
@@ -32,7 +32,7 @@
 NONSHARABLE_CLASS(CMMFRadioBackendEngine) : public CBase,
                      public MRadioPlayerObserver,
                      public MRadioFmTunerObserver,
-                     public MRadioPresetObserver          
+                     public MRadioPresetObserver
     {
 public:
 
@@ -40,26 +40,27 @@
     void DeleteInstance();
     ~CMMFRadioBackendEngine();
     
-		void SetFrequency(TInt aFreq);		   
-		TInt GetFrequency(TInt& aFreq);
-		TInt GetSignalStrength(TInt& aFreq);		
-		void StationSeek(XAboolean aUpwards);
-		void CancelSetFrequency();	
-		void CancelStationSeek();	
-		void SetFreqRange(TFmRadioFrequencyRange aRange);	
-		TInt GetFreqRange(TFmRadioFrequencyRange& aRange);
-		TInt GetFreqRangeProperties(TFmRadioFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq);			
-		TInt GetMaxVolume(TInt& aMaxVol);									
-		TInt SetVolume(TInt aVol);		
-		TInt GetVolume(TInt& aVol);
-		TInt SetMute(XAboolean aMute);	
-		TInt GetForcedMonoReception(XAuint32& aForcedMono);
-		TInt ForceMonoReception(XAuint32 aForcedMono);
-		void PlayRadio();		
-		void StopRadio();		
-        XAresult SetRadioAdaptContext(void * adaptcontext);  	
-		XAresult SetPlayerAdaptContext(void * adaptcontext);    					
-						
+    void SetFrequency(TInt aFreq);
+    TInt GetFrequency(TInt& aFreq);
+    TInt GetSignalStrength(TInt& aFreq);
+    void StationSeek(TBool aUpwards);
+    void CancelSetFrequency();
+    void CancelStationSeek();
+    void SetFreqRange(TFmRadioFrequencyRange aRange);
+    TInt GetFreqRange(TFmRadioFrequencyRange& aRange);
+    TInt GetFreqRangeProperties(TFmRadioFrequencyRange& aRange, TInt& aMinFreq, TInt& aMaxFreq);
+    TInt GetMaxVolume(TInt& aMaxVol);
+    TInt SetVolume(TInt aVol);
+    TInt GetVolume(TInt& aVol);
+    TInt SetMute(TBool aMute);
+    TInt GetForcedMonoReception(TUint& aForcedMono);
+    TInt ForceMonoReception(TUint aForcedMono);
+    void PlayRadio();
+    void StopRadio();
+    TInt GetSquelch(TBool& aSquelch);
+    TInt SetSquelch(TBool aSquelch);
+    void SetAdaptContext(void* adaptcontext);
+
     /**
      * From MRadioPlayerObserver.
      * Called when Radio state changed.
@@ -220,52 +221,50 @@
      * @param aChange Change event type
      * @param aIndex Index to the preset that has changed. Zero means all presets.
      */
-    void MrpeoPresetChanged( TPresetChangeEvent aChange, TInt aIndex ); 
+    void MrpeoPresetChanged( TPresetChangeEvent aChange, TInt aIndex );
        
 private:
     static CMMFRadioBackendEngine* s_instance;
     CMMFRadioBackendEngine();
     void ConstructL();
-	XAresult TranslateError(TInt error);    
-	XAresult SetForceMonoFlag();		 
+    XAresult TranslateError(TInt error);
+    XAresult SetForceMonoFlag();
 
-private:      
-    CRadioUtility* 				iRadioUtility; 
-    CRadioFmTunerUtility* 	    iFmTunerUtility;
-    CRadioPlayerUtility* 		iRadioPlayerUtility;
-    TBool						iForceStereo;
-    void* 						iRadioAdaptContext;
-    void* 						iPlayerAdaptContext;    
-    TFmRadioFrequencyRange 		iDefaultFreqRange;
-    XAuint32 					iDefaultFrequency; 
-    TInt 						iDefaultMinFreq;
-    TInt 						iDefaultMaxFreq; 
+private:
+    CRadioUtility*          iRadioUtility; 
+    CRadioFmTunerUtility*   iFmTunerUtility;
+    CRadioPlayerUtility*    iRadioPlayerUtility;
+    TBool                   iForceStereo;
+    void*                   iAdaptContext;
+    TFmRadioFrequencyRange  iDefaultFreqRange;
+    TUint                   iDefaultFrequency;     
+    TInt                    iDefaultMinFreq;
+    TInt                    iDefaultMaxFreq; 
        
     };
-    
+
 #else  /* __cplusplus */
 
-extern void*     	cmmfradiobackendengine_init(void);
-extern void      	cmmfradiobackendengine_delete(void* context);
-extern void      	set_frequency(void* context, XAuint32 freq);
-extern void  			cancel_set_frequency(void* context);
-extern void 			station_seek(void* context, XAboolean upwards);    
-extern void 			cancel_station_seek(void* context);        
-extern XAresult  	get_frequency(void* context, XAuint32* freq);
-extern XAresult 	get_signal_strength(void* context, XAuint32* signalStrength);
-extern void 		 	set_freq_range(void* context, XAuint8 range);
-extern XAresult  	get_freq_range(void* context, XAuint8* range);   
-extern XAresult  	get_freq_range_properties(void* context, XAuint8 range, XAuint32* aMinFreq, XAuint32* aMaxFreq);
-extern XAresult  	set_stereo_mode(void* context, XAuint32 mode);
-extern XAresult  	get_stereo_mode(void* context, XAuint32* mode);
-extern XAresult  	mmf_set_radio_adapt_context(void * context, void * adaptcontext);
-extern XAresult  	mmf_set_player_adapt_context(void * context, void * adaptcontext);
-extern void         stop_radio(void * context);
-extern void         play_radio(void* context);
-extern XAresult     set_volume(void* context, XAuint32 vol);
-extern XAresult     get_volume(void* context, XAuint32* vol);
-extern XAresult     mmf_set_player_adapt_context(void * context, void * adaptcontext);
-extern XAresult     set_mute(void* context, XAboolean mute);
+extern void*        cmmfradiobackendengine_init(void);
+extern void         cmmfradiobackendengine_delete(void* pContext);
+extern void         set_frequency(void* pContext, void* pAdaptcontext, XAuint32 freq);
+extern void         cancel_set_frequency(void* pContext);
+extern void         station_seek(void* pContext, void* pAdaptcontext, XAboolean upwards);
+extern void         cancel_station_seek(void* pContext);
+extern XAresult     get_frequency(void* pContext, XAuint32* pFreq);
+extern XAresult     get_signal_strength(void* pContext, XAuint32* pSignalStrength);
+extern void         set_freq_range(void* pContext, void* pAdaptcontext, XAuint8 range);
+extern XAresult     get_freq_range(void* pContext, XAuint8* pRange);
+extern XAresult     get_freq_range_properties(void* pContext, XAuint8 range, XAuint32* pMinFreq, XAuint32* pMaxFreq);
+extern XAresult     set_stereo_mode(void* pContext, void* pAdaptcontext, XAuint32 mode);
+extern XAresult     get_stereo_mode(void* pContext, XAuint32* pMode);
+extern void         stop_radio(void* pContext, void* pAdaptcontext);
+extern void         play_radio(void* pContext, void* pAdaptcontext);
+extern XAresult     set_volume(void* pContext, void* pAdaptcontext, XAuint32 vol);
+extern XAresult     get_volume(void* pContext, XAuint32* pVol);
+extern XAresult     set_mute(void* pContext, void* pAdaptcontext, XAboolean mute);
+extern XAresult     get_squelch(void* pContext, XAboolean* pSquelch);
+extern XAresult     set_squelch(void* pContext, void* pAdaptcontext, XAboolean squelch);
 #endif /* __cplusplus */
 
 #endif /* CMMFRADIOBACKENDENGINE_H */
--- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c	Fri Sep 17 08:33:15 2010 +0300
@@ -49,12 +49,11 @@
         }
     else if (ctx->baseObj.ctxId == XARadioAdaptation)
         {
-        mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);
         res = get_volume(cmmfradiobackendengine_init(), &vol);
         *percentage = vol;
         }      
 
-    DEBUG_API_A1("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel %d", percentage);
+    DEBUG_API_A1("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel %d", (int)percentage);
     return res;
 }
 
@@ -98,8 +97,7 @@
         }
     else if (ctx->baseObj.ctxId == XARadioAdaptation)
         {
-        mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);
-        res = set_volume(cmmfradiobackendengine_init(), percentage);
+        res = set_volume(cmmfradiobackendengine_init(), ctx, percentage);
         }
     DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel");
     return res;
@@ -130,17 +128,5 @@
     return res;
     }
 
-void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx,
-        TInt aVolume)
-    {
-    XAAdaptEvent event =
-        {
-        XA_NOKIALINEARVOLITFEVENTS, XA_ADAPT_VOLUME_VOLUME_CHANGED, 1, 0
-        };
-    if (ctx)
-        {
-        event.data = &aVolume;
-        XAAdaptationBase_SendAdaptEvents(ctx, &event);
-        }
-    }
 
+
--- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h	Fri Sep 17 08:33:15 2010 +0300
@@ -36,7 +36,4 @@
 XAresult XANokiaLinearVolumeItfAdapt_GetStepCount(XAAdaptationMMFCtx *ctx,
         XAuint32 * pStepCount);
 
-void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx,
-        TInt volume);
-
 #endif /* XANOKIALINEARVOLUMEITFADAPTATIONMMF_H */
--- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c	Fri Sep 17 08:33:15 2010 +0300
@@ -92,8 +92,7 @@
         }
     else if (ctx->baseObj.ctxId == XARadioAdaptation)
         {
-        mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);
-        res = set_mute(cmmfradiobackendengine_init(), mute);
+        res = set_mute(cmmfradiobackendengine_init(), ctx, mute);
         }
 
     DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute");
@@ -175,17 +174,3 @@
     return res;
     }
 
-void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx,
-        XAboolean aMute)
-    {
-    XAAdaptEvent event =
-        {
-        XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED, 1, 0
-        };
-    if (ctx)
-        {
-        event.data = &aMute;
-        XAAdaptationBase_SendAdaptEvents(ctx, &event);
-        }
-    }
-
--- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h	Fri Sep 17 08:33:15 2010 +0300
@@ -37,7 +37,4 @@
 XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx,
         XApermille stereoPosition);
 
-void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx,
-        XAboolean aMute);
-
 #endif /* XANOKIAVOLUMEEXTITFADAPTATIONMMF_H */
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c	Fri Sep 17 08:33:15 2010 +0300
@@ -47,7 +47,7 @@
     mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
 
 
-    DEBUG_API_A1("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state));
+//    DEBUG_API_A1_STR("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state));
 
     /* bCtx and parameter pointer validation happens in the calling function.
      * We don't need to repeat it here*/
@@ -57,9 +57,7 @@
             {
             if (bCtx->ctxId == XARadioAdaptation)
                 {
-                mmf_set_player_adapt_context(cmmfradiobackendengine_init(),
-                        bCtx);
-                stop_radio(cmmfradiobackendengine_init());
+                stop_radio(cmmfradiobackendengine_init(), bCtx);
                 }
             else
                 {
@@ -74,9 +72,7 @@
             {
             if (bCtx->ctxId == XARadioAdaptation)
                 {
-                mmf_set_player_adapt_context(cmmfradiobackendengine_init(),
-                        bCtx);
-                play_radio(cmmfradiobackendengine_init());
+                play_radio(cmmfradiobackendengine_init(), bCtx);
                 }
             else
                 {
@@ -300,28 +296,4 @@
     DEBUG_API("<-XAPlayItfAdaptMMF_SetPositionUpdatePeriod");
     return ret;
     }
-/*
- * XAresult XAPlayItfAdapt_StateChange
- * Handle callback from Radio utility 
- */
-void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx,
-        XAboolean playing)
-    {
-    if (playing)
-        {
-        XAAdaptEvent event =
-            {
-            XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 1, 0
-            };
-        XAAdaptationBase_SendAdaptEvents(bCtx, &event);
-        }
-    else
-        {
-        XAAdaptEvent event =
-            {
-            XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED, 1, 0
-            };
-        XAAdaptationBase_SendAdaptEvents(bCtx, &event);
-        }
 
-    }
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h	Fri Sep 17 08:33:15 2010 +0300
@@ -48,6 +48,4 @@
 XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx);
 XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx,
         XAmillisecond mSec);
-void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx,
-        XAboolean playing);
 #endif /* XAPLAYITFADAPTATIONMMF_H */
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaradioadaptctx.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaradioadaptctx.c	Fri Sep 17 08:33:15 2010 +0300
@@ -18,7 +18,6 @@
 #include "xaradioadaptctx.h"
 #include "xaadaptationmmf.h"
 #include "cmmfradiobackendengine.h"
-#include "assert.h"
 
 /*
  * XAAdaptationMMFCtx* XARadioAdapt_Create()
@@ -32,21 +31,20 @@
 
     if ( pSelf)
     {
-        if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XARadioAdaptation)
-                    != XA_RESULT_SUCCESS )
-      	{
-        	DEBUG_ERR("Failed to init base context!!!");
-         	free(pSelf);
-        	pSelf = NULL;
-        	return (XAAdaptationBaseCtx*)pSelf;
-      	}
-     		else
-       	{
-       		pSelf->range = RADIO_DEFAULT_FREQ_RANGE;
-        	pSelf->frequency = RADIO_DEFAULT_FREQ;
-        	pSelf->rdsEmulationThread = 0;
-       		pSelf->emulationThread = 0;
-       	}
+        if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XARadioAdaptation) != XA_RESULT_SUCCESS )
+        {
+            DEBUG_ERR("Failed to init base context!!!");
+            free(pSelf);
+            pSelf = NULL;
+            return (XAAdaptationBaseCtx*)pSelf;
+        }
+        else
+        {
+            pSelf->range = RADIO_DEFAULT_FREQ_RANGE;
+            pSelf->frequency = RADIO_DEFAULT_FREQ;
+            pSelf->rdsEmulationThread = 0;
+            pSelf->emulationThread = 0;
+        }
     }
 
     DEBUG_API("<-XARadioAdapt_Create");
@@ -69,8 +67,6 @@
         return XA_RESULT_PARAMETER_INVALID;
     }
     ctx = (XARadioAdaptationCtx*)bCtx;
-    assert(ctx);
-
     ret = XAAdaptationBase_PostInit( &ctx->baseObj.baseObj );
     if( ret!=XA_RESULT_SUCCESS )
     {
@@ -79,7 +75,12 @@
         return ret;
     }
 
-		cmmfradiobackendengine_init(); 
+    if (cmmfradiobackendengine_init() == NULL)
+    {
+        DEBUG_ERR("Creation of Radio Backend Engine failed!!");
+        DEBUG_API("<-XARadioAdapt_PostInit");
+        return XA_RESULT_RESOURCE_ERROR;
+    }
 
     DEBUG_API("<-XARadioAdapt_PostInit");
     return ret;
@@ -92,10 +93,10 @@
  */
 void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx)
 {
-		XARadioAdaptationCtx* ctx = NULL;
+    XARadioAdaptationCtx* ctx = NULL;
     DEBUG_API("->XARadioAdapt_Destroy");
-    
-		cmmfradiobackendengine_delete(cmmfradiobackendengine_init());    
+
+    cmmfradiobackendengine_delete(cmmfradiobackendengine_init());
 
     if(bCtx == NULL || bCtx->ctxId != XARadioAdaptation )
     {
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c	Fri Sep 17 08:33:15 2010 +0300
@@ -16,21 +16,22 @@
 */
 
 #include <unistd.h>
+#include <openMAXAL.h>
 #include "xadebug.h"
 #include "xaadaptationmmf.h"
 #include "xaradioitfadaptation.h"
 #include "xaradioadaptctx.h"
 #include "cmmfradiobackendengine.h"
 
+
 /*
  * XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationMMFCtx *bCtx, XAuint8 range)
  */
 XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationMMFCtx *bCtx, XAuint8 range)
 {
     XAresult ret = XA_RESULT_SUCCESS;  
-    DEBUG_API("->XARadioItfAdapt_SetFreqRange");    
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);		
-    set_freq_range(cmmfradiobackendengine_init(), range);    
+    DEBUG_API("->XARadioItfAdapt_SetFreqRange");
+    set_freq_range(cmmfradiobackendengine_init(), bCtx, range);
     DEBUG_API("<-XARadioItfAdapt_SetFreqRange");
     return ret;
 }
@@ -41,9 +42,9 @@
  */
 XAresult XARadioItfAdapt_GetFreqRange(XAuint8 * pFreqRange)
 {
-    XAresult res = XA_RESULT_SUCCESS;    
-    DEBUG_API("->XARadioItfAdapt_GetFreqRange");    
- 		res = get_freq_range(cmmfradiobackendengine_init(), pFreqRange);
+    XAresult res = XA_RESULT_SUCCESS;
+    DEBUG_API("->XARadioItfAdapt_GetFreqRange");
+    res = get_freq_range(cmmfradiobackendengine_init(), pFreqRange);
     DEBUG_API("<-XARadioItfAdapt_GetFreqRange");
     return res;
 }
@@ -56,14 +57,15 @@
                                              XAboolean * pSupported)
 {
     XAresult ret = XA_RESULT_SUCCESS;
-    DEBUG_API("->XARadioItfAdapt_IsFreqRangeSupported");    
+    DEBUG_API("->XARadioItfAdapt_IsFreqRangeSupported");
     if ((range == XA_FREQRANGE_FMEUROAMERICA) || (range == XA_FREQRANGE_FMJAPAN)) 
-        {	
- 			*pSupported = XA_BOOLEAN_TRUE;   
- 		}
- 		else
- 			*pSupported = XA_BOOLEAN_FALSE;
- 			 
+    {
+        *pSupported = XA_BOOLEAN_TRUE;
+    }
+    else
+    {
+        *pSupported = XA_BOOLEAN_FALSE;
+    }
     DEBUG_API("<-XARadioItfAdapt_IsFreqRangeSupported");
     return ret;
 }
@@ -81,8 +83,7 @@
 {
     XAresult res = XA_RESULT_SUCCESS;    
     DEBUG_API("->XARadioItfAdapt_GetFreqRangeProperties");
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);		
- 		res = get_freq_range_properties(cmmfradiobackendengine_init(), range, pMinFreq, pMaxFreq); 					 		
+    res = get_freq_range_properties(cmmfradiobackendengine_init(), range, pMinFreq, pMaxFreq);	
     DEBUG_API("<-XARadioItfAdapt_GetFreqRangeProperties");
     return res;
 }
@@ -93,9 +94,8 @@
 XAresult XARadioItfAdapt_SetFrequency(XAAdaptationMMFCtx *bCtx, XAuint32 freq)
 {
     XAresult ret = XA_RESULT_SUCCESS; 
-    DEBUG_API("->XARadioItfAdapt_SetFrequency");    
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);
-    set_frequency(cmmfradiobackendengine_init(), freq);    
+    DEBUG_API("->XARadioItfAdapt_SetFrequency");
+    set_frequency(cmmfradiobackendengine_init(), bCtx, freq);
     DEBUG_API("<-XARadioItfAdapt_SetFrequency");
     return ret;
 }
@@ -108,10 +108,10 @@
 XAresult XARadioItfAdapt_GetFrequency(XAuint32* pFrequency)
 {
     XAresult ret = XA_RESULT_SUCCESS;
-    DEBUG_API("->XARadioItfAdapt_GetFrequency");	
-		ret = get_frequency(cmmfradiobackendengine_init(), pFrequency);       
-   DEBUG_API("<-XARadioItfAdapt_GetFrequency");
-   return ret;
+    DEBUG_API("->XARadioItfAdapt_GetFrequency");
+    ret = get_frequency(cmmfradiobackendengine_init(), pFrequency);
+    DEBUG_API("<-XARadioItfAdapt_GetFrequency");
+    return ret;
 }
 
 
@@ -122,7 +122,7 @@
 {
     XAresult ret = XA_RESULT_SUCCESS;
     DEBUG_API("->XARadioItfAdapt_CancelSetFrequency");
-		cancel_set_frequency(cmmfradiobackendengine_init());     
+    cancel_set_frequency(cmmfradiobackendengine_init());
     DEBUG_API("<-XARadioItfAdapt_CancelSetFrequency");
     return ret;
 }
@@ -130,19 +130,23 @@
 /*
  * XAresult XARadioItfAdapt_SetSquelch(XAboolean squelch)
  */
-XAresult XARadioItfAdapt_SetSquelch(XAboolean squelch)
-{	
-    XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED;	
+XAresult XARadioItfAdapt_SetSquelch(XAAdaptationMMFCtx *bCtx, XAboolean squelch)
+{
+    XAresult res = XA_RESULT_SUCCESS;
     DEBUG_API("->XARadioItfAdapt_SetSquelch");
-    return ret;
+    set_squelch(cmmfradiobackendengine_init(), bCtx, squelch);
+    DEBUG_API("->XARadioItfAdapt_SetSquelch");
+    return res;
 }
 
 /*
  * XAresult XARadioItfAdapt_GetSquelch(XAboolean *squelch)
  */
-XAresult XARadioItfAdapt_GetSquelch(XAboolean* squelch)
+XAresult XARadioItfAdapt_GetSquelch(XAboolean* pSquelch)
 {
-    XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED;	
+    XAresult ret = XA_RESULT_SUCCESS;
+    DEBUG_API("->XARadioItfAdapt_GetSquelch");
+    get_squelch(cmmfradiobackendengine_init(), pSquelch);
     DEBUG_API("->XARadioItfAdapt_GetSquelch");
     return ret;
 }
@@ -152,10 +156,9 @@
  */
 XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationMMFCtx *bCtx, XAuint32 mode)
 {
-		XAresult res = XA_RESULT_SUCCESS;   	
+    XAresult res = XA_RESULT_SUCCESS;
     DEBUG_API("->XARadioItfAdapt_SetStereoMode");
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);
-    res = set_stereo_mode(cmmfradiobackendengine_init(), mode);    
+    res = set_stereo_mode(cmmfradiobackendengine_init(), bCtx, mode);
     DEBUG_API("<-XARadioItfAdapt_SetStereoMode");
     return res;
 }
@@ -165,9 +168,9 @@
  */
 XAresult XARadioItfAdapt_GetSignalStrength(XAuint32 * pStrength)
 {
- 		XAresult ret = XA_RESULT_SUCCESS;   	
-    DEBUG_API("->XARadioItfAdapt_GetSignalStrength");  		
-		ret = get_signal_strength(cmmfradiobackendengine_init(), pStrength);    
+    XAresult ret = XA_RESULT_SUCCESS;
+    DEBUG_API("->XARadioItfAdapt_GetSignalStrength");
+    ret = get_signal_strength(cmmfradiobackendengine_init(), pStrength);
     DEBUG_API("<-XARadioItfAdapt_GetSignalStrength");
     return ret;
 }
@@ -177,11 +180,9 @@
  */
 XAresult XARadioItfAdapt_Seek(XAAdaptationMMFCtx *bCtx, XAboolean upwards)
 {
-    XAresult ret = XA_RESULT_SUCCESS;          
- 		
-   	DEBUG_API("->XARadioItfAdapt_Seek");	    
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);     	
-		station_seek(cmmfradiobackendengine_init(), upwards);   				
+    XAresult ret = XA_RESULT_SUCCESS;
+    DEBUG_API("->XARadioItfAdapt_Seek");
+    station_seek(cmmfradiobackendengine_init(), bCtx, upwards);
     DEBUG_API("<-XARadioItfAdapt_Seek");
     return ret;
 }
@@ -192,8 +193,7 @@
 void XARadioItfAdapt_StopSeeking(XAAdaptationMMFCtx *bCtx)
 {
     DEBUG_API("->XARadioItfAdapt_StopSeeking");	
-    mmf_set_radio_adapt_context(cmmfradiobackendengine_init(), bCtx);	
-		cancel_station_seek(cmmfradiobackendengine_init());   
+    cancel_station_seek(cmmfradiobackendengine_init());
     DEBUG_API("<-XARadioItfAdapt_StopSeeking");
 }
 
@@ -202,9 +202,9 @@
  */
 XAresult XARadioItfAdapt_GetStereoMode(XAuint32 * pMode)
 {
- 		XAresult ret = XA_RESULT_SUCCESS;   	
-    DEBUG_API("->XARadioItfAdapt_GetStereoMode");  		
-		ret = get_stereo_mode(cmmfradiobackendengine_init(), pMode);    
+    XAresult ret = XA_RESULT_SUCCESS;
+    DEBUG_API("->XARadioItfAdapt_GetStereoMode");
+    ret = get_stereo_mode(cmmfradiobackendengine_init(), pMode);
     DEBUG_API("<-XARadioItfAdapt_GetStereoMode");
     return ret;
 }
@@ -215,100 +215,138 @@
 void XARadioItfAdapt_Free()
 {
     DEBUG_API("->XARadioItfAdapt_Free");
-    
 }
 
 void XARadioItfAdapt_SeekComplete(XAAdaptationBaseCtx *ctx, TInt aError, TInt aFrequency)
 {
-   	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE,1,0};        	
-		if (ctx)
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE,1,0};
+    if (ctx)
     {
-    	if (aError)
-    	{
-    		event.data = &aError;
-    	}
-    	else
-    	{
-   			event.data = &aFrequency;
-   		}
-   		
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}   
+        if (aError)
+        {
+            event.data = &aError;
+        }
+        else
+        {
+            event.data = &aFrequency;
+        }
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
 }
 
 void XARadioItfAdapt_FrequencyChange(XAAdaptationBaseCtx *ctx, TInt aFrequency)
 {
-		// Currently: Bug in FM Radio Utility: SetFrequency calls this callback as well as SetFrequencyComplete
-		// (So client will end up getting 2 events on a SetFrequency call)
-   	XAuint32 freq = aFrequency;    		
-    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED,1,0};        	
-		if (ctx)
+    // Currently: Bug in FM Radio Utility: SetFrequency calls this callback as well as SetFrequencyComplete
+    // (So client will end up getting 2 events on a SetFrequency call)
+    XAuint32 freq = aFrequency;    		
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED,1,0};
+    if (ctx)
     {
-    	event.data = &freq;
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}  
+        event.data = &freq;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
 }
 
 void XARadioItfAdapt_FrequencyRangeChange(XAAdaptationBaseCtx* ctx, TInt aFreqRangeChange)
 {
-		// Currently: Bug in FM Radio Utility: SetFrequencyRange triggers this callback as well as SetFrequencyRangeComplete
-		
+    // Currently: Bug in FM Radio Utility: SetFrequencyRange triggers this callback as well as SetFrequencyRangeComplete
    /*	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED,1,0};        	
 		if (baseCtx)
     {
     	event.data = &aFreqRangeChange;
      	XAAdaptationBase_SendAdaptEvents(&baseCtx->baseObj, &event );
    	} 
-   	*/  
+   	*/
 }
 
 void XARadioItfAdapt_SetFrequencyComplete(XAAdaptationBaseCtx *ctx, TInt aError, TInt aFrequency)
 {
-		// Currently: Qt API has no event for SetFrequencyComplete, so must use this one:
-   	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED,1,0};   
-   	XAuint32 freq = aFrequency;     	
-		if (ctx)
+    // Currently: Qt API has no event for SetFrequencyComplete, so must use this one:
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED,1,0};   
+    XAuint32 freq = aFrequency;
+    if (ctx)
     {
-    	if (!aError)
-    	{
-    		event.data = &freq;
-    	}
-    	else
-    	{
-    		event.data = &aError;
-    	}
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}   
+        if (!aError)
+        {
+            event.data = &freq;
+        }
+        else
+        {
+            event.data = &aError;
+        }
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
 }
 
 void XARadioItfAdapt_SetFrequencyRangeComplete(XAAdaptationBaseCtx *ctx, TInt aError)
 {
-   	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED,1,0};        	
-		if (ctx)
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED,1,0};
+    if (ctx)
     {
-    	event.data = &aError;
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}   
+        event.data = &aError;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
 }
 
 void XARadioItfAdapt_StereoStatusChange(XAAdaptationBaseCtx *ctx, XAboolean aStereoStatus)
 {
-   	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_STEREO_STATUS_CHANGED,1,0}; 
-  	DEBUG_INFO_A1("XARadioItfAdapt_StereoStatusChange to: %s", aStereoStatus);	   	       	
-		if (ctx)
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_STEREO_STATUS_CHANGED,1,0}; 
+    DEBUG_INFO_A1("XARadioItfAdapt_StereoStatusChange to: %s", aStereoStatus);
+    if (ctx)
     {
-    	event.data = &aStereoStatus;
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}   
+        event.data = &aStereoStatus;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
 }
 
 void XARadioItfAdapt_SignalStrengthChange(XAAdaptationBaseCtx *ctx, TInt aSignalStrength)
 {
-   	XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SIGNAL_STRENGTH_CHANGED,1,0}; 
-  	DEBUG_INFO_A1("XARadioItfAdapt_SignalStrengthChange to: %s", aSignalStrength);	   	       	
-		if (ctx)
+    XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SIGNAL_STRENGTH_CHANGED,1,0};
+    DEBUG_INFO_A1("XARadioItfAdapt_SignalStrengthChange to: %s", aSignalStrength);
+    if (ctx)
+    {
+        event.data = &aSignalStrength;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event );
+    }
+}
+
+void XARadioItfAdapt_StateChange(XAAdaptationBaseCtx *ctx, XAboolean aState)
+{
+    if (aState) // playing
+    {
+        XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 1, 0};
+        XAAdaptationBase_SendAdaptEvents(ctx, &event);
+    }
+    else  // idle
+    {
+        XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED, 1, 0};
+        XAAdaptationBase_SendAdaptEvents(ctx, &event);
+    }
+}
+
+void XARadioItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt aVolume)
     {
-    	event.data = &aSignalStrength;
-     	XAAdaptationBase_SendAdaptEvents(ctx, &event );
-   	}   
-}
+    XAAdaptEvent event =
+        {
+        XA_NOKIALINEARVOLITFEVENTS, XA_ADAPT_VOLUME_VOLUME_CHANGED, 1, 0
+        };
+    if (ctx)
+        {
+        event.data = &aVolume;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event);
+        }
+    }
+    
+
+void XARadioItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, XAboolean aMute)
+    {
+    XAAdaptEvent event =
+        {
+        XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED, 1, 0
+        };
+    if (ctx)
+        {
+        event.data = &aMute;
+        XAAdaptationBase_SendAdaptEvents(ctx, &event);
+        }
+    }
--- a/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h	Fri Sep 17 08:33:15 2010 +0300
@@ -24,22 +24,23 @@
 
 XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationMMFCtx *bCtx, XAuint8 range);
 
-XAresult XARadioItfAdapt_GetFreqRange(XAuint8 * pFreqRange);
+XAresult XARadioItfAdapt_GetFreqRange(XAuint8* pFreqRange);
 
 XAresult XARadioItfAdapt_IsFreqRangeSupported(XAuint8 range,
                                              XAboolean * pSupported);
 
 XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationMMFCtx *bCtx,
-                                               XAuint8 		range,
-                                               XAuint32 * pMinFreq,
-                                               XAuint32 * pMaxFreq);
+                                               XAuint8  range,
+                                               XAuint32* pMinFreq,
+                                               XAuint32* pMaxFreq);
 
 XAresult XARadioItfAdapt_SetFrequency(XAAdaptationMMFCtx *bCtx, XAuint32 freq);
 
 XAresult XARadioItfAdapt_GetFrequency(XAuint32 * pFrequency);
 
 XAresult XARadioItfAdapt_CancelSetFrequency(void);
-XAresult XARadioItfAdapt_SetSquelch(XAboolean squelch);
+
+XAresult XARadioItfAdapt_SetSquelch(XAAdaptationMMFCtx *bCtx, XAboolean squelch);
 
 XAresult XARadioItfAdapt_GetSquelch(XAboolean* squelch);
 
@@ -69,4 +70,10 @@
 
 void XARadioItfAdapt_SignalStrengthChange(XAAdaptationBaseCtx *ctx, TInt aSignalStrength);
 
+void XARadioItfAdapt_StateChange(XAAdaptationBaseCtx *ctx, XAboolean aState);
+
+void XARadioItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt aVolume);
+
+void XARadioItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, XAboolean aMute);
+
 #endif /* XARADIOITFADAPTATION_H */
--- a/khronosfws/openmax_al/src/radio/xaradiodevice.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/radio/xaradiodevice.c	Fri Sep 17 08:33:15 2010 +0300
@@ -17,7 +17,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
 #include "xaradiodevice.h"
 #include "xaradioitf.h"
 #include "xaconfigextensionsitf.h"
@@ -119,10 +118,14 @@
     }
 
     *pDevice = (XAObjectItf)&(pBaseObj->self);
-    pImpl->adaptationCtx = XARadioAdapt_Create();   
-
+    pImpl->adaptationCtx = XARadioAdapt_Create();
+    if (pImpl->adaptationCtx == NULL)
+    {
+        XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
+        DEBUG_API("<-XARadioDeviceImpl_Create With ERROR");
+        return XA_RESULT_RESOURCE_ERROR;
+    }
     XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
-
     DEBUG_API("<-XARadioDeviceImpl_Create");
     return XA_RESULT_SUCCESS;
 }
@@ -277,10 +280,6 @@
     DEBUG_API("->XARadioDeviceImpl_FreeResources");
     XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSRadio);
 
-    
-    assert( pObj && pImpl && pObj == pObj->self );
-
-
     /* free all allocated interfaces */
     for(itfIdx = 0; itfIdx < RADIO_ITFCOUNT; itfIdx++)
     {
--- a/khronosfws/openmax_al/src/radio/xaradioitf.c	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/radio/xaradioitf.c	Fri Sep 17 08:33:15 2010 +0300
@@ -11,13 +11,12 @@
 *
 * Contributors:
 *
-* Description:
+* Description: 
 *
 */
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <string.h>
 #include "xaradioitf.h"
 #include "xaradioitfadaptation.h"
@@ -197,7 +196,7 @@
     XAuint32 minFreq;
     XAuint32 maxFreq;
    	XAuint32 freqInterval;
-
+        
     XARadioItfImpl* impl = GetImpl(self);
     DEBUG_API("->XARadioItfImpl_SetFrequency");
     XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio);
@@ -209,23 +208,23 @@
         DEBUG_API("<-XARadioItfImpl_SetFrequency");
         return XA_RESULT_PARAMETER_INVALID;
     }
-
-    // Check for valid entries:
- 		ret = XARadioItfImpl_GetFreqRangeProperties(self, range, &minFreq, &maxFreq, &freqInterval);
+    
+    // Check for valid entries: 
+ 		ret = XARadioItfImpl_GetFreqRangeProperties(self, range, &minFreq, &maxFreq, &freqInterval);   
     if (ret != XA_RESULT_SUCCESS)
     {
     	XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
-    	DEBUG_API("<-XARadioItfImpl_SetFrequency");
+    	DEBUG_API("<-XARadioItfImpl_SetFrequency");    	
     	return ret;
-    }
-
+    }		
+    
     if ( (freq < minFreq) || (freq > maxFreq) )
     {
     	XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
-    	DEBUG_API("<-XARadioItfImpl_SetFrequency");
+    	DEBUG_API("<-XARadioItfImpl_SetFrequency");    	
     	return XA_RESULT_PARAMETER_INVALID;
-    }
-
+    }	  
+           
    	ret = XARadioItfAdapt_SetFrequency( (XAAdaptationMMFCtx*)impl->adapCtx, freq );
 
     XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
@@ -312,7 +311,7 @@
 
     if (impl->squelch != squelch)
     {
-        ret = XARadioItfAdapt_SetSquelch( squelch );
+        ret = XARadioItfAdapt_SetSquelch( (XAAdaptationMMFCtx*)impl->adapCtx, squelch );
         if ( ret == XA_RESULT_SUCCESS )
         {
             impl->squelch = squelch;
@@ -373,7 +372,7 @@
         {
          	  impl->stereoMode = mode;
         }
-    }
+    }    
     XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio);
     DEBUG_API("<-XARadioItfImpl_SetStereoMode");
     return ret;
@@ -494,10 +493,11 @@
  * XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets)
  * Description: Returns the number of preset slots the device has for storing the presets.
  **/
-XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets)
+XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32* pNumPresets)
 {
-    XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED;
-
+    XAresult ret = XA_RESULT_SUCCESS;
+    XAuint32 presetValue = 0;
+    pNumPresets = &presetValue;
     DEBUG_API("->XARadioItfImpl_GetNumberOfPresets");
 
     return ret;
@@ -519,7 +519,9 @@
                                   XAuint32 mode,
                                   const XAchar * name)
 {
-    XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED;
+  //  XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED; Currently, this is not a valid error code for OpenMaxAL. Is proposed to be added.
+  
+    XAresult ret = XA_RESULT_PARAMETER_INVALID; // For now, use this error code.
 
     return ret;
 }
@@ -542,9 +544,11 @@
                                   XAchar * pName,
                                   XAuint16 * pNameLength)
 {
-
-    XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED;
-
+ 
+    XAresult ret = XA_RESULT_SUCCESS;
+    if (preset != 0)
+        ret = XA_RESULT_PARAMETER_INVALID;
+        
     DEBUG_API("<-XARadioItfImpl_GetPreset");
     return ret;
 }
@@ -612,6 +616,9 @@
         self->itf.GetSignalStrength = XARadioItfImpl_GetSignalStrength;
         self->itf.Seek = XARadioItfImpl_Seek;
         self->itf.StopSeeking = XARadioItfImpl_StopSeeking;
+        self->itf.GetNumberOfPresets = XARadioItfImpl_GetNumberOfPresets;
+        self->itf.SetPreset = XARadioItfImpl_SetPreset;
+        self->itf.GetPreset = XARadioItfImpl_GetPreset;
         self->itf.RegisterRadioCallback = XARadioItfImpl_RegisterRadioCallback;
 
         /* init variables */
@@ -643,7 +650,6 @@
     XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XARadioItfImpl_AdaptCb );
 
     XARadioItfAdapt_Free();
-    assert(self==self->self);
     free(self);
 
     XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSRadio);
@@ -658,7 +664,7 @@
     XARadioItfImpl* impl =(XARadioItfImpl*)pHandlerCtx;
     XAuint32 eventData = 0;
     XAboolean eventBoolean = XA_BOOLEAN_FALSE;
-
+    
     DEBUG_API("->XARadioItfimpl_AdaptCb");
 
     if(!impl)
@@ -667,41 +673,38 @@
         DEBUG_API("<-XARadioItfImpl_AdaptCb");
         return;
     }
-    assert(event);
-
-    if( event->eventid == XA_ADAPT_RADIO_FREQUENCY_CHANGED && impl->callback )
-    {
-        DEBUG_API("Frequency changed in adaptation");
-        eventData = *(XAuint32*)event->data;
-        impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_FREQUENCY_CHANGED, eventData, eventBoolean );
-    }
-
-    else if( event->eventid == XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED && impl->callback )
-    {
-        DEBUG_API("Frequency range changed in adaptation");
-
-        impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED, eventData, eventBoolean  );
-    }
-
-    else if( event->eventid == XA_ADAPT_RADIO_SEEK_COMPLETE && impl->callback )
+    
+    if (event)
     {
-        DEBUG_API("Seek complete in adaptation");
-       	eventBoolean = *(XAboolean*)event->data;
-        impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_SEEK_COMPLETED, eventData, eventBoolean  );
-    }
-
-    else if( event->eventid == XA_ADAPT_RADIO_STEREO_STATUS_CHANGED && impl->callback )
-    {
-        DEBUG_API("Stereo status change in adaptation");
-      	eventBoolean = *(XAboolean*)event->data;
-        impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_STEREO_STATUS_CHANGED, eventData, eventBoolean  );
-    }
-
-    else if( event->eventid == XA_ADAPT_RADIO_SIGNAL_STRENGTH_CHANGED && impl->callback )
-    {
-        DEBUG_API("Signal Strength Change in adaptation");
-        impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_SIGNAL_STRENGTH_CHANGED, eventData, eventBoolean  );
-    }
+        if( event->eventid == XA_ADAPT_RADIO_FREQUENCY_CHANGED && impl->callback )
+        {
+            DEBUG_API("Frequency changed in adaptation"); 
+            eventData = *(XAuint32*)event->data;
+            impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_FREQUENCY_CHANGED, eventData, eventBoolean );
+        }
+        else if( event->eventid == XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED && impl->callback )
+        {
+            DEBUG_API("Frequency range changed in adaptation");
+            impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED, eventData, eventBoolean  );
+        }
+        else if( event->eventid == XA_ADAPT_RADIO_SEEK_COMPLETE && impl->callback )
+        {
+            DEBUG_API("Seek complete in adaptation");
+       	    eventBoolean = *(XAboolean*)event->data;        
+            impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_SEEK_COMPLETED, eventData, eventBoolean  );     
+        }
+        else if( event->eventid == XA_ADAPT_RADIO_STEREO_STATUS_CHANGED && impl->callback )
+        {
+            DEBUG_API("Stereo status change in adaptation");
+            eventBoolean = *(XAboolean*)event->data;          
+            impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_STEREO_STATUS_CHANGED, eventData, eventBoolean  );
+        } 
+        else if( event->eventid == XA_ADAPT_RADIO_SIGNAL_STRENGTH_CHANGED && impl->callback )
+        {
+            DEBUG_API("Signal Strength Change in adaptation");
+            impl->callback( impl->cbPtrToSelf, impl->context, XA_RADIO_EVENT_SIGNAL_STRENGTH_CHANGED, eventData, eventBoolean  );
+        }
+    }      
     else
     {
         /* do nothing */
--- a/khronosfws/openmax_al/src/radio/xaradioitf.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/khronosfws/openmax_al/src/radio/xaradioitf.h	Fri Sep 17 08:33:15 2010 +0300
@@ -52,10 +52,10 @@
     XARadioItf         cbPtrToSelf;
     xaRadioCallback    callback;
     void               *context;
-   	XAuint32    preset;
-   	XAuint32    numOfPresets;
+    XAuint32    preset;
+    XAuint32    numOfPresets;
 
-    RadioPreset presets[RADIO_NUM_OF_PRESETS];    
+    RadioPreset presets[RADIO_NUM_OF_PRESETS];
 
     /*Adaptation variables*/
     XAAdaptationBaseCtx *adapCtx;
@@ -102,7 +102,7 @@
                                               xaRadioCallback callback,
                                               void * pContext);
                                               
-XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets);
+XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32* pNumPresets);
 
 XAresult XARadioItfImpl_SetPreset(XARadioItf self,
                                   XAuint32 preset,
@@ -117,7 +117,7 @@
                                   XAuint8 * pRange,
                                   XAuint32 * pMode,
                                   XAchar * pName,
-                                  XAuint16 * pNameLength);                                              
+                                  XAuint16 * pNameLength);
 
 /* XARadioItfImpl -specific methods */
 XARadioItfImpl* XARadioItfImpl_Create(XAAdaptationBaseCtx *adapCtx);
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpDataSourceAdapter/Src/3gpDataSourceAdapter.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpDataSourceAdapter/Src/3gpDataSourceAdapter.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -82,6 +82,7 @@
 EXPORT_C C3gpDataSourceAdapter::~C3gpDataSourceAdapter()
     {
     DP0(_L("C3gpDataSourceAdapter::~C3gpDataSourceAdapter"));
+	TRAP_IGNORE(SourceStopL());
 	MP4ParseClose(iMP4Handle);
 	delete iParserBuf;
 	delete iSrcBuf;
@@ -143,11 +144,14 @@
 EXPORT_C void C3gpDataSourceAdapter::SourcePrimeL()
 	{
 	DP0(_L("C3gpDataSourceAdapter::SourcePrimeL"));
-	iDataSource->SourcePrimeL();
-   	if (!iMP4Handle)
-   		{
-   		PrepareMP4ParserL();
-   		}
+	if(iDataSource)
+		{
+		iDataSource->SourcePrimeL();
+		if (!iMP4Handle)
+			{
+			PrepareMP4ParserL();
+			}
+		}	
 	}
 	
 EXPORT_C void C3gpDataSourceAdapter::SourceStopL()
@@ -156,7 +160,10 @@
 	ResetVariables();
 	MP4ParseClose(iMP4Handle);
 	iMP4Handle = NULL;
-	iDataSource->SourceStopL();
+	if(iDataSource)
+		{
+		iDataSource->SourceStopL();
+		}
 	// Clear previously read Audio Frames  
 	iParserBuf->Data().SetLength(0);
 	iParserBuf->SetPosition(0);	
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -824,7 +824,13 @@
 		{
 		iDataSourceAdapter = CDataSourceAdapter::NewL();
 		}
-	iDataSourceAdapter->SetDataSourceL(&aSource, this, this);
+	TRAPD(err,iDataSourceAdapter->SetDataSourceL(&aSource, this, this));
+	if(err)
+		{
+	    DP1(_L("setdatasource left for reason %d"),err);
+	    iDataSourceAdapter->ResetDataSource();
+	    User::Leave(err);
+		}
 	
     iDataSource = &aSource; // remove this eventually when all the references are removed
 	
@@ -856,7 +862,12 @@
         // we don't want to prime in this case
         DP0(_L("CAdvancedAudioPlayController::AddDataSourceL() Prime to get duration"));
         iBlockDuration = ETrue;
-        DoInitializeL(); // to get data from the source to calculate bitrate and duration
+        TRAPD(err,DoInitializeL());// to get data from the source to calculate bitrate and duration
+        if(err)
+            {
+            iDataSourceAdapter->ResetDataSource();
+            User::Leave(err);
+            }
         }
     if ((!iEventsEnabled) && (iDataSourceAdapter->OnlyHeaderPresent()))
         {
@@ -864,7 +875,12 @@
         // the recorder might have to open this file again - and if we keep it open
         // with shared read access, he won't be able to open it for writing.
         // So we will close the file here.
-        iDataSourceAdapter->SourceStopL();
+        TRAPD(err,iDataSourceAdapter->SourceStopL());
+        if(err)
+            {
+            iDataSourceAdapter->ResetDataSource();
+            User::Leave(err);
+            }
         }
     }
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Bwins/DataSourceAdapteru.def	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Bwins/DataSourceAdapteru.def	Fri Sep 17 08:33:15 2010 +0300
@@ -29,4 +29,5 @@
 	?SourcePlayL@CDataSourceAdapter@@UAEXXZ @ 28 NONAME ; void CDataSourceAdapter::SourcePlayL(void)
 	?SourceThreadLogoff@CDataSourceAdapter@@UAEXXZ @ 29 NONAME ; void CDataSourceAdapter::SourceThreadLogoff(void)
 	??0CDataSourceAdapter@@IAE@XZ @ 30 NONAME ; CDataSourceAdapter::CDataSourceAdapter(void)
+	?ResetDataSource@CDataSourceAdapter@@UAEXXZ @ 31 NONAME ; void CDataSourceAdapter::ResetDataSource(void)
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/EABI/DataSourceAdapteru.def	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/EABI/DataSourceAdapteru.def	Fri Sep 17 08:33:15 2010 +0300
@@ -36,4 +36,5 @@
 	_ZTIN18CDataSourceAdapter21CAsyncProxyFillBufferE @ 35 NONAME
 	_ZTV18CDataSourceAdapter @ 36 NONAME
 	_ZTVN18CDataSourceAdapter21CAsyncProxyFillBufferE @ 37 NONAME
+	_ZN18CDataSourceAdapter15ResetDataSourceEv @ 38 NONAME
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Inc/DataSourceAdapter.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Inc/DataSourceAdapter.h	Fri Sep 17 08:33:15 2010 +0300
@@ -103,6 +103,7 @@
 		IMPORT_C virtual TInt EvaluateIntent(ContentAccess::TIntent aIntent);
         IMPORT_C virtual TInt GetInterface(TUid aInterfaceId, TVersion& aVer, TAny*& aInterfaceImpl);
 		IMPORT_C virtual TBool OnlyHeaderPresent();
+		IMPORT_C virtual void ResetDataSource();
 		
 		//sets the AudioOutputControlUtitlity reference and sets Datasource to AudioOutputContolUtility
 		IMPORT_C TInt SetAudioOutputControlUtil(CAudioOutputControlUtility* aAudioOutputControlUtility);
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Src/DataSourceAdapter.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Src/DataSourceAdapter.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -72,11 +72,13 @@
 EXPORT_C CDataSourceAdapter::~CDataSourceAdapter()
     {
 	DP0(_L("CDataSourceAdapter::~CDataSourceAdapter"));
+	TRAP_IGNORE(SourceStopL());
 	delete iAsyncProxyFillBuffer;
     delete iZeroBuffer;
     delete iHdrBuffer;
     if (iMMDataSource)
     	{
+		iMMDataSource->Stop();
     	iMMDataSource->Close();
 	    delete iMMDataSource;	
     	}
@@ -143,7 +145,15 @@
 EXPORT_C TUid CDataSourceAdapter::DataSourceType() 
 	{
 	DP0(_L("CDataSourceAdapter::DataSourceType"));
-	return iDataSource->DataSourceType();
+	if(iDataSource)
+	    {
+	    return iDataSource->DataSourceType();
+	    }
+	else
+	    {
+	    TUid uid={KNullUidValue};
+        return uid;
+	    }
 	}
 
 EXPORT_C void CDataSourceAdapter::FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId)
@@ -155,50 +165,86 @@
 		}
 	else
 		{
-		iDataSource->FillBufferL(aBuffer, aConsumer, aMediaId);
+		if(iDataSource)
+	        {
+			iDataSource->FillBufferL(aBuffer, aConsumer, aMediaId);
+			}
 		}	
 	}
 
 EXPORT_C void CDataSourceAdapter::BufferEmptiedL(CMMFBuffer* aBuffer)
 	{
 	DP0(_L("CDataSourceAdapter::BufferEmptiedL"));
-	iDataSource->BufferEmptiedL(aBuffer);
+		if(iDataSource)
+	        {
+			iDataSource->BufferEmptiedL(aBuffer);
+			}
 	}
 
 EXPORT_C TBool CDataSourceAdapter::CanCreateSourceBuffer()
 	{
 	DP0(_L("CDataSourceAdapter::CanCreateSourceBuffer"));
-	return iDataSource->CanCreateSourceBuffer();
+    if(iDataSource)
+		{	
+		return iDataSource->CanCreateSourceBuffer();
+		}
+	else
+	{
+		return EFalse;
+	}
 	}
 	
 EXPORT_C CMMFBuffer* CDataSourceAdapter::CreateSourceBufferL(TMediaId aMediaId, TBool& aReference)
 	{
 	DP0(_L("CDataSourceAdapter::CreateSourceBufferL"));
-	return iDataSource->CreateSourceBufferL(aMediaId, aReference);
+	if(iDataSource)
+	    {	
+		return iDataSource->CreateSourceBufferL(aMediaId, aReference);
+		}
+	else
+		{
+		return NULL;
+		}
 	}
 
 EXPORT_C TInt CDataSourceAdapter::SourceThreadLogon(MAsyncEventHandler& aEventHandler)
 	{
 	DP0(_L("CDataSourceAdapter::SourceThreadLogon"));
-	return iDataSource->SourceThreadLogon(aEventHandler);
+	if(iDataSource)
+	    {
+	    return iDataSource->SourceThreadLogon(aEventHandler);
+	    }
+	else
+	    {
+	    return KErrGeneral;
+	    }
 	}
 
 EXPORT_C void CDataSourceAdapter::SourceThreadLogoff()
 	{
 	DP0(_L("CDataSourceAdapter::SourceThreadLogoff"));
-	iDataSource->SourceThreadLogoff();
+	if(iDataSource)
+	    {
+	    iDataSource->SourceThreadLogoff();
+	    }
 	}
 
 EXPORT_C void CDataSourceAdapter::SourcePrimeL()
 	{
 	DP0(_L("CDataSourceAdapter::SourcePrimeL"));
-	iDataSource->SourcePrimeL();
+	if(iDataSource)
+	    {
+	    iDataSource->SourcePrimeL();
+	    }
 	}
 	
 EXPORT_C void CDataSourceAdapter::SourceStopL()
 	{
 	DP0(_L("CDataSourceAdapter::SourceStopL"));
-	iDataSource->SourceStopL();
+		if(iDataSource)
+		{
+		iDataSource->SourceStopL();
+	  }
 	if (iAsyncProxyFillBuffer)
 		{
 		iAsyncProxyFillBuffer->Cancel();
@@ -209,7 +255,10 @@
 EXPORT_C void CDataSourceAdapter::SourcePlayL()
 	{
 	DP0(_L("CDataSourceAdapter::SourcePlayL"));
-	iDataSource->SourcePlayL();
+	if(iDataSource)
+	    {
+	    iDataSource->SourcePlayL();
+	    }
 	}
 
 EXPORT_C TInt CDataSourceAdapter::SeekToPosition(TUint aPosition)
@@ -269,8 +318,10 @@
 	DP0(_L("CDataSourceAdapter::SourceSize"));
 	iSourceSize = KErrUnknown;
     if ((iSourceType == KUidMmfFileSource) ||(iSourceType == KUidMmfDescriptorSource))
-    	{
-   		iSourceSize  = static_cast<CMMFClip*>(iDataSource)->Size();
+    	{       if(iDataSource)
+                 {
+   		  iSourceSize  = static_cast<CMMFClip*>(iDataSource)->Size();
+                 }
     	}
 	else if (iMMDataSource)
         {
@@ -293,7 +344,10 @@
 EXPORT_C void CDataSourceAdapter::SetSourcePrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
 	{
 	DP0(_L("CDataSourceAdapter::SetSourcePrioritySettings"));
-	iDataSource->SetSourcePrioritySettings(aPrioritySettings);
+	if(iDataSource)
+         {
+	  iDataSource->SetSourcePrioritySettings(aPrioritySettings);
+         }
 	}
 
 EXPORT_C TBool CDataSourceAdapter::OnlyHeaderPresent()
@@ -405,6 +459,12 @@
 		}
 	}
 
+EXPORT_C void CDataSourceAdapter::ResetDataSource()
+    {
+	DP0(_L("CDataSourceAdapter::ReSetDataSource"));
+    iDataSource = NULL;
+    }
+	
 EXPORT_C TBool CDataSourceAdapter::IsLocalPlayback()
 	{
 	DP1(_L("CDataSourceAdapter::iIsLocalPlayback[%d]"), iIsLocalPlayback);
@@ -482,6 +542,8 @@
 void CDataSourceAdapter::CAsyncProxyFillBuffer::RunL()
 	{
     DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunL"));
+  if(iDataSource)
+    {
     if (iDataSource->DataSourceType() == KUidMmfDescriptorSource)
     	{ 
     	// descriptor has no way to set read position back to 0
@@ -496,6 +558,7 @@
     	{
         iDataSource->FillBufferL(iBuffer,iConsumer,iMediaId);
     	}
+    }
 	if (iQueuedAsyncBuffers.Count() > 0)
 		{
 	    DP1(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunL que count [%d]"),iQueuedAsyncBuffers.Count());
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -724,9 +724,7 @@
 	// NB KErrInUse, KErrDied OR KErrAccessDenied may be returned 
 	// to indicate that the sound device is in use  by another higher 
 	// priority client.
-	if (aError == KErrCancel || aError == KErrInUse || 
-	    aError == KErrDied || aError == KErrAccessDenied)
-		return;
+	
 
 	if (aError == KErrUnderflow)
 		aError = KErrNone;
--- a/mmfenh/enhancedmediaclient/Plugins/FileSource/src/FileSource.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/enhancedmediaclient/Plugins/FileSource/src/FileSource.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  Implementation of FileSource.
-*  Version     : %version: bh1mmcf#5.1.7 %
+*  Version     : %version: bh1mmcf#5.1.8 %
 *
 */
 
@@ -702,9 +702,12 @@
     for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ )
         {
         CReadWriteRequest* request = iRequests[ii];
-        delete request;
-        iRequests.Remove(ii);
-        ii--;
+        if(!request->Processing())
+            {
+            delete request;
+            iRequests.Remove(ii);
+            ii--;
+            }
         }
     }
             
@@ -800,20 +803,6 @@
     return iFile->Seek(ESeekStart, aPosInBytes);
     };
             
-/*
-*	Returns ETrue if the request can safely be deleted.
-*/
-
-TBool CReadWriteRequest::Completed() 
-    {
-    return iCompleted ;
-    }
-            
-TInt CReadWriteRequest::SetStatus(TBool aStatus)
-    {
-    iCompleted = aStatus;
-    return KErrNone;
-    }
 
 TBool CReadWriteRequest::SourceType() 
     {
@@ -878,7 +867,7 @@
 */
 void CReadWriteRequest::DoCancel() 
     {
-    iCompleted = ETrue ;
+    iState = ECompleted;
     }
             
 /*
@@ -887,7 +876,7 @@
 TInt CReadWriteRequest::RunError( TInt aError ) 
     {
     //RunL can leave.
-    iCompleted = ETrue ;
+    iState = ECompleted;
     iError = aError; //keep this error internally for now
     return KErrNone ;
     }
@@ -897,6 +886,7 @@
 */
 void CReadRequest::RunL() 
     {
+    iState = EProcessing;
     //Copy the data from the normal buffer into the Transfer buffer
     if(iTransferBufferCopy)
         {
@@ -908,6 +898,7 @@
         }
 
         STATIC_CAST(CFileMultimediaSource*,iParent)->ReadRequestStatus(STATIC_CAST(CReadWriteRequest*,this),iStatus);
+    iState = ECompleted;
     }
 
         // From CMultimediaDataSource begins
@@ -1372,7 +1363,6 @@
                 
             }
             
-            aRequest->SetStatus(ETrue);
             return KErrNone;		
         }
     }
--- a/mmfenh/enhancedmediaclient/Plugins/FileSource/src/MmffilePriv.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmfenh/enhancedmediaclient/Plugins/FileSource/src/MmffilePriv.h	Fri Sep 17 08:33:15 2010 +0300
@@ -204,8 +204,8 @@
             }
         
         
-        TBool Completed() ;
-        TInt SetStatus(TBool aStatus);
+        inline TBool Processing() const { return iState == EProcessing; }   
+        inline TBool Completed() const { return iState == ECompleted; }
         TDes8& BufferDes() ;
         TBool SourceType();
         const TDesC8& BufferDesC() ;
@@ -234,6 +234,14 @@
         TBool iUseTransferBuffer ;
         void SetTransferBuffer (TBool aTBuffer) ;
         TBool CanUseTransferBuffer () ;
+        enum TState
+            {
+            EActive,
+            EProcessing,
+            ECompleted
+            };
+        
+        TState iState;
     } ;
 
     /**
--- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg	Fri Sep 17 08:33:15 2010 +0300
@@ -30,65 +30,7 @@
 [Endtest]  
 
 [Test]
-title 21.2 RadioItf Get Frequency (DEFAULT)
-create openmaxaltestmodule ALImpl
-ALImpl al_createEngine 1 1 0 0
-ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE
-ALImpl al_engitf_CreateRadioDevice 0
-ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO
-ALImpl al_radioitf_RegisterRadioCallback  
-
-ALImpl al_SetDataLocator 3 5 0 1
-ALImpl al_SetDataSource 3 0 1
-ALImpl al_SetDataSink 3 6 1
-
-ALImpl al_engitf_CreateMediaPlayer 0 
-
-ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
-ALImpl al_playitf_RegisterCallback
-
-ALImpl al_radioitf_GetFrequencyDefault
-
-ALImpl al_objitf_Destroy MO_RADIO
-ALImpl al_objitf_Destroy MO_PLAYER
-ALImpl al_objitf_Destroy MO_ENGINE
-delete ALImpl
-[Endtest] 
-
-[Test]
-title 21.3 RadioItf Get Freq Range (DEFAULT)
-create openmaxaltestmodule ALImpl
-ALImpl al_createEngine 1 1 0 0
-ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE
-ALImpl al_engitf_CreateRadioDevice 0
-ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO
-ALImpl al_radioitf_RegisterRadioCallback  
-
-ALImpl al_SetDataLocator 3 5 0 1
-ALImpl al_SetDataSource 3 0 1
-ALImpl al_SetDataSink 3 6 1
-
-ALImpl al_engitf_CreateMediaPlayer 0 
-
-ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE
-ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
-ALImpl al_playitf_RegisterCallback
-
-ALImpl al_radioitf_GetFreqRangeDefault
-
-ALImpl al_objitf_Destroy MO_RADIO
-ALImpl al_objitf_Destroy MO_PLAYER
-ALImpl al_objitf_Destroy MO_ENGINE
-delete ALImpl
-[Endtest] 
-
-[Test]
-title 21.4 RadioItf Set-Get Freq 106.0 
+title 21.2 RadioItf Set-Get Freq 106.0 
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -123,7 +65,7 @@
 [Endtest] 
 
 [Test]
-title 21.5 RadioItf Set-Get Freq Range
+title 21.3 RadioItf Set-Get Freq Range
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -157,7 +99,7 @@
 [Endtest] 
 
 [Test]
-title 21.6 RadioItf Get FR Properties 
+title 21.4 RadioItf Get FR Properties 
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -191,7 +133,7 @@
 [Endtest] 
 
 [Test]
-title 21.7 RadioItf Is Freq Range Supported
+title 21.5 RadioItf Is Freq Range Supported
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -220,7 +162,7 @@
 [Endtest] 
 
 [Test]
-title 21.8 RadioItf Set Squelch
+title 21.6 RadioItf Set Squelch
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -240,7 +182,11 @@
 ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
 ALImpl al_playitf_RegisterCallback
 
-allownextresult XA_RESULT_FEATURE_UNSUPPORTED
+request Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+ALImpl al_radioitf_SetFrequency 106000000
+wait Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+release Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+
 ALImpl al_radioitf_SetSquelch 1
 
 ALImpl al_objitf_Destroy MO_RADIO
@@ -250,7 +196,7 @@
 [Endtest] 
 
 [Test]
-title 21.9 RadioItf Get Squelch
+title 21.7 RadioItf Get Squelch
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -270,7 +216,11 @@
 ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
 ALImpl al_playitf_RegisterCallback
 
-allownextresult XA_RESULT_FEATURE_UNSUPPORTED
+request Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+ALImpl al_radioitf_SetFrequency 106000000
+wait Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+release Event_XA_RADIO_EVENT_FREQUENCY_CHANGED
+
 ALImpl al_radioitf_GetSquelch 1
 
 ALImpl al_objitf_Destroy MO_RADIO
@@ -280,7 +230,7 @@
 [Endtest] 
 
 [Test]
-title 21.10 RadioItfSetStereoModeMONO
+title 21.8 RadioItfSetStereoModeMONO
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -315,7 +265,7 @@
 [Endtest] 
 
 [Test]
-title 21.11 RadioItf SetStereoModeSTEREO
+title 21.9 RadioItf SetStereoModeSTEREO
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -350,7 +300,7 @@
 [Endtest] 
 
 [Test]
-title 21.12 RadioItf SetStereoModeAUTO
+title 21.10 RadioItf SetStereoModeAUTO
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -384,7 +334,7 @@
 delete ALImpl
 [Endtest] 
 [Test]
-title 21.13 RadioItf Get Signal Strength
+title 21.11 RadioItf Get Signal Strength
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -418,7 +368,7 @@
 [Endtest] 
 
 [Test]
-title 21.14 RadioItf Seek
+title 21.12 RadioItf Seek
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -471,7 +421,7 @@
 [Endtest] 
 
 [Test]
-title 21.15 RadioItf Stop Seeking
+title 21.13 RadioItf Stop Seeking
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -521,7 +471,7 @@
 [Endtest]
 
 [Test]
-title 21.16 RadioItf Cancel Set Freq
+title 21.14 RadioItf Cancel Set Freq
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -550,7 +500,7 @@
 [Endtest]  
 
 [Test]
-title 21.17 RadioItf Set Volume
+title 21.15 RadioItf Set Volume
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -583,7 +533,7 @@
 [Endtest] 
 
 [Test]
-title 21.18 RadioItf Get Step Count
+title 21.16 RadioItf Get Step Count
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -616,7 +566,7 @@
 [Endtest] 
 
 [Test]
-title 21.19 RadioItf SetMute On
+title 21.17 RadioItf SetMute On
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -649,7 +599,7 @@
 [Endtest] 
 
 [Test]
-title 21.20 RadioItf SetMute Off
+title 21.18 RadioItf SetMute Off
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -682,7 +632,7 @@
 [Endtest] 
 
 [Test]
-title 21.21 RadioItf Stop Radio
+title 21.19 RadioItf Stop Radio
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -718,7 +668,7 @@
 [Endtest]  
 
 [Test]
-title 21.22 RadioItf Set Freq ERROR--too big
+title 21.20 RadioItf Set Freq ERROR--too big
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -741,15 +691,15 @@
 
 allownextresult -17
 ALImpl al_radioitf_SetFrequency 109000000
-																
+
 ALImpl al_objitf_Destroy MO_RADIO
 ALImpl al_objitf_Destroy MO_PLAYER
 ALImpl al_objitf_Destroy MO_ENGINE
 delete ALImpl
-[Endtest]   
+[Endtest]
 
 [Test]
-title 21.23 RadioItf Set Invalid Freq Range
+title 21.21 RadioItf Set Invalid Freq Range
 create openmaxaltestmodule ALImpl
 ALImpl al_createEngine 1 1 0 0
 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
@@ -770,15 +720,102 @@
 ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
 ALImpl al_playitf_RegisterCallback
 
-//request Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED
 allownextresult 2
 ALImpl al_radioitf_SetFreqRange 50 
-//wait Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED
-//release Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED
+
+ALImpl al_objitf_Destroy MO_RADIO
+ALImpl al_objitf_Destroy MO_PLAYER
+ALImpl al_objitf_Destroy MO_ENGINE
+delete ALImpl
+[Endtest]
 
+[Test]
+title 21.22 RadioItf Get # of presets
+create openmaxaltestmodule ALImpl
+ALImpl al_createEngine 1 1 0 0
+ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE
+ALImpl al_engitf_CreateRadioDevice 0
+ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO
+ALImpl al_radioitf_RegisterRadioCallback
+
+
+ALImpl al_SetDataLocator 3 5 0 1
+ALImpl al_SetDataSource 3 0 1
+ALImpl al_SetDataSink 3 6 1
+
+ALImpl al_engitf_CreateMediaPlayer 0 
+
+ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
+ALImpl al_playitf_RegisterCallback
+
+ALImpl al_radioitf_GetNumberOfPresets
 
 ALImpl al_objitf_Destroy MO_RADIO
 ALImpl al_objitf_Destroy MO_PLAYER
 ALImpl al_objitf_Destroy MO_ENGINE
 delete ALImpl
-[Endtest]     
\ No newline at end of file
+[Endtest]
+
+[Test]
+title 21.23 RadioItf Set Preset
+create openmaxaltestmodule ALImpl
+ALImpl al_createEngine 1 1 0 0
+ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE
+ALImpl al_engitf_CreateRadioDevice 0
+ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO
+ALImpl al_radioitf_RegisterRadioCallback  
+
+
+ALImpl al_SetDataLocator 3 5 0 1
+ALImpl al_SetDataSource 3 0 1
+ALImpl al_SetDataSink 3 6 1
+
+ALImpl al_engitf_CreateMediaPlayer 0
+
+ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
+ALImpl al_playitf_RegisterCallback
+
+allownextresult 2
+ALImpl al_radioitf_SetPreset 1
+
+ALImpl al_objitf_Destroy MO_RADIO
+ALImpl al_objitf_Destroy MO_PLAYER
+ALImpl al_objitf_Destroy MO_ENGINE
+delete ALImpl
+[Endtest]
+
+[Test]
+title 21.24 RadioItf Get Preset
+create openmaxaltestmodule ALImpl
+ALImpl al_createEngine 1 1 0 0
+ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE
+ALImpl al_engitf_CreateRadioDevice 0
+ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO
+ALImpl al_radioitf_RegisterRadioCallback  
+
+
+ALImpl al_SetDataLocator 3 5 0 1
+ALImpl al_SetDataSource 3 0 1
+ALImpl al_SetDataSink 3 6 1
+
+ALImpl al_engitf_CreateMediaPlayer 0
+
+ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE
+ALImpl al_objitf_GetInterface 4 XA_IID_PLAY
+ALImpl al_playitf_RegisterCallback
+
+ALImpl al_radioitf_GetPreset 0
+
+ALImpl al_objitf_Destroy MO_RADIO
+ALImpl al_objitf_Destroy MO_PLAYER
+ALImpl al_objitf_Destroy MO_ENGINE
+delete ALImpl
+[Endtest]
\ No newline at end of file
--- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h	Fri Sep 17 08:33:15 2010 +0300
@@ -370,8 +370,9 @@
         virtual TInt al_radioitf_Seek(CStifItemParser& aItem );
         virtual TInt al_radioitf_StopSeeking(CStifItemParser& aItem ); 
        	virtual TInt al_radioitf_RegisterRadioCallback(CStifItemParser& aItem ); 
-        virtual TInt al_radioitf_GetFrequencyDefault( CStifItemParser& aItem);
-        virtual TInt al_radioitf_GetFreqRangeDefault( CStifItemParser& aItem );
+        virtual TInt al_radioitf_GetNumberOfPresets( CStifItemParser& aItem);
+        virtual TInt al_radioitf_SetPreset( CStifItemParser& aItem);
+        virtual TInt al_radioitf_GetPreset( CStifItemParser& aItem);
 
         virtual TInt al_strminfoitf_QueryMediaContainerInformation( CStifItemParser& aItem );
         virtual TInt al_strminfoitf_QueryStreamType( CStifItemParser& aItem );
--- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -246,24 +246,25 @@
         /*DynamicSourceItf ends*/
         
         /*RadioItf begins*/
-        ENTRY( "al_radioitf_SetFreqRange", COpenMAXALTestModule::al_radioitf_SetFreqRange ),    
-        ENTRY( "al_radioitf_GetFreqRange", COpenMAXALTestModule::al_radioitf_GetFreqRange ),    
-        ENTRY( "al_radioitf_GetFreqRangeDefault", COpenMAXALTestModule::al_radioitf_GetFreqRangeDefault ),            	 
-        ENTRY( "al_radioitf_IsFreqRangeSupported", COpenMAXALTestModule::al_radioitf_IsFreqRangeSupported ),    
-        ENTRY( "al_radioitf_GetFreqRangeProperties", COpenMAXALTestModule::al_radioitf_GetFreqRangeProperties ),    
-        ENTRY( "al_radioitf_SetFrequency", COpenMAXALTestModule::al_radioitf_SetFrequency ),            	        	        	        	
-        ENTRY( "al_radioitf_CancelSetFrequency", COpenMAXALTestModule::al_radioitf_CancelSetFrequency ),    
-        ENTRY( "al_radioitf_GetFrequency", COpenMAXALTestModule::al_radioitf_GetFrequency ),    
-        ENTRY( "al_radioitf_GetFrequencyDefault", COpenMAXALTestModule::al_radioitf_GetFrequencyDefault ),            	
-        ENTRY( "al_radioitf_SetSquelch", COpenMAXALTestModule::al_radioitf_SetSquelch ),    
-        ENTRY( "al_radioitf_GetSquelch", COpenMAXALTestModule::al_radioitf_GetSquelch ),    
-        ENTRY( "al_radioitf_SetStereoMode", COpenMAXALTestModule::al_radioitf_SetStereoMode ),    
-        ENTRY( "al_radioitf_GetStereoMode", COpenMAXALTestModule::al_radioitf_GetStereoMode ),    
-        ENTRY( "al_radioitf_GetSignalStrength", COpenMAXALTestModule::al_radioitf_GetSignalStrength ),    
+        ENTRY( "al_radioitf_SetFreqRange", COpenMAXALTestModule::al_radioitf_SetFreqRange ),
+        ENTRY( "al_radioitf_GetFreqRange", COpenMAXALTestModule::al_radioitf_GetFreqRange ),
+        ENTRY( "al_radioitf_IsFreqRangeSupported", COpenMAXALTestModule::al_radioitf_IsFreqRangeSupported ),
+        ENTRY( "al_radioitf_GetFreqRangeProperties", COpenMAXALTestModule::al_radioitf_GetFreqRangeProperties ),
+        ENTRY( "al_radioitf_SetFrequency", COpenMAXALTestModule::al_radioitf_SetFrequency ),
+        ENTRY( "al_radioitf_CancelSetFrequency", COpenMAXALTestModule::al_radioitf_CancelSetFrequency ),
+        ENTRY( "al_radioitf_GetFrequency", COpenMAXALTestModule::al_radioitf_GetFrequency ),
+        ENTRY( "al_radioitf_SetSquelch", COpenMAXALTestModule::al_radioitf_SetSquelch ),
+        ENTRY( "al_radioitf_GetSquelch", COpenMAXALTestModule::al_radioitf_GetSquelch ),
+        ENTRY( "al_radioitf_SetStereoMode", COpenMAXALTestModule::al_radioitf_SetStereoMode ),
+        ENTRY( "al_radioitf_GetStereoMode", COpenMAXALTestModule::al_radioitf_GetStereoMode ),
+        ENTRY( "al_radioitf_GetSignalStrength", COpenMAXALTestModule::al_radioitf_GetSignalStrength ),
         ENTRY( "al_radioitf_Seek", COpenMAXALTestModule::al_radioitf_Seek ),
-        ENTRY( "al_radioitf_StopSeeking", COpenMAXALTestModule::al_radioitf_StopSeeking ),  
-        ENTRY( "al_radioitf_RegisterRadioCallback", COpenMAXALTestModule::al_radioitf_RegisterRadioCallback ),        	        	            	        	        	        	        	        	        	        	
-        /*RadioItf ends*/       	    
+        ENTRY( "al_radioitf_StopSeeking", COpenMAXALTestModule::al_radioitf_StopSeeking ),
+        ENTRY( "al_radioitf_GetNumberOfPresets", COpenMAXALTestModule::al_radioitf_GetNumberOfPresets ),
+        ENTRY( "al_radioitf_SetPreset", COpenMAXALTestModule::al_radioitf_SetPreset ),
+        ENTRY( "al_radioitf_GetPreset", COpenMAXALTestModule::al_radioitf_GetPreset ),
+        ENTRY( "al_radioitf_RegisterRadioCallback", COpenMAXALTestModule::al_radioitf_RegisterRadioCallback ),
+        /*RadioItf ends*/
         /*StreamInformationItf begins*/
         ENTRY( "al_strminfoitf_QueryMediaContainerInformation", COpenMAXALTestModule::al_strminfoitf_QueryMediaContainerInformation ),
         ENTRY( "al_strminfoitf_QueryStreamType", COpenMAXALTestModule::al_strminfoitf_QueryStreamType ),
--- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -83,26 +83,15 @@
     status = aItem.GetNextInt(freqRange);
     RET_ERR_IF_ERR(status);
 
-		if (m_PlayItf)
+    if(m_RadioItf)
         {
-        status = (*m_PlayItf)->SetPlayState(
-                m_PlayItf, XA_PLAYSTATE_PLAYING);              
+        status = (*m_RadioItf)->SetFreqRange(
+                m_RadioItf, freqRange);
         }
     else
         {
         status = KErrNotFound;
-        return status;
-        } 			
-			
-    if(m_RadioItf)
-        {
-        status = (*m_RadioItf)->SetFreqRange(
-                m_RadioItf, freqRange);              
         }
-    else
-        {
-        status = KErrNotFound;
-        }    
     return status;
     }
 
@@ -110,14 +99,14 @@
     {
     TInt status(KErrNone);
     XAuint8 freqRange;
-		TInt expectedRange;   
+    TInt expectedRange;
     status = aItem.GetNextInt(expectedRange);
     RET_ERR_IF_ERR(status);
 
     if (m_RadioItf)
         {
         status = (*m_RadioItf)->GetFreqRange(
-                m_RadioItf, &freqRange);              
+                m_RadioItf, &freqRange);
         if (!status)
             {
             if (freqRange != (TInt)expectedRange)
@@ -129,7 +118,7 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
 
@@ -142,14 +131,14 @@
     if (m_RadioItf)
         {
         status = (*m_RadioItf)->IsFreqRangeSupported(
-                m_RadioItf, (XAuint8)freqRange, &isSupported);  
-        if (!isSupported)   
-        	status = KErrCompletion;                 
+                m_RadioItf, (XAuint8)freqRange, &isSupported);
+        if (!isSupported)
+        	status = KErrCompletion;
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
 
@@ -157,25 +146,26 @@
     {
     TInt status(KErrNone);
     TInt range;
-    status = aItem.GetNextInt(range); 
-    RET_ERR_IF_ERR(status);         
+    status = aItem.GetNextInt(range);
+    RET_ERR_IF_ERR(status);
     TInt expectedMinFreq;
-    status = aItem.GetNextInt(expectedMinFreq);  
-    RET_ERR_IF_ERR(status);         
+    status = aItem.GetNextInt(expectedMinFreq);
+    RET_ERR_IF_ERR(status);
     TInt expectedMaxFreq;
-    status = aItem.GetNextInt(expectedMaxFreq);    
-    RET_ERR_IF_ERR(status);       
+    status = aItem.GetNextInt(expectedMaxFreq);
+    RET_ERR_IF_ERR(status);
     TInt expectedFreqInterval;
-    status = aItem.GetNextInt(expectedFreqInterval); 
-    RET_ERR_IF_ERR(status);     
- 		XAuint32 minFreq;
- 		XAuint32 maxFreq;
- 		XAuint32 freqInterval;   
+    status = aItem.GetNextInt(expectedFreqInterval);
+    RET_ERR_IF_ERR(status);
+
+    XAuint32 minFreq;
+    XAuint32 maxFreq;
+    XAuint32 freqInterval;
 
     if (m_RadioItf)
         {
         status = (*m_RadioItf)->GetFreqRangeProperties(
-                m_RadioItf, range, &minFreq, &maxFreq, &freqInterval);              
+                m_RadioItf, range, &minFreq, &maxFreq, &freqInterval);
         if (!status)
             {
             /* If duration does not fall between the range we expected fail the case */
@@ -188,7 +178,7 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
 
@@ -196,46 +186,19 @@
     {
     TInt status(KErrNone);
     TInt freq;
-    XAuint32 currentFreq;    
-    status = aItem.GetNextInt(freq); 
-    RET_ERR_IF_ERR(status);   
-    
-		if (m_PlayItf)
+    status = aItem.GetNextInt(freq);
+    RET_ERR_IF_ERR(status);
+    if (m_RadioItf)
         {
-        status = (*m_PlayItf)->SetPlayState(
-                m_PlayItf, XA_PLAYSTATE_PLAYING);              
+        status = (*m_RadioItf)->SetFrequency(
+                m_RadioItf, freq);
+        if (status != KErrNone)
+            status = KErrCompletion;
         }
     else
         {
         status = KErrNotFound;
-        return status;
-        } 
-        
-    if (m_RadioItf)
-        {
-        	status = (*m_RadioItf)->GetFrequency(m_RadioItf, &currentFreq); 
-       		if (status != KErrNone)
-       		{	
-       			status = KErrCompletion;  
-       			return status;
-       		}             
         }
-    else
-        {
-        status = KErrNotFound;
-        return status;
-        }          
-                      
-    if (m_RadioItf)
-        {
-        status = (*m_RadioItf)->SetFrequency(m_RadioItf, freq); 
-       	if (status != KErrNone)
-       		status = KErrCompletion;               
-        }
-    else
-        {
-        status = KErrNotFound;
-        }    
     return status;
     }
 
@@ -246,55 +209,25 @@
     status = aItem.GetNextInt(expectedFreq); 
     RET_ERR_IF_ERR(status); 
     XAuint32 freq;
-                 
+
     if (m_RadioItf)
         {
         status = (*m_RadioItf)->GetFrequency(
-                m_RadioItf, &freq); 
+                m_RadioItf, &freq);
          if (!status)
             {
             if ( freq != expectedFreq )
                 {
                 status = KErrCompletion;
                 }
-            }                                 
+            }
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
-    
-TInt COpenMAXALTestModule::al_radioitf_GetFrequencyDefault( CStifItemParser& aItem)
-    {
-    TInt status(KErrCompletion);
-    XAuint32 freq;
-                 
-    if (m_RadioItf)
-        {
-        status = (*m_RadioItf)->GetFrequency(
-                m_RadioItf, &freq); 
-        }    
-    return status;
-    }    
-    
-TInt COpenMAXALTestModule::al_radioitf_GetFreqRangeDefault( CStifItemParser& aItem )
-    {
-    TInt status(KErrCompletion);
-    XAuint8 freqRange;
-    
-    if (m_RadioItf)
-        {
-        status = (*m_RadioItf)->GetFreqRange(
-                m_RadioItf, &freqRange);              
-        }
-    else
-        {
-        status = KErrNotFound;
-        }    
-    return status;
-    }    
 
 TInt COpenMAXALTestModule::al_radioitf_RegisterRadioCallback( CStifItemParser& /*aItem*/ )
     {
@@ -304,13 +237,13 @@
     if(m_RadioItf)
         {
         res = (*m_RadioItf)->RegisterRadioCallback(
-                m_RadioItf, &RadioItfCallback, (void*)this);              
+                m_RadioItf, &RadioItfCallback, (void*)this);
         status = res;
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
 
     return status;
     }
@@ -327,7 +260,6 @@
         {
         status = (*m_RadioItf)->SetSquelch(
                 m_RadioItf, squelch);
-                              
         }
     else
         {
@@ -335,7 +267,7 @@
         }    
     return status;
     }
-    
+
 TInt COpenMAXALTestModule::al_radioitf_GetSquelch( CStifItemParser& aItem )
     {
     TInt status(KErrNone);
@@ -354,14 +286,14 @@
                 {
                 status = KErrCompletion;
                 }
-            }                                       
+            }
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
-    }    
+    }
 
 TInt COpenMAXALTestModule::al_radioitf_CancelSetFrequency( CStifItemParser& /*aItem*/ )
     {
@@ -370,19 +302,19 @@
     if(m_RadioItf)
         {
         status = (*m_RadioItf)->CancelSetFrequency(
-                m_RadioItf);              
+                m_RadioItf);
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
 
 TInt COpenMAXALTestModule::al_radioitf_SetStereoMode( CStifItemParser& aItem )
     {
     TInt status(KErrNone);
-		TInt stereoMode;
+    TInt stereoMode;
     status = aItem.GetNextInt(stereoMode);
     RET_ERR_IF_ERR(status);
 
@@ -394,14 +326,14 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
-    
+
 TInt COpenMAXALTestModule::al_radioitf_GetStereoMode( CStifItemParser& aItem )
     {
     TInt status(KErrNone);
-		TInt expectedStereoMode;
+    TInt expectedStereoMode;
     status = aItem.GetNextInt(expectedStereoMode);
     RET_ERR_IF_ERR(status);
     XAuint32 stereoMode;
@@ -416,14 +348,14 @@
                {
                status = KErrCompletion;
                }
-           }                        
+           }
         }
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
-    }    
+    }
 
 TInt COpenMAXALTestModule::al_radioitf_GetSignalStrength( CStifItemParser& /*aItem*/ )
     {
@@ -438,17 +370,17 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
 
 TInt COpenMAXALTestModule::al_radioitf_Seek( CStifItemParser& aItem )
     {
     TInt status(KErrNone);
-		TBool upwards;
+    TBool upwards;
     status = aItem.GetNextInt(upwards);
     RET_ERR_IF_ERR(status);
-    		
+
     if(m_RadioItf)
         {
         status = (*m_RadioItf)->Seek(
@@ -457,10 +389,10 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
     return status;
     }
-    
+
 TInt COpenMAXALTestModule::al_radioitf_StopSeeking( CStifItemParser& /*aItem*/ )
     {
     TInt status(KErrNone);
@@ -473,19 +405,81 @@
     else
         {
         status = KErrNotFound;
-        }    
+        }
+    return status;
+    }
+
+TInt COpenMAXALTestModule::al_radioitf_GetNumberOfPresets( CStifItemParser& aItem)
+    {
+    TInt status(KErrNone);
+    RET_ERR_IF_ERR(status);
+    XAuint32 num;
+
+    if (m_RadioItf)
+        {
+        status = (*m_RadioItf)->GetNumberOfPresets(
+                m_RadioItf, &num);
+        }
+    else
+        {
+        status = KErrNotFound;
+        }
     return status;
     }
-      
-      
+
+TInt COpenMAXALTestModule::al_radioitf_SetPreset( CStifItemParser& aItem)
+    {
+    TInt status(KErrNone);
+    TInt preset;
+    status = aItem.GetNextInt(preset);
+    RET_ERR_IF_ERR(status);
+    XAuint32 presetVal = preset;
+    XAuint32 freq = 0;
+    XAuint8 range = 0;
+    XAuint32 mode = 0;
+
+    if (m_RadioItf)
+        {
+        status = (*m_RadioItf)->SetPreset(m_RadioItf, presetVal, freq, range, mode, 0);
+        }
+    else
+        {
+        status = KErrNotFound;
+        }
+    return status;
+    }
+
+TInt COpenMAXALTestModule::al_radioitf_GetPreset( CStifItemParser& aItem)
+    {
+    TInt status(KErrNone);
+    TInt presetToGet;
+    status = aItem.GetNextInt(presetToGet);
+    RET_ERR_IF_ERR(status); 
+    XAuint32 preset = presetToGet;
+    XAuint32 freq = 0;
+    XAuint8 range = 0;
+    XAuint32 mode = 0;
+    XAuint16 nameLength = 0;
+
+    if (m_RadioItf)
+        {
+        status = (*m_RadioItf)->GetPreset(m_RadioItf, preset, &freq, &range, &mode, 0, &nameLength);
+        }
+    else
+        {
+        status = KErrNotFound;
+        }
+    return status;
+    }
+
 void COpenMAXALTestModule::HandleRadioItfCallback(
-        XARadioItf 	caller,
-        XAuint32   	event
+        XARadioItf  caller,
+        XAuint32    event
 )
-{  		
-    
+{
+
     switch (event)
-        {                   	
+        {
         case XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED:
             {
             TEventIf antennaStatusEvent( TEventIf::ESetEvent, _L("Event_XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED:") );
@@ -517,15 +511,15 @@
         default:
             break;	
           }
- 
-}        
+
+}
 
 void RadioItfCallback (
     XARadioItf caller,
     void * pContext,
     XAuint32 event,
-		XAuint32 eventIntData,
-		XAboolean eventBooleanData    
+    XAuint32 eventIntData,
+    XAboolean eventBooleanData
     )
     {
     if (pContext)
--- a/mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg	Fri Sep 17 08:33:15 2010 +0300
@@ -12,53 +12,15 @@
 //
 //
 
-[Define]
-CalendarAlarm 									32769			
-ClockAlarm 											32770			
-ToDoAlarm 											32771			
-
-BurstMode 			  							1			
-Capture  												2			
-CallRecording  									3			
-RecordingStart  								4			
-RecordingStop  									5			
-SelfTimer  											6			
-
-ConfirmationBeep 								257			
-DefaultBeep   									258			
-ErrorBeep  											259			
-InformationBeep  								260			
-WarningBeep  										261			
-IntegratedHandsFreeActivated 		262
-
-TouchScreen  									  513
-
-LocationRequest  							  769 
-
-ChatAlert  										  1025
-EmailAlert  									  1026
-MmsAlert  										  1027
-SmsAlert  										  1028
-DeliveryReport  							  1029
-MessageSendFailure  					  1030 
-
-BatteryLow  									  1281
-BatteryRecharged 							  1282
-PowerOn  											  1283
-PowerOff  										  1284
-WakeUp  											  1285
-WrongCharger  								  1286
-
-IncomingCall  								  33025
-IncomingCallLine2  						  33026 
-IncomingDataCall  						  33027
-
-AutomaticRedialComplete  			  1540
-
-VoiceStart  									  1793 
-VoiceError  									  1794
-VoiceAbort  									  1795
-[Enddefine]
+[Test]
+title 00 Play ErrorBeep
+create systemtoneservicestif STSSTIF
+STSSTIF Create
+STSSTIF PlayTone ErrorBeep
+pause 5000
+STSSTIF Delete
+delete STSSTIF
+[Endtest]
 
 [Test]
 title 01 Play EmailAlert
--- a/mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.pkg	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.pkg	Fri Sep 17 08:33:15 2010 +0300
@@ -20,7 +20,7 @@
 &EN
 
 ; Provide value for uid
-#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+#{"STS STIF"},(0x101FB3E3),1,1,0, TYPE=SA, RU
 
 ; Series60 product id for S60 3.0
 [0x101F7961], 0, 0, 0, {"Series60ProductID"}
@@ -47,7 +47,9 @@
 
 ; Install files
 "\epoc32\release\armv5\udeb\systemtoneservicestif.dll"   -   "!:\Sys\Bin\systemtoneservicestif.dll"
-"..\conf\systemtoneservicestif.cfg"                      -   "C:\testframework\systemtoneservicestif.cfg" 
+"..\conf\systemtoneservicestif_common.cfg"               -   "C:\testframework\systemtoneservicestif_common.cfg"
+"..\conf\systemtoneservicestif.cfg"                      -   "C:\testframework\systemtoneservicestif.cfg"
+"..\conf\systemtoneservicestif_calendaralarm.cfg"        -   "C:\testframework\systemtoneservicestif_calendaralarm.cfg" 
 "..\init\TestFramework.ini"                              -   "C:\TestFramework\TestFramework.ini"
  
 ; Embedded SIS 
--- a/mmmw_plat/system_tone_service_api/tsrc/init/testframework.ini	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/init/testframework.ini	Fri Sep 17 08:33:15 2010 +0300
@@ -93,6 +93,7 @@
 [New_Module]
 ModuleName= TestScripter
 IniFile = c:\testframework\systemtoneservicestif_common.cfg
+TestCaseFile= c:\testframework\systemtoneservicestif.cfg
 TestCaseFile= c:\testframework\systemtoneservicestif_calendaralarm.cfg
 [End_Module]
 
--- a/mmserv/sts/group/systemtoneservice.mmp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/group/systemtoneservice.mmp	Fri Sep 17 08:33:15 2010 +0300
@@ -28,6 +28,7 @@
 MW_LAYER_SYSTEMINCLUDE
 
 USERINCLUDE   ../stsproxy/inc
+USERINCLUDE   ../inc
 
 SOURCEPATH    ../src
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/inc/stsdebug.h	Fri Sep 17 08:33:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * This file is the direct implementation of the System Tone Service
+ * API.  This acts as a facade to the actual implementation logic
+ * which is in the CStsImplementation class.
+ */
+
+#ifndef STSDEBUG_H
+#define STSDEBUG_H
+
+#ifdef _DEBUG
+#include <e32debug.h>
+#endif /*_DEBUG*/
+
+#ifdef _DEBUG
+#   define TRACE_FUNCTION_ENTRY         RDebug::Printf( "%s >", __PRETTY_FUNCTION__)
+#   define TRACE_FUNCTION_EXIT          RDebug::Printf( "%s <", __PRETTY_FUNCTION__)
+#   define TRACE_FUNCTION_ENTRY_EXIT    RDebug::Printf( "%s ><", __PRETTY_FUNCTION__)
+#   define TRACE_LOG(s)                 RDebug::Print s
+#else
+#   define TRACE_FUNCTION_ENTRY
+#   define TRACE_FUNCTION_EXIT
+#   define TRACE_FUNCTION_ENTRY_EXIT
+#   define TRACE_LOG
+#endif /* _DEBUG */
+
+#endif /*STSDEBUG_H*/
--- a/mmserv/sts/src/systemtoneservice.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/src/systemtoneservice.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -20,10 +20,12 @@
 //  Include Files  
 #include <systemtoneservice.h>	// CSystemToneService
 #include "stsimplementation.h"
+#include "stsdebug.h"
 
 //  Member Functions
 EXPORT_C /*static*/CSystemToneService* CSystemToneService::Create()
     {
+    TRACE_FUNCTION_ENTRY;
     CSystemToneService* self = 0;
     CStsImplementation* implementation = CStsImplementation::Create();
     if (implementation != 0)
@@ -31,46 +33,66 @@
         self = new CSystemToneService(*implementation);
         if (self == 0)
             {
+            TRACE_LOG(_L(" Unable to instantiate CSystemToneService"));
             delete implementation;
             }
         }
+    TRACE_FUNCTION_EXIT;
     return self;
     }
 
 EXPORT_C /*static*/void CSystemToneService::Delete(
         CSystemToneService* aSystemToneService)
     {
+    TRACE_FUNCTION_ENTRY;
     delete &(aSystemToneService->iImplementation);
     delete aSystemToneService;
+    TRACE_FUNCTION_EXIT;
     }
 
 CSystemToneService::CSystemToneService(CStsImplementation& aImplementation) :
     iImplementation(aImplementation)
     {
+    TRACE_FUNCTION_ENTRY_EXIT;
     }
 
 CSystemToneService::~CSystemToneService()
     {
+    TRACE_FUNCTION_ENTRY_EXIT;
     }
 
 EXPORT_C void CSystemToneService::PlayTone(TToneType aTone)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TToneType[0x%x]"), aTone));
     iImplementation.PlayTone(aTone);
+    TRACE_FUNCTION_EXIT;
     }
 
 EXPORT_C void CSystemToneService::PlayAlarm(TAlarmType aAlarm,
         unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TAlarmType[0x%x]"), aAlarm));
     iImplementation.PlayAlarm(aAlarm, aAlarmContext, aObserver);
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
+    TRACE_FUNCTION_EXIT;
     }
 
 EXPORT_C void CSystemToneService::PlayAlarm(TToneType aTone,
         unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TToneType[0x%x]"), aTone));
     iImplementation.PlayAlarm(aTone, aAlarmContext, aObserver);
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
+    TRACE_FUNCTION_EXIT;
     }
 
 EXPORT_C void CSystemToneService::StopAlarm(unsigned int aAlarmContext)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
     iImplementation.StopAlarm(aAlarmContext);
+    TRACE_FUNCTION_EXIT;
     }
--- a/mmserv/sts/sts/group/sts.mmp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/sts/group/sts.mmp	Fri Sep 17 08:33:15 2010 +0300
@@ -28,6 +28,7 @@
 
 USERINCLUDE     ../src
 USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
 
 SOURCEPATH      ../src
 
--- a/mmserv/sts/sts/src/sts.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/sts/src/sts.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -18,6 +18,7 @@
 //  Include Files  
 #include "sts.h"
 #include "stssettingsmanager.h"
+#include "stsdebug.h"
 
 class CSts::CPlayerNode
     {
@@ -110,6 +111,8 @@
 
 void CSts::PlayTone(CSystemToneService::TToneType aTone)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TToneType[0x%x]"), aTone));
     CStsPlayer* player = CStsPlayer::Create(*this, *iSettingsManager,
             iNextContext, aTone);
     if (player != 0)
@@ -124,11 +127,14 @@
         {
         //TODO: Add trace here
         }
+    TRACE_FUNCTION_EXIT;
     }
 
 void CSts::PlayAlarm(CSystemToneService::TAlarmType aAlarm,
         unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TAlarmType[0x%x]"), aAlarm));
     CStsPlayer* player = CStsPlayer::Create(*this, *iSettingsManager,
             iNextContext, aAlarm);
     if (player != 0)
@@ -145,11 +151,15 @@
         //TODO: Add trace here
         aAlarmContext = 0;
         }
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
+    TRACE_FUNCTION_EXIT;
     }
 
 void CSts::PlayAlarm(CSystemToneService::TToneType aTone,
         unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("TToneType[0x%x]"), aTone));
     CStsPlayer* player = CStsPlayer::Create(*this, *iSettingsManager,
             iNextContext, aTone);
     if (player != 0)
@@ -166,10 +176,14 @@
         //TODO: Add trace here
         aAlarmContext = 0;
         }
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
+    TRACE_FUNCTION_EXIT;
     }
 
 void CSts::StopAlarm(unsigned int aAlarmContext)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("AlarmContext[%u]"), aAlarmContext));
     CPlayerNode* node = iPlayerMap[aAlarmContext];
     iPlayerMap.erase(aAlarmContext);
     if (node)
@@ -181,6 +195,7 @@
         {
         //TODO: Add trace here
         }
+    TRACE_FUNCTION_EXIT;
     }
 
 void CSts::CleanUpPlayers()
@@ -194,6 +209,8 @@
 
 void CSts::PlayComplete(unsigned int aContext)
     {
+    TRACE_FUNCTION_ENTRY;
+    TRACE_LOG((_L("Context[%u]"), aContext));
     CPlayerNode* node = iPlayerMap[aContext];
     iPlayerMap.erase(aContext);
     if (node)
@@ -209,4 +226,5 @@
         {
         // TODO: log unexpected error
         }
+    TRACE_FUNCTION_EXIT;
     }
--- a/mmserv/sts/sts/src/stsplayer.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/sts/src/stsplayer.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -22,6 +22,7 @@
 #include <systemtoneservice.h>
 #include "stsplayersettings.h"
 #include "stssettingsmanager.h"
+#include "stsdebug.h"
 
 /*static*/CStsPlayer* CStsPlayer::Create(MStsPlayerObserver& aObserver,
         CStsSettingsManager& aSettingsManager, unsigned int aContext,
@@ -85,18 +86,22 @@
 bool CStsPlayer::Init()
     {
     TRAPD(result, iPlayer = CMdaAudioPlayerUtility::NewL(*this));
+    TRACE_LOG((_L("CStsPlayer::Init() : CMdaAudioPlayerUtility::NewL result[%d]"), result));
     return result == KErrNone;
     }
 
 CStsPlayer::~CStsPlayer()
     {
+    TRACE_FUNCTION_ENTRY;
     delete iPlayer;
+    TRACE_FUNCTION_EXIT;
     }
 
 void CStsPlayer::Play()
     {
     // Play the tone
     TRAPD( err, iPlayer->OpenFileL(iPlayerSettings.GetFileName()) );
+    TRACE_LOG((_L("CStsPlayer::Play() : CMdaAudioPlayerUtility::OpenFileL result[%d]"), err));
     // If there is an error, indicate that the playback is complete. 
     if (err)
         {
@@ -107,7 +112,9 @@
 
 void CStsPlayer::Stop()
     {
+    TRACE_FUNCTION_ENTRY;
     iPlayer->Stop();
+    TRACE_FUNCTION_EXIT;
     }
 
 void CStsPlayer::MapcInitComplete(TInt aError,
@@ -124,19 +131,29 @@
                 iPlayerSettings.GetRepeatDelay());
         iPlayer->SetVolume(volume);
         iPlayer->SetVolumeRamp(iPlayerSettings.GetVolumeRamp());
+        TRACE_LOG((_L("CStsPlayer::Play() Settings-Priority[%d]Preference[0x%x]Repeats[%d]Volume[%d]"), 
+                iAudioPriority,
+                iAudioPreference,
+                iPlayerSettings.GetNumberOfRepeats(),
+                volume));
+        TRACE_LOG((_L("CStsPlayer::Play() Settings-RepeatDelay[%d]VolumeRamp[0x%x]"), 
+                iPlayerSettings.GetRepeatDelay().Int64(),
+                iPlayerSettings.GetVolumeRamp().Int64()));
         iPlayer->Play();
         }
     else
         {
         //TODO: add trace
         // Since there is an error, indicate that the playback is complete
-        RDebug::Print(_L("InitCompleteReturned"), aError);
+        //RDebug::Print(_L("InitCompleteReturned"), aError);
+        TRACE_LOG((_L("CStsPlayer::MapcInitComplete() Error[%d]"), aError));
         iObserver.PlayComplete(iContext);
         }
     }
 
 void CStsPlayer::MapcPlayComplete(TInt aError)
     {
+    TRACE_LOG((_L("CStsPlayer::MapcPlayComplete() Error[%d]"), aError));
     if (aError != KErrNone)
         {
         //TODO: add trace
--- a/mmserv/sts/sts/src/stssettingsmanager.cpp	Thu Sep 02 20:58:01 2010 +0300
+++ b/mmserv/sts/sts/src/stssettingsmanager.cpp	Fri Sep 17 08:33:15 2010 +0300
@@ -25,6 +25,7 @@
 #include <MProEngToneSettings.h>
 #include <ProEngFactory.h>
 #include "stsplayersettings.h"
+#include <NokiaAudioPreference.h>
 _LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac");
 
 // Data types
@@ -216,6 +217,12 @@
             aPreference = KAudioPrefNewSMS;
             break;
             }
+        case CSystemToneService::EErrorBeep:
+            {
+            aPriority = KAudioPriorityHighLevel;
+            aPreference = KAudioPrefError;
+            break;
+            }
         case CSystemToneService::EWarningBeep:
             {
             aPriority = KAudioPriorityWarningTone;
--- a/package_definition.xml	Thu Sep 02 20:58:01 2010 +0300
+++ b/package_definition.xml	Fri Sep 17 08:33:15 2010 +0300
@@ -91,7 +91,7 @@
     <unit bldFile="mmmw_plat/stream_control_custom_command_api/group"/>
    </component>
    <component id="system_tone_service_api" name="System Tone Service API" class="api" filter="s60" introduced="^4">
-      <unit bldFile="mmmw_plat/system_tone_service_api/group"/>
+      <unit bldFile="mmmw_plat/system_tone_service_api/group" filter="!test"/>
       <unit bldFile="mmmw_plat/system_tone_service_api/tsrc/group" filter="test,api_test,pref_test,TA_MMMW"/>
    </component>
    <component id="telephony_multimedia_service_api" name="Telephony Multimedia Service API" class="api" filter="s60">