phoneapp/phoneuiview/src/phoneringingtonesrvsession.cpp
branchRCL_3
changeset 5 2a26698d78ba
child 6 38529f706030
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneapp/phoneuiview/src/phoneringingtonesrvsession.cpp	Mon Mar 15 12:40:24 2010 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002-2005,2007 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:  Phone ringing tone server session.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+
+#include "MPhoneRingingToneSrv.h"
+#include "PhoneRingingToneSrv.hrh"
+#include "PhoneRingingToneSrvSession.h"
+#include "phoneuiviewtrace.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneRingingToneServerSession::CPhoneRingingToneServerSession
+// -----------------------------------------------------------------------------
+//
+CPhoneRingingToneServerSession::CPhoneRingingToneServerSession( MPhoneRingingToneServer& aServer )
+    : iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhoneRingingToneServerSession::~CPhoneRingingToneServerSession
+// -----------------------------------------------------------------------------
+//
+CPhoneRingingToneServerSession::~CPhoneRingingToneServerSession()
+    {
+    iServer.DecrementSessions();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneRingingToneServerSession::NewL
+// -----------------------------------------------------------------------------
+//
+CPhoneRingingToneServerSession* CPhoneRingingToneServerSession::NewL( MPhoneRingingToneServer& aServer )
+    {
+    CPhoneRingingToneServerSession* self = new (ELeave) CPhoneRingingToneServerSession( aServer );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneRingingToneServerSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneRingingToneServerSession::ConstructL()
+    {
+    PHONEUIVIEW_PRINT( "CPhoneRingingToneServerSession::ConstructL" );
+    iServer.IncrementSessions();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneRingingToneServerSession::ServiceL
+// -----------------------------------------------------------------------------
+//
+void CPhoneRingingToneServerSession::ServiceL( const RMessage2& aMessage )
+    {
+    PHONEUIVIEW_PRINTF( "CPhoneRingingToneServerSession::ServiceL: func=%d", aMessage.Function() );
+
+    TBool noComplete = EFalse;
+
+    switch ( aMessage.Function() )
+        {
+        case ESetExtendedSecurityNeeded:
+            iServer.SetExtendedSecurityNeeded( aMessage.Int0() );
+            break;
+        case ESetToneFileSizeLimit:
+            iServer.SetToneFileSizeLimit( aMessage.Int0() );
+            break;
+        case ESetAudioRingingTone:
+            iServer.SetRingingToneL( aMessage );
+            break;
+        case ESetDefaultRingingTone:
+            iServer.SetDefaultRingingToneL( aMessage );
+            break;
+
+        // Playback control
+        case EPlayAudioRingTone:
+            noComplete = iServer.PlayAudioRingTone( aMessage );
+            break;
+        case EPlayTtsTone:
+            iServer.PlayTtsTone( aMessage );
+            break;
+        case EPlayDefaultTone:
+            iServer.PlayDefaultTone( aMessage );
+            break;
+        case EPlayBackupTone:
+            iServer.PlayBackupTone( aMessage );
+            break;
+        case EPlaySilentTone:
+            iServer.PlaySilentTone();
+            break;
+        case EBeepOnce:
+            iServer.BeepOnce( aMessage );
+            break;
+        case EPlayUnsecureVoIPTone:
+            iServer.PlayUnsecureVoIPTone();
+            break;
+
+        case EMuteRingingTone:
+            iServer.MuteRingingTone();
+            break;
+        case EStopPlaying:
+            iServer.StopPlaying();
+            break;
+        default:
+            break;
+        }
+
+    if ( !noComplete )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    }