24
|
1 |
// Copyright (c) 1997-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 |
#include "ET_SSTD.H"
|
|
17 |
#include "ETBUFFER.H"
|
|
18 |
#include <f32file.h>
|
|
19 |
#include "etsvr_slots.h"
|
|
20 |
#include "et_phone_util.h"
|
|
21 |
#include "et_patchdata.h"
|
|
22 |
//
|
|
23 |
//
|
|
24 |
// CFaxBase
|
|
25 |
//
|
|
26 |
//
|
|
27 |
EXPORT_C CFaxBase::CFaxBase()
|
|
28 |
//
|
|
29 |
// C'Tor
|
|
30 |
//
|
|
31 |
{
|
|
32 |
__DECLARE_NAME(_S("CFaxBase"));
|
|
33 |
}
|
|
34 |
|
|
35 |
EXPORT_C CFaxBase::~CFaxBase()
|
|
36 |
//
|
|
37 |
// D'Tor
|
|
38 |
//
|
|
39 |
{}
|
|
40 |
|
|
41 |
EXPORT_C CTelObject* CFaxBase::OpenNewObjectByNameL(const TDesC&)
|
|
42 |
//
|
|
43 |
// Always return NULL not allow CFaxBase Tsy object to create new object
|
|
44 |
//
|
|
45 |
{
|
|
46 |
User::Leave(KErrNotSupported);
|
|
47 |
return NULL;
|
|
48 |
}
|
|
49 |
|
|
50 |
EXPORT_C CTelObject* CFaxBase::OpenNewObjectL(TDes&)
|
|
51 |
//
|
|
52 |
// Always return NULL not allow CFaxBase Tsy object to create new object
|
|
53 |
//
|
|
54 |
{
|
|
55 |
User::Leave(KErrNotSupported);
|
|
56 |
return NULL;
|
|
57 |
}
|
|
58 |
|
|
59 |
EXPORT_C void CFaxBase::OpenPostProcessing(CTelSession*,const TInt)
|
|
60 |
//
|
|
61 |
// Perform post-processing after object has been added to session's CObjectIx.
|
|
62 |
//
|
|
63 |
{}
|
|
64 |
|
|
65 |
EXPORT_C void CFaxBase::CloseSubSessionPreProcessing(CTelSession* aSession,const TInt aSubSessionHandle)
|
|
66 |
{
|
|
67 |
CreateDummySession(aSession,aSubSessionHandle);
|
|
68 |
FlushReqs(aSession,aSubSessionHandle);
|
|
69 |
}
|
|
70 |
|
|
71 |
EXPORT_C TInt CFaxBase::CancelService(const TInt aIpc,const TTsyReqHandle /*aTsyReqHandle*/)
|
|
72 |
//
|
|
73 |
// Cancel Service for Fax
|
|
74 |
//
|
|
75 |
{
|
|
76 |
__ASSERT_ALWAYS((aIpc==EEtelFaxRead) ||
|
|
77 |
(aIpc==EEtelFaxWrite) ||
|
|
78 |
(aIpc==EEtelFaxWaitForEndOfPage)
|
|
79 |
,Fault(EEtelFaultInvalidIpcForCancel));
|
|
80 |
|
|
81 |
switch (aIpc)
|
|
82 |
{
|
|
83 |
// this is a special case for Fax session -
|
|
84 |
// count already increment before calling susession
|
|
85 |
// for those reqs below - server do expect Tsy to call ReqCompleted()
|
|
86 |
// so the count should be decrement again !
|
|
87 |
case EEtelFaxRead:
|
|
88 |
case EEtelFaxWrite:
|
|
89 |
case EEtelFaxWaitForEndOfPage:
|
|
90 |
return KErrNone;
|
|
91 |
// There is no individual cancel associated with these requests
|
|
92 |
default:
|
|
93 |
return KErrGeneral;
|
|
94 |
}
|
|
95 |
}
|
|
96 |
|
|
97 |
|
|
98 |
EXPORT_C TInt CFaxBase::Service(const RMessage2& /*aMessage*/,CReqEntry* aReqEntry)
|
|
99 |
//
|
|
100 |
// The ServiceL functionality for the fax
|
|
101 |
//
|
|
102 |
{
|
|
103 |
__ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage));
|
|
104 |
aReqEntry->iPlacedRequest=ETrue;
|
|
105 |
TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle;
|
|
106 |
TDes8* des1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
107 |
|
|
108 |
switch (aReqEntry->iFunction)
|
|
109 |
{
|
|
110 |
case EEtelFaxRead:
|
|
111 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
112 |
return Read(tsyReqHandle,des1);
|
|
113 |
case EEtelFaxWrite:
|
|
114 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
115 |
return Write(tsyReqHandle,des1);
|
|
116 |
case EEtelFaxWaitForEndOfPage:
|
|
117 |
return WaitForEndOfPage(tsyReqHandle);
|
|
118 |
case EEtelFaxTerminateFaxSession:
|
|
119 |
return TerminateFaxSession(tsyReqHandle);
|
|
120 |
default:
|
|
121 |
return KErrNotSupported;
|
|
122 |
}
|
|
123 |
}
|
|
124 |
|
|
125 |
|
|
126 |
EXPORT_C void CFaxBase::Init()
|
|
127 |
{}
|
|
128 |
|
|
129 |
EXPORT_C CTelObject::TReqMode CFaxBase::ReqModeL(const TInt aIpc)
|
|
130 |
//
|
|
131 |
// Fax Request Inquiry Functions
|
|
132 |
//
|
|
133 |
{
|
|
134 |
CTelObject::TReqMode mode=0;
|
|
135 |
switch (aIpc)
|
|
136 |
{
|
|
137 |
case EEtelFaxTerminateFaxSession:
|
|
138 |
// if two clients call this, only want the first to be acted upon
|
|
139 |
mode=KReqModeMultipleCompletionEnabled;
|
|
140 |
break;
|
|
141 |
case EEtelFaxRead:
|
|
142 |
case EEtelFaxWrite:
|
|
143 |
case EEtelFaxWaitForEndOfPage:
|
|
144 |
mode=KReqModeFlowControlObeyed;
|
|
145 |
break;
|
|
146 |
default:
|
|
147 |
User::Leave(KErrNotSupported);
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
return mode;
|
|
151 |
}
|
|
152 |
|
|
153 |
EXPORT_C TInt CFaxBase::NumberOfSlotsL(const TInt /*aIpc*/)
|
|
154 |
{
|
|
155 |
User::Leave(KErrNotSupported); // there are no repost immediately functions for fax
|
|
156 |
return KSlotNumbersDefault;
|
|
157 |
}
|
|
158 |
|
|
159 |
//
|
|
160 |
//
|
|
161 |
// CCallBase
|
|
162 |
//
|
|
163 |
//
|
|
164 |
EXPORT_C CCallBase::CCallBase()
|
|
165 |
//
|
|
166 |
// C'Tor
|
|
167 |
//
|
|
168 |
:iOwnershipStatus(EOwnedUnowned)
|
|
169 |
,iOwnerSession(NULL)
|
|
170 |
,iOwnerSubSessionHandle(0)
|
|
171 |
,iLoanDataPort(EFalse)
|
|
172 |
{
|
|
173 |
__DECLARE_NAME(_S("CCallBase"));
|
|
174 |
}
|
|
175 |
|
|
176 |
EXPORT_C CCallBase::~CCallBase()
|
|
177 |
//
|
|
178 |
// D'Tor
|
|
179 |
// Attual closing of the owner is done in CSubSessionBase destructor
|
|
180 |
// This is for all object inherit fron CSubSessionBase
|
|
181 |
//
|
|
182 |
{
|
|
183 |
LOGTEXT("~CCallBase");
|
|
184 |
}
|
|
185 |
|
|
186 |
EXPORT_C TInt CCallBase::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
187 |
//
|
|
188 |
// Cancel Service for Call
|
|
189 |
//
|
|
190 |
{
|
|
191 |
__ASSERT_ALWAYS((aIpc==EEtelCallNotifyHookChange) ||
|
|
192 |
(aIpc==EEtelCallNotifyStatusChange) ||
|
|
193 |
(aIpc==EEtelCallNotifyDurationChange) ||
|
|
194 |
(aIpc==EEtelCallCapsChangeNotification) ||
|
|
195 |
(aIpc==EEtelCallAcquireOwnership) ||
|
|
196 |
(aIpc==EEtelCallDial) ||
|
|
197 |
(aIpc==EEtelCallAnswer) ||
|
|
198 |
(aIpc==EEtelCallHangUp) ||
|
|
199 |
(aIpc==EEtelCallConnect)||
|
|
200 |
(aIpc==EEtelCallLoanDataPort)
|
|
201 |
,Fault(EEtelFaultInvalidIpcForCancel));
|
|
202 |
switch (aIpc)
|
|
203 |
{
|
|
204 |
case EEtelCallCapsChangeNotification:
|
|
205 |
return NotifyCapsChangeCancel(aTsyReqHandle);
|
|
206 |
case EEtelCallNotifyHookChange:
|
|
207 |
return NotifyHookChangeCancel(aTsyReqHandle);
|
|
208 |
case EEtelCallNotifyStatusChange:
|
|
209 |
return NotifyStatusChangeCancel(aTsyReqHandle);
|
|
210 |
case EEtelCallNotifyDurationChange:
|
|
211 |
return NotifyDurationChangeCancel(aTsyReqHandle);
|
|
212 |
case EEtelCallAcquireOwnership:
|
|
213 |
return AcquireOwnershipCancel(aTsyReqHandle);
|
|
214 |
case EEtelCallDial:
|
|
215 |
return DialCancel(aTsyReqHandle);
|
|
216 |
case EEtelCallConnect:
|
|
217 |
return ConnectCancel(aTsyReqHandle);
|
|
218 |
case EEtelCallAnswer:
|
|
219 |
return AnswerIncomingCallCancel(aTsyReqHandle);
|
|
220 |
case EEtelCallHangUp:
|
|
221 |
return HangUpCancel(aTsyReqHandle);
|
|
222 |
case EEtelCallLoanDataPort:
|
|
223 |
return LoanDataPortCancel(aTsyReqHandle);
|
|
224 |
default:
|
|
225 |
return KErrGeneral; // should never reached here
|
|
226 |
}
|
|
227 |
}
|
|
228 |
|
|
229 |
EXPORT_C void CCallBase::Init()
|
|
230 |
{}
|
|
231 |
|
|
232 |
EXPORT_C CCallBase::TCallOwnership CCallBase::CheckOwnership(const TTsyReqHandle aTsyReqHandle) const
|
|
233 |
//
|
|
234 |
// Tsy upcall function - return the call ownership status
|
|
235 |
//
|
|
236 |
{
|
|
237 |
CReqEntry* reqEntry=PhoneOwner()->FindByTsyHandle(aTsyReqHandle);
|
|
238 |
__ASSERT_ALWAYS(reqEntry!=NULL,Fault(EEtelFaultNotRecognisedTsyHandle));
|
|
239 |
RCall::TOwnershipStatus owner=CheckOwnershipBySession(reqEntry->iSession,reqEntry->iMessage.Int3());
|
|
240 |
|
|
241 |
if (owner==RCall::EOwnershipUnowned)
|
|
242 |
return EOwnedUnowned;
|
|
243 |
|
|
244 |
if (owner==RCall::EOwnershipOwnedByThisClient)
|
|
245 |
return EOwnedTrue;
|
|
246 |
|
|
247 |
if (owner==RCall::EOwnershipThisIsPriorityClient)
|
|
248 |
return EOwnedPriorityClient;
|
|
249 |
|
|
250 |
return EOwnedFalse;
|
|
251 |
}
|
|
252 |
|
|
253 |
EXPORT_C RCall::TOwnershipStatus CCallBase::CheckOwnershipBySession(CTelSession* aSession,const TInt /*aSubSessionHandle*/) const
|
|
254 |
//
|
|
255 |
// Return true if the owner
|
|
256 |
//
|
|
257 |
{
|
|
258 |
if (iOwnershipStatus==EOwnedUnowned)
|
|
259 |
return RCall::EOwnershipUnowned;
|
|
260 |
|
|
261 |
if(iOwnershipStatus==EOwnedTrue && iOwnerSession==aSession /*&& iOwnerSubSessionHandle==aSubSessionHandle*/) // ownership is session based!
|
|
262 |
return RCall::EOwnershipOwnedByThisClient;
|
|
263 |
|
|
264 |
// Ann changed
|
|
265 |
if (iOwnershipStatus==EOwnedTrue && aSession->TelServer()->IsPriorityClient(aSession))
|
|
266 |
return RCall::EOwnershipThisIsPriorityClient;
|
|
267 |
// end
|
|
268 |
|
|
269 |
return RCall::EOwnershipOwnedByAnotherClient;
|
|
270 |
}
|
|
271 |
|
|
272 |
EXPORT_C TInt CCallBase::SetUnowned()
|
|
273 |
//
|
|
274 |
// Return Owner ship status
|
|
275 |
//
|
|
276 |
{
|
|
277 |
iOwnershipStatus=EOwnedUnowned;
|
|
278 |
iOwnerSession=NULL; // set to invalid value
|
|
279 |
iOwnerSubSessionHandle=0;
|
|
280 |
|
|
281 |
return KErrNone;
|
|
282 |
}
|
|
283 |
|
|
284 |
EXPORT_C TInt CCallBase::SetOwnership(const TTsyReqHandle aTsyReqHandle)
|
|
285 |
//
|
|
286 |
// If owner ship if not own
|
|
287 |
//
|
|
288 |
{
|
|
289 |
CReqEntry* reqEntry=PhoneOwner()->FindByTsyHandle(aTsyReqHandle);
|
|
290 |
__ASSERT_ALWAYS(reqEntry!=NULL,Fault(EEtelFaultNotRecognisedTsyHandle));
|
|
291 |
|
|
292 |
iOwnershipStatus=EOwnedTrue;
|
|
293 |
iOwnerSession=reqEntry->iSession;
|
|
294 |
iOwnerSubSessionHandle=reqEntry->iMessage.Int3();
|
|
295 |
return KErrNone;
|
|
296 |
}
|
|
297 |
|
|
298 |
EXPORT_C TBool CCallBase::CheckPriorityClient(const TTsyReqHandle aTsyReqHandle) const
|
|
299 |
{
|
|
300 |
CReqEntry* reqEntry=PhoneOwner()->FindByTsyHandle(aTsyReqHandle);
|
|
301 |
__ASSERT_ALWAYS(reqEntry!=NULL,Fault(EEtelFaultNotRecognisedTsyHandle));
|
|
302 |
|
|
303 |
return reqEntry->iSession->TelServer()->IsPriorityClient(reqEntry->iSession);
|
|
304 |
}
|
|
305 |
|
|
306 |
EXPORT_C CCallBase* CCallBase::ResolveSubSessionHandle(const TTsyReqHandle aTsyReqHandle,
|
|
307 |
const TInt aSubSessionHandle)
|
|
308 |
//
|
|
309 |
// expects the subsession handle of a call, which must have been opened by the same client session
|
|
310 |
// which opened this call and called the current request (identified by aTsyReqHandle)
|
|
311 |
//
|
|
312 |
{
|
|
313 |
CReqEntry* reqEntry=PhoneOwner()->FindByTsyHandle(aTsyReqHandle);
|
|
314 |
__ASSERT_ALWAYS(reqEntry!=NULL,Fault(EEtelFaultNotRecognisedTsyHandle));
|
|
315 |
return REINTERPRET_CAST(CCallBase*,reqEntry->iSession->CObjectFromHandle(aSubSessionHandle));
|
|
316 |
}
|
|
317 |
|
|
318 |
EXPORT_C void CCallBase::OpenPostProcessing(CTelSession* ,const TInt)
|
|
319 |
//
|
|
320 |
// Perform post-processing after object has been added to session's CObjectIx.
|
|
321 |
//
|
|
322 |
{}
|
|
323 |
|
|
324 |
EXPORT_C void CCallBase::CloseSubSessionPreProcessing(CTelSession* aSession,const TInt aSubSessionHandle)
|
|
325 |
//
|
|
326 |
// Perform close post-processing before object being close
|
|
327 |
// if is owner then set to EUnOwned
|
|
328 |
//
|
|
329 |
{
|
|
330 |
LOGTEXT("CCallBase::CloseSubSessionPreProcessing() - about to create dummy session");
|
|
331 |
CreateDummySession(aSession,aSubSessionHandle);
|
|
332 |
RCall::TOwnershipStatus owner=CheckOwnershipBySession(aSession,aSubSessionHandle);
|
|
333 |
if (owner==RCall::EOwnershipOwnedByThisClient)
|
|
334 |
{
|
|
335 |
CreateDummySession(aSession,aSubSessionHandle,ETrue);
|
|
336 |
if (iLoanDataPort) // data port being on loan by this owner
|
|
337 |
RecoverDataPortAndRelinquishOwnership(); // inform tsy about this
|
|
338 |
else
|
|
339 |
RelinquishOwnership();
|
|
340 |
}
|
|
341 |
FlushReqs(aSession,aSubSessionHandle);
|
|
342 |
}
|
|
343 |
|
|
344 |
EXPORT_C void CCallBase::RelinquishOwnershipCompleted(const TInt aError)
|
|
345 |
//
|
|
346 |
// Server called Tsy with RelinquishOwnership()
|
|
347 |
// TSY should do a Up call with this function
|
|
348 |
//
|
|
349 |
{
|
|
350 |
__ASSERT_ALWAYS(aError==KErrNone,Fault(EEtelFaultCanNotRelinquishOwnership));
|
|
351 |
CheckAndDestroyDummySubSession();
|
|
352 |
}
|
|
353 |
|
|
354 |
EXPORT_C void CCallBase::RecoverDataPortAndRelinquishOwnershipCompleted(const TInt aError)
|
|
355 |
//
|
|
356 |
// Server called Tsy with RecoverDataPortAndRelinquishOwnership()
|
|
357 |
// TSY should do a Up call with this function
|
|
358 |
//
|
|
359 |
{
|
|
360 |
__ASSERT_ALWAYS(aError==KErrNone,Fault(EEtelFaultCanNotRelinquishOwnership));
|
|
361 |
iLoanDataPort=EFalse;
|
|
362 |
RelinquishOwnershipCompleted(aError);
|
|
363 |
}
|
|
364 |
|
|
365 |
EXPORT_C TInt CCallBase::Service(const RMessage2& aMessage,CReqEntry* aReqEntry)
|
|
366 |
//
|
|
367 |
// The ServiceL functionality for the call
|
|
368 |
//
|
|
369 |
{
|
|
370 |
__ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage));
|
|
371 |
aReqEntry->iPlacedRequest=ETrue;
|
|
372 |
TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle;
|
|
373 |
TDes8* des1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
374 |
TUint8* ptr1=Ptr1(des1);
|
|
375 |
switch (aReqEntry->iFunction)
|
|
376 |
{
|
|
377 |
|
|
378 |
// Asynchronous + Cancel
|
|
379 |
case EEtelCallCapsChangeNotification:
|
|
380 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
381 |
return NotifyCapsChange(tsyReqHandle,REINTERPRET_CAST(RCall::TCaps*,ptr1));
|
|
382 |
case EEtelCallCapsChangeNotificationCancel:
|
|
383 |
return NotifyCapsChangeCancel(tsyReqHandle);
|
|
384 |
case EEtelCallNotifyHookChange:
|
|
385 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
386 |
return NotifyHookChange(tsyReqHandle,REINTERPRET_CAST(RCall::THookStatus*,ptr1));
|
|
387 |
case EEtelCallNotifyHookChangeCancel:
|
|
388 |
return NotifyHookChangeCancel(tsyReqHandle);
|
|
389 |
|
|
390 |
case EEtelCallNotifyStatusChange:
|
|
391 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
392 |
return NotifyStatusChange(tsyReqHandle,REINTERPRET_CAST(RCall::TStatus*,ptr1));
|
|
393 |
case EEtelCallNotifyStatusChangeCancel:
|
|
394 |
return NotifyStatusChangeCancel(tsyReqHandle);
|
|
395 |
case EEtelCallNotifyDurationChange:
|
|
396 |
return NotifyDurationChange(tsyReqHandle,REINTERPRET_CAST(TTimeIntervalSeconds*,ptr1));
|
|
397 |
case EEtelCallNotifyDurationChangeCancel:
|
|
398 |
return NotifyDurationChangeCancel(tsyReqHandle);
|
|
399 |
case EEtelCallDial:
|
|
400 |
{
|
|
401 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
402 |
TDes* des2 = NULL;
|
|
403 |
des2 = BufferDes2u(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
404 |
__ASSERT_ALWAYS(des2!=NULL,Fault(EEtelFaultDes2DoesNotExist));
|
|
405 |
return Dial(tsyReqHandle,des1,des2);
|
|
406 |
}
|
|
407 |
case EEtelCallDialCancel:
|
|
408 |
return DialCancel(tsyReqHandle);
|
|
409 |
|
|
410 |
case EEtelCallConnect:
|
|
411 |
return Connect(tsyReqHandle,des1);
|
|
412 |
case EEtelCallConnectCancel:
|
|
413 |
return ConnectCancel(tsyReqHandle);
|
|
414 |
|
|
415 |
case EEtelCallAnswer:
|
|
416 |
return AnswerIncomingCall(tsyReqHandle,des1);
|
|
417 |
case EEtelCallAnswerCancel:
|
|
418 |
return AnswerIncomingCallCancel(tsyReqHandle);
|
|
419 |
|
|
420 |
case EEtelCallHangUp:
|
|
421 |
return HangUp(tsyReqHandle);
|
|
422 |
case EEtelCallHangUpCancel:
|
|
423 |
return HangUpCancel(tsyReqHandle);
|
|
424 |
|
|
425 |
case EEtelCallAcquireOwnership:
|
|
426 |
{
|
|
427 |
if (RCall::EOwnershipOwnedByThisClient==
|
|
428 |
CheckOwnershipBySession(aReqEntry->iSession,aMessage.Int3()))
|
|
429 |
return KErrEtelAlreadyCallOwner;
|
|
430 |
else
|
|
431 |
return AcquireOwnership(tsyReqHandle);
|
|
432 |
}
|
|
433 |
case EEtelCallAcquireOwnershipCancel:
|
|
434 |
return AcquireOwnershipCancel(tsyReqHandle);
|
|
435 |
|
|
436 |
// Synchronous
|
|
437 |
case EEtelCallGetInfo:
|
|
438 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
439 |
return GetInfo(tsyReqHandle,REINTERPRET_CAST(RCall::TCallInfo*,ptr1));
|
|
440 |
case EEtelCallGetStatus:
|
|
441 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
442 |
return GetStatus(tsyReqHandle,REINTERPRET_CAST(RCall::TStatus*,ptr1));
|
|
443 |
case EEtelCallGetCaps:
|
|
444 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
445 |
return GetCaps(tsyReqHandle,REINTERPRET_CAST(RCall::TCaps*,ptr1));
|
|
446 |
case EEtelCallLoanDataPort:
|
|
447 |
{
|
|
448 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
449 |
TInt ret=LoanDataPort(tsyReqHandle,REINTERPRET_CAST(RCall::TCommPort*,ptr1));
|
|
450 |
if (ret==KErrNone)
|
|
451 |
iLoanDataPort=ETrue;
|
|
452 |
return ret;
|
|
453 |
}
|
|
454 |
case EEtelCallLoanDataPortCancel:
|
|
455 |
return LoanDataPortCancel(tsyReqHandle);
|
|
456 |
|
|
457 |
case EEtelCallRecoverDataPort:
|
|
458 |
{
|
|
459 |
TInt ret=RecoverDataPort(tsyReqHandle);
|
|
460 |
if (ret==KErrNone)
|
|
461 |
iLoanDataPort=EFalse;
|
|
462 |
return ret;
|
|
463 |
}
|
|
464 |
|
|
465 |
case EEtelCallTransferOwnership:
|
|
466 |
return TransferOwnership(tsyReqHandle);
|
|
467 |
case EEtelCallGetBearerServiceInfo:
|
|
468 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
469 |
return GetBearerServiceInfo(tsyReqHandle,REINTERPRET_CAST(RCall::TBearerService*,ptr1));
|
|
470 |
|
|
471 |
case EEtelCallGetOwnershipStatus:
|
|
472 |
{
|
|
473 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
474 |
|
|
475 |
RCall::TOwnershipStatus* owner=REINTERPRET_CAST(RCall::TOwnershipStatus*,ptr1);
|
|
476 |
*owner=CheckOwnershipBySession(aReqEntry->iSession,aMessage.Int3());
|
|
477 |
ReqCompleted(tsyReqHandle,KErrNone);
|
|
478 |
return KErrNone;
|
|
479 |
}
|
|
480 |
|
|
481 |
case EEtelCallGetCallParams:
|
|
482 |
{
|
|
483 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
484 |
return GetCallParams(tsyReqHandle,des1);
|
|
485 |
}
|
|
486 |
case EEtelCallGetCallDuration:
|
|
487 |
{
|
|
488 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
489 |
return GetCallDuration(tsyReqHandle,REINTERPRET_CAST(TTimeIntervalSeconds*,ptr1));
|
|
490 |
}
|
|
491 |
case EEtelCallGetFaxSettings:
|
|
492 |
{
|
|
493 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
494 |
return GetFaxSettings(tsyReqHandle,REINTERPRET_CAST(RCall::TFaxSessionSettings*,ptr1));
|
|
495 |
}
|
|
496 |
|
|
497 |
case EEtelCallSetFaxSettings:
|
|
498 |
{
|
|
499 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
500 |
return SetFaxSettings(tsyReqHandle,REINTERPRET_CAST(RCall::TFaxSessionSettings*,ptr1));
|
|
501 |
}
|
|
502 |
case EEtelCallReferenceCount:
|
|
503 |
{
|
|
504 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
505 |
|
|
506 |
TInt* count=REINTERPRET_CAST(TInt*,ptr1);
|
|
507 |
*count=AccessCount();
|
|
508 |
ReqCompleted(tsyReqHandle,KErrNone);
|
|
509 |
return KErrNone;
|
|
510 |
}
|
|
511 |
case EEtelAdoptFaxSharedHeaderFile:
|
|
512 |
{
|
|
513 |
CFaxSharedFileHandles* fshare = NULL;
|
|
514 |
TRAPD(err, fshare = CFaxSharedFileHandles::NewL(aMessage));
|
|
515 |
if(err != KErrNone)
|
|
516 |
{
|
|
517 |
return err;
|
|
518 |
}
|
|
519 |
//Pass the CFaxSharedFileHandles object to the TSY. If call is successful then TSY assumes owenership of the object else we delete it.
|
|
520 |
TInt ret = SetFaxSharedHeaderFile(tsyReqHandle, fshare);
|
|
521 |
if(ret!= KErrNone)
|
|
522 |
{
|
|
523 |
delete fshare;
|
|
524 |
}
|
|
525 |
return ret;
|
|
526 |
}
|
|
527 |
default:
|
|
528 |
return ServiceExtFunc(aMessage,aReqEntry);
|
|
529 |
}
|
|
530 |
}
|
|
531 |
|
|
532 |
EXPORT_C RHandleBase* CCallBase::GlobalKernelObjectHandle()
|
|
533 |
{
|
|
534 |
if (iChunk.Handle() == KNullHandle) return NULL;
|
|
535 |
return &iChunk;
|
|
536 |
}
|
|
537 |
|
|
538 |
|
|
539 |
EXPORT_C RFax::TProgress* CCallBase::CreateFaxProgressChunk()
|
|
540 |
//
|
|
541 |
// Even if already created, return pointer to it
|
|
542 |
//
|
|
543 |
{
|
|
544 |
if (iChunk.Handle() == KNullHandle)
|
|
545 |
{
|
|
546 |
TInt r = iChunk.CreateGlobal(KNullDesC,sizeof (RFax::TProgress), sizeof (RFax::TProgress),EOwnerProcess);
|
|
547 |
if (r == KErrNone)
|
|
548 |
{
|
|
549 |
RFax::TProgress* progress = new(iChunk.Base()) RFax::TProgress;
|
|
550 |
progress->iLastUpdateTime = 0;
|
|
551 |
progress->iAnswerback.Zero ();
|
|
552 |
progress->iPhase = ENotYetStarted;
|
|
553 |
progress->iSpeed = 9600;
|
|
554 |
progress->iResolution = EFaxNormal;
|
|
555 |
progress->iCompression = EModifiedHuffman;
|
|
556 |
progress->iECM = 0;
|
|
557 |
progress->iPage = 0;
|
|
558 |
progress->iLines = 0;
|
|
559 |
return progress;
|
|
560 |
}
|
|
561 |
if (r != KErrNone)
|
|
562 |
return NULL;
|
|
563 |
|
|
564 |
}
|
|
565 |
return (RFax::TProgress*)iChunk.Base();
|
|
566 |
}
|
|
567 |
|
|
568 |
/**
|
|
569 |
Base implementation for virtual API declared in MCallBaseTSY. This base implementation always returns KErrNotSupported and
|
|
570 |
it is therefore necessary for TSYs who support this API to override this in their CCallBase derived class.
|
|
571 |
|
|
572 |
This function passes through a pointer to a heap-based CFaxSharedFileHandles object. This object is instantiated by Etel but
|
|
573 |
a successful return of this function will pass responsibility for deletion of aFaxSharedFileHandles from Etel server to the TSY.
|
|
574 |
If an error code is returned from this function (e.g. KErrNotSupported) Etel maintains ownership of the aFaxSharedFileHandles and
|
|
575 |
is responsible for its deletion.
|
|
576 |
|
|
577 |
TSY overrides of this function must correctly handle the cleanup of the aFaxSharedFileHandles object if they take ownership of it
|
|
578 |
which is implied when returning from this function with KErrNone.
|
|
579 |
|
|
580 |
@publishedPartner
|
|
581 |
@param aTsyReqHandle Handle to request.
|
|
582 |
@param aFaxSharedFileHandles CFaxSharedFileHandles instance to be stored in TSY.
|
|
583 |
@released Released v9.0 to allow a fax client to pass a file handle to the Fax server.
|
|
584 |
*/
|
|
585 |
EXPORT_C TInt CCallBase::SetFaxSharedHeaderFile(const TTsyReqHandle /*aTsyReqHandle*/, CFaxSharedFileHandles* /*aFaxSharedFileHandles*/)
|
|
586 |
{
|
|
587 |
return KErrNotSupported;
|
|
588 |
}
|
|
589 |
|
|
590 |
EXPORT_C void CCallBase::DeleteFaxProgressChunk()
|
|
591 |
{
|
|
592 |
iChunk.Close();
|
|
593 |
}
|
|
594 |
|
|
595 |
EXPORT_C CTelObject::TReqMode CCallBase::ReqModeL(const TInt aIpc)
|
|
596 |
//
|
|
597 |
// Basic Request Mode for Call
|
|
598 |
//
|
|
599 |
{
|
|
600 |
CTelObject::TReqMode mode=0;
|
|
601 |
switch (aIpc)
|
|
602 |
{
|
|
603 |
case EEtelCallNotifyHookChange:
|
|
604 |
case EEtelCallNotifyStatusChange:
|
|
605 |
case EEtelCallNotifyDurationChange:
|
|
606 |
case EEtelCallCapsChangeNotification:
|
|
607 |
mode=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
608 |
break;
|
|
609 |
case EEtelCallGetInfo:
|
|
610 |
case EEtelCallRecoverDataPort:
|
|
611 |
case EEtelCallGetStatus:
|
|
612 |
case EEtelCallGetCaps:
|
|
613 |
case EEtelCallTransferOwnership:
|
|
614 |
case EEtelCallAcquireOwnership:
|
|
615 |
case EEtelCallGetFaxSettings:
|
|
616 |
case EEtelCallGetCallParams:
|
|
617 |
case EEtelCallGetCallDuration:
|
|
618 |
case EEtelCallAnswer: // no longer obeys flow control since it may be placed long before
|
|
619 |
// a call arrives
|
|
620 |
break;
|
|
621 |
case EEtelCallGetOwnershipStatus:
|
|
622 |
case EEtelCallGetBearerServiceInfo:
|
|
623 |
case EEtelCallSetFaxSettings:
|
|
624 |
case EEtelAdoptFaxSharedHeaderFile:
|
|
625 |
case EEtelCallReferenceCount:
|
|
626 |
break;
|
|
627 |
case EEtelCallLoanDataPort:
|
|
628 |
case EEtelCallDial:
|
|
629 |
case EEtelCallConnect:
|
|
630 |
case EEtelCallHangUp:
|
|
631 |
|
|
632 |
mode=KReqModeFlowControlObeyed;
|
|
633 |
break;
|
|
634 |
|
|
635 |
default:
|
|
636 |
User::Leave(KErrNotSupported);
|
|
637 |
break;
|
|
638 |
}
|
|
639 |
return mode;
|
|
640 |
}
|
|
641 |
|
|
642 |
EXPORT_C TInt CCallBase::NumberOfSlotsL(const TInt aIpc)
|
|
643 |
{
|
|
644 |
switch (aIpc)
|
|
645 |
{
|
|
646 |
case EEtelCallNotifyHookChange:
|
|
647 |
case EEtelCallNotifyDurationChange:
|
|
648 |
break;
|
|
649 |
case EEtelCallNotifyStatusChange:
|
|
650 |
return KSlotNumbersCallStatusChange;
|
|
651 |
case EEtelCallCapsChangeNotification:
|
|
652 |
return KSlotNumbersCallCapsChange;
|
|
653 |
default:
|
|
654 |
User::Leave(KErrNotSupported);
|
|
655 |
break;
|
|
656 |
}
|
|
657 |
return KSlotNumbersDefault;
|
|
658 |
}
|
|
659 |
|
|
660 |
//
|
|
661 |
//
|
|
662 |
// CLineBase
|
|
663 |
//
|
|
664 |
//
|
|
665 |
EXPORT_C CLineBase::CLineBase()
|
|
666 |
//
|
|
667 |
// C'Tor
|
|
668 |
//
|
|
669 |
{
|
|
670 |
__DECLARE_NAME(_S("CLineBase"));
|
|
671 |
}
|
|
672 |
|
|
673 |
EXPORT_C CLineBase::~CLineBase()
|
|
674 |
//
|
|
675 |
// D'Tor
|
|
676 |
//
|
|
677 |
{
|
|
678 |
LOGTEXT("~CLineBase");
|
|
679 |
}
|
|
680 |
|
|
681 |
EXPORT_C TInt CLineBase::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
682 |
//
|
|
683 |
// Cancel Service for Line
|
|
684 |
//
|
|
685 |
{
|
|
686 |
__ASSERT_ALWAYS(( aIpc==EEtelLineNotifyIncomingCall ||
|
|
687 |
aIpc==EEtelLineNotifyHookChange ||
|
|
688 |
aIpc==EEtelLineNotifyStatusChange ||
|
|
689 |
aIpc==EEtelLineNotifyCallAdded ||
|
|
690 |
aIpc==EETelLineCapsChangeNotification)
|
|
691 |
,Fault(EEtelFaultInvalidIpcForCancel));
|
|
692 |
switch (aIpc)
|
|
693 |
{
|
|
694 |
case EEtelLineNotifyIncomingCall:
|
|
695 |
return NotifyIncomingCallCancel(aTsyReqHandle);
|
|
696 |
case EEtelLineNotifyHookChange:
|
|
697 |
return NotifyHookChangeCancel(aTsyReqHandle);
|
|
698 |
case EEtelLineNotifyStatusChange:
|
|
699 |
return NotifyStatusChangeCancel(aTsyReqHandle);
|
|
700 |
case EEtelLineNotifyCallAdded:
|
|
701 |
return NotifyCallAddedCancel(aTsyReqHandle);
|
|
702 |
case EETelLineCapsChangeNotification:
|
|
703 |
return NotifyCapsChangeCancel(aTsyReqHandle);
|
|
704 |
default:
|
|
705 |
return KErrGeneral; // should never reaches here
|
|
706 |
}
|
|
707 |
}
|
|
708 |
|
|
709 |
EXPORT_C TInt CLineBase::Service(const RMessage2& aMessage, CReqEntry* aReqEntry)
|
|
710 |
//
|
|
711 |
// The ServiceL Functionality for the Line
|
|
712 |
//
|
|
713 |
{
|
|
714 |
__ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage));
|
|
715 |
aReqEntry->iPlacedRequest=ETrue;
|
|
716 |
TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle;
|
|
717 |
TDes8* des1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
718 |
TUint8* ptr1=Ptr1(des1);
|
|
719 |
|
|
720 |
switch (aReqEntry->iFunction)
|
|
721 |
{
|
|
722 |
case EETelLineCapsChangeNotification:
|
|
723 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
724 |
return NotifyCapsChange(tsyReqHandle,REINTERPRET_CAST(RLine::TCaps*,ptr1));
|
|
725 |
case EETelLineCapsChangeNotificationCancel:
|
|
726 |
return NotifyCapsChangeCancel(tsyReqHandle);
|
|
727 |
case EEtelLineNotifyIncomingCall:
|
|
728 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
729 |
return NotifyIncomingCall(tsyReqHandle,REINTERPRET_CAST(TName*,ptr1));
|
|
730 |
case EEtelLineNotifyIncomingCallCancel:
|
|
731 |
return NotifyIncomingCallCancel(tsyReqHandle);
|
|
732 |
|
|
733 |
case EEtelLineNotifyHookChange:
|
|
734 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
735 |
return NotifyHookChange(tsyReqHandle,REINTERPRET_CAST(RCall::THookStatus*,ptr1));
|
|
736 |
case EEtelLineNotifyHookChangeCancel:
|
|
737 |
return NotifyHookChangeCancel(tsyReqHandle);
|
|
738 |
case EEtelLineNotifyStatusChange:
|
|
739 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
740 |
return NotifyStatusChange(tsyReqHandle,REINTERPRET_CAST(RCall::TStatus*,ptr1));
|
|
741 |
case EEtelLineNotifyStatusChangeCancel:
|
|
742 |
return NotifyStatusChangeCancel(tsyReqHandle);
|
|
743 |
case EEtelLineNotifyCallAdded:
|
|
744 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
745 |
return NotifyCallAdded(tsyReqHandle,REINTERPRET_CAST(TName*,ptr1));
|
|
746 |
case EEtelLineNotifyCallAddedCancel:
|
|
747 |
return NotifyCallAddedCancel(tsyReqHandle);
|
|
748 |
|
|
749 |
case EEtelLineGetHookStatus:
|
|
750 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
751 |
return GetHookStatus(tsyReqHandle,REINTERPRET_CAST(RCall::THookStatus*,ptr1));
|
|
752 |
|
|
753 |
case EEtelLineGetInfo:
|
|
754 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
755 |
return GetInfo(tsyReqHandle,REINTERPRET_CAST(RLine::TLineInfo*,ptr1));
|
|
756 |
case EEtelLineGetCaps:
|
|
757 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
758 |
return GetCaps(tsyReqHandle,REINTERPRET_CAST(RLine::TCaps*,ptr1));
|
|
759 |
case EEtelLineGetStatus:
|
|
760 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
761 |
return GetStatus(tsyReqHandle,REINTERPRET_CAST(RCall::TStatus*,ptr1));
|
|
762 |
case EEtelLineEnumerateCall:
|
|
763 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
764 |
return EnumerateCall(tsyReqHandle,REINTERPRET_CAST(TInt*,ptr1));
|
|
765 |
case EEtelLineGetCallInfo:
|
|
766 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
767 |
return GetCallInfo(tsyReqHandle,REINTERPRET_CAST(TCallInfoIndex*,ptr1));
|
|
768 |
default:
|
|
769 |
return ServiceExtFunc(aMessage,aReqEntry);
|
|
770 |
}
|
|
771 |
}
|
|
772 |
|
|
773 |
EXPORT_C void CLineBase::Init()
|
|
774 |
//
|
|
775 |
// not used for Line
|
|
776 |
//
|
|
777 |
{}
|
|
778 |
|
|
779 |
EXPORT_C void CLineBase::OpenPostProcessing(CTelSession*,const TInt)
|
|
780 |
//
|
|
781 |
// Perform post-processing after object has been added to session's CObjectIx.
|
|
782 |
//
|
|
783 |
{}
|
|
784 |
|
|
785 |
EXPORT_C void CLineBase::CloseSubSessionPreProcessing(CTelSession* aSession,const TInt aSubSessionHandle)
|
|
786 |
//
|
|
787 |
//
|
|
788 |
//
|
|
789 |
{
|
|
790 |
LOGTEXT("CLineBase::CloseSubSessionPreProcessing() - about to create dummy session");
|
|
791 |
CreateDummySession(aSession,aSubSessionHandle);
|
|
792 |
FlushReqs(aSession,aSubSessionHandle);
|
|
793 |
}
|
|
794 |
|
|
795 |
EXPORT_C CTelObject::TReqMode CLineBase::ReqModeL(const TInt aIpc)
|
|
796 |
//
|
|
797 |
// Mode Request Inquiry Functions
|
|
798 |
//
|
|
799 |
{
|
|
800 |
CTelObject::TReqMode mode=0;
|
|
801 |
switch (aIpc)
|
|
802 |
{
|
|
803 |
case EEtelLineGetCaps:
|
|
804 |
case EEtelLineGetStatus:
|
|
805 |
case EEtelLineGetHookStatus:
|
|
806 |
case EEtelLineEnumerateCall:
|
|
807 |
case EEtelLineGetCallInfo:
|
|
808 |
case EEtelLineGetInfo:
|
|
809 |
case EEtelLineNotifyIncomingCall: // 3/12/98 Removed Repost ability.
|
|
810 |
mode=KReqModeMultipleCompletionEnabled;
|
|
811 |
break;
|
|
812 |
case EEtelLineNotifyHookChange:
|
|
813 |
case EEtelLineNotifyStatusChange:
|
|
814 |
case EEtelLineNotifyCallAdded:
|
|
815 |
case EETelLineCapsChangeNotification:
|
|
816 |
mode=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
817 |
break;
|
|
818 |
default:
|
|
819 |
User::Leave(KErrNotSupported);
|
|
820 |
break;
|
|
821 |
}
|
|
822 |
return mode;
|
|
823 |
}
|
|
824 |
|
|
825 |
EXPORT_C TInt CLineBase::NumberOfSlotsL(const TInt aIpc)
|
|
826 |
{
|
|
827 |
switch (aIpc)
|
|
828 |
{
|
|
829 |
case EEtelLineNotifyHookChange:
|
|
830 |
case EETelLineCapsChangeNotification:
|
|
831 |
break;
|
|
832 |
case EEtelLineNotifyStatusChange:
|
|
833 |
return KSlotNumbersLineStatusChange;
|
|
834 |
case EEtelLineNotifyCallAdded:
|
|
835 |
return KSlotNumbersLineCallAddedChange;
|
|
836 |
default:
|
|
837 |
User::Leave(KErrNotSupported);
|
|
838 |
break;
|
|
839 |
}
|
|
840 |
return KSlotNumbersDefault;
|
|
841 |
}
|
|
842 |
|
|
843 |
//
|
|
844 |
//
|
|
845 |
// CPhoneBase
|
|
846 |
//
|
|
847 |
//
|
|
848 |
EXPORT_C CPhoneBase::CPhoneBase()
|
|
849 |
//
|
|
850 |
// CPhoneBase constructor
|
|
851 |
//
|
|
852 |
{
|
|
853 |
__DECLARE_NAME(_S("CPhoneBase"));
|
|
854 |
iReqWaitList.SetOffset(_FOFF(CReqEntry,iLink));
|
|
855 |
iReqActiveList.SetOffset(_FOFF(CReqEntry,iLink));
|
|
856 |
iTsyReqHandleCnt=TSY_HANDLE_INIT_VALUE;
|
|
857 |
}
|
|
858 |
|
|
859 |
EXPORT_C CPhoneBase::~CPhoneBase()
|
|
860 |
//
|
|
861 |
// CPhone destructor.
|
|
862 |
// Attual closing of the owner is done in CSubSessionBase destructor
|
|
863 |
// This is for all object inherit fron CSubSesissionBase
|
|
864 |
//
|
|
865 |
{
|
|
866 |
LOGTEXT("~CPhoneBase");
|
|
867 |
}
|
|
868 |
|
|
869 |
//
|
|
870 |
// Request List Manipulation Functions
|
|
871 |
//
|
|
872 |
CReqEntry* CPhoneBase::ActivateNextWaitingReq()
|
|
873 |
//
|
|
874 |
// Use: during completion to Activate the next waiting request
|
|
875 |
// Action: Find next Waiting Req, move to active, and return.
|
|
876 |
//
|
|
877 |
{
|
|
878 |
if(iReqWaitList.IsEmpty())
|
|
879 |
return NULL;
|
|
880 |
|
|
881 |
CReqEntry* reqEntry=iReqWaitList.First();
|
|
882 |
if(reqEntry==NULL)
|
|
883 |
return NULL;
|
|
884 |
reqEntry->iLink.Deque();
|
|
885 |
iReqActiveList.AddLast(*reqEntry);
|
|
886 |
if (reqEntry->iReqMode & KReqModeMultipleCompletionEnabled | KReqModeMultipleCompletionWithInterestLevel)
|
|
887 |
{
|
|
888 |
CReqEntry* otherClientsEntry;
|
|
889 |
TDblQueIter<CReqEntry> iter(iReqWaitList);
|
|
890 |
while(otherClientsEntry=iter++, otherClientsEntry!=NULL)
|
|
891 |
{
|
|
892 |
if(otherClientsEntry->iTsyReqHandle==reqEntry->iTsyReqHandle)
|
|
893 |
{
|
|
894 |
otherClientsEntry->iLink.Deque();
|
|
895 |
iReqActiveList.AddLast(*otherClientsEntry);
|
|
896 |
}
|
|
897 |
}
|
|
898 |
}
|
|
899 |
return reqEntry;
|
|
900 |
}
|
|
901 |
|
|
902 |
CReqEntry* CPhoneBase::FindByTsyHandleAndPlacedRequest(const TTsyReqHandle aTsyReqHandle)
|
|
903 |
//
|
|
904 |
// Use: to search active req list for a single req, remove and then return it. Can be called repeatedly for Notification
|
|
905 |
//
|
|
906 |
{
|
|
907 |
CReqEntry* reqEntry;
|
|
908 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
909 |
while(reqEntry=iter++, reqEntry!=NULL)
|
|
910 |
{
|
|
911 |
if(reqEntry->iTsyReqHandle==aTsyReqHandle && reqEntry->iPlacedRequest)
|
|
912 |
return reqEntry;
|
|
913 |
}
|
|
914 |
return NULL;
|
|
915 |
}
|
|
916 |
|
|
917 |
CReqEntry* CPhoneBase::FindByTsyHandle(const TTsyReqHandle aTsyReqHandle)
|
|
918 |
//
|
|
919 |
// Use: to search active req list for a single req, remove and then return it. Can be called repeatedly for Notification
|
|
920 |
//
|
|
921 |
{
|
|
922 |
CReqEntry* reqEntry;
|
|
923 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
924 |
while(reqEntry=iter++, reqEntry!=NULL)
|
|
925 |
{
|
|
926 |
if(reqEntry->iTsyReqHandle==aTsyReqHandle)
|
|
927 |
return reqEntry;
|
|
928 |
}
|
|
929 |
return NULL;
|
|
930 |
}
|
|
931 |
|
|
932 |
EXPORT_C TInt CPhoneBase::FindSessionByTsyHandle(const TTsyReqHandle aTsyReqHandle)
|
|
933 |
{
|
|
934 |
CReqEntry* reqEntry = FindByTsyHandle(aTsyReqHandle);
|
|
935 |
if (!reqEntry)
|
|
936 |
{
|
|
937 |
// TODO we'd need to ensure the subsession handle was positive
|
|
938 |
// to be able to return an error. Shifting the pointer >>1
|
|
939 |
// would ensure this.
|
|
940 |
return KErrNotFound;
|
|
941 |
}
|
|
942 |
return reinterpret_cast<TInt>(reqEntry->iSession);
|
|
943 |
}
|
|
944 |
|
|
945 |
EXPORT_C TInt CPhoneBase::FindSubSessionByTsyHandle(const TTsyReqHandle aTsyReqHandle)
|
|
946 |
{
|
|
947 |
CReqEntry* reqEntry = FindByTsyHandle(aTsyReqHandle);
|
|
948 |
if (!reqEntry)
|
|
949 |
{
|
|
950 |
return KErrNotFound;
|
|
951 |
}
|
|
952 |
return reqEntry->iMessage.Int3();
|
|
953 |
}
|
77
|
954 |
|
24
|
955 |
void CPhoneBase::UpdateBuffer(CReqEntry* aUpdatedReqEntry,CReqEntry* aReqEntry)
|
|
956 |
//
|
|
957 |
// Is passed both the TSY-updated request entry (which may be multi-buffered or not)
|
|
958 |
// and another request entry which is to have the data copied into it (which again may or may
|
|
959 |
// not be multi-buffered) copies the latest data into the target request entry.
|
|
960 |
//
|
|
961 |
{
|
|
962 |
__ASSERT_ALWAYS(aUpdatedReqEntry->iFunction==aReqEntry->iFunction,Fault(EEtelFaultUpdatingBufferOfDifferentIpc));
|
|
963 |
TInt msgType = aReqEntry->iMessage.Int1();
|
|
964 |
if (msgType==EIsaNarrowAndUnicodeDoubleDesTobeRead)
|
|
965 |
{
|
|
966 |
TDes8* targetDes1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
967 |
TDes16* targetDes2 = BufferDes2u(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
968 |
TDes8* sourceDes1 = BufferDes1(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
969 |
TDes16* sourceDes2 = BufferDes2u(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
970 |
if (sourceDes1!=targetDes1)
|
|
971 |
{
|
|
972 |
targetDes1->Copy(*sourceDes1);
|
|
973 |
if (targetDes2)
|
|
974 |
targetDes2->Copy(*sourceDes2);
|
|
975 |
aReqEntry->iBuffer->IncWrite();
|
|
976 |
}
|
|
977 |
return;
|
|
978 |
}
|
|
979 |
if (aUpdatedReqEntry->iSession->IsUnicodeReq(msgType))
|
|
980 |
{
|
|
981 |
TDes16* targetDes1 = BufferDes1u(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
982 |
TDes16* targetDes2 = BufferDes2u(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
983 |
TDes16* sourceDes1 = BufferDes1u(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
984 |
TDes16* sourceDes2 = BufferDes2u(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
985 |
if (sourceDes1!=targetDes1)
|
|
986 |
{
|
|
987 |
targetDes1->Copy(*sourceDes1);
|
|
988 |
if (targetDes2)
|
|
989 |
targetDes2->Copy(*sourceDes2);
|
|
990 |
aReqEntry->iBuffer->IncWrite();
|
|
991 |
}
|
|
992 |
}
|
|
993 |
else // this is narrow
|
|
994 |
{
|
|
995 |
TDes8* targetDes1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
996 |
TDes8* targetDes2 = BufferDes2(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
997 |
TDes8* sourceDes1 = BufferDes1(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
998 |
TDes8* sourceDes2 = BufferDes2(aUpdatedReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
999 |
if (sourceDes1!=targetDes1)
|
|
1000 |
{
|
|
1001 |
targetDes1->Copy(*sourceDes1);
|
|
1002 |
if (targetDes2)
|
|
1003 |
targetDes2->Copy(*sourceDes2);
|
|
1004 |
aReqEntry->iBuffer->IncWrite();
|
|
1005 |
}
|
|
1006 |
}
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
CReqEntry* CPhoneBase::FindClientInWaiting(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc)
|
|
1010 |
//
|
|
1011 |
// Used to search waiting list for a req that's to be cancelled.
|
|
1012 |
// If non-Null is returned it will have been removed by this function and can be completed by the caller.
|
|
1013 |
//
|
|
1014 |
{
|
|
1015 |
CReqEntry* reqEntry;
|
|
1016 |
TDblQueIter<CReqEntry> iter(iReqWaitList);
|
|
1017 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1018 |
{
|
|
1019 |
if((reqEntry->iSession==aSession)&&(reqEntry->iMessage.Int3()==aSubSessionHandle)&&(reqEntry->iFunction==aIpc))
|
|
1020 |
return reqEntry;
|
|
1021 |
}
|
|
1022 |
return NULL;
|
|
1023 |
}
|
|
1024 |
|
|
1025 |
CReqEntry* CPhoneBase::FindClientInActive(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc)
|
|
1026 |
//
|
|
1027 |
// Used to search the active req list for a req that's to be cancelled.
|
|
1028 |
// The function will return any req entry found, by the caller does not know to pass the cancel down until a search has been done just on the aIpc
|
|
1029 |
//
|
|
1030 |
{
|
|
1031 |
CReqEntry* reqEntry;
|
|
1032 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
1033 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1034 |
{
|
|
1035 |
if((reqEntry->iSession==aSession)&&(reqEntry->iMessage.Int3()==aSubSessionHandle)&&(reqEntry->iFunction==aIpc))
|
|
1036 |
return reqEntry;
|
|
1037 |
}
|
|
1038 |
return NULL;
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
CReqEntry* CPhoneBase::FindByIpcAndTelObject(const TInt aIpc, const CTelObject* aTelObject, const TUint aBufSize)
|
|
1042 |
//
|
|
1043 |
// Finds an active request by both IPC and by the TelObject it was placed on
|
|
1044 |
//
|
|
1045 |
{
|
|
1046 |
CReqEntry* reqEntry;
|
|
1047 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
1048 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1049 |
{
|
|
1050 |
if(reqEntry->iFunction==aIpc && reqEntry->iTelObject==aTelObject
|
|
1051 |
&& reqEntry->iBuffer->Size() == aBufSize)
|
|
1052 |
return reqEntry;
|
|
1053 |
}
|
|
1054 |
return NULL;
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
CReqEntry* CPhoneBase::FindByIpcAndTelObjectInWaiting(const TInt aIpc, const CTelObject* aTelObject, const TUint aBufSize)
|
|
1058 |
//
|
|
1059 |
// Finds a waiting request by both IPC and by the TelObject it was placed on
|
|
1060 |
//
|
|
1061 |
{
|
|
1062 |
CReqEntry* reqEntry;
|
|
1063 |
TDblQueIter<CReqEntry> iter(iReqWaitList);
|
|
1064 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1065 |
{
|
|
1066 |
if(reqEntry->iFunction==aIpc && reqEntry->iTelObject==aTelObject
|
|
1067 |
&& reqEntry->iBuffer->Size() == aBufSize)
|
|
1068 |
return reqEntry;
|
|
1069 |
}
|
|
1070 |
return NULL;
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
void CPhoneBase::AddReqToActive(CReqEntry* aReqEntry)
|
|
1074 |
//
|
|
1075 |
// Add reqEntry to the 'active list'
|
|
1076 |
//
|
|
1077 |
{
|
|
1078 |
LOGTEXT2("CPhoneBase::AddReqToActive with TsyHandle of %d", aReqEntry->iTsyReqHandle);
|
|
1079 |
iReqActiveList.AddLast(*aReqEntry);
|
|
1080 |
}
|
|
1081 |
|
|
1082 |
void CPhoneBase::AddReqToWaiting(CReqEntry* aReqEntry)
|
|
1083 |
//
|
|
1084 |
// Add entry to the 'wait list'
|
|
1085 |
//
|
|
1086 |
{
|
|
1087 |
LOGTEXT2("CPhoneBase::AddReqToWaiting with TsyHandle of %d", aReqEntry->iTsyReqHandle);
|
|
1088 |
iReqWaitList.AddLast(*aReqEntry);
|
|
1089 |
}
|
|
1090 |
|
|
1091 |
TTsyReqHandle CPhoneBase::TsyReqHandle()
|
|
1092 |
//
|
|
1093 |
// Return the request handle if wrap round avoid assigned to TSY_HANDLE_INIT_VALUE
|
|
1094 |
//
|
|
1095 |
{
|
|
1096 |
iTsyReqHandleCnt++ ;
|
|
1097 |
if (iTsyReqHandleCnt==TSY_HANDLE_INIT_VALUE)
|
|
1098 |
iTsyReqHandleCnt=(TSY_HANDLE_INIT_VALUE+1);
|
|
1099 |
return iTsyReqHandleCnt;
|
|
1100 |
}
|
|
1101 |
|
|
1102 |
CReqEntry* CPhoneBase::NewReqL(const RMessage2& aMessage, CTelSession* aSession,CBuffer* aBuffer,
|
|
1103 |
const CTelObject* aTelObject,TInt aFunction)
|
|
1104 |
//
|
|
1105 |
// Create new req entry
|
|
1106 |
//
|
|
1107 |
{
|
|
1108 |
return CReqEntry::NewL(TsyReqHandle(),aMessage,aSession,aBuffer,aTelObject,aFunction,aSession->EmergencyClientHeap(aMessage.Int1()));
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
CReqEntry* CPhoneBase::FindSameClientEntry(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc)
|
|
1112 |
//
|
|
1113 |
// Seaching for duplicate request and panic client is return not NULL
|
|
1114 |
//
|
|
1115 |
{
|
|
1116 |
CReqEntry* reqEntry=FindClientInWaiting(aSession,aSubSessionHandle,aIpc);
|
|
1117 |
|
|
1118 |
if (reqEntry!=NULL)
|
|
1119 |
return reqEntry;
|
|
1120 |
else // not found in waiting
|
|
1121 |
reqEntry=FindClientInActive(aSession,aSubSessionHandle,aIpc);
|
|
1122 |
return reqEntry;
|
|
1123 |
|
|
1124 |
}
|
|
1125 |
|
|
1126 |
EXPORT_C void CPhoneBase::OpenPostProcessing(CTelSession*,const TInt)
|
|
1127 |
//
|
|
1128 |
// Perform post-processing after object has been added to session's CObjectIx.
|
|
1129 |
//
|
|
1130 |
{}
|
|
1131 |
|
|
1132 |
EXPORT_C void CPhoneBase::CloseSubSessionPreProcessing(CTelSession* aSession,const TInt aSubSessionHandle)
|
|
1133 |
//
|
|
1134 |
// Find if any active request if so create a dummy session
|
|
1135 |
//
|
|
1136 |
{
|
|
1137 |
LOGTEXT("CPhoneBase::CloseSubSessionPreProcessing");
|
|
1138 |
CreateDummySession(aSession,aSubSessionHandle);
|
|
1139 |
FlushReqs(aSession,aSubSessionHandle);
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
EXPORT_C TInt CPhoneBase::Service(const RMessage2& aMessage, CReqEntry* aReqEntry)
|
|
1143 |
//
|
|
1144 |
// The ServiceL functionality for the phone
|
|
1145 |
//
|
|
1146 |
{
|
|
1147 |
__ASSERT_ALWAYS(aReqEntry!=NULL,Fault(EEtelFaultCallTsyServiceWithoutReqPackage));
|
|
1148 |
aReqEntry->iPlacedRequest=ETrue;
|
|
1149 |
TTsyReqHandle tsyReqHandle=aReqEntry->iTsyReqHandle;
|
|
1150 |
TDes8* des1 = BufferDes1(aReqEntry->iBuffer,CBuffer::ESlotWrite);
|
|
1151 |
TUint8* ptr1=Ptr1(des1);
|
|
1152 |
switch (aReqEntry->iFunction)
|
|
1153 |
{
|
|
1154 |
case EETelPhoneCapsChangeNotification:
|
|
1155 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1156 |
return NotifyCapsChange(tsyReqHandle,REINTERPRET_CAST(RPhone::TCaps*,ptr1));
|
|
1157 |
case EETelPhoneCapsChangeNotificationCancel:
|
|
1158 |
return NotifyCapsChangeCancel(tsyReqHandle);
|
|
1159 |
case EEtelPhoneInitialise:
|
|
1160 |
return ControlledInitialisation(tsyReqHandle);
|
|
1161 |
case EEtelPhoneInitialiseCancel:
|
|
1162 |
return ControlledInitialisationCancel(tsyReqHandle);
|
|
1163 |
case EEtelPhoneNotifyModemDetected:
|
|
1164 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1165 |
return NotifyModemDetected(tsyReqHandle,REINTERPRET_CAST(RPhone::TModemDetection*,ptr1) );
|
|
1166 |
case EEtelPhoneNotifyModemDetectedCancel:
|
|
1167 |
return NotifyModemDetectedCancel(tsyReqHandle);
|
|
1168 |
case EEtelPhoneGetInfo:
|
|
1169 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1170 |
return GetInfo(tsyReqHandle,REINTERPRET_CAST(RPhone::TPhoneInfo*,ptr1));
|
|
1171 |
case EEtelPhoneGetCaps:
|
|
1172 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1173 |
return GetCaps(tsyReqHandle,REINTERPRET_CAST(RPhone::TCaps*,ptr1));
|
|
1174 |
case EEtelPhoneGetStatus:
|
|
1175 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1176 |
return GetStatus(tsyReqHandle,REINTERPRET_CAST(RPhone::TStatus*,ptr1));
|
|
1177 |
case EEtelPhoneEnumerateLines:
|
|
1178 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1179 |
return EnumerateLines(tsyReqHandle,REINTERPRET_CAST(TInt*,ptr1));
|
|
1180 |
case EEtelPhoneGetLineInfo:
|
|
1181 |
__ASSERT_ALWAYS(des1!=NULL,Fault(EETelFaultRequestWithoutBuffer));
|
|
1182 |
return GetLineInfo(tsyReqHandle,REINTERPRET_CAST(TLineInfoIndex*,ptr1));
|
|
1183 |
default:
|
|
1184 |
return ServiceExtFunc(aMessage,aReqEntry);
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
EXPORT_C TInt CPhoneBase::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
1189 |
//
|
|
1190 |
// Cancel Outstanding service for the phone
|
|
1191 |
//
|
|
1192 |
{
|
|
1193 |
switch (aIpc)
|
|
1194 |
{
|
|
1195 |
case EEtelPhoneNotifyModemDetected:
|
|
1196 |
return NotifyModemDetectedCancel(aTsyReqHandle);
|
|
1197 |
case EETelPhoneCapsChangeNotification:
|
|
1198 |
return NotifyCapsChangeCancel(aTsyReqHandle);
|
|
1199 |
case EEtelPhoneInitialise:
|
|
1200 |
return ControlledInitialisationCancel(aTsyReqHandle);
|
|
1201 |
default:
|
|
1202 |
return KErrGeneral;
|
|
1203 |
}
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
CReqEntry* CPhoneBase::FindClientReqInWaitList(CTelSession* aSession,const TInt aSubSessionHandle)
|
|
1207 |
//
|
|
1208 |
// Find first entry already logged by this client - in wait list
|
|
1209 |
//
|
|
1210 |
{
|
|
1211 |
CReqEntry* reqEntry;
|
|
1212 |
TDblQueIter<CReqEntry> iter(iReqWaitList);
|
|
1213 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1214 |
{
|
|
1215 |
if(aSession==reqEntry->iSession && aSubSessionHandle==reqEntry->iMessage.Int3())
|
|
1216 |
return reqEntry;
|
|
1217 |
}
|
|
1218 |
return NULL;
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
CReqEntry* CPhoneBase::FindThisReqByAnotherClient(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc,const TUint aBufSize,const CTelObject* aThisTelObject)
|
|
1222 |
//
|
|
1223 |
// Find this IPC in active list, placed by a different client
|
|
1224 |
//
|
|
1225 |
{
|
|
1226 |
CReqEntry* reqEntry;
|
|
1227 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
1228 |
while(reqEntry=iter++,reqEntry!=NULL)
|
|
1229 |
{
|
|
1230 |
if((aSession!=reqEntry->iSession || aSubSessionHandle!=reqEntry->iMessage.Int3())
|
|
1231 |
&& reqEntry->iFunction==aIpc && reqEntry->iTelObject==aThisTelObject
|
|
1232 |
&& reqEntry->iBuffer->Size()==aBufSize)
|
|
1233 |
{
|
|
1234 |
return reqEntry;
|
|
1235 |
}
|
|
1236 |
}
|
|
1237 |
return NULL;
|
|
1238 |
}
|
|
1239 |
|
|
1240 |
CReqEntry* CPhoneBase::FindNonCancelledClientReq(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc)
|
|
1241 |
//
|
|
1242 |
// Find this IPC in active list, placed by this client but not the one which placed request on TSY
|
|
1243 |
//
|
|
1244 |
{
|
|
1245 |
CReqEntry* reqEntry;
|
|
1246 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
1247 |
while(reqEntry=iter++,reqEntry!=NULL)
|
|
1248 |
{
|
|
1249 |
if(aSession==reqEntry->iSession && aSubSessionHandle==reqEntry->iMessage.Int3() && reqEntry->iFunction==aIpc && reqEntry->iCancelFnCalled==EFalse)
|
|
1250 |
{
|
|
1251 |
return reqEntry;
|
|
1252 |
}
|
|
1253 |
}
|
|
1254 |
return NULL;
|
|
1255 |
}
|
|
1256 |
|
|
1257 |
void CPhoneBase::CheckAndCompleteAllActive(CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aIpc,const TInt aError)
|
|
1258 |
//
|
|
1259 |
// Cycles through active list, checking for any requests with the same IPC value and if
|
|
1260 |
// registered, copying the data from the buffer that the TSY filled in to this buffer. All those
|
|
1261 |
// with the same IPC are completed up to the client (if the client is ready).
|
|
1262 |
//
|
|
1263 |
{
|
|
1264 |
CReqEntry* reqEntry;
|
|
1265 |
TDblQueIter<CReqEntry> iter(iReqActiveList);
|
|
1266 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1267 |
{
|
|
1268 |
if(reqEntry->iFunction==aIpc && reqEntry!=aUpdatedReqEntry
|
|
1269 |
&& reqEntry->iTelObject==aUpdatedReqEntry->iTelObject
|
|
1270 |
&& reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size())
|
|
1271 |
{
|
|
1272 |
UpdateBuffer(aUpdatedReqEntry,reqEntry);
|
|
1273 |
TInt error = ResolveError(reqEntry->iSession,aError); // set error as either low or high byte
|
|
1274 |
if (aReqMode & KReqModeRePostImmediately)
|
|
1275 |
UpdateAndCompleteIfNecessary(reqEntry,error);
|
|
1276 |
else
|
|
1277 |
WriteBackAndCompleteReq(reqEntry,error);
|
|
1278 |
}
|
|
1279 |
}
|
|
1280 |
}
|
|
1281 |
|
|
1282 |
|
|
1283 |
// The delivery object performs the task of delivering the request to the
|
|
1284 |
// client. It loops through the clients in priority order and gives each
|
|
1285 |
// client a fixed amount of time to either accept or reject. At the end
|
|
1286 |
// the request will either be allocated or discarded (if no one wants it).
|
|
1287 |
|
|
1288 |
CMmDeliveryObject* CMmDeliveryObject::NewL( CTelObject& aTelObject )
|
|
1289 |
{
|
|
1290 |
CMmDeliveryObject* self=new(ELeave) CMmDeliveryObject( aTelObject );
|
|
1291 |
CleanupStack::PushL( self );
|
|
1292 |
self->ConstructL();
|
|
1293 |
CleanupStack::Pop( self );
|
|
1294 |
return self;
|
|
1295 |
}
|
|
1296 |
|
|
1297 |
CMmDeliveryObject::CMmDeliveryObject( CTelObject& aTelObject ) :
|
|
1298 |
CActive(EPriorityStandard), iTelObject(aTelObject)
|
|
1299 |
{
|
|
1300 |
CActiveScheduler::Add( this );
|
|
1301 |
}
|
|
1302 |
|
|
1303 |
void CMmDeliveryObject::ConstructL()
|
|
1304 |
{
|
|
1305 |
User::LeaveIfError( iDeliveryTimer.CreateLocal() );
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
CMmDeliveryObject::~CMmDeliveryObject()
|
|
1309 |
{
|
|
1310 |
Cancel();
|
|
1311 |
iDeliveryTimer.Close();
|
|
1312 |
iPendingReqs.Close();
|
|
1313 |
}
|
|
1314 |
|
|
1315 |
void CMmDeliveryObject::DoCancel()
|
|
1316 |
{
|
|
1317 |
iDeliveryTimer.Cancel();
|
|
1318 |
}
|
|
1319 |
|
|
1320 |
// Called either when we need to attempt delivery of a request.
|
|
1321 |
// Can be due to:
|
|
1322 |
// 1) the start of the delivery process.
|
|
1323 |
// 2) a client rejecting the request which makes us try the next one.
|
|
1324 |
// 3) a client timing out which makes us try the next one.
|
|
1325 |
void CMmDeliveryObject::RunL()
|
|
1326 |
{
|
|
1327 |
|
|
1328 |
if ( iStatus == KErrNone && iUpdatedReqEntry)
|
|
1329 |
{
|
|
1330 |
|
|
1331 |
TInterestCategory interestCategory;
|
|
1332 |
iCurrentReq = NULL;
|
|
1333 |
iCurrentReq = HighestPriorityReq(interestCategory);
|
|
1334 |
|
|
1335 |
if ( iCurrentReq )
|
|
1336 |
{
|
|
1337 |
if (iUpdatedReqEntry!=iCurrentReq)
|
|
1338 |
{
|
|
1339 |
iTelObject.PhoneOwner()->UpdateBuffer(iUpdatedReqEntry,iCurrentReq);
|
|
1340 |
}
|
|
1341 |
|
|
1342 |
// Offer incoming message to interested clients one at a time.
|
|
1343 |
// Initially the priority client followed by Standard category clients.
|
|
1344 |
OfferToClient( iCurrentReq );
|
|
1345 |
|
|
1346 |
// Client will have a certain time in which to accept/reject the message.
|
|
1347 |
// After which it will be offered to the next client.
|
|
1348 |
switch ( interestCategory )
|
|
1349 |
{
|
|
1350 |
case EInterestCategoryPriority:
|
|
1351 |
iDeliveryTimer.After( iStatus, (KUssdOfferDialogueTimeout * KUssdPriorityTimeoutPercentage)/100 );
|
|
1352 |
SetActive();
|
|
1353 |
break;
|
|
1354 |
case EInterestCategoryStandard:
|
|
1355 |
iDeliveryTimer.After( iStatus, iTimeSlice );
|
|
1356 |
SetActive();
|
|
1357 |
break;
|
|
1358 |
case EInterestCategoryDefault:
|
77
|
1359 |
// wait on default client (no timeout)
|
24
|
1360 |
break;
|
|
1361 |
default:
|
|
1362 |
// No more clients
|
|
1363 |
Clear();
|
|
1364 |
} // end switch
|
|
1365 |
}
|
|
1366 |
else
|
|
1367 |
{
|
|
1368 |
iTelObject.RepostRequest( iUpdatedReqEntry, KErrNone );
|
|
1369 |
|
|
1370 |
// No more clients left to check
|
|
1371 |
Clear();
|
|
1372 |
}
|
|
1373 |
}
|
|
1374 |
else
|
|
1375 |
{
|
|
1376 |
// Delivery has failed.
|
|
1377 |
Clear();
|
|
1378 |
}
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
TInt CMmDeliveryObject::DeliverReqL( TDblQue<CReqEntry>& aArray, CReqEntry* aUpdatedReqEntry,
|
|
1382 |
const CTelObject::TReqMode aReqMode, const TInt aIpc, TInt aError)
|
|
1383 |
{
|
|
1384 |
iPendingReqs.Reset();
|
|
1385 |
|
|
1386 |
ASSERT(aUpdatedReqEntry != NULL);
|
|
1387 |
iUpdatedReqEntry = aUpdatedReqEntry;
|
|
1388 |
iReqMode = aReqMode;
|
|
1389 |
iError = aError;
|
|
1390 |
|
|
1391 |
CReqEntry* reqEntry = NULL;
|
|
1392 |
TDblQueIter<CReqEntry> iter(aArray);
|
|
1393 |
while(reqEntry = iter++, reqEntry!=NULL)
|
|
1394 |
{
|
|
1395 |
if(reqEntry->iFunction==aIpc
|
|
1396 |
&& reqEntry->iTelObject==iUpdatedReqEntry->iTelObject
|
|
1397 |
&& reqEntry->iBuffer->Size()==iUpdatedReqEntry->iBuffer->Size())
|
|
1398 |
{
|
|
1399 |
switch (reqEntry->iInterestCategory)
|
|
1400 |
{
|
|
1401 |
case EInterestCategoryPriority:
|
|
1402 |
{
|
|
1403 |
// If we don't already have a priority client registered,
|
|
1404 |
// then add this one as the priority client.
|
|
1405 |
if (iPriorityReq == NULL)
|
|
1406 |
{
|
|
1407 |
iPriorityReq = reqEntry;
|
|
1408 |
}
|
|
1409 |
// Otherwise if there is already a registered priority client,
|
|
1410 |
// add this to the list of standard clients to be treated as such.
|
|
1411 |
else
|
|
1412 |
{
|
|
1413 |
iPendingReqs.AppendL( reqEntry );
|
|
1414 |
}
|
|
1415 |
break;
|
|
1416 |
}
|
|
1417 |
case EInterestCategoryDefault:
|
|
1418 |
{
|
|
1419 |
// If we don't already have a default client registered,
|
|
1420 |
// then add this one as the default client.
|
|
1421 |
if (iDefaultReq == NULL)
|
|
1422 |
{
|
|
1423 |
iDefaultReq = reqEntry;
|
|
1424 |
}
|
|
1425 |
// Otherwise if there is already a registered default client,
|
|
1426 |
// add this to the list of standard clients to be treated as such.
|
|
1427 |
else
|
|
1428 |
{
|
|
1429 |
iPendingReqs.AppendL( reqEntry );
|
|
1430 |
}
|
|
1431 |
break;
|
|
1432 |
}
|
|
1433 |
default:
|
|
1434 |
{
|
|
1435 |
iPendingReqs.AppendL( reqEntry );
|
|
1436 |
}
|
|
1437 |
} //end switch
|
|
1438 |
} //end if
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
// Calculate amount of time each client will get to accept the request
|
|
1442 |
TInt count = iPendingReqs.Count();
|
|
1443 |
if (count)
|
|
1444 |
{
|
|
1445 |
if (iPriorityReq)
|
|
1446 |
{
|
|
1447 |
iTimeSlice = (KUssdOfferDialogueTimeout * (100 - KUssdPriorityTimeoutPercentage)/(100 * count) );
|
|
1448 |
}
|
|
1449 |
else
|
|
1450 |
{
|
|
1451 |
iTimeSlice = KUssdOfferDialogueTimeout / count ;
|
|
1452 |
}
|
|
1453 |
}
|
|
1454 |
|
|
1455 |
// now start looping through clients...
|
|
1456 |
DoStart();
|
|
1457 |
return KErrNone;
|
|
1458 |
}
|
|
1459 |
|
|
1460 |
TBool CMmDeliveryObject::DeliveryInProgress() const
|
|
1461 |
{
|
|
1462 |
// In the case of delivery to the default client we won't be active when
|
77
|
1463 |
// delivery is carried out as no timeout is used for the default client
|
24
|
1464 |
return (IsActive() || iCurrentReq);
|
|
1465 |
}
|
77
|
1466 |
CTelObject::TReqMode CMmDeliveryObject::GetReqMode()const
|
|
1467 |
{
|
|
1468 |
return iReqMode;
|
|
1469 |
}
|
24
|
1470 |
TInt CMmDeliveryObject::ClientsDecision( const RMessage2& aMessage, CTelSession* aSession, TBool aAccepted )
|
|
1471 |
{
|
|
1472 |
if (!DeliveryInProgress())
|
|
1473 |
{
|
|
1474 |
return KErrTimedOut;
|
|
1475 |
}
|
|
1476 |
|
|
1477 |
const TInt currentreqsession = reinterpret_cast<TInt>(iCurrentReq->iSession);
|
|
1478 |
const TInt currentreqsubsession = iCurrentReq->iMessage.Int3();
|
|
1479 |
|
|
1480 |
const TInt clientsession = reinterpret_cast<TInt>(aSession);
|
|
1481 |
const TInt clientsubsession = aMessage.Int3();
|
|
1482 |
|
|
1483 |
if (currentreqsession != clientsession ||
|
|
1484 |
currentreqsubsession != clientsubsession)
|
|
1485 |
{
|
|
1486 |
// do nothing - client took too long to reply and we've moved
|
|
1487 |
// onto another client now
|
|
1488 |
return KErrTimedOut;
|
|
1489 |
}
|
|
1490 |
|
|
1491 |
if (aAccepted)
|
|
1492 |
{
|
|
1493 |
Cancel();
|
|
1494 |
iTelObject.SetSessionOwner(clientsession, clientsubsession);
|
|
1495 |
ASSERT(iUpdatedReqEntry != NULL);
|
|
1496 |
// We repost the request so we don't miss the next message in the dialog
|
|
1497 |
// in case the client is slow in calling ReceiveMessage again.
|
|
1498 |
iTelObject.RepostRequest(iUpdatedReqEntry, KErrNone);
|
|
1499 |
Clear();
|
|
1500 |
}
|
|
1501 |
else
|
|
1502 |
{
|
|
1503 |
Cancel();
|
|
1504 |
DoStart();
|
|
1505 |
}
|
|
1506 |
return KErrNone;
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
void CMmDeliveryObject::OfferToClient( CReqEntry* aReq )
|
|
1510 |
{
|
|
1511 |
iTelObject.OfferToClient(aReq, iUpdatedReqEntry, iReqMode, iError);
|
|
1512 |
}
|
|
1513 |
|
|
1514 |
|
|
1515 |
// CMmDeliveryObject is being notified that a client has called cancel.
|
|
1516 |
// The relevant CReqEntry is being passed as a parameter.
|
|
1517 |
// Need to remove it from our list of interested (in Receiving messages) clients.
|
|
1518 |
|
|
1519 |
void CMmDeliveryObject::DeletedReqEntry( CReqEntry* aReqEntry )
|
|
1520 |
{
|
|
1521 |
if (iCurrentReq == aReqEntry)
|
|
1522 |
{
|
|
1523 |
iCurrentReq = NULL;
|
|
1524 |
}
|
|
1525 |
|
|
1526 |
if (iPriorityReq == aReqEntry)
|
|
1527 |
{
|
|
1528 |
iPriorityReq = NULL;
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
if (iDefaultReq == aReqEntry)
|
|
1532 |
{
|
|
1533 |
iDefaultReq = NULL;
|
|
1534 |
}
|
|
1535 |
|
|
1536 |
if ( iPendingReqs.Count() )
|
|
1537 |
{
|
|
1538 |
for (TInt i = iPendingReqs.Count()-1; i>=0; --i)
|
|
1539 |
{
|
|
1540 |
if (aReqEntry == iPendingReqs[i])
|
|
1541 |
{
|
|
1542 |
iPendingReqs.Remove(i);
|
|
1543 |
break;
|
|
1544 |
}
|
|
1545 |
}
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
if (aReqEntry == iUpdatedReqEntry)
|
|
1549 |
{
|
|
1550 |
// iUpdatedReqEntry is the client which cancelled.
|
|
1551 |
// Copy data from the 'about to be destroyed' entry to
|
|
1552 |
// one owned by the next client.
|
|
1553 |
|
|
1554 |
CReqEntry* req = NewUpdatedReqEntry();
|
|
1555 |
if (req == NULL)
|
|
1556 |
// No more clients left.
|
|
1557 |
{
|
|
1558 |
Cancel();
|
|
1559 |
iPendingReqs.Close();
|
|
1560 |
}
|
|
1561 |
else
|
|
1562 |
{
|
|
1563 |
ASSERT(aReqEntry != req);
|
|
1564 |
iTelObject.PhoneOwner()->UpdateBuffer(iUpdatedReqEntry,req);
|
|
1565 |
iUpdatedReqEntry = req;
|
|
1566 |
}
|
|
1567 |
}
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
CReqEntry* CMmDeliveryObject::NewUpdatedReqEntry()
|
|
1571 |
{
|
|
1572 |
if (iCurrentReq)
|
|
1573 |
return iCurrentReq;
|
|
1574 |
|
|
1575 |
CReqEntry* req = NULL;
|
|
1576 |
if (iPriorityReq)
|
|
1577 |
{
|
|
1578 |
req = iPriorityReq;
|
|
1579 |
}
|
|
1580 |
else if ( iPendingReqs.Count() )
|
|
1581 |
{
|
|
1582 |
req = iPendingReqs[0];
|
|
1583 |
}
|
|
1584 |
else if (iDefaultReq)
|
|
1585 |
{
|
|
1586 |
req = iDefaultReq;
|
|
1587 |
}
|
|
1588 |
return req;
|
|
1589 |
}
|
|
1590 |
|
|
1591 |
|
|
1592 |
CReqEntry* CMmDeliveryObject::HighestPriorityReq( TInterestCategory& aInterestCategory )
|
|
1593 |
{
|
|
1594 |
aInterestCategory = EInterestCategoryStandard;
|
|
1595 |
CReqEntry* req = NULL;
|
|
1596 |
if (iPriorityReq)
|
|
1597 |
{
|
|
1598 |
req = iPriorityReq;
|
|
1599 |
iPriorityReq = NULL;
|
|
1600 |
aInterestCategory = EInterestCategoryPriority;
|
|
1601 |
}
|
|
1602 |
else if ( iPendingReqs.Count() )
|
|
1603 |
{
|
|
1604 |
req = iPendingReqs[0];
|
|
1605 |
iPendingReqs.Remove(0);
|
|
1606 |
aInterestCategory = EInterestCategoryStandard;
|
|
1607 |
}
|
|
1608 |
else if (iDefaultReq)
|
|
1609 |
{
|
|
1610 |
req = iDefaultReq;
|
|
1611 |
iDefaultReq = NULL;
|
|
1612 |
aInterestCategory = EInterestCategoryDefault;
|
|
1613 |
}
|
|
1614 |
return req;
|
|
1615 |
}
|
|
1616 |
|
|
1617 |
void CMmDeliveryObject::DoStart()
|
|
1618 |
{
|
|
1619 |
SetActive();
|
|
1620 |
TRequestStatus* status = &iStatus;
|
|
1621 |
User::RequestComplete( status, KErrNone );
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
void CMmDeliveryObject::Clear()
|
|
1625 |
{
|
|
1626 |
iPendingReqs.Reset();
|
|
1627 |
iCurrentReq = NULL;
|
|
1628 |
iPriorityReq = NULL;
|
|
1629 |
iDefaultReq = NULL;
|
|
1630 |
|
|
1631 |
iUpdatedReqEntry = NULL;
|
|
1632 |
iReqMode = 0;
|
|
1633 |
iError = KErrNone;
|
|
1634 |
}
|
|
1635 |
|
|
1636 |
//
|
|
1637 |
// CPhoneBase performs Flow Control
|
|
1638 |
//
|
|
1639 |
TInt CPhoneBase::FlowControl() const
|
|
1640 |
//
|
|
1641 |
// Return the value of iFlowControlCnt
|
|
1642 |
//
|
|
1643 |
{
|
|
1644 |
return iFlowControlCnt;
|
|
1645 |
}
|
|
1646 |
|
|
1647 |
void CPhoneBase::FlowControlInc()
|
|
1648 |
//
|
|
1649 |
// Increase iFlowControlCnt
|
|
1650 |
//
|
|
1651 |
{
|
|
1652 |
LOGTEXT3("Incrementing Flow Control from %d to %d", iFlowControlCnt, iFlowControlCnt+1);
|
|
1653 |
iFlowControlCnt++;
|
|
1654 |
}
|
|
1655 |
|
|
1656 |
void CPhoneBase::FlowControlDec()
|
|
1657 |
//
|
|
1658 |
// Decrease iFlowControlCnt
|
|
1659 |
//
|
|
1660 |
{
|
|
1661 |
__ASSERT_ALWAYS((iFlowControlCnt>0),Fault(EEtelFaultNegativeFlowcontrolCount));
|
|
1662 |
LOGTEXT3("Decrementing Flow Control from %d to %d", iFlowControlCnt, iFlowControlCnt-1);
|
|
1663 |
iFlowControlCnt--;
|
|
1664 |
}
|
|
1665 |
|
|
1666 |
EXPORT_C TBool CPhoneBase::CheckEmergencyClient(const TTsyReqHandle aTsyReqHandle) const
|
|
1667 |
{
|
|
1668 |
CReqEntry* reqEntry=PhoneOwner()->FindByTsyHandle(aTsyReqHandle);
|
|
1669 |
__ASSERT_ALWAYS(reqEntry!=NULL,Fault(EEtelFaultNotRecognisedTsyHandle));
|
|
1670 |
|
|
1671 |
return reqEntry->iSession->TelServer()->IsEmergencyClient(reqEntry->iSession);
|
|
1672 |
}
|
|
1673 |
|
|
1674 |
|
|
1675 |
EXPORT_C CTelObject::TReqMode CPhoneBase::ReqModeL(const TInt aIpc)
|
|
1676 |
//
|
|
1677 |
// Mode Request Inquiry Functions
|
|
1678 |
//
|
|
1679 |
{
|
|
1680 |
CTelObject::TReqMode mode=0;
|
|
1681 |
switch (aIpc)
|
|
1682 |
{
|
|
1683 |
case EEtelPhoneInitialise: //test
|
|
1684 |
mode=KReqModeFlowControlObeyed | KReqModeMultipleCompletionEnabled;
|
|
1685 |
break;
|
|
1686 |
case EEtelPhoneGetCaps:
|
|
1687 |
case EEtelPhoneGetStatus:
|
|
1688 |
case EEtelPhoneEnumerateLines:
|
|
1689 |
case EEtelPhoneGetLineInfo:
|
|
1690 |
case EEtelPhoneGetInfo:
|
|
1691 |
mode=KReqModeMultipleCompletionEnabled;
|
|
1692 |
break;
|
|
1693 |
case EETelPhoneSetEmergencyClient:
|
|
1694 |
mode=KReqModeFlowControlObeyed;
|
|
1695 |
break;
|
|
1696 |
case EEtelPhoneNotifyModemDetected:
|
|
1697 |
case EETelPhoneCapsChangeNotification:
|
|
1698 |
mode=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
1699 |
break;
|
|
1700 |
default:
|
|
1701 |
User::Leave(KErrNotSupported);
|
|
1702 |
break;
|
|
1703 |
}
|
|
1704 |
return mode;
|
|
1705 |
}
|
|
1706 |
|
|
1707 |
EXPORT_C TInt CPhoneBase::NumberOfSlotsL(const TInt aIpc)
|
|
1708 |
{
|
|
1709 |
switch (aIpc)
|
|
1710 |
{
|
|
1711 |
case EEtelPhoneNotifyModemDetected:
|
|
1712 |
case EETelPhoneCapsChangeNotification:
|
|
1713 |
break;
|
|
1714 |
default:
|
|
1715 |
User::Leave(KErrNotSupported);
|
|
1716 |
break;
|
|
1717 |
}
|
|
1718 |
return KSlotNumbersDefault;
|
|
1719 |
}
|
|
1720 |
|
|
1721 |
TDblQue<CReqEntry>& CPhoneBase::ReqActiveList()
|
|
1722 |
{
|
|
1723 |
return iReqActiveList;
|
|
1724 |
}
|