os/mm/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +// Copyright (c) 2004-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 +#include "MmfAudioServerSession.h"
1.20 +#include "MmfAudioClientServer.h"
1.21 +#include "MmfAudioServer.h"
1.22 +#include <s32mem.h>
1.23 +#include <e32math.h>
1.24 +
1.25 +
1.26 +/*
1.27 + This call takes ownership of aDevSoundSessionHandle. We need to ensure that it is closed
1.28 + in case of failure, but want to avoid double close situations. We emporarily push the argument
1.29 + onto cleanup stack and pass it into the CMMFAudioServerSession once we know that the assignment
1.30 + can't fail. The latter object itself takes ownership.
1.31 + */
1.32 +CMMFAudioServerSession* CMMFAudioServerSession::NewL(RHandleBase& aDevSoundSessionHandle)
1.33 + {
1.34 + CleanupClosePushL(aDevSoundSessionHandle);
1.35 + CMMFAudioServerSession* self = new(ELeave) CMMFAudioServerSession();
1.36 + CleanupStack::Pop(&aDevSoundSessionHandle);
1.37 + self->SetDevSoundSessionHandle(aDevSoundSessionHandle);
1.38 + CleanupStack::PushL(self);
1.39 + self->ConstructL();
1.40 + CleanupStack::Pop(self);
1.41 + return self;
1.42 + }
1.43 +
1.44 +void CMMFAudioServerSession::ConstructL()
1.45 + {
1.46 + }
1.47 +
1.48 +CMMFAudioServerSession::CMMFAudioServerSession()// : iEventsQue(_FOFF(TMMFAudioPolicyEventHolder,iLink))
1.49 + {
1.50 + }
1.51 +
1.52 +void CMMFAudioServerSession::CreateL(const CMmfIpcServer& aServer)
1.53 + {
1.54 + CMmfIpcSession::CreateL(aServer);
1.55 + CMMFAudioServer* server = static_cast<CMMFAudioServer*>(CONST_CAST(CMmfIpcServer*, &aServer));
1.56 + server->IncrementSessionId();
1.57 + iAudioServerSessionId = server->AudioServerSessionId();
1.58 + }
1.59 +
1.60 +CMMFAudioServerSession::~CMMFAudioServerSession()
1.61 + {
1.62 + CMMFAudioServer* server =
1.63 + const_cast<CMMFAudioServer*>(static_cast<const CMMFAudioServer*>(Server()));
1.64 + if (server)
1.65 + {
1.66 + server->DecrementSessionId();
1.67 + }
1.68 + iDevSoundSessionHandle.Close();
1.69 + }
1.70 +
1.71 +void CMMFAudioServerSession::ServiceL(const RMmfIpcMessage& aMessage)
1.72 + {
1.73 + switch(aMessage.Function())
1.74 + {
1.75 + case EMMFDevSoundSessionHandle:
1.76 + aMessage.Complete(iDevSoundSessionHandle);
1.77 + break;
1.78 + default:
1.79 + User::Leave(KErrNotSupported);
1.80 + break;
1.81 + }
1.82 + }
1.83 +
1.84 +void CMMFAudioServerSession::SendEventToClient(/*TMMFAudioPolicyEvent& aEvent*/)
1.85 + {
1.86 + }
1.87 +
1.88 +void CMMFAudioServerSession::SetDevSoundSessionHandle(RHandleBase& aDevSoundSessionHandle)
1.89 + {
1.90 + iDevSoundSessionHandle = aDevSoundSessionHandle;
1.91 + }