1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3fdevsound/src/mmfaudioserver/mmfaudioserversession.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,107 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +// INCLUDE FILES
1.22 +#include <s32mem.h>
1.23 +#include <e32math.h>
1.24 +#include "mmfaudioserversession.h"
1.25 +#include "mmfaudioclientserver.h"
1.26 +#include "mmfaudioserver.h"
1.27 +
1.28 +// -----------------------------------------------------------------------------
1.29 +// CMMFAudioServerSession::NewL
1.30 +// Two-phased constructor.
1.31 +// -----------------------------------------------------------------------------
1.32 +//
1.33 +CMMFAudioServerSession* CMMFAudioServerSession::NewL(RHandleBase& aDevSoundSessionHandle)
1.34 + {
1.35 + CMMFAudioServerSession* self = new(ELeave) CMMFAudioServerSession(aDevSoundSessionHandle);
1.36 + CleanupStack::PushL(self);
1.37 + self->ConstructL();
1.38 + CleanupStack::Pop(self);
1.39 + return self;
1.40 + }
1.41 +
1.42 +// -----------------------------------------------------------------------------
1.43 +// void CMMFAudioServerSession::ConstructL
1.44 +// Symbian 2nd phase constructor can leave.
1.45 +// -----------------------------------------------------------------------------
1.46 +//
1.47 +void CMMFAudioServerSession::ConstructL()
1.48 + {
1.49 + }
1.50 +
1.51 +// -----------------------------------------------------------------------------
1.52 +// CMMFAudioServerSession::CMMFAudioServerSession
1.53 +// -----------------------------------------------------------------------------
1.54 +//
1.55 +CMMFAudioServerSession::CMMFAudioServerSession(
1.56 + RHandleBase& aDevSoundSessionHandle):iDevSoundSessionHandle(aDevSoundSessionHandle)
1.57 + {
1.58 + }
1.59 +
1.60 +
1.61 +// -----------------------------------------------------------------------------
1.62 +// CMMFAudioServerSession::CreateL
1.63 +// Creates a new server-side session
1.64 +// -----------------------------------------------------------------------------
1.65 +//
1.66 +void CMMFAudioServerSession::CreateL(const CMmfIpcServer& aServer)
1.67 + {
1.68 + CMmfIpcSession::CreateL(aServer);
1.69 + CMMFAudioServer* server = static_cast<CMMFAudioServer*>(const_cast<CMmfIpcServer*>(&aServer));
1.70 + server->IncrementSessionId();
1.71 + iAudioServerSessionId = server->AudioServerSessionId();
1.72 + }
1.73 +
1.74 +// -----------------------------------------------------------------------------
1.75 +// Destructor
1.76 +// -----------------------------------------------------------------------------
1.77 +CMMFAudioServerSession::~CMMFAudioServerSession()
1.78 + {
1.79 + CMMFAudioServer* server =
1.80 + const_cast<CMMFAudioServer*>(static_cast<const CMMFAudioServer*>(Server()));
1.81 +
1.82 + if (server)
1.83 + {
1.84 + server->DecrementSessionId();
1.85 + }
1.86 +
1.87 + iDevSoundSessionHandle.Close();
1.88 + }
1.89 +
1.90 +
1.91 +// -----------------------------------------------------------------------------
1.92 +// CMMFAudioServerSession::ServiceL
1.93 +// Handles the client requests
1.94 +// (other items were commented in a header).
1.95 +// -----------------------------------------------------------------------------
1.96 +//
1.97 +void CMMFAudioServerSession::ServiceL(const RMmfIpcMessage& aMessage)
1.98 + {
1.99 + switch(aMessage.Function())
1.100 + {
1.101 + case EMMFDevSoundSessionHandle:
1.102 + aMessage.Complete(iDevSoundSessionHandle);
1.103 + break;
1.104 + default:
1.105 + User::Leave(KErrNotSupported);
1.106 + break;
1.107 + }
1.108 + }
1.109 +
1.110 +// End of File