mmserv/tms/tmscallserver/src/tmscsdevsound.cpp
branchRCL_3
changeset 46 0ac9a5310753
parent 45 095bea5f582e
--- a/mmserv/tms/tmscallserver/src/tmscsdevsound.cpp	Tue Aug 31 15:43:02 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscsdevsound.cpp	Wed Sep 01 12:23:00 2010 +0100
@@ -16,7 +16,6 @@
  */
 
 #include <AudioPreference.h>
-#include <tms.h>
 #include <S60FourCC.h>
 #include "tmsutility.h"
 #include "tmscsdevsound.h"
@@ -24,35 +23,22 @@
 
 using namespace TMS;
 
-// CONSTANTS
-const gint KTimeoutInitial = 250000; // 250 ms initial timeout
-const gint KTimeoutMultiplier = 2;   // Double the timeout for each retry
-const gint KPeriodicTimeoutMax = 2000000; // 2 sec max periodic timeout
-const gint KMicroSecMultiply = 1000000;   // 1 sec
-
 // -----------------------------------------------------------------------------
-// TMSCSDevSound
+// TMSCSPDevSound
 // -----------------------------------------------------------------------------
 //
 TMSCSDevSound::TMSCSDevSound(TMSCSDevSoundObserver& observer) :
     iObserver(observer)
     {
-    iTimer = NULL;
-    iPeriodic = KTimeoutInitial;
-    iElapsedTime = 0;
-    iInitRetryTime = 0;
-    iStartRetryTime = 0;
     }
 
 // -----------------------------------------------------------------------------
 // ConstructL
 // -----------------------------------------------------------------------------
 //
-void TMSCSDevSound::ConstructL(const TMSStreamType strmtype,
-        const gint retrytime)
+void TMSCSDevSound::ConstructL(const TMSStreamType strmtype)
     {
     TRACE_PRN_FN_ENT;
-    iInitRetryTime = retrytime;
     iStreamType = strmtype;
 
     if (strmtype == TMS_STREAM_UPLINK)
@@ -67,8 +53,6 @@
         iPriority = KAudioPriorityCSCallDownlink;
         iPreference = KAudioPrefCSCallDownlink;
         }
-
-    iTimer = TMSTimer::NewL();
     InitializeL();
     TRACE_PRN_FN_EXT;
     }
@@ -110,21 +94,15 @@
 //
 TMSCSDevSound::~TMSCSDevSound()
     {
-    TRACE_PRN_FN_ENT;
-    CancelTimer();
-    delete iTimer;
     delete iDevSound;
-    TRACE_PRN_FN_EXT;
     }
 
 // -----------------------------------------------------------------------------
 // Tries to activate the audio stream if not already active or activating
 // -----------------------------------------------------------------------------
 //
-void TMSCSDevSound::Activate(const gint retrytime)
+void TMSCSDevSound::Activate()
     {
-    iStartRetryTime = retrytime;
-
     if (!iActive && !iActivationOngoing)
         {
         iActivationOngoing = ETrue;
@@ -136,21 +114,14 @@
 // Deactivates the audio device.
 // -----------------------------------------------------------------------------
 //
-void TMSCSDevSound::Deactivate(gboolean reset)
+void TMSCSDevSound::Deactivate()
     {
-    TRACE_PRN_FN_ENT;
-    if (reset)
-        {
-        iPeriodic = KTimeoutInitial;
-        }
-    CancelTimer();
     if (iDevSound && (iActive || iActivationOngoing))
         {
         iDevSound->Stop();
         iActive = EFalse;
         iActivationOngoing = EFalse;
         }
-    TRACE_PRN_FN_EXT;
     }
 
 // -----------------------------------------------------------------------------
@@ -169,17 +140,10 @@
 void TMSCSDevSound::InitializeComplete(TInt aError)
     {
     TRACE_PRN_FN_ENT;
-    if (aError != TMS_RESULT_SUCCESS && iInitRetryTime != 0)
+    if (aError == TMS_RESULT_SUCCESS)
         {
-        StartTimer();
-        }
-    else
-        {
-        iPeriodic = KTimeoutInitial;
-        CancelTimer();
         NotifyEvent(aError);
         }
-    TRACE_PRN_IF_ERR(aError);
     TRACE_PRN_FN_EXT;
     }
 
@@ -199,73 +163,4 @@
         }
     }
 
-// -----------------------------------------------------------------------------
-// TMSCSDevSound::CancelTimer
-// Resets timer
-// -----------------------------------------------------------------------------
-//
-void TMSCSDevSound::CancelTimer()
-    {
-    iInitRetryTime = 0;
-    iStartRetryTime = 0;
-    iElapsedTime = 0;
-
-    if (iTimer)
-        {
-        if (iTimer->IsRunning())
-            {
-            iTimer->CancelNotify();
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// TMSCSDevSound::StartTimer
-// Activates timer
-// -----------------------------------------------------------------------------
-//
-void TMSCSDevSound::StartTimer()
-    {
-    if (iTimer && (iInitRetryTime != 0 || iStartRetryTime != 0))
-        {
-        iTimer->NotifyAfter(iPeriodic, *this);
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// From TMSTimerObserver
-// Notification upon TMSTimer timeout.
-// -----------------------------------------------------------------------------
-//
-void TMSCSDevSound::TimerEvent()
-    {
-    if (iPeriodic < KPeriodicTimeoutMax)
-        {
-        iPeriodic *= KTimeoutMultiplier;
-        }
-    iElapsedTime += iPeriodic;
-
-    if (!iActivationOngoing) //Initializing
-        {
-        if (iElapsedTime >= (iInitRetryTime * KMicroSecMultiply))
-            {
-            iInitRetryTime = 0; //timer will not start again
-            }
-        TRAPD(status, InitializeL());
-        if (status != TMS_RESULT_SUCCESS)
-            {
-            NotifyEvent(status);
-            }
-        }
-    else //Activating
-        {
-        if (iElapsedTime >= (iStartRetryTime * KMicroSecMultiply))
-            {
-            iStartRetryTime = 0; //timer will not start again
-            }
-        Deactivate(FALSE);
-        Activate(iStartRetryTime);
-        }
-    }
-
 //  End of File