|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "tmscallserver.h" |
|
19 #include "delaytimer.h" |
|
20 #include "tmsutility.h" |
|
21 #include "tmscallsession.h" |
|
22 |
|
23 using namespace TMS; |
|
24 |
|
25 const TInt KShutDownDelay = 0; //0 sec |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // TMSCallServer::TMSCallServer |
|
29 // |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 TMSCallServer::TMSCallServer(TMSServer* aTMSServer) : |
|
33 CServer2(CActive::EPriorityHigh, EGlobalSharableSessions), |
|
34 iTMSServer(aTMSServer), |
|
35 iDelayTimer(NULL), |
|
36 iSessionCount(0) |
|
37 { |
|
38 TRACE_PRN_FN_ENT; |
|
39 TRACE_PRN_FN_EXT; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // TMSCallServer::~TMSCallServer |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 TMSCallServer::~TMSCallServer() |
|
48 { |
|
49 TRACE_PRN_FN_ENT; |
|
50 if (iDelayTimer) |
|
51 { |
|
52 iDelayTimer->Cancel(); |
|
53 delete iDelayTimer; |
|
54 } |
|
55 TRACE_PRN_FN_EXT; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // TMSCallServer::NewL |
|
60 // |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 TMSCallServer* TMSCallServer::NewL(TMSServer* aTMSServer) |
|
64 { |
|
65 TRACE_PRN_FN_ENT; |
|
66 TMSCallServer* self = new (ELeave) TMSCallServer(aTMSServer); |
|
67 CleanupStack::PushL(self); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop(self); |
|
70 TRACE_PRN_FN_EXT; |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // TMSCallServer::ConstructL |
|
76 // |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void TMSCallServer::ConstructL() |
|
80 { |
|
81 TRACE_PRN_FN_ENT; |
|
82 // Call base class to Start server |
|
83 StartL(KNullDesC); |
|
84 iDelayTimer = TMSCallDelayTimer::NewL(); |
|
85 TRACE_PRN_FN_EXT; |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // TMSCallServer::AddSession |
|
90 // |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void TMSCallServer::AddSession() |
|
94 { |
|
95 TRACE_PRN_FN_ENT; |
|
96 iSessionCount++; |
|
97 iDelayTimer->Cancel(); |
|
98 TRACE_PRN_FN_EXT; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // TMSCallServer::DropSession |
|
103 // |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void TMSCallServer::DropSession() |
|
107 { |
|
108 TRACE_PRN_FN_ENT; |
|
109 iSessionCount--; |
|
110 if (iSessionCount == 0) |
|
111 { |
|
112 iDelayTimer->SetDelay(TTimeIntervalMicroSeconds32(KShutDownDelay)); |
|
113 } |
|
114 TRACE_PRN_FN_EXT; |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // TMSCallServer::NewSessionL |
|
119 // |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 CSession2* TMSCallServer::NewSessionL(const TVersion& aVersion, |
|
123 const RMessage2& /*aMessage*/) const |
|
124 { |
|
125 TRACE_PRN_FN_ENT; |
|
126 const TVersion version(KTMSCallServerMajorVersionNumber, |
|
127 KTMSCallServerMinorVersionNumber, |
|
128 KTMSCallServerBuildVersionNumber); |
|
129 |
|
130 if (!User::QueryVersionSupported(version, aVersion)) |
|
131 { |
|
132 User::Leave(KErrNotSupported); |
|
133 } |
|
134 |
|
135 TMSCallSession* session = |
|
136 TMSCallSession::NewL(*(const_cast<TMSCallServer*> (this))); |
|
137 TRACE_PRN_FN_EXT; |
|
138 return session; |
|
139 } |
|
140 |
|
141 // End of file |