mmserv/tms/tmscallserver/src/tmscsdownlink.cpp
branchRCL_3
changeset 40 60e492b28869
parent 17 3570217d8c21
child 45 095bea5f582e
--- a/mmserv/tms/tmscallserver/src/tmscsdownlink.cpp	Mon Jun 21 16:15:34 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmscsdownlink.cpp	Thu Jul 15 19:13:36 2010 +0300
@@ -25,12 +25,35 @@
 const gint KDefaultMaxVolume = 10;
 
 // -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+//
+TMSCSDownlink::TMSCSDownlink(TMSCSDevSoundObserver& observer) :
+    TMSCSDevSound(observer)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Second phase constructor
+// -----------------------------------------------------------------------------
+//
+void TMSCSDownlink::ConstructL()
+    {
+    TMSCSDevSound::ConstructL(TMS_STREAM_DOWNLINK);
+
+    if (iDevSound)
+        {
+        iDevSound->SetVolume(KDefaultVolume);
+        }
+    }
+
+// -----------------------------------------------------------------------------
 // Static constructor
 // -----------------------------------------------------------------------------
 //
-TMSCSDownlink* TMSCSDownlink::NewL(TMSCSPDevSoundObserver& aObserver)
+TMSCSDownlink* TMSCSDownlink::NewL(TMSCSDevSoundObserver& observer)
     {
-    TMSCSDownlink* self = new (ELeave) TMSCSDownlink(aObserver);
+    TMSCSDownlink* self = new (ELeave) TMSCSDownlink(observer);
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(self);
@@ -38,7 +61,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// Destructor.
+// Destructor
 // -----------------------------------------------------------------------------
 //
 TMSCSDownlink::~TMSCSDownlink()
@@ -49,19 +72,19 @@
 // Sets volume
 // -----------------------------------------------------------------------------
 //
-void TMSCSDownlink::SetVolume(gint aVolume)
+void TMSCSDownlink::SetVolume(gint volume)
     {
     if (iDevSound)
         {
         gint maxVolume(iDevSound->MaxVolume());
         maxVolume = (maxVolume > 0) ? maxVolume : KDefaultMaxVolume;
-        gint scaledVolume = (aVolume * maxVolume) / KDefaultMaxVolume;
+        gint scaledVolume = (volume * maxVolume) / KDefaultMaxVolume;
         iDevSound->SetVolume(scaledVolume);
         }
     }
 
 // -----------------------------------------------------------------------------
-// Gives volume
+// Returns volume
 // -----------------------------------------------------------------------------
 //
 gint TMSCSDownlink::Volume()
@@ -75,7 +98,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// Gives max volume
+// Returns device's max volume
 // -----------------------------------------------------------------------------
 //
 gint TMSCSDownlink::MaxVolume()
@@ -95,13 +118,14 @@
 //
 void TMSCSDownlink::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
     {
-    //CSPLOGSTRING( CSPINT, "TMSCSDownlink:: activated" );
+    //TRACE_PRN_N(_L("TMSCSDownlink::BufferToBeFilled"));
+
     // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
+    if (iActivationOngoing)
         {
         iActive = ETrue;
         iActivationOngoing = EFalse;
-        iObserver.DownlinkActivatedSuccessfully();
+        iObserver.DownlinkActivationCompleted(KErrNone);
         }
     }
 
@@ -112,23 +136,19 @@
 //
 void TMSCSDownlink::PlayError(TInt aError)
     {
-    //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError" );
+    //TRACE_PRN_N1(_L("TMSCSDownlink::PlayError[%d]"), aError);
 
-    // We dont react to devsound messages unless we are activating.
-    if (IsActivationOngoing())
+    // We don't react to devsound errors unless we are activating.
+    if (iActivationOngoing && aError == KErrAccessDenied)
         {
-        //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError activation failed" );
-        if (aError == KErrAccessDenied)
-            {
-            iActivationOngoing = EFalse;
-            iObserver.DownlinkActivationFailed();
-            }
+        iActivationOngoing = EFalse;
+        iObserver.DownlinkActivationCompleted(aError);
         }
     }
 
 // -----------------------------------------------------------------------------
-// From class CSPDevsound
-// Tries to activate Downlink stream.
+// From class TMSCSDevSound
+// Activates Downlink stream.
 // -----------------------------------------------------------------------------
 //
 void TMSCSDownlink::DoActivateL()
@@ -139,28 +159,4 @@
         }
     }
 
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-TMSCSDownlink::TMSCSDownlink(TMSCSPDevSoundObserver& aObserver) :
-    TMSCSPDevSound(aObserver)
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// Second phase constructor
-// -----------------------------------------------------------------------------
-//
-void TMSCSDownlink::ConstructL()
-    {
-    TMSCSPDevSound::ConstructL(EMMFStatePlaying, KAudioPrefCSCallDownlink,
-            KAudioPriorityCSCallDownlink);
-
-    if (iDevSound)
-        {
-        iDevSound->SetVolume(KDefaultVolume);
-        }
-    }
-
 //  End of File