|
1 /* |
|
2 * Copyright (c) 2005 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: VoIP call status handling. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "btmcvoipline.h" |
|
19 #include "btmc_defs.h" |
|
20 #include "debug.h" |
|
21 #include "btmccallstatus.h" |
|
22 #include <ccallinformation.h> |
|
23 #include <mcall.h> |
|
24 #include <ccallinfoiter.h> |
|
25 #include <etelmm.h> |
|
26 |
|
27 // ========================================================== |
|
28 // CBtmcVoIPLine::NewL |
|
29 // |
|
30 // ========================================================== |
|
31 // |
|
32 CBtmcVoIPLine* CBtmcVoIPLine::NewL(CBtmcCallStatus& aParent, RMobilePhone& aPhone) |
|
33 { |
|
34 CBtmcVoIPLine* self = new (ELeave) CBtmcVoIPLine(aParent, aPhone); |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // ========================================================== |
|
42 // CBtmcVoIPLine::ConstructL |
|
43 // |
|
44 // ========================================================== |
|
45 // |
|
46 void CBtmcVoIPLine::ConstructL() |
|
47 { |
|
48 iInfo = CCallInformation::NewL(); |
|
49 iInfo->NotifyCallInformationChanges(*this); |
|
50 } |
|
51 |
|
52 // ========================================================== |
|
53 // CBtmcVoIPLine::Phone |
|
54 // |
|
55 // ========================================================== |
|
56 // |
|
57 RMobilePhone& CBtmcVoIPLine::Phone() |
|
58 { |
|
59 iPhone.Close(); |
|
60 return iPhone; |
|
61 } |
|
62 |
|
63 // ========================================================== |
|
64 // CBtmcVoIPLine::CallInformationL |
|
65 // |
|
66 // ========================================================== |
|
67 // |
|
68 const MCall& CBtmcVoIPLine::CallInformationL() |
|
69 { |
|
70 TRACE_FUNC_ENTRY |
|
71 CCallInfoIter& iter = iInfo->GetCallsL(); |
|
72 MCall *returnValue = NULL; |
|
73 for( iter.First(); !iter.IsDone(); iter.Next() ) |
|
74 { |
|
75 const MCall& call( iter.Current() ); |
|
76 if(call.CallType() == CCPCall::ECallTypePS) |
|
77 { |
|
78 returnValue = const_cast<MCall*> (&call); |
|
79 break; |
|
80 } |
|
81 } |
|
82 TRACE_FUNC_EXIT |
|
83 return *returnValue; |
|
84 } |
|
85 |
|
86 // ========================================================== |
|
87 // CBtmcVoIPLine::CallStatus |
|
88 // |
|
89 // ========================================================== |
|
90 // |
|
91 TInt CBtmcVoIPLine::CallStatusL() const |
|
92 { |
|
93 TRACE_FUNC_ENTRY |
|
94 CCallInfoIter& iter = iInfo->GetCallsL(); |
|
95 TInt mask = 0; |
|
96 for( iter.First(); !iter.IsDone(); iter.Next() ) |
|
97 { |
|
98 const MCall& call( iter.Current() ); |
|
99 if(call.CallType() == CCPCall::ECallTypePS) |
|
100 { |
|
101 TInt tempState = call.CallState(); |
|
102 switch(call.CallState()) |
|
103 { |
|
104 /** Indicates initial call state after call creation. Basic state. */ |
|
105 case CCPCall::EStateIdle: |
|
106 break; |
|
107 /** Indicates that the MT call is ringing but not answered yet by the local user. Basic state.*/ |
|
108 case CCPCall::EStateRinging: |
|
109 { |
|
110 mask |= KCallRingingBit; |
|
111 break; |
|
112 } |
|
113 /** MO Call: the network notifies to the MS that the remote party is now ringing. Basic state.*/ |
|
114 case CCPCall::EStateConnecting: |
|
115 { |
|
116 mask |= KCallConnectingBit; |
|
117 break; |
|
118 } |
|
119 /** Indicates that call is connected and active. Basic state.*/ |
|
120 case CCPCall::EStateConnected: |
|
121 { |
|
122 mask |= KCallConnectedBit; |
|
123 break; |
|
124 } |
|
125 /** Indicates that call is disconnecting. Basic state.*/ |
|
126 case CCPCall::EStateDisconnecting: |
|
127 break; |
|
128 |
|
129 /** Indicates that the call is connected but on hold. Basic state.*/ |
|
130 case CCPCall::EStateHold: |
|
131 { |
|
132 mask |= KCallHoldBit; |
|
133 break; |
|
134 } |
|
135 /** Call is transfering. Optional state.*/ |
|
136 case CCPCall::EStateTransferring: |
|
137 /** MO call is being forwarded at receiver end. Optional state. */ |
|
138 case CCPCall::EStateForwarding: |
|
139 /** Call is queued locally. Optional state. */ |
|
140 case CCPCall::EStateQueued: |
|
141 break; |
|
142 /** Indicates that the local user has answered the MT call but the network has not |
|
143 acknowledged the call connection yet. Must be sent after MCCPCall::Answer method has been completed. */ |
|
144 case CCPCall::EStateAnswering: |
|
145 { |
|
146 mask |= KCallAnsweringBit; |
|
147 break; |
|
148 } |
|
149 |
|
150 /** Indicates that the call is dialing. Must be sent after MCCPCall::Dial method has been completed. */ |
|
151 case CCPCall::EStateDialling: |
|
152 { |
|
153 mask |= KCallDiallingBit; |
|
154 break; |
|
155 } |
|
156 } |
|
157 } |
|
158 } |
|
159 TRACE_INFO((_L("Voip line, CALL STATUS 0x%08x"), mask)) |
|
160 TRACE_FUNC_EXIT |
|
161 return mask; |
|
162 } |
|
163 |
|
164 // ========================================================== |
|
165 // CBtmcVoIPLine::~CBtmcVoIPLine |
|
166 // Destructor |
|
167 // ========================================================== |
|
168 // |
|
169 CBtmcVoIPLine::~CBtmcVoIPLine() |
|
170 { |
|
171 if (iInfo != NULL) |
|
172 { |
|
173 iInfo->CancelNotification(); |
|
174 delete iInfo; |
|
175 } |
|
176 } |
|
177 |
|
178 // ========================================================== |
|
179 // CBtmcVoIPLine::ActiveCalls |
|
180 // Destructor |
|
181 // ========================================================== |
|
182 // |
|
183 const RPointerArray<CBtmcCallActive>& CBtmcVoIPLine::ActiveCalls() const |
|
184 { |
|
185 TRACE_FUNC |
|
186 return iCallActives; |
|
187 } |
|
188 |
|
189 // ========================================================== |
|
190 // CBtmcVoIPLine::CallInformationChanged |
|
191 // Callback |
|
192 // ========================================================== |
|
193 // |
|
194 void CBtmcVoIPLine::CallInformationChanged() |
|
195 { |
|
196 TRACE_FUNC |
|
197 TRAP_IGNORE( CallInformationChangedL() ); |
|
198 } |
|
199 |
|
200 // ========================================================== |
|
201 // CBtmcVoIPLine::CBtmcVoIPLine |
|
202 // Constructor |
|
203 // ========================================================== |
|
204 // |
|
205 CBtmcVoIPLine::CBtmcVoIPLine(CBtmcCallStatus& aParent, RMobilePhone& aPhone) : iParent(aParent), iPhone(aPhone) |
|
206 { |
|
207 } |
|
208 |
|
209 // ========================================================== |
|
210 // CBtmcVoIPLine::IsVoIP |
|
211 // Returns always ETrue |
|
212 // ========================================================== |
|
213 // |
|
214 TBool CBtmcVoIPLine::IsVoip() |
|
215 { |
|
216 return ETrue; |
|
217 } |
|
218 |
|
219 // ========================================================== |
|
220 // CBtmcVoIPLine::CallInformationChangedL |
|
221 // Pass the call status change to the owner of this if necessary |
|
222 // ========================================================== |
|
223 // |
|
224 void CBtmcVoIPLine::CallInformationChangedL() |
|
225 { |
|
226 TRACE_FUNC_ENTRY |
|
227 _LIT(KVoip, "VoIP"); |
|
228 _LIT(KVoipCall, "VoIP Call"); |
|
229 TPtrC voipPtr(KVoip); |
|
230 |
|
231 CCallInfoIter& iter = iInfo->GetCallsL(); |
|
232 for( iter.First(); !iter.IsDone(); iter.Next() ) |
|
233 { |
|
234 const MCall& call( iter.Current() ); |
|
235 if(call.CallType() == CCPCall::ECallTypePS) |
|
236 { |
|
237 switch(call.CallState()) |
|
238 { |
|
239 /** Indicates initial call state after call creation. Basic state. */ |
|
240 case CCPCall::EStateIdle: |
|
241 iParent.HandleMobileCallEventL( voipPtr , KVoipCall, RMobileCall::EStatusIdle); |
|
242 break; |
|
243 /** Indicates that the MT call is ringing but not answered yet by the local user. Basic state.*/ |
|
244 case CCPCall::EStateRinging: |
|
245 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusRinging); |
|
246 break; |
|
247 /** MO Call: the network notifies to the MS that the remote party is now ringing. Basic state.*/ |
|
248 case CCPCall::EStateConnecting: |
|
249 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusConnecting); |
|
250 break; |
|
251 /** Indicates that call is connected and active. Basic state.*/ |
|
252 case CCPCall::EStateConnected: |
|
253 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusConnected); |
|
254 break; |
|
255 /** Indicates that call is disconnecting. Basic state.*/ |
|
256 case CCPCall::EStateDisconnecting: |
|
257 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusDisconnecting); |
|
258 break; |
|
259 /** Indicates that the call is connected but on hold. Basic state.*/ |
|
260 case CCPCall::EStateHold: |
|
261 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusHold); |
|
262 break; |
|
263 /** Call is transfering. Optional state.*/ |
|
264 case CCPCall::EStateTransferring: |
|
265 /** MO call is being forwarded at receiver end. Optional state. */ |
|
266 case CCPCall::EStateForwarding: |
|
267 /** Call is queued locally. Optional state. */ |
|
268 case CCPCall::EStateQueued: |
|
269 break; |
|
270 /** Indicates that the local user has answered the MT call but the network has not |
|
271 acknowledged the call connection yet. Must be sent after MCCPCall::Answer method has been completed. */ |
|
272 case CCPCall::EStateAnswering: |
|
273 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusAnswering); |
|
274 break; |
|
275 /** Indicates that the call is dialing. Must be sent after MCCPCall::Dial method has been completed. */ |
|
276 case CCPCall::EStateDialling: |
|
277 iParent.HandleMobileCallEventL(voipPtr, KVoipCall, RMobileCall::EStatusDialling); |
|
278 break; |
|
279 } |
|
280 } |
|
281 } |
|
282 TRACE_FUNC_EXIT |
|
283 } |