1 /* |
|
2 * Copyright (c) 2008 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: Implements the class CSPCallCommandHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cspcallcommandhandler.h" |
|
20 #include "mcspcallcommandhandling.h" |
|
21 #include "csplogger.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // CSPCallCommandHandler::NewL. |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CSPCallCommandHandler* CSPCallCommandHandler::NewL() |
|
28 { |
|
29 CSPLOGSTRING(CSPOBJECT, |
|
30 "CSPCallCommandHandler::NewL()" ); |
|
31 CSPCallCommandHandler* self = new ( ELeave ) CSPCallCommandHandler(); |
|
32 return self; |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Destructs the array including remaining calls. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CSPCallCommandHandler::~CSPCallCommandHandler() |
|
40 { |
|
41 iActiveHangupArray.Reset(); |
|
42 iActiveHangupArray.Close(); |
|
43 CSPLOGSTRING(CSPOBJECT, |
|
44 "CSPCallCommandHandler::~CSPCallCommandHandler"); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CSPCallCommandHandler::IndicateActiveHangup |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 TInt CSPCallCommandHandler::IndicateActiveHangup( MCCPCallCommandHandling& aCall ) |
|
52 { |
|
53 TInt err = iActiveHangupArray.Find( &aCall ); |
|
54 if ( err == KErrNotFound ) |
|
55 { |
|
56 err = iActiveHangupArray.Append( &aCall ); |
|
57 CSPLOGSTRING2( |
|
58 CSPINT, |
|
59 "CSPCallCommandHandler::IndicateActiveHangup append error: %d", |
|
60 err ); |
|
61 } |
|
62 else |
|
63 { |
|
64 CSPLOGSTRING( |
|
65 CSPINT, |
|
66 "CSPCallCommandHandler::IndicateActiveHangup call already added"); |
|
67 } |
|
68 CSPLOGSTRING2( |
|
69 CSPINT, |
|
70 "CSPCallCommandHandler::IndicateActiveHangup active hangup count: %d", |
|
71 iActiveHangupArray.Count()); |
|
72 |
|
73 return err; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CSPCallCommandHandler::CSPCallCommandHandler::IndicateHangupComplete |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 TInt CSPCallCommandHandler::IndicateHangupComplete( MCCPCallCommandHandling& aCall ) |
|
81 { |
|
82 TInt index = iActiveHangupArray.Find( &aCall ); |
|
83 if ( index != KErrNotFound ) |
|
84 { |
|
85 iActiveHangupArray.Remove( index ); |
|
86 CSPLOGSTRING(CSPINT, |
|
87 "CSPCallCommandHandler::IndicateHangupComplete remove"); |
|
88 } |
|
89 |
|
90 if( !iActiveHangupArray.Count() && iPendingCall ) |
|
91 { |
|
92 if( iPendingCommand == ECSPAnswerCall ) |
|
93 { |
|
94 CSPLOGSTRING(CSPINT, |
|
95 "CSPCallCommandHandler::IndicateHangupComplete perform answer request"); |
|
96 iPendingCall->PerformAnswerRequest(); |
|
97 iPendingCommand = ECSPNone; |
|
98 iPendingCall = NULL; |
|
99 } |
|
100 else if( iPendingCommand == ECSPDialCall ) |
|
101 { |
|
102 CSPLOGSTRING(CSPINT, |
|
103 "CSPCallCommandHandler::IndicateHangupComplete perform dial request"); |
|
104 iPendingCall->PerformDialRequest(); |
|
105 iPendingCommand = ECSPNone; |
|
106 iPendingCall = NULL; |
|
107 } |
|
108 } |
|
109 |
|
110 CSPLOGSTRING2(CSPINT, |
|
111 "CSPCallCommandHandler::IndicateHangupComplete active hangup count: %d", |
|
112 iActiveHangupArray.Count()); |
|
113 |
|
114 return KErrNone; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CSPCallCommandHandler::IndicateDialRequest |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CSPCallCommandHandler::IndicateDialRequest( MCCPCallCommandHandling& aCall ) |
|
122 |
|
123 { |
|
124 CSPLOGSTRING(CSPINT, |
|
125 "CSPCallCommandHandler::IndicateDialRequest"); |
|
126 TInt ret( KErrNone ); |
|
127 |
|
128 if( !iActiveHangupArray.Count() ) |
|
129 { |
|
130 CSPLOGSTRING(CSPINT, |
|
131 "CSPCallCommandHandler::IndicateDialRequest dial"); |
|
132 aCall.PerformDialRequest(); |
|
133 } |
|
134 else if( !iPendingCall && iPendingCommand == ECSPNone ) |
|
135 { |
|
136 CSPLOGSTRING(CSPINT, |
|
137 "CSPCallCommandHandler::IndicateDialRequest delay dialing"); |
|
138 iPendingCall = &aCall; |
|
139 iPendingCommand = ECSPDialCall; |
|
140 } |
|
141 else |
|
142 { |
|
143 CSPLOGSTRING(CSPINT, |
|
144 "CSPCallCommandHandler::IndicateDialRequest ERROR already exists"); |
|
145 ret = KErrAlreadyExists; |
|
146 } |
|
147 return ret; |
|
148 } |
|
149 |
|
150 // --------------------------------------------------------------------------- |
|
151 // CSPCallCommandHandler::IndicateAnswerRequest |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 TInt CSPCallCommandHandler::IndicateAnswerRequest( MCCPCallCommandHandling& aCall ) |
|
155 |
|
156 { |
|
157 CSPLOGSTRING(CSPINT, "CSPCallCommandHandler::IndicateAnswerRequest" ); |
|
158 |
|
159 TInt ret( KErrNone ); |
|
160 |
|
161 if( !iActiveHangupArray.Count() ) |
|
162 { |
|
163 CSPLOGSTRING(CSPINT, |
|
164 "CSPCallCommandHandler::IndicateAnswerRequest answer"); |
|
165 aCall.PerformAnswerRequest(); |
|
166 } |
|
167 else if( !iPendingCall && iPendingCommand == ECSPNone ) |
|
168 { |
|
169 CSPLOGSTRING(CSPINT, |
|
170 "CSPCallCommandHandler::IndicateAnswerRequest delay answering"); |
|
171 iPendingCall = &aCall; |
|
172 iPendingCommand = ECSPAnswerCall; |
|
173 } |
|
174 else |
|
175 { |
|
176 CSPLOGSTRING(CSPINT, |
|
177 "CSPCallCommandHandler::IndicateAnswerRequest ERROR already exists"); |
|
178 ret = KErrAlreadyExists; |
|
179 } |
|
180 |
|
181 return ret; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // Constructs the monitor. |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 CSPCallCommandHandler::CSPCallCommandHandler() |
|
189 { |
|
190 CSPLOGSTRING(CSPOBJECT, "CSPCallCommandHandler::CSPCallCommandHandler"); |
|
191 } |
|
192 |
|
193 // End of File |
|