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 |
// Dummy TSY classes that represent the core ETel API support.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "coretsy.h"
|
|
23 |
#include "testdef.h"
|
|
24 |
|
|
25 |
#include <et_clsvr.h>
|
|
26 |
|
|
27 |
void TsyPanic(TTsyPanic aPanic)
|
|
28 |
{
|
|
29 |
_LIT(KTsyPanic,"Tsy Panic");
|
|
30 |
User::Panic(KTsyPanic,aPanic);
|
|
31 |
}
|
|
32 |
|
|
33 |
TTsyTimer::TTsyTimer()
|
|
34 |
{
|
|
35 |
iPending=EFalse;
|
|
36 |
}
|
|
37 |
|
|
38 |
/*******************************************************************/
|
|
39 |
//
|
|
40 |
// CCallDummyBase
|
|
41 |
//
|
|
42 |
/*******************************************************************/
|
|
43 |
|
|
44 |
CCallDummyBase::CCallDummyBase(CPhoneFactoryDummyBase* aFac)
|
|
45 |
{
|
|
46 |
iFac=aFac;
|
|
47 |
}
|
|
48 |
|
|
49 |
void CCallDummyBase::ConstructL()
|
|
50 |
{
|
|
51 |
}
|
|
52 |
|
|
53 |
CCallDummyBase::~CCallDummyBase()
|
|
54 |
{
|
|
55 |
iFac->RemoveTimer(iNotifyStatusChange);
|
|
56 |
iFac->RemoveTimer(iDial);
|
|
57 |
iFac->RemoveTimer(iAnswer);
|
|
58 |
iFac->RemoveTimer(iHangUp);
|
|
59 |
}
|
|
60 |
|
|
61 |
CCallDummyBase* CCallDummyBase::This(TAny* aPtr)
|
|
62 |
{
|
|
63 |
return REINTERPRET_CAST(CCallDummyBase*,aPtr);
|
|
64 |
}
|
|
65 |
|
|
66 |
CPhoneFactoryDummyBase* CCallDummyBase::FacPtr() const
|
|
67 |
{
|
|
68 |
return iFac;
|
|
69 |
}
|
|
70 |
|
|
71 |
/*******************************************************************/
|
|
72 |
//
|
|
73 |
// Core ETel API call requests - all these must be implemented by TSY
|
|
74 |
// even if just to return KErrNotSupported
|
|
75 |
//
|
|
76 |
/*******************************************************************/
|
|
77 |
|
|
78 |
TInt CCallDummyBase::RelinquishOwnership()
|
|
79 |
{
|
|
80 |
// Request not implemented in this dummy TSY
|
|
81 |
RelinquishOwnershipCompleted(KErrNone);
|
|
82 |
return KErrNone;
|
|
83 |
}
|
|
84 |
|
|
85 |
TInt CCallDummyBase::TransferOwnership(const TTsyReqHandle aTsyReqHandle)
|
|
86 |
{
|
|
87 |
// Request not implemented in this dummy TSY
|
|
88 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
89 |
return KErrNone;
|
|
90 |
}
|
|
91 |
|
|
92 |
TInt CCallDummyBase::AcquireOwnership(const TTsyReqHandle aTsyReqHandle)
|
|
93 |
{
|
|
94 |
// Request not implemented in this dummy TSY
|
|
95 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
96 |
return KErrNone;
|
|
97 |
}
|
|
98 |
|
|
99 |
TInt CCallDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RCall::TCaps*)
|
|
100 |
{
|
|
101 |
iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::NotifyCapsChangeHandler,this);
|
|
102 |
return KErrNone;
|
|
103 |
}
|
|
104 |
|
|
105 |
TInt CCallDummyBase::NotifyHookChange(const TTsyReqHandle aTsyReqHandle,RCall::THookStatus* /*aHookStatus*/)
|
|
106 |
{
|
|
107 |
// Request not implemented in this dummy TSY
|
|
108 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
109 |
return KErrNone;
|
|
110 |
}
|
|
111 |
|
|
112 |
TInt CCallDummyBase::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
|
|
113 |
{
|
|
114 |
iNotifyStatusChangeParams=aStatus;
|
|
115 |
iFac->QueueTimer(iNotifyStatusChange,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::NotifyStatusChangeHandler,this);
|
|
116 |
return KErrNone;
|
|
117 |
}
|
|
118 |
|
|
119 |
TInt CCallDummyBase::NotifyDurationChange(const TTsyReqHandle aTsyReqHandle,TTimeIntervalSeconds*)
|
|
120 |
{
|
|
121 |
iFac->QueueTimer(iNotifyDurationChange,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::NotifyDurationChangeHandler,this);
|
|
122 |
return KErrNone;
|
|
123 |
}
|
|
124 |
|
|
125 |
TInt CCallDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RCall::TCallInfo* /*aCallInfo*/)
|
|
126 |
{
|
|
127 |
// Request not implemented in this dummy TSY
|
|
128 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
129 |
return KErrNone;
|
|
130 |
}
|
|
131 |
|
|
132 |
TInt CCallDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
|
|
133 |
{
|
|
134 |
*aStatus=DSATTSY_CORE_CALL_STATUS;
|
|
135 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
136 |
return KErrNone;
|
|
137 |
}
|
|
138 |
|
|
139 |
TInt CCallDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RCall::TCaps*)
|
|
140 |
{
|
|
141 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
142 |
return KErrNone;
|
|
143 |
}
|
|
144 |
|
|
145 |
TInt CCallDummyBase::LoanDataPort(const TTsyReqHandle aTsyReqHandle, RCall::TCommPort* /*aCommPort*/)
|
|
146 |
{
|
|
147 |
iFac->QueueTimer(iLoanDataPortTimer,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::LoanDataPortHandler,this);
|
|
148 |
return KErrNone;
|
|
149 |
}
|
|
150 |
|
|
151 |
TInt CCallDummyBase::RecoverDataPort(const TTsyReqHandle aTsyReqHandle)
|
|
152 |
{
|
|
153 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
154 |
return KErrNone;
|
|
155 |
}
|
|
156 |
|
|
157 |
TInt CCallDummyBase::RecoverDataPortAndRelinquishOwnership()
|
|
158 |
{
|
|
159 |
// Request not implemented in this dummy TSY
|
|
160 |
RecoverDataPortAndRelinquishOwnershipCompleted(KErrNone);
|
|
161 |
return KErrNone;
|
|
162 |
}
|
|
163 |
|
|
164 |
TInt CCallDummyBase::Dial(const TTsyReqHandle aTsyReqHandle,const TDesC8*, TDesC*)
|
|
165 |
{
|
|
166 |
iFac->QueueTimer(iDial,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::DialHandler,this);
|
|
167 |
return KErrNone;
|
|
168 |
}
|
|
169 |
|
|
170 |
TInt CCallDummyBase::Connect(const TTsyReqHandle aTsyReqHandle,const TDesC8*)
|
|
171 |
{
|
|
172 |
// Request not implemented in this dummy TSY
|
|
173 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
174 |
return KErrNone;
|
|
175 |
}
|
|
176 |
|
|
177 |
TInt CCallDummyBase::AnswerIncomingCall(const TTsyReqHandle aTsyReqHandle,const TDesC8*)
|
|
178 |
{
|
|
179 |
iFac->QueueTimer(iAnswer,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::AnswerHandler,this);
|
|
180 |
return KErrNone;
|
|
181 |
}
|
|
182 |
|
|
183 |
TInt CCallDummyBase::HangUp(const TTsyReqHandle aTsyReqHandle)
|
|
184 |
{
|
|
185 |
// If this is a voice call then any client can hang it up.
|
|
186 |
// If this is a data or fax call then only the owning client can hang it up
|
|
187 |
if (CheckOwnership(aTsyReqHandle)==CCallBase::EOwnedTrue)
|
|
188 |
{
|
|
189 |
iFac->QueueTimer(iHangUp,aTsyReqHandle,DSATTSY_TIMEOUT,CCallDummyBase::HangUpHandler,this);
|
|
190 |
return KErrNone;
|
|
191 |
}
|
|
192 |
else
|
|
193 |
return KErrEtelNotCallOwner;
|
|
194 |
}
|
|
195 |
|
|
196 |
TInt CCallDummyBase::GetBearerServiceInfo(const TTsyReqHandle aTsyReqHandle,RCall::TBearerService* aService)
|
|
197 |
{
|
|
198 |
aService->iBearerSpeed=DSATTSY_CALL_BEARER_SPEED;
|
|
199 |
aService->iBearerCaps=DSATTSY_CALL_BEARER_CAPS;
|
|
200 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
201 |
return KErrNone;
|
|
202 |
}
|
|
203 |
|
|
204 |
TInt CCallDummyBase::GetCallParams(const TTsyReqHandle aTsyReqHandle, TDes8*)
|
|
205 |
{
|
|
206 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
207 |
return KErrNone;
|
|
208 |
}
|
|
209 |
|
|
210 |
TInt CCallDummyBase::GetCallDuration(const TTsyReqHandle aTsyReqHandle, TTimeIntervalSeconds* aTime)
|
|
211 |
{
|
|
212 |
*aTime = DSATTSY_CALL_DURATION1;
|
|
213 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
214 |
return KErrNone;
|
|
215 |
}
|
|
216 |
|
|
217 |
TInt CCallDummyBase::GetFaxSettings(const TTsyReqHandle aTsyReqHandle,RCall::TFaxSessionSettings* aSettings)
|
|
218 |
{
|
|
219 |
aSettings->iFaxId=DSATTSY_MYFAX;
|
|
220 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
221 |
return KErrNone;
|
|
222 |
}
|
|
223 |
|
|
224 |
TInt CCallDummyBase::SetFaxSettings(const TTsyReqHandle aTsyReqHandle,const RCall::TFaxSessionSettings* aSettings)
|
|
225 |
{
|
|
226 |
if (aSettings->iFaxId.Compare(DSATTSY_MYFAX)!=KErrNone)
|
|
227 |
return(KErrEtelDataCorrupted);
|
|
228 |
|
|
229 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
230 |
return KErrNone;
|
|
231 |
}
|
|
232 |
|
|
233 |
|
|
234 |
/*******************************************************************/
|
|
235 |
//
|
|
236 |
// Cancellation functions for call requests
|
|
237 |
//
|
|
238 |
/*******************************************************************/
|
|
239 |
|
|
240 |
TInt CCallDummyBase::AcquireOwnershipCancel(const TTsyReqHandle aTsyReqHandle)
|
|
241 |
{
|
|
242 |
// Request not implemented in this dummy TSY
|
|
243 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
244 |
return KErrNone;
|
|
245 |
}
|
|
246 |
|
|
247 |
TInt CCallDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
248 |
{
|
|
249 |
if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
|
|
250 |
{
|
|
251 |
iFac->RemoveTimer(iNotifyCapsChange);
|
|
252 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
253 |
return KErrNone;
|
|
254 |
}
|
|
255 |
return KErrEtelNotRecognisedCancelHandle;
|
|
256 |
}
|
|
257 |
|
|
258 |
TInt CCallDummyBase::NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
259 |
{
|
|
260 |
// Request not implemented in this dummy TSY
|
|
261 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
262 |
return KErrNone;
|
|
263 |
}
|
|
264 |
|
|
265 |
TInt CCallDummyBase::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
266 |
{
|
|
267 |
if (aTsyReqHandle==iNotifyStatusChange.iTsyReqHandle)
|
|
268 |
{
|
|
269 |
iFac->RemoveTimer(iNotifyStatusChange);
|
|
270 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
271 |
return KErrNone;
|
|
272 |
}
|
|
273 |
return KErrEtelNotRecognisedCancelHandle;
|
|
274 |
}
|
|
275 |
|
|
276 |
TInt CCallDummyBase::NotifyDurationChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
277 |
{
|
|
278 |
if (aTsyReqHandle==iNotifyDurationChange.iTsyReqHandle)
|
|
279 |
{
|
|
280 |
iFac->RemoveTimer(iNotifyDurationChange);
|
|
281 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
282 |
return KErrNone;
|
|
283 |
}
|
|
284 |
return KErrEtelNotRecognisedCancelHandle;
|
|
285 |
}
|
|
286 |
|
|
287 |
TInt CCallDummyBase::LoanDataPortCancel(const TTsyReqHandle aTsyReqHandle)
|
|
288 |
{
|
|
289 |
if (aTsyReqHandle==iLoanDataPortTimer.iTsyReqHandle)
|
|
290 |
{
|
|
291 |
iFac->RemoveTimer(iLoanDataPortTimer);
|
|
292 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
293 |
return KErrNone;
|
|
294 |
}
|
|
295 |
return KErrEtelNotRecognisedCancelHandle;
|
|
296 |
}
|
|
297 |
|
|
298 |
TInt CCallDummyBase::DialCancel(const TTsyReqHandle aTsyReqHandle)
|
|
299 |
{
|
|
300 |
if (aTsyReqHandle==iDial.iTsyReqHandle)
|
|
301 |
{
|
|
302 |
iFac->RemoveTimer(iDial);
|
|
303 |
SetUnowned();
|
|
304 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
305 |
return KErrNone;
|
|
306 |
}
|
|
307 |
return KErrEtelNotRecognisedCancelHandle;
|
|
308 |
}
|
|
309 |
|
|
310 |
TInt CCallDummyBase::ConnectCancel(const TTsyReqHandle aTsyReqHandle)
|
|
311 |
{
|
|
312 |
// Request not implemented in this dummy TSY
|
|
313 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
314 |
return KErrNone;
|
|
315 |
}
|
|
316 |
|
|
317 |
TInt CCallDummyBase::AnswerIncomingCallCancel(const TTsyReqHandle aTsyReqHandle)
|
|
318 |
{
|
|
319 |
if (aTsyReqHandle==iAnswer.iTsyReqHandle)
|
|
320 |
{
|
|
321 |
iFac->RemoveTimer(iAnswer);
|
|
322 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
323 |
return KErrNone;
|
|
324 |
}
|
|
325 |
return KErrEtelNotRecognisedCancelHandle;
|
|
326 |
}
|
|
327 |
|
|
328 |
TInt CCallDummyBase::HangUpCancel(const TTsyReqHandle aTsyReqHandle)
|
|
329 |
{
|
|
330 |
if (aTsyReqHandle==iHangUp.iTsyReqHandle)
|
|
331 |
{
|
|
332 |
iFac->RemoveTimer(iHangUp);
|
|
333 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
334 |
return KErrNone;
|
|
335 |
}
|
|
336 |
return KErrEtelNotRecognisedCancelHandle;
|
|
337 |
}
|
|
338 |
|
|
339 |
|
|
340 |
/*******************************************************************/
|
|
341 |
//
|
|
342 |
// Asynchronous handler functions - called after a timeout
|
|
343 |
//
|
|
344 |
/*******************************************************************/
|
|
345 |
|
|
346 |
TInt CCallDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
|
|
347 |
{
|
|
348 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
|
|
349 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
|
|
350 |
return KErrNone;
|
|
351 |
}
|
|
352 |
|
|
353 |
TInt CCallDummyBase::NotifyStatusChangeHandler(TAny* aPtr)
|
|
354 |
{
|
|
355 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyStatusChange);
|
|
356 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyStatusChange.iTsyReqHandle,KErrNone);
|
|
357 |
return KErrNone;
|
|
358 |
}
|
|
359 |
|
|
360 |
TInt CCallDummyBase::NotifyDurationChangeHandler(TAny* aPtr)
|
|
361 |
{
|
|
362 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyDurationChange);
|
|
363 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyDurationChange.iTsyReqHandle,KErrNone);
|
|
364 |
return KErrNone;
|
|
365 |
}
|
|
366 |
|
|
367 |
TInt CCallDummyBase::DialHandler(TAny* aPtr)
|
|
368 |
{
|
|
369 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iDial);
|
|
370 |
This(aPtr)->ReqCompleted(This(aPtr)->iDial.iTsyReqHandle,KErrNone);
|
|
371 |
return KErrNone;
|
|
372 |
}
|
|
373 |
|
|
374 |
TInt CCallDummyBase::AnswerHandler(TAny* aPtr)
|
|
375 |
{
|
|
376 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iAnswer);
|
|
377 |
This(aPtr)->ReqCompleted(This(aPtr)->iAnswer.iTsyReqHandle,KErrNone);
|
|
378 |
return KErrNone;
|
|
379 |
}
|
|
380 |
|
|
381 |
TInt CCallDummyBase::HangUpHandler(TAny* aPtr)
|
|
382 |
{
|
|
383 |
This(aPtr)->SetUnowned();
|
|
384 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iHangUp);
|
|
385 |
This(aPtr)->ReqCompleted(This(aPtr)->iHangUp.iTsyReqHandle,KErrNone);
|
|
386 |
return KErrNone;
|
|
387 |
}
|
|
388 |
|
|
389 |
TInt CCallDummyBase::LoanDataPortHandler(TAny* aPtr)
|
|
390 |
{
|
|
391 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iLoanDataPortTimer);
|
|
392 |
This(aPtr)->ReqCompleted(This(aPtr)->iLoanDataPortTimer.iTsyReqHandle,KErrNone);
|
|
393 |
return KErrNone;
|
|
394 |
}
|
|
395 |
|
|
396 |
/*******************************************************************/
|
|
397 |
//
|
|
398 |
// CLineDummyBase
|
|
399 |
//
|
|
400 |
/*******************************************************************/
|
|
401 |
|
|
402 |
CLineDummyBase::CLineDummyBase(CPhoneFactoryDummyBase* aFac)
|
|
403 |
{
|
|
404 |
iFac=aFac;
|
|
405 |
}
|
|
406 |
|
|
407 |
void CLineDummyBase::ConstructL()
|
|
408 |
{
|
|
409 |
}
|
|
410 |
|
|
411 |
CLineDummyBase::~CLineDummyBase()
|
|
412 |
{
|
|
413 |
iFac->RemoveTimer(iNotifyIncomingCall);
|
|
414 |
iFac->RemoveTimer(iNotifyStatusChange);
|
|
415 |
}
|
|
416 |
|
|
417 |
CLineDummyBase* CLineDummyBase::This(TAny* aPtr)
|
|
418 |
{
|
|
419 |
return REINTERPRET_CAST(CLineDummyBase*,aPtr);
|
|
420 |
}
|
|
421 |
|
|
422 |
CPhoneFactoryDummyBase* CLineDummyBase::FacPtr() const
|
|
423 |
{
|
|
424 |
return iFac;
|
|
425 |
}
|
|
426 |
|
|
427 |
/*******************************************************************/
|
|
428 |
//
|
|
429 |
// Core ETel API line requests - all these must be implemented by TSY
|
|
430 |
// even if just to return KErrNotSupported
|
|
431 |
//
|
|
432 |
/*******************************************************************/
|
|
433 |
|
|
434 |
TInt CLineDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RLine::TCaps* aCaps)
|
|
435 |
{
|
|
436 |
iCapsParams=aCaps;
|
|
437 |
iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DSATTSY_TIMEOUT,CLineDummyBase::NotifyCapsChangeHandler,this);
|
|
438 |
return KErrNone;
|
|
439 |
}
|
|
440 |
|
|
441 |
TInt CLineDummyBase::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
|
|
442 |
{
|
|
443 |
iStatusParams=aStatus;
|
|
444 |
iFac->QueueTimer(iNotifyStatusChange,aTsyReqHandle,DSATTSY_TIMEOUT,CLineDummyBase::NotifyStatusChangeHandler,this);
|
|
445 |
return KErrNone;
|
|
446 |
}
|
|
447 |
|
|
448 |
TInt CLineDummyBase::NotifyIncomingCall(const TTsyReqHandle aTsyReqHandle, TName* aName)
|
|
449 |
{
|
|
450 |
iNameParams=aName;
|
|
451 |
iFac->QueueTimer(iNotifyIncomingCall,aTsyReqHandle,DSATTSY_TIMEOUT,CLineDummyBase::NotifyIncomingCallHandler,this);
|
|
452 |
return KErrNone;
|
|
453 |
}
|
|
454 |
|
|
455 |
TInt CLineDummyBase::NotifyHookChange(const TTsyReqHandle aTsyReqHandle, RCall::THookStatus* /*aHookStatus*/)
|
|
456 |
{
|
|
457 |
// Request not implemented in this dummy TSY
|
|
458 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
459 |
return KErrNone;
|
|
460 |
}
|
|
461 |
|
|
462 |
TInt CLineDummyBase::NotifyCallAdded(const TTsyReqHandle aTsyReqHandle, TName* /*aName*/)
|
|
463 |
{
|
|
464 |
iFac->QueueTimer(iNotifyCallAdded,aTsyReqHandle,DSATTSY_TIMEOUT,CLineDummyBase::NotifyCallAddedHandler,this);
|
|
465 |
return KErrNone;
|
|
466 |
}
|
|
467 |
|
|
468 |
TInt CLineDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps*)
|
|
469 |
{
|
|
470 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
471 |
return KErrNone;
|
|
472 |
}
|
|
473 |
|
|
474 |
TInt CLineDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RLine::TLineInfo* /*aLineInfo*/)
|
|
475 |
{
|
|
476 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
477 |
return KErrNone;
|
|
478 |
}
|
|
479 |
|
|
480 |
TInt CLineDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
|
|
481 |
{
|
|
482 |
*aStatus=DSATTSY_CORE_LINE_STATUS;
|
|
483 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
484 |
return KErrNone;
|
|
485 |
}
|
|
486 |
|
|
487 |
TInt CLineDummyBase::GetHookStatus(const TTsyReqHandle aTsyReqHandle,RCall::THookStatus*)
|
|
488 |
{
|
|
489 |
// Request not implemented in this dummy TSY
|
|
490 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
491 |
return KErrNone;
|
|
492 |
}
|
|
493 |
|
|
494 |
TInt CLineDummyBase::EnumerateCall(const TTsyReqHandle aTsyReqHandle, TInt*)
|
|
495 |
{
|
|
496 |
// Request not implemented in this dummy TSY
|
|
497 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
498 |
return KErrNone;
|
|
499 |
}
|
|
500 |
|
|
501 |
TInt CLineDummyBase::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex*)
|
|
502 |
{
|
|
503 |
// Request not implemented in this dummy TSY
|
|
504 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
505 |
return KErrNone;
|
|
506 |
}
|
|
507 |
|
|
508 |
|
|
509 |
/*******************************************************************/
|
|
510 |
//
|
|
511 |
// Cancellation functions for line requests
|
|
512 |
//
|
|
513 |
/*******************************************************************/
|
|
514 |
|
|
515 |
TInt CLineDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
516 |
{
|
|
517 |
if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
|
|
518 |
{
|
|
519 |
iFac->RemoveTimer(iNotifyCapsChange);
|
|
520 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
521 |
return KErrNone;
|
|
522 |
}
|
|
523 |
return KErrEtelNotRecognisedCancelHandle;
|
|
524 |
}
|
|
525 |
|
|
526 |
TInt CLineDummyBase::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
527 |
{
|
|
528 |
if (aTsyReqHandle==iNotifyStatusChange.iTsyReqHandle)
|
|
529 |
{
|
|
530 |
iFac->RemoveTimer(iNotifyStatusChange);
|
|
531 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
532 |
return KErrNone;
|
|
533 |
}
|
|
534 |
return KErrEtelNotRecognisedCancelHandle;
|
|
535 |
}
|
|
536 |
|
|
537 |
TInt CLineDummyBase::NotifyIncomingCallCancel(const TTsyReqHandle aTsyReqHandle)
|
|
538 |
{
|
|
539 |
if (aTsyReqHandle==iNotifyIncomingCall.iTsyReqHandle)
|
|
540 |
{
|
|
541 |
iFac->RemoveTimer(iNotifyIncomingCall);
|
|
542 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
543 |
return KErrNone;
|
|
544 |
}
|
|
545 |
return KErrEtelNotRecognisedCancelHandle;
|
|
546 |
}
|
|
547 |
|
|
548 |
TInt CLineDummyBase::NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
549 |
{
|
|
550 |
// Request not implemented in this dummy TSY
|
|
551 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
552 |
return KErrNone;
|
|
553 |
}
|
|
554 |
|
|
555 |
TInt CLineDummyBase::NotifyCallAddedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
556 |
{
|
|
557 |
if (aTsyReqHandle==iNotifyCallAdded.iTsyReqHandle)
|
|
558 |
{
|
|
559 |
iFac->RemoveTimer(iNotifyCallAdded);
|
|
560 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
561 |
return KErrNone;
|
|
562 |
}
|
|
563 |
return KErrEtelNotRecognisedCancelHandle;
|
|
564 |
}
|
|
565 |
|
|
566 |
/*******************************************************************/
|
|
567 |
//
|
|
568 |
// Asynchronous handler functions - called after a timeout
|
|
569 |
//
|
|
570 |
/*******************************************************************/
|
|
571 |
|
|
572 |
TInt CLineDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
|
|
573 |
{
|
|
574 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
|
|
575 |
This(aPtr)->iCapsParams->iFlags=DSATTSY_CORE_LINE_CAPS;
|
|
576 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
|
|
577 |
return KErrNone;
|
|
578 |
}
|
|
579 |
|
|
580 |
TInt CLineDummyBase::NotifyStatusChangeHandler(TAny* aPtr)
|
|
581 |
{
|
|
582 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyStatusChange);
|
|
583 |
*(This(aPtr)->iStatusParams)=DSATTSY_CORE_LINE_STATUS2;
|
|
584 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyStatusChange.iTsyReqHandle,KErrNone);
|
|
585 |
return KErrNone;
|
|
586 |
}
|
|
587 |
|
|
588 |
TInt CLineDummyBase::NotifyIncomingCallHandler(TAny* aPtr)
|
|
589 |
{
|
|
590 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyIncomingCall);
|
|
591 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyIncomingCall.iTsyReqHandle,KErrNone);
|
|
592 |
return KErrNone;
|
|
593 |
}
|
|
594 |
|
|
595 |
TInt CLineDummyBase::NotifyCallAddedHandler(TAny* aPtr)
|
|
596 |
{
|
|
597 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCallAdded);
|
|
598 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCallAdded.iTsyReqHandle,KErrNone);
|
|
599 |
return KErrNone;
|
|
600 |
}
|
|
601 |
|
|
602 |
|
|
603 |
/*******************************************************************/
|
|
604 |
//
|
|
605 |
// CPhoneDummyBase
|
|
606 |
//
|
|
607 |
/*******************************************************************/
|
|
608 |
|
|
609 |
CPhoneDummyBase::CPhoneDummyBase(CPhoneFactoryDummyBase* aFac)
|
|
610 |
{
|
|
611 |
iFac=aFac;
|
|
612 |
}
|
|
613 |
|
|
614 |
void CPhoneDummyBase::ConstructL()
|
|
615 |
{
|
|
616 |
}
|
|
617 |
|
|
618 |
CPhoneDummyBase::~CPhoneDummyBase()
|
|
619 |
{
|
|
620 |
iFac->RemoveTimer(iNotifyPhoneDetected);
|
|
621 |
iFac->RemoveTimer(iNotifyCapsChange);
|
|
622 |
}
|
|
623 |
|
|
624 |
CPhoneDummyBase* CPhoneDummyBase::This(TAny* aPtr)
|
|
625 |
{
|
|
626 |
return REINTERPRET_CAST(CPhoneDummyBase*,aPtr);
|
|
627 |
}
|
|
628 |
|
|
629 |
CPhoneFactoryDummyBase* CPhoneDummyBase::FacPtr() const
|
|
630 |
{
|
|
631 |
return iFac;
|
|
632 |
}
|
|
633 |
|
|
634 |
/*******************************************************************/
|
|
635 |
//
|
|
636 |
// Core ETel API phone requests - all these must be implemented by TSY
|
|
637 |
// even if just to return KErrNotSupported
|
|
638 |
//
|
|
639 |
/*******************************************************************/
|
|
640 |
|
|
641 |
TInt CPhoneDummyBase::ControlledInitialisation(const TTsyReqHandle aTsyReqHandle)
|
|
642 |
{
|
|
643 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
644 |
return KErrNone;
|
|
645 |
}
|
|
646 |
|
|
647 |
TInt CPhoneDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RPhone::TCaps*)
|
|
648 |
{
|
|
649 |
iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DSATTSY_TIMEOUT,CPhoneDummyBase::NotifyCapsChangeHandler,this);
|
|
650 |
return KErrNone;
|
|
651 |
}
|
|
652 |
|
|
653 |
TInt CPhoneDummyBase::NotifyModemDetected(const TTsyReqHandle aTsyReqHandle,RPhone::TModemDetection* aDetection)
|
|
654 |
{
|
|
655 |
iDetectionParams=aDetection;
|
|
656 |
iFac->QueueTimer(iNotifyPhoneDetected,aTsyReqHandle,DSATTSY_TIMEOUT,CPhoneDummyBase::NotifyPhoneDetectedHandler,this);
|
|
657 |
return KErrNone;
|
|
658 |
}
|
|
659 |
|
|
660 |
TInt CPhoneDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RPhone::TPhoneInfo* /*aPhoneInfo*/)
|
|
661 |
{
|
|
662 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
663 |
return KErrNone;
|
|
664 |
}
|
|
665 |
|
|
666 |
TInt CPhoneDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RPhone::TStatus* aPhoneStat)
|
|
667 |
{
|
|
668 |
aPhoneStat->iModemDetected=DSATTSY_CORE_PHONE_STATUS;
|
|
669 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
670 |
return KErrNone;
|
|
671 |
}
|
|
672 |
|
|
673 |
TInt CPhoneDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RPhone::TCaps*)
|
|
674 |
{
|
|
675 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
676 |
return KErrNone;
|
|
677 |
}
|
|
678 |
|
|
679 |
TInt CPhoneDummyBase::EnumerateLines(const TTsyReqHandle aTsyReqHandle, TInt*)
|
|
680 |
{
|
|
681 |
// Request not implemented in this dummy TSY
|
|
682 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
683 |
return KErrNone;
|
|
684 |
}
|
|
685 |
|
|
686 |
TInt CPhoneDummyBase::GetLineInfo(const TTsyReqHandle aTsyReqHandle, TLineInfoIndex* /*aLineInfo*/)
|
|
687 |
{
|
|
688 |
// Request not implemented in this dummy TSY
|
|
689 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
690 |
return KErrNone;
|
|
691 |
}
|
|
692 |
|
|
693 |
|
|
694 |
/*******************************************************************/
|
|
695 |
//
|
|
696 |
// Cancellation functions for line requests
|
|
697 |
//
|
|
698 |
/*******************************************************************/
|
|
699 |
|
|
700 |
TInt CPhoneDummyBase::ControlledInitialisationCancel(const TTsyReqHandle aTsyReqHandle)
|
|
701 |
{
|
|
702 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
703 |
return KErrNone;
|
|
704 |
}
|
|
705 |
|
|
706 |
TInt CPhoneDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
707 |
{
|
|
708 |
if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
|
|
709 |
{
|
|
710 |
iFac->RemoveTimer(iNotifyCapsChange);
|
|
711 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
712 |
return KErrNone;
|
|
713 |
}
|
|
714 |
return KErrEtelNotRecognisedCancelHandle;
|
|
715 |
}
|
|
716 |
|
|
717 |
TInt CPhoneDummyBase::NotifyModemDetectedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
718 |
{
|
|
719 |
if (aTsyReqHandle==iNotifyPhoneDetected.iTsyReqHandle)
|
|
720 |
{
|
|
721 |
iFac->RemoveTimer(iNotifyPhoneDetected);
|
|
722 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
723 |
return KErrNone;
|
|
724 |
}
|
|
725 |
return KErrEtelNotRecognisedCancelHandle;
|
|
726 |
}
|
|
727 |
|
|
728 |
/*******************************************************************/
|
|
729 |
//
|
|
730 |
// Asynchronous handler functions - called after a timeout
|
|
731 |
//
|
|
732 |
/*******************************************************************/
|
|
733 |
|
|
734 |
TInt CPhoneDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
|
|
735 |
{
|
|
736 |
This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
|
|
737 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
|
|
738 |
return KErrNone;
|
|
739 |
}
|
|
740 |
|
|
741 |
TInt CPhoneDummyBase::NotifyPhoneDetectedHandler(TAny* aPtr)
|
|
742 |
{
|
|
743 |
This(aPtr)->iFac->ResetPending(This(aPtr)->iNotifyPhoneDetected);
|
|
744 |
This(aPtr)->ReqCompleted(This(aPtr)->iNotifyPhoneDetected.iTsyReqHandle,KErrNone);
|
|
745 |
return KErrNone;
|
|
746 |
}
|
|
747 |
|
|
748 |
|
|
749 |
/*******************************************************************/
|
|
750 |
//
|
|
751 |
// CPhoneFactoryDummyBase
|
|
752 |
//
|
|
753 |
/*******************************************************************/
|
|
754 |
|
|
755 |
CPhoneFactoryDummyBase::CPhoneFactoryDummyBase()
|
|
756 |
{
|
|
757 |
}
|
|
758 |
|
|
759 |
void CPhoneFactoryDummyBase::ConstructL()
|
|
760 |
{
|
|
761 |
iTimer=CDeltaTimer::NewL(CActive::EPriorityHigh,KEtelTimerGranularity);
|
|
762 |
}
|
|
763 |
|
|
764 |
CPhoneFactoryDummyBase::~CPhoneFactoryDummyBase()
|
|
765 |
{
|
|
766 |
delete iTimer;
|
|
767 |
}
|
|
768 |
|
|
769 |
void CPhoneFactoryDummyBase::QueueTimer(TTsyTimer& aTsyTimer, const TTsyReqHandle aTsyReqHandle,TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,
|
|
770 |
TInt (*aFunction)(TAny *aPtr), TAny* aPtr)
|
|
771 |
{
|
|
772 |
TCallBack callBackFn(aFunction,aPtr);
|
|
773 |
|
|
774 |
aTsyTimer.iEntry.Set(callBackFn);
|
|
775 |
aTsyTimer.iPending=ETrue;
|
|
776 |
aTsyTimer.iTsyReqHandle=aTsyReqHandle;
|
|
777 |
|
|
778 |
aTimeInMicroSeconds=aTimeInMicroSeconds.Int()+(KEtelTimerGranularity>>2);
|
|
779 |
if(aTimeInMicroSeconds.Int()<100000)
|
|
780 |
aTimeInMicroSeconds=aTimeInMicroSeconds.Int()+KEtelTimerGranularity;
|
|
781 |
|
|
782 |
iTimer->Queue(aTimeInMicroSeconds,aTsyTimer.iEntry);
|
|
783 |
}
|
|
784 |
|
|
785 |
TBool CPhoneFactoryDummyBase::RemoveTimer(TTsyTimer& aTsyTimer)
|
|
786 |
{
|
|
787 |
if (aTsyTimer.iPending)
|
|
788 |
{
|
|
789 |
aTsyTimer.iPending=EFalse;
|
|
790 |
iTimer->Remove(aTsyTimer.iEntry);
|
|
791 |
return ETrue;
|
|
792 |
}
|
|
793 |
return EFalse;
|
|
794 |
}
|
|
795 |
|
|
796 |
void CPhoneFactoryDummyBase::ResetPending(TTsyTimer& aTsyTimer)
|
|
797 |
{
|
|
798 |
aTsyTimer.iPending=EFalse;
|
|
799 |
}
|
|
800 |
|
|
801 |
TInt CPhoneFactoryDummyBase::GetPhoneInfo(const TInt aIndex, RTelServer::TPhoneInfo& aInfo)
|
|
802 |
{
|
|
803 |
if (aIndex==0)
|
|
804 |
{
|
|
805 |
aInfo.iNetworkType=DSATTSY_NETWORK_TYPE;
|
|
806 |
aInfo.iName=DSATTSY_PHONE_NAME;
|
|
807 |
aInfo.iNumberOfLines=DSATTSY_NUMBER_OF_LINES;
|
|
808 |
return KErrNone;
|
|
809 |
}
|
|
810 |
else
|
|
811 |
return KErrNotFound;
|
|
812 |
}
|
|
813 |
|
|
814 |
TInt CPhoneFactoryDummyBase::EnumeratePhones()
|
|
815 |
{
|
|
816 |
return (DSATTSY_NUMBER_OF_PHONES);
|
|
817 |
}
|
|
818 |
|
|
819 |
/*******************************************************************/
|
|
820 |
//
|
|
821 |
// CSubSessionExtDummyBase
|
|
822 |
//
|
|
823 |
/*******************************************************************/
|
|
824 |
|
|
825 |
CSubSessionExtDummyBase::CSubSessionExtDummyBase(CPhoneFactoryDummyBase* aFac)
|
|
826 |
{
|
|
827 |
iFac=aFac;
|
|
828 |
}
|
|
829 |
|
|
830 |
CSubSessionExtDummyBase::~CSubSessionExtDummyBase()
|
|
831 |
{}
|
|
832 |
|
|
833 |
CPhoneFactoryDummyBase* CSubSessionExtDummyBase::FacPtr() const
|
|
834 |
{
|
|
835 |
return iFac;
|
|
836 |
}
|
|
837 |
|