sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "MmfAudioServerSession.h"
|
sl@0
|
17 |
#include "MmfAudioClientServer.h"
|
sl@0
|
18 |
#include "MmfAudioServer.h"
|
sl@0
|
19 |
#include <s32mem.h>
|
sl@0
|
20 |
#include <e32math.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
/*
|
sl@0
|
24 |
This call takes ownership of aDevSoundSessionHandle. We need to ensure that it is closed
|
sl@0
|
25 |
in case of failure, but want to avoid double close situations. We emporarily push the argument
|
sl@0
|
26 |
onto cleanup stack and pass it into the CMMFAudioServerSession once we know that the assignment
|
sl@0
|
27 |
can't fail. The latter object itself takes ownership.
|
sl@0
|
28 |
*/
|
sl@0
|
29 |
CMMFAudioServerSession* CMMFAudioServerSession::NewL(RHandleBase& aDevSoundSessionHandle)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
CleanupClosePushL(aDevSoundSessionHandle);
|
sl@0
|
32 |
CMMFAudioServerSession* self = new(ELeave) CMMFAudioServerSession();
|
sl@0
|
33 |
CleanupStack::Pop(&aDevSoundSessionHandle);
|
sl@0
|
34 |
self->SetDevSoundSessionHandle(aDevSoundSessionHandle);
|
sl@0
|
35 |
CleanupStack::PushL(self);
|
sl@0
|
36 |
self->ConstructL();
|
sl@0
|
37 |
CleanupStack::Pop(self);
|
sl@0
|
38 |
return self;
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
void CMMFAudioServerSession::ConstructL()
|
sl@0
|
42 |
{
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
CMMFAudioServerSession::CMMFAudioServerSession()// : iEventsQue(_FOFF(TMMFAudioPolicyEventHolder,iLink))
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
void CMMFAudioServerSession::CreateL(const CMmfIpcServer& aServer)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
CMmfIpcSession::CreateL(aServer);
|
sl@0
|
52 |
CMMFAudioServer* server = static_cast<CMMFAudioServer*>(CONST_CAST(CMmfIpcServer*, &aServer));
|
sl@0
|
53 |
server->IncrementSessionId();
|
sl@0
|
54 |
iAudioServerSessionId = server->AudioServerSessionId();
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
CMMFAudioServerSession::~CMMFAudioServerSession()
|
sl@0
|
58 |
{
|
sl@0
|
59 |
CMMFAudioServer* server =
|
sl@0
|
60 |
const_cast<CMMFAudioServer*>(static_cast<const CMMFAudioServer*>(Server()));
|
sl@0
|
61 |
if (server)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
server->DecrementSessionId();
|
sl@0
|
64 |
}
|
sl@0
|
65 |
iDevSoundSessionHandle.Close();
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
void CMMFAudioServerSession::ServiceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
switch(aMessage.Function())
|
sl@0
|
71 |
{
|
sl@0
|
72 |
case EMMFDevSoundSessionHandle:
|
sl@0
|
73 |
aMessage.Complete(iDevSoundSessionHandle);
|
sl@0
|
74 |
break;
|
sl@0
|
75 |
default:
|
sl@0
|
76 |
User::Leave(KErrNotSupported);
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
void CMMFAudioServerSession::SendEventToClient(/*TMMFAudioPolicyEvent& aEvent*/)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
void CMMFAudioServerSession::SetDevSoundSessionHandle(RHandleBase& aDevSoundSessionHandle)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
iDevSoundSessionHandle = aDevSoundSessionHandle;
|
sl@0
|
88 |
}
|