Revision: 201019
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 13:20:50 +0300
changeset 22 128eb6a32b84
parent 16 43d09473c595
child 31 8dfd592727cb
Revision: 201019 Kit: 2010121
inc/FrameTable.h
khronosfws/openmax_al/group/openmaxal.mmp
khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c
khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h
khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.h
khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xastaticcameracapsadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xavibraadaptctx.c
khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.c
khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c
khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp
khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h
khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp
khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h
khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerRecognizer.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudiorecordcontroller/Src/3GPAudioRecordControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioInput.h
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioOutput.h
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioRecordController.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerHwDecoder.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerHwDecoder.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerHwEncoder.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerHwDecoder.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerResource.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerHwDecoder.cpp
mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerResource.cpp
mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/group/mmfaudiotonecontroller.mmp
mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp
mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.h
mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/inc/SimpleSoundPlayer.h
mmfenh/audiooutputcontrolutility/AudioOutputControlUtilityProxy/src/AudioOutputControlUtilityProxyImpl.cpp
mmmw_plat/system_tone_service_api/inc/systemtoneservice.h
mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg
mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.mmp
mmmw_plat/system_tone_service_api/tsrc/inc/systemtoneservicesactiveobj.h
mmmw_plat/system_tone_service_api/tsrc/inc/systemtoneservicestif.h
mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicesactiveobj.cpp
mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestif.cpp
mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestifblocks.cpp
mmmw_plat/telephony_multimedia_service_api/inc/tmsbuffer.h
mmmw_plat/telephony_multimedia_service_api/inc/tmscall.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsink.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsource.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsourceobsrvr.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsdtmf.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsfactory.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsformat.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsg711format.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsg729format.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsgaineffect.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalgaineffect.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalrouting.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalvoleffect.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsilbcformat.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtone.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtoneobsrvr.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsmicsource.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsink.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsource.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsspeakersink.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h
mmmw_plat/telephony_multimedia_service_api/inc/tmsvolumeeffect.h
mmserv/metadatautility/Src/MetaDataParser.cpp
mmserv/metadatautility/Src/MetaDataParser.h
mmserv/metadatautility/Src/MetaDataParserID3v22.cpp
mmserv/metadatautility/Src/MetaDataParserID3v23.cpp
mmserv/metadatautility/Src/MetaDataParserID3v24.cpp
mmserv/metadatautility/Src/MetaDataParserRA.cpp
mmserv/metadatautility/Src/MetaDataParserWMA.cpp
mmserv/metadatautility/Src/MetaDataSourceDescriptor.cpp
mmserv/metadatautility/Src/MetaDataSourceDescriptor.h
mmserv/metadatautility/Src/MetaDataUtilityBody.cpp
mmserv/radioutility/inc/RadioSession.h
mmserv/radioutility/presetutility/conf/presetutility.confml
mmserv/radioutility/presetutility/tsrc/cenrep/presetutility.confml
mmserv/radioutility/presetutility/tsrc/conf/presetutility.confml
mmserv/radioutility/radio_utility/src/RadioUtilityBody.cpp
mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp
mmserv/radioutility/radioserver/Session/Bwins/RadioSessionU.DEF
mmserv/radioutility/radioserver/Session/EABI/RadioSessionU.DEF
mmserv/radioutility/radioserver/Session/Group/RadioSession.mmp
mmserv/radioutility/radioserver/Session/Src/RadioEventHandler.cpp
mmserv/radioutility/radioserver/Session/Src/RadioRequest.cpp
mmserv/radioutility/radioserver/Session/Src/RadioSession.cpp
mmserv/radioutility/radioserver/Session/Src/trace.h
mmserv/radioutility/radioserver/Session/Src/traceconfiguration.hrh
mmserv/sts/group/bld.inf
mmserv/sts/group/systemtoneservice.mmp
mmserv/sts/inc/sts.h
mmserv/sts/inc/stsclientservercommon.h
mmserv/sts/inc/stsimplementation.h
mmserv/sts/inc/stsplayer.h
mmserv/sts/rom/mmmwsystemtoneservice.iby
mmserv/sts/rom/systemtoneservice.iby
mmserv/sts/sts/group/bld.inf
mmserv/sts/sts/group/sts.mmp
mmserv/sts/sts/inc/sts.h
mmserv/sts/sts/inc/stsplayer.h
mmserv/sts/sts/src/sts.cpp
mmserv/sts/sts/src/stsplayer.cpp
mmserv/sts/stsimplementation/group/bld.inf
mmserv/sts/stsimplementation/group/stsimplementation.mmp
mmserv/sts/stsimplementation/src/rstssession.cpp
mmserv/sts/stsimplementation/src/rstssession.h
mmserv/sts/stsimplementation/src/stsimplementation.cpp
mmserv/sts/stsplayer/group/bld.inf
mmserv/sts/stsplayer/group/stsplayer.mmp
mmserv/sts/stsplayer/src/sts.cpp
mmserv/sts/stsplayer/src/stsplayer.cpp
mmserv/sts/stsproxy/group/bld.inf
mmserv/sts/stsproxy/group/stsproxy.mmp
mmserv/sts/stsproxy/inc/stsimplementation.h
mmserv/sts/stsproxy/src/rstssession.cpp
mmserv/sts/stsproxy/src/rstssession.h
mmserv/sts/stsproxy/src/stsimplementation.cpp
mmserv/sts/stsserver/group/stsserver.mmp
mmserv/sts/stsserver/inc/stsclientservercommon.h
mmserv/sts/stsserver/src/stsserver.cpp
mmserv/sts/stsserver/src/stsserver.h
mmserv/sts/stsserver/src/stsserversession.cpp
mmserv/sts/stsserver/src/stsserversession.h
mmserv/sts/tsrc/ststester/src/ststester.cpp
mmserv/tms/inc/tmsclientserver.h
mmserv/tms/inc/tmsmembuffer.h
mmserv/tms/inc/tmsproxy.h
mmserv/tms/inc/tmsshared.h
mmserv/tms/tmscallserver/group/tmscallserver.mmp
mmserv/tms/tmscallserver/inc/tmscalladpt.h
mmserv/tms/tmscallserver/inc/tmscallcsadpt.h
mmserv/tms/tmscallserver/inc/tmscallipadpt.h
mmserv/tms/tmscallserver/inc/tmsdtmfnotifier.h
mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h
mmserv/tms/tmscallserver/inc/tmsdtmftoneplayer.h
mmserv/tms/tmscallserver/inc/tmseteldtmfmonitor.h
mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp
mmserv/tms/tmscallserver/src/tmscallipadpt.cpp
mmserv/tms/tmscallserver/src/tmscallsession.cpp
mmserv/tms/tmscallserver/src/tmsdtmfnotifier.cpp
mmserv/tms/tmscallserver/src/tmsdtmfprovider.cpp
mmserv/tms/tmscallserver/src/tmsdtmftoneplayer.cpp
mmserv/tms/tmscallserver/src/tmseteldtmfmonitor.cpp
mmserv/tms/tmscallserver/src/tmseteldtmfstopmonitor.cpp
mmserv/tms/tmsfactory/bwins/tmsfactory.def
mmserv/tms/tmsfactory/eabi/tmsfactory.def
mmserv/tms/tmsfactory/src/tmsfactory.cpp
mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp
mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h
mmserv/tms/tmsimpl/inc/tmsringtonebodyimpl.h
mmserv/tms/tmsimpl/src/tmsamrbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsamrimpl.cpp
mmserv/tms/tmsimpl/src/tmscallbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmscallimpl.cpp
mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp
mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp
mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsg711bodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsg711impl.cpp
mmserv/tms/tmsimpl/src/tmsg729bodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsg729impl.cpp
mmserv/tms/tmsimpl/src/tmsgaineffectbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsgaineffectimpl.cpp
mmserv/tms/tmsimpl/src/tmsglobalgaineffectbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsglobalgaineffectimpl.cpp
mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsglobalvoleffectbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsglobalvoleffectimpl.cpp
mmserv/tms/tmsimpl/src/tmsilbcbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsilbcimpl.cpp
mmserv/tms/tmsimpl/src/tmsinbandtonebodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsmembuffer.cpp
mmserv/tms/tmsimpl/src/tmsmicsourcebodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsmicsourceimpl.cpp
mmserv/tms/tmsimpl/src/tmsmodemsinkbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsmodemsinkimpl.cpp
mmserv/tms/tmsimpl/src/tmsmodemsourcebodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsmodemsourceimpl.cpp
mmserv/tms/tmsimpl/src/tmspcmbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmspcmimpl.cpp
mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsringtoneimpl.cpp
mmserv/tms/tmsimpl/src/tmsspeakersinkbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsspeakersinkimpl.cpp
mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp
mmserv/tms/tmsimpl/src/tmsvolumeeffectbodyimpl.cpp
mmserv/tms/tmsimpl/src/tmsvolumeeffectimpl.cpp
mmserv/tms/tmsproxy/src/tmsproxy.cpp
mmserv/tms/tmsproxy/src/tmsqueuehandler.cpp
mmserv/tms/tmsserver/group/tmsserver.mmp
mmserv/tms/tmsserver/inc/tmsaudioinbandtoneplayer.h
mmserv/tms/tmsserver/inc/tmsaudiotoneutility.h
mmserv/tms/tmsserver/inc/tmsaudiotoneutilityimpl.h
mmserv/tms/tmsserver/inc/tmsdtmfeventhandler.h
mmserv/tms/tmsserver/inc/tmsrtaudiohdlr.h
mmserv/tms/tmsserver/inc/tmsserver.h
mmserv/tms/tmsserver/inc/tmsserversession.h
mmserv/tms/tmsserver/inc/tmstimer.h
mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp
mmserv/tms/tmsserver/src/tmsaudiotoneutilityimpl.cpp
mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp
mmserv/tms/tmsserver/src/tmsrtcontainer.cpp
mmserv/tms/tmsserver/src/tmsrtplayer.cpp
mmserv/tms/tmsserver/src/tmsserver.cpp
mmserv/tms/tmsserver/src/tmstimer.cpp
mmserv/tms/tmsutility/src/tmsutility.cpp
--- a/inc/FrameTable.h	Fri May 14 16:22:35 2010 +0300
+++ b/inc/FrameTable.h	Thu May 27 13:20:50 2010 +0300
@@ -113,7 +113,6 @@
     TUint iAvgBitrate;
     TUint iOffset;
     TUint iTimeRefMs;
-    TUint iBufCnt;
     TUint iPosEventMs;
     TUint iPlayWindowEndPosEventMs;
     TInt iIntervalRef;
--- a/khronosfws/openmax_al/group/openmaxal.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/group/openmaxal.mmp	Thu May 27 13:20:50 2010 +0300
@@ -197,14 +197,9 @@
 MW_LAYER_SYSTEMINCLUDE
 OS_LAYER_LIBC_SYSTEMINCLUDE
 OS_LAYER_GLIB_SYSTEMINCLUDE
+MW_LAYER_GSTREAMER_SYSTEMINCLUDE
 SYSTEMINCLUDE /epoc32/include/platform/mw/khronos 
 
-SYSTEMINCLUDE  	/sf/mw/gstreamer/include/gstreamer
-SYSTEMINCLUDE  	/sf/mw/gstreamer/include/gstreamer/gst
-SYSTEMINCLUDE  	/sf/mw/gstreamer/include/gstreamer/gst/interfaces
-SYSTEMINCLUDE  	/sf/mw/gstreamer/include/gstreamer/gst/app
-SYSTEMINCLUDE  	/sf/mw/gstreamer/include/gstreamer/gst/video
-
 LIBRARY         euser.lib
 LIBRARY         libc.lib
 LIBRARY         libglib.lib
--- a/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c	Thu May 27 13:20:50 2010 +0300
@@ -31,7 +31,7 @@
 
 
 /* Config file location */
-const char configFileLocation[] = "c:/openmaxal/openmaxal.cfg";
+const char configFileLocation[] = "z:/openmaxal/openmaxal.cfg";
 
 /* Tags used for parsing */
 const char mediaPlayerBeginTag[] = "<mediaplayer>";
@@ -92,9 +92,10 @@
     if (fp == NULL)
         {
         createDefaultRules(configFileLocation);
+
+        fp = fopen(configFileLocation, "r");
         }
 
-    fp = fopen(configFileLocation, "r");
     if (fp != NULL)
     {
         while((fgets(buffer, LINEWIDTH, fp) != NULL) && processedEntry)
--- a/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h	Thu May 27 13:20:50 2010 +0300
@@ -24,10 +24,10 @@
 #include <unistd.h>
 #include "openmaxalwrapper.h"
 #include "xaglobals.h"
-#include <gst.h>
-#include <gstappsrc.h>
-#include <gstappsink.h>
-#include <gstappbuffer.h>
+#include <gst/gst.h>
+#include <gst/app/gstappsrc.h>
+#include <gst/app/gstappsink.h>
+#include <gst/app/gstappbuffer.h>
 #include "xaplatform.h"
 #include "xaadptbasectx.h"
 #include <stdlib.h>
--- a/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xamediarecorderadaptctx.h"
 #include "xaaudioencoderitfadaptation.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -16,10 +16,10 @@
 */
 
 #include <string.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xacameraadaptctx.h"
 #include "xaadaptationgst.h"
-#include <photography.h>
+#include <gst/interfaces/photography.h>
 //#include "XAStaticCapsAdaptation.h"
 
 
--- a/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.h	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.h	Thu May 27 13:20:50 2010 +0300
@@ -19,7 +19,7 @@
 #define XACAMERAADAPTCTX_H
 
 #include "xaadaptationgst.h"
-#include <photography.h>
+#include <gst/interfaces/photography.h>
 /* TYPEDEFS */
 
 typedef struct XACameraAdaptationCtx_ XACameraAdaptationCtx;
--- a/khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include <gst.h>
-#include <photography.h>
+#include <gst/gst.h>
+#include <gst/interfaces/photography.h>
 #include "xacameraadaptctx.h"
 #include "xacameraitfadaptation.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include <gst.h>
-#include <mixer.h>
+#include <gst/gst.h>
+#include <gst/interfaces/mixer.h>
 #include "xadevicevolumeitfadaptation.h"
 #include "xaengineadaptctx.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xadynamicsourceitfadaptation.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 #include <string.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaengineadaptctx.h"
 #include "xaadaptationgst.h"
 
--- a/khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xamediarecorderadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xamediarecorderadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,8 +16,8 @@
 */
 
 
-#include <gst.h>
-#include <photography.h>
+#include <gst/gst.h>
+#include <gst/interfaces/photography.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xamediarecorderadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -17,8 +17,8 @@
 
 #include <assert.h>
 #include <stdlib.h>
-#include <gstappsrc.h>
-#include <gst.h>
+#include <gst/gst.h>
+#include <gst/app/gstappsrc.h>
 #include "xamediaplayeradaptctx.h"
 #include "xamediaplayeradaptctxmmf.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -17,8 +17,8 @@
 
 #include <string.h>
 #include <assert.h>
-#include <gst.h>
-#include <gstappsink.h>
+#include <gst/gst.h>
+#include <gst/app/gstappsink.h>
 #include "xacapabilitiesmgr.h"
 #include "xamediarecorderadaptctx.h"
 #include "xacameraadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 #include <string.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xametadataadaptctx.h"
 #include "xamediaplayeradaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaoutputmixadaptctx.h"
 #include "xaadaptationgst.h"
 #include "xacapabilitiesmgr.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 #include <string.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaoutputmixadaptctx.h"
 #include "xaoutputmixitfadaptation.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xaplaybackrateitfadaptation.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "unistd.h"
 #include <pthread.h>
 #include "xamediaplayeradaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaradioadaptctx.h"
 #include "xaadaptationgst.h"
 #include "assert.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 #include <unistd.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xaradioitfadaptation.h"
 #include "xaradioadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 #include <pthread.h>
-#include <gst.h>
+#include <gst/gst.h>
 #include "xamediarecorderadaptctx.h"
 #include "xarecorditfadaptation.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xaseekitfadaptation.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -16,9 +16,9 @@
 */
 
 #include <string.h>
-#include <gst.h>
-#include <gstappsrc.h>
-#include <gstappsink.h>
+#include <gst/gst.h>
+#include <gst/app/gstappsrc.h>
+#include <gst/app/gstappsink.h>
 #include "xaadaptationgst.h"
 #include "xasnapshotitfadaptation.h"
 #include "xamediarecorderadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xastaticcameracapsadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xastaticcameracapsadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -17,8 +17,8 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <gst.h>
-#include <photography.h>
+#include <gst/gst.h>
+#include <gst/interfaces/photography.h>
 #include "xaglobals.h"
 #include "xastaticcameracapsadaptation.h"
 #include "xaadptbasectx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xavibraadaptctx.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xavibraadaptctx.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xavibraadaptctx.h"
 #include "xaadaptationgst.h"
 
--- a/khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <gst.h>
+#include <gst/gst.h>
 #include "xamediarecorderadaptctx.h"
 #include "xavideoencoderitfadaptation.h"
 #include "xaadaptationgst.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include <gst.h>
-#include <video.h>
+#include <gst/gst.h>
+#include <gst/video/video.h>
 #include "xaadaptationgst.h"
 #include "xamediaplayeradaptctx.h"
 #include "xamediarecorderadaptctx.h"
--- a/khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c	Thu May 27 13:20:50 2010 +0300
@@ -15,8 +15,8 @@
 *
 */
 
-#include <gst.h>
-#include <mixer.h>
+#include <gst/gst.h>
+#include <gst/interfaces/mixer.h>
 #include "xaadaptationgst.h"
 #include "xavolumeitfadaptation.h"
 #include "xamediaplayeradaptctx.h"
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp	Thu May 27 13:20:50 2010 +0300
@@ -392,7 +392,7 @@
 		}
 	} 
 
-	return NULL;
+	return "UnSupported";
 }
 
 TInt CS60MetadataUtilityItf::ValueEncoding(TMetaDataFieldId fldID)
@@ -766,7 +766,7 @@
 		}
 	} 
 
-	return NULL;
+	return "UnSupported";
 }
 
 TInt CHXMetadataUtilityItf::ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID)
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h	Thu May 27 13:20:50 2010 +0300
@@ -25,7 +25,7 @@
 #include <e32hashtab.h>
 #include <OpenMAXAL.h>
 
-#include <Hxmetadatautil.h>
+#include <hxmetadatautil.h>
 #include <MetaDataUtility.h>
 #include <MetaDataFieldContainer.h>
 #include <MetaDataField.hrh>
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp	Thu May 27 13:20:50 2010 +0300
@@ -61,11 +61,18 @@
 void CMMFBackendEngine::ConstructL()
     {
     iAPIBeingUsed = ENoUtility;
-    iBaseAudioRecorder = CMdaAudioRecorderUtility::NewL(*this);
-    iAudioRecorder = (CMdaAudioRecorderUtility*)iBaseAudioRecorder;
     iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
     }
 
+void CMMFBackendEngine::InitAudioRecorderUtilityL()
+    {
+    if (!iAudioRecorder)
+        {
+        iBaseAudioRecorder = CMdaAudioRecorderUtility::NewL(*this);
+        iAudioRecorder = (CMdaAudioRecorderUtility*)iBaseAudioRecorder;
+        }
+    }
+
 void CMMFBackendEngine::InitAudioPlayerUtilityL()
     {
     if (!iAudioPlayer)
@@ -113,33 +120,27 @@
         if (iRecordState == ERecorderNotReady)
             {
             iFileFormat = format;
-            iAPIBeingUsed = EAudioRecorderUtility;
-            TPtr8 fileuri(((TUint8*)uri), strlen(uri) ,strlen(uri));
-            TPtr8 filepath = fileuri.RightTPtr(strlen(uri)-fileslashlen);
-            TInt pos = filepath.LocateReverse(':');
-            if(pos != KErrNotFound)
+            iAPIBeingUsed = DetermineAPIToUse(uri, EPlay);
+            err = XA_RESULT_INTERNAL_ERROR;
+            if (iAPIBeingUsed == EAudioRecorderUtility)
                 {
-                fileuri.Delete(fileslashlen+pos,1);
-                }
-
-            TUriParser8 localfileUri;
-            TInt ret = localfileUri.Parse(fileuri);
-            HBufC* file = NULL;
-            TRAP(err,file = localfileUri.GetFileNameL());
-            TPtr des = file->Des();
-            iFileName = des;
-            delete file;
-            file = NULL;
-            TRAP(err, iAudioRecorder->OpenFileL(iFileName));
-            if (!err)
-                { /* Wait until we receive moscostatechanged callback */
+                /* Initialize URI as needed by MMF utilities */
+                err = InitializeURIForMMFUtil(uri);
+                RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR);
+                /* Initalize Recorder related objects */
+                TRAP(err, InitAudioRecorderUtilityL());
+                RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR);
+    
+                TRAP(err, iAudioRecorder->OpenFileL(iFileName));
+                RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR);
+                /* Wait until we receive moscostatechanged callback */
                 if(!iActiveSchedulerWait->IsStarted())
                     {
                     iActiveSchedulerWait->Start();
                     }
-                err = iErrorCode;
-                }
-           }
+                RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR);
+               }
+            }
         }
     else
         {
@@ -505,6 +506,12 @@
 TInt CMMFBackendEngine::SetRecorderState(TRecorderState state, XAboolean stopCalled)
     {
     TInt err(KErrNone);
+
+    if (iAPIBeingUsed != EAudioRecorderUtility)
+        {
+        return XA_RESULT_INTERNAL_ERROR;
+        }
+
     switch(state)
         {
         case ERecorderNotReady:
@@ -574,28 +581,14 @@
         iPositionUpdateTimer->Stop();
         }
 
-    if(iActiveSchedulerWait)
+    if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted())
         {
-        if(iActiveSchedulerWait->IsStarted())
-            {
-            iActiveSchedulerWait->AsyncStop();
-            }
+        iActiveSchedulerWait->AsyncStop();
         }
     }
 
 void CMMFBackendEngine::Destroy()
     {
-
-    if (iBaseAudioRecorder)
-        {
-        iAudioRecorder->Close();
-        }
-
-    if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted())
-        {
-        iActiveSchedulerWait->AsyncStop();
-        }
-
     delete iPositionUpdateTimer;
     iPositionUpdateTimer = NULL;
     delete iUri;
@@ -607,12 +600,8 @@
     delete iBaseVideoPlayer;
     iBaseVideoPlayer = NULL;
     iVideoPlayer = NULL;
-    if (iaudioInputRecord)
-        {
-        delete iaudioInputRecord;
-        iaudioInputRecord = NULL;
-        }
-		
+    delete iaudioInputRecord;
+    iaudioInputRecord = NULL;
     delete iBaseAudioPlayer;
     iBaseAudioPlayer = NULL;
     iAudioPlayer = NULL;
--- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h	Thu May 27 13:20:50 2010 +0300
@@ -25,7 +25,7 @@
 #ifdef __cplusplus
 
 #include <e32base.h>
-#include <MdaAudioSamplePlayer.h>  
+#include <mdaaudiosampleplayer.h>  
 #include <f32file.h>
 #include <videoplayer.h>
 #include <videoplayer2.h>
@@ -166,6 +166,7 @@
 private:
     CMMFBackendEngine();
     void ConstructL();
+    void InitAudioRecorderUtilityL();
     void InitAudioPlayerUtilityL();
     void InitVideoPlayerUtilityL();
     void InitPlayerTimersL();
--- a/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c	Fri May 14 16:22:35 2010 +0300
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c	Thu May 27 13:20:50 2010 +0300
@@ -50,38 +50,38 @@
         
         mmf_close(mCtx->mmfContext);
         mCtx->xaSource = pDataSource;
-        ret = mmf_set_player_uri(mCtx->mmfContext, (char *)(tempUri->URI), tempFormat->containerType);
         if(mCtx->xaVideoSink)
-          {
+            {
             ret = mmf_setup_native_display(mCtx->mmfContext, mCtx->xaVideoSink);
-          }
+            }
+        if (ret == XA_RESULT_SUCCESS)
+            {
+            ret = mmf_set_player_uri(mCtx->mmfContext, (char *)(tempUri->URI), tempFormat->containerType);
+            }
         if(ret == XA_RESULT_SUCCESS)
             {
-			ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate);
-			}
-		else
-			{
-			DEBUG_ERR("Set Play state failed");
-	        ret = XA_RESULT_INTERNAL_ERROR;
-			}
-		if(ret == XA_RESULT_SUCCESS)
-		{
-			if(mCtx->mmfMetadataContext)
-			{
-				ret = mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, (char *)(tempUri->URI));
-			}
-		}
+            ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate);
+            }
+        else
+            {
+            DEBUG_ERR("Set Play state failed");
+            ret = XA_RESULT_INTERNAL_ERROR;
+            }
+        if((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext))
+            {
+            ret = mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, (char *)(tempUri->URI));
+            }
     }
-	else if(bCtx->baseObj.ctxId == XAMDAdaptation)
-	{
-		
+    else if(bCtx->baseObj.ctxId == XAMDAdaptation)
+    {
+        
         XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx;
-		if(mCtx->mmfContext)
-		{
-			mCtx->xaSource = pDataSource;
-			ret = mmf_metadata_utility_parse_source(mCtx->mmfContext, (char *)(( (XADataLocator_URI*)(pDataSource->pLocator))->URI));
-		}
-	}
+        if(mCtx->mmfContext)
+        {
+            mCtx->xaSource = pDataSource;
+            ret = mmf_metadata_utility_parse_source(mCtx->mmfContext, (char *)(( (XADataLocator_URI*)(pDataSource->pLocator))->URI));
+        }
+    }
     DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource");
     return ret;
 }
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerRecognizer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerRecognizer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -30,6 +30,7 @@
 _LIT(KDot, ".");
 _LIT(KDot3gp, ".3gp");
 _LIT(KDot3ga, ".3ga");
+_LIT(KDot3gpp, ".3gpp");
 _LIT8(K3gpAudioMimeType, "audio/3gpp");
 _LIT8(K3gpVideoMimeType, "video/3gpp");
 
@@ -202,7 +203,14 @@
             }
         }
 
-    TPtrC ext(aName.Right(KExtLength));
+   // TPtrC ext(aName.Right(KExtLength));
+   TInt num=aName.LocateReverse('.');
+   if(num < 0)
+   {
+	num = 0;
+   }
+    TPtrC ext(aName.Right(aName.Length()-num));
+
     DP0(_L("C3GPAudioPlayControllerRecognizer::DoRecognizeL: Extension:"));
 #ifdef _DEBUG
     RDebug::RawPrint(ext);
@@ -211,7 +219,7 @@
 
     if ( (ext.CompareF(KDot3gp) == 0) || (ext.CompareF(KDotMp4) == 0) ||
          (ext.CompareF(KDotM4a) == 0) || (ext.CompareF(KDot3g2) == 0) || 
-         (ext.CompareF(KDot3ga) == 0) || headerMatch)
+         (ext.CompareF(KDot3ga) == 0) || (ext.CompareF(KDot3gpp) == 0) || headerMatch)
         {
         RFile* fileHandle= NULL;
         TRAPD(handleErr, fileHandle = FilePassedByHandleL());
@@ -277,7 +285,7 @@
                          (header.FindF(K3gs6Header) == 0) ||
                          (header.FindF(KMmp4Header) == 0) ||
                          (ext.CompareF(KDot3gp)     == 0) ||
-                         (ext.CompareF(KDot3ga)     == 0) )
+                         (ext.CompareF(KDot3ga)     == 0)||(ext.CompareF(KDot3gpp) == 0) )
                         {
                         iDataType = TDataType(K3gpAudioMimeType);
                         iConfidence = ECertain;
@@ -308,7 +316,7 @@
                      (header.FindF(K3gr6Header) == 0) ||
                      (header.FindF(K3gs6Header) == 0) ||
                      (header.FindF(KMmp4Header) == 0) ||
-                     (ext.CompareF(KDot3gp)     == 0) )
+                     (ext.CompareF(KDot3gp)     == 0) || (ext.CompareF(KDot3gpp) == 0))
                     {
                     iDataType = TDataType(K3gpVideoMimeType);
                     iConfidence = ECertain;
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<3GPAudioPlayControllerResource.rsg>
+#include	<3gpaudioplaycontrollerresource.rsg>
 #include	"3GPAudioPlayControllerResource.h"
 #include 	<data_caging_path_literals.hrh>
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudiorecordcontroller/Src/3GPAudioRecordControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudiorecordcontroller/Src/3GPAudioRecordControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<3GPAudioRecordControllerResource.rsg>
+#include	<3gpaudiorecordcontrollerresource.rsg>
 #include	"3GPAudioRecordControllerResource.h"
 #include 	<data_caging_path_literals.hrh>
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioInput.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioInput.h	Thu May 27 13:20:50 2010 +0300
@@ -30,7 +30,7 @@
 //#include <MmfControllerFrameworkBase.h>
 //#include <MmfControllerFramework.h>
 //#include <MmfBase.h>
-//#include <MmfPanicCodes.h>
+//#include <mmfpaniccodes.h>
 #include "AdvancedAudioEncoder.h"
 
 // CLASS DECLARATION
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioOutput.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioOutput.h	Thu May 27 13:20:50 2010 +0300
@@ -30,7 +30,7 @@
 //#include <MmfControllerFrameworkBase.h>
 //#include <MmfControllerFramework.h>
 //#include <MmfBase.h>
-//#include <MmfPanicCodes.h>
+//#include <mmfpaniccodes.h>
 #include "AdvancedAudioDecoder.h"
 #include "DataSourceAdapter.h"
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioRecordController.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioRecordController.cpp	Thu May 27 13:20:50 2010 +0300
@@ -1019,6 +1019,18 @@
 EXPORT_C void CAdvancedAudioRecordController::SendEvent(
 	const TMMFEvent& aEvent )
     {
+#ifdef _DEBUG
+    RDebug::Print(_L("CAdvancedAudioRecordController::SendEvent[%d] this[%x]"), aEvent.iErrorCode, this);
+#endif
+    // fix for DALM-853QJX, handling preemption use case during recording, this handles only preemption errors and other errors are ignored
+    // MMFDevSound throws the following error codes incase of any preemption events
+    // (DevSound instance has been thrown-off or initial request has been rejected)
+    if ( (aEvent.iErrorCode == KErrAccessDenied) || (aEvent.iErrorCode == KErrInUse) || (aEvent.iErrorCode == KErrDied) )
+        {
+        // this might be a DevSound Preemption
+        iState = EStopping;
+        TRAP_IGNORE(DoStopL());
+        }
     SendEventToClient(aEvent);
     }
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerHwDecoder.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerHwDecoder.cpp	Thu May 27 13:20:50 2010 +0300
@@ -23,7 +23,7 @@
 #include "DebugMacros.h"
 #include <Mmfcodec.h>
 
-#include <MmfPanicCodes.h>
+#include <mmfpaniccodes.h>
 
 // New eAAC+ custom interface is used only when using DSP decoder and 
 // the eAAC+ feature is turned on.
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 // INCLUDE FILES
 #include "AACAudioPlayControllerResource.h"
-#include <AACAudioPlayControllerResource.rsg>
+#include <aacaudioplaycontrollerresource.rsg>
 #include <data_caging_path_literals.hrh>
 
 // LOCAL CONSTANTS AND MACROS
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerHwDecoder.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerHwDecoder.cpp	Thu May 27 13:20:50 2010 +0300
@@ -22,7 +22,7 @@
 #include "AMRAudioPlayControllerDecoder.h"
 #include "DebugMacros.h"
 //#include <AmrDecHwDeviceTICIM.h>
-#include <MmfPanicCodes.h>
+#include <mmfpaniccodes.h>
 
 // The size of AMR header, header must include bits for determining frame length
 const TInt KAmrFrameHeaderSize1 = 1;
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudioplaycontroller/Src/AMRAudioPlayControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<AMRAudioPlayControllerResource.rsg>
+#include	<amraudioplaycontrollerresource.rsg>
 #include	"AMRAudioPlayControllerResource.h"
 #include "DebugMacros.h"
 #include 	<data_caging_path_literals.hrh> 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerHwEncoder.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerHwEncoder.cpp	Thu May 27 13:20:50 2010 +0300
@@ -20,7 +20,7 @@
 
 // INCLUDE FILES
 #include	"AMRAudioRecordControllerEncoder.h"
-#include 	<MmfPanicCodes.h>
+#include 	<mmfpaniccodes.h>
 #include	<SpeechEncoderConfig.h> // Custom Interface for Speech Encoder Configuration
 
 // AMR Bit Rate constant
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<AMRAudioRecordControllerResource.rsg>
+#include	<amraudiorecordcontrollerresource.rsg>
 #include	"AMRAudioRecordControllerResource.h"
 #include 	<data_caging_path_literals.hrh>
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerHwDecoder.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerHwDecoder.cpp	Thu May 27 13:20:50 2010 +0300
@@ -23,7 +23,7 @@
 #include "DebugMacros.h"
 
 //#include <AmrWbDecHwDeviceTICIM.h>
-#include <MmfPanicCodes.h>
+#include <mmfpaniccodes.h>
 
 const TInt KAwbFrameHeaderSize1 = 1;
 
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<AWBAudioPlayControllerResource.rsg>
+#include	<awbaudioplaycontrollerresource.rsg>
 #include	"AWBAudioPlayControllerResource.h"
 #include 	<data_caging_path_literals.hrh> 
 #include "DebugMacros.h"
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerHwDecoder.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerHwDecoder.cpp	Thu May 27 13:20:50 2010 +0300
@@ -21,7 +21,7 @@
 // INCLUDE FILES
 #include "MP3AudioPlayControllerDecoder.h"
 #include "DebugMacros.h"
-#include <MmfPanicCodes.h>
+#include <mmfpaniccodes.h>
 #include <Mmfcodec.h>
 
 const TUint KRawMp3MaxFrameSize  = 1441;
--- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerResource.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerResource.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include	<MP3AudioPlayControllerResource.rsg>
+#include	<mp3audioplaycontrollerresource.rsg>
 #include	"MP3AudioPlayControllerResource.h"
 #include "DebugMacros.h"
 
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/group/mmfaudiotonecontroller.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/group/mmfaudiotonecontroller.mmp	Thu May 27 13:20:50 2010 +0300
@@ -56,6 +56,9 @@
 LIBRARY mmfdevsound.lib
 LIBRARY mmfcontrollerframework.lib
 LIBRARY mmfstandardcustomcommands.lib
+LIBRARY	ConfigurationComponentsFactory.lib
+LIBRARY	AudioOutputControlUtility.lib
+LIBRARY	AudioOutputRouting.lib
 #ifdef EABI
 LIBRARY ecom.lib
 #endif
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp	Thu May 27 13:20:50 2010 +0300
@@ -22,6 +22,9 @@
 #include <mmf/common/mmfpaniccodes.h>
 #include "mmfaudiotonecontroller.h"
 #include <mmf/server/mmfaudiooutput.h>
+#include <ConfigurationComponentsFactory.h>
+#include <AudioOutputControlUtility.h>
+#include <mmf/server/mmffile.h>
 
 /*
  A list of panic codes for the Audio Tone Controller
@@ -127,7 +130,15 @@
 	CleanupStack::PushL(audPlayConSetRepeatsParser);
 	AddCustomCommandParserL(*audPlayConSetRepeatsParser);
 	CleanupStack::Pop(audPlayConSetRepeatsParser);
-	
+	// for drm CR/Error 417-45879/ESLM-82JAHL
+    TInt err = CConfigurationComponentsFactory::CreateFactoryL(iFactory);
+    User::LeaveIfError(err);    
+    
+    if (iFactory)
+        {
+        User::LeaveIfError(iFactory->CreateAudioOutputControlUtility(iAudioOutputControlUtility));                
+        }    
+//end drm cr
 	// [ assert the invariant now that we are constructed ]
 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotConstructed));
 	}
@@ -150,6 +161,8 @@
 */
 CMMFAudioToneController::~CMMFAudioToneController()
 	{
+    delete iAudioOutputControlUtility;
+    delete iFactory;
 	delete iMMFDevSound;
 	delete iToneSequenceData;
 	delete iMessage;
@@ -267,7 +280,17 @@
 			User::Leave(err);
 			}
 		}
-	
+	// for drm CR/Error 417-45879/ESLM-82JAHL
+    if (iDataSource->DataSourceType()==KUidMmfFileSource)
+        {
+        CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+        
+        if (file->IsProtectedL())
+            {
+            User::LeaveIfError(iAudioOutputControlUtility->SetDataSource(iDataSource));
+            }         
+        }
+	   // end drm cr
 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotPrimed ) );
 
 	}
@@ -346,7 +369,18 @@
 
 	// [ assert the Invariant ]
 	__ASSERT_ALWAYS( Invariant(), Panic(EStateNotReadyToPlay));
-
+        // for drm CR/Error 417-45879/ESLM-82JAHL
+	   //configure Devsound with output restriction for a DRM protected file
+	    if (iDataSource->DataSourceType()==KUidMmfFileSource)
+	        {
+	        CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+	        
+	        if (file->IsProtectedL())
+	            {
+	            iAudioOutputControlUtility->Configure(*iMMFDevSound);    //ignoring errors since rouitng changes are only suggestions to adaptation
+	            }
+	        }
+	
 	if(State() == EPausePlaying && iIsResumeSupported)
 		{
 		User::LeaveIfError(iMMFDevSound->Resume());
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.h	Thu May 27 13:20:50 2010 +0300
@@ -46,7 +46,8 @@
 The public API for clients of the MMFAudioToneController
 @internalTechnology
 */
-
+class CConfigurationComponentsFactory;
+class CAudioOutputControlUtility; 
 class CMMFAudioToneController : public CMMFController, 
 							public MMMFAudioPlayDeviceCustomCommandImplementor,
 							public MMMFAudioPlayControllerCustomCommandImplementor,
@@ -158,6 +159,10 @@
 /** the Dev Sound that will be used to play the tone*/
 	CMMFDevSound*            iMMFDevSound;
 
+    // for drm CR/Error 417-45879/ESLM-82JAHL
+	CConfigurationComponentsFactory*   iFactory;
+	CAudioOutputControlUtility*        iAudioOutputControlUtility; // used for audio routing for DRM files
+	// end drm cr
 /** Current state of the controller, see TControllerState*/
 	TControllerState         iState;
 
--- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/inc/SimpleSoundPlayer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/inc/SimpleSoundPlayer.h	Thu May 27 13:20:50 2010 +0300
@@ -18,7 +18,7 @@
 #ifndef __SOUND_PLAYER_H
 #define  __SOUND_PLAYER_H
 
-#include <MdaAudioSamplePlayer.h>
+#include <mdaaudiosampleplayer.h>
 #include <StifTestModule.h>
 #include "EventTarget.h"
 #include "Parameters.h"
--- a/mmfenh/audiooutputcontrolutility/AudioOutputControlUtilityProxy/src/AudioOutputControlUtilityProxyImpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmfenh/audiooutputcontrolutility/AudioOutputControlUtilityProxy/src/AudioOutputControlUtilityProxyImpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -167,6 +167,7 @@
                 CleanupStack::Pop(iAudioOutput);
             else
                 CleanupStack::PopAndDestroy(iAudioOutput);
+                iAudioOutput = NULL;
             }
         return err;
         }
@@ -253,9 +254,12 @@
             {
             //in case of EMC sources
             CleanupStack::PopAndDestroy(iDRMConfigIntfc);
+            iDRMConfigIntfc = NULL;
             }
         CleanupStack::PopAndDestroy(iRestrictedAudioOutput);
         CleanupStack::PopAndDestroy(iFactory);
+        iFactory = NULL;
+        iRestrictedAudioOutput = NULL;
         }
         
     return err;
--- a/mmmw_plat/system_tone_service_api/inc/systemtoneservice.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/inc/systemtoneservice.h	Thu May 27 13:20:50 2010 +0300
@@ -13,11 +13,7 @@
  *
  * Description:
  * This file defines the API for System Tone Service which is
- * implemented in the systemtoneservice.dll.  This API uses
- * the private implementation pattern to help improve the BC
- * of the API by decoupling the implementation from the
- * interface. 
- *
+ * implemented in the systemtoneservice.dll.
  */
 
 #ifndef SYSTEMTONESERVICE_H_
@@ -32,18 +28,37 @@
 //Observer declaration
 /**
  *  Play Alarm Observer API definition.
- *  This defines the interface that must be implemented by Play Alarm
- *  Observers.
- *
+ *  This defines the interface that must be implemented by clients using
+ *  the PlayAlarm method.  This API allows the clients to observe  when
+ *  the Play Alarm completes.  The same observer can be used for different
+ *  PlayAlarm calls, even ones that are playing at the same time.
  */
 class MStsPlayAlarmObserver
     {
 public:
     /**
      * Informs the observer when the play alarm as indicated by the alarm
-     * context is complete.  This method will not be called when this alarm
-     * associated with the alarm context has been stopped with the StopAlarm
-     * method.
+     * context is complete.  This method is guaranteed to be called unless
+     * the alarm context has been stopped with the StopAlarm method, in
+     * which case the callback is guaranteed not to be called.
+     * 
+     * Implementations of this interface cannot make any assumptions about
+     * which thread this method is called on, it may or may not be the same
+     * thread from which the PlayAlarm was called.  It is up to the clients
+     * to provide what ever mutual exclusion protection that is needed for
+     * data accessed in this method.
+     * 
+     * In some cases and especially on SMP systems there is a chance that
+     * this method may be called before the PlayAlarm method returns.  It is
+     * up to the client to correctly handle this potential race condition.
+     * 
+     * Clients cannot assume properties about the thread that the callback
+     * is running on, for instance the thread may or may not have Active
+     * Scheduler.
+     * 
+     * It is strongly recommended that clients do as little as possible
+     * processing in this method and to complete this method as quickly as
+     * possible.
      *
      * @param aAlarmContext The context of the alarm that has completed.
      */
@@ -52,9 +67,15 @@
 
 // Class declaration
 /**
- *  System Tone Service API definition.
- *  This is the native C++ API for applications and middleware components
- *  to play standard system tones.
+ * System Tone Service API definition.
+ * This is the native C++ API for applications and middleware components
+ * to play standard system tones.  This API uses the Private Implementation
+ * (PIMPL) pattern to help improve the BC of the API by decoupling the
+ * implementation from the interface.
+ * 
+ * The methods of this class are guaranteed to be thread safe and may be
+ * used from any thread within the same process.  An instance of this class
+ * may not be shared between processes, even if the processes share memory.
  *
  *  @code
  *   CSystemToneService* sts = CSystemToneService::Create();
@@ -78,15 +99,30 @@
 NONSHARABLE_CLASS(CSystemToneService) : public CBase
     {
 public:
-    //** Constructor - returns NULL if construction fails */
+    /**
+     * Constructor
+     * Creates and initializes an instance of the System Tone Service.
+     * 
+     * @returns Either a pointer to the new CSystemToneService instance
+     *          or NULL if construction fails.
+     */
     IMPORT_C static CSystemToneService* Create();
 
-    //** Destructor */
+    /** Destructor
+     * Deinitializes and deletes the specified System Tone Service instance.  This method
+     * should not be called if an existing PlayAlarm has not yet completed or has not been
+     * stopped, otherwise whether or not the outstanding alarms actually plays or stops is
+     * not guaranteed.
+     * 
+     * @param[in] aSystemToneService A pointer to the CSystemToneService instance
+     *                           to be deleted.  This pointer will be invalid
+     *                           after this method completes.
+     */
     IMPORT_C static void Delete(CSystemToneService* aSystemToneService);
 
 public:
     // Data types
-    /** The type of System Tones that are supported by this API. */
+    /** The type of system tones that are supported by this API. */
     enum TToneType
         {
         // Capture Tones
@@ -136,7 +172,7 @@
         EVoiceAbort = 0x0703
         };
 
-    /** The type of System Alarms that are supported by this API. */
+    /** The type of system alarms that are supported by this API. */
     enum TAlarmType
         {
         // Calendar Alarms
@@ -151,31 +187,40 @@
         };
 
     /**
-     * Plays the specified tone.  If the tone type is not recognized a default tone will
-     * be played.  This method is for fixed duration tones that are expected 
-     * to play to completion and do not need to be stopped by the client.
+     * Plays the specified system tone.  If the tone type is not recognized, a default
+     * tone will be played.  Tones are short, fixed duration that always play to
+     * completion and cannot be stopped by the client.
      *
-     * @param aTone An input parameter that indicates the type of tone to play.
+     * @param[in] aTone The system tone type to play.
      */
     IMPORT_C void PlayTone(TToneType aTone);
 
     /**
-     * Plays the specified alarm.  If the alarm type is not recognized a default alarm will
-     * be played.  Alarms are tones that are not fixed duration such as a calendar alarm
-     * that can be manually stopped by the client, or the client needs to know when the alarm
-     * has completed playing.
+     * Plays the specified system alarm.  If the alarm type is not recognized, a default
+     * alarm will be played.  Alarms are tones that are long or not fixed duration such as a
+     * calendar alarm that can be manually stopped by the client.  The client is notified
+     * when an alarm playback completes if it is not manually stopped by the client.
      *
-     * @param aAlarn An input parameter that indicates the type of alarm to play.
-     * @param aAlarmContext An output parameter that provides back a unique context to
-     *  the client for this alarm that can be used for stopping the alarm.
+     * @param[in]  aAlarm        The system alarm type to play.
+     * @param[out] aAlarmContext A guaranteed globablly unique context representing this
+     *                           specific alarm playback that can be used for stopping the
+     *                           alarm or used to indicate to the observer which alarm playback
+     *                           has completed.
+     * @param[in] aObserver      A reference to the observer that is to be notified if this alarm
+     *                           playback completes before StopAlarm is called.  The same observer
+     *                           can be used for multiple PlayAlarms, even for ones playing at the
+     *                           same time.  It is the responsibility of the client to manage the
+     *                           life cycle of the observer.  However the observer must exist until
+     *                           all alarms the observer is associated with are either completed
+     *                           or stopped.
      */
     IMPORT_C void PlayAlarm(TAlarmType aAlarm, unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
 
     /**
-     * Stops the specified alarm playback.  If the playback has already completed or the
+     * Stops the specified system alarm playback.  If the playback has already completed or the
      * context is not valid, this method does nothing.
      *
-     * @param aAlarmContext The context to the alarm that is to be stopped.
+     * @param[in] aAlarmContext The context to the specific alarm that is to be stopped.
      */
     IMPORT_C void StopAlarm(unsigned int aAlarmContext);
 
--- a/mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/conf/systemtoneservicestif.cfg	Thu May 27 13:20:50 2010 +0300
@@ -135,7 +135,7 @@
 STSSTIF Create
 STSSTIF PlayAlarm ClockAlarm
 pause 10000
-STSSTIF PlayTone CalendarAlarm
+STSSTIF PlayTone DefaultTone
 pause 10000
 STSSTIF StopAlarm True
 STSSTIF Delete
--- a/mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/group/systemtoneservicestif.mmp	Thu May 27 13:20:50 2010 +0300
@@ -45,6 +45,7 @@
 
 SOURCEPATH      ../src
 
+SOURCE		systemtoneservicesactiveobj.cpp
 SOURCE          systemtoneservicestif.cpp
 SOURCE          systemtoneservicestifblocks.cpp
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmmw_plat/system_tone_service_api/tsrc/inc/systemtoneservicesactiveobj.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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 contains activeobject header for handling callbacks
+*
+*/
+
+
+
+#include <e32base.h>
+#include <systemtoneservice.h>
+
+
+ 
+
+
+class CStsActiveObj : public CActive
+{
+    
+    public:
+    CStsActiveObj( MStsPlayAlarmObserver* aObserver);
+    ~CStsActiveObj();
+
+    
+    public:     // Functions from base classes
+
+    /**
+    * RunL derived from CActive handles the completed requests.
+    */
+    void RunL();
+
+    /**
+    * DoCancel derived from CActive handles the cancel
+    */
+    void DoCancel();
+
+    /**
+    * RunError derived from CActive handles errors from active handler.
+    */
+    TInt RunError( TInt aError );
+   
+    
+
+    private:    // Data
+    MStsPlayAlarmObserver*   iObserver;
+   
+
+};
--- a/mmmw_plat/system_tone_service_api/tsrc/inc/systemtoneservicestif.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/inc/systemtoneservicestif.h	Thu May 27 13:20:50 2010 +0300
@@ -19,11 +19,13 @@
 #define SYSTEMTONESERVICESTIF_H
 
 //  INCLUDES
+#include <e32base.h>
 #include <StifLogger.h>
 #include <TestScripterInternal.h>
 #include <StifTestModule.h>
 #include <TestclassAssert.h>
 #include <systemtoneservice.h>
+#include "systemtoneservicesactiveobj.h"
 
 
 // CONSTANTS
@@ -140,10 +142,15 @@
     private:  
     	 // inherited from MPlayAlarmObserver
        virtual void PlayAlarmComplete(unsigned int aAlarmContext);
+       virtual void HandleEvent();
     	
+    	
+    	  
     	  // Data
         TPlayState            iPlayState;
         CSystemToneService*   iSts;
+          // Active object with a timer to timeout the test case
+        CStsActiveObj*        iCallbackController;   
         TUint                 iCurrentContext;
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicesactiveobj.cpp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 contains testclass implementation.
+*
+*/
+
+#include <e32base.h>
+#include <systemtoneservice.h>
+#include "systemtoneservicesactiveobj.h"
+
+CStsActiveObj::CStsActiveObj(MStsPlayAlarmObserver* aObserver) : CActive (EPriorityStandard)
+{
+    CActiveScheduler::Add(this);
+}
+
+
+
+
+
+CStsActiveObj::~ CStsActiveObj()
+{
+		if(IsActive())
+    {
+        Cancel();
+    }
+}
+
+
+void  CStsActiveObj::RunL()
+{
+	if(IsActive())
+    {
+        Cancel();
+    }
+    
+    SetActive();
+}
+
+
+void  CStsActiveObj::DoCancel()
+{
+    if(IsActive())
+    {
+        Cancel();
+    }
+}
+
+
+TInt  CStsActiveObj::RunError( TInt aError )
+{
+    
+    iObserver->PlayAlarmComplete(aError);
+    return aError;
+}
+
--- a/mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestif.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestif.cpp	Thu May 27 13:20:50 2010 +0300
@@ -80,7 +80,7 @@
                           CStifLogger::ETxt,
                           CStifLogger::EFile,
                           EFalse );
-    
+    iCallbackController = (CStsActiveObj*)(this);	
     SendTestClassVersion();
     }
 
@@ -111,6 +111,7 @@
 
     // Delete logger
     delete iLog; 
+    delete iCallbackController;
 
     }
 
--- a/mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestifblocks.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/system_tone_service_api/tsrc/src/systemtoneservicestifblocks.cpp	Thu May 27 13:20:50 2010 +0300
@@ -55,7 +55,8 @@
 
 void CSystemToneServiceStif::Delete()
     {
-
+				iSts = NULL;
+				iCallbackController = NULL;
     }
 
 
@@ -213,15 +214,30 @@
     
     return error;
 }
+
+
+void CSystemToneServiceStif::HandleEvent()
+	{
+		TEventIf event( TEventIf::ESetEvent, _L("Event_PlayAlarmComplete") );
+    TestModuleIf().Event( event );
+	}
+
+	
     
 void CSystemToneServiceStif::PlayAlarmComplete(unsigned int aAlarmContext)
     {
     if (aAlarmContext == iCurrentContext)
         {
+        	
+         _LIT( Ksystemtoneservicestif, "STS" );
+          _LIT( KPrint, "PlayAlarmComplete" );
+          TestModuleIf().Printf( 0, Ksystemtoneservicestif, KPrint );
+          // Print to log file
+          iLog->Log( KPrint );	
+        	
         iPlayState = EStopped;
-        TEventIf event( TEventIf::ESetEvent, _L("Event_PlayAlarmComplete") );
-        TestModuleIf().Event( event );
-        
+        iCallbackController->Cancel();
+        //HandleEvent();
         }
     }  
 
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsbuffer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsbuffer.h	Thu May 27 13:20:50 2010 +0300
@@ -35,6 +35,11 @@
 class TMSBuffer
     {
 public:
+    /*
+     * Destructor
+     */
+    virtual ~TMSBuffer() {}
+
     /**
      * Return buffer type.
      *
@@ -42,7 +47,8 @@
      *      Type of the buffer object (TMS_BUFFER_MEMORY).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint GetType(TMSBufferType& buftype) = 0;
@@ -56,7 +62,8 @@
      *      Time stamp in microseconds.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint GetTimeStamp(guint64& ts) = 0;
@@ -70,7 +77,8 @@
      *      Time stamp in microseconds.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint SetTimeStamp(const guint64 ts) = 0;
@@ -82,7 +90,8 @@
      *      Size of data in the buffer.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint GetDataSize(guint& size) = 0;
@@ -94,7 +103,8 @@
      *      Size of data in the buffer.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint SetDataSize(const guint size) = 0;
@@ -107,7 +117,8 @@
      *      Pointer to the data stored in the buffer.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     virtual gint GetDataPtr(guint8*& bufptr) = 0;
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmscall.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmscall.h	Thu May 27 13:20:50 2010 +0300
@@ -92,7 +92,8 @@
      *      Context ID.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FATAL_ERROR if an error occured.
      *
      */
@@ -108,7 +109,8 @@
      *      Created stream.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INSUFFICIENT_MEMORY if call creation failed due to
      *      insufficient memory.
      *      TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED if stream type is not
@@ -117,7 +119,7 @@
      *      TMS_REASON_EMERGENCY_CALL_ONGOING if emergency call is active.
      *      TMS_REASON_PERMISSION_DENIED if permission is denied.
      *      TMS_RESULT_INVALID_ARGUMENT if strm is not set to NULL.
-     *      TMS_RESULT_ALREADY_EXIST if the same streamtype is created 
+     *      TMS_RESULT_ALREADY_EXIST if the same streamtype is created
      *      multiple times.
      *
      */
@@ -130,7 +132,8 @@
      *      Stream to be deleted.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_ARGUMENT if the stream is not valid.
      */
     IMPORT_C gint DeleteStream(TMSStream*& strm);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsink.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsink.h	Thu May 27 13:20:50 2010 +0300
@@ -72,7 +72,8 @@
      *      Any user data passed to the function.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list.
      *
      */
@@ -88,7 +89,8 @@
      *      The listener to be removed.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_DOES_NOT_EXIST if obsrvr is not already in the list.
      *
      */
@@ -120,7 +122,8 @@
      *      The type of sink object (TMS_SINK_CLIENT).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSinkType& sinktype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsource.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsource.h	Thu May 27 13:20:50 2010 +0300
@@ -68,7 +68,8 @@
      *      Any user data passed to the function.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list.
      *
      */
@@ -140,7 +141,8 @@
      *      Toggles buffer enqueuing ON and OFF.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetEnqueueMode(const gboolean enable);
@@ -167,7 +169,8 @@
      * Has no effect in the PULL mode.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Flush();
@@ -185,7 +188,8 @@
      *          TMS_STREAM_MIC
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSourceType& sourcetype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsourceobsrvr.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsclientsourceobsrvr.h	Thu May 27 13:20:50 2010 +0300
@@ -20,7 +20,7 @@
 #define TMS_CLIENT_SOURCE_OBSRVR_H
 
 // Include files
-#include <glib.h>
+#include <tms.h>
 
 namespace TMS {
 
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsdtmf.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsdtmf.h	Thu May 27 13:20:50 2010 +0300
@@ -53,7 +53,8 @@
      *      Any user data passed to the function.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list.
      *
      */
@@ -79,7 +80,8 @@
      * Common for CS and VOIP (uplink and downlink)
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Start();
@@ -89,7 +91,8 @@
      * Common for CS and VOIP (Uplink and Downlink).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Stop();
@@ -102,7 +105,8 @@
      *      String containing one or more DTMF digits.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetTone(GString* string);
@@ -121,7 +125,8 @@
      *      Boolean to continue sending DTMF string.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint ContinueDTMFStringSending(gboolean sending);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsfactory.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsfactory.h	Thu May 27 13:20:50 2010 +0300
@@ -368,7 +368,8 @@
      *      Created DTMF player.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INSUFFICIENT_MEMORY if DTMF player creation failed due
      *      to insufficient memory.
      *      TMS_RESULT_FATAL_ERROR if an error occured.
@@ -385,7 +386,8 @@
      *      DTMF player to be deleted.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_ARGUMENT if the DTMF player is not valid.
      *
      */
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsformat.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsformat.h	Thu May 27 13:20:50 2010 +0300
@@ -64,7 +64,8 @@
      *      The typedef std::vector<guint> BitRateVector; list of codecs.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
      *
@@ -80,7 +81,8 @@
      *      Bitrate to be set for the encoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_ARGUMENT if requested bitrate is invalid.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
@@ -97,7 +99,8 @@
      *      Current bitrate.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
      *
@@ -111,7 +114,8 @@
      *      Type of the format object.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSFormatType& fmttype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsg711format.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsg711format.h	Thu May 27 13:20:50 2010 +0300
@@ -59,7 +59,8 @@
      *      Sets selected G.711 encoding or decoding mode.
 
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_STATE if this method is used during active
      *      encoding or decoding operation.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
@@ -82,7 +83,8 @@
      *      Returns current G.711 encoding or decoding mode.
 
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMode(TMSG711CodecMode& mode);
@@ -98,7 +100,8 @@
      *      Sets CNG feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_STATE if this method is used during active
      *      decoding operation.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
@@ -117,7 +120,7 @@
      *      Current CNG setting of the decoder.
      *
      * @return gint
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise system error..
      *
      */
     IMPORT_C gint GetCNG(gboolean& cng);
@@ -133,7 +136,7 @@
      *      Sets PLC feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise system error..
      *      TMS_RESULT_INVALID_STATE if this method is used during active
      *      decoding operation.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
@@ -151,7 +154,8 @@
      *      Current CNG setting of the decoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetPlc(gboolean& plc);
@@ -166,7 +170,8 @@
      *      Sets VAD feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
      *
@@ -182,7 +187,8 @@
      *      Current VAD setting of the encoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetVADMode(gboolean& vad);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsg729format.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsg729format.h	Thu May 27 13:20:50 2010 +0300
@@ -55,7 +55,8 @@
      *      Sets VAD feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
      *      TMS_RESULT_DOES_NOT_EXIST if the custom interface handle does
@@ -73,7 +74,8 @@
      *      Current VAD setting of the encoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetVADMode(gboolean& vad);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsgaineffect.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsgaineffect.h	Thu May 27 13:20:50 2010 +0300
@@ -94,7 +94,8 @@
      *      Gain level to be set.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetLevel(const guint level);
@@ -106,7 +107,8 @@
      *      Current mic gain level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetLevel(guint& level);
@@ -118,7 +120,8 @@
      *      Max gain level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMaxLevel(guint& level);
@@ -132,7 +135,8 @@
      *      Variable that contains the effect type on return.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSEffectType& effecttype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalgaineffect.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalgaineffect.h	Thu May 27 13:20:50 2010 +0300
@@ -96,7 +96,8 @@
      *      Gain level to be set.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetLevel(const guint level);
@@ -108,7 +109,8 @@
      *      Current mic gain level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetLevel(guint& level);
@@ -120,7 +122,8 @@
      *      Max mic gain level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMaxLevel(guint& level);
@@ -132,7 +135,8 @@
      *      Type of the effect object (TMS_EFFECT_GLOBAL_GAIN).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSEffectType& effecttype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalrouting.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalrouting.h	Thu May 27 13:20:50 2010 +0300
@@ -111,7 +111,8 @@
      *
      * @return
      *      TMS_RESULT_INVALID_ARGUMENT if set to TMS_AUDIO_OUTPUT_NONE.
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetOutput(const TMSAudioOutput output);
@@ -126,7 +127,8 @@
      *      Current audio output device.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetOutput(TMSAudioOutput& output);
@@ -141,7 +143,8 @@
      *      Previous audio output device.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetPreviousOutput(TMSAudioOutput& output);
@@ -157,7 +160,8 @@
      *      audio output devices (TMSAudioOutput-type).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetAvailableOutputs(OutputVector& outputs);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalvoleffect.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsglobalvoleffect.h	Thu May 27 13:20:50 2010 +0300
@@ -95,7 +95,8 @@
      * @param  level
      *      the volume level to be set.
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      */
     IMPORT_C gint SetLevel(const guint level);
 
@@ -106,7 +107,8 @@
      *      Volume level to be set.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetLevel(guint& level);
@@ -118,7 +120,8 @@
      *      Max volume level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMaxLevel(guint& level);
@@ -130,7 +133,8 @@
      *      Type of the effect object (TMS_EFFECT_GLOBAL_VOL).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSEffectType& effecttype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsilbcformat.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsilbcformat.h	Thu May 27 13:20:50 2010 +0300
@@ -59,7 +59,8 @@
      *      Sets selected iLBC encoding or decoding mode.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_STATE if this method is used during active
      *      encoding or decoding operation.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
@@ -84,7 +85,8 @@
      *      Returns current iLBC encoding or decoding mode.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMode(TMSILBCCodecMode& mode);
@@ -100,7 +102,8 @@
      *      Sets CNG feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_INVALID_STATE if this method is used during active
      *      decoding operation.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
@@ -121,7 +124,8 @@
      *      Current CNG setting of the decoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetCNG(gboolean& cng);
@@ -136,7 +140,8 @@
      *      Sets VAD feature on or off.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_FEATURE_NOT_SUPPORTED if this method is not implemented
      *      by the adaptation.
      *      TMS_RESULT_DOES_NOT_EXIST if the custom interface handle does
@@ -154,7 +159,8 @@
      *      Current VAD setting of the encoder.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetVADMode(gboolean& vad);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtone.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtone.h	Thu May 27 13:20:50 2010 +0300
@@ -29,7 +29,7 @@
 /**
  * TMSInbandTone class
 *
-* This class provides Inband tone playback capability to the TMS clients. 
+* This class provides Inband tone playback capability to the TMS clients.
 *
 * @lib tmsapi.lib
 *
@@ -52,7 +52,8 @@
      *      Any user data passed to the function.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list.
      *
      */
@@ -73,12 +74,13 @@
 
     /**
      * Starts the inband tone playback. The inband volume will correspond to
-     * the current downlink volume level. 
-     * 
+     * the current downlink volume level.
+     *
      * For CS calltype.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Start(TMSInbandToneType inbandtonetype);
@@ -87,7 +89,8 @@
      * Stops the inband tone playback.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Stop();
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtoneobsrvr.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsinbandtoneobsrvr.h	Thu May 27 13:20:50 2010 +0300
@@ -20,7 +20,7 @@
 #define TMS_INBAND_OBSRVR_H
 
 // Include files
-#include <glib.h>
+#include <tms.h>
 
 namespace TMS {
 
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsmicsource.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsmicsource.h	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,8 @@
      *      The type of sink object (TMS_SOURCE_MIC).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSourceType& sourcetype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsink.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsink.h	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,8 @@
      *      The type of sink object (TMS_SINK_MODEM).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSinkType& sinktype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsource.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsmodemsource.h	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,8 @@
      *      The type of sink object (TMS_SOURCE_MODEM).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSourceType& sourcetype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h	Thu May 27 13:20:50 2010 +0300
@@ -53,7 +53,8 @@
      *      Any user data passed to the function.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *      TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list.
      *
      */
@@ -98,7 +99,8 @@
      *            will be played from the phone book (if available).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Init(const TMSRingToneType type = TMS_RINGTONE_DEFAULT,
@@ -108,7 +110,8 @@
      * Deinit ring tone player.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Deinit();
@@ -117,7 +120,8 @@
      * Start ring tone playback.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Play();
@@ -126,7 +130,8 @@
      * Stop ring tone playback.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Stop();
@@ -135,7 +140,8 @@
      * Pause ring tone playback.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Pause();
@@ -144,7 +150,8 @@
      * Mute ring tone playback.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint Mute();
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsspeakersink.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsspeakersink.h	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,8 @@
      *      The type of sink object (TMS_SINK_SPEAKER).
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C virtual gint GetType(TMSSinkType& sinktype);
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h	Thu May 27 13:20:50 2010 +0300
@@ -254,7 +254,7 @@
      * sink is re-claimed by the client.
      *
      * @param  sink
-     *      Dink to removed from the stream.
+     *      Sink to removed from the stream.
      *
      * @return
      *      TMS_RESULT_SUCCESS if sink is removed successfully from the stream.
@@ -385,6 +385,17 @@
     IMPORT_C gint GetState();
 
     /**
+     * Get stream ID.
+     *
+     * This function can be called at any time.
+     *
+     * @return
+     *      Unique ID of the stream.
+     *
+     */
+    IMPORT_C gint GetStreamId();
+
+    /**
      * Get stream type.
      *
      * This function can be called at any time.
@@ -397,17 +408,6 @@
      *      Stream type indicating whether it is an uplink or downlink.
      *
      */
-    IMPORT_C gint GetStreamId();
-
-    /**
-     * Get stream ID.
-     *
-     * This function can be called at any time.
-     *
-     * @return
-     *      Unique ID of the stream.
-     *
-     */
     IMPORT_C gint GetStreamType();
 
     /**
--- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsvolumeeffect.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsvolumeeffect.h	Thu May 27 13:20:50 2010 +0300
@@ -96,7 +96,8 @@
      *      Volume level to be set.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint SetLevel(const guint level);
@@ -108,7 +109,8 @@
      *      Volume level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetLevel(guint& level);
@@ -120,7 +122,8 @@
      *      Max volume level.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetMaxLevel(guint& level);
@@ -134,7 +137,8 @@
      *      Variable that contains the effect type on return.
      *
      * @return
-     *      TMS_RESULT_SUCCESS if the operation was successful.
+     *      TMS_RESULT_SUCCESS if the operation was successful otherwise
+     *      system error.
      *
      */
     IMPORT_C gint GetType(TMSEffectType& effecttype);
--- a/mmserv/metadatautility/Src/MetaDataParser.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParser.cpp	Thu May 27 13:20:50 2010 +0300
@@ -31,6 +31,7 @@
 
 _LIT(KCharacterSetRscFile, "TopCharacterSet.rsc");
 
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -172,12 +173,7 @@
 #ifdef _DEBUG
      RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
 #endif
-    
-	if(aNum < 0 || aNum > 125 && aNum != 199)
-		{
-		return;
-		}
-	switch(aNum)
+   		switch(aNum)
 			{
 				case 0:
 					aGenrePtr.Append(KGenreBlues);
@@ -574,12 +570,7 @@
 #ifdef _DEBUG
      RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
 #endif
-
-	if(aNum < 0 || aNum > 125 && aNum != 199)
-		{
-		return;
-		}
-	switch(aNum)
+		switch(aNum)
 			{
 				case 0:
 					aGenrePtr.Append(KGenreBlues);
@@ -1277,6 +1268,26 @@
     }
 
 // -----------------------------------------------------------------------------
+// CMetaDataParser::CommonParseDesL
+// -----------------------------------------------------------------------------
+//
+void CMetaDataParser::CommonParseDesL(
+    const RArray<TMetaDataFieldId>& aWantedFields,
+    CMetaDataFieldContainer& aContainer )
+    {
+#ifdef _DEBUG
+     RDebug::Print(_L("CMetaDataParser::CommonParseDesL"));
+#endif
+
+     //Since this is for descriptor "source", by default it is not a DRM Protected file
+     _LIT(KNoProtection, "0");
+     aContainer.AppendL( EMetaDataProtected, KNoProtection );
+           
+     //Continue parsing the file
+     ParseL(aWantedFields, aContainer);
+    }
+
+// -----------------------------------------------------------------------------
 // CMetaDataParser::GetProtectedL
 // -----------------------------------------------------------------------------
 //
--- a/mmserv/metadatautility/Src/MetaDataParser.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParser.h	Thu May 27 13:20:50 2010 +0300
@@ -128,6 +128,17 @@
                 CMetaDataFieldContainer& aContainer );
 
         /**
+        * Parses the common metadata, the metadata fields are
+        * inserted into the container.
+        * @since 9.2
+        * @param aWantedFields An array of TMetaDataFieldId's. Empty array is interpreted as all fields.
+        * @param aContainer On return, metadata found in aSource is stored here
+        * @return void
+        */
+        void CommonParseDesL( const RArray<TMetaDataFieldId>& aWantedFields, 
+                CMetaDataFieldContainer& aContainer );
+
+        /**
         * Append DRM Protected data to the container.
         * @param aSource a Metadata source file.
         * @param aContainer On return, metadata ptotected data is stored here
--- a/mmserv/metadatautility/Src/MetaDataParserID3v22.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParserID3v22.cpp	Thu May 27 13:20:50 2010 +0300
@@ -619,10 +619,20 @@
 	TInt length = info.Length();
 	if ( length )
 		{
-		TReal sec = (TReal) atoi((char*)info.Ptr()) / 1000;
-		TBuf16<10> info1;
-		info1.Num(sec, TRealFormat (9, 3));
-		iContainer->AppendL( EMetaDataDuration, info1 );
+		HBufC* data16 = HBufC::NewLC( length );
+		TPtr unicode( data16->Des() );
+		if ( ConvertToUnicodeL(encoding, info, unicode) == KErrNone )
+			{
+			TLex16 lex(unicode);
+			TReal milliSec = 0;
+			TBuf16<10> info1;
+			
+			lex.Val(milliSec);				
+			info1.Num(milliSec/1000, TRealFormat (9, 3));
+			iContainer->AppendL( EMetaDataDuration, info1 );
+			}
+		CleanupStack::PopAndDestroy();  // data16
+		
 		}
 
 	CleanupStack::PopAndDestroy();  // frame
--- a/mmserv/metadatautility/Src/MetaDataParserID3v23.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParserID3v23.cpp	Thu May 27 13:20:50 2010 +0300
@@ -666,12 +666,20 @@
 	TInt length = info.Length();
 	if ( length )
 		{
-		TReal sec = ((TReal) atoi((char*)info.Ptr())) / 1000;
-		TBuf16<10> info1;
-		info1.Num(sec, TRealFormat (9, 3));
-		iContainer->AppendL( EMetaDataDuration, info1 );
+		HBufC* data16 = HBufC::NewLC( length );
+		TPtr unicode( data16->Des() );
+		if ( ConvertToUnicodeL(encoding, info, unicode) == KErrNone )
+			{
+			TLex16 lex(unicode);
+			TReal milliSec = 0;
+			TBuf16<10> info1;
+			
+			lex.Val(milliSec);				
+			info1.Num(milliSec/1000, TRealFormat (9, 3));
+			iContainer->AppendL( EMetaDataDuration, info1 );
+			}
+		CleanupStack::PopAndDestroy();  // data16
 		}
-
 	CleanupStack::PopAndDestroy();  // frame
 	}
 
--- a/mmserv/metadatautility/Src/MetaDataParserID3v24.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParserID3v24.cpp	Thu May 27 13:20:50 2010 +0300
@@ -673,10 +673,20 @@
 	TInt length = info.Length();
 	if ( length )
 		{
-		TReal sec = (TReal) atoi((char*)info.Ptr()) / 1000;
-		TBuf16<10> info1;
-		info1.Num(sec, TRealFormat (9, 3));
-		iContainer->AppendL( EMetaDataDuration, info1 );
+		HBufC* data16 = HBufC::NewLC( length );
+		TPtr unicode( data16->Des() );
+		if ( ConvertToUnicodeL(encoding, info, unicode) == KErrNone )
+			{
+			TLex16 lex(unicode);
+			TReal milliSec = 0;
+			TBuf16<10> info1;
+			
+			lex.Val(milliSec);				
+			info1.Num(milliSec/1000, TRealFormat (9, 3));
+			iContainer->AppendL( EMetaDataDuration, info1 );
+			}
+		CleanupStack::PopAndDestroy();  // data16
+		
 		}
 
 	CleanupStack::PopAndDestroy();  // frame
--- a/mmserv/metadatautility/Src/MetaDataParserRA.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParserRA.cpp	Thu May 27 13:20:50 2010 +0300
@@ -26,6 +26,8 @@
 #include <s32mem.h>
 #include <hxmetadatautil.h>
 #include "MetaDataSourceFile.h"
+#include "MetaDataSourceDescriptor.h"
+
 
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -51,6 +53,7 @@
     {
 	if ( ValidateL() )
 		{
+	    iExists = TRUE;
 		iHxMetaDataUtility = CHXMetaDataUtility::NewL();
 		}
 	else
@@ -114,13 +117,19 @@
 	HXMetaDataKeys::EHXMetaDataId id;
 	TFileName fileName;
 	
-	// Determine if user entered a TDesC filename or a RFile:
-	
-	if (((CMetaDataSourceFile&)iSource).IsFileHandler())
+	//Determine CMetaDataSourceDescriptor or CMetaDataSourceFile
+	CMetaDataSourceDescriptor* srcDesc = dynamic_cast<CMetaDataSourceDescriptor *>(&iSource);
+	if(srcDesc)
+	{
+		const TDesC8& des = srcDesc->GetDescriptor();
+		TRAPD(err, iHxMetaDataUtility->OpenDesL(des));
+		User::LeaveIfError(err);
+	}
+	else if (((CMetaDataSourceFile&)iSource).IsFileHandler())	// Determine if user entered a TDesC filename or a RFile:
 	{
 		RFile rFile;
 		rFile.Duplicate( ((CMetaDataSourceFile&)iSource).FileHandler() );
-		TRAPD(err, iHxMetaDataUtility->OpenFileL((RFile &)rFile));	// casting necessary--compile error	
+		TRAPD(err, iHxMetaDataUtility->OpenFileL(rFile));
 		rFile.Close();
 		User::LeaveIfError(err);
 	}
@@ -367,3 +376,4 @@
 	}	
 
 //  End of File
+
--- a/mmserv/metadatautility/Src/MetaDataParserWMA.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataParserWMA.cpp	Thu May 27 13:20:50 2010 +0300
@@ -28,6 +28,23 @@
 #include <s32mem.h>
 
 // CONSTANTS
+/***
+ *  File Properties Objects:
+ *  Object ID,          GUID,   128 [bits]
+ *  Object Size,        QWORD,  64 
+ *  File ID,            GUID,   128 
+ *  File Size,          QWORD,  64
+ *  Creation Date,      QWORD,  64
+ *  Data Packets Count, QWORD,  64
+ *  Play Duration,      QWORD,  64
+ *  Send Duration,      QWORD,  64
+ *  Preroll,            QWORD,  64
+ *  Flags,              DWORD,  32 
+ */
+const TInt KDurationOffset  = 64;       // duration offset from File Property object
+const TInt KPrerollOffset   = 80;       // preRoll offset from File Property object
+const TInt KFlagsOffset     = 88;       // flags offset from File Property object
+
 // ASF Header Object GUIDs 
   
 _LIT8 (KASFContentDescriptionObject, "75B22633668E11CFA6D900AA0062CE6C");
@@ -695,22 +712,37 @@
 //
 void CMetaDataParserWMA::GetDurationL()
 	{
-	TInt offset = iFilePropertiesOffset + 16;
-	TPtrC8 size8 = iHeaderData->Mid(offset, 8);
-	TInt size = ConvertToInt64(size8);
-	offset = iFilePropertiesOffset + 88;
-	TPtrC8 flags = iHeaderData->Mid(offset, 4);
-	TInt broadcastBit = (TInt) (flags[0] & 0x01);
-	if(broadcastBit == 1)
-		{
-		return; // duration not valid.
-		}
-	//offset = iFilePropertiesOffset + 48;
-	TPtrC8 duration8 = iHeaderData->Mid(offset - 24, 8); // 100 nanosec units
-	TReal sec = ((TReal)ConvertToInt64(duration8)) / 10000000; // seconds
-	TBuf16<10> des16;
-	des16.Num(sec, TRealFormat (9, 3));
+#ifdef _DEBUG
+    RDebug::Print(_L("CMetaDataParserWMA::GetDuration()"));
+#endif    
+    TInt offset = iFilePropertiesOffset + KFlagsOffset;
+    TPtrC8 flags = iHeaderData->Mid(offset, 4);
+    TInt broadcastBit = (TInt) (flags[0] & 0x01);
+    if(broadcastBit == 1)
+        {
+        return; // duration not valid.
+        }
+    
+    offset = iFilePropertiesOffset + KDurationOffset;
+    TPtrC8 duration8 = iHeaderData->Mid(offset, 8);     // 100 nanosec units
+    TReal durationSec = ((TReal)ConvertToInt64(duration8)) / 10000000; // seconds
+    
+    offset = iFilePropertiesOffset + KPrerollOffset;
+    TPtrC8 preRoll8 = iHeaderData->Mid(offset, 8);      // millisec units
+    TReal preRollSec = ((TReal)ConvertToInt64(preRoll8)) / 1000; // seconds
+    TReal sec = durationSec - preRollSec;               // not include preroll
+
+    TBuf16<10> des16;	
+    TRealFormat format(9, 3);                           // width=9, decimal place=3
+    // Use fixed format, and do not use Triads
+    format.iType = KRealFormatFixed | KDoNotUseTriads; 
+    des16.Num(sec, format);	                            // convert to string
+	
 	iContainer->AppendL( EMetaDataDuration, des16 );
+#ifdef _DEBUG
+    RDebug::Print(_L("CMetaDataParserWMA::GetDuration(), duration=%f"), sec);
+#endif 	
+	
 	}
 
 
--- a/mmserv/metadatautility/Src/MetaDataSourceDescriptor.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataSourceDescriptor.cpp	Thu May 27 13:20:50 2010 +0300
@@ -154,4 +154,9 @@
     return KErrNone;
     }
 
+const TDesC8& CMetaDataSourceDescriptor::GetDescriptor() const
+{
+	return iSource;
+}
+
 //  End of File
--- a/mmserv/metadatautility/Src/MetaDataSourceDescriptor.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataSourceDescriptor.h	Thu May 27 13:20:50 2010 +0300
@@ -100,10 +100,12 @@
 		*/
 		TInt Size( TInt& aSize ) const;
 
+		const TDesC8& GetDescriptor() const;
+
 	private:
 
         /**
-        * C++ default constructor.
+                * C++ default constructor.
         */
 		CMetaDataSourceDescriptor();
 
--- a/mmserv/metadatautility/Src/MetaDataUtilityBody.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/metadatautility/Src/MetaDataUtilityBody.cpp	Thu May 27 13:20:50 2010 +0300
@@ -18,6 +18,8 @@
 
 
 
+
+
 // INCLUDE FILES
 #include	<MetaDataFieldContainer.h>
 #include	<Oma2Agent.h>
@@ -152,7 +154,7 @@
 	iParser = FindParserDesL(aDes);
 	if ( iParser )
 		{
-		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
+		iParser->CommonParseDesL(aWantedFields, *iContainer);
 		}
 	}
 
@@ -697,7 +699,7 @@
 		}
 	if ( iParser )
 		{
-		iParser->CommonParseL((CMetaDataSourceFile*)iSource, aWantedFields, *iContainer);
+		iParser->CommonParseDesL(aWantedFields, *iContainer);
 		}
 	}	
 	
--- a/mmserv/radioutility/inc/RadioSession.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/inc/RadioSession.h	Thu May 27 13:20:50 2010 +0300
@@ -360,6 +360,8 @@
 class RRadioSession : public RSessionBase,
 					  public MCustomCommand
     {
+public: // New functions
+    IMPORT_C static RRadioSession* NewL();
 public:  // Constructors and destructor
 
 	/**
Binary file mmserv/radioutility/presetutility/conf/presetutility.confml has changed
Binary file mmserv/radioutility/presetutility/tsrc/cenrep/presetutility.confml has changed
Binary file mmserv/radioutility/presetutility/tsrc/conf/presetutility.confml has changed
--- a/mmserv/radioutility/radio_utility/src/RadioUtilityBody.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radio_utility/src/RadioUtilityBody.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
     {
     FUNC_LOG;
     INFO_1("Size of RRadioSession: %i", sizeof(RRadioSession) );
-    iRadioSession = new (ELeave) RRadioSession();
+    iRadioSession = RRadioSession::NewL();
     User::LeaveIfError(iRadioSession->Connect(*this, aPrimaryClient));
     }
 
--- a/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -3032,7 +3032,11 @@
 void CRadioServer::CompleteAsyncRequest(
     TInt aErrorCode )
     {
-    if ( iAsyncRequest && !(iAsyncRequest->iMessage.IsNull()) )
+    if ( !iAsyncRequest )
+        {
+        RADIO_RDEBUG_INT(_L("[RADIO-SVR] CompleteAsyncRequest(%d) - iAsyncRequest NULL"), aErrorCode);
+        }
+    else if ( !(iAsyncRequest->iMessage.IsNull()) )
         {
         RADIO_RDEBUG_INT2(_L("[RADIO-SVR] CompleteAsyncRequest(%d, %d) - Client alive"), iAsyncRequest->iType, aErrorCode);
         iAsyncRequest->iMessage.Complete(aErrorCode);
@@ -3055,7 +3059,11 @@
 void CRadioServer::CompleteSyncRequest(
     TInt aErrorCode )
     {
-    if ( iSyncRequest && !(iSyncRequest->iMessage.IsNull()) )
+    if ( !iSyncRequest )
+        {
+        RADIO_RDEBUG_INT(_L("[RADIO-SVR] CompleteSyncRequest(%d) - iSyncRequest NULL"), aErrorCode);
+        }
+    else if ( !(iSyncRequest->iMessage.IsNull()) )
         {
         RADIO_RDEBUG_INT2(_L("[RADIO-SVR] CompleteSyncRequest(%d, %d) - Client alive"), iSyncRequest->iType, aErrorCode);
         iSyncRequest->iMessage.Complete(aErrorCode);
--- a/mmserv/radioutility/radioserver/Session/Bwins/RadioSessionU.DEF	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/Bwins/RadioSessionU.DEF	Thu May 27 13:20:50 2010 +0300
@@ -67,4 +67,5 @@
 	?StationSeekByTP@RRadioSession@@QAEXH@Z @ 66 NONAME ; void RRadioSession::StationSeekByTP(int)
 	?Stop@RRadioSession@@QAEXH@Z @ 67 NONAME ; void RRadioSession::Stop(int)
 	?Version@RRadioSession@@QBE?AVTVersion@@XZ @ 68 NONAME ; class TVersion RRadioSession::Version(void) const
+	?NewL@RRadioSession@@SAPAV1@XZ @ 69 NONAME ; class RRadioSession * RRadioSession::NewL(void)
 
--- a/mmserv/radioutility/radioserver/Session/EABI/RadioSessionU.DEF	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/EABI/RadioSessionU.DEF	Thu May 27 13:20:50 2010 +0300
@@ -74,4 +74,5 @@
 	_ZTV13CRadioRequest @ 73 NONAME ; #<VT>#
 	_ZTV13RRadioSession @ 74 NONAME ; #<VT>#
 	_ZTV18CRadioEventHandler @ 75 NONAME ; #<VT>#
+	_ZN13RRadioSession4NewLEv @ 76 NONAME
 
--- a/mmserv/radioutility/radioserver/Session/Group/RadioSession.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/Group/RadioSession.mmp	Thu May 27 13:20:50 2010 +0300
@@ -35,6 +35,8 @@
 USERINCLUDE	../../../inc
 
 MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/internal
 
 LIBRARY		euser.lib
 LIBRARY		MmfControllerFramework.lib
+LIBRARY     flogger.lib
--- a/mmserv/radioutility/radioserver/Session/Src/RadioEventHandler.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/Src/RadioEventHandler.cpp	Thu May 27 13:20:50 2010 +0300
@@ -22,6 +22,13 @@
 #include    "RadioEventHandler.h"
 #include    "RadioClientServer.h"
 #include    "RadioDebug.h"
+#include    "trace.h"
+
+// This has to be the last include. 
+#ifdef STUB_CONSTELLATION
+#   include "RadioStubManager.h"
+#   define KRadioServerPropertyCategory KStub_KRadioServerPropertyCategory
+#endif //STUB_CONSTELLATION
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -40,6 +47,7 @@
 		iKey(aKey),
 		iObserver(aObserver)
     {
+    FUNC_LOG;
     if ( iKey == ERadioServPsAfSearchEnd )
     	{
 		// This is necessary to make sure AfSearchEnd comes in before FrequencyChanged event.
@@ -56,7 +64,7 @@
 //
 void CRadioEventHandler::ConstructL()
     {
-	RADIO_RDEBUG(_L("[RADIO-SESS] CRadioEventHandler::ConstructL()"));
+    FUNC_LOG;
 	CActiveScheduler::Add(this);
 	User::LeaveIfError( iProperty.Attach(KRadioServerPropertyCategory, iKey) );
 	iProperty.Subscribe(iStatus);
@@ -73,6 +81,7 @@
 	RRadioSession& aSession,
 	TUint aKey )
     {
+    FUNC_LOG;
     CRadioEventHandler* self = new( ELeave ) CRadioEventHandler(aObserver,aSession, aKey);
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -82,6 +91,7 @@
 // Destructor
 CRadioEventHandler::~CRadioEventHandler()
     {
+    FUNC_LOG;
 	if ( IsActive() )
 		{
 		Cancel();
@@ -95,6 +105,7 @@
 //
 void CRadioEventHandler::DoCancel()
     {
+    FUNC_LOG;
 	iProperty.Cancel();
     }
 
@@ -104,6 +115,7 @@
 //
 void CRadioEventHandler::RunL()
     {
+    FUNC_LOG;
     // Subscribe immediately before analyzing the notification to ensure that we
     // don't miss further updates.
 	iProperty.Subscribe(iStatus);
@@ -280,7 +292,7 @@
 			break;
 		default:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioEventHandler::RunL(): ERROR case default !!!"));
+			INFO("ERROR case default !!!");
 			User::Panic(_L("RadioServer"), KErrGeneral );
 			}
 			break;
--- a/mmserv/radioutility/radioserver/Session/Src/RadioRequest.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/Src/RadioRequest.cpp	Thu May 27 13:20:50 2010 +0300
@@ -21,6 +21,7 @@
 // INCLUDE FILES
 #include    "RadioRequest.h"
 #include    "RadioDebug.h"
+#include    "trace.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -43,6 +44,7 @@
 		iInt(0),
 		iIntPckg(iInt)
     {
+    FUNC_LOG;
     }
 
 // -----------------------------------------------------------------------------
@@ -52,7 +54,7 @@
 //
 void CRadioRequest::ConstructL()
     {
-	RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::ConstructL()"));
+    FUNC_LOG;
 	CActiveScheduler::Add(this);
     }
 
@@ -66,6 +68,7 @@
 	MRadioObserver& aObserver,
 	TRadioServerRequest aRequest )
     {
+    FUNC_LOG;
     CRadioRequest* self = new( ELeave ) CRadioRequest(aSession, aObserver, aRequest);
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -75,6 +78,8 @@
 // Destructor
 CRadioRequest::~CRadioRequest()
     {
+    FUNC_LOG;
+    INFO_1("My pointer: 0x%x", this );
 	if ( IsActive() )
 		{
 		Cancel();
@@ -91,6 +96,7 @@
 	TRadioServerRequest aRequest,
 	TInt aError )
     {
+    FUNC_LOG;
 	iRequest = aRequest;
 
 	TRequestStatus* stat = &iStatus;
@@ -104,6 +110,7 @@
 //
 void CRadioRequest::DoCancel()
     {
+    FUNC_LOG;
 	iSession.CancelRequest(iRequest);
     }
 
@@ -113,11 +120,12 @@
 //
 void CRadioRequest::RunL()
     {
+    FUNC_LOG;
 	TInt err = iStatus.Int();
 	if ( err == KErrCancel )
 		{
 		// Ignore the cancelled request
-		RADIO_RDEBUG_INT(_L("[RADIO-SESS] CRadioRequest::RunL():cancelled [%d]"), iRequest);
+		INFO_1("cancelled iRequest [%d]", iRequest);
 		return;
 		}
 
@@ -127,31 +135,31 @@
 		case ERadioServStationSeek:
 			{
 			iInt = iIntPckg();
-			RADIO_RDEBUG_INT(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServStationSeek [%d]"), iInt);
+			INFO_1("ERadioServStationSeek [%d]", iInt);
 			iObserver.StationSeekComplete(err, iInt);
 			}
 			break;
 		case ERadioServSetFrequency:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServSetFrequency"));
+			INFO("ERadioServSetFrequency");
 			iObserver.SetFrequencyComplete(err);
 			}
 			break;
 		case ERadioServRequestTunerControl:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServRequestTunerControl"));
+			INFO("ERadioServRequestTunerControl");
 			iObserver.RequestTunerControlComplete(err);
 			}
 			break;
 		case ERadioServSetFrequencyRange:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServSetFrequencyRange"));
+			INFO("ERadioServSetFrequencyRange");
 			iObserver.SetFrequencyRangeComplete(err);
 			}
 			break;
 		case ERadioServPlay:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServPlay"));
+			INFO("INFOERadioServPlay");
 			if ( err != KErrNone )
 				{
 				iObserver.RadioEventStateChange(EFalse, err);
@@ -161,21 +169,21 @@
 		case ERadioServStationSeekByPTY:
 			{
 			iInt = iIntPckg();
-			RADIO_RDEBUG_INT(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServStationSeekByPTY [%d]"), iInt);
+			INFO_1("ERadioServStationSeekByPTY [%d]", iInt);
 			iObserver.StationSeekByPTYComplete(err, iInt);
 			}
 			break;
 		case ERadioServStationSeekByTA:
 			{
 			iInt = iIntPckg();
-			RADIO_RDEBUG_INT(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServStationSeekByTA [%d]"), iInt);
+			INFO_1("ERadioServStationSeekByTA [%d]", iInt);
 			iObserver.StationSeekByTAComplete(err, iInt);
 			}
 			break;
 		case ERadioServStationSeekByTP:
 			{
 			iInt = iIntPckg();
-			RADIO_RDEBUG_INT(_L("[RADIO-SESS] CRadioRequest::RunL(): ERadioServStationSeekByTP [%d]"), iInt);
+			INFO_1("ERadioServStationSeekByTP [%d]", iInt);
 			iObserver.StationSeekByTPComplete(err, iInt);
 			}
 			break;
@@ -205,7 +213,7 @@
 			break;
 		default:
 			{
-			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioRequest::RunL(): ERROR case default !!!"));
+			INFO("ERROR case default !!!");
 			User::Panic(_L("RadioServer"), KErrGeneral );
 			break;
 			}
--- a/mmserv/radioutility/radioserver/Session/Src/RadioSession.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/radioutility/radioserver/Session/Src/RadioSession.cpp	Thu May 27 13:20:50 2010 +0300
@@ -25,6 +25,7 @@
 #include	"RadioRequest.h"
 #include	"RadioEventHandler.h"
 #include    "RadioDebug.h"
+#include    "trace.h"
 
 // CONSTANTS
 // Index to list of asynchronous requests that generates response to MRadioObserver.
@@ -54,7 +55,7 @@
 //
 static TInt StartServer()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] StartServer()"));
+    FUNC_LOG;
 
     const TUidType serverUid(KNullUid, KNullUid, KRadioServerUid3);
 
@@ -66,7 +67,7 @@
 
     if ( r != KErrNone )
 	    {
-		RADIO_RDEBUG_INT(_L("[RADIO-SESS] server.Create() failed [%d]"), r);
+		INFO_1("server.Create() failed [%d]", r);
         return r;
 	    }
 	TRequestStatus stat;
@@ -91,6 +92,18 @@
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
+// RRadioSession::NewL
+// Two-phased constructor except no need for ConstrucL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RRadioSession* RRadioSession::NewL()
+    {
+    FUNC_LOG;
+    RRadioSession* self = new (ELeave) RRadioSession();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
 // RRadioSession::RRadioSession
 // C++ default constructor can NOT contain any code, that
 // might leave.
@@ -103,6 +116,7 @@
 		iPrimaryClient(EFalse),
 		iRdsNotify(EFalse)
     {
+    FUNC_LOG;
     }
 
 // -----------------------------------------------------------------------------
@@ -114,11 +128,11 @@
 	MRadioObserver& aObserver,
 	TBool aPrimaryClient )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] Connect() entry"));
+    FUNC_LOG;
 	// check if already connected
 	if ( iConnected )
 		{
-		RADIO_RDEBUG(_L("[RADIO-SESS] Connect(): already connected"));
+		INFO("already connected");
 		return KErrAlreadyExists;
 		}
 
@@ -147,7 +161,7 @@
 
 	if ( err != KErrNone )
 		{
-		RADIO_RDEBUG_INT(_L("[RADIO-SESS] Connect(): Unable to start server [%d]"), err);
+		INFO_1("Unable to start server [%d]", err);
 		return err;
 		}
 
@@ -177,8 +191,7 @@
 		{
 		iRequests.ResetAndDestroy();
 		}
-
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] Connect() exit err=[%d]"), err);
+	INFO_1("exit err=[%d]", err);
 	return err;
 	}
 
@@ -188,6 +201,7 @@
 //
 EXPORT_C TVersion RRadioSession::Version() const
 	{
+    FUNC_LOG;
 	return(TVersion(KRadioServerVersionMajor, KRadioServerVersionMinor, KRadioServerVersionBuild));
 	}
 
@@ -197,7 +211,7 @@
 //
 EXPORT_C void RRadioSession::Close()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] Close() entry"));
+    FUNC_LOG;
 	iRequests.ResetAndDestroy();
 	iRequests.Close();
 
@@ -216,7 +230,6 @@
 			}
 		RSessionBase::Close();
 		}
-	RADIO_RDEBUG(_L("[RADIO-SESS] Close() exit"));
 	}
 
 //********** TunerUtility control begins
@@ -228,7 +241,6 @@
 EXPORT_C void RRadioSession::RequestTunerControl(
 	TRsTuner aTuner )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] RequestTunerControl()"));
 	if ( iConnected )
 		{
 		if ( iRequests[KReqRequestTunerControl]->IsActive() )
@@ -253,7 +265,6 @@
 EXPORT_C TInt RRadioSession::GetTunerCapabilities(
 	TRsTunerCapabilities& aCaps ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetTunerCapabilities()"));
 	if ( iConnected )
 		{
 		TPckg<TRsTunerCapabilities> caps(aCaps);
@@ -273,7 +284,7 @@
 EXPORT_C TInt RRadioSession::EnableTunerInOfflineMode(
 	TBool aEnable )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] EnableTunerInOfflineMode() [%d]"), aEnable);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServEnableTunerInOfflineMode,
@@ -292,7 +303,7 @@
 EXPORT_C void RRadioSession::SetFrequencyRange(
 	TRsFrequencyRange aRange )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] SetFrequencyRange() [%d]"), aRange);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqSetFrequencyRange]->IsActive() )
@@ -316,7 +327,7 @@
 //
 EXPORT_C void RRadioSession::CancelSetFrequencyRange()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CancelSetFrequencyRange()"));
+    FUNC_LOG;
 	if ( iConnected && iRequests[KReqSetFrequencyRange]->IsActive() )
 		{
 		iRequests[KReqSetFrequencyRange]->Cancel();
@@ -332,7 +343,7 @@
 	TInt& aMinFreq,
 	TInt& aMaxFreq) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetFrequencyRange()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsFrequencyRange> range(aRange);
@@ -354,7 +365,7 @@
 EXPORT_C void RRadioSession::SetFrequency(
 	TInt aFrequency )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] SetFrequency() [%d]"), aFrequency);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqSetFrequency]->IsActive() )
@@ -378,7 +389,7 @@
 //
 EXPORT_C void RRadioSession::CancelSetFrequency()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CancelSetFrequency()"));
+    FUNC_LOG;
 	if ( iConnected && iRequests[KReqSetFrequency]->IsActive() )
 		{
 		iRequests[KReqSetFrequency]->Cancel();
@@ -392,7 +403,7 @@
 EXPORT_C TInt RRadioSession::GetFrequency(
 	TInt& aFrequency ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetFrequency()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> frequency(aFrequency);
@@ -411,7 +422,7 @@
 EXPORT_C void RRadioSession::StationSeek(
 	TBool aUpwards )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] StationSeek() [%d]"), aUpwards);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqStationSeek]->IsActive() )
@@ -434,7 +445,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void RRadioSession::CancelStationSeek()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CancelStationSeek()"));
+    FUNC_LOG;
 	if ( iConnected && iRequests[KReqStationSeek]->IsActive() )
 		{
 		iRequests[KReqStationSeek]->Cancel();
@@ -447,7 +458,7 @@
 EXPORT_C TInt RRadioSession::GetSignalStrength(
 	TInt& aSignalStrength ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetSignalStrength()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> strength(aSignalStrength);
@@ -466,7 +477,7 @@
 EXPORT_C TInt RRadioSession::GetMaxSignalStrength(
 	TInt& aMaxSignalStrength ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetMaxSignalStrength()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> maxStrength(aMaxSignalStrength);
@@ -485,7 +496,7 @@
 EXPORT_C TInt RRadioSession::GetStereoMode(
 	TBool& aStereo ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetStereoMode()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> stereo(aStereo);
@@ -504,7 +515,7 @@
 EXPORT_C TInt RRadioSession::ForceMonoReception(
 	TBool aForcedMono )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] ForceMonoReception() [%d]"), aForcedMono);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServForceMonoReception,
@@ -522,7 +533,7 @@
 EXPORT_C TInt RRadioSession::GetForceMonoReception(
 	TBool& aForcedMono ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetForceMonoReception()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> mono(aForcedMono);
@@ -541,7 +552,7 @@
 EXPORT_C TInt RRadioSession::SetSquelch(
 	TBool aEnabled )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] SetSquelch() [%d]"), aEnabled);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServSetSquelch,
@@ -559,7 +570,7 @@
 EXPORT_C TInt RRadioSession::GetSquelch(
 	TBool& aSquelch ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetSquelch()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> squelch(aSquelch);
@@ -580,7 +591,7 @@
 EXPORT_C TInt RRadioSession::PlayerState(
 	TRsPlayerState& aState ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetPlayerState()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsPlayerState> state(aState);
@@ -598,7 +609,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void RRadioSession::Play()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] Play()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqPlay]->IsActive() )
@@ -619,14 +630,14 @@
 EXPORT_C void RRadioSession::Stop(
 	TBool aIfOnlyPrimaryClient )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] Stop() [%d]"), aIfOnlyPrimaryClient);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TInt err = Send(ERadioServStop,
 						TIpcArgs(&iDestinationPckg, aIfOnlyPrimaryClient));
 		if (err != KErrNone)
 			{
-			RADIO_RDEBUG_INT(_L("[RADIO-SESS] Stop() - err[%d]"), err);
+			INFO_1("err[%d]", err);
 			}
 		}
 	}
@@ -637,7 +648,7 @@
 EXPORT_C TInt RRadioSession::GetMaxVolume(
     TInt& aMaxVolume ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetMaxVolume()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> maxVolume(aMaxVolume);
@@ -656,7 +667,7 @@
 EXPORT_C TInt RRadioSession::SetVolume(
 	TInt aVolume )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] SetVolume() [%d]"), aVolume);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServSetVolume,
@@ -674,7 +685,7 @@
 EXPORT_C TInt RRadioSession::GetVolume(
 	TInt& aVolume ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetVolume()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> volume(aVolume);
@@ -693,7 +704,7 @@
 EXPORT_C TInt RRadioSession::SetVolumeRamp(
 	const TTimeIntervalMicroSeconds& aRampInterval )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] SetVolumeRamp()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckgBuf<TTimeIntervalMicroSeconds> interval(aRampInterval);
@@ -712,7 +723,7 @@
 EXPORT_C TInt RRadioSession::Mute(
 	TBool aMute )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] Mute() [%d]"), aMute);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServSetMute,
@@ -730,7 +741,7 @@
 EXPORT_C TInt RRadioSession::GetMuteStatus(
 	TBool& aMute ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] Mute()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> mute(aMute);
@@ -750,7 +761,7 @@
 	TInt aLeftPercentage,
 	TInt aRightPercentage )
 	{
-	RADIO_RDEBUG_INT2(_L("[RADIO-SESS] SetBalance() left=[%d] right=[%d]"), aLeftPercentage, aRightPercentage);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServSetBalance,
@@ -770,7 +781,7 @@
 	TInt& aLeftPercentage,
 	TInt& aRightPercentage ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetBalance()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> left(aLeftPercentage);
@@ -793,7 +804,7 @@
 EXPORT_C TInt RRadioSession::GetRdsCapabilities(
 	TRsRdsCapabilities& aCaps ) const
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetRdsCapabilities()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsRdsCapabilities> caps(aCaps);
@@ -813,7 +824,7 @@
 EXPORT_C TInt RRadioSession::GetRdsSignalStatus(
 	TBool& aRdsSignal ) const
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetRdsSignalStatus()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> signal(aRdsSignal);
@@ -833,7 +844,7 @@
 EXPORT_C TInt RRadioSession::NotifyRdsDataChange(
 	TRsRdsData aRdsData )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] NotifyRdsDataChange() [%d]"), aRdsData.iRdsFunctions);
+    FUNC_LOG;
 	if ( !iConnected )
 		{
 		return KErrDisconnected;
@@ -847,7 +858,7 @@
 	TRAPD(err, StartRdsEventHandlersL(aRdsData.iRdsFunctions));
 	if ( err != KErrNone )
 		{
-		RADIO_RDEBUG_INT(_L("[RADIO-SESS] NotifyRdsDataChange() err=[%d]"), err);
+		INFO_1("err=[%d]", err);
 		return err;
 		}
 	err = SendReceive(ERadioServNotifyRdsDataChange,
@@ -865,7 +876,7 @@
 //
 EXPORT_C void RRadioSession::CancelNotifyRdsDataChange()
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] CancelNotifyRdsDataChange()"));
+    FUNC_LOG;
 	if ( iConnected && iRdsNotify )
 		{
 		iRdsEventHandlers.ResetAndDestroy();
@@ -881,7 +892,7 @@
 EXPORT_C TInt RRadioSession::NotifyRadioTextPlusChange(
 	RArray<TInt>& /*aRtPlusClasses*/ )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] NotifyRadioTextPlusChange()"));
+    FUNC_LOG;
 	return KErrNotSupported;
 	}
 
@@ -891,7 +902,7 @@
 //
 EXPORT_C void RRadioSession::CancelNotifyRadioTextPlusChange()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CancelNotifyRadioTextPlusChange()"));
+    FUNC_LOG;
 	// NotifyRadioTextPlusChange is not supported
 	}
 
@@ -902,7 +913,7 @@
 EXPORT_C TInt RRadioSession::SetAutomaticSwitching(
 	TBool aAuto )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] SetAutomaticSwitching() [%d]"), aAuto);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(ERadioServSetAutomaticSwitching,
@@ -921,7 +932,7 @@
 EXPORT_C TInt RRadioSession::GetAutomaticSwitching(
 	TBool& aAuto )
 	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetAutomaticSwitching()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> autoSwitching(aAuto);
@@ -940,7 +951,7 @@
 //
 EXPORT_C void RRadioSession::CancelAFSearch()
 	{
-   	RADIO_RDEBUG(_L("[RADIO-SESS] CancelAFSearch()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		SendReceive(ERadioServCancelAFSearch, TIpcArgs(&iDestinationPckg));
@@ -954,7 +965,7 @@
 EXPORT_C TInt RRadioSession::SetAutomaticTrafficAnnouncement(
 	TBool /*aAuto*/ )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] SetAutomaticTrafficAnnouncement()"));
+    FUNC_LOG;
 	return KErrNotSupported;
 	}
 
@@ -965,7 +976,7 @@
 EXPORT_C TInt RRadioSession::GetAutomaticTrafficAnnouncement(
 	TBool& /*aAuto*/ )
 	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetAutomaticTrafficAnnouncement()"));
+    FUNC_LOG;
 	return KErrNotSupported;
    	}
 
@@ -977,7 +988,7 @@
 	TRsRdsProgrammeType aPty,
 	TBool aSeekUp )
    	{
-   	RADIO_RDEBUG_INT(_L("[RADIO-SESS] StationSeekByPTY() pty=[%d]"), aPty);
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqStationSeekByPTY]->IsActive() )
@@ -1002,7 +1013,7 @@
 EXPORT_C void RRadioSession::StationSeekByTA(
 	TBool aSeekUp )
    	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] StationSeekByTA()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqStationSeekByTA]->IsActive() )
@@ -1027,7 +1038,7 @@
 EXPORT_C void RRadioSession::StationSeekByTP(
 	TBool aSeekUp )
    	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] StationSeekByTP()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqStationSeekByTP]->IsActive() )
@@ -1051,7 +1062,7 @@
 //
 EXPORT_C void RRadioSession::CancelRdsStationSeek()
   	{
-   	RADIO_RDEBUG(_L("[RADIO-SESS] CancelRdsStationSeek()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		if ( iRequests[KReqStationSeekByPTY]->IsActive() )
@@ -1076,7 +1087,7 @@
 EXPORT_C void RRadioSession::GetFreqByPTY(
 	TRsRdsProgrammeType /*aPty*/ )
 	{
-  	RADIO_RDEBUG(_L("[RADIO-SESS] GetFreqByPTY()"));
+    FUNC_LOG;
 	iRequests[KReqInternal]->CompleteRequest(ERadioServGetFreqByPTY, KErrNotSupported);
   	}
 
@@ -1086,7 +1097,7 @@
 //
 EXPORT_C void RRadioSession::CancelGetFreqByPTY()
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CancelGetFreqByPTY()"));
+    FUNC_LOG;
 	// GetFreqByPTY is not supported
 	}
 
@@ -1096,7 +1107,7 @@
 //
 EXPORT_C void RRadioSession::GetFreqByTA()
 	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetFreqByTA()"));
+    FUNC_LOG;
 	iRequests[KReqInternal]->CompleteRequest(ERadioServGetFreqByTA, KErrNotSupported);
     }
 
@@ -1106,7 +1117,7 @@
 //
 EXPORT_C void RRadioSession::CancelGetFreqByTA()
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] CancelGetFreqByTA()"));
+    FUNC_LOG;
     // GetFreqByTA is not supported
 	}
 
@@ -1117,7 +1128,7 @@
 EXPORT_C void RRadioSession::GetPSByPTY(
 	TRsRdsProgrammeType /*aPty*/ )
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetPSByPTY()"));
+    FUNC_LOG;
 	iRequests[KReqInternal]->CompleteRequest(ERadioServGetPSByPTY, KErrNotSupported);
     }
 
@@ -1127,7 +1138,7 @@
 //
 EXPORT_C void RRadioSession::CancelGetPSByPTY()
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] CancelGetPSByPTY()"));
+    FUNC_LOG;
     // GetPSByPTY is not supported
 	}
 
@@ -1137,7 +1148,7 @@
 //
 EXPORT_C void RRadioSession::GetPSByTA()
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetPSByTA()"));
+    FUNC_LOG;
 	iRequests[KReqInternal]->CompleteRequest(ERadioServGetPSByTA, KErrNotSupported);
     }
 
@@ -1147,7 +1158,7 @@
 //
 EXPORT_C void RRadioSession::CancelGetPSByTA()
     {
-    RADIO_RDEBUG(_L("[RADIO-SESS] CancelGetPSByTA()"));
+    FUNC_LOG;
     // GetPSByTA is not supported
 	}
 
@@ -1158,7 +1169,7 @@
 EXPORT_C TInt RRadioSession::GetProgrammeIdentification(
 	TInt& aPi )
     {
- 	RADIO_RDEBUG(_L("[RADIO-SESS] GetProgrammeIdentification()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TInt> pi(aPi);
@@ -1178,7 +1189,7 @@
 EXPORT_C TInt RRadioSession::GetProgrammeType(
 	TRsRdsProgrammeType& aPty )
     {
-  	RADIO_RDEBUG(_L("[RADIO-SESS] GetProgrammeType()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsRdsProgrammeType> pty(aPty);
@@ -1198,7 +1209,7 @@
 EXPORT_C TInt RRadioSession::GetProgrammeService(
 	TRsRdsPSName& aPs )
     {
- 	RADIO_RDEBUG(_L("[RADIO-SESS] GetProgrammeService()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsRdsPSName> ps(aPs);
@@ -1218,7 +1229,7 @@
 EXPORT_C TInt RRadioSession::GetRadioText(
 	TRsRdsRadioText& aRt )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetRadioText()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TRsRdsRadioText> rt(aRt);
@@ -1239,7 +1250,7 @@
 	TRsRdsRTplusClass /*aRtPlusClass*/,
 	TRsRdsRadioText& /*aRtPlusData*/ )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetRadioText()"));
+    FUNC_LOG;
 	return KErrNotSupported;
 	}
 
@@ -1250,7 +1261,7 @@
 EXPORT_C TInt RRadioSession::GetClockTime(
 	TDateTime& aCt )
 	{
-    RADIO_RDEBUG(_L("[RADIO-SESS] GetClockTime()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TDateTime> ct(aCt);
@@ -1270,7 +1281,7 @@
 EXPORT_C TInt RRadioSession::GetTrafficAnnouncementStatus(
 	TBool& aTaStatus )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetTrafficAnnouncementStatus()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> taStatus(aTaStatus);
@@ -1290,7 +1301,7 @@
 EXPORT_C TInt RRadioSession::GetTrafficProgrammeStatus(
 	TBool& aTpStatus )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] GetTrafficProgrammeStatus()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		TPckg<TBool> tpStatus(aTpStatus);
@@ -1312,7 +1323,7 @@
 	const TDesC8& aDataTo1,
 	const TDesC8& aDataTo2 )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CustomCommandSync NoReturn()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(aFunction, TIpcArgs(&aDestination, &aDataTo1, &aDataTo2));
@@ -1333,7 +1344,7 @@
 	const TDesC8& aDataTo2,
 	TDes8& aDataFrom )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CustomCommandSync Return()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		return SendReceive(aFunction, TIpcArgs(&aDestination, &aDataTo1, &aDataTo2, &aDataFrom));
@@ -1354,7 +1365,7 @@
 	const TDesC8& aDataTo2,
 	TRequestStatus& aStatus )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CustomCommandAsync NoReturn()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		SendReceive(aFunction, TIpcArgs(&aDestination, &aDataTo1, &aDataTo2), aStatus);
@@ -1377,7 +1388,7 @@
 	TDes8& aDataFrom,
 	TRequestStatus& aStatus )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] CustomCommandAsync Return()"));
+    FUNC_LOG;
 	if ( iConnected )
 		{
 		SendReceive(aFunction, TIpcArgs(&aDestination, &aDataTo1, &aDataTo2, &aDataFrom), aStatus);
@@ -1396,7 +1407,8 @@
 void RRadioSession::CancelRequest(
 	TInt aRequest )
 	{
-	RADIO_RDEBUG_INT(_L("[RADIO-SESS] CancelRequest(): [%d]"), aRequest);
+    FUNC_LOG;
+	INFO_1("aRequest: [%d]", aRequest);
 	if ( iConnected )
 		{
 		SendReceive(ERadioServCancel, TIpcArgs(&iDestinationPckg, aRequest));
@@ -1413,8 +1425,7 @@
 void RRadioSession::StartRequestHandlersL(
 	MRadioObserver& aObserver )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] StartRequestHandlersL()"));
-
+    FUNC_LOG;
 	CRadioRequest* req = NULL;
 
 	req = CRadioRequest::NewLC(*this, aObserver, ERadioServNone);
@@ -1461,7 +1472,7 @@
 void RRadioSession::StartEventHandlersL(
 	MRadioObserver& aEventObserver )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] StartEventHandlersL()"));
+    FUNC_LOG;
 
 	CRadioEventHandler* handler = NULL;
 
@@ -1517,7 +1528,7 @@
 void RRadioSession::StartRdsEventHandlersL(
 	TUint32 aRdsFunction )
 	{
-	RADIO_RDEBUG(_L("[RADIO-SESS] StartRdsEventHandlersL()"));
+    FUNC_LOG;
 
 	iRdsEventHandlers.ResetAndDestroy();
 	CRadioEventHandler* handler = NULL;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/radioutility/radioserver/Session/Src/trace.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2009 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:
+* Trace macro definitions.
+*
+*/
+
+#ifndef TRACE_H
+#define TRACE_H
+
+#include <e32base.h> // TCleanupItem
+#include "traceconfiguration.hrh"
+
+#ifdef TRACE_INTO_FILE
+#include <flogger.h> // RFileLogger
+#else
+#include <e32debug.h> // RDebug
+#endif
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+//
+
+// NOTE!
+// Replace all COMPONENT_NAME occurnaces with your own component / module name.
+
+/**
+* Prefix trace macro to complete tracing with component name.
+* Returns TDesC which can be used directly with RDebug or RFileLogger.
+*/
+#define _PREFIX_TRACE( aMsg ) TPtrC( (const TText*)L"[Radio_Client_Session]: " L##aMsg )
+
+/**
+* Prefix error trace
+*/
+#define _PREFIX_ERROR( aMsg ) _PREFIX_TRACE( "[ERROR: %d]: " L##aMsg )
+
+/**
+* Prefix info trace.
+*/
+#define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg )
+
+/**
+* Prefix macro for strings
+*/
+#define _PREFIX_CHAR( aMsg ) (const char*)"[Radio_Client_Session]: " ##aMsg
+
+/**
+* Define needed directories if TRACE_INTO_FILE macro in use
+*/
+#ifdef TRACE_INTO_FILE
+
+    _LIT( KDir, "radio" );
+    _LIT( KFile, "radio.txt" );
+    _LIT( KFullPath, "c:\\logs\\radio\\" );
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Error trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef ERROR_TRACE
+
+    /**
+    * Error trace definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+        #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4 );\
+                }\
+            }
+        #define ERROR_5( aErr, aMsg, aP1, aP2, aP3, aP4, aP5 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4, aP5 );\
+                }\
+            }
+        #define ERROR_6( aErr, aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4, aP5 );\
+                }\
+            }
+            
+    #else//TRACE_INTO_FILE not defined
+    
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+        #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4 );\
+                }\
+            }
+        #define ERROR_5( aErr, aMsg, aP1, aP2, aP3, aP4, aP5 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4, aP5 );\
+                }\
+            }
+        #define ERROR_6( aErr, aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4, aP5, aP6 );\
+                }\
+            }
+    
+    #endif//TRACE_INTO_FILE
+
+    #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 ) ERROR_2( KErrGeneral, aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) ERROR_3( KErrGeneral, aMsg, aP1, aP3 )
+    #define ERROR_GEN_4( aMsg, aP1, aP2, aP3, aP4 ) ERROR_4( KErrGeneral, aMsg, aP1, aP3, aP4 )
+    #define ERROR_GEN_5( aMsg, aP1, aP2, aP3, aP4, aP5 ) ERROR_5( KErrGeneral, aMsg, aP1, aP3, aP4, aP5 )
+    #define ERROR_GEN_6( aMsg, aP1, aP2, aP3, aP4, aP5, aP6 ) ERROR_6( KErrGeneral, aMsg, aP1, aP3, aP4, aP5, aP6 )
+
+#else//ERROR_TRACE not defined
+
+    #define ERROR( aErr, aMsg )
+    #define ERROR_1( aErr, aMsg, aP1 )
+    #define ERROR_2( aErr, aMsg, aP1, aP2 )
+    #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )
+    #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 )
+    #define ERROR_5( aErr, aMsg, aP1, aP2, aP3, aP4, aP5 )
+    #define ERROR_6( aErr, aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )
+
+    #define ERROR_GEN( aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 )
+    #define ERROR_GEN_4( aMsg, aP1, aP2, aP3, aP4 )
+    #define ERROR_GEN_5( aMsg, aP1, aP2, aP3, aP4, aP5 )
+    #define ERROR_GEN_6( aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )
+
+#endif//ERROR_TRACE
+
+//-----------------------------------------------------------------------------
+// TRAP and trace with error macro
+//-----------------------------------------------------------------------------
+//
+#define TRAP_ERROR( aErr, aFunction )\
+    {\
+    TRAP( aErr, aFunction );\
+    TPtrC8 file( ( TText8* )__FILE__ );\
+    ERROR_2( aErr, "Trapped leave in '%S' line %d", &file, __LINE__);\
+    }
+
+//-----------------------------------------------------------------------------
+// Info trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef INFO_TRACE
+
+    /**
+    * Info log message definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define INFO( aMsg )\
+            {\
+            RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+        #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\
+            }
+        #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5 );\
+            }
+        #define INFO_6( aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5, aP6 );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+
+        #define INFO( aMsg )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+        #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\
+            }
+        #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5 );\
+            }
+        #define INFO_6( aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5, aP6 );\
+            }
+
+    #endif//TRACE_INTO_FILE
+        
+#else//INFO_TRACE not defined
+
+    #define INFO( aMsg )
+    #define INFO_1( aMsg, aP1 )
+    #define INFO_2( aMsg, aP1, aP2 )
+    #define INFO_3( aMsg, aP1, aP2, aP3 )
+    #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )
+    #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 )
+    #define INFO_6( aMsg, aP1, aP2, aP3, aP4, aP5, aP6 )
+
+#endif//INFO_TRACE
+
+//-----------------------------------------------------------------------------
+// Trace current client thread name and process id
+//-----------------------------------------------------------------------------
+//
+#ifdef CLIENT_TRACE
+
+    #define CLIENT_PROCESS\
+        {\
+        CLIENT_PROCESS_PREFIX( "" );\
+        }        
+
+    #define CLIENT_PROCESS_PREFIX( aPrefix )\
+        {\
+        RProcess process;\
+        TPtrC name( process.Name() );\
+        TSecureId sid( process.SecureId() );\
+        TPtrC prefix( _S( aPrefix ) );\
+        if( prefix.Length() )\
+            {\
+            INFO_3( "%S: CLIENT - Name: [%S], Sid: [0x%x]", &prefix, &name, sid.iId );\
+            }\
+        else\
+            {\
+            INFO_2( "CLIENT - Name: [%S], Sid: [0x%x]", &name, sid.iId );\
+            }\
+        process.Close();\
+        }        
+
+    #define CLIENT_MESSAGE( aMsg )\
+        {\
+        CLIENT_MESSAGE_PREFIX( "", aMsg );\
+        }
+
+    #define CLIENT_MESSAGE_PREFIX( aPrefix, aMsg )\
+        {\
+        RThread thread;\
+        TInt err = aMsg.Client( thread );\
+        if( err == KErrNone )\
+            {\
+            RProcess process;\
+            err = thread.Process( process );\
+            if( err == KErrNone )\
+                {\
+                TPtrC threadName( thread.Name() );\
+                TUid processUid( process.SecureId() );\
+                TPtrC prefix( _S( aPrefix ) );\
+                if( prefix.Length() )\
+                    {\
+                    INFO_4( "%S: MSG - Name: [%S], Sid: [0x%x], Message ID: [%d]",\
+                        &prefix,\
+                        &threadName,\
+                        processUid,\
+                        aMsg.Function() );\
+                    }\
+                else\
+                    {\
+                    INFO_3( "MSG - Name: [%S], Sid: [0x%x], Message ID: [%d]",\
+                        &threadName,\
+                        processUid,\
+                        aMsg.Function() );\
+                    }\
+                }\
+            process.Close();\
+            }\
+        thread.Close();\
+        }
+
+#else
+
+    #define CLIENT_PROCESS
+    #define CLIENT_PROCESS_PREFIX( aPrefix )
+    #define CLIENT_MESSAGE( aMsg )
+    #define CLIENT_MESSAGE_PREFIX( aPrefix, aMsg )
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Function trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef FUNC_TRACE
+
+    /**
+    * Function logging definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            TPtrC8 trace( _S8( aMsg ) );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, trace, aP1 );\
+            }\
+    
+    #else//TRACE_INTO_FILE not defined
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            RDebug::Printf( aMsg, aP1 );\
+            }\
+    
+    #endif//TRACE_INTO_FILE
+        
+    /**
+    * Function trace helper class.
+    * 
+    * NOTE:
+    * LC -methods cannot be trapped. Therefore if LC -method leaves
+    * END trace is used instead of LEAVE trace.
+    * If you have an idea how to round this problem please tell.
+    */
+    _LIT8( KFuncNameTerminator, "(" );
+    _LIT8( KFuncLeavePatternL, "L" );
+    class TFuncLog
+        {
+        public:
+            static void Cleanup( TAny* aPtr )
+                {
+                TFuncLog* self = static_cast< TFuncLog* >( aPtr );
+                self->iLeft = ETrue;
+                FUNC( _PREFIX_CHAR("%S-LEAVE"), &self->iFunc ); // Leave detected
+                }
+            inline TFuncLog( const char* aFunc ) :
+                    iFunc( aFunc ? _S8( aFunc ) : _S8("") ),
+                    iLeft( EFalse ),
+                    iCleanupItem( Cleanup, this ),
+                    iCanLeave( EFalse )
+                {
+                TInt pos( iFunc.Find( KFuncNameTerminator ) );
+                if( pos != KErrNotFound )
+                    {
+                    iFunc.Set( iFunc.Left( pos ) );
+                    iCanLeave = !iFunc.Right( KFuncLeavePatternL().Length() ).Compare( KFuncLeavePatternL );
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::PushL( iCleanupItem ); // Ignore warnings
+                        }
+                    }
+                FUNC( _PREFIX_CHAR("%S-START"), &iFunc );
+                }
+
+            inline ~TFuncLog()
+                {
+                if ( !iLeft )
+                    {
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::Pop( this ); // Pop the cleanup item
+                        }
+                    FUNC( _PREFIX_CHAR("%S-END"), &iFunc ); // Normally finished
+                    }
+                }
+
+        private: // Data
+            TPtrC8 iFunc;
+            TBool iLeft;
+            TCleanupItem iCleanupItem;
+            TBool iCanLeave;
+        };
+    #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ );
+    
+#else//FUNC_TRACE not defined
+
+    #define FUNC_LOG
+
+#endif//FUNC_TRACE
+
+//-----------------------------------------------------------------------------
+// Timestamp trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef TIMESTAMP_TRACE
+
+    #ifdef TRACE_INTO_FILE
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend,\
+                _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                    &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RDebug::Print( _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #endif//TRACE_INTO_FILE
+
+#else//TIMESTAMP_TRACE not defined
+
+    #define TIMESTAMP( aCaption )
+
+#endif//TIMESTAMP_TRACE
+
+#ifdef HEAP_TRACE
+
+    #ifdef TRACE_INTO_FILE
+
+        #define HEAP( aMsg )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace );\
+            }
+        #define HEAP_1( aMsg, aP1 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1 );\
+            }
+        #define HEAP_2( aMsg, aP1, aP2 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2 );\
+            }
+        #define HEAP_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3 );\
+            }
+        #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3, aP4 );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+
+        #define HEAP( aMsg )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace );\
+            }
+        #define HEAP_1( aMsg, aP1 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1 );\
+            }
+        #define HEAP_2( aMsg, aP1, aP2 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2 );\
+            }
+        #define HEAP_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3 );\
+            }
+        #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 )\
+            {\
+            TInt totalAllocSpace = 0;\
+            User::AllocSize( totalAllocSpace );\
+            RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3, aP4 );\
+            }
+
+    #endif//TRACE_INTO_FILE
+
+#else//HEAP_TRACE not defined
+
+    #define HEAP( aMsg )
+    #define HEAP_1( aMsg, aP1 )
+    #define HEAP_2( aMsg, aP1, aP2 )
+    #define HEAP_3( aMsg, aP1, aP2, aP3 )
+    #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 )
+
+#endif//HEAP_TRACE
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/radioutility/radioserver/Session/Src/traceconfiguration.hrh	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 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: 
+* Trace Macro Configurations.
+*
+*/
+
+
+#ifndef TRACECONFIGURATION_HRH
+#define TRACECONFIGURATION_HRH
+
+//-----------------------------------------------------------------------------
+// Trace definitions
+//-----------------------------------------------------------------------------
+//
+
+/**
+* Error trace enabled
+*/
+#ifdef _DEBUG
+    #define ERROR_TRACE
+#else
+    #undef ERROR_TRACE
+#endif
+
+/**
+* Info trace enabled
+*/
+#ifdef _DEBUG
+    #define INFO_TRACE
+#else
+    #undef INFO_TRACE
+#endif
+
+/**
+* Timestamp tracing on
+*/
+#ifdef _DEBUG
+    #define TIMESTAMP_TRACE
+#else
+    #undef TIMESTAMP_TRACE
+#endif
+
+/**
+* Tracing current client process and thread
+*/
+#ifdef _DEBUG
+    #define CLIENT_TRACE
+#else
+    #undef CLIENT_TRACE
+#endif
+
+/**
+* Function trace enabled
+*/
+#ifdef _DEBUG
+    #define FUNC_TRACE
+#else
+    #undef FUNC_TRACE
+#endif
+
+/**
+* Tracing into file enabled, default RDebug
+*/
+#undef TRACE_INTO_FILE
+
+#endif
+
--- a/mmserv/sts/group/bld.inf	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/group/bld.inf	Thu May 27 13:20:50 2010 +0300
@@ -16,8 +16,8 @@
  * whole of System Tone Service.
  */
 
-#include "../stsimplementation/group/bld.inf"
-#include "../stsplayer/group/bld.inf"
+#include "../sts/group/bld.inf"
+#include "../stsproxy/group/bld.inf"
 #include "../stsserver/group/bld.inf"
 
 PRJ_PLATFORMS
@@ -25,7 +25,7 @@
 
 PRJ_EXPORTS
 ../data/sts_stub.sis /epoc32/data/z/system/install/sts_stub.sis
-../rom/systemtoneservice.iby       CORE_MW_LAYER_IBY_EXPORT_PATH(systemtoneservice.iby)
+../rom/mmmwsystemtoneservice.iby       CORE_MW_LAYER_IBY_EXPORT_PATH(mmmwsystemtoneservice.iby)
 
 PRJ_MMPFILES
 systemtoneservice.mmp
--- a/mmserv/sts/group/systemtoneservice.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/group/systemtoneservice.mmp	Thu May 27 13:20:50 2010 +0300
@@ -23,15 +23,19 @@
 UID           0x1000008d 0x10207C8F
 CAPABILITY    ALL -TCB
 
+EPOCALLOWDLLDATA
+
 MW_LAYER_SYSTEMINCLUDE
-USERINCLUDE   ../inc
+
+USERINCLUDE   ../stsproxy/inc
 
 SOURCEPATH    ../src
 
 SOURCE        systemtoneservice.cpp
 
+NOSTRICTDEF
 DEFFILE       systemtoneservice.def
-NOSTRICTDEF
+
+STATICLIBRARY stsproxy.lib
 
 LIBRARY       euser.lib
-STATICLIBRARY stsimplementation.lib
--- a/mmserv/sts/inc/sts.h	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * 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 defines an interface to an System Tone Service used by the
- * STS Server for playing and stopping tones.  Only one instance of this
- * class is created by the server, and it exists for the lifetime of the
- * server.  This class manages all of the active players, and guarantees
- * that the context values are unique.
- */
-
-#ifndef STS_H_
-#define STS_H_
-
-#include <systemtoneservice.h>
-#include <map>
-
-#include "stsplayer.h"
-
-class CSts : private MStsPlayerObserver
-    {
-public:
-    static CSts* Create();
-    static void Delete(CSts* aSts);
-    void PlayTone(CSystemToneService::TToneType aTone);
-    void PlayAlarm(CSystemToneService::TAlarmType aAlarm,
-            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
-    void StopAlarm(unsigned int aAlarmContext);
-
-protected:
-    CSts();
-    virtual ~CSts();
-    bool Init();
-
-private:
-    void CleanUpPlayers();
-
-    // inherited from MPlayerObserver
-    virtual void PlayComplete(unsigned int aContext);
-
-private:
-    unsigned int iNextContext;
-    class CPlayerNode;
-    typedef std::map<unsigned int, CPlayerNode*> TPlayerMap;
-    TPlayerMap iPlayerMap;
-    };
-
-#endif //STS_H
--- a/mmserv/sts/inc/stsclientservercommon.h	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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 defines common types and constants used by the STS server
- * and sessions.
- */
-
-#ifndef STSCLIENTSERVERCOMMON_H_
-#define STSCLIENTSERVERCOMMON_H_
-
-// SYMBIAN INCLUDES
-#include <e32std.h>
-#include <systemtoneservice.h>
-
-// CONSTANTS
-_LIT( KStsServerFile, "StsServer" );
-_LIT( KStsServerName, "!StsServer" );
-
-const TInt KStsServerMajorVersion = 0;
-const TInt KStsServerMinorVersion = 1;
-const TInt KStsServerBuild = 0;
-
-// This type enumerates the client/server messages for the STS server.
-enum TStsServerCommandType
-    {
-    StsMsg_RegisterMsgQueue,
-    StsMsg_PlayTone,
-    StsMsg_PlayAlarm,
-    StsMsg_StopAlarm,
-    StsMsg_ENDMARKER
-    };
-
-const TStsServerCommandType KStsCmdLast =
-        (TStsServerCommandType) ((int) StsMsg_ENDMARKER - 1);
-
-enum TStsCallBackType
-    {
-    EStsShutdown,
-    EStsPlayAlarmComplete
-    };
-
-struct TStsCallBack
-    {
-    TStsCallBackType callBackType;
-    MStsPlayAlarmObserver* observer;
-    unsigned int alarmContext;
-    };
-
-#endif // STSCLIENTSERVERCOMMON_H_
--- a/mmserv/sts/inc/stsimplementation.h	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * 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 defines the interface to the class that provides the
- * implementation logic of the STS API.
- */
-
-#ifndef STSIMPLEMENTATION_H_
-#define STSIMPLEMENTATION_H_
-
-#include <systemtoneservice.h>
-
-class RStsSession;
-
-NONSHARABLE_CLASS(CStsImplementation) : public CBase
-    {
-public:
-    static CStsImplementation* Create();
-    virtual ~CStsImplementation();
-public:
-    void PlayTone(CSystemToneService::TToneType aTone);
-    void
-    PlayAlarm(CSystemToneService::TAlarmType aAlarm,
-            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
-    void StopAlarm(unsigned int aAlarmContext);
-private:
-    CStsImplementation();
-    bool Init();
-
-    RStsSession* iSession;
-    };
-
-#endif /* STSIMPLEMENTATION_H_ */
--- a/mmserv/sts/inc/stsplayer.h	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * 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 defines the interface for creating, playing,
- * stopping, and deleting an MMF player for a tone type.
- */
-#ifndef STSPLAYER_H_
-#define STSPLAYER_H_
-
-#include <MdaAudioSamplePlayer.h>
-#include <systemtoneservice.h>
-
-class MStsPlayerObserver
-    {
-public:
-    virtual void PlayComplete(unsigned int aContext) = 0;
-    };
-
-class CStsPlayer : private MMdaAudioPlayerCallback
-    {
-public:
-    static CStsPlayer* CreateTonePlayer(MStsPlayerObserver& aObserver,
-            CSystemToneService::TToneType aTone, unsigned int aContext);
-    static CStsPlayer* CreateAlarmPlayer(MStsPlayerObserver& aObserver,
-            CSystemToneService::TAlarmType aAlarm, unsigned int aContext);
-    virtual ~CStsPlayer();
-    void Play();
-    void Stop();
-
-protected:
-    CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName,
-            int aRepeatNumberOfTimes, unsigned int aContext);
-    bool Init();
-
-private:
-    void MapcInitComplete(TInt aError,
-            const TTimeIntervalMicroSeconds& aDuration);
-    void MapcPlayComplete(TInt aError);
-
-    MStsPlayerObserver& iObserver;
-    CMdaAudioPlayerUtility* iPlayer;
-    TPtrC iFileName;
-    int iRepeatNumberOfTimes;
-    unsigned int iContext;
-    };
-
-#endif // STSPLAYER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/rom/mmmwsystemtoneservice.iby	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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: STS IBY file
+*
+*/
+/*
+ * sts.iby
+ *
+ */
+
+#ifndef SYSTEMTONESERVICE_IBY
+#define SYSTEMTONESERVICE_IBY
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR/BUILD_DIR/systemtoneservice.dll         SHARED_LIB_DIR/systemtoneservice.dll
+file=ABI_DIR/BUILD_DIR/stsserver.exe                 SHARED_LIB_DIR/stsserver.exe
+
+//STS_Stub
+data=ZSYSTEM/install/sts_stub.sis                    System/Install/sts_stub.sis
+
+#endif //SYSTEMTONESERVICE_IBY
+
+//End of File
\ No newline at end of file
--- a/mmserv/sts/rom/systemtoneservice.iby	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* 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: STS IBY file
-*
-*/
-/*
- * sts.iby
- *
- */
-
-#ifndef SYSTEMTONESERVICE_IBY
-#define SYSTEMTONESERVICE_IBY
-
-#include <bldvariant.hrh>
-
-file=ABI_DIR/BUILD_DIR/systemtoneservice.dll         SHARED_LIB_DIR/systemtoneservice.dll
-file=ABI_DIR/BUILD_DIR/stsserver.exe                 SHARED_LIB_DIR/stsserver.exe
-
-//STS_Stub
-data=ZSYSTEM/install/sts_stub.sis                    System/Install/sts_stub.sis
-
-#endif //SYSTEMTONESERVICE_IBY
-
-//End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/group/bld.inf	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,20 @@
+/*
+ * 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 provides the information required for building the
+ * system tone service server side implementation.
+ */
+
+PRJ_MMPFILES
+sts.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/group/sts.mmp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,33 @@
+/*
+ * 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 is the project specification file for building the
+ * sts server side implementation static library.
+ */
+
+#include <platform_paths.hrh>
+
+TARGET          sts.lib
+TARGETTYPE      lib
+
+MW_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
+OS_LAYER_STDCPP_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+SOURCEPATH      ../src
+
+SOURCE          sts.cpp
+SOURCE          stsplayer.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/inc/sts.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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 defines an interface to an System Tone Service used by the
+ * STS Server for playing and stopping tones.  Only one instance of this
+ * class is created by the server, and it exists for the lifetime of the
+ * server.  This class manages all of the active players, and guarantees
+ * that the context values are unique.
+ */
+
+#ifndef STS_H_
+#define STS_H_
+
+#include <systemtoneservice.h>
+#include <map>
+
+#include "stsplayer.h"
+
+class CSts : private MStsPlayerObserver
+    {
+public:
+    static CSts* Create();
+    static void Delete(CSts* aSts);
+    void PlayTone(CSystemToneService::TToneType aTone);
+    void PlayAlarm(CSystemToneService::TAlarmType aAlarm,
+            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
+    void StopAlarm(unsigned int aAlarmContext);
+
+protected:
+    CSts();
+    virtual ~CSts();
+    bool Init();
+
+private:
+    void CleanUpPlayers();
+
+    // inherited from MPlayerObserver
+    virtual void PlayComplete(unsigned int aContext);
+
+private:
+    unsigned int iNextContext;
+    class CPlayerNode;
+    typedef std::map<unsigned int, CPlayerNode*> TPlayerMap;
+    TPlayerMap iPlayerMap;
+    };
+
+#endif //STS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/inc/stsplayer.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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 defines the interface for creating, playing,
+ * stopping, and deleting an MMF player for a tone type.
+ */
+#ifndef STSPLAYER_H_
+#define STSPLAYER_H_
+
+#include <mdaaudiosampleplayer.h>
+#include <systemtoneservice.h>
+
+class MStsPlayerObserver
+    {
+public:
+    virtual void PlayComplete(unsigned int aContext) = 0;
+    };
+
+class CStsPlayer : private MMdaAudioPlayerCallback
+    {
+public:
+    static CStsPlayer* CreateTonePlayer(MStsPlayerObserver& aObserver,
+            CSystemToneService::TToneType aTone, unsigned int aContext);
+    static CStsPlayer* CreateAlarmPlayer(MStsPlayerObserver& aObserver,
+            CSystemToneService::TAlarmType aAlarm, unsigned int aContext);
+    virtual ~CStsPlayer();
+    void Play();
+    void Stop();
+
+protected:
+    CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName,
+            int aRepeatNumberOfTimes, unsigned int aContext);
+    bool Init();
+
+private:
+    void MapcInitComplete(TInt aError,
+            const TTimeIntervalMicroSeconds& aDuration);
+    void MapcPlayComplete(TInt aError);
+
+    MStsPlayerObserver& iObserver;
+    CMdaAudioPlayerUtility* iPlayer;
+    TPtrC iFileName;
+    int iRepeatNumberOfTimes;
+    unsigned int iContext;
+    };
+
+#endif // STSPLAYER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/src/sts.cpp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,181 @@
+/*
+ * 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 provides the implementation of System Tone Service used
+ * by the STS Server.
+ */
+
+#include "sts.h"
+
+class CSts::CPlayerNode
+    {
+public:
+    CPlayerNode(CStsPlayer* aPlayer);
+    CPlayerNode(CStsPlayer* aPlayer, MStsPlayAlarmObserver& aObserver);
+    ~CPlayerNode();
+    bool HasObserver();
+    CStsPlayer* Player();
+    MStsPlayAlarmObserver& Observer();
+private:
+    CStsPlayer* iPlayer;
+    MStsPlayAlarmObserver* iObserver;
+    };
+
+CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer) :
+    iPlayer(aPlayer), iObserver(0)
+    {
+    }
+
+CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer,
+        MStsPlayAlarmObserver& aObserver) :
+    iPlayer(aPlayer), iObserver(&aObserver)
+    {
+    }
+
+CSts::CPlayerNode::~CPlayerNode()
+    {
+    delete iPlayer;
+    }
+
+bool CSts::CPlayerNode::HasObserver()
+    {
+    return iObserver != 0;
+    }
+
+CStsPlayer* CSts::CPlayerNode::Player()
+    {
+    return iPlayer;
+    }
+
+MStsPlayAlarmObserver& CSts::CPlayerNode::Observer()
+    {
+    return *iObserver;
+    }
+
+/*static*/CSts* CSts::Create()
+    {
+    CSts* self = new CSts();
+    if (self != 0)
+        {
+        bool successful = self->Init();
+        if (!successful)
+            {
+            delete self;
+            self = 0;
+            }
+        }
+    return self;
+    }
+
+/*static*/void CSts::Delete(CSts* aSts)
+    {
+    delete aSts;
+    }
+
+CSts::CSts() :
+    iNextContext(1)
+    {
+    }
+
+bool CSts::Init()
+    {
+    return true;
+    }
+
+CSts::~CSts()
+    {
+    CleanUpPlayers();
+    }
+
+void CSts::PlayTone(CSystemToneService::TToneType aTone)
+    {
+    CStsPlayer* player = CStsPlayer::CreateTonePlayer(*this, aTone,
+            iNextContext);
+    if (player != 0)
+        {
+        iPlayerMap[iNextContext] = new CPlayerNode(player);
+        iNextContext++;
+        if (iNextContext == 0)
+            iNextContext++;
+        player->Play();
+        }
+    else
+        {
+        //TODO: Add trace here
+        }
+    }
+
+void CSts::PlayAlarm(CSystemToneService::TAlarmType aAlarm,
+        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
+    {
+    CStsPlayer* player = CStsPlayer::CreateAlarmPlayer(*this, aAlarm,
+            iNextContext);
+    if (player != 0)
+        {
+        iPlayerMap[iNextContext] = new CPlayerNode(player, aObserver);
+        aAlarmContext = iNextContext;
+        iNextContext++;
+        if (iNextContext == 0)
+            iNextContext++;
+        player->Play();
+        }
+    else
+        {
+        //TODO: Add trace here
+        aAlarmContext = 0;
+        }
+    }
+
+void CSts::StopAlarm(unsigned int aAlarmContext)
+    {
+    CPlayerNode* node = iPlayerMap[aAlarmContext];
+    iPlayerMap.erase(aAlarmContext);
+    if (node)
+        {
+        node->Player()->Stop();
+        delete node;
+        }
+    else
+        {
+        //TODO: Add trace here
+        }
+    }
+
+void CSts::CleanUpPlayers()
+    {
+        while (!iPlayerMap.empty())
+            {
+            //TODO: Add trace here
+            StopAlarm(iPlayerMap.begin()->first);
+            }
+    }
+
+void CSts::PlayComplete(unsigned int aContext)
+    {
+    CPlayerNode* node = iPlayerMap[aContext];
+    iPlayerMap.erase(aContext);
+    if (node)
+        {
+        CStsPlayer* player = node->Player();
+        if (node->HasObserver())
+            {
+            node->Observer().PlayAlarmComplete(aContext);
+            }
+        delete node;
+        }
+    else
+        {
+        // TODO: log unexpected error
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/sts/src/stsplayer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,132 @@
+/*
+ * 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 provides the implementation for creating and deleting a
+ * an MMF based player for playing and stopping a tone playback.
+ */
+
+#include "stsplayer.h"
+
+_LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac");
+
+/*static*/CStsPlayer* CStsPlayer::CreateTonePlayer(
+        MStsPlayerObserver& aObserver, CSystemToneService::TToneType aTone,
+        unsigned int aContext)
+    {
+    CStsPlayer* self = 0;
+    switch (aTone)
+        {
+        default:
+            self = new CStsPlayer(aObserver, KDefaultFile, 0, aContext);
+            break;
+        }
+    if (self != 0)
+        {
+        bool successful = self->Init();
+        if (!successful)
+            {
+            delete self;
+            self = 0;
+            }
+        }
+    return self;
+    }
+
+/*static*/CStsPlayer* CStsPlayer::CreateAlarmPlayer(
+        MStsPlayerObserver& aObserver, CSystemToneService::TAlarmType aAlarm,
+        unsigned int aContext)
+    {
+    CStsPlayer* self = 0;
+    switch (aAlarm)
+        {
+        case CSystemToneService::EClockAlarm:
+            self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext);
+            break;
+        default:
+            self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext);
+            break;
+        }
+    if (self != 0)
+        {
+        bool successful = self->Init();
+        if (!successful)
+            {
+            delete self;
+            self = 0;
+            }
+        }
+    return self;
+    }
+
+CStsPlayer::CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName,
+        int aRepeatNumberOfTimes, unsigned int aContext) :
+    iObserver(aObserver), iPlayer(0), iFileName(aFileName),
+            iRepeatNumberOfTimes(aRepeatNumberOfTimes), iContext(aContext)
+    {
+    }
+
+bool CStsPlayer::Init()
+    {
+    TRAPD(result, iPlayer = CMdaAudioPlayerUtility::NewL(*this));
+    return result == KErrNone;
+    }
+
+CStsPlayer::~CStsPlayer()
+    {
+    delete iPlayer;
+    }
+
+void CStsPlayer::Play()
+    {
+    // Play the tone
+    TRAPD(err, iPlayer->OpenFileL(iFileName));
+
+    // If there is an error, indicate that the playback is complete. 
+    if (err)
+        {
+        //TODO: Add trace here
+        iObserver.PlayComplete(iContext);
+        }
+    }
+
+void CStsPlayer::Stop()
+    {
+    iPlayer->Stop();
+    }
+
+void CStsPlayer::MapcInitComplete(TInt aError,
+        const TTimeIntervalMicroSeconds& /*aDuration*/)
+    {
+    if (aError == KErrNone)
+        {
+        TTimeIntervalMicroSeconds delay = 0;
+        iPlayer->SetRepeats(iRepeatNumberOfTimes, delay);
+        iPlayer->Play();
+        }
+    else
+        {
+        //TODO: add trace
+        // Since there is an error, indicate that the playback is complete
+        iObserver.PlayComplete(iContext);
+        }
+    }
+
+void CStsPlayer::MapcPlayComplete(TInt aError)
+    {
+    if (aError != KErrNone)
+        {
+        //TODO: add trace
+        }
+    iObserver.PlayComplete(iContext);
+    }
--- a/mmserv/sts/stsimplementation/group/bld.inf	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/*
- * 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 provides the information required for building the
- * system tone service implementation.
- */
-
-PRJ_MMPFILES
-stsimplementation.mmp
--- a/mmserv/sts/stsimplementation/group/stsimplementation.mmp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * 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 is the project specification file for building the
- * stsimplementation static library.
- */
-
-#include <platform_paths.hrh>
-
-TARGET          stsimplementation.lib
-TARGETTYPE      lib
-
-MW_LAYER_SYSTEMINCLUDE
-USERINCLUDE     ../../inc
-
-SOURCEPATH      ../src
-
-SOURCE          stsimplementation.cpp rstssession.cpp
--- a/mmserv/sts/stsimplementation/src/rstssession.cpp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * 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:
- * The file provides the implementation of the client side session
- * to the STS Server.
- */
-
-#include "rstssession.h"
-#include "stsclientservercommon.h"
-
-const TUint KNumSlots = 30;
-
-/*static*/TInt RStsSession::CallBackThreadMain(TAny* aSession)
-    {
-    TInt err = KErrNoMemory;
-
-    RThread myThread;
-    myThread.SetPriority(EPriorityAbsoluteHigh);
-    myThread.Close();
-
-    CTrapCleanup* cleanup = CTrapCleanup::New();
-
-    if (cleanup)
-        {
-        // Run the server and request a thread rendezvous.
-        TRAP( err, ((RStsSession*)aSession)->RunThreadL() );
-        delete cleanup;
-        }
-
-    return err;
-    }
-
-void RStsSession::RunThreadL()
-    {
-    // Initialisation complete, now signal the client, if requested.
-    RThread::Rendezvous(KErrNone);
-
-    while (true)
-        {
-        TStsCallBack message;
-        iMsgQueue.ReceiveBlocking(message);
-        TStsCallBackType type = message.callBackType;
-        if (type == EStsPlayAlarmComplete)
-            {
-            message.observer->PlayAlarmComplete(message.alarmContext);
-            }
-        else if (type == EStsShutdown)
-            {
-            break;
-            }
-        else
-            {
-            //TODO: Log error message
-            }
-        }
-    }
-
-TInt RStsSession::StartMsgQueue()
-    {
-    // Create a nameless global message queue, then pass the handle to the queue to the server.
-    TInt err = iMsgQueue.CreateGlobal(KNullDesC, 30);
-    if (err == KErrNone)
-        {
-        err = SendReceive(StsMsg_RegisterMsgQueue, TIpcArgs(iMsgQueue));
-        }
-    return err;
-    }
-
-TInt RStsSession::StartServer()
-    {
-    TInt err = KErrNone;
-
-    // Launch the server executable (i.e. in it its own process).
-
-    // Create a new server process. Simultaneous launching of two such processes 
-    // should be detected when the second one attempts to create the server 
-    // object, failing with KErrAlreadyExists.
-    RProcess server;
-    err = server.Create(KStsServerFile, KNullDesC);
-
-    if (err == KErrNone)
-        {
-        TRequestStatus rendezvousStatus;
-        server.Rendezvous(rendezvousStatus);
-        server.Resume();
-
-        // wait for start or death
-        User::WaitForRequest(rendezvousStatus);
-
-        // we can't use the 'exit reason' if the server panicked as this
-        // is the panic 'reason' and may be '0' which cannot be distinguished
-        // from KErrNone  
-        if (server.ExitType() == EExitPanic)
-            {
-            err = KErrGeneral;
-            }
-        else
-            {
-            err = rendezvousStatus.Int();
-            }
-        }
-
-    server.Close();
-
-    return err;
-    }
-
-TInt RStsSession::StartThread()
-    {
-    TInt result = iThread.Create(KNullDesC,
-            RStsSession::CallBackThreadMain, KDefaultStackSize,
-            &User::Heap(), (TAny*) this);
-
-    if (result == KErrNone)
-        {
-        TRequestStatus rendezvousStatus = KRequestPending;
-
-        //  Register for rendezvous notification when thread is started.
-        iThread.Rendezvous(rendezvousStatus);
-
-        // Start the thread execution
-        iThread.Resume();
-
-        // Wait for thread to start.
-        User::WaitForRequest(rendezvousStatus);
-
-        result = rendezvousStatus.Int();
-
-        if (result != KErrNone)
-            {
-            iThread.Kill(result);
-            }
-        }
-
-    return result;
-    }
-
-TInt RStsSession::Connect()
-    {
-    // Try to create a session with the server
-    TInt result = CreateSession(KStsServerName, TVersion(
-            KStsServerMajorVersion, KStsServerMinorVersion, KStsServerBuild),
-            KNumSlots, EIpcSession_Sharable);
-
-    // If the server wasn't found, start the server and try creating a session again
-    if (result == KErrNotFound)
-        {
-        result = StartServer();
-        if (result == KErrNone || result == KErrAlreadyExists)
-            {
-            result = CreateSession(KStsServerName, TVersion(
-                    KStsServerMajorVersion, KStsServerMinorVersion,
-                    KStsServerBuild), KNumSlots, EIpcSession_Sharable);
-            }
-        }
-
-    // Create thread for receiving asynch callbacks from the server
-    if (result == KErrNone)
-        {
-        result = StartMsgQueue();
-        if (result == KErrNone)
-            {
-            result = StartThread();
-            }
-        }
-
-    return result;
-    }
-
-void RStsSession::Close()
-    {
-    TRequestStatus logonStatus = KRequestPending;
-    iThread.Logon(logonStatus);
-    RSessionBase::Close();
-    User::WaitForRequest(logonStatus);
-    iThread.Close();
-    iMsgQueue.Close();
-    }
-
-TInt RStsSession::SendPlayTone(CSystemToneService::TToneType aTone)
-    {
-    return SendReceive(StsMsg_PlayTone, TIpcArgs(aTone));
-    }
-
-TInt RStsSession::SendPlayAlarm(CSystemToneService::TAlarmType aAlarm,
-        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
-    {
-    TPckg<unsigned int> alarmContextPckg(aAlarmContext);
-    return SendReceive(StsMsg_PlayAlarm, TIpcArgs(aAlarm, &alarmContextPckg,
-            &aObserver));
-    }
-
-TInt RStsSession::SendStopAlarm(unsigned int aAlarmContext)
-    {
-    return SendReceive(StsMsg_StopAlarm, TIpcArgs(aAlarmContext));
-    }
--- a/mmserv/sts/stsimplementation/src/rstssession.h	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * 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 defines the interface to the client side session of the
- * STS Server.
- */
-
-#ifndef RSTSSESSION_H_
-#define RSTSSESSION_H_
-
-#include <e32msgqueue.h>
-#include <systemtoneservice.h>
-
-#include "stsclientservercommon.h"
-
-class RStsSession : public RSessionBase
-    {
-public:
-
-    TInt Connect();
-
-    void Close();
-
-    TInt SendPlayTone(CSystemToneService::TToneType aTone);
-
-    TInt SendPlayAlarm(CSystemToneService::TAlarmType aAlarm,
-            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
-
-    TInt SendStopAlarm(unsigned int aAlarmContext);
-
-private:
-
-    static TInt CallBackThreadMain(TAny* aSession);
-    void RunThreadL();
-    
-    TInt StartMsgQueue();
-    TInt StartServer();
-    TInt StartThread();
-
-    RThread iThread;
-    RMsgQueue<TStsCallBack> iMsgQueue;
-    };
-
-#endif // RSTSSESSION_H_
--- a/mmserv/sts/stsimplementation/src/stsimplementation.cpp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * 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:
- * The file provides the actual implementation of the STS API.
- * All of the STS API methods are implemented by passing the
- * calls to the STS Server through the client side STS
- * Session.
- */
-
-//  Include Files  
-#include "stsimplementation.h"
-#include "rstssession.h"
-
-//  Member Functions
-/*static*/CStsImplementation* CStsImplementation::Create()
-    {
-    CStsImplementation* self = new CStsImplementation();
-    if (self != 0)
-        {
-        bool successful = self->Init();
-        if (!successful)
-            {
-            delete self;
-            self = 0;
-            }
-        }
-    return self;
-    }
-
-CStsImplementation::CStsImplementation() :
-    iSession(NULL)
-    {
-    }
-
-CStsImplementation::~CStsImplementation()
-    {
-    iSession->Close();
-    delete iSession;
-    }
-
-bool CStsImplementation::Init()
-    {
-    bool result = false;
-    iSession = new RStsSession();
-    if (iSession)
-        {
-        TInt err = iSession->Connect();
-        result = err == KErrNone;
-        }
-    return result;
-    }
-
-void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone)
-    {
-    iSession->SendPlayTone(aTone);
-    }
-
-void CStsImplementation::PlayAlarm(CSystemToneService::TAlarmType aAlarm,
-        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
-    {
-    //TODO: Add logging and error checking
-    iSession->SendPlayAlarm(aAlarm, aAlarmContext, aObserver);
-    }
-
-void CStsImplementation::StopAlarm(unsigned int aAlarmContext)
-    {
-    //TODO: Add logging and error checking
-    iSession->SendStopAlarm(aAlarmContext);
-    }
--- a/mmserv/sts/stsplayer/group/bld.inf	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/*
- * 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 provides the information required for building the
- * system tone service player.
- */
-
-PRJ_MMPFILES
-stsplayer.mmp
--- a/mmserv/sts/stsplayer/group/stsplayer.mmp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * 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 is the project specification file for building the
- * stsimplementation static library.
- */
-
-#include <platform_paths.hrh>
-
-TARGET          stsplayer.lib
-TARGETTYPE      lib
-
-MW_LAYER_SYSTEMINCLUDE
-OS_LAYER_LIBC_SYSTEMINCLUDE
-OS_LAYER_STDCPP_SYSTEMINCLUDE
-USERINCLUDE     ../../inc
-
-SOURCEPATH      ../src
-
-SOURCE          sts.cpp
-SOURCE          stsplayer.cpp
--- a/mmserv/sts/stsplayer/src/sts.cpp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * 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 provides the implementation of System Tone Service used
- * by the STS Server.
- */
-
-#include "sts.h"
-
-class CSts::CPlayerNode
-    {
-public:
-    CPlayerNode(CStsPlayer* aPlayer);
-    CPlayerNode(CStsPlayer* aPlayer, MStsPlayAlarmObserver& aObserver);
-    ~CPlayerNode();
-    bool HasObserver();
-    CStsPlayer* Player();
-    MStsPlayAlarmObserver& Observer();
-private:
-    CStsPlayer* iPlayer;
-    MStsPlayAlarmObserver* iObserver;
-    };
-
-CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer) :
-    iPlayer(aPlayer), iObserver(0)
-    {
-    }
-
-CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer,
-        MStsPlayAlarmObserver& aObserver) :
-    iPlayer(aPlayer), iObserver(&aObserver)
-    {
-    }
-
-CSts::CPlayerNode::~CPlayerNode()
-    {
-    delete iPlayer;
-    }
-
-bool CSts::CPlayerNode::HasObserver()
-    {
-    return iObserver != 0;
-    }
-
-CStsPlayer* CSts::CPlayerNode::Player()
-    {
-    return iPlayer;
-    }
-
-MStsPlayAlarmObserver& CSts::CPlayerNode::Observer()
-    {
-    return *iObserver;
-    }
-
-/*static*/CSts* CSts::Create()
-    {
-    CSts* self = new CSts();
-    if (self != 0)
-        {
-        bool successful = self->Init();
-        if (!successful)
-            {
-            delete self;
-            self = 0;
-            }
-        }
-    return self;
-    }
-
-/*static*/void CSts::Delete(CSts* aSts)
-    {
-    delete aSts;
-    }
-
-CSts::CSts() :
-    iNextContext(1)
-    {
-    }
-
-bool CSts::Init()
-    {
-    return true;
-    }
-
-CSts::~CSts()
-    {
-    CleanUpPlayers();
-    }
-
-void CSts::PlayTone(CSystemToneService::TToneType aTone)
-    {
-    CStsPlayer* player = CStsPlayer::CreateTonePlayer(*this, aTone,
-            iNextContext);
-    if (player != 0)
-        {
-        iPlayerMap[iNextContext] = new CPlayerNode(player);
-        iNextContext++;
-        if (iNextContext == 0)
-            iNextContext++;
-        player->Play();
-        }
-    else
-        {
-        //TODO: Add trace here
-        }
-    }
-
-void CSts::PlayAlarm(CSystemToneService::TAlarmType aAlarm,
-        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
-    {
-    CStsPlayer* player = CStsPlayer::CreateAlarmPlayer(*this, aAlarm,
-            iNextContext);
-    if (player != 0)
-        {
-        iPlayerMap[iNextContext] = new CPlayerNode(player, aObserver);
-        aAlarmContext = iNextContext;
-        iNextContext++;
-        if (iNextContext == 0)
-            iNextContext++;
-        player->Play();
-        }
-    else
-        {
-        //TODO: Add trace here
-        aAlarmContext = 0;
-        }
-    }
-
-void CSts::StopAlarm(unsigned int aAlarmContext)
-    {
-    CPlayerNode* node = iPlayerMap[aAlarmContext];
-    iPlayerMap.erase(aAlarmContext);
-    if (node)
-        {
-        node->Player()->Stop();
-        delete node;
-        }
-    else
-        {
-        //TODO: Add trace here
-        }
-    }
-
-void CSts::CleanUpPlayers()
-    {
-        while (!iPlayerMap.empty())
-            {
-            //TODO: Add trace here
-            StopAlarm(iPlayerMap.begin()->first);
-            }
-    }
-
-void CSts::PlayComplete(unsigned int aContext)
-    {
-    CPlayerNode* node = iPlayerMap[aContext];
-    iPlayerMap.erase(aContext);
-    if (node)
-        {
-        CStsPlayer* player = node->Player();
-        if (node->HasObserver())
-            {
-            node->Observer().PlayAlarmComplete(aContext);
-            }
-        delete node;
-        }
-    else
-        {
-        // TODO: log unexpected error
-        }
-    }
--- a/mmserv/sts/stsplayer/src/stsplayer.cpp	Fri May 14 16:22:35 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * 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 provides the implementation for creating and deleting a
- * an MMF based player for playing and stopping a tone playback.
- */
-
-#include "stsplayer.h"
-
-_LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac");
-
-/*static*/CStsPlayer* CStsPlayer::CreateTonePlayer(
-        MStsPlayerObserver& aObserver, CSystemToneService::TToneType aTone,
-        unsigned int aContext)
-    {
-    CStsPlayer* self = 0;
-    switch (aTone)
-        {
-        default:
-            self = new CStsPlayer(aObserver, KDefaultFile, 0, aContext);
-            break;
-        }
-    if (self != 0)
-        {
-        bool successful = self->Init();
-        if (!successful)
-            {
-            delete self;
-            self = 0;
-            }
-        }
-    return self;
-    }
-
-/*static*/CStsPlayer* CStsPlayer::CreateAlarmPlayer(
-        MStsPlayerObserver& aObserver, CSystemToneService::TAlarmType aAlarm,
-        unsigned int aContext)
-    {
-    CStsPlayer* self = 0;
-    switch (aAlarm)
-        {
-        case CSystemToneService::EClockAlarm:
-            self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext);
-            break;
-        default:
-            self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext);
-            break;
-        }
-    if (self != 0)
-        {
-        bool successful = self->Init();
-        if (!successful)
-            {
-            delete self;
-            self = 0;
-            }
-        }
-    return self;
-    }
-
-CStsPlayer::CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName,
-        int aRepeatNumberOfTimes, unsigned int aContext) :
-    iObserver(aObserver), iPlayer(0), iFileName(aFileName),
-            iRepeatNumberOfTimes(aRepeatNumberOfTimes), iContext(aContext)
-    {
-    }
-
-bool CStsPlayer::Init()
-    {
-    TRAPD(result, iPlayer = CMdaAudioPlayerUtility::NewL(*this));
-    return result == KErrNone;
-    }
-
-CStsPlayer::~CStsPlayer()
-    {
-    delete iPlayer;
-    }
-
-void CStsPlayer::Play()
-    {
-    // Play the tone
-    TRAPD(err, iPlayer->OpenFileL(iFileName));
-
-    // If there is an error, indicate that the playback is complete. 
-    if (err)
-        {
-        //TODO: Add trace here
-        iObserver.PlayComplete(iContext);
-        }
-    }
-
-void CStsPlayer::Stop()
-    {
-    iPlayer->Stop();
-    }
-
-void CStsPlayer::MapcInitComplete(TInt aError,
-        const TTimeIntervalMicroSeconds& /*aDuration*/)
-    {
-    if (aError == KErrNone)
-        {
-        TTimeIntervalMicroSeconds delay = 0;
-        iPlayer->SetRepeats(iRepeatNumberOfTimes, delay);
-        iPlayer->Play();
-        }
-    else
-        {
-        //TODO: add trace
-        // Since there is an error, indicate that the playback is complete
-        iObserver.PlayComplete(iContext);
-        }
-    }
-
-void CStsPlayer::MapcPlayComplete(TInt aError)
-    {
-    if (aError != KErrNone)
-        {
-        //TODO: add trace
-        }
-    iObserver.PlayComplete(iContext);
-    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/group/bld.inf	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,20 @@
+/*
+ * 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 provides the information required for building the
+ * system tone service client side proxy.
+ */
+
+PRJ_MMPFILES
+stsproxy.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/group/stsproxy.mmp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,33 @@
+/*
+ * 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 is the project specification file for building the
+ * sts client side proxy static library.
+ */
+
+#include <platform_paths.hrh>
+
+TARGET          stsproxy.lib
+TARGETTYPE      lib
+
+MW_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
+OS_LAYER_STDCPP_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../stsserver/inc
+
+SOURCEPATH      ../src
+
+SOURCE          stsimplementation.cpp rstssession.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/inc/stsimplementation.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,44 @@
+/*
+ * 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 defines the interface to the class that provides the
+ * implementation logic of the STS API.
+ */
+
+#ifndef STSIMPLEMENTATION_H_
+#define STSIMPLEMENTATION_H_
+
+#include <systemtoneservice.h>
+
+class RStsSession;
+
+NONSHARABLE_CLASS(CStsImplementation) : public CBase
+    {
+public:
+    static CStsImplementation* Create();
+    virtual ~CStsImplementation();
+public:
+    void PlayTone(CSystemToneService::TToneType aTone);
+    void
+    PlayAlarm(CSystemToneService::TAlarmType aAlarm,
+            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
+    void StopAlarm(unsigned int aAlarmContext);
+private:
+    CStsImplementation();
+    bool Init();
+
+    RStsSession* iSession;
+    };
+
+#endif /* STSIMPLEMENTATION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/src/rstssession.cpp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,321 @@
+/*
+ * 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:
+ * The file provides the implementation of the client side session
+ * to the STS Server.
+ */
+
+#include "rstssession.h"
+#include "stsclientservercommon.h"
+
+const TUint KNumSlots = 30;
+
+/*static*/TInt RStsSession::CallBackThreadMain(TAny* aSession)
+    {
+    TInt err = KErrNoMemory;
+
+    RThread myThread;
+    myThread.SetPriority(EPriorityAbsoluteHigh);
+    myThread.Close();
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+
+    if (cleanup)
+        {
+        // Run the server and request a thread rendezvous.
+        TRAP( err, ((RStsSession*)aSession)->RunThreadL() );
+        delete cleanup;
+        }
+
+    return err;
+    }
+
+void RStsSession::RunThreadL()
+    {
+    iState = ERunning;
+    // Initialisation complete, now signal the client, if requested.
+    RThread::Rendezvous(KErrNone);
+    TRequestStatus queueStatus = KRequestPending;
+    iMsgQueue.NotifyDataAvailable(queueStatus);
+
+    RThread server;
+    TInt err = server.Open(iServerThreadId);
+    TRequestStatus serverStatus = KRequestPending;
+    server.Logon(serverStatus);
+
+    while (iState == ERunning)
+        {
+        TStsCallBack message;
+        // Using ReceiveBlocking here would block forever if the executive thread
+        // dies, so instead wait for either a data available notification or a
+        // notification that the executive thread has died.
+        User::WaitForRequest(queueStatus, serverStatus);
+
+        if (queueStatus != KRequestPending)
+            {
+            TInt err = iMsgQueue.Receive(message);
+            if (err == KErrNone)
+                {
+                HandleMessage(message);
+                }
+            else
+                {
+                //TODO:Log a message
+                }
+            queueStatus = KRequestPending;
+            iMsgQueue.NotifyDataAvailable(queueStatus);
+            }
+        if (serverStatus != KRequestPending && iState == ERunning)
+            {
+            //TODO: Log a message
+            //Restart the server
+            SignalObservers();
+            server.Close();
+            CreateServerSession();
+            TInt err = server.Open(iServerThreadId);
+            TRequestStatus serverStatus = KRequestPending;
+            server.Logon(serverStatus);
+            }
+        }
+
+    iMsgQueue.CancelDataAvailable();
+    server.LogonCancel(serverStatus);
+    server.Close();
+    }
+
+void RStsSession::HandleMessage(TStsCallBack& aMessage)
+    {
+    TStsCallBackType type = aMessage.callBackType;
+    if (type == EStsPlayAlarmComplete)
+        {
+        MStsPlayAlarmObserver* observer = aMessage.observer;
+        unsigned int context = aMessage.alarmContext;
+        iObserverMutex.Wait();
+        if (observer == iObserverMap[context])
+            {
+            observer->PlayAlarmComplete(aMessage.alarmContext);
+            }
+        else
+            {
+            //TODO: Log a message
+            }
+        iObserverMap.erase(context);
+        iObserverMutex.Signal();
+        }
+    else if (type == EStsShutdown)
+        {
+        iState = EStopping;
+        }
+    else
+        {
+        //TODO: Log error message
+        }
+    }
+
+TInt RStsSession::StartServer()
+    {
+    TInt err = KErrNone;
+
+    // Launch the server executable (i.e. in it its own process).
+
+    // Create a new server process. Simultaneous launching of two such processes 
+    // should be detected when the second one attempts to create the server 
+    // object, failing with KErrAlreadyExists.
+    RProcess server;
+    err = server.Create(KStsServerFile, KNullDesC);
+
+    if (err == KErrNone)
+        {
+        TRequestStatus rendezvousStatus;
+        server.Rendezvous(rendezvousStatus);
+        server.Resume();
+
+        // wait for start or death
+        User::WaitForRequest(rendezvousStatus);
+
+        // we can't use the 'exit reason' if the server panicked as this
+        // is the panic 'reason' and may be '0' which cannot be distinguished
+        // from KErrNone  
+        if (server.ExitType() == EExitPanic)
+            {
+            err = KErrGeneral;
+            }
+        else
+            {
+            err = rendezvousStatus.Int();
+            }
+        }
+    server.Close();
+
+    return err;
+    }
+
+TInt RStsSession::StartThread()
+    {
+    TInt result = iThread.Create(KNullDesC, RStsSession::CallBackThreadMain,
+            KDefaultStackSize, &User::Heap(), (TAny*) this);
+
+    if (result == KErrNone)
+        {
+        TRequestStatus rendezvousStatus = KRequestPending;
+
+        //  Register for rendezvous notification when thread is started.
+        iThread.Rendezvous(rendezvousStatus);
+
+        // Start the thread execution
+        iThread.Resume();
+
+        // Wait for thread to start.
+        User::WaitForRequest(rendezvousStatus);
+
+        result = rendezvousStatus.Int();
+
+        if (result != KErrNone)
+            {
+            iThread.Kill(result);
+            }
+        }
+
+    return result;
+    }
+
+TInt RStsSession::CreateServerSession()
+    {
+    // Try to create a session with the server
+    TInt result = CreateSession(KStsServerName, TVersion(
+            KStsServerMajorVersion, KStsServerMinorVersion, KStsServerBuild),
+            KNumSlots, EIpcSession_Sharable);
+
+    // If the server wasn't found, start the server and try creating a session again
+    if (result == KErrNotFound || result == KErrServerTerminated)
+        {
+        result = StartServer();
+        if (result == KErrNone || result == KErrAlreadyExists)
+            {
+            result = CreateSession(KStsServerName, TVersion(
+                    KStsServerMajorVersion, KStsServerMinorVersion,
+                    KStsServerBuild), KNumSlots, EIpcSession_Sharable);
+            }
+        }
+
+    if (result == KErrNone)
+        {
+        TPckg<TThreadId> idPckg(iServerThreadId);
+        result = SendReceive(StsMsg_RegisterMsgQueue, TIpcArgs(iMsgQueue,
+                &idPckg));
+        }
+
+    return result;
+    }
+
+TInt RStsSession::Connect()
+    {
+    iState = EInitializing;
+
+    // Create a nameless global message queue, then pass the handle to the queue to the server.
+    TInt result = iMsgQueue.CreateGlobal(KNullDesC, 30);
+
+    // Create thread for receiving asynch callbacks from the server
+    if (result == KErrNone)
+        {
+        result = CreateServerSession();
+        if (result == KErrNone)
+            {
+            result = StartThread();
+            if (result == KErrNone)
+                {
+                result = iObserverMutex.CreateLocal();
+                }
+            }
+        }
+
+    return result;
+    }
+
+void RStsSession::Close()
+    {
+    TRequestStatus logonStatus = KRequestPending;
+    iThread.Logon(logonStatus);
+    RSessionBase::Close();
+    User::WaitForRequest(logonStatus);
+    iThread.Close();
+    iMsgQueue.Close();
+    CleanUpObservers();
+    iObserverMutex.Close();
+    }
+
+void RStsSession::SendPlayTone(CSystemToneService::TToneType aTone)
+    {
+    TInt err = SendReceive(StsMsg_PlayTone, TIpcArgs(aTone));
+    if (err != KErrNone)
+        {
+        //TODO: Log a message
+        }
+    }
+
+void RStsSession::SendPlayAlarm(CSystemToneService::TAlarmType aAlarm,
+        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
+    {
+    TPckg<unsigned int> alarmContextPckg(aAlarmContext);
+    TInt err = SendReceive(StsMsg_PlayAlarm, TIpcArgs(aAlarm,
+            &alarmContextPckg, &aObserver));
+    if (err != KErrNone)
+        {
+        //TODO: Log a message
+        aObserver.PlayAlarmComplete(aAlarmContext);
+        }
+    else
+        {
+        iObserverMutex.Wait();
+        iObserverMap[aAlarmContext] = &aObserver;
+        iObserverMutex.Signal();
+        }
+    }
+
+void RStsSession::SendStopAlarm(unsigned int aAlarmContext)
+    {
+    iObserverMutex.Wait();
+    iObserverMap.erase(aAlarmContext);
+    iObserverMutex.Signal();
+    TInt err = SendReceive(StsMsg_StopAlarm, TIpcArgs(aAlarmContext));
+    if (err != KErrNone)
+        {
+        //TODO: Log a message
+        }
+    }
+
+void RStsSession::CleanUpObservers()
+    {
+    iObserverMutex.Wait();
+    while (!iObserverMap.empty())
+        {
+        //TODO: Add trace here
+        unsigned int context = iObserverMap.begin()->first;
+        iObserverMap.erase(context);
+        }
+    iObserverMutex.Signal();
+    }
+
+void RStsSession::SignalObservers()
+    {
+    iObserverMutex.Wait();
+    while (!iObserverMap.empty())
+        {
+        //TODO: Add trace here
+        unsigned int context = iObserverMap.begin()->first;
+        iObserverMap[context]->PlayAlarmComplete(context);
+        iObserverMap.erase(context);
+        }
+    iObserverMutex.Signal();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/src/rstssession.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,69 @@
+/*
+ * 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 defines the interface to the client side session of the
+ * STS Server.
+ */
+
+#ifndef RSTSSESSION_H_
+#define RSTSSESSION_H_
+
+#include <e32msgqueue.h>
+#include <map>
+#include <systemtoneservice.h>
+
+#include "stsclientservercommon.h"
+
+class RStsSession : public RSessionBase
+    {
+public:
+
+    TInt Connect();
+
+    void Close();
+
+    void SendPlayTone(CSystemToneService::TToneType aTone);
+
+    void SendPlayAlarm(CSystemToneService::TAlarmType aAlarm,
+            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
+
+    void SendStopAlarm(unsigned int aAlarmContext);
+
+private:
+
+    static TInt CallBackThreadMain(TAny* aSession);
+    void RunThreadL();
+
+    TInt CreateServerSession();
+    void HandleMessage(TStsCallBack& aMessage);
+    TInt StartServer();
+    TInt StartThread();
+    void CleanUpObservers();
+    void SignalObservers();
+
+    RThread iThread;
+    RMsgQueue<TStsCallBack> iMsgQueue;
+    TThreadId iServerThreadId;
+
+    enum TState
+        {
+        EInitializing, ERunning, EStopping
+        };
+    TState iState;
+    typedef std::map<unsigned int, MStsPlayAlarmObserver*> TObserverMap;
+    TObserverMap iObserverMap;
+    RMutex iObserverMutex;
+    };
+
+#endif // RSTSSESSION_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsproxy/src/stsimplementation.cpp	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ * The file provides the actual implementation of the STS API.
+ * All of the STS API methods are implemented by passing the
+ * calls to the STS Server through the client side STS
+ * Session.
+ */
+
+//  Include Files  
+#include "stsimplementation.h"
+#include "rstssession.h"
+
+//  Member Functions
+/*static*/CStsImplementation* CStsImplementation::Create()
+    {
+    CStsImplementation* self = new CStsImplementation();
+    if (self != 0)
+        {
+        bool successful = self->Init();
+        if (!successful)
+            {
+            delete self;
+            self = 0;
+            }
+        }
+    return self;
+    }
+
+CStsImplementation::CStsImplementation() :
+    iSession(NULL)
+    {
+    }
+
+CStsImplementation::~CStsImplementation()
+    {
+    iSession->Close();
+    delete iSession;
+    }
+
+bool CStsImplementation::Init()
+    {
+    bool result = false;
+    iSession = new RStsSession();
+    if (iSession)
+        {
+        TInt err = iSession->Connect();
+        result = err == KErrNone;
+        }
+    return result;
+    }
+
+void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone)
+    {
+    iSession->SendPlayTone(aTone);
+    }
+
+void CStsImplementation::PlayAlarm(CSystemToneService::TAlarmType aAlarm,
+        unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver)
+    {
+    //TODO: Add logging and error checking
+    iSession->SendPlayAlarm(aAlarm, aAlarmContext, aObserver);
+    }
+
+void CStsImplementation::StopAlarm(unsigned int aAlarmContext)
+    {
+    //TODO: Add logging and error checking
+    iSession->SendStopAlarm(aAlarmContext);
+    }
--- a/mmserv/sts/stsserver/group/stsserver.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/stsserver/group/stsserver.mmp	Thu May 27 13:20:50 2010 +0300
@@ -32,14 +32,16 @@
 OS_LAYER_LIBC_SYSTEMINCLUDE
 OS_LAYER_STDCPP_SYSTEMINCLUDE
 
-USERINCLUDE    ../../inc
+USERINCLUDE    ../inc
+USERINCLUDE    ../../sts/inc
+
 SOURCEPATH     ../src
 
 SOURCE         stsserverexe.cpp
 SOURCE         stsserver.cpp
 SOURCE         stsserversession.cpp
 
-STATICLIBRARY  stsplayer.lib
+STATICLIBRARY  sts.lib
 
 LIBRARY        ecom.lib
 LIBRARY        euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/sts/stsserver/inc/stsclientservercommon.h	Thu May 27 13:20:50 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * 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 defines common types and constants used by the STS server
+ * and sessions.
+ */
+
+#ifndef STSCLIENTSERVERCOMMON_H_
+#define STSCLIENTSERVERCOMMON_H_
+
+// SYMBIAN INCLUDES
+#include <e32std.h>
+#include <systemtoneservice.h>
+
+// CONSTANTS
+_LIT( KStsServerFile, "StsServer" );
+_LIT( KStsServerName, "!StsServer" );
+
+const TInt KStsServerMajorVersion = 0;
+const TInt KStsServerMinorVersion = 1;
+const TInt KStsServerBuild = 0;
+
+// This type enumerates the client/server messages for the STS server.
+enum TStsServerCommandType
+    {
+    StsMsg_RegisterMsgQueue,
+    StsMsg_StopAlarm,
+    StsMsg_PlayTone,
+    StsMsg_PlayAlarm,
+    StsMsg_ENDMARKER
+    };
+
+const TStsServerCommandType KStsCmdLast =
+        (TStsServerCommandType) ((int) StsMsg_ENDMARKER - 1);
+
+enum TStsCallBackType
+    {
+    EStsShutdown,
+    EStsPlayAlarmComplete
+    };
+
+struct TStsCallBack
+    {
+    TStsCallBackType callBackType;
+    MStsPlayAlarmObserver* observer;
+    unsigned int alarmContext;
+    };
+
+#endif // STSCLIENTSERVERCOMMON_H_
--- a/mmserv/sts/stsserver/src/stsserver.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/stsserver/src/stsserver.cpp	Thu May 27 13:20:50 2010 +0300
@@ -19,25 +19,24 @@
  */
 
 #include "stsserver.h"
-
 #include "stsserversession.h"
 #include "sts.h"
 
-// TODO: IMPLEMENT PLATFORM SECURITY CHECKS ON THIS API.
-
 // Total number of ranges
-const TUint KStsRangeCount = 2;
+const TUint KStsRangeCount = 3;
 
 // Definition of the ranges of IPC numbers
 const TInt KStsRanges[KStsRangeCount] =
     {
-    0, KStsCmdLast + 1
+    0, 2, KStsCmdLast + 1
     };
 
 // Policy to implement for each of the above ranges        
 const TUint8 KStsElementsIndex[KStsRangeCount] =
     {
-    CPolicyServer::EAlwaysPass, CPolicyServer::ENotSupported
+            CPolicyServer::EAlwaysPass,
+            CPolicyServer::ECustomCheck,
+            CPolicyServer::ENotSupported
     };
 
 // Package all the above together into a policy
@@ -81,6 +80,61 @@
     CSts::Delete(iSts);
     }
 
+// Performs security checks based on the tone or Alarm type.
+CPolicyServer::TCustomResult CStsServer::CustomSecurityCheckL(
+        const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& aMissing)
+    {
+    CPolicyServer::TCustomResult result;
+
+    switch (aMsg.Function())
+        {
+        case StsMsg_PlayTone:
+            {
+            CSystemToneService::TToneType tone =
+                    (CSystemToneService::TToneType) aMsg.Int0();
+            result = SecurityCheckTone(tone, aMsg, aMissing);
+            }
+            break;
+        case StsMsg_PlayAlarm:
+            {
+            CSystemToneService::TAlarmType alarm =
+                    (CSystemToneService::TAlarmType) aMsg.Int0();
+            result = SecurityCheckAlarm(alarm, aMsg, aMissing);
+            }
+            break;
+        default:
+            result = CPolicyServer::EFail;
+        }
+
+    return result;
+    }
+
+CPolicyServer::TCustomResult CStsServer::SecurityCheckAlarm(
+        CSystemToneService::TAlarmType aAlarm, const RMessage2& /*aMsg*/,
+        TSecurityInfo& /*aMissing*/)
+    {
+    CPolicyServer::TCustomResult result;
+    switch(aAlarm)
+        {
+        default:
+            result = CPolicyServer::EPass;
+        }
+    return result;
+    }
+
+CPolicyServer::TCustomResult CStsServer::SecurityCheckTone(
+        CSystemToneService::TToneType aTone, const RMessage2& /*aMsg*/,
+        TSecurityInfo& /*aMissing*/)
+    {
+    CPolicyServer::TCustomResult result;
+    switch(aTone)
+        {
+        default:
+            result = CPolicyServer::EPass;
+        }
+    return result;
+    }
+
 CSession2* CStsServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const
     {
     if (aVersion.iMajor != KStsServerMajorVersion || aVersion.iMinor
--- a/mmserv/sts/stsserver/src/stsserver.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/stsserver/src/stsserver.h	Thu May 27 13:20:50 2010 +0300
@@ -19,6 +19,7 @@
 #define STSSERVER_H_
 
 #include <e32base.h>
+#include <systemtoneservice.h>
 
 class CSts;
 class CStsServerSession;
@@ -42,7 +43,17 @@
     void ConstructL();
     virtual ~CStsServer();
 
+    CPolicyServer::TCustomResult SecurityCheckAlarm(
+            CSystemToneService::TAlarmType aAlarm, const RMessage2& aMsg,
+            TSecurityInfo& aMissing);
+
+    CPolicyServer::TCustomResult SecurityCheckTone(
+            CSystemToneService::TToneType aTone, const RMessage2& aMsg,
+            TSecurityInfo& aMissing);
+
     // inherited from CPolicyServer    
+    virtual CPolicyServer::TCustomResult CustomSecurityCheckL(
+            const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
     CSession2* NewSessionL(const TVersion& aVersion,
             const RMessage2& aMessage) const;
 
--- a/mmserv/sts/stsserver/src/stsserversession.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/stsserver/src/stsserversession.cpp	Thu May 27 13:20:50 2010 +0300
@@ -29,6 +29,7 @@
 
 CStsServerSession::~CStsServerSession()
     {
+    CleanUpObservers();
     TStsCallBack callBack;
     callBack.callBackType = EStsShutdown;
     iMsgQueue.SendBlocking(callBack);
@@ -70,7 +71,12 @@
 void CStsServerSession::DoRegisterMsgQueueL(const RMessage2& aMessage)
     {
     TInt result = iMsgQueue.Open(aMessage, 0);
-
+    if (result == KErrNone)
+        {
+        TThreadId id = RThread().Id();
+        TPckg<TThreadId> idPckg(id);
+        TRAP(result,aMessage.Write(1, idPckg));
+        }
     aMessage.Complete(result);
     }
 
@@ -108,9 +114,19 @@
     iSts.StopAlarm(context);
     }
 
+void CStsServerSession::CleanUpObservers()
+    {
+    while (!iObserverMap.empty())
+        {
+        //TODO: Add trace here
+        unsigned int context = iObserverMap.begin()->first;
+        iObserverMap.erase(context);
+        iSts.StopAlarm(context);
+        }
+    }
+
 void CStsServerSession::PlayAlarmComplete(unsigned int aAlarmContext)
     {
-    //TODO: Trigger play complete callback to RSession
     TStsCallBack callBack =
         {
         EStsPlayAlarmComplete, iObserverMap[aAlarmContext], aAlarmContext
--- a/mmserv/sts/stsserver/src/stsserversession.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/stsserver/src/stsserversession.h	Thu May 27 13:20:50 2010 +0300
@@ -48,6 +48,8 @@
     void DoPlayAlarmL(const RMessage2& aMessage);
     void DoStopAlarmL(const RMessage2& aMessage);
 
+    void CleanUpObservers();
+    
     // inherited from MPlayAlarmObserver
     virtual void PlayAlarmComplete(unsigned int aAlarmContext);
 
--- a/mmserv/sts/tsrc/ststester/src/ststester.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/sts/tsrc/ststester/src/ststester.cpp	Thu May 27 13:20:50 2010 +0300
@@ -177,12 +177,12 @@
             // Only play if not already playing
             if (iPlayState != EPlaying)
                 {
+                iPlayState = EPlaying;
                 TAG_TIME_PROFILING_BEGIN;
                 iSts->PlayAlarm(CSystemToneService::EClockAlarm,
                         iCurrentContext, *this);
                 TAG_TIME_PROFILING_END;
                 PRINT_TO_CONSOLE_TIME_DIFF;
-                iPlayState = EPlaying;
                 }
             break;
             }
--- a/mmserv/tms/inc/tmsclientserver.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/inc/tmsclientserver.h	Thu May 27 13:20:50 2010 +0300
@@ -101,7 +101,8 @@
 const TUid KTMSPropertyCategory = {0x10207C7C};
 
 // server name and UID
-_LIT(KTMSServerName, "tmsserver");
+_LIT(KTMSServerFile, "tmsserver");
+_LIT(KTMSServerName, "!TmsServer");
 const TUid KTMSServerUid3 = {0x10207C7C};
 const TUid KUidTMSCallServerUid3 = {0x10207C78};
 
--- a/mmserv/tms/inc/tmsmembuffer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/inc/tmsmembuffer.h	Thu May 27 13:20:50 2010 +0300
@@ -34,56 +34,56 @@
     static gint Create(guint size, TMSBuffer*& tmsbuffer);
     static gint Create(guint size, guint8* dataptr, TMSBuffer*& tmsbuffer);
 
-    // Implementation of TMSBuffer interface begins
+    /*
+     * Returns buffer type.
+     *
+     * @param buftype buffer type
+     *
+     */
     virtual gint GetType(TMSBufferType& buftype);
+
     /**
-     Gets the timestamp on the Buffer so that the framework can
-     determine the time at which this buffer has to be rendered
-     by the output device sink.
-
-     @param ts
-     timestamp in microseconds
-
+     * Gets the timestamp on the Buffer so that the framework can
+     * determine the time at which this buffer has to be rendered
+     * by the output device sink.
+     *
+     * @param ts buffer timestamp in microseconds
+     *
      */
     virtual gint GetTimeStamp(guint64& ts);
 
     /**
-     Sets the timestamp on the Buffer so that the framework can
-     determine the time at which this buffer has to be rendered
-     by the output device sink.
-
-     @param ts
-     timestamp in milliseconds
-
+     * Sets the timestamp on the Buffer so that the framework can
+     * determine the time at which this buffer has to be rendered
+     * by the output device sink.
+     *
+     * @param ts timestamp in milliseconds
+     *
      */
     virtual gint SetTimeStamp(const guint64 ts);
 
     /**
-     Gets the size of data in the buffer specified by the client.
-
-     @param size
-     size of data in bytes
-
+     * Gets the size of data in the buffer specified by the client.
+     *
+     * @param size size of data in bytes
+     *
      */
     virtual gint GetDataSize(guint& size);
 
     /**
-     Sets the size of data in the buffer after the client
-     fill it.
-
-     @param size
-     size of data in bytes
-
+     * Sets the size of data in the buffer after the client fill it.
+     *
+     * @param size size of data in bytes
+     *
      */
     virtual gint SetDataSize(const guint size);
 
     /**
-     Gets the pointer to the memory location associated with this
-     buffer where the data is stored.
-
-     @param bufptr
-     ptr to the data stored in the buffer.
-
+     * Gets the pointer to the memory location associated with this
+     * buffer where the data is stored.
+     *
+     * @param bufptr ptr to the data stored in the buffer.
+     *
      */
     virtual gint GetDataPtr(guint8*& bufptr);
 
--- a/mmserv/tms/inc/tmsproxy.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/inc/tmsproxy.h	Thu May 27 13:20:50 2010 +0300
@@ -119,6 +119,8 @@
     virtual void QueueEvent(gint aEventType, gint aError, void* event_data);
 
 private:
+    gint StartServer();
+
     void PopulateArrayL(TMSClientServerRequest aRequest,
             RArray<TUint32>& aDecoders, gint aCount);
     void GetAvailableOutputsL(OutputVector& outputs);
--- a/mmserv/tms/inc/tmsshared.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/inc/tmsshared.h	Thu May 27 13:20:50 2010 +0300
@@ -114,8 +114,8 @@
     ECmdUplinkPaused,
     ECmdFillBuffer,
     ECmdEmptyBuffer,
-    ECmdDTMFOpenDnlinkComplete,
-    ECmdDTMFOpenUplinkComplete,
+    ECmdDTMFToneDnlPlayStarted,
+    ECmdDTMFToneUplPlayStarted,
     ECmdDTMFTonePlayFinished,
     ECmdRingToneOpenComplete,
     ECmdRingTonePlayComplete,
--- a/mmserv/tms/tmscallserver/group/tmscallserver.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/group/tmscallserver.mmp	Thu May 27 13:20:50 2010 +0300
@@ -60,9 +60,6 @@
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
-#ifdef __USE_GSTREAMER__
-USERINCLUDE     /sf/mw/gstreamer/gst_plugins_symbian/gst/devsound
-#endif //__USE_GSTREAMER__
 
 MW_LAYER_SYSTEMINCLUDE
 OS_LAYER_LIBC_SYSTEMINCLUDE
@@ -74,10 +71,7 @@
 
 #ifdef __USE_GSTREAMER__
 MW_LAYER_GSTREAMER_SYSTEMINCLUDE
-//SYSTEMINCLUDE   /sf/mw/gstreamer/include/gstreamer
-//SYSTEMINCLUDE   /sf/mw/gstreamer/include/gstreamer/gst
-//SYSTEMINCLUDE   /sf/mw/gstreamer/include/gstreamer/gst/app
-//SYSTEMINCLUDE   /epoc32/include/stdapis/glib-2.0/gobject
+MW_LAYER_GSTREAMER_SYSTEMINCLUDE(gst_plugins_symbian/gst/devsound)
 
 LIBRARY         libgobject.lib
 LIBRARY         libgstreamer.lib
--- a/mmserv/tms/tmscallserver/inc/tmscalladpt.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmscalladpt.h	Thu May 27 13:20:50 2010 +0300
@@ -29,11 +29,12 @@
 public:
     static gint CreateCallL(gint callType, TMSCallAdpt*& callAdpt);
     virtual ~TMSCallAdpt();
+
+    // From TMSStream
     virtual gint CreateStream(TMSCallType callType,
             TMSStreamType strmType, gint& outStrmId) = 0;
-    virtual gint InitStreamL(TMSCallType callType,
-            TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
-            const RMessage2& aMessage) = 0;
+    virtual gint InitStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage) = 0;
     virtual gint StartStream(TMSCallType callType,
             TMSStreamType strmType, gint strmId) = 0;
     virtual gint PauseStream(TMSCallType callType,
@@ -52,6 +53,7 @@
             const TMSStreamType strmType, const gint strmId,
             const guint32 key, RChunk& chunk) = 0;
 
+    // From TMS effects
     virtual gint GetMaxVolume(guint& volume) = 0;
     virtual gint SetVolume(const guint volume) = 0;
     virtual gint GetVolume(guint& volume) = 0;
@@ -65,6 +67,7 @@
     virtual gint SetGlobalGain(const guint gain) = 0;
     virtual gint GetGlobalGain(guint& gain) = 0;
 
+    // From TMS formats
     virtual gint GetCodecMode(const TMSFormatType fmttype,
             const TMSStreamType strmtype, gint& mode) = 0;
     virtual gint SetCodecMode(const TMSFormatType fmttype,
@@ -79,11 +82,15 @@
     virtual gint SetCNG(const TMSFormatType fmttype, const gboolean cng) = 0;
     virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc) = 0;
     virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc) = 0;
+
+    // From TMS routing
     virtual gint SetOutput(TMSAudioOutput output) = 0;
     virtual gint GetOutput(TMSAudioOutput& output) = 0;
     virtual gint GetPreviousOutput(TMSAudioOutput& output) = 0;
     virtual gint GetAvailableOutputsL(gint& count,
             CBufFlat*& outputsbuffer) = 0;
+
+    // From TMSDTMF
     virtual gint StartDTMF(TMSStreamType streamtype, TDes& dtmfstring) = 0;
     virtual gint StopDTMF(TMSStreamType streamtype) = 0;
     virtual gint ContinueDTMF(TBool continuesending) = 0;
--- a/mmserv/tms/tmscallserver/inc/tmscallcsadpt.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmscallcsadpt.h	Thu May 27 13:20:50 2010 +0300
@@ -55,8 +55,8 @@
 
     virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
             gint& outStrmId);
-    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
-            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
+    virtual gint InitStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId, TMSFormatType frmtType, const RMessage2& message);
     virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
             gint strmId);
     virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
@@ -74,6 +74,8 @@
     virtual gint GetDataXferBufferHndl(const TMSCallType callType,
             const TMSStreamType strmType, const gint strmId,
             const guint32 key, RChunk& chunk);
+
+    // From TMS effects
     virtual gint GetMaxVolume(guint& volume);
     virtual gint SetVolume(const guint volume);
     virtual gint GetVolume(guint& volume);
@@ -87,6 +89,7 @@
     virtual gint SetGlobalGain(const guint gain);
     virtual gint GetGlobalGain(guint& gain);
 
+    // From TMS formats
     virtual gint GetCodecMode(const TMSFormatType fmttype,
             const TMSStreamType strmtype, gint& mode);
     virtual gint SetCodecMode(const TMSFormatType fmttype,
@@ -102,17 +105,17 @@
     virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
     virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
 
+    // From TMS audio routing
     virtual gint SetOutput(TMSAudioOutput output);
     virtual gint GetOutput(TMSAudioOutput& output);
     virtual gint GetPreviousOutput(TMSAudioOutput& output);
     virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer);
+	
+	// From TMSDTMF
     virtual gint StartDTMF(TMSStreamType streamtype, TDes& dtmfstring);
     virtual gint StopDTMF(TMSStreamType streamtype);
     virtual gint ContinueDTMF(TBool continuesending);
 
-    void NotifyClient(const gint strmId, const gint aCommand,
-            const gint aStatus = KErrNone, const gint64 aInt64 = TInt64(0));
-
     //From TMSCSPDevSoundObserver
     void DownlinkInitCompleted(TInt status);
     void UplinkInitCompleted(TInt status);
@@ -129,13 +132,15 @@
      void HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent,
              const TInt aError, const TChar aTone);
 
-protected:
+private:
     void AvailableOutputsChanged(
             CTelephonyAudioRouting& aTelephonyAudioRouting);
     void OutputChanged(CTelephonyAudioRouting& aTelephonyAudioRouting);
     void SetOutputComplete(CTelephonyAudioRouting& aTelephonyAudioRouting,
             gint aError);
     void GetSupportedBitRatesL(CBufFlat*& brbuffer);
+    void NotifyClient(const gint strmId, const gint command,
+            const gint status = KErrNone, const gint64 int64 = TInt64(0));
 
 private:
     gint iNextStreamId;
--- a/mmserv/tms/tmscallserver/inc/tmscallipadpt.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmscallipadpt.h	Thu May 27 13:20:50 2010 +0300
@@ -40,14 +40,14 @@
 public:
     // Constractor
     static TMSCallIPAdpt* NewL();
-
     virtual ~TMSCallIPAdpt();
     virtual gint PostConstruct();
 
+    // From TMSStream
     virtual gint CreateStream(TMSCallType callType, TMSStreamType strmType,
             gint& outStrmId);
-    virtual gint InitStreamL(TMSCallType callType, TMSStreamType strmType,
-            gint strmId, TMSFormatType frmtType, const RMessage2& aMessage);
+    virtual gint InitStream(TMSCallType callType, TMSStreamType strmType,
+            gint strmId, TMSFormatType frmtType, const RMessage2& message);
     virtual gint StartStream(TMSCallType callType, TMSStreamType strmType,
             gint strmId);
     virtual gint PauseStream(TMSCallType callType, TMSStreamType strmType,
@@ -66,6 +66,7 @@
             const TMSStreamType strmType, const gint strmId,
             const guint32 key, RChunk& chunk);
 
+    // From TMS effects
     virtual gint GetMaxVolume(guint& volume);
     virtual gint SetVolume(const guint volume);
     virtual gint GetVolume(guint& volume);
@@ -79,6 +80,7 @@
     virtual gint SetGlobalGain(const guint gain);
     virtual gint GetGlobalGain(guint& gain);
 
+    // From TMS formats
     virtual gint GetCodecMode(const TMSFormatType fmttype,
             const TMSStreamType strmtype, gint& mode);
     virtual gint SetCodecMode(const TMSFormatType fmttype,
@@ -94,15 +96,18 @@
     virtual gint GetPlc(const TMSFormatType fmttype, gboolean& plc);
     virtual gint SetPlc(const TMSFormatType fmttype, const gboolean plc);
 
+    // From TMS audio output
     virtual gint SetOutput(TMSAudioOutput output);
     virtual gint GetOutput(TMSAudioOutput& output);
     virtual gint GetPreviousOutput(TMSAudioOutput& output);
-    virtual gint GetAvailableOutputsL(TInt& count, CBufFlat*& outputsbuffer);
+    virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuffer);
 
+    // From TMSDTMF
     virtual gint StartDTMF(TMSStreamType streamtype, TDes& dtmfstring);
     virtual gint StopDTMF(TMSStreamType streamtype);
-    virtual gint ContinueDTMF(TBool continuesending);
+    virtual gint ContinueDTMF(gboolean continuesending);
 
+    // From TMS codec formats
     gint SetIlbcCodecMode(const gint mode, const TMSStreamType strmtype);
     gint GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype);
     gint SetG711CodecMode(const gint mode, const TMSStreamType strmtype);
@@ -113,26 +118,26 @@
     gint ConcealErrorForNextBuffer();
     gint BadLsfNextBuffer();
 
-    gint OpenDownlinkL(const RMessage2& aMessage);
-    gint OpenUplinkL(const RMessage2& aMessage);
-    void SetFormat(const gint strmId, const TUint32 aFormat);
+    gint OpenDownlinkL(const RMessage2& message);
+    gint OpenUplinkL(const RMessage2& message);
+    void SetFormat(const gint strmId, const guint32 aFormat);
 
-    void BufferFilledL(TUint dataSize);
+    void BufferFilledL(guint dataSize);
     void BufferEmptiedL();
     gint GetDataXferChunkHndl(const TMSStreamType strmType,
-            const TUint32 key, RChunk& chunk);
+            const guint32 key, RChunk& chunk);
 
     //From DTMFTonePlayerObserver
-     void DTMFInitCompleted(TInt error);
-     void DTMFToneFinished(TInt error);
+     void DTMFInitCompleted(gint error);
+     void DTMFToneFinished(gint error);
 
 private:
     void ConstructL();
     TMSCallIPAdpt();
 
-    void NotifyClient(const gint strmId, const TInt aCommand,
-            const TInt aStatus = KErrNone, const TInt64 aInt64 = TInt64(0));
-    //void DetermineG711FrameRateL(); //G711 10/20ms
+    gint InitDTMF(TMSStreamType strmtype);
+    void NotifyClient(const gint strmId, const gint aCommand,
+            const gint aStatus = KErrNone, const gint64 aInt64 = gint64(0));
     void GetSupportedBitRatesL(CBufFlat*& brbuffer);
 
 private:
@@ -151,13 +156,13 @@
 
     TmsMsgBuf iMsgBuffer;
     TMMFPrioritySettings iPriority;
-    TUint32 iUpFourCC;
-    TUint32 iDnFourCC;
-    TInt iMaxVolume;
-    TInt iMaxGain;
-    RArray<TUint> iArrBitrates;
+    guint32 iUpFourCC;
+    guint32 iDnFourCC;
+    gint iMaxVolume;
+    gint iMaxGain;
+    RArray<guint> iArrBitrates;
     RArray<TFourCC> iCodecs;
-    TInt iCodecsCount;
+    gint iCodecsCount;
 
     TMSAudioDtmfTonePlayer* iDTMFDnlinkPlayer;
     TMSAudioDtmfTonePlayer* iDTMFUplinkPlayer;
--- a/mmserv/tms/tmscallserver/inc/tmsdtmfnotifier.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmsdtmfnotifier.h	Thu May 27 13:20:50 2010 +0300
@@ -44,7 +44,7 @@
 public:
     // New functions
 
-    void SetDtmf(TmsMsgBufPckg dtmfpckg, TBool aPublish = ETrue);
+    void SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish = TRUE);
 
 private:
 
@@ -59,7 +59,7 @@
     void ConstructL();
 
 private:
-    TInt iVolume; //Volume
+    gint iVolume;
     };
 
 } //namespace TMS
--- a/mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h	Thu May 27 13:20:50 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <e32base.h>
 #include <etelmm.h>
+#include <glib.h>
 #include <rmmcustomapi.h>
 #include "tmsdtmfobserver.h"
 
@@ -59,14 +60,14 @@
      * @param aTone Character
      */
     void NotifyDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent,
-            const TInt aError, const TChar aTone);
+            const gint aError, const TChar aTone);
 
     // from base class MCCPDTMFProvider
     /**
      * Cancels asynchronous DTMF string sending.
      * @return KErrNone if succesfull, otherwise another system wide error code
      */
-    TInt CancelDtmfStringSending();
+    gint CancelDtmfStringSending();
 
     /**
      * Starts the transmission of a single DTMF tone across a
@@ -74,13 +75,13 @@
      * @param aTone Tone to be played.
      * @return KErrNone if succesfull, otherwise another system wide error code
      */
-    TInt StartDtmfTone(const TChar aTone);
+    gint StartDtmfTone(const TChar aTone);
 
     /**
      * Stops playing current DTMF tone.
      * @return KErrNone if succesfull, otherwise another system wide error code
      */
-    TInt StopDtmfTone();
+    gint StopDtmfTone();
 
     /**
      * Plays DTMF string.
@@ -88,7 +89,7 @@
      * @return KErrNone if succesfull, otherwise another system wide error code
      * KErrArgument if the specified string contains illegal DTMF characters
      */
-    TInt SendDtmfToneString(const TDesC& aString);
+    gint SendDtmfToneString(const TDesC& aString);
 
     /**
      * Continue or cancel sending DTMF string which was stopped with 'w'
@@ -97,7 +98,7 @@
      * EFalse if the rest of the DTMF string is to be discarded.
      * @return KErrNone if succesfull, otherwise another system wide error code
      */
-    TInt ContinueDtmfStringSending(const TBool aContinue);
+    gint ContinueDtmfStringSending(const gboolean aContinue);
 
     /**
      * Add an observer for DTMF related events.
@@ -106,7 +107,7 @@
      * @param aObserver Observer
      * @leave system error if observer adding fails
      */
-    void AddObserverL(const TMSDTMFObserver& aObserver);
+    void AddObserver(const TMSDTMFObserver& aObserver);
 
     /**
      * Remove an observer.
@@ -114,7 +115,7 @@
      * @return KErrNone if removed succesfully. KErrNotFound if observer was
      * not found. Any other system error depending on the error.
      */
-    TInt RemoveObserver(const TMSDTMFObserver& aObserver);
+    gint RemoveObserver(const TMSDTMFObserver& aObserver);
 
     // from base class CActive
 protected:
--- a/mmserv/tms/tmscallserver/inc/tmsdtmftoneplayer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmsdtmftoneplayer.h	Thu May 27 13:20:50 2010 +0300
@@ -29,7 +29,7 @@
 // CLASS DECLARATION
 
 /**
- *  plays DTMF tones using media server
+ *  Plays DTMF tones using media server
  */
 
 namespace TMS {
@@ -43,7 +43,7 @@
      * Two-phased constructor.
      */
     static TMSAudioDtmfTonePlayer* NewL(TMSDTMFTonePlayerObserver& obsrvr,
-            guint aAudioPreference, guint aAudioPriority);
+            guint audioPreference, guint audioPriority);
 
     /**
      * Destructor.
@@ -57,7 +57,7 @@
      * @param aVolume volume value or KDtmfSilent.
      * @return None.
      */
-    void SetVolume(gint aVolume);
+    void SetVolume(gint volume);
 
     /**
      * Starts playing given dtmf tone infinitely.
@@ -88,31 +88,31 @@
     /**
      * See MDevSoundObserver
      */
-    void BufferToBeFilled(CMMFBuffer* aBuffer);
+    void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {}
 
     /**
      * See MDevSoundObserver
      */
-    void PlayError(TInt aError);
+    void PlayError(TInt /*aError*/) {}
 
     /**
      * See MDevSoundObserver
      */
-    void BufferToBeEmptied(CMMFBuffer* aBuffer);
+    void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
 
     /**
      * See MDevSoundObserver
      */
-    void RecordError(TInt aError);
+    void RecordError(TInt /*aError*/) {}
 
     /**
      * See MDevSoundObserver
      */
-    void ConvertError(TInt aError);
+    void ConvertError(TInt /*aError*/) {}
     /**
      * See MDevSoundObserver
      */
-    void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
+    void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {}
 
 protected:
 
@@ -120,7 +120,7 @@
      * C++ default constructor.
      */
     TMSAudioDtmfTonePlayer(TMSDTMFTonePlayerObserver& obsrvr,
-            guint aAudioPreference, guint aAudioPriority);
+            guint audioPreference, guint audioPriority);
 
     void ConstructL();
 
@@ -129,7 +129,7 @@
      * @param aTone dtmf tone.
      * @return None.
      */
-    void Normalize(TChar& aTone);
+    void Normalize(TChar& tone);
 
 private:
     //new functions
@@ -139,7 +139,7 @@
      * CMMFDevSound. The CMMFDevSound uses valuess that can from 0 to the
      * value returned by a call to CMMFDevSound::MaxVolume().
      */
-    gint ConvertVolume(gint aVolume);
+    gint ConvertVolumeLevel(gint volume);
 
 protected:
     // Data
@@ -153,7 +153,6 @@
     TMSDTMFTonePlayerObserver& iObserver;
     guint iPref;
     guint iPrior;
-
     };
 
 } //namespace TMS
--- a/mmserv/tms/tmscallserver/inc/tmseteldtmfmonitor.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/inc/tmseteldtmfmonitor.h	Thu May 27 13:20:50 2010 +0300
@@ -97,7 +97,6 @@
      * Custom API reference.
      */
     RMmCustomAPI& iMmCustom;
-
     };
 
 } //namespace TMS
--- a/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp	Thu May 27 13:20:50 2010 +0300
@@ -147,9 +147,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-gint TMSCallCSAdpt::InitStreamL(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId, TMSFormatType /*frmtType*/,
-        const RMessage2& aMessage)
+gint TMSCallCSAdpt::InitStream(TMSCallType /*callType*/, TMSStreamType strmType,
+        gint strmId, TMSFormatType /*frmtType*/, const RMessage2& message)
     {
     TRACE_PRN_FN_ENT;
     gint status(TMS_RESULT_SUCCESS);
@@ -157,13 +156,14 @@
     switch (strmType)
         {
         case TMS_STREAM_UPLINK:
+            {
             if (strmId == iUplinkStreamId)
                 {
                 // Open message queue handling client-server communication
                 if (iMsgQueueUp.Handle() <= 0)
                     {
                     // Third argument in TMSCallProxy::InitStream
-                    status = iMsgQueueUp.Open(aMessage, 1);
+                    status = iMsgQueueUp.Open(message, 1);
                     }
                 if (status == TMS_RESULT_SUCCESS)
                     {
@@ -171,11 +171,13 @@
 
                     if (status == TMS_RESULT_SUCCESS)
                         {
-                        iDTMFUplinkPlayer =  TMSDTMFProvider::NewL();
-                        iDTMFUplinkPlayer->AddObserverL(*this);
-                        if(!iDTMFNotifier)
+                        TRAP(status, iDTMFUplinkPlayer =
+                                TMSDTMFProvider::NewL());
+                        iDTMFUplinkPlayer->AddObserver(*this);
+                        if (!iDTMFNotifier)
                             {
-                            iDTMFNotifier = TMSDtmfNotifier::NewL();
+                            TRAP(status, iDTMFNotifier =
+                                    TMSDtmfNotifier::NewL());
                             }
                         }
                     }
@@ -186,14 +188,16 @@
                 status = TMS_RESULT_DOES_NOT_EXIST;
                 }
             break;
+            }
         case TMS_STREAM_DOWNLINK:
+            {
             if (strmId == iDnlinkStreamId)
                 {
                 // Open message queue handling client-server communication
                 if (iMsgQueueDn.Handle() <= 0)
                     {
                     // Third argument in TMSCallProxy::InitStream
-                    status = iMsgQueueDn.Open(aMessage, 1);
+                    status = iMsgQueueDn.Open(message, 1);
                     }
                 if (status == TMS_RESULT_SUCCESS)
                     {
@@ -201,20 +205,22 @@
                     if (status == TMS_RESULT_SUCCESS)
                         {
                         TRAP(status, iRouting =
-                             CTelephonyAudioRouting::NewL(*this));
+                                CTelephonyAudioRouting::NewL(*this));
                         if (status == TMS_RESULT_SUCCESS)
                             {
-                            iTarSettings = TMSTarSettings::NewL();
+                            TRAP(status, iTarSettings = TMSTarSettings::NewL());
                             }
                         if (status == TMS_RESULT_SUCCESS)
                             {
                             TRAP(status, iDTMFDnlinkPlayer =
-                                 TMSAudioDtmfTonePlayer::NewL(*this,
-                                 KAudioPrefKeyDownDTMF,
-                                 KAudioPriorityDtmfKeyPress));
-                            if(!iDTMFNotifier)
+                                    TMSAudioDtmfTonePlayer::NewL(*this,
+                                    KAudioDTMFString,
+                                    KAudioPriorityDTMFString));
+
+                            if (!iDTMFNotifier)
                                 {
-                                iDTMFNotifier = TMSDtmfNotifier::NewL();
+                                TRAP(status, iDTMFNotifier =
+                                        TMSDtmfNotifier::NewL());
                                 }
                             }
                         }
@@ -226,9 +232,12 @@
                 status = TMS_RESULT_DOES_NOT_EXIST;
                 }
             break;
+            }
         default:
+            {
             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
             break;
+            }
         }
 
     TRACE_PRN_IF_ERR(status);
@@ -925,7 +934,6 @@
             {
             tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
             stream.WriteUint32L(tmsoutput);
-            //TRACE_PRN_N1(_L("TMS->CallIPAdpt: outputs: [%d]"), availableOutputs[i]);
             }
 
         CleanupStack::PopAndDestroy(&stream);
@@ -956,8 +964,7 @@
             }
 
         dtmfpckg().iStatus = TMS_RESULT_SUCCESS;
-        //TMS_EVENT_DTMF_TONE_STARTED;
-        dtmfpckg().iRequest = ECmdDTMFOpenDnlinkComplete;
+        dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted;
         if (iDTMFNotifier)
             {
             iDTMFNotifier->SetDtmf(dtmfpckg, TRUE);
@@ -972,8 +979,7 @@
             }
 
         dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status);
-        //TMS_EVENT_DTMF_TONE_STARTED;
-        dtmfpckg().iRequest = ECmdDTMFOpenUplinkComplete;
+        dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted;
 
         if (iDTMFNotifier)
             {
@@ -1014,7 +1020,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-gint TMSCallCSAdpt::ContinueDTMF(TBool continuesending)
+gint TMSCallCSAdpt::ContinueDTMF(gboolean continuesending)
     {
     TRACE_PRN_FN_ENT;
     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
@@ -1035,9 +1041,10 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallCSAdpt::DTMFInitCompleted(TInt /*error*/)
+void TMSCallCSAdpt::DTMFInitCompleted(gint /*error*/)
     {
     TRACE_PRN_FN_ENT;
+    // TODO: process error
     TRACE_PRN_FN_EXT;
     }
 
@@ -1046,7 +1053,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallCSAdpt::DTMFToneFinished(TInt error)
+void TMSCallCSAdpt::DTMFToneFinished(gint error)
     {
     TRACE_PRN_FN_ENT;
     TmsMsgBufPckg dtmfpckg;
@@ -1057,7 +1064,6 @@
         }
 
     dtmfpckg().iStatus = TMSUtility::TMSResult(error);
-    //TMS_EVENT_DTMF_TONE_STOPPED
     dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
     if (iDTMFNotifier)
         {
@@ -1073,7 +1079,7 @@
 // -----------------------------------------------------------------------------
 //
 void TMSCallCSAdpt::HandleDTMFEvent(
-        const TMSDTMFObserver::TCCPDtmfEvent aEvent, const TInt aError,
+        const TMSDTMFObserver::TCCPDtmfEvent aEvent, const gint aError,
         const TChar /*aTone*/)
     {
     TRACE_PRN_FN_ENT;
@@ -1085,35 +1091,19 @@
 
     switch (aEvent)
         {
-            /** Unknown */
-        case ECCPDtmfUnknown:
+
+        case ECCPDtmfUnknown:               //Unknown
             break;
-            /** DTMF sending started manually */
-        case ECCPDtmfManualStart:
-            /** Automatic DTMF sending initialized */
-        case ECCPDtmfSequenceStart:
-            //TMS_EVENT_DTMF_TONE_STARTED
-            dtmfpckg().iRequest = ECmdDTMFOpenUplinkComplete;
+        case ECCPDtmfManualStart:           //DTMF sending started manually
+        case ECCPDtmfSequenceStart:         //Automatic DTMF sending initialized
+            dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted;
             break;
-
-            /** DTMF sending stopped manually */
-        case ECCPDtmfManualStop:
-            //break;
-            /** DTMF sending aborted manually */
-        case ECCPDtmfManualAbort:
-            //break;
-            /** Automatic DTMF sending stopped */
-        case ECCPDtmfSequenceStop:
-            //break;
-            /** Automatic DTMF sending aborted */
-        case ECCPDtmfSequenceAbort:
-            //break;
-            /** There was stop mark in DTMF string */
-        case ECCPDtmfStopInDtmfString:
-            //break;
-            /** DTMF sending completed succesfully */
-        case ECCPDtmfStringSendingCompleted:
-            //TMS_EVENT_DTMF_TONE_STOPPED
+        case ECCPDtmfManualStop:            //DTMF sending stopped manually
+        case ECCPDtmfManualAbort:           //DTMF sending aborted manually
+        case ECCPDtmfSequenceStop:          //Automatic DTMF sending stopped
+        case ECCPDtmfSequenceAbort:         //Automatic DTMF sending aborted
+        case ECCPDtmfStopInDtmfString:      //There was stop mark in DTMF string
+        case ECCPDtmfStringSendingCompleted: //DTMF sending success
             dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
             break;
         default:
@@ -1134,7 +1124,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallCSAdpt::DownlinkInitCompleted(TInt status)
+void TMSCallCSAdpt::DownlinkInitCompleted(gint status)
     {
     TRACE_PRN_FN_ENT;
     NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status, 0);
@@ -1146,7 +1136,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallCSAdpt::UplinkInitCompleted(TInt status)
+void TMSCallCSAdpt::UplinkInitCompleted(gint status)
     {
     TRACE_PRN_FN_ENT;
     NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status, 0);
@@ -1249,7 +1239,6 @@
         {
         iTarSettings->SetTar(pckg, ETrue);
         }
-    //TRACE_PRN_IF_ERR(aError);
     TRACE_PRN_FN_EXT;
     }
 
@@ -1258,11 +1247,11 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallCSAdpt::NotifyClient(const gint strmId, const gint aCommand,
-        const gint aStatus, const gint64 /*aInt64*/)
+void TMSCallCSAdpt::NotifyClient(const gint strmId, const gint command,
+        const gint status, const gint64 /*int64*/)
     {
-    iMsgBuffer.iRequest = aCommand;
-    iMsgBuffer.iStatus = aStatus;
+    iMsgBuffer.iRequest = command;
+    iMsgBuffer.iStatus = status;
 
     if (strmId == iUplinkStreamId)
         {
--- a/mmserv/tms/tmscallserver/src/tmscallipadpt.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallipadpt.cpp	Thu May 27 13:20:50 2010 +0300
@@ -105,7 +105,6 @@
     iNextStreamId = 1;
     iUplinkInitialized = FALSE;
     iDnlinkInitialized = FALSE;
-
     TRACE_PRN_FN_EXT;
     return status;
     }
@@ -163,14 +162,13 @@
 //
 // -----------------------------------------------------------------------------
 //
-gint TMSCallIPAdpt::InitStreamL(TMSCallType /*callType*/,
-        TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
-        const RMessage2& aMessage)
+gint TMSCallIPAdpt::InitStream(TMSCallType /*callType*/, TMSStreamType strmType,
+        gint strmId, TMSFormatType frmtType, const RMessage2& message)
     {
     TRACE_PRN_FN_ENT;
     gint status(TMS_RESULT_SUCCESS);
 
-    TUint32 fourCC = TOFOURCC(frmtType);
+    guint32 fourCC = TOFOURCC(frmtType);
     if (fourCC == NULL)
         {
         return TMS_RESULT_INVALID_ARGUMENT;
@@ -184,17 +182,11 @@
             if (strmId == iUplinkStreamId)
                 {
                 SetFormat(iUplinkStreamId, fourCC);
-                status = OpenUplinkL(aMessage);
-
-                iDTMFUplinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this,
-                        KAudioPrefUnknownVoipAudioUplink,
-                        KAudioPriorityUnknownVoipAudioUplink);
-
-                if (!iDTMFNotifier)
+                status = OpenUplinkL(message);
+                if (status == TMS_RESULT_SUCCESS)
                     {
-                    iDTMFNotifier = TMSDtmfNotifier::NewL();
+                    status = InitDTMF(TMS_STREAM_UPLINK);
                     }
-
                 NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
                 }
             break;
@@ -205,17 +197,11 @@
             if (strmId == iDnlinkStreamId)
                 {
                 SetFormat(iDnlinkStreamId, fourCC);
-                status = OpenDownlinkL(aMessage);
-
-                iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this,
-                        KAudioPrefUnknownVoipAudioDownlink,
-                        KAudioPriorityUnknownVoipAudioDownlink);
-
-                if (!iDTMFNotifier)
+                status = OpenDownlinkL(message);
+                if (status == TMS_RESULT_SUCCESS)
                     {
-                    iDTMFNotifier = TMSDtmfNotifier::NewL();
+                    status = InitDTMF(TMS_STREAM_DOWNLINK);
                     }
-
                 NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
                 }
             break;
@@ -1013,14 +999,21 @@
 // Method for player initialization.
 // -----------------------------------------------------------------------------
 //
-gint TMSCallIPAdpt::OpenDownlinkL(const RMessage2& aMessage)
+gint TMSCallIPAdpt::OpenDownlinkL(const RMessage2& message)
     {
     TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
 
     // Clients must have MultimediaDD capability to use this priority/pref.
     // TODO: Also, TMS will monitor for emergency call and if detected it
     //       will deny access to audio resources.
+
+    /* Clarify with adaptation team which prio/pref values should be used.
+     * 1) KAudioPrefUnknownVoipAudioDownlink      -3rd party VoIP?
+     *    KAudioPriorityUnknownVoipAudioDownlink  -3rd party VoIP?
+     * 2) KAudioPrefVoipAudioDownlink             -NOK native VoIP?
+     *    KAudioPriorityVoipAudioDownlink         -NOK native VoIP?
+     */
     iPriority.iPref = KAudioPrefVoipAudioDownlink;
     iPriority.iPriority = KAudioPriorityVoipAudioDownlink;
 
@@ -1035,7 +1028,7 @@
         if (iMsgQueueDn.Handle() <= 0)
             {
             // Second argument in TMSCallProxy::InitStream
-            status = iMsgQueueDn.Open(aMessage, 1);
+            status = iMsgQueueDn.Open(message, 1);
             }
 
         if (status == TMS_RESULT_SUCCESS)
@@ -1044,7 +1037,6 @@
             iIPDownlink->SetMsgQueue(iMsgQueueDn);
             }
         }
-
     TRACE_PRN_IF_ERR(status);
     TRACE_PRN_FN_EXT;
     return status;
@@ -1055,12 +1047,19 @@
 // Method for recorder initialization.
 // -----------------------------------------------------------------------------
 //
-gint TMSCallIPAdpt::OpenUplinkL(const RMessage2& aMessage)
+gint TMSCallIPAdpt::OpenUplinkL(const RMessage2& message)
     {
     TRACE_PRN_FN_ENT;
-    gint status(TMS_RESULT_SUCCESS);
+    gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
+
+    // Clients must have MultimediaDD capability to use this priority/pref
 
-    // Ensure clients have MultimediaDD capability to use this priority/pref
+    /* Clarify with adaptation team which prio/pref values should be used.
+     * 1) KAudioPrefUnknownVoipAudioUplink      -3rd party VoIP?
+     *    KAudioPriorityUnknownVoipAudioUplink  -3rd party VoIP?
+     * 2) KAudioPrefVoipAudioUplink             -NOK native VoIP?
+     *    KAudioPriorityVoipAudioUplink         -NOK native VoIP?
+     */
     iPriority.iPref = KAudioPrefVoipAudioUplink;
     iPriority.iPriority = KAudioPriorityVoipAudioUplink;
 
@@ -1075,7 +1074,7 @@
         if (iMsgQueueUp.Handle() <= 0)
             {
             // Second argument in TMSCallProxy::InitStream
-            status = iMsgQueueUp.Open(aMessage, 1);
+            status = iMsgQueueUp.Open(message, 1);
             }
 
         if (status == TMS_RESULT_SUCCESS)
@@ -1084,7 +1083,6 @@
             iIPUplink->SetMsgQueue(iMsgQueueUp);
             }
         }
-
     TRACE_PRN_IF_ERR(status);
     TRACE_PRN_FN_EXT;
     return status;
@@ -1095,7 +1093,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallIPAdpt::SetFormat(const gint strmId, const TUint32 aFormat)
+void TMSCallIPAdpt::SetFormat(const gint strmId, const guint32 aFormat)
     {
     if (strmId == iUplinkStreamId)
         {
@@ -1112,7 +1110,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallIPAdpt::BufferFilledL(TUint dataSize)
+void TMSCallIPAdpt::BufferFilledL(guint dataSize)
     {
     if (iIPDownlink)
         {
@@ -1139,7 +1137,7 @@
 // -----------------------------------------------------------------------------
 //
 gint TMSCallIPAdpt::GetDataXferChunkHndl(const TMSStreamType strmType,
-        const TUint32 key, RChunk& chunk)
+        const guint32 key, RChunk& chunk)
     {
     TRACE_PRN_FN_ENT;
 
@@ -1405,6 +1403,60 @@
     }
 
 // -----------------------------------------------------------------------------
+// TMSCallIPAdpt::InitDTMF
+//
+// -----------------------------------------------------------------------------
+//
+gint TMSCallIPAdpt::InitDTMF(TMSStreamType strmtype)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED);
+
+    if (strmtype == TMS_STREAM_DOWNLINK)
+        {
+        delete iDTMFDnlinkPlayer;
+        iDTMFDnlinkPlayer = NULL;
+
+        /* Clarify with adaptation team which prio/pref values should be used.
+         * 1) KAudioDTMFString                       -local play, no mixing
+         *    KAudioPriorityDTMFString               -local play, no mixing
+         * 2) KAudioPrefUnknownVoipAudioDownlink     -3rd party VoIP?
+         *    KAudioPriorityUnknownVoipAudioDownlink -3rd party VoIP?
+         * 3) KAudioPrefVoipAudioDownlink            -NOK native VoIP?
+         *    KAudioPriorityVoipAudioDownlink        -NOK native VoIP?
+         */
+        TRAP(status, iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this,
+                KAudioPrefVoipAudioDownlink, KAudioPriorityVoipAudioDownlink));
+         }
+    else if (strmtype == TMS_STREAM_UPLINK)
+        {
+        delete iDTMFUplinkPlayer;
+        iDTMFUplinkPlayer = NULL;
+
+        /* Clarify with adaptation team which prio/pref values should be used.
+         * Currently the audio policy blocks DTMF mixing with the UPL stream.
+         * 1) KAudioPrefUnknownVoipAudioUplink      -3rd party VoIP?
+         *    KAudioPriorityUnknownVoipAudioUplink  -3rd party VoIP?
+         *    KAudioPriorityUnknownVoipAudioUplinkNonSignal -???
+         * 2) KAudioPrefVoipAudioUplink             -NOK native VoIP?
+         *    KAudioPrefUnknownVoipAudioUplinkNonSignal -???
+         *    KAudioPrefVoipAudioUplinkNonSignal        -???
+         *    KAudioPriorityVoipAudioUplink         -NOK native VoIP?
+         */
+        TRAP(status, iDTMFUplinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this,
+                KAudioPrefVoipAudioUplink, KAudioPriorityVoipAudioUplink));
+        }
+
+    if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS)
+         {
+         TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL());
+         }
+
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
 // TMSCallIPAdpt::StartDTMF
 //
 // -----------------------------------------------------------------------------
@@ -1412,35 +1464,44 @@
 gint TMSCallIPAdpt::StartDTMF(TMSStreamType strmtype, TDes& dtmfstring)
     {
     TRACE_PRN_FN_ENT;
+    gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED);
     TmsMsgBufPckg dtmfpckg;
+    dtmfpckg().iStatus = status;
+    dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
+
     if (strmtype == TMS_STREAM_DOWNLINK)
         {
-        if (iDTMFDnlinkPlayer /*&& iDTMFDnlinkStatus*/)
+        status = TMS_RESULT_UNINITIALIZED_OBJECT;
+        if (iDTMFDnlinkPlayer)
             {
             iDTMFDnlinkPlayer->PlayDtmfTone(dtmfstring);
-            dtmfpckg().iStatus = TMS_RESULT_SUCCESS;
-            //TMS_EVENT_DTMF_TONE_STARTED
-            dtmfpckg().iRequest = ECmdDTMFOpenDnlinkComplete;
+            status = TMS_RESULT_SUCCESS;
             }
+        dtmfpckg().iStatus = status;
+        dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted;
         }
     else if (strmtype == TMS_STREAM_UPLINK)
         {
-        if (iDTMFUplinkPlayer /*&& iDTMFUplinkStatus*/)
+        status = TMS_RESULT_UNINITIALIZED_OBJECT;
+        if (iDTMFUplinkPlayer)
             {
             iDTMFUplinkPlayer->PlayDtmfTone(dtmfstring);
-            dtmfpckg().iStatus = TMS_RESULT_SUCCESS;
-            //TMS_EVENT_DTMF_TONE_STARTED
-            dtmfpckg().iRequest = ECmdDTMFOpenUplinkComplete;
+            status = TMS_RESULT_SUCCESS;
             }
+        dtmfpckg().iStatus = status;
+        dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted;
         }
 
     if (iDTMFNotifier)
         {
-        iDTMFNotifier->SetDtmf(dtmfpckg, TRUE);
+        iDTMFNotifier->SetDtmf(dtmfpckg);
         }
+
+    TRACE_PRN_IF_ERR(status);
     TRACE_PRN_FN_EXT;
-    return TMS_RESULT_SUCCESS;
+    return status;
     }
+
 // -----------------------------------------------------------------------------
 // TMSCallIPAdpt::StopDTMF
 //
@@ -1454,7 +1515,7 @@
         {
         iDTMFDnlinkPlayer->Cancel();
         }
-    else
+    else if (streamtype == TMS_STREAM_UPLINK)
         {
         iDTMFUplinkPlayer->Cancel();
         }
@@ -1468,10 +1529,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-gint TMSCallIPAdpt::ContinueDTMF(TBool /*continuesending*/)
+gint TMSCallIPAdpt::ContinueDTMF(gboolean /*continuesending*/)
     {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
     return TMS_RESULT_FEATURE_NOT_SUPPORTED;
     }
 
@@ -1481,10 +1540,10 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallIPAdpt::DTMFInitCompleted(TInt /*error*/)
+void TMSCallIPAdpt::DTMFInitCompleted(gint /*error*/)
     {
-    //DTMF init status
     TRACE_PRN_FN_ENT;
+    //TRACE_PRN_IF_ERR(error);
     TRACE_PRN_FN_EXT;
     }
 
@@ -1493,22 +1552,22 @@
 //
 // -----------------------------------------------------------------------------
 //
-void TMSCallIPAdpt::DTMFToneFinished(TInt error)
+void TMSCallIPAdpt::DTMFToneFinished(gint error)
     {
     TRACE_PRN_FN_ENT;
+    TRACE_PRN_IF_ERR(error);
     TmsMsgBufPckg dtmfpckg;
 
-     if(error == KErrUnderflow || error == KErrInUse)
+    // Ignore KErrUnderflow - end of DTMF playback.
+    if(error == KErrUnderflow /*|| error == KErrInUse*/)
          {
          error = TMS_RESULT_SUCCESS;
          }
-
     dtmfpckg().iStatus = error;
-    //TMS_EVENT_DTMF_TONE_STOPPED
     dtmfpckg().iRequest = ECmdDTMFTonePlayFinished;
     if (iDTMFNotifier)
         {
-        iDTMFNotifier->SetDtmf(dtmfpckg, TRUE);
+        iDTMFNotifier->SetDtmf(dtmfpckg);
         }
     TRACE_PRN_FN_EXT;
     }
@@ -1517,8 +1576,8 @@
 // TMSCallIPAdpt::NotifyClient
 // -----------------------------------------------------------------------------
 //
-void TMSCallIPAdpt::NotifyClient(const gint strmId, const TInt aCommand,
-        const TInt aStatus, const TInt64 /*aInt64*/)
+void TMSCallIPAdpt::NotifyClient(const gint strmId, const gint aCommand,
+        const gint aStatus, const gint64 /*aInt64*/)
     {
     iMsgBuffer.iRequest = aCommand;
     iMsgBuffer.iStatus = aStatus;
--- a/mmserv/tms/tmscallserver/src/tmscallsession.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscallsession.cpp	Thu May 27 13:20:50 2010 +0300
@@ -25,6 +25,7 @@
 using namespace TMS;
 
 const guint KArrayExpandSize = 8;
+const guint KNumOfElements = 10;
 
 // -----------------------------------------------------------------------------
 // TMSCallSession::TMSCallSession
@@ -298,7 +299,7 @@
         {
         TMSCliSrvStreamInitDataStructBufPckg pckg;
         aMessage.ReadL(0, pckg);
-        status = iCallAdpt->InitStreamL(pckg().CallType, pckg().StreamType,
+        status = iCallAdpt->InitStream(pckg().CallType, pckg().StreamType,
                 pckg().StreamId, pckg().FormatType, aMessage);
 
         switch (pckg().StreamType)
@@ -1106,7 +1107,7 @@
     gint count;
     if (iCallAdpt)
         {
-        CBufFlat* outputbuf = CBufFlat::NewL(10);
+        CBufFlat* outputbuf = CBufFlat::NewL(KNumOfElements);
         CleanupStack::PushL(outputbuf);
         status = iCallAdpt->GetAvailableOutputsL(count, outputbuf);
 
@@ -1132,8 +1133,6 @@
         HBufC* tone(NULL);
         if (len > 0)
             {
-            delete tone;
-            tone = NULL;
             TRAP(status,tone = HBufC::NewL(len));
             if (status == KErrNone)
                 {
--- a/mmserv/tms/tmscallserver/src/tmsdtmfnotifier.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmsdtmfnotifier.cpp	Thu May 27 13:20:50 2010 +0300
@@ -44,9 +44,9 @@
 void TMSDtmfNotifier::ConstructL()
     {
     TRACE_PRN_FN_ENT;
-    TInt err = RProperty::Define(EDtmfPs, RProperty::EByteArray,
+    gint err = RProperty::Define(EDtmfPs, RProperty::EByteArray,
             KTMSServerReadPolicy, KTMSServerWritePolicy);
-    TRACE_PRN_N1(_L("DtmfSetting::ConstructL err:%d"),err);
+    TRACE_PRN_N1(_L("DtmfSetting::ConstructL err:%d"), err);
 
     if (err != KErrAlreadyExists)
         {
@@ -73,25 +73,23 @@
 TMSDtmfNotifier::~TMSDtmfNotifier()
     {
     TRACE_PRN_FN_ENT;
-    TInt err = RProperty::Delete(KTMSPropertyCategory, EDtmfPs);
-    TRACE_PRN_N1(_L("DtmfSetting::~TMSDtmfNotifier err:%d"),err);
+    gint err = RProperty::Delete(KTMSPropertyCategory, EDtmfPs);
+    TRACE_PRN_N1(_L("DtmfSetting::~TMSDtmfNotifier err:%d"), err);
     TRACE_PRN_FN_ENT;
     }
 
 // -----------------------------------------------------------------------------
-// TMSDtmfNotifier::SetVolume
+// TMSDtmfNotifier::SetDtmf
 // -----------------------------------------------------------------------------
 //
-void TMSDtmfNotifier::SetDtmf(TmsMsgBufPckg dtmfpckg, TBool aPublish)
+void TMSDtmfNotifier::SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish)
     {
     TRACE_PRN_FN_ENT;
-    //TInt err(KErrNone);
-    if (aPublish)
+    if (publish)
         {
-        /*err =*/RProperty::Set(KTMSPropertyCategory, EDtmfPs, dtmfpckg);
+        gint err = RProperty::Set(KTMSPropertyCategory, EDtmfPs, dtmfpckg);
+        TRACE_PRN_N1(_L("DtmfSetting::SetDtmf err:%d"), err);
         }
-
-    //TRACE_PRN_N1(_L("DtmfSetting::SetDtmf err:%d"),err);
     TRACE_PRN_FN_EXT;
     }
 
--- a/mmserv/tms/tmscallserver/src/tmsdtmfprovider.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmsdtmfprovider.cpp	Thu May 27 13:20:50 2010 +0300
@@ -56,184 +56,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// Notifies observers about a DTMF event
-// -----------------------------------------------------------------------------
-//
-void TMSDTMFProvider::NotifyDTMFEvent(
-        const TMSDTMFObserver::TCCPDtmfEvent aEvent, const gint aError,
-        const TChar aTone)
-    {
-    TRACE_PRN_FN_ENT;
-    for (gint i = 0; i < iObservers.Count(); i++)
-        {
-        TMSDTMFObserver* obs = iObservers[i];
-        if (obs)
-            {
-            iObservers[i]->HandleDTMFEvent(aEvent, aError, aTone);
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// Cancel DTMF string sending
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::CancelDtmfStringSending()
-    {
-    TRACE_PRN_FN_ENT;
-    gint ret(KErrAlreadyExists);
-    if (IsActive())
-        {
-        Cancel();
-        ret = KErrNone;
-        }
-    TRACE_PRN_FN_EXT;
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// Starts DTMF string sending
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::StartDtmfTone(const TChar aTone)
-    {
-    TRACE_PRN_FN_ENT;
-    gint ret(KErrAlreadyExists);
-    if (!IsActive())
-        {
-        ret = iPhone.StartDTMFTone(aTone);
-        }
-    TRACE_PRN_FN_EXT;
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// Stop DTMF tone
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::StopDtmfTone()
-    {
-    TRACE_PRN_FN_ENT;
-    gint ret(KErrAlreadyExists);
-    if (!IsActive())
-        {
-        ret = iPhone.StopDTMFTone();
-        }
-    TRACE_PRN_FN_EXT;
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// Send DTMF string
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::SendDtmfToneString(const TDesC& aString)
-    {
-    TRACE_PRN_FN_ENT;
-    gint ret = KErrInUse;
-    if (!IsActive())
-        {
-        iStatus = KRequestPending;
-        iPhone.SendDTMFTones(iStatus, aString);
-        SetActive();
-        ret = KErrNone;
-        }
-    TRACE_PRN_FN_EXT;
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// Continue DTMF string sending
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::ContinueDtmfStringSending(const TBool aContinue)
-    {
-    TRACE_PRN_FN_ENT;
-    gint status = iPhone.ContinueDTMFStringSending(aContinue);
-    TRACE_PRN_FN_EXT;
-    return status;
-    }
-
-// -----------------------------------------------------------------------------
-// Adds observer.
-// -----------------------------------------------------------------------------
-//
-void TMSDTMFProvider::AddObserverL(const TMSDTMFObserver& aObserver)
-    {
-    TRACE_PRN_FN_ENT;
-    if (iObservers.Find(&aObserver) == KErrNotFound)
-        {
-        iObservers.Append(&aObserver);
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// Removes given observer.
-// -----------------------------------------------------------------------------
-//
-TInt TMSDTMFProvider::RemoveObserver(const TMSDTMFObserver& aObserver)
-    {
-    TRACE_PRN_FN_ENT;
-    gint ret = KErrNotFound;
-    gint found = iObservers.Find(&aObserver);
-    if (found != KErrNotFound)
-        {
-        iObservers.Remove(found);
-        ret = KErrNone;
-        }
-    TRACE_PRN_FN_EXT;
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// From CActive.
-// Handles request completion.
-// -----------------------------------------------------------------------------
-//
-void TMSDTMFProvider::RunL()
-    {
-    TRACE_PRN_FN_ENT;
-    if (iStatus == KErrNone)
-        {
-        TMSDTMFObserver::TCCPDtmfEvent event =
-                TMSDTMFObserver::ECCPDtmfStringSendingCompleted;
-        NotifyDTMFEvent(event, KErrNone, NULL);
-        }
-    else
-        {
-        gint error = iStatus.Int();
-        if (error != KErrCancel)
-            {
-            TMSDTMFObserver::TCCPDtmfEvent event =
-                    TMSDTMFObserver::ECCPDtmfStringSendingCompleted;
-            NotifyDTMFEvent(event, error, NULL);
-            }
-        else
-            {
-            // Cancel is not notified
-            }
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// From CActive
-// Canceling functionality.
-// -----------------------------------------------------------------------------
-//
-void TMSDTMFProvider::DoCancel()
-    {
-    TRACE_PRN_FN_ENT;
-    if (iStatus == KRequestPending)
-        {
-        iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
 // Constructs the requester.
 // -----------------------------------------------------------------------------
 //
@@ -308,4 +130,176 @@
     TRACE_PRN_FN_EXT;
     }
 
+// -----------------------------------------------------------------------------
+// Notifies observers about a DTMF event
+// -----------------------------------------------------------------------------
+//
+void TMSDTMFProvider::NotifyDTMFEvent(
+        const TMSDTMFObserver::TCCPDtmfEvent aEvent, const gint aError,
+        const TChar aTone)
+    {
+    TRACE_PRN_FN_ENT;
+    for (gint i = 0; i < iObservers.Count(); i++)
+        {
+        TMSDTMFObserver* obs = iObservers[i];
+        if (obs)
+            {
+            iObservers[i]->HandleDTMFEvent(aEvent, aError, aTone);
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// Cancel DTMF string sending
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::CancelDtmfStringSending()
+    {
+    TRACE_PRN_FN_ENT;
+    gint ret(KErrAlreadyExists);
+    if (IsActive())
+        {
+        Cancel();
+        ret = KErrNone;
+        }
+    TRACE_PRN_FN_EXT;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Starts DTMF string sending
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::StartDtmfTone(const TChar aTone)
+    {
+    TRACE_PRN_FN_ENT;
+    gint ret(KErrAlreadyExists);
+    if (!IsActive())
+        {
+        ret = iPhone.StartDTMFTone(aTone);
+        }
+    TRACE_PRN_FN_EXT;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Stop DTMF tone
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::StopDtmfTone()
+    {
+    TRACE_PRN_FN_ENT;
+    gint ret(KErrAlreadyExists);
+    if (!IsActive())
+        {
+        ret = iPhone.StopDTMFTone();
+        }
+    TRACE_PRN_FN_EXT;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Send DTMF string
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::SendDtmfToneString(const TDesC& aString)
+    {
+    TRACE_PRN_FN_ENT;
+    gint ret = KErrInUse;
+    if (!IsActive())
+        {
+        iStatus = KRequestPending;
+        iPhone.SendDTMFTones(iStatus, aString);
+        SetActive();
+        ret = KErrNone;
+        }
+    TRACE_PRN_FN_EXT;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Continue DTMF string sending
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::ContinueDtmfStringSending(const gboolean aContinue)
+    {
+    TRACE_PRN_FN_ENT;
+    gint status = iPhone.ContinueDTMFStringSending(aContinue);
+    TRACE_PRN_FN_EXT;
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// Adds observer.
+// -----------------------------------------------------------------------------
+//
+void TMSDTMFProvider::AddObserver(const TMSDTMFObserver& aObserver)
+    {
+    TRACE_PRN_FN_ENT;
+    if (iObservers.Find(&aObserver) == KErrNotFound)
+        {
+        iObservers.Append(&aObserver);
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// Removes given observer.
+// -----------------------------------------------------------------------------
+//
+gint TMSDTMFProvider::RemoveObserver(const TMSDTMFObserver& aObserver)
+    {
+    TRACE_PRN_FN_ENT;
+    gint ret = KErrNotFound;
+    gint found = iObservers.Find(&aObserver);
+    if (found != KErrNotFound)
+        {
+        iObservers.Remove(found);
+        ret = KErrNone;
+        }
+    TRACE_PRN_FN_EXT;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// From CActive.
+// Handles request completion.
+// -----------------------------------------------------------------------------
+//
+void TMSDTMFProvider::RunL()
+    {
+    TRACE_PRN_FN_ENT;
+    if (iStatus == KErrNone)
+        {
+        TMSDTMFObserver::TCCPDtmfEvent event =
+                TMSDTMFObserver::ECCPDtmfStringSendingCompleted;
+        NotifyDTMFEvent(event, KErrNone, NULL);
+        }
+    else
+        {
+        gint error = iStatus.Int();
+        if (error != KErrCancel)
+            {
+            TMSDTMFObserver::TCCPDtmfEvent event =
+                    TMSDTMFObserver::ECCPDtmfStringSendingCompleted;
+            NotifyDTMFEvent(event, error, NULL);
+            }
+        // Cancel is not notified
+        }
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
+// From CActive
+// Canceling functionality.
+// -----------------------------------------------------------------------------
+//
+void TMSDTMFProvider::DoCancel()
+    {
+    TRACE_PRN_FN_ENT;
+    iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
+    TRACE_PRN_FN_EXT;
+    }
+
 //  End of File
--- a/mmserv/tms/tmscallserver/src/tmsdtmftoneplayer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmsdtmftoneplayer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -16,8 +16,6 @@
  */
 
 // INCLUDE FILES
-#include <mdaaudiotoneplayer.h>
-#include <AudioPreference.h>
 #include "tmsutility.h"
 #include "tmsdtmftoneplayer.h"
 
@@ -40,12 +38,11 @@
 // -----------------------------------------------------------------------------
 //
 TMSAudioDtmfTonePlayer* TMSAudioDtmfTonePlayer::NewL(
-        TMSDTMFTonePlayerObserver& obsrvr, guint aAudioPreference,
-        guint aAudioPriority)
+        TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference,
+        guint audioPriority)
     {
-    //iObserver = obsrvr;
-    TMSAudioDtmfTonePlayer* self = new (ELeave) TMSAudioDtmfTonePlayer(
-            obsrvr, aAudioPreference, aAudioPriority);
+    TMSAudioDtmfTonePlayer* self = new (ELeave) TMSAudioDtmfTonePlayer(obsrvr,
+            audioPreference, audioPriority);
 
     CleanupStack::PushL(self);
     self->ConstructL();
@@ -69,11 +66,11 @@
 // -----------------------------------------------------------------------------
 //
 TMSAudioDtmfTonePlayer::TMSAudioDtmfTonePlayer(
-        TMSDTMFTonePlayerObserver& obsrvr, guint aAudioPreference,
-        guint aAudioPriority) :
+        TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference,
+        guint audioPriority) :
     iObserver(obsrvr),
-    iPref(aAudioPreference),
-    iPrior(aAudioPriority)
+    iPref(audioPreference),
+    iPrior(audioPriority)
     {
     TRACE_PRN_FN_ENT;
     TRACE_PRN_FN_EXT;
@@ -100,10 +97,10 @@
 // Sets the volume level that is used when the dtmf tone is played.
 // -----------------------------------------------------------------------------
 //
-void TMSAudioDtmfTonePlayer::SetVolume(gint aVolume)
+void TMSAudioDtmfTonePlayer::SetVolume(gint volume)
     {
     TRACE_PRN_FN_ENT;
-    gint vol = ConvertVolume(aVolume);
+    gint vol = ConvertVolumeLevel(volume);
 
     if (vol != iVolume)
         {
@@ -119,17 +116,17 @@
 // member function.
 // -----------------------------------------------------------------------------
 //
-void TMSAudioDtmfTonePlayer::PlayDtmfTone(TDes& aTone)
+void TMSAudioDtmfTonePlayer::PlayDtmfTone(TDes& tone)
     {
     TRACE_PRN_FN_ENT;
     Cancel();
 
-    // DTMF signalling.
+    // DTMF signaling.
     if (iDTMFPlayer)
         {
         TBuf<KBufSize> key;
-        key.Append(aTone);
-        TRAP_IGNORE(iDTMFPlayer->PlayDTMFStringL(aTone));
+        key.Append(tone);
+        TRAP_IGNORE(iDTMFPlayer->PlayDTMFStringL(tone));
         }
     TRACE_PRN_FN_EXT;
     }
@@ -152,16 +149,15 @@
 // char ('*').
 // -----------------------------------------------------------------------------
 //
-void TMSAudioDtmfTonePlayer::Normalize(TChar& aTone)
+void TMSAudioDtmfTonePlayer::Normalize(TChar& tone)
     {
     TRACE_PRN_FN_ENT;
-    aTone.LowerCase();
-
+    tone.LowerCase();
     TPtrC ast(KPhoneTone_Asterisk);
 
-    if (ast.Locate(aTone) != KErrNotFound)
+    if (ast.Locate(tone) != KErrNotFound)
         {
-        aTone = ast[0];
+        tone = ast[0];
         }
     TRACE_PRN_FN_EXT;
     }
@@ -177,7 +173,7 @@
     if (aError == KErrNone)
         {
         TMMFPrioritySettings dtmfPlayerSettings;
-        dtmfPlayerSettings.iPref = (TMdaPriorityPreference) iPref;
+        dtmfPlayerSettings.iPref = iPref;
         dtmfPlayerSettings.iPriority = iPrior;
         dtmfPlayerSettings.iState = EMMFStateTonePlaying;
         iDTMFPlayer->SetPrioritySettings(dtmfPlayerSettings);
@@ -206,74 +202,13 @@
     }
 
 // -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::BufferToBeFilled
-// -----------------------------------------------------------------------------
-//
-void TMSAudioDtmfTonePlayer::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::PlayError
-// -----------------------------------------------------------------------------
-//
-void TMSAudioDtmfTonePlayer::PlayError(TInt /*aError*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::BufferToBeEmptied
-// -----------------------------------------------------------------------------
-//
-void TMSAudioDtmfTonePlayer::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::RecordError
+// TMSAudioDtmfTonePlayer::ConvertVolumeLevel
 // -----------------------------------------------------------------------------
 //
-void TMSAudioDtmfTonePlayer::RecordError(TInt /*aError*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::ConvertError
-// -----------------------------------------------------------------------------
-//
-void TMSAudioDtmfTonePlayer::ConvertError(TInt /*aError*/)
+gint TMSAudioDtmfTonePlayer::ConvertVolumeLevel(gint volume)
     {
     TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::DeviceMessage
-// -----------------------------------------------------------------------------
-//
-void TMSAudioDtmfTonePlayer::DeviceMessage(TUid /*aMessageType*/,
-        const TDesC8& /*aMsg*/)
-    {
-    TRACE_PRN_FN_ENT;
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// TMSAudioDtmfTonePlayer::ConvertVolume
-// -----------------------------------------------------------------------------
-//
-gint TMSAudioDtmfTonePlayer::ConvertVolume(gint aVolume)
-    {
-    TRACE_PRN_FN_ENT;
-    gint result = iDTMFPlayer->MaxVolume() * aVolume / KMaxVolumeLevel;
+    gint result = iDTMFPlayer->MaxVolume() * volume / KMaxVolumeLevel;
     TRACE_PRN_FN_EXT;
     return result;
     }
--- a/mmserv/tms/tmscallserver/src/tmseteldtmfmonitor.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmseteldtmfmonitor.cpp	Thu May 27 13:20:50 2010 +0300
@@ -39,6 +39,21 @@
     }
 
 // -----------------------------------------------------------------------------
+// Constructs the monitor.
+// -----------------------------------------------------------------------------
+//
+TMSEtelDtmfMonitor::TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver,
+        RMmCustomAPI& aMmCustom) :
+    CActive(EPriorityStandard),
+    iObserver(aObserver),
+    iMmCustom(aMmCustom)
+    {
+    TRACE_PRN_FN_ENT;
+    CActiveScheduler::Add(this);
+    TRACE_PRN_FN_EXT;
+    }
+
+// -----------------------------------------------------------------------------
 // Destructs the object by canceling first ongoing monitoring.
 // -----------------------------------------------------------------------------
 //
@@ -73,7 +88,7 @@
 void TMSEtelDtmfMonitor::RunL()
     {
     TRACE_PRN_FN_ENT;
-    TInt err = iStatus.Int();
+    gint err = iStatus.Int();
     TRACE_PRN_N1(_L("**TMS TMSEtelDtmfMonitor::RunL: status:%d"), err);
 
     if (err == KErrNone)
@@ -143,25 +158,7 @@
 void TMSEtelDtmfMonitor::DoCancel()
     {
     TRACE_PRN_FN_ENT;
-    if (iStatus == KRequestPending)
-        {
-        iMmCustom.CancelAsyncRequest(ECustomNotifyDtmfEventIPC);
-        }
-    TRACE_PRN_FN_EXT;
-    }
-
-// -----------------------------------------------------------------------------
-// Constructs the monitor.
-// -----------------------------------------------------------------------------
-//
-TMSEtelDtmfMonitor::TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver,
-        RMmCustomAPI& aMmCustom) :
-    CActive(EPriorityStandard),
-    iObserver(aObserver),
-    iMmCustom(aMmCustom)
-    {
-    TRACE_PRN_FN_ENT;
-    CActiveScheduler::Add(this);
+    iMmCustom.CancelAsyncRequest(ECustomNotifyDtmfEventIPC);
     TRACE_PRN_FN_EXT;
     }
 
--- a/mmserv/tms/tmscallserver/src/tmseteldtmfstopmonitor.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmseteldtmfstopmonitor.cpp	Thu May 27 13:20:50 2010 +0300
@@ -120,10 +120,7 @@
 void TMSEtelDtmfStopMonitor::DoCancel()
     {
     TRACE_PRN_FN_ENT;
-    if (iStatus == KRequestPending)
-        {
-        iPhone.CancelAsyncRequest(EMobilePhoneNotifyStopInDTMFString);
-        }
+    iPhone.CancelAsyncRequest(EMobilePhoneNotifyStopInDTMFString);
     TRACE_PRN_FN_EXT;
     }
 
--- a/mmserv/tms/tmsfactory/bwins/tmsfactory.def	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsfactory/bwins/tmsfactory.def	Thu May 27 13:20:50 2010 +0300
@@ -24,4 +24,6 @@
 	?DeleteGlobalRouting@TMSFactory@TMS@@QAEHAAPAVTMSGlobalRouting@2@@Z @ 23 NONAME ; int TMS::TMSFactory::DeleteGlobalRouting(class TMS::TMSGlobalRouting * &)
 	?DeleteRingTonePlayer@TMSFactory@TMS@@QAEHAAPAVTMSRingTone@2@@Z @ 24 NONAME ; int TMS::TMSFactory::DeleteRingTonePlayer(class TMS::TMSRingTone * &)
 	?CreateFormat@TMSFactory@TMS@@QAEHHAAPAVTMSFormat@2@@Z @ 25 NONAME ; int TMS::TMSFactory::CreateFormat(int, class TMS::TMSFormat * &)
+	?CreateRTPSession@TMSFactory@TMS@@QAEHAAPAVTMSRTPSession@2@PAEI@Z @ 26 NONAME ; int TMS::TMSFactory::CreateRTPSession(class TMS::TMSRTPSession * &, unsigned char *, unsigned int)
+	?DeleteRTPSession@TMSFactory@TMS@@QAEHAAPAVTMSRTPSession@2@@Z @ 27 NONAME ; int TMS::TMSFactory::DeleteRTPSession(class TMS::TMSRTPSession * &)
 
--- a/mmserv/tms/tmsfactory/eabi/tmsfactory.def	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsfactory/eabi/tmsfactory.def	Thu May 27 13:20:50 2010 +0300
@@ -30,4 +30,6 @@
 	_ZTIN3TMS14TMSFactoryImplE @ 29 NONAME
 	_ZTVN3TMS10TMSFactoryE @ 30 NONAME
 	_ZTVN3TMS14TMSFactoryImplE @ 31 NONAME
+	_ZN3TMS10TMSFactory16CreateRTPSessionERPNS_13TMSRTPSessionEPhj @ 32 NONAME
+	_ZN3TMS10TMSFactory16DeleteRTPSessionERPNS_13TMSRTPSessionE @ 33 NONAME
 
--- a/mmserv/tms/tmsfactory/src/tmsfactory.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsfactory/src/tmsfactory.cpp	Thu May 27 13:20:50 2010 +0300
@@ -276,3 +276,15 @@
     return status;
     }
 
+EXPORT_C gint TMSFactory::CreateRTPSession(TMSRTPSession*& /*rtpsession*/,
+        guint8* /*sdp*/, guint /*mode*/)
+    {
+    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
+    }
+
+EXPORT_C gint TMSFactory::DeleteRTPSession(TMSRTPSession*& /*rtpsession*/)
+    {
+    return TMS_RESULT_FEATURE_NOT_SUPPORTED;
+    }
+
+
--- a/mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -68,8 +68,6 @@
         case TMS_CALL_IP:
             flag = ETrue;
             break;
-        case TMS_CALL_ECS: //from TB 10.2
-        case TMS_CALL_RTP: //from TB 10.2
         default:
             flag = EFalse;
             break;
@@ -248,7 +246,7 @@
 gint TMSFactoryImpl::QueryDevice(const TMSStreamType strmtype)
     {
     gint ret(TMS_RESULT_SUCCESS);
-    TMSProxy* session = new TMSProxy;
+    TMSProxy* session = new TMSProxy();
     if (session)
         {
         if (session->Connect() == TMS_RESULT_SUCCESS)
--- a/mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h	Thu May 27 13:20:50 2010 +0300
@@ -42,7 +42,7 @@
     virtual gint Start();
     virtual gint Stop();
     virtual gint SetTone(GString* string);
-    virtual gint ContinueDTMFStringSending(gboolean aContinue);
+    virtual gint ContinueDTMFStringSending(gboolean sending);
 
     void SetParent(TMSDTMF*& parent);
 
--- a/mmserv/tms/tmsimpl/inc/tmsringtonebodyimpl.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/inc/tmsringtonebodyimpl.h	Thu May 27 13:20:50 2010 +0300
@@ -60,7 +60,6 @@
     TMSRingTone* iParent;
     guint iClientId;
     gint iScreenID;
-    //RWindow iWindow;
     };
 
 } //namespace TMS
--- a/mmserv/tms/tmsimpl/src/tmsamrbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsamrbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSAMRFormatBodyImpl::Create(TMSAMRFormatBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSAMRFormatBodyImpl* self = new TMSAMRFormatBodyImpl;
+    TMSAMRFormatBodyImpl* self = new TMSAMRFormatBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsamrimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsamrimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
 gint TMSAMRFormatImpl::Create(TMSFormat*& tmsformat)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSAMRFormatImpl *self = new TMSAMRFormatImpl;
+    TMSAMRFormatImpl *self = new TMSAMRFormatImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmscallbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmscallbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -31,7 +31,7 @@
 gint TMSCallBodyImpl::Create(TMSCallBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSCallBodyImpl* self = new TMSCallBodyImpl;
+    TMSCallBodyImpl* self = new TMSCallBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmscallimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmscallimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -66,7 +66,7 @@
         guint ctxid)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSCallImpl *self = new TMSCallImpl;
+    TMSCallImpl *self = new TMSCallImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -37,7 +37,7 @@
 gint TMSClientSinkBodyImpl::Create(TMSClientSinkBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSClientSinkBodyImpl* self = new TMSClientSinkBodyImpl;
+    TMSClientSinkBodyImpl* self = new TMSClientSinkBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSClientSinkImpl::Create(TMSSink*& tmssink)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSClientSinkImpl *self = new TMSClientSinkImpl;
+    TMSClientSinkImpl *self = new TMSClientSinkImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSClientSourceBodyImpl::Create(TMSClientSourceBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSClientSourceBodyImpl* self = new TMSClientSourceBodyImpl;
+    TMSClientSourceBodyImpl* self = new TMSClientSourceBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSClientSourceImpl::Create(TMSSource*& tmssource)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSClientSourceImpl *self = new TMSClientSourceImpl;
+    TMSClientSourceImpl *self = new TMSClientSourceImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -45,7 +45,7 @@
 gint TMSCSCallBodyImpl::Create(TMSCallBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSCSCallBodyImpl* self = new TMSCSCallBodyImpl;
+    TMSCSCallBodyImpl* self = new TMSCSCallBodyImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
@@ -67,7 +67,7 @@
     gint ret(TMS_RESULT_SUCCESS);
     TRACE_PRN_FN_ENT;
 
-    iSession = new TMSCallProxy;
+    iSession = new TMSCallProxy();
 
     TRACE_PRN_FN_ENT;
     if (!iSession)
--- a/mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -39,9 +39,9 @@
     if (iProxy)
         {
         iProxy->Close();
-        delete iProxy;
-        iProxy = NULL;
         }
+    delete iProxy;
+
     if (iString)
         {
         g_string_free(iString, TRUE);
@@ -77,18 +77,19 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
     if (!iProxy)
         {
         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
         }
-    RET_REASON_IF_ERR(ret);
-
-    if (iProxy->Connect() != TMS_RESULT_SUCCESS)
+    else
         {
-        delete iProxy;
-        iProxy = NULL;
-        ret = TMS_RESULT_FATAL_ERROR;
+        if (iProxy->Connect() != TMS_RESULT_SUCCESS)
+            {
+            delete iProxy;
+            iProxy = NULL;
+            ret = TMS_RESULT_FATAL_ERROR;
+            }
         }
     RET_REASON_IF_ERR(ret);
     return ret;
@@ -141,7 +142,7 @@
 gint TMSDTMFBodyImpl::Start()
     {
     gint ret(TMS_RESULT_SUCCESS);
-    if (iProxy)
+    if (iProxy && iString)
         {
         if (iString->len)
             {
@@ -154,7 +155,7 @@
         }
     else
         {
-        ret = TMS_RESULT_DOES_NOT_EXIST;
+        ret = TMS_RESULT_UNINITIALIZED_OBJECT;
         }
     return ret;
     }
@@ -168,30 +169,35 @@
         }
     else
         {
-        ret = TMS_RESULT_DOES_NOT_EXIST;
+        ret = TMS_RESULT_UNINITIALIZED_OBJECT;
         }
     return ret;
     }
 
 gint TMSDTMFBodyImpl::SetTone(GString* string)
     {
+    __ASSERT_ALWAYS(string, PANIC(TMS_RESULT_NULL_ARGUMENT));
+
     gint ret(TMS_RESULT_SUCCESS);
 
-    if (iString && iString->len)
+    if (iString)
         {
-        g_string_free(iString, TRUE);
+        if (iString->len)
+            {
+            g_string_free(iString, TRUE);
+            }
         }
 
     iString = g_string_new_len(string->str, string->len);
     return ret;
     }
 
-gint TMSDTMFBodyImpl::ContinueDTMFStringSending(gboolean aContinue)
+gint TMSDTMFBodyImpl::ContinueDTMFStringSending(gboolean sending)
     {
     gint ret(TMS_RESULT_SUCCESS);
     if (iProxy)
         {
-        ret = iProxy->ContinueDTMFStringSending(aContinue);
+        ret = iProxy->ContinueDTMFStringSending(sending);
         }
     else
         {
--- a/mmserv/tms/tmsimpl/src/tmsg711bodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsg711bodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSG711FormatBodyImpl::Create(TMSG711FormatBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSG711FormatBodyImpl* self = new TMSG711FormatBodyImpl;
+    TMSG711FormatBodyImpl* self = new TMSG711FormatBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsg711impl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsg711impl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
 gint TMSG711FormatImpl::Create(TMSFormat*& tmsformat)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSG711FormatImpl *self = new TMSG711FormatImpl;
+    TMSG711FormatImpl *self = new TMSG711FormatImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsg729bodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsg729bodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSG729FormatBodyImpl::Create(TMSG729FormatBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSG729FormatBodyImpl* self = new TMSG729FormatBodyImpl;
+    TMSG729FormatBodyImpl* self = new TMSG729FormatBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsg729impl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsg729impl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
 gint TMSG729FormatImpl::Create(TMSFormat*& tmsformat)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSG729FormatImpl *self = new TMSG729FormatImpl;
+    TMSG729FormatImpl *self = new TMSG729FormatImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsgaineffectbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsgaineffectbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -40,7 +40,7 @@
 gint TMSGainEffectBodyImpl::Create(TMSGainEffectBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGainEffectBodyImpl* self = new TMSGainEffectBodyImpl;
+    TMSGainEffectBodyImpl* self = new TMSGainEffectBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsgaineffectimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsgaineffectimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSGainEffectImpl::Create(TMSEffect*& tmseffect)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGainEffectImpl *self = new TMSGainEffectImpl;
+    TMSGainEffectImpl *self = new TMSGainEffectImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsglobalgaineffectbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsglobalgaineffectbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -46,7 +46,7 @@
 gint TMSGlobalGainEffectBodyImpl::Create(TMSGlobalGainEffectBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGlobalGainEffectBodyImpl* self = new TMSGlobalGainEffectBodyImpl;
+    TMSGlobalGainEffectBodyImpl* self = new TMSGlobalGainEffectBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +64,7 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
     if (!iProxy)
         {
         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
--- a/mmserv/tms/tmsimpl/src/tmsglobalgaineffectimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsglobalgaineffectimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSGlobalGainEffectImpl::Create(TMSEffect*& tmseffect)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGlobalGainEffectImpl *self = new TMSGlobalGainEffectImpl;
+    TMSGlobalGainEffectImpl *self = new TMSGlobalGainEffectImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsglobalroutingbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -64,7 +64,7 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
     if (!iProxy)
         {
         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
--- a/mmserv/tms/tmsimpl/src/tmsglobalvoleffectbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsglobalvoleffectbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -46,7 +46,7 @@
 gint TMSGlobalVolEffectBodyImpl::Create(TMSGlobalVolEffectBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGlobalVolEffectBodyImpl* self = new TMSGlobalVolEffectBodyImpl;
+    TMSGlobalVolEffectBodyImpl* self = new TMSGlobalVolEffectBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +64,7 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
     if (!iProxy)
         {
         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
--- a/mmserv/tms/tmsimpl/src/tmsglobalvoleffectimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsglobalvoleffectimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSGlobalVolEffectImpl::Create(TMSEffect*& tmseffect)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSGlobalVolEffectImpl *self = new TMSGlobalVolEffectImpl;
+    TMSGlobalVolEffectImpl *self = new TMSGlobalVolEffectImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsilbcbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsilbcbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSILBCFormatBodyImpl::Create(TMSILBCFormatBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSILBCFormatBodyImpl* self = new TMSILBCFormatBodyImpl;
+    TMSILBCFormatBodyImpl* self = new TMSILBCFormatBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsilbcimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsilbcimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
 gint TMSILBCFormatImpl::Create(TMSFormat*& tmsformat)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSILBCFormatImpl *self = new TMSILBCFormatImpl;
+    TMSILBCFormatImpl *self = new TMSILBCFormatImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsinbandtonebodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsinbandtonebodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -64,7 +64,7 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
 
     if (!iProxy)
         {
@@ -96,7 +96,7 @@
                     iObserver, iParent, iClientId);
             if (ret == TMS_RESULT_SUCCESS)
                 {
-                //ret = iProxy->StartInbandToneNotifier();
+                //ret = iProxy->StartInbandToneNotifier(); //TODO: remove?
                 }
             }
         else
@@ -119,7 +119,7 @@
         ret = iProxy->RemoveMsgQueueNotifier(EMsgQueueInbandToneType,
                 iObserver);
         iObserver = NULL;
-        //iProxy->CancelInbandToneNotifier();
+        //iProxy->CancelInbandToneNotifier(); //TODO: remove?
         }
     else
         {
--- a/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -45,7 +45,7 @@
 gint TMSIPCallBodyImpl::Create(TMSCallBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSIPCallBodyImpl* self = new TMSIPCallBodyImpl;
+    TMSIPCallBodyImpl* self = new TMSIPCallBodyImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
@@ -194,7 +194,7 @@
     if (itStrm)
         {
         iStreamsVector.erase(itStrm); // Remove from array
-        // Don't delete itStrm as the iterator advanced to the next 
+        // Don't delete itStrm as the iterator advanced to the next
         // item on the list
         ret = TMSStreamImpl::Delete(strm);
         }
--- a/mmserv/tms/tmsimpl/src/tmsmembuffer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmembuffer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
     TRACE_PRN_FN_ENT;
-    TMSMemBuffer* self = new TMSMemBuffer;
+    TMSMemBuffer* self = new TMSMemBuffer();
     if (self)
         {
         ret = self->PostConstruct(size);
@@ -57,7 +57,7 @@
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
     TRACE_PRN_FN_ENT;
-    TMSMemBuffer* self = new TMSMemBuffer;
+    TMSMemBuffer* self = new TMSMemBuffer();
     if (self)
         {
         self->iDataPtr = dataptr;
@@ -92,15 +92,13 @@
     return ret;
     }
 
-// Implementation of TMSBuffer interface begins
 /**
- Gets the timestamp on the Buffer so that the framework can
- determine the time at which this buffer has to be rendered
- by the output device sink.
-
- @param ts
- timestamp in microseconds
-
+ * Gets the timestamp on the Buffer so that the framework can
+ * determine the time at which this buffer has to be rendered
+ * by the output device sink.
+ *
+ * @param ts timestamp in microseconds
+ *
  */
 gint TMSMemBuffer::GetTimeStamp(guint64& ts)
     {
@@ -110,13 +108,12 @@
     }
 
 /**
- Sets the timestamp on the Buffer so that the framework can
- determine the time at which this buffer has to be rendered
- by the output device sink.
-
- @param ts
- timestamp in milliseconds
-
+ * Sets the timestamp on the Buffer so that the framework can
+ * determine the time at which this buffer has to be rendered
+ * by the output device sink.
+ *
+ * @param ts timestamp in milliseconds
+ *
  */
 gint TMSMemBuffer::SetTimeStamp(const guint64 ts)
     {
@@ -126,11 +123,10 @@
     }
 
 /**
- Gets the size of data in the buffer specified by the client.
-
- @param size
- size of data in bytes
-
+ * Gets the size of data in the buffer specified by the client.
+ *
+ * @param size size of data in bytes
+ *
  */
 gint TMSMemBuffer::GetDataSize(guint& size)
     {
@@ -140,27 +136,24 @@
     }
 
 /**
- Sets the size of data in the buffer after the client
- fill it.
-
- @param size
- size of data in bytes
-
+ * Sets the size of data in the buffer after the client fill it.
+ *
+ * @param size size of data in bytes
+ *
  */
 gint TMSMemBuffer::SetDataSize(const guint size)
     {
     gint ret(TMS_RESULT_SUCCESS);
-    iBufferSize = size;
+    iBufferSize = size; //TODO: should realloc when new size > old size (?)
     return ret;
     }
 
 /**
- Gets the pointer to the memory location associated with this
- buffer where the data is stored.
-
- @param bufptr
- ptr to the data stored in the buffer.
-
+ * Gets the pointer to the memory location associated with this
+ * buffer where the data is stored.
+ *
+ * @param bufptr ptr to the data stored in the buffer.
+ *
  */
 gint TMSMemBuffer::GetDataPtr(guint8*& bufptr)
     {
--- a/mmserv/tms/tmsimpl/src/tmsmicsourcebodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmicsourcebodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -33,7 +33,7 @@
 gint TMSMicSourceBodyImpl::Create(TMSMicSourceBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSMicSourceBodyImpl* self = new TMSMicSourceBodyImpl;
+    TMSMicSourceBodyImpl* self = new TMSMicSourceBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsmicsourceimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmicsourceimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSMicSourceImpl::Create(TMSSource*& tmssource)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSMicSourceImpl *self = new TMSMicSourceImpl;
+    TMSMicSourceImpl *self = new TMSMicSourceImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
@@ -72,7 +72,6 @@
         gpointer /*queuehandler*/)
     {
     gint ret = TMS_RESULT_SUCCESS;
-    //static_cast<TMSMicSourceBodyImpl*>(this->iBody)->SetProxy(aProxy, queuehandler);
     return ret;
     }
 
--- a/mmserv/tms/tmsimpl/src/tmsmodemsinkbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmodemsinkbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -33,7 +33,7 @@
 gint TMSModemSinkBodyImpl::Create(TMSModemSinkBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSModemSinkBodyImpl* self = new TMSModemSinkBodyImpl;
+    TMSModemSinkBodyImpl* self = new TMSModemSinkBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +64,6 @@
         gpointer /*queuehandler*/)
     {
     iProxy = aProxy;
-    //static_cast<TMSQueueHandler*>(queuehandler)->AddObserver(*this, TMS_SINK_MODEM);
     }
 
 // End of file
--- a/mmserv/tms/tmsimpl/src/tmsmodemsinkimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmodemsinkimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -50,7 +50,7 @@
 gint TMSModemSinkImpl::Create(TMSSink*& tmssink)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSModemSinkImpl *self = new TMSModemSinkImpl;
+    TMSModemSinkImpl *self = new TMSModemSinkImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
@@ -71,7 +71,6 @@
         gpointer /*queuehandler*/)
     {
     gint ret = TMS_RESULT_SUCCESS;
-    //static_cast<TMSModemSinkBodyImpl*>(this->iBody)->SetProxy(aProxy, queuehandler);
     return ret;
     }
 
--- a/mmserv/tms/tmsimpl/src/tmsmodemsourcebodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmodemsourcebodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -33,7 +33,7 @@
 gint TMSModemSourceBodyImpl::Create(TMSModemSourceBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSModemSourceBodyImpl* self = new TMSModemSourceBodyImpl;
+    TMSModemSourceBodyImpl* self = new TMSModemSourceBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +64,6 @@
         gpointer /*queuehandler*/)
     {
     iProxy = aProxy;
-    //static_cast<TMSQueueHandler*>(queuehandler)->AddObserver(*this, TMS_SOURCE_MODEM);
     }
 
 // End of file
--- a/mmserv/tms/tmsimpl/src/tmsmodemsourceimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsmodemsourceimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
     TRACE_PRN_FN_ENT;
-    TMSModemSourceImpl *self = new TMSModemSourceImpl;
+    TMSModemSourceImpl *self = new TMSModemSourceImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -71,7 +71,6 @@
         gpointer /*queuehandler*/)
     {
     gint ret = TMS_RESULT_SUCCESS;
-    //static_cast<TMSModemSourceBodyImpl*>(this->iBody)->SetProxy(aProxy, queuehandler);
     return ret;
     }
 
--- a/mmserv/tms/tmsimpl/src/tmspcmbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmspcmbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -38,7 +38,7 @@
 gint TMSPCMFormatBodyImpl::Create(TMSPCMFormatBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSPCMFormatBodyImpl* self = new TMSPCMFormatBodyImpl;
+    TMSPCMFormatBodyImpl* self = new TMSPCMFormatBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmspcmimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmspcmimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -53,7 +53,7 @@
 gint TMSPCMFormatImpl::Create(TMSFormat*& tmsformat)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSPCMFormatImpl *self = new TMSPCMFormatImpl;
+    TMSPCMFormatImpl *self = new TMSPCMFormatImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -35,18 +35,16 @@
     if (iProxy)
         {
         iProxy->Close();
-        delete iProxy;
-        iProxy = NULL;
         }
+    delete iProxy;
     iObserver = NULL;
     iParent = NULL;
-    iUserData = NULL;
     }
 
 gint TMSRingToneBodyImpl::Create(TMSRingToneBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSRingToneBodyImpl* self = new TMSRingToneBodyImpl;
+    TMSRingToneBodyImpl* self = new TMSRingToneBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +62,7 @@
         RWindow& /*window*/, gint /*scrid*/)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSRingToneBodyImpl* self = new TMSRingToneBodyImpl;
+    TMSRingToneBodyImpl* self = new TMSRingToneBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -82,7 +80,7 @@
     {
     gint ret(TMS_RESULT_SUCCESS);
     iClientId = 1;
-    iProxy = new TMSProxy;
+    iProxy = new TMSProxy();
 
     if (!iProxy)
         {
--- a/mmserv/tms/tmsimpl/src/tmsringtoneimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsringtoneimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -67,7 +67,7 @@
     {
     TRACE_PRN_FN_ENT;
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSRingToneImpl *self = new TMSRingToneImpl;
+    TMSRingToneImpl *self = new TMSRingToneImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
@@ -93,7 +93,7 @@
     {
     TRACE_PRN_FN_ENT;
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSRingToneImpl *self = new TMSRingToneImpl;
+    TMSRingToneImpl *self = new TMSRingToneImpl();
     if (self)
         {
         ret = self->PostConstruct(window, scrid);
--- a/mmserv/tms/tmsimpl/src/tmsspeakersinkbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsspeakersinkbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -33,7 +33,7 @@
 gint TMSSpeakerSinkBodyImpl::Create(TMSSpeakerSinkBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSSpeakerSinkBodyImpl* self = new TMSSpeakerSinkBodyImpl;
+    TMSSpeakerSinkBodyImpl* self = new TMSSpeakerSinkBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -64,7 +64,6 @@
         gpointer /*queuehandler*/)
     {
     iProxy = aProxy;
-    //static_cast<TMSQueueHandler*>(queuehandler)->AddObserver(*this, TMS_SINK_SPEAKER);
     }
 
 // End of file
--- a/mmserv/tms/tmsimpl/src/tmsspeakersinkimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsspeakersinkimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -50,7 +50,7 @@
 gint TMSSpeakerSinkImpl::Create(TMSSink*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSSpeakerSinkImpl* self = new TMSSpeakerSinkImpl;
+    TMSSpeakerSinkImpl* self = new TMSSpeakerSinkImpl();
     if (self)
         {
         ret = self->PostConstruct();
@@ -68,7 +68,6 @@
         gpointer /*queuehandler*/)
     {
     gint ret = TMS_RESULT_SUCCESS;
-    //static_cast<TMSSpeakerSinkBodyImpl*>(this->iBody)->SetProxy(aProxy, queuehandler);
     return ret;
     }
 
--- a/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -77,7 +77,7 @@
         TMSCallProxy* proxy, TMSStream& parent, TMSStreamBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSStreamBodyImpl* self = new TMSStreamBodyImpl;
+    TMSStreamBodyImpl* self = new TMSStreamBodyImpl();
     if (self)
         {
         ret = self->PostConstruct(callType, stype, proxy, parent);
--- a/mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
         TMSCallProxy* proxy, TMSStream*& strm)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSStreamImpl *self = new TMSStreamImpl;
+    TMSStreamImpl *self = new TMSStreamImpl();
 
     if (self)
         {
--- a/mmserv/tms/tmsimpl/src/tmsvolumeeffectbodyimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsvolumeeffectbodyimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -40,7 +40,7 @@
 gint TMSVolumeEffectBodyImpl::Create(TMSVolumeEffectBody*& bodyimpl)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSVolumeEffectBodyImpl* self = new TMSVolumeEffectBodyImpl;
+    TMSVolumeEffectBodyImpl* self = new TMSVolumeEffectBodyImpl();
     if (self)
         {
         ret = self->PostConstruct();
--- a/mmserv/tms/tmsimpl/src/tmsvolumeeffectimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsvolumeeffectimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -51,7 +51,7 @@
 gint TMSVolumeEffectImpl::Create(TMSEffect*& tmseffect)
     {
     gint ret(TMS_RESULT_INSUFFICIENT_MEMORY);
-    TMSVolumeEffectImpl *self = new TMSVolumeEffectImpl;
+    TMSVolumeEffectImpl *self = new TMSVolumeEffectImpl();
 
     TRACE_PRN_FN_ENT;
     if (self)
--- a/mmserv/tms/tmsproxy/src/tmsproxy.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsproxy/src/tmsproxy.cpp	Thu May 27 13:20:50 2010 +0300
@@ -36,43 +36,45 @@
 
 // -----------------------------------------------------------------------------
 // StartServer
-// Static function to start the server process thread.
-// Start the server process/thread which lives in an EPOCEXE object.
-// Returns: gint: TMS_RESULT_SUCCESS (0) if no error
+//
+// Function that will launch TMS server executable in it its own process.
+// Start the server process/thread, which lives in an EPOCEXE object.
+// Returns: gint: TMS_RESULT_SUCCESS (0) if no error.
 // -----------------------------------------------------------------------------
 //
-static gint StartServer()
+gint TMSProxy::StartServer()
     {
     const TUidType serverUid(KNullUid, KNullUid, KTMSServerUid3);
 
     // Only one instance of the server is allowed. Attempt of launching
     // second instance of the server will fail with KErrAlreadyExists.
     RProcess server;
-    gint r = server.Create(KTMSServerName, KNullDesC, serverUid);
+    gint ret = server.Create(KTMSServerFile, KNullDesC, serverUid);
+
+    if (ret == TMS_RESULT_SUCCESS)
+        {
+        TRequestStatus stat;
+        server.Rendezvous(stat);
 
-    if (r != TMS_RESULT_SUCCESS)
-        {
-        return r;
+        if (stat != KRequestPending)
+            {
+            server.Kill(0); // abort startup
+            }
+        else
+            {
+            server.Resume(); // logon OK - start the server
+            }
+
+        User::WaitForRequest(stat); // wait for start or death
+
+        // We can't use the 'exit reason' if the server panicked, as '0' is a
+        // valid panic 'reason', which cannot be distinguished from
+        // TMS_RESULT_SUCCESS.
+        ret = (server.ExitType() == EExitPanic) ? KErrGeneral : stat.Int();
+        server.Close();
         }
 
-    TRequestStatus stat;
-    server.Rendezvous(stat);
-
-    if (stat != KRequestPending)
-        {
-        server.Kill(0); // abort startup
-        }
-    else
-        {
-        server.Resume(); // logon OK - start the server
-        }
-
-    User::WaitForRequest(stat); // wait for start or death
-
-    // Panic reason cannot be '0' as it would conflict with TMS_RESULT_SUCCESS
-    r = (server.ExitType() == EExitPanic) ? KErrGeneral : stat.Int();
-    server.Close();
-    return r;
+    return ret;
     }
 
 // -----------------------------------------------------------------------------
@@ -439,7 +441,7 @@
                 gint unilen = str->len / KUTF8Multiply;
 
                 TRAP(status, buf = HBufC::NewL(unilen));
-                if (status == KErrNone)
+                if (buf && status == KErrNone)
                     {
                     TPtr p = buf->Des();
                     p.Copy((TUint16*) str->str, unilen);
@@ -475,7 +477,7 @@
                 HBufC8* buf(NULL);
                 gint len = str->len;
                 TRAP(status, buf = HBufC8::NewL(len));
-                if (status == KErrNone)
+                if (buf && status == KErrNone)
                     {
                     TPtr8 p = buf->Des();
                     p.Copy((TUint8*) str->str, len);
@@ -538,8 +540,9 @@
 EXPORT_C gint TMSProxy::StartDTMF(TMSStreamType streamtype, GString* tone)
     {
     TRACE_PRN_FN_ENT;
+    __ASSERT_ALWAYS(tone, PANIC(TMS_RESULT_NULL_ARGUMENT));
+
     gint status(TMS_RESULT_SUCCESS);
-
     HBufC* buf(NULL);
     TRAP(status, buf = HBufC::NewL(tone->len));
     if (status == KErrNone)
@@ -555,10 +558,8 @@
         args.Set(1, &p1);
         status = RSessionBase::SendReceive(ETMSStartDTMF, args);
         }
-
     delete buf;
     buf = NULL;
-
     TRACE_PRN_FN_EXT;
     return TMSRESULT(status);
     }
@@ -965,7 +966,7 @@
     {
     TMSSignalEvent event = {}; //all elements initialized to zeros
     event.type = aEventType;
-    event.reason = aError;
+    event.reason = TMSRESULT(aError);
     event.user_data = NULL; //use only to return data passed in by the user
 
     switch (aEventType)
--- a/mmserv/tms/tmsproxy/src/tmsqueuehandler.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsproxy/src/tmsqueuehandler.cpp	Thu May 27 13:20:50 2010 +0300
@@ -200,8 +200,8 @@
                 iObserver->QueueEvent(TMS_EVENT_RINGTONE_DEINIT_COMPLETE,
                         msgBuf.iStatus, NULL);
                 break;
-            case ECmdDTMFOpenDnlinkComplete:
-            case ECmdDTMFOpenUplinkComplete:
+            case ECmdDTMFToneDnlPlayStarted:
+            case ECmdDTMFToneUplPlayStarted:
                 iObserver->QueueEvent(TMS_EVENT_DTMF_TONE_STARTED,
                         msgBuf.iStatus, NULL);
                 break;
--- a/mmserv/tms/tmsserver/group/tmsserver.mmp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/group/tmsserver.mmp	Thu May 27 13:20:50 2010 +0300
@@ -23,7 +23,7 @@
 UID             0 0x10207C7C
 EPOCSTACKSIZE   0x5000
 EPOCHEAPSIZE    0x500000 0x1000000
-CAPABILITY      ProtServ MultiMediaDD ReadDeviceData WriteDeviceData ReadUserData WriteUserData UserEnvironment
+CAPABILITY      ProtServ MultiMediaDD ReadDeviceData WriteDeviceData ReadUserData WriteUserData UserEnvironment NetworkServices
 VENDORID        VID_DEFAULT
 
 EPOCPROCESSPRIORITY high
--- a/mmserv/tms/tmsserver/inc/tmsaudioinbandtoneplayer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsaudioinbandtoneplayer.h	Thu May 27 13:20:50 2010 +0300
@@ -15,16 +15,21 @@
  *
  */
 
-#ifndef CPEAUDIOINBANDTONEPLAYER_H
-#define CPEAUDIOINBANDTONEPLAYER_H
+#ifndef TMSAUDIOINBANDTONEPLAYER_H
+#define TMSAUDIOINBANDTONEPLAYER_H
 
 // INCLUDES
 #include <mdaaudiotoneplayer.h>
+#include <barsc.h>
+#include <barsread.h>
 #include <ccpdefs.h>
 #include <tms.h>
 
 namespace TMS {
 
+// CONSTANTS
+const gint KPhoneInbandToneZero = 0;
+
 // FORWARD DECLARATIONS
 class TMSAudioToneUtility;
 
@@ -53,7 +58,7 @@
      * Plays given tone. Originates from CCP plugin.
      * @param aTone inband tone needed to play
      */
-    void PlayInbandTone(TMSInbandToneType aTone);
+    void PlayInbandTone(TMSInbandToneType tone);
 
     /**
      * Cancels playing.
@@ -64,7 +69,7 @@
      * Sets volume.
      * @param    aVolume     Volume in 0...10 scale.
      */
-    void SetVolume(TInt aVolume);
+    void SetVolume(gint volume);
 
 private:
 
@@ -79,12 +84,30 @@
     void ConstructL();
 
     /**
+     * Create inband tone sequences from resources.
+     */
+    void CreateToneSequencesL();
+
+    /**
      * Playes current tone.
      * @param None.
      * @return None.
      */
     void PlayCurrentTone();
 
+    /**
+     * Configure tone player utility for current sequence playback.
+     */
+    void SetToneAttributes(const guint pref,
+            const guint priority = KAudioPriorityNetMsg,
+            const gint repeatTimes = KMdaAudioToneRepeatForever,
+            const gint trailSilence = KPhoneInbandToneZero);
+
+    /**
+     * Allocate tone sequence from resource.
+     */
+    void AllocSeqFromResourceL(const gint resource);
+
     //From MMdaAudioToneObserver
 
     /**
@@ -107,7 +130,7 @@
      * @param   aVolume     Volume level in 0...10 scale.
      * @return  Volume level in media server scale.
      */
-    TInt CalculateMediaServerVolume(TInt aVolume) const;
+    gint CalculateMediaServerVolume(gint volume) const;
 
     /**
      * Updates tone player's volume to the current audio volume level.
@@ -118,37 +141,23 @@
     // Data
 
     // Currently playing, NULL or tone sequence.
-    TMSAudioToneUtility* iCurrent;
-    //Member variable for inband tone
+    TMSAudioToneUtility* iPlayer;
+    // Member variable for inband tone
     TMSInbandToneType iToneName;
-    //NetworkBusy sequence
-    HBufC8* iResourceBusySeq;
-    //NetworkBusy sequence
-    HBufC8* iResourceReorderSeq;
-    //NetworkBusy sequence
-    HBufC8* iResourceCongestionSeq;
-    //NetworkBusy sequence
-    HBufC8* iResourceSpecialSeq;
-    //NetworkBusy sequence
-    HBufC8* iResourceRadioPathSeq;
-    //NetworkBusy sequence
-    HBufC8* iResourceRingGoingSeq;
-    //CallWaiting sequence
-    HBufC8* iResourceCallWaitingSeq;
-    //Ringing type
-    //       TProfileRingingType iRingingType;
-    //Data call tone sequence
-    HBufC8* iPlayDataSequence;
-    //Data call silent sequence
-    HBufC8* iPlayNoSoundSequence;
-    //Data call beep sequence
-    HBufC8* iPlayBeepSequence;
-    //Handle to a file server session
+    // Ringing type
+    // TProfileRingingType iRingingType;
+    // Handle to a file server session
     RFs iFsSession;
+	// For reading sequence tones from resource file
+    TFileName iFileName;
+    RResourceFile iResourceFile;
+    TResourceReader iReader;
+    // Array of tone pointers
+    RPointerArray<HBufC8> iTones;
+    };
 
-    };
 } // namespace TMS
 
-#endif      // CPEAUDIOINBANDTONEPLAYER_H
+#endif // TMSAUDIOINBANDTONEPLAYER_H
 
 // End of File
--- a/mmserv/tms/tmsserver/inc/tmsaudiotoneutility.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsaudiotoneutility.h	Thu May 27 13:20:50 2010 +0300
@@ -29,6 +29,9 @@
 class TMSAudioToneUtility
     {
 public:
+
+    virtual ~TMSAudioToneUtility() {}
+
     /**
      * See CMdaAudioToneUtility::PrepareToPlayDesSequence.
      */
@@ -72,7 +75,7 @@
             const TTimeIntervalMicroSeconds& aRampDuration) = 0;
 
     /**
-     * See CMdaAudioToneUtility::SetVolumeRamp.
+     * See CMdaAudioToneUtility::Play.
      */
     virtual void Play() = 0;
 
--- a/mmserv/tms/tmsserver/inc/tmsaudiotoneutilityimpl.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsaudiotoneutilityimpl.h	Thu May 27 13:20:50 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <e32base.h>
 #include <mdaaudiotoneplayer.h>
+#include <glib.h>
 #include "tmsaudiotoneutility.h"
 
 namespace TMS {
@@ -35,7 +36,7 @@
 public:
 
     static TMSAudioToneUtilityImpl* NewL(
-            MMdaAudioToneObserver& aToneObserver);
+            MMdaAudioToneObserver& toneObserver);
 
     /**
      * Destructor.
@@ -48,7 +49,7 @@
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    void PrepareToPlayDesSequence(const TDesC8& aSequence);
+    void PrepareToPlayDesSequence(const TDesC8& sequence);
 
     /**
      * From TMSAudioToneUtilityImpl
@@ -66,32 +67,32 @@
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    TInt MaxVolume();
+    gint MaxVolume();
 
     /**
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    void SetVolume(TInt aVolume);
+    void SetVolume(gint volume);
 
     /**
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    void SetRepeats(TInt aRepeatNumberOfTimes,
-            const TTimeIntervalMicroSeconds& aTrailingSilence);
+    void SetRepeats(gint repeatNumberOfTimes,
+            const TTimeIntervalMicroSeconds& trailingSilence);
 
     /**
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    void SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
+    void SetPriority(gint priority, TMdaPriorityPreference pref);
 
     /**
      * From TMSAudioToneUtilityImpl
      * @see CMdaAudioToneUtility
      */
-    void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
+    void SetVolumeRamp(const TTimeIntervalMicroSeconds& rampDuration);
 
     /**
      * From TMSAudioToneUtilityImpl
@@ -109,7 +110,7 @@
 
     TMSAudioToneUtilityImpl();
 
-    void ConstructL(MMdaAudioToneObserver& aToneObserver);
+    void ConstructL(MMdaAudioToneObserver& toneObserver);
 
 private:
     // data
--- a/mmserv/tms/tmsserver/inc/tmsdtmfeventhandler.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsdtmfeventhandler.h	Thu May 27 13:20:50 2010 +0300
@@ -53,6 +53,13 @@
      */
     void RunL();
 
+    /**
+     * From CActive
+     * Implementation of CActive::RunError.
+     * Called when RunL leaves.
+     */
+    TInt RunError(TInt /*aError*/) {}
+
 private:
 
     /**
--- a/mmserv/tms/tmsserver/inc/tmsrtaudiohdlr.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsrtaudiohdlr.h	Thu May 27 13:20:50 2010 +0300
@@ -214,7 +214,7 @@
     void DoPlay();
 
     /**
-     * Ser tinging type properties
+     * Set ringing type properties
      */
     void SetRingingTypeProperties();
 
--- a/mmserv/tms/tmsserver/inc/tmsserver.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsserver.h	Thu May 27 13:20:50 2010 +0300
@@ -46,7 +46,7 @@
                   private TMSRtPlayerObsrv
     {
 public:
-    static TMSServer* NewL();
+    static void RunServerL();
     ~TMSServer();
 
     void AddSession();
@@ -107,6 +107,7 @@
     void RtPlayerEvent(TInt aEventType, TInt aError);
 
 private:
+    static TMSServer* NewLC();
     TMSServer();
     void ConstructL();
     CSession2* NewSessionL(const TVersion& aVersion,
--- a/mmserv/tms/tmsserver/inc/tmsserversession.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmsserversession.h	Thu May 27 13:20:50 2010 +0300
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef __TMSSERVERSESSION_H
-#define __TMSSERVERSESSION_H
+#ifndef TMSSERVERSESSION_H
+#define TMSSERVERSESSION_H
 
 // INCLUDES
 #include <sounddevice.h>
@@ -87,6 +87,6 @@
 
 } //namespace TMS
 
-#endif //__TMSSERVERSESSION_H
+#endif //TMSSERVERSESSION_H
 
 // End of file
--- a/mmserv/tms/tmsserver/inc/tmstimer.h	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/inc/tmstimer.h	Thu May 27 13:20:50 2010 +0300
@@ -95,6 +95,11 @@
     virtual void RunL();
 
     /**
+     * From CTimer::RunL()
+     */
+    virtual TInt RunError(TInt aError);
+
+    /**
      * From CTimer::DoCancel()
      */
     virtual void DoCancel();
--- a/mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -19,8 +19,6 @@
 
 #include <tms.h>
 #include <AudioPreference.h>
-#include <barsc.h>
-#include <barsread.h>
 #include <data_caging_path_literals.hrh>
 #include <defaultbeep.rsg>
 #include "tmsutility.h"
@@ -30,13 +28,12 @@
 using namespace TMS;
 
 // CONSTANTS
-const TInt KPhoneInbandVolumeMax = 10;
-const TInt KPhoneInbandVolumeMin = 0;
-const TInt KPhoneInbandToneZero = 0;
+const gint KPhoneInbandVolumeMax = 10;
+const gint KPhoneInbandVolumeMin = 0;
 
 // Resourcefile destination.
-_LIT( KSystemDefaultbeepRscDrive, "Z:" );
-_LIT( KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC" );
+_LIT(KSystemDefaultbeepRscDrive, "Z:");
+_LIT(KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC");
 
 // -----------------------------------------------------------------------------
 // TMSAudioInbandTonePlayer::NewL
@@ -45,10 +42,9 @@
 //
 TMSAudioInbandTonePlayer* TMSAudioInbandTonePlayer::NewL()
     {
-    TMSAudioInbandTonePlayer* self =
-            new (ELeave) TMSAudioInbandTonePlayer();
+    TMSAudioInbandTonePlayer* self = new (ELeave) TMSAudioInbandTonePlayer();
     CleanupStack::PushL(self);
-    self->ConstructL( /*aAudioFactory*/);
+    self->ConstructL();
     CleanupStack::Pop(self);
     return self;
     }
@@ -57,20 +53,15 @@
 TMSAudioInbandTonePlayer::~TMSAudioInbandTonePlayer()
     {
     TRACE_PRN_FN_ENT;
+    iResourceFile.Close();
     iFsSession.Close();
-    iCurrent->CancelPlay();
-    delete iCurrent;
-
-    delete iPlayBeepSequence;
-    delete iPlayNoSoundSequence;
-    delete iPlayDataSequence;
-    delete iResourceCallWaitingSeq;
-    delete iResourceRingGoingSeq;
-    delete iResourceRadioPathSeq;
-    delete iResourceSpecialSeq;
-    delete iResourceCongestionSeq;
-    delete iResourceReorderSeq;
-    delete iResourceBusySeq;
+    iTones.ResetAndDestroy();
+    iTones.Close();
+    if (iPlayer)
+        {
+        iPlayer->CancelPlay();
+        }
+    delete iPlayer;
     TRACE_PRN_FN_EXT;
     }
 
@@ -80,7 +71,8 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer()
+TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer() :
+    iPlayer(NULL)
     {
     }
 
@@ -91,181 +83,64 @@
 //
 void TMSAudioInbandTonePlayer::ConstructL()
     {
-    // iCurrent = aFactory.CreateAudioToneUtilityL( *this );
     TRACE_PRN_FN_ENT;
-    iCurrent = TMSAudioToneUtilityImpl::NewL(*this);
-
-    //Get the inband tone sequences from resource and and store to member
-    //variables
-    RResourceFile resourceFile;
-
-    TFileName fileName(KSystemDefaultbeepRscDrive);
-    fileName.Append(KDC_RESOURCE_FILES_DIR);
-    fileName.Append(KSystemDefaultbeepRscFile);
-
-    iFsSession.Connect();
-    resourceFile.OpenL(iFsSession, fileName);
-    CleanupClosePushL(resourceFile);
-
-    HBufC8* resourceBusy = resourceFile.AllocReadL(R_NET_BUSY);
-    HBufC8* resourceReorder = resourceFile.AllocReadL(R_NET_REORDER);
-    HBufC8* resourceCongestion = resourceFile.AllocReadL(R_NET_CONGESTION);
-    HBufC8* resourceSpecial = resourceFile.AllocReadL(
-            R_NET_SPECIAL_INFORMATION);
-    HBufC8* resourceRadioPath = resourceFile.AllocReadL(
-            R_NET_RADIO_NOT_AVAILABLE);
-    HBufC8* resourceRingGoing = resourceFile.AllocReadL(R_NET_RING_GOING);
-    HBufC8* resourceCallWaiting = resourceFile.AllocReadL(R_NET_CALL_WAITING);
-    HBufC8* dataCallTone = resourceFile.AllocReadL(R_DATA_CALL_TONE);
-    HBufC8* noSoundSequence = resourceFile.AllocReadL(R_NO_SOUND_SEQUENCE);
-    HBufC8* beepSequence = resourceFile.AllocReadL(R_BEEP_SEQUENCE);
-
-    CleanupStack::PopAndDestroy(&resourceFile);
-
-    TResourceReader reader;
-    TInt i(0);
-    TInt length(0);
-
-    //SubscriberBusy
-    reader.SetBuffer(resourceBusy);
-    length = reader.ReadInt16();
-    iResourceBusySeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendBusy(iResourceBusySeq->Des());
+    iPlayer = TMSAudioToneUtilityImpl::NewL(*this);
+    iTones.Reset();
+    CreateToneSequencesL();
+    TRACE_PRN_FN_EXT;
+    }
 
-    for (i = 0; i < length; i++)
-        {
-        appendBusy.Append(reader.ReadUint16());
-        }
-
-    //Reorder
-    reader.SetBuffer(resourceReorder);
-    length = reader.ReadInt16();
-    iResourceReorderSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendReorder(iResourceReorderSeq->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendReorder.Append(reader.ReadUint16());
-        }
+// -----------------------------------------------------------------------------
+// TMSAudioInbandTonePlayer::CreateSequencesL
+// Create inband tone sequences from resources.
+// -----------------------------------------------------------------------------
+//
+void TMSAudioInbandTonePlayer::CreateToneSequencesL()
+    {
+    TRACE_PRN_FN_ENT;
 
-    //Congestion
-    reader.SetBuffer(resourceCongestion);
-    length = reader.ReadInt16();
-    iResourceCongestionSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendCongestion(iResourceCongestionSeq->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendCongestion.Append(reader.ReadUint16());
-        }
-
-    //Special Information
-    reader.SetBuffer(resourceSpecial);
-    length = reader.ReadInt16();
-    iResourceSpecialSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendSpecial(iResourceSpecialSeq->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendSpecial.Append(reader.ReadUint16());
-        }
+    iFileName = KSystemDefaultbeepRscDrive;
+    iFileName.Append(KDC_RESOURCE_FILES_DIR);
+    iFileName.Append(KSystemDefaultbeepRscFile);
+    iFsSession.Connect();
+    iResourceFile.OpenL(iFsSession, iFileName);
 
-    //RadioPathNotAvailable
-    reader.SetBuffer(resourceRadioPath);
-    length = reader.ReadInt16();
-    iResourceRadioPathSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendRadio(iResourceRadioPathSeq->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendRadio.Append(reader.ReadUint16());
-        }
+    // DO NOT change order of sequence allocation!
+    AllocSeqFromResourceL(R_NET_BUSY);                 //iTones[0]
+    AllocSeqFromResourceL(R_NET_RADIO_NOT_AVAILABLE);  //iTones[1]
+    AllocSeqFromResourceL(R_NET_CONGESTION);           //iTones[2]
+    AllocSeqFromResourceL(R_NET_SPECIAL_INFORMATION);  //iTones[3]
+    AllocSeqFromResourceL(R_NET_REORDER);              //iTones[4]
+    AllocSeqFromResourceL(R_NET_RING_GOING);           //iTones[5]
+    AllocSeqFromResourceL(R_NET_CALL_WAITING);         //iTones[6]
+    AllocSeqFromResourceL(R_DATA_CALL_TONE);           //iTones[7]
+    AllocSeqFromResourceL(R_NO_SOUND_SEQUENCE);        //iTones[8]
+    AllocSeqFromResourceL(R_BEEP_SEQUENCE);            //iTones[9]
 
-    //RemoteAlertingTone
-    reader.SetBuffer(resourceRingGoing);
-    length = reader.ReadInt16();
-    iResourceRingGoingSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendRingGoing(iResourceRingGoingSeq->Des());
+    iResourceFile.Close();
+    iFsSession.Close();
 
-    for (i = 0; i < length; i++)
-        {
-        appendRingGoing.Append(reader.ReadUint16());
-        }
-    //CallWaitingTone
-    reader.SetBuffer(resourceCallWaiting);
-    length = reader.ReadInt16();
-    iResourceCallWaitingSeq = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendCallWaiting(iResourceCallWaitingSeq->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendCallWaiting.Append(reader.ReadUint16());
-        }
+    TRACE_PRN_FN_EXT;
+    }
 
-    //DataCalTone
-    reader.SetBuffer(dataCallTone);
-    length = reader.ReadInt16();
-    iPlayDataSequence = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendDataCallTone(iPlayDataSequence->Des());
-
-    for (i = 0; i < length; i++)
+// -----------------------------------------------------------------------------
+// TMSAudioInbandTonePlayer::AllocSeqFromResourceL
+//
+// -----------------------------------------------------------------------------
+//
+void TMSAudioInbandTonePlayer::AllocSeqFromResourceL(const gint resource)
+    {
+    HBufC8* res = iResourceFile.AllocReadLC(resource);
+    iReader.SetBuffer(res);
+    gint length = iReader.ReadInt16();
+    HBufC8* buf = HBufC8::NewL(length);
+    TPtr8 ptr(buf->Des());
+    for (gint i = 0; i < length; i++)
         {
-        appendDataCallTone.Append(reader.ReadUint16());
-        }
-
-    //NoSoundSequence
-    reader.SetBuffer(noSoundSequence);
-    length = reader.ReadInt16();
-    iPlayNoSoundSequence = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendNoSoundSequence(iPlayNoSoundSequence->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendNoSoundSequence.Append(reader.ReadUint16());
+        ptr.Append(iReader.ReadUint16());
         }
-
-    //BeepSequence
-    reader.SetBuffer(beepSequence);
-    length = reader.ReadInt16();
-    iPlayBeepSequence = HBufC8::NewL(length);
-    //Tptr modifies member variables (HBufC8) length so it includes the memory
-    //edited by Append()
-    TPtr8 appendBeepSequence(iPlayBeepSequence->Des());
-
-    for (i = 0; i < length; i++)
-        {
-        appendBeepSequence.Append(reader.ReadUint16());
-        }
-
-    delete dataCallTone;
-    delete noSoundSequence;
-    delete beepSequence;
-    delete resourceBusy;
-    delete resourceReorder;
-    delete resourceCongestion;
-    delete resourceSpecial;
-    delete resourceRadioPath;
-    delete resourceRingGoing;
-    delete resourceCallWaiting;
-    TRACE_PRN_FN_EXT;
+    User::LeaveIfError(iTones.Append(buf));
+    CleanupStack::PopAndDestroy(res);
     }
 
 // -----------------------------------------------------------------------------
@@ -273,52 +148,18 @@
 // Searches the given Inband tone from iToneArray and calls PlayCurrentTone.
 // -----------------------------------------------------------------------------
 //
-void TMSAudioInbandTonePlayer::PlayInbandTone(
-/*TCCPTone*/TMSInbandToneType aTone)
+void TMSAudioInbandTonePlayer::PlayInbandTone(TMSInbandToneType tone)
     {
     TRACE_PRN_FN_ENT;
-    //Stop playing if there is something playing
-    Cancel();
-
-    UpdateTonePlayerVolume();
-
-    iToneName = aTone;
 
-    TPtr8 resourceBusySeq = iResourceBusySeq -> Des();
-    TPtr8 resourceRadioPathSeq = iResourceRadioPathSeq -> Des();
-    TPtr8 resourceCongestionSeq = iResourceCongestionSeq -> Des();
-    TPtr8 resourceSpecialSeq = iResourceSpecialSeq -> Des();
-    TPtr8 resourceReorderSeq = iResourceReorderSeq->Des();
-    TPtr8 resourceRingGoingSeq = iResourceRingGoingSeq -> Des();
-    TPtr8 resourceCallWaitingSeq = iResourceCallWaitingSeq -> Des();
+    // First stop any ongoing playback
+    Cancel();
+    UpdateTonePlayerVolume();
+    iToneName = tone;
 
-    switch (aTone)
+    if (iPlayer && (tone >= 0 && tone < iTones.Count()))
         {
-        case TMS_INBAND_USER_BUSY://ECCPToneUserBusy:
-            iCurrent->PrepareToPlayDesSequence(resourceBusySeq);
-            break;
-        case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable:
-            iCurrent->PrepareToPlayDesSequence(resourceRadioPathSeq);
-            break;
-        case TMS_INBAND_CONGESTION://ECCPToneCongestion:
-            iCurrent->PrepareToPlayDesSequence(resourceCongestionSeq);
-            break;
-        case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation:
-            iCurrent->PrepareToPlayDesSequence(resourceSpecialSeq);
-            break;
-        case TMS_INBAND_REORDER://ECCPReorder:
-            iCurrent->PrepareToPlayDesSequence(resourceReorderSeq);
-            break;
-        case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting:
-            iCurrent->PrepareToPlayDesSequence(resourceRingGoingSeq);
-            break;
-        case TMS_INBAND_CALL_WAITING://ECCPCallWaiting:
-            iCurrent->PrepareToPlayDesSequence(resourceCallWaitingSeq);
-            break;
-        case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence:
-            break;
-        default:
-            break;
+        iPlayer->PrepareToPlayDesSequence(iTones[tone]->Des());
         }
     TRACE_PRN_FN_EXT;
     }
@@ -333,17 +174,17 @@
     {
     TRACE_PRN_FN_ENT;
 
-    if (iCurrent)
+    if (iPlayer)
         {
-        if (iCurrent->State() == EMdaAudioToneUtilityNotReady)
+        if (iPlayer->State() == EMdaAudioToneUtilityNotReady)
             {
             // Prepare is called, but toneplayer's state is not yet prepare,
             // then cancel to prepare is needed.
-            iCurrent->CancelPrepare();
+            iPlayer->CancelPrepare();
             }
         else
             {
-            iCurrent->CancelPlay();
+            iPlayer->CancelPlay();
             }
         }
     TRACE_PRN_FN_EXT;
@@ -358,114 +199,89 @@
 void TMSAudioInbandTonePlayer::PlayCurrentTone()
     {
     TRACE_PRN_FN_ENT;
-    if (iCurrent)
+    if (iPlayer)
         {
-        if (iCurrent->State() == EMdaAudioToneUtilityPrepared)
+        if (iPlayer->State() == EMdaAudioToneUtilityPrepared)
             {
             UpdateTonePlayerVolume();
 
             switch (iToneName)
                 {
-                case TMS_INBAND_USER_BUSY://ECCPToneUserBusy:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefBusy));
+                case TMS_INBAND_USER_BUSY:
+                    SetToneAttributes(KAudioPrefBusy);
                     break;
-                case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefRadioNotAvailable));
+                case TMS_INBAND_RADIO_PATH_NOT_AVAIL:
+                    SetToneAttributes(KAudioPrefRadioNotAvailable);
+                    break;
+                case TMS_INBAND_CONGESTION:
+                    SetToneAttributes(KAudioPrefCongestion);
                     break;
-                case TMS_INBAND_CONGESTION://ECCPToneCongestion:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefCongestion));
+                case TMS_INBAND_SPECIAL_INFO:
+                    SetToneAttributes(KAudioPrefSpecialInformation);
                     break;
-                case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefSpecialInformation));
+                case TMS_INBAND_REORDER:
+                    SetToneAttributes(KAudioPrefReorder);
                     break;
-                case TMS_INBAND_REORDER://ECCPReorder:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefReorder));
+                case TMS_INBAND_REMOTE_ALEARTING:
+                    SetToneAttributes(KAudioPrefRingGoing);
                     break;
-                case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefRingGoing));
-                    break;
-                case TMS_INBAND_CALL_WAITING://ECCPCallWaiting:
-                    iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
-                            KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityNetMsg,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefCallWaiting));
+                case TMS_INBAND_CALL_WAITING:
+                    SetToneAttributes(KAudioPrefCallWaiting,
+                            KAudioPriorityNetMsg, 0);
                     break;
-                case TMS_INBAND_DATA_CALL://ECCPDataCallTone: //EProfileRingingTypeRinging, EProfileRingingTypeAscending, EProfileRingingTypeRingingOnce
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(KAudioPriorityPhoneCall,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefIncomingDataCall));
+                case TMS_INBAND_DATA_CALL:
+                    SetToneAttributes(KAudioPrefIncomingDataCall,
+                            KAudioPriorityPhoneCall);
 
-                    //      if ( iRingingType == EProfileRingingTypeAscending )
-                    //           {
-                    //           iCurrent->SetVolumeRamp(
-                    //               TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) );
-                    //           }
-                    //       else
-                    //          {
-                    //EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce
-                    iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds(
+            //      if ( iRingingType == EProfileRingingTypeAscending )
+            //           {
+            //           iPlayer->SetVolumeRamp(
+            //               TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) );
+            //           }
+            //       else
+            //          {
+            //          EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce
+                    iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(
                             KPhoneInbandToneZero));
-                    //           }
-                    //      if ( iRingingType == EProfileRingingTypeRingingOnce )
-                    //          {
-                    iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
-                            KPhoneInbandToneZero));
+            //           }
+            //      if ( iRingingType == EProfileRingingTypeRingingOnce )
+            //          {
+            //        iPlayer->SetRepeats(0, TTimeIntervalMicroSeconds(
+            //                KPhoneInbandToneZero));
                     //          }
                     break;
-                case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence:
-                case TMS_INBAND_BEEP_SEQUENCE://ECCPBeepSequence:
-                    iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
-                            TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
-                    iCurrent->SetPriority(
-                            KAudioPriorityPhoneCall,
-                            static_cast<TMdaPriorityPreference> (
-                                    KAudioPrefIncomingCall));
-                    iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
-                            KPhoneInbandToneZero));
-                    iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds(
+                case TMS_INBAND_NO_SEQUENCE:
+                case TMS_INBAND_BEEP_SEQUENCE:
+                    SetToneAttributes(KAudioPrefIncomingCall,
+                            KAudioPriorityPhoneCall);
+
+                    //iPlayer->SetRepeats(0, TTimeIntervalMicroSeconds(
+                    //        KPhoneInbandToneZero));
+                    iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(
                             KPhoneInbandToneZero));
                     break;
                 default:
                     break;
                 }
-
-#ifdef __WINS__
-
-#else
+#ifndef __WINS__
             //Play the tone
-            iCurrent->Play();
+            iPlayer->Play();
 #endif
+            }
+        }
+    TRACE_PRN_FN_EXT;
+    }
 
-            } // State()
-        } //iCurrent
-    TRACE_PRN_FN_EXT;
+// -----------------------------------------------------------------------------
+// TMSAudioInbandTonePlayer::SetToneAttributes
+//
+// -----------------------------------------------------------------------------
+//
+void TMSAudioInbandTonePlayer::SetToneAttributes(const guint pref,
+        const guint priority, const gint repeatTimes, const gint trailSilence)
+    {
+    iPlayer->SetRepeats(repeatTimes, TTimeIntervalMicroSeconds(trailSilence));
+    iPlayer->SetPriority(priority, static_cast<TMdaPriorityPreference> (pref));
     }
 
 // -----------------------------------------------------------------------------
@@ -488,16 +304,19 @@
 // TMSAudioInbandTonePlayer::SetVolume
 // -----------------------------------------------------------------------------
 //
-void TMSAudioInbandTonePlayer::SetVolume(TInt aVolume)
+void TMSAudioInbandTonePlayer::SetVolume(gint volume)
     {
     TRACE_PRN_FN_ENT;
-    TInt safeVolume = Max(Min(aVolume, KPhoneInbandVolumeMax),
+    gint safeVolume = Max(Min(volume, KPhoneInbandVolumeMax),
             KPhoneInbandVolumeMin);
 
-    if (iCurrent && EMdaAudioToneUtilityNotReady != iCurrent->State())
+    if (iPlayer)
         {
-        TInt mediaServerVolume = CalculateMediaServerVolume(safeVolume);
-        iCurrent->SetVolume(mediaServerVolume);
+        gint mediaServerVolume = CalculateMediaServerVolume(safeVolume);
+        if (EMdaAudioToneUtilityNotReady != iPlayer->State())
+            {
+            iPlayer->SetVolume(mediaServerVolume);
+            }
         }
     TRACE_PRN_FN_EXT;
     }
@@ -508,12 +327,10 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt aError)
+void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt /*aError*/)
     {
     TRACE_PRN_FN_ENT;
-    if (aError != KErrNone)
-        {
-        }
+    // TODO: process error?
     TRACE_PRN_FN_EXT;
     }
 
@@ -521,13 +338,13 @@
 // TMSAudioInbandTonePlayer::CalculateMediaServerVolume
 // -----------------------------------------------------------------------------
 //
-TInt TMSAudioInbandTonePlayer::CalculateMediaServerVolume(TInt aVolume) const
+gint TMSAudioInbandTonePlayer::CalculateMediaServerVolume(gint volume) const
     {
     TRACE_PRN_FN_ENT;
     TRACE_PRN_FN_EXT;
     // Our volume level scale is 0...10, media server's can be anything.
     // This scales the volume to correct level.
-    return (iCurrent->MaxVolume() * aVolume) /
+    return (iPlayer->MaxVolume() * volume) /
             (KPhoneInbandVolumeMax - KPhoneInbandVolumeMin);
     }
 
@@ -538,8 +355,7 @@
 void TMSAudioInbandTonePlayer::UpdateTonePlayerVolume()
     {
     TRACE_PRN_FN_ENT;
-    TInt volume( /*KPhoneInbandVolumeMin*/KPhoneInbandVolumeMax);
-    // iOwner.GetAudioVolumeSync( volume );
+    gint volume( /*KPhoneInbandVolumeMin*/KPhoneInbandVolumeMax);
     SetVolume(volume);
     TRACE_PRN_FN_EXT;
     }
--- a/mmserv/tms/tmsserver/src/tmsaudiotoneutilityimpl.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsaudiotoneutilityimpl.cpp	Thu May 27 13:20:50 2010 +0300
@@ -32,9 +32,9 @@
 // 2nd phase construcotor
 // ---------------------------------------------------------------------------
 //
-void TMSAudioToneUtilityImpl::ConstructL(MMdaAudioToneObserver& aToneObserver)
+void TMSAudioToneUtilityImpl::ConstructL(MMdaAudioToneObserver& toneObserver)
     {
-    iToneUtility = CMdaAudioToneUtility::NewL(aToneObserver);
+    iToneUtility = CMdaAudioToneUtility::NewL(toneObserver);
     }
 
 // ---------------------------------------------------------------------------
@@ -42,11 +42,11 @@
 // ---------------------------------------------------------------------------
 //
 TMSAudioToneUtilityImpl* TMSAudioToneUtilityImpl::NewL(
-        MMdaAudioToneObserver& aToneObserver)
+        MMdaAudioToneObserver& toneObserver)
     {
     TMSAudioToneUtilityImpl* self = new (ELeave) TMSAudioToneUtilityImpl;
     CleanupStack::PushL(self);
-    self->ConstructL(aToneObserver);
+    self->ConstructL(toneObserver);
     CleanupStack::Pop(self);
     return self;
     }
@@ -86,13 +86,16 @@
     {
     // Do state specific cancellations, this way we do not end up in a
     // endless play state if CancelPlay() is called during preparation.
-    if (EMdaAudioToneUtilityPlaying == iToneUtility->State())
+    if (iToneUtility)
         {
-        iToneUtility->CancelPlay();
-        }
-    else if (EMdaAudioToneUtilityPrepared == iToneUtility->State())
-        {
-        iToneUtility->CancelPrepare();
+        if (EMdaAudioToneUtilityPlaying == State())
+            {
+            iToneUtility->CancelPlay();
+            }
+        else if (EMdaAudioToneUtilityPrepared == State())
+            {
+            iToneUtility->CancelPrepare();
+            }
         }
     }
 
@@ -100,7 +103,7 @@
 // From class TMSAudioToneUtilityImpl
 // ---------------------------------------------------------------------------
 //
-TInt TMSAudioToneUtilityImpl::MaxVolume()
+gint TMSAudioToneUtilityImpl::MaxVolume()
     {
     return iToneUtility->MaxVolume();
     }
@@ -109,29 +112,29 @@
 // From class TMSAudioToneUtilityImpl
 // ---------------------------------------------------------------------------
 //
-void TMSAudioToneUtilityImpl::SetVolume(TInt aVolume)
+void TMSAudioToneUtilityImpl::SetVolume(gint volume)
     {
-    iToneUtility->SetVolume(aVolume);
+    iToneUtility->SetVolume(volume);
     }
 
 // ---------------------------------------------------------------------------
 // From class TMSAudioToneUtilityImpl
 // ---------------------------------------------------------------------------
 //
-void TMSAudioToneUtilityImpl::SetRepeats(TInt aRepeatNumberOfTimes,
-        const TTimeIntervalMicroSeconds& aTrailingSilence)
+void TMSAudioToneUtilityImpl::SetRepeats(gint repeatNumberOfTimes,
+        const TTimeIntervalMicroSeconds& trailingSilence)
     {
-    iToneUtility->SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
+    iToneUtility->SetRepeats(repeatNumberOfTimes, trailingSilence);
     }
 
 // ---------------------------------------------------------------------------
 // From class TMSAudioToneUtilityImpl
 // ---------------------------------------------------------------------------
 //
-void TMSAudioToneUtilityImpl::SetPriority(TInt aPriority,
-        TMdaPriorityPreference aPref)
+void TMSAudioToneUtilityImpl::SetPriority(gint priority,
+        TMdaPriorityPreference pref)
     {
-    iToneUtility->SetPriority(aPriority, aPref);
+    iToneUtility->SetPriority(priority, pref);
     }
 
 // ---------------------------------------------------------------------------
@@ -139,9 +142,9 @@
 // ---------------------------------------------------------------------------
 //
 void TMSAudioToneUtilityImpl::SetVolumeRamp(
-        const TTimeIntervalMicroSeconds& aRampDuration)
+        const TTimeIntervalMicroSeconds& rampDuration)
     {
-    iToneUtility->SetVolumeRamp(aRampDuration);
+    iToneUtility->SetVolumeRamp(rampDuration);
     }
 
 // ---------------------------------------------------------------------------
--- a/mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp	Thu May 27 13:20:50 2010 +0300
@@ -251,7 +251,10 @@
         switch (iPlayerStatus)
             {
             case ETonePlaying:
-                iTonePlayer->CancelPlay();
+                if (iTonePlayer)
+                    {
+                    iTonePlayer->CancelPlay();
+                    }
                 DoPlay();
                 break;
             case EToneReady:
@@ -272,7 +275,10 @@
         switch (iPlayerStatus)
             {
             case ETonePlaying:
-                iTtsPlayer->Stop();
+                if (iTtsPlayer)
+                    {
+                    iTtsPlayer->Stop();
+                    }
                 DoPlay();
                 break;
             case EToneReady:
@@ -320,17 +326,17 @@
 void TMSRtAudioHdlr::ReStartPlaying()
     {
     TRACE_PRN_FN_ENT;
-    if (iFormat == EFormatTone)
+    if (iFormat == EFormatTone && iTonePlayer)
         {
         iTonePlayer->Play();
         iPlayerStatus = ETonePlaying;
         }
-    else if (iFormat == EFormatTts)
+    else if (iFormat == EFormatTts && iTtsPlayer)
         {
         iTtsPlayer->Play();
         iPlayerStatus = ETonePlaying;
         }
-    else
+    else if (iFormat == EFormatSample && iSamplePlayer)
         {
         iSamplePlayer->Play();
         iPlayerStatus = ETonePlaying;
--- a/mmserv/tms/tmsserver/src/tmsrtcontainer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsrtcontainer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -19,7 +19,6 @@
 #include <apgcli.h>
 #include <DRMHelper.h>
 #include <bldvariant.hrh>
-//#include <pathinfo.h>
 #include "tmsrtcontainer.h"
 
 using namespace TMS;
@@ -222,17 +221,8 @@
 // -----------------------------------------------------------------------------
 //
 TBool TMSRtContainer::IsFileInVideoDirectory() const
-    {/*
-    TParsePtrC parsedName(*iFileName);
-
-    if (PathInfo::PathType(parsedName.DriveAndPath()) == PathInfo::EVideosPath)
-        {
-        return ETrue;
-        }
-    else
-        {*/
-        return EFalse;
-        //}
+    {
+    return EFalse;
     }
 
 // -----------------------------------------------------------------------------
--- a/mmserv/tms/tmsserver/src/tmsrtplayer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsrtplayer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -204,13 +204,16 @@
         iProfile->Release();
         iProfile = NULL;
         }
-    __ASSERT_DEBUG(iEngine, PANIC(TMS_RESULT_UNINITIALIZED_OBJECT));
+    __ASSERT_ALWAYS(iEngine, PANIC(TMS_RESULT_UNINITIALIZED_OBJECT));
 
     iProfile = iEngine->ActiveProfileL();
-    MProEngToneSettings& settings = iProfile->ToneSettings();
-    iRtParam.iVolume = settings.RingingVolume();
-    iRtParam.iRingingType = settings.RingingType();
-    iRtParam.iCallerText = settings.TextToSpeech();
+    if (iProfile)
+        {
+        MProEngToneSettings& settings = iProfile->ToneSettings();
+        iRtParam.iVolume = settings.RingingVolume();
+        iRtParam.iRingingType = settings.RingingType();
+        iRtParam.iCallerText = settings.TextToSpeech();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -222,7 +225,7 @@
     TRACE_PRN_FN_ENT;
 
     LoadActiveProfileSettingsL();
-    __ASSERT_DEBUG(iProfile, PANIC(TMS_RESULT_UNINITIALIZED_OBJECT));
+    __ASSERT_ALWAYS(iProfile, PANIC(TMS_RESULT_UNINITIALIZED_OBJECT));
 
     MProEngTones& tones = iProfile->ProfileTones();
     // Get alternate line RT: tones.RingingTone2()
@@ -1114,7 +1117,7 @@
     TMSRtAudioHdlr* currPlayer = NULL;
     currPlayer = GetCurrentlyActiveAudioPlayerWithTTS();
 
-    if (!currPlayer)
+    if (!currPlayer || !iTtsPlayer)
         {
         return;
         }
@@ -1376,12 +1379,11 @@
                 }
 
 #ifdef __WINS__
-            TRAPD(ignore, PlayAudioRingToneL());
+            TRAP_IGNORE(PlayAudioRingToneL());
             iTonePlayingStatus = EDefaultTonePlaying;
 #else
-            TRAPD(ignore, PlayDefaultToneL());
+            TRAP_IGNORE(PlayDefaultToneL());
 #endif
-            if (ignore) ;
             break;
             }
         case EDefaultTonePlaying:
@@ -1592,11 +1594,15 @@
     TInt error = TMS_RESULT_SUCCESS;
 
     RFs fs;
-    fs.Connect();
-    TEntry entry;
-    if (TMS_RESULT_SUCCESS == fs.Entry(aFile, entry))
+    error = fs.Connect();
+
+    if (error == TMS_RESULT_SUCCESS)
         {
-        size = entry.iSize;
+        TEntry entry;
+        if (TMS_RESULT_SUCCESS == fs.Entry(aFile, entry))
+            {
+            size = entry.iSize;
+            }
         }
     fs.Close();
 
--- a/mmserv/tms/tmsserver/src/tmsserver.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmsserver.cpp	Thu May 27 13:20:50 2010 +0300
@@ -45,12 +45,11 @@
 //
 // -----------------------------------------------------------------------------
 //
-TMSServer* TMSServer::NewL()
+TMSServer* TMSServer::NewLC()
     {
     TMSServer* self = new (ELeave) TMSServer;
     CleanupStack::PushL(self);
     self->ConstructL();
-    CleanupStack::Pop(self);
     return self;
     }
 
@@ -1292,21 +1291,24 @@
     }
 
 // -----------------------------------------------------------------------------
-// RunServerL
+// TMSServer::RunServerL
 //
 // -----------------------------------------------------------------------------
 //
-static void RunServerL()
+void TMSServer::RunServerL()
     {
     TRACE_PRN_N(_L("TMS->RunServerL"));
 
+    // Naming the server thread after the server helps to debug panics
+    User::LeaveIfError(User::RenameThread(KTMSServerName));
+
     // Create and install the active scheduler we need
     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
     CleanupStack::PushL(scheduler);
     CActiveScheduler::Install(scheduler);
 
     // Create the server (leave it on the cleanup stack)
-    TMSServer* server = TMSServer::NewL();
+    TMSServer* server = TMSServer::NewLC();
 
     // Initialisation complete, now signal the client
     RProcess::Rendezvous(TMS_RESULT_SUCCESS);
@@ -1316,7 +1318,7 @@
 
     // Ready to exit.
     // Cleanup scheduler and delete the server
-    delete server;
+    CleanupStack::PopAndDestroy(server);
     CleanupStack::PopAndDestroy(scheduler);
 
     TRACE_PRN_N(_L("TMS->RunServerL - TMS server closed"));
@@ -1565,7 +1567,7 @@
     TInt r = KErrNoMemory;
     if (cleanup)
         {
-        TRAP(r, RunServerL());
+        TRAP(r, TMSServer::RunServerL());
         delete cleanup;
         }
     __UHEAP_MARKEND;
--- a/mmserv/tms/tmsserver/src/tmstimer.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsserver/src/tmstimer.cpp	Thu May 27 13:20:50 2010 +0300
@@ -88,6 +88,16 @@
     }
 
 // ---------------------------------------------------------
+// TMSTimer::RunL()
+// ---------------------------------------------------------
+//
+TInt TMSTimer::RunError(TInt aError)
+    {
+    //TODO: process error if HandleTimeOutL() in RunL leaves
+    return aError;
+    }
+
+// ---------------------------------------------------------
 // TMSTimer::After()
 // ---------------------------------------------------------
 //
--- a/mmserv/tms/tmsutility/src/tmsutility.cpp	Fri May 14 16:22:35 2010 +0300
+++ b/mmserv/tms/tmsutility/src/tmsutility.cpp	Thu May 27 13:20:50 2010 +0300
@@ -52,7 +52,7 @@
             result = TMS_RESULT_INSUFFICIENT_MEMORY;
             break;
         case KErrNotSupported: //-5
-            result = TMS_RESULT_DOES_NOT_EXIST;
+            result = TMS_RESULT_ILLEGAL_OPERATION;
             break;
         case KErrArgument: //-6
             result = TMS_RESULT_INVALID_ARGUMENT;
@@ -74,10 +74,10 @@
             result = TMS_RESULT_GENERAL_ERROR;
             break;
         case KErrDied: //-13
-        case KErrInUse: //-14
         case KErrServerTerminated: //-15
             result = TMS_RESULT_FATAL_ERROR;
             break;
+        case KErrInUse: //-14
         case KErrServerBusy: //-16
         case KErrCompletion: //-17
         case KErrNotReady: //-18