|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <s32mem.h> |
|
20 #include <e32math.h> |
|
21 #include "mmfaudioserversession.h" |
|
22 #include "mmfaudioclientserver.h" |
|
23 #include "mmfaudioserver.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CMMFAudioServerSession::NewL |
|
27 // Two-phased constructor. |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CMMFAudioServerSession* CMMFAudioServerSession::NewL(RHandleBase& aDevSoundSessionHandle) |
|
31 { |
|
32 CMMFAudioServerSession* self = new(ELeave) CMMFAudioServerSession(aDevSoundSessionHandle); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // void CMMFAudioServerSession::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CMMFAudioServerSession::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMMFAudioServerSession::CMMFAudioServerSession |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CMMFAudioServerSession::CMMFAudioServerSession( |
|
53 RHandleBase& aDevSoundSessionHandle):iDevSoundSessionHandle(aDevSoundSessionHandle) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CMMFAudioServerSession::CreateL |
|
60 // Creates a new server-side session |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CMMFAudioServerSession::CreateL(const CMmfIpcServer& aServer) |
|
64 { |
|
65 CMmfIpcSession::CreateL(aServer); |
|
66 CMMFAudioServer* server = static_cast<CMMFAudioServer*>(const_cast<CMmfIpcServer*>(&aServer)); |
|
67 server->IncrementSessionId(); |
|
68 iAudioServerSessionId = server->AudioServerSessionId(); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // Destructor |
|
73 // ----------------------------------------------------------------------------- |
|
74 CMMFAudioServerSession::~CMMFAudioServerSession() |
|
75 { |
|
76 CMMFAudioServer* server = |
|
77 const_cast<CMMFAudioServer*>(static_cast<const CMMFAudioServer*>(Server())); |
|
78 |
|
79 if (server) |
|
80 { |
|
81 server->DecrementSessionId(); |
|
82 } |
|
83 |
|
84 iDevSoundSessionHandle.Close(); |
|
85 } |
|
86 |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CMMFAudioServerSession::ServiceL |
|
90 // Handles the client requests |
|
91 // (other items were commented in a header). |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 void CMMFAudioServerSession::ServiceL(const RMmfIpcMessage& aMessage) |
|
95 { |
|
96 switch(aMessage.Function()) |
|
97 { |
|
98 case EMMFDevSoundSessionHandle: |
|
99 aMessage.Complete(iDevSoundSessionHandle); |
|
100 break; |
|
101 default: |
|
102 User::Leave(KErrNotSupported); |
|
103 break; |
|
104 } |
|
105 } |
|
106 |
|
107 // End of File |