|
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 "DSTD.H" |
|
17 #include "DDEF.H" |
|
18 #include "../TETEL/Tetelcs.h" |
|
19 |
|
20 // |
|
21 // CCallDstd |
|
22 // |
|
23 CCallDstd* CCallDstd::NewL(CPhoneFactoryDummyBase* aFac) |
|
24 // |
|
25 // Create new instance of CCallDstd |
|
26 // |
|
27 { |
|
28 CCallDstd* call=new(ELeave)CCallDstd(aFac); |
|
29 CleanupStack::PushL(call); |
|
30 call->ConstructL(); |
|
31 CleanupStack::Pop(); |
|
32 return call; |
|
33 } |
|
34 |
|
35 CCallDstd::CCallDstd(CPhoneFactoryDummyBase* aFac) |
|
36 :CCallDummyBase(aFac) |
|
37 {} |
|
38 |
|
39 CCallDstd::~CCallDstd() |
|
40 {} |
|
41 |
|
42 TInt CCallDstd::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
43 { |
|
44 return KErrNotSupported; |
|
45 } |
|
46 |
|
47 CTelObject* CCallDstd::OpenNewObjectByNameL(const TDesC& /*aName*/) |
|
48 { |
|
49 return REINTERPRET_CAST(CTelObject*,CFaxDstd::NewL(FacPtr())); |
|
50 } |
|
51 |
|
52 CTelObject* CCallDstd::OpenNewObjectL(TDes& /*aNewName*/) |
|
53 { |
|
54 User::Leave(KErrNotSupported); |
|
55 return NULL; |
|
56 } |
|
57 |
|
58 CTelObject::TReqMode CCallDstd::ReqModeL(const TInt aIpc) |
|
59 // |
|
60 // Basic Request Mode for Call |
|
61 // |
|
62 { |
|
63 CTelObject::TReqMode ret=0; |
|
64 switch (aIpc) |
|
65 { |
|
66 case EEtelCallRecoverDataPort: |
|
67 case EEtelCallAcquireOwnership: |
|
68 break; |
|
69 case EEtelCallNotifyStatusChange: |
|
70 ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately; |
|
71 break; |
|
72 case EEtelCallNotifyHookChange: |
|
73 ret=KReqModeMultipleCompletionEnabled; |
|
74 break; |
|
75 |
|
76 case EEtelCallGetStatus: |
|
77 case EEtelCallGetCaps: |
|
78 case EEtelCallLoanDataPort: |
|
79 case EEtelCallDial: |
|
80 case EEtelCallConnect: |
|
81 case EEtelCallAnswer: |
|
82 case EEtelCallHangUp: |
|
83 case EEtelCallTransferOwnership: |
|
84 case EEtelCallGetBearerServiceInfo: |
|
85 case EEtelCallGetOwnershipStatus: |
|
86 case EEtelCallGetFaxSettings: |
|
87 case EEtelCallSetFaxSettings: |
|
88 case EEtelCallReferenceCount: |
|
89 case EEtelAdoptFaxSharedHeaderFile: |
|
90 ret=KReqModeFlowControlObeyed; |
|
91 break; |
|
92 default: |
|
93 User::Leave(0); // Server error = Should not call this |
|
94 break; |
|
95 } |
|
96 return ret; |
|
97 } |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 // |
|
103 // CFaxDstd |
|
104 // |
|
105 CFaxDstd* CFaxDstd::NewL(CPhoneFactoryDummyBase* aFac) |
|
106 { |
|
107 CFaxDstd* fax=new(ELeave) CFaxDstd(aFac); |
|
108 CleanupStack::PushL(fax); |
|
109 fax->ConstructL(); |
|
110 CleanupStack::Pop(); |
|
111 return fax; |
|
112 } |
|
113 |
|
114 CFaxDstd::CFaxDstd(CPhoneFactoryDummyBase* aFac) |
|
115 :CFaxDummyBase(aFac) |
|
116 {} |
|
117 |
|
118 void CFaxDstd::ConstructL() |
|
119 { |
|
120 TInt r = iChunk.CreateGlobal(KNullDesC,sizeof (RFax::TProgress), sizeof (RFax::TProgress),EOwnerProcess); |
|
121 if (r == KErrNone) |
|
122 { |
|
123 RFax::TProgress* progress = new(iChunk.Base()) RFax::TProgress; |
|
124 progress->iLastUpdateTime = 0; |
|
125 progress->iAnswerback.Zero (); |
|
126 progress->iPhase = ENotYetStarted; |
|
127 progress->iSpeed = 9600; |
|
128 progress->iResolution = EFaxNormal; |
|
129 progress->iCompression = EModifiedHuffman; |
|
130 progress->iECM = 0; |
|
131 progress->iPage = 0; |
|
132 progress->iLines = 0; |
|
133 } |
|
134 else |
|
135 User::Leave(r); |
|
136 } |
|
137 |
|
138 CFaxDstd::~CFaxDstd() |
|
139 { |
|
140 iChunk.Close(); |
|
141 } |
|
142 |
|
143 RHandleBase* CFaxDstd::GlobalKernelObjectHandle() |
|
144 { |
|
145 return &iChunk; |
|
146 } |
|
147 |
|
148 |
|
149 // |
|
150 // CLineDstd |
|
151 // |
|
152 CLineDstd* CLineDstd::NewL(CPhoneFactoryDummyBase* aFac) |
|
153 { |
|
154 CLineDstd* line=new(ELeave) CLineDstd(aFac); |
|
155 CleanupStack::PushL(line); |
|
156 line->ConstructL(); |
|
157 CleanupStack::Pop(); |
|
158 return line; |
|
159 } |
|
160 |
|
161 CLineDstd::CLineDstd(CPhoneFactoryDummyBase* aFac) |
|
162 :CLineDummyBase(aFac) |
|
163 { |
|
164 iFac=aFac; |
|
165 } |
|
166 |
|
167 CLineDstd::~CLineDstd() |
|
168 {} |
|
169 |
|
170 TInt CLineDstd::EnumerateCall(const TTsyReqHandle aTsyReqHandle,TInt* aCount) |
|
171 { |
|
172 *aCount=iNumberOfCalls; |
|
173 ReqCompleted(aTsyReqHandle,KErrNone); |
|
174 return KErrNone; |
|
175 } |
|
176 |
|
177 TInt CLineDstd::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* aCallInfo) |
|
178 { |
|
179 aCallInfo->iInfo.iStatus=DSTD_CALL_STATUS; |
|
180 ReqCompleted(aTsyReqHandle,KErrNone); |
|
181 return KErrNone; |
|
182 } |
|
183 |
|
184 TInt CLineDstd::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
185 { |
|
186 return KErrNotSupported; |
|
187 } |
|
188 |
|
189 CTelObject* CLineDstd::OpenNewObjectByNameL(const TDesC& /*aName*/) |
|
190 { |
|
191 return REINTERPRET_CAST(CTelObject*,CCallDstd::NewL(iFac)); |
|
192 } |
|
193 |
|
194 CTelObject* CLineDstd::OpenNewObjectL(TDes& aNewName) |
|
195 { |
|
196 aNewName.Append(DSTD_MODULE_NAME); |
|
197 aNewName.AppendNum(iNameIndex++); |
|
198 return REINTERPRET_CAST(CTelObject*,CCallDstd::NewL(iFac)); |
|
199 } |
|
200 |
|
201 // |
|
202 // CPhoneDstd |
|
203 // |
|
204 CPhoneDstd* CPhoneDstd::NewL(CPhoneFactoryDummyBase* aFac) |
|
205 { |
|
206 CPhoneDstd* phone=new(ELeave) CPhoneDstd(aFac); |
|
207 CleanupStack::PushL(phone); |
|
208 phone->ConstructL(); |
|
209 CleanupStack::Pop(); |
|
210 return phone; |
|
211 } |
|
212 |
|
213 CPhoneDstd::CPhoneDstd(CPhoneFactoryDummyBase* aFac) |
|
214 :CPhoneDummyBase(aFac) |
|
215 {} |
|
216 |
|
217 CPhoneDstd::~CPhoneDstd() |
|
218 {} |
|
219 |
|
220 TInt CPhoneDstd::EnumerateLines(const TTsyReqHandle aTsyReqHandle,TInt* aNumLines) |
|
221 { |
|
222 *aNumLines=DSTD_NUMBER_OF_LINES; |
|
223 ReqCompleted(aTsyReqHandle,KErrNone); |
|
224 return KErrNone; |
|
225 } |
|
226 |
|
227 TInt CPhoneDstd::GetLineInfo(const TTsyReqHandle aTsyReqHandle,TLineInfoIndex* aLineInfo) |
|
228 { |
|
229 |
|
230 if (aLineInfo->iIndex!=0) |
|
231 return(KErrArgument); |
|
232 |
|
233 aLineInfo->iInfo.iStatus=DSTD_LINE_STATUS; |
|
234 aLineInfo->iInfo.iName.Copy(DSTD_LINE_NAME); |
|
235 |
|
236 ReqCompleted(aTsyReqHandle,KErrNone); |
|
237 return KErrNone; |
|
238 } |
|
239 |
|
240 CTelObject::TReqMode CPhoneDstd::ReqModeL(const TInt aIpc) |
|
241 // |
|
242 // Request Mode for Phone |
|
243 // |
|
244 { |
|
245 CTelObject::TReqMode ret=0; |
|
246 switch (aIpc) |
|
247 { |
|
248 case ETestCustomIPC1: |
|
249 case ETestCustomIPC2: |
|
250 case ETestCustomIPC3: |
|
251 case ETestCustomIPC4: |
|
252 case ETestCustomIPC5: |
|
253 case ETestCustomIPC6: |
|
254 case ETestCustomIPC7: |
|
255 case ETestCustomIPC8: |
|
256 case ETestCustomIPC9: |
|
257 break; |
|
258 case EEtelPhoneNotifyModemDetected: |
|
259 ret=KReqModeMultipleCompletionEnabled; |
|
260 break; |
|
261 case EEtelPhoneEnumerateLines: |
|
262 case EEtelPhoneGetLineInfo: |
|
263 case EEtelPhoneGetCaps: |
|
264 case EEtelPhoneGetStatus: |
|
265 case EEtelPhoneGetInfo: |
|
266 case ETestEtelUnicodeSetAndNarrowGet: |
|
267 case ETestEtelNarrowSetAndGet: |
|
268 case ETestEtelNarrowSetAndUnicodeGet: |
|
269 case ETestEtelUnicodeSetAndGet: |
|
270 case ETestEtelDoubleUnicodeGet: |
|
271 case EETelPhoneSetEmergencyClient: |
|
272 ret=KReqModeFlowControlObeyed; |
|
273 break; |
|
274 default: |
|
275 User::Leave(KErrNotSupported); |
|
276 break; |
|
277 } |
|
278 return ret; |
|
279 |
|
280 } |
|
281 |
|
282 TInt CPhoneDstd::ExtFunc(const TTsyReqHandle aTsyReqHandle, const TInt aIpc, const TDataPackage& aPackage) |
|
283 { |
|
284 |
|
285 switch (aIpc) |
|
286 { |
|
287 case ETestEtelNarrowSetAndGet: |
|
288 return TestNarrowSetAndGet(aTsyReqHandle, aPackage.Des1n(),aPackage.Des2n()); |
|
289 |
|
290 case ETestEtelUnicodeSetAndNarrowGet: |
|
291 return TestUnicodeSetAndNarrowGet(aTsyReqHandle, aPackage.Des1n(),aPackage.Des2u()); |
|
292 |
|
293 case ETestEtelUnicodeSetAndGet: |
|
294 return TestUnicodeSetAndGet(aTsyReqHandle, aPackage.Des1u(),aPackage.Des2u()); |
|
295 |
|
296 case ETestEtelNarrowSetAndUnicodeGet: |
|
297 return TestNarrowSetAndUnicodeGet(aTsyReqHandle, aPackage.Des1n(),aPackage.Des2u()); |
|
298 |
|
299 case ETestEtelDoubleUnicodeGet: |
|
300 return TestDoubleUnicodeGet(aTsyReqHandle, aPackage.Des1u(), aPackage.Des2u()); |
|
301 |
|
302 //Custom IPC 1,2 &6 are supported by this TSY. |
|
303 case ETestCustomIPC1: //IPC 1000055 |
|
304 case ETestCustomIPC2: //IPC 1000056 |
|
305 ReqCompleted(aTsyReqHandle,KErrNone); |
|
306 return KErrNone; |
|
307 |
|
308 case EETelPhoneSetEmergencyClient: |
|
309 ReqCompleted(aTsyReqHandle,KErrNone); |
|
310 return KErrNone; |
|
311 |
|
312 case ETestCustomIPC6: |
|
313 return KErrCancel; //IPC 100500 (potentially a cancel request for IPC 9000) |
|
314 |
|
315 //Custom IPCs 3,4,5,7,8 & 9 are not supported for various reasons. |
|
316 //Typically a TSY will not explicitly list the IPCs it does not support but they are listed |
|
317 //here for clarity |
|
318 case ETestCustomIPC3: //IPC 1000099 - No support for this IPC in this TSY |
|
319 case ETestCustomIPC4: //IPC 1000100 - No support for this IPC in this TSY |
|
320 case ETestCustomIPC5: //IPC 1000499 - No support for this IPC in this TSY |
|
321 case ETestCustomIPC7: //IPC 1000099 - No support for this IPC in this TSY |
|
322 case ETestCustomIPC8: //IPC 1001000 - Should never be supported by a TSY as IPC is outside allocated range |
|
323 case ETestCustomIPC9: //IPC 999999 - Should never be supported by a TSY as IPC is outside allocated range |
|
324 return KErrNotSupported; |
|
325 } |
|
326 |
|
327 return KErrNotSupported; |
|
328 } |
|
329 |
|
330 CTelObject* CPhoneDstd::OpenNewObjectByNameL(const TDesC& aName) |
|
331 { |
|
332 if (aName.Compare(DSTD_LINE_NAME)==KErrNone) |
|
333 return REINTERPRET_CAST(CTelObject*,CLineDstd::NewL(FacPtr())); |
|
334 return NULL; |
|
335 } |
|
336 |
|
337 CTelObject* CPhoneDstd::OpenNewObjectL(TDes& /*aNewName*/) |
|
338 { |
|
339 User::Leave(KErrNotSupported); |
|
340 return NULL; |
|
341 } |
|
342 |
|
343 void CPhoneDstd::Init() |
|
344 {} |
|
345 |
|
346 |
|
347 TInt CPhoneDstd::TestNarrowSetAndGet(const TTsyReqHandle aTsyReqHandle, const TDesC8* aDes1, TDes8* aDes2) |
|
348 { |
|
349 if (aDes1->Compare(DSTD_NARROW)!=KErrNone) |
|
350 { |
|
351 TInt extendedError = (KErrLicenseeSpecificCorrupt << 16) | |
|
352 (KErrCorrupt & 0x0000ffff); |
|
353 |
|
354 ReqCompleted(aTsyReqHandle,extendedError); |
|
355 } |
|
356 else |
|
357 { |
|
358 TInt extendedError = (KErrLicenseeSpecificOkay << 16) | |
|
359 (KErrNone & 0x0000ffff); |
|
360 |
|
361 *aDes2=DSTD_NARROW; |
|
362 ReqCompleted(aTsyReqHandle,extendedError); |
|
363 } |
|
364 return KErrNone; |
|
365 } |
|
366 |
|
367 TInt CPhoneDstd::TestUnicodeSetAndNarrowGet(const TTsyReqHandle aTsyReqHandle, TDes8* aDes1, const TDesC16* aDes2) |
|
368 { |
|
369 if (aDes2->Compare(DSTD_UNICODE)!=KErrNone) |
|
370 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
371 else |
|
372 { |
|
373 *aDes1=DSTD_NARROW; |
|
374 ReqCompleted(aTsyReqHandle,KErrNone); |
|
375 } |
|
376 return KErrNone; |
|
377 } |
|
378 |
|
379 TInt CPhoneDstd::TestUnicodeSetAndGet(const TTsyReqHandle aTsyReqHandle, const TDesC16* aDes1, TDes16* aDes2) |
|
380 { |
|
381 if (aDes1->Compare(DSTD_UNICODE)!=KErrNone) |
|
382 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
383 else |
|
384 { |
|
385 *aDes2=DSTD_UNICODE; |
|
386 ReqCompleted(aTsyReqHandle,KErrNone); |
|
387 } |
|
388 return KErrNone; |
|
389 } |
|
390 |
|
391 TInt CPhoneDstd::TestNarrowSetAndUnicodeGet(const TTsyReqHandle aTsyReqHandle, const TDesC8* aDes1 , TDes16* aDes2) |
|
392 { |
|
393 if (aDes1->Compare(DSTD_NARROW)!=KErrNone) |
|
394 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
395 else |
|
396 { |
|
397 *aDes2=DSTD_UNICODE; |
|
398 ReqCompleted(aTsyReqHandle,KErrNone); |
|
399 } |
|
400 return KErrNone; |
|
401 } |
|
402 |
|
403 TInt CPhoneDstd::TestDoubleUnicodeGet(const TTsyReqHandle aTsyReqHandle, TDes16* aDes1 , TDes16* aDes2) |
|
404 { |
|
405 *aDes1=DSTD_UNICODE; |
|
406 *aDes2=DSTD_UNICODE; |
|
407 ReqCompleted(aTsyReqHandle,KErrNone); |
|
408 |
|
409 return KErrNone; |
|
410 } |
|
411 |
|
412 TSecurityPolicy CPhoneDstd::GetRequiredPlatSecCaps(const TInt aIpc) |
|
413 { |
|
414 switch(aIpc) |
|
415 { |
|
416 case ETestCustomIPC1: |
|
417 return TSecurityPolicy(ECapabilityNetworkServices); |
|
418 |
|
419 case ETestCustomIPC2: |
|
420 return TSecurityPolicy(ECapabilityTCB); |
|
421 |
|
422 case ETestCustomIPC6: |
|
423 return TSecurityPolicy(ECapabilityReadUserData, ECapabilityWriteUserData); |
|
424 |
|
425 case ETestCustomIPC3: //Not supported by this TSY |
|
426 case ETestCustomIPC4: //Not supported by this TSY |
|
427 case ETestCustomIPC5: //Not supported by this TSY |
|
428 case ETestCustomIPC7: //Not supported by this TSY |
|
429 case ETestCustomIPC8: //Not in range of IPCs allocated to Custom IPCs should be caught by Etel's policy table |
|
430 case ETestCustomIPC9: //Not in range of IPCs allocated to Custom IPCs should be caught by Etel's policy table |
|
431 return TSecurityPolicy(TSecurityPolicy::EAlwaysFail); |
|
432 |
|
433 default: |
|
434 //For any non-Custom IPCs return a policy that will always cause the capability check to pass |
|
435 return TSecurityPolicy(TSecurityPolicy::EAlwaysPass); |
|
436 } |
|
437 } |
|
438 |
|
439 // |
|
440 // FlowControl Phone |
|
441 // |
|
442 |
|
443 // |
|
444 // CFaxFc |
|
445 // |
|
446 CFaxFc* CFaxFc::NewL(CPhoneFactoryDummyBase* aFac) |
|
447 { |
|
448 CFaxFc* fax=new(ELeave) CFaxFc(aFac); |
|
449 CleanupStack::PushL(fax); |
|
450 fax->ConstructL(); |
|
451 CleanupStack::Pop(); |
|
452 return fax; |
|
453 } |
|
454 |
|
455 CFaxFc::CFaxFc(CPhoneFactoryDummyBase* aFac) |
|
456 :CFaxDummyBase(aFac) |
|
457 {} |
|
458 |
|
459 void CFaxFc::ConstructL() |
|
460 { |
|
461 TInt r = iChunk.CreateGlobal(KNullDesC,sizeof (RFax::TProgress), sizeof (RFax::TProgress),EOwnerProcess); |
|
462 if (r == KErrNone) |
|
463 { |
|
464 RFax::TProgress* progress = new(iChunk.Base()) RFax::TProgress; |
|
465 progress->iLastUpdateTime = 0; |
|
466 progress->iAnswerback.Zero (); |
|
467 progress->iPhase = ENotYetStarted; |
|
468 progress->iSpeed = 9600; |
|
469 progress->iResolution = EFaxNormal; |
|
470 progress->iCompression = EModifiedHuffman; |
|
471 progress->iECM = 0; |
|
472 progress->iPage = 0; |
|
473 progress->iLines = 0; |
|
474 } |
|
475 else |
|
476 User::Leave(r); |
|
477 } |
|
478 |
|
479 CFaxFc::~CFaxFc() |
|
480 { |
|
481 iChunk.Close(); |
|
482 } |
|
483 |
|
484 RHandleBase* CFaxFc::GlobalKernelObjectHandle() |
|
485 { |
|
486 return &iChunk; |
|
487 } |
|
488 |
|
489 // |
|
490 // CCallFc |
|
491 // |
|
492 CCallFc* CCallFc::NewL(CPhoneFactoryDummyBase* aFac) |
|
493 { |
|
494 CCallFc* call=new(ELeave) CCallFc(aFac); |
|
495 CleanupStack::PushL(call); |
|
496 call->ConstructL(); |
|
497 CleanupStack::Pop(); |
|
498 return call; |
|
499 } |
|
500 |
|
501 CCallFc::CCallFc(CPhoneFactoryDummyBase* aFac) |
|
502 :CCallDummyBase(aFac) |
|
503 {} |
|
504 |
|
505 CCallFc::~CCallFc() |
|
506 {} |
|
507 |
|
508 |
|
509 |
|
510 TInt CCallFc::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
511 { |
|
512 return KErrNotSupported; |
|
513 } |
|
514 |
|
515 CTelObject* CCallFc::OpenNewObjectByNameL(const TDesC& ) |
|
516 { |
|
517 return REINTERPRET_CAST(CTelObject*,CFaxFc::NewL(FacPtr())); |
|
518 } |
|
519 |
|
520 CTelObject* CCallFc::OpenNewObjectL(TDes& /*aNewName*/) |
|
521 { |
|
522 User::Leave(KErrNotSupported); |
|
523 return NULL; |
|
524 } |
|
525 |
|
526 // |
|
527 // CLineFc |
|
528 // |
|
529 CLineFc* CLineFc::NewL(CPhoneFactoryDummyBase* aFac) |
|
530 { |
|
531 CLineFc* line=new(ELeave)CLineFc(aFac); |
|
532 CleanupStack::PushL(line); |
|
533 line->ConstructL(); |
|
534 CleanupStack::Pop(); |
|
535 return line; |
|
536 } |
|
537 |
|
538 CLineFc::CLineFc(CPhoneFactoryDummyBase* aFac) |
|
539 :CLineDummyBase(aFac) |
|
540 {} |
|
541 |
|
542 CLineFc::~CLineFc() |
|
543 {} |
|
544 |
|
545 TInt CLineFc::EnumerateCall(const TTsyReqHandle aTsyReqHandle,TInt* aCount) |
|
546 { |
|
547 *aCount=iNumberOfCalls; |
|
548 ReqCompleted(aTsyReqHandle,KErrNone); |
|
549 return KErrNone; |
|
550 } |
|
551 |
|
552 TInt CLineFc::GetCallInfo(const TTsyReqHandle aTsyReqHandle,TCallInfoIndex* aCallInfo) |
|
553 { |
|
554 aCallInfo->iInfo.iStatus=DSTDFC_CALL_STATUS; |
|
555 ReqCompleted(aTsyReqHandle,KErrNone); |
|
556 return KErrNone; |
|
557 } |
|
558 |
|
559 TInt CLineFc::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
560 { |
|
561 return KErrNotSupported; |
|
562 } |
|
563 |
|
564 CTelObject* CLineFc::OpenNewObjectByNameL(const TDesC& aName) |
|
565 { |
|
566 if (aName.Compare(DSTDFC_CALL_NAME)==KErrNone) |
|
567 return REINTERPRET_CAST(CTelObject*,CCallFc::NewL(FacPtr())); |
|
568 return NULL; |
|
569 } |
|
570 |
|
571 CTelObject* CLineFc::OpenNewObjectL(TDes& aNewName) |
|
572 { |
|
573 aNewName.Append(DSTD_MODULE_NAME); |
|
574 aNewName.AppendNum(iNameIndex++); |
|
575 return REINTERPRET_CAST(CTelObject*,CCallFc::NewL(FacPtr())); |
|
576 } |
|
577 |
|
578 // |
|
579 // CPhoneFc |
|
580 // |
|
581 CPhoneFc* CPhoneFc::NewL(CPhoneFactoryDummyBase* aFac) |
|
582 { |
|
583 CPhoneFc* phone=new(ELeave) CPhoneFc(aFac); |
|
584 CleanupStack::PushL(phone); |
|
585 phone->ConstructL(); |
|
586 CleanupStack::Pop(); |
|
587 return phone; |
|
588 } |
|
589 |
|
590 CPhoneFc::CPhoneFc(CPhoneFactoryDummyBase* aFac) |
|
591 :CPhoneDummyBase(aFac) |
|
592 {} |
|
593 |
|
594 void CPhoneFc::Init() |
|
595 { |
|
596 FlowControlSuspend(); |
|
597 FacPtr()->QueueTimer(iOpenPhone,0,DSTDFC_OPEN_PHONE_TIMEOUT,CPhoneFc::OpenPhoneHandler,this); |
|
598 } |
|
599 |
|
600 TInt CPhoneFc::OpenPhoneHandler(TAny* aPtr) |
|
601 { |
|
602 REINTERPRET_CAST(CPhoneFc*,aPtr)->FlowControlResume(); |
|
603 REINTERPRET_CAST(CPhoneFc*,aPtr)->FacPtr()->ResetPending(REINTERPRET_CAST(CPhoneFc*,aPtr)->iOpenPhone ); |
|
604 return KErrNone; |
|
605 } |
|
606 |
|
607 CPhoneFc::~CPhoneFc() |
|
608 { |
|
609 FacPtr()->RemoveTimer(iOpenPhone); |
|
610 } |
|
611 |
|
612 TInt CPhoneFc::EnumerateLines(const TTsyReqHandle aTsyReqHandle,TInt* aNumLines) |
|
613 { |
|
614 *aNumLines=DSTDFC_NUMBER_OF_LINES; |
|
615 ReqCompleted(aTsyReqHandle,KErrNone); |
|
616 return KErrNone; |
|
617 } |
|
618 |
|
619 TInt CPhoneFc::GetLineInfo(const TTsyReqHandle aTsyReqHandle,TLineInfoIndex* aLineInfo) |
|
620 { |
|
621 if (aLineInfo->iIndex!=0) |
|
622 return(KErrArgument); |
|
623 |
|
624 aLineInfo->iInfo.iStatus=DSTDFC_LINE_STATUS; |
|
625 aLineInfo->iInfo.iName.Copy(DSTDFC_LINE_NAME); |
|
626 |
|
627 ReqCompleted(aTsyReqHandle,KErrNone); |
|
628 return KErrNone; |
|
629 } |
|
630 |
|
631 TInt CPhoneFc::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
632 { |
|
633 return KErrNotSupported; |
|
634 } |
|
635 |
|
636 CTelObject* CPhoneFc::OpenNewObjectByNameL(const TDesC& aName) |
|
637 { |
|
638 if (aName.Compare(DSTDFC_LINE_NAME)==KErrNone) |
|
639 return REINTERPRET_CAST(CTelObject*,CLineFc::NewL(FacPtr())); |
|
640 return NULL; |
|
641 } |
|
642 |
|
643 CTelObject* CPhoneFc::OpenNewObjectL(TDes& /*aNewName*/) |
|
644 { |
|
645 User::Leave(KErrNotSupported); |
|
646 return NULL; |
|
647 } |
|
648 |
|
649 // |
|
650 // CFaxPm |
|
651 // |
|
652 CFaxPm* CFaxPm::NewL(CPhoneFactoryDummyBase* aFac) |
|
653 { |
|
654 CFaxPm* fax=new(ELeave) CFaxPm(aFac); |
|
655 CleanupStack::PushL(fax); |
|
656 fax->ConstructL(); |
|
657 CleanupStack::Pop(); |
|
658 return fax; |
|
659 } |
|
660 |
|
661 CFaxPm::CFaxPm(CPhoneFactoryDummyBase* aFac) |
|
662 :CFaxDummyBase(aFac) |
|
663 {} |
|
664 |
|
665 void CFaxPm::ConstructL() |
|
666 { |
|
667 TInt r = iChunk.CreateGlobal(KNullDesC,sizeof (RFax::TProgress), sizeof (RFax::TProgress),EOwnerProcess); |
|
668 if (r == KErrNone) |
|
669 { |
|
670 RFax::TProgress* progress = new(iChunk.Base()) RFax::TProgress; |
|
671 progress->iLastUpdateTime = 0; |
|
672 progress->iAnswerback.Zero (); |
|
673 progress->iPhase = ENotYetStarted; |
|
674 progress->iSpeed = 9600; |
|
675 progress->iResolution = EFaxNormal; |
|
676 progress->iCompression = EModifiedHuffman; |
|
677 progress->iECM = 0; |
|
678 progress->iPage = 0; |
|
679 progress->iLines = 0; |
|
680 } |
|
681 else |
|
682 User::Leave(r); |
|
683 } |
|
684 |
|
685 CFaxPm::~CFaxPm() |
|
686 { |
|
687 iChunk.Close(); |
|
688 } |
|
689 |
|
690 RHandleBase* CFaxPm::GlobalKernelObjectHandle() |
|
691 { |
|
692 return &iChunk; |
|
693 } |
|
694 |
|
695 |
|
696 // |
|
697 // CCallPm |
|
698 // |
|
699 CCallPm* CCallPm::NewL(TInt& aNumberOfCalls,CPhoneFactoryDummyBase* aFac) |
|
700 { |
|
701 CCallPm* call=new(ELeave) CCallPm(aNumberOfCalls,aFac); |
|
702 CleanupStack::PushL(call); |
|
703 call->ConstructL(); |
|
704 CleanupStack::Pop(); |
|
705 return call; |
|
706 } |
|
707 |
|
708 CCallPm::CCallPm(TInt& aNumberOfCalls,CPhoneFactoryDummyBase* aFac) |
|
709 : CCallDummyBase(aFac), |
|
710 iNumberOfCalls(aNumberOfCalls) |
|
711 {} |
|
712 |
|
713 CCallPm::~CCallPm() |
|
714 { |
|
715 iNumberOfCalls--; |
|
716 } |
|
717 |
|
718 TInt CCallPm::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
719 { |
|
720 return KErrNotSupported; |
|
721 } |
|
722 |
|
723 CTelObject* CCallPm::OpenNewObjectByNameL(const TDesC& ) |
|
724 { |
|
725 return REINTERPRET_CAST(CTelObject*,CFaxPm::NewL(FacPtr())); |
|
726 } |
|
727 CTelObject* CCallPm::OpenNewObjectL(TDes& /*aNewName*/) |
|
728 { |
|
729 User::Leave(KErrNotSupported); |
|
730 return NULL; |
|
731 } |
|
732 |
|
733 |
|
734 // |
|
735 // CLinePm |
|
736 // |
|
737 CLinePm* CLinePm::NewL(CPhoneFactoryDummyBase* aFac) |
|
738 { |
|
739 CLinePm* line=new(ELeave) CLinePm(aFac); |
|
740 CleanupStack::PushL(line); |
|
741 line->ConstructL(); |
|
742 CleanupStack::Pop(); |
|
743 return line; |
|
744 } |
|
745 |
|
746 CLinePm::CLinePm(CPhoneFactoryDummyBase* aFac) |
|
747 :CLineDummyBase(aFac) |
|
748 {} |
|
749 |
|
750 void CLinePm::ConstructL() |
|
751 { |
|
752 CLineDummyBase::ConstructL(); |
|
753 iNumberOfCalls=0; |
|
754 iCallName.SetLength(0); |
|
755 } |
|
756 |
|
757 CLinePm::~CLinePm() |
|
758 {} |
|
759 |
|
760 TInt CLinePm::EnumerateCall(const TTsyReqHandle aTsyReqHandle,TInt* aCount) |
|
761 { |
|
762 *aCount=iNumberOfCalls; |
|
763 ReqCompleted(aTsyReqHandle,KErrNone); |
|
764 return KErrNone; |
|
765 } |
|
766 |
|
767 TInt CLinePm::GetCallInfo(const TTsyReqHandle aUid,TCallInfoIndex* aCallInfo) |
|
768 { |
|
769 aCallInfo->iInfo.iStatus= DSTDPM_CALL_STATUS; |
|
770 aCallInfo->iInfo.iCallName.Copy(iCallName); |
|
771 |
|
772 ReqCompleted(aUid,KErrNone); |
|
773 return KErrNone; |
|
774 } |
|
775 |
|
776 TInt CLinePm::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
777 { |
|
778 return KErrNotSupported; |
|
779 } |
|
780 |
|
781 CTelObject* CLinePm::OpenNewObjectByNameL(const TDesC& aName) |
|
782 { |
|
783 iNumberOfCalls++; |
|
784 iCallName.Copy(aName); |
|
785 return REINTERPRET_CAST(CTelObject*,CCallPm::NewL(iNumberOfCalls,FacPtr())); |
|
786 } |
|
787 CTelObject* CLinePm::OpenNewObjectL(TDes& aNewName) |
|
788 { |
|
789 iNumberOfCalls++; |
|
790 aNewName.Append(DSTD_MODULE_NAME); |
|
791 aNewName.AppendNum(iNameIndex++); |
|
792 iCallName.Copy(aNewName); |
|
793 return REINTERPRET_CAST(CTelObject*,CCallPm::NewL(iNumberOfCalls,FacPtr())); |
|
794 } |
|
795 |
|
796 // |
|
797 // CPhonePm |
|
798 // |
|
799 CPhonePm* CPhonePm::NewL(CPhoneFactoryDummyBase* aFac) |
|
800 { |
|
801 CPhonePm* phone=new(ELeave) CPhonePm(aFac); |
|
802 CleanupStack::PushL(phone); |
|
803 phone->ConstructL(); |
|
804 CleanupStack::Pop(); |
|
805 return phone; |
|
806 } |
|
807 |
|
808 CPhonePm::CPhonePm(CPhoneFactoryDummyBase* aFac) |
|
809 :CPhoneDummyBase(aFac) |
|
810 {} |
|
811 |
|
812 void CPhonePm::Init() |
|
813 {} |
|
814 |
|
815 CPhonePm::~CPhonePm() |
|
816 {} |
|
817 |
|
818 TInt CPhonePm::EnumerateLines(const TTsyReqHandle aTsyReqHandle,TInt* aNumLines) |
|
819 { |
|
820 *aNumLines=DSTDPM_NUMBER_OF_LINES; |
|
821 ReqCompleted(aTsyReqHandle,KErrNone); |
|
822 return KErrNone; |
|
823 } |
|
824 |
|
825 TInt CPhonePm::GetLineInfo(const TTsyReqHandle aTsyReqHandle,TLineInfoIndex* aLineInfo) |
|
826 { |
|
827 if (aLineInfo->iIndex!=0) |
|
828 return(KErrArgument); |
|
829 |
|
830 aLineInfo->iInfo.iStatus=DSTDPM_LINE_STATUS; |
|
831 aLineInfo->iInfo.iName.Copy(DSTDPM_LINE_NAME); |
|
832 |
|
833 ReqCompleted(aTsyReqHandle,KErrNone); |
|
834 return KErrNone; |
|
835 } |
|
836 |
|
837 TInt CPhonePm::ExtFunc(const TTsyReqHandle,const TInt,const TDataPackage&) |
|
838 { |
|
839 return KErrNotSupported; |
|
840 } |
|
841 |
|
842 CTelObject* CPhonePm::OpenNewObjectByNameL(const TDesC& aName) |
|
843 { |
|
844 if (aName.Compare(DSTDPM_LINE_NAME)==KErrNone) |
|
845 return REINTERPRET_CAST(CTelObject*,CLinePm::NewL(FacPtr())); |
|
846 return NULL; |
|
847 } |
|
848 CTelObject* CPhonePm::OpenNewObjectL(TDes& /*aNewName*/) |
|
849 { |
|
850 User::Leave(KErrNotSupported); |
|
851 return NULL; |
|
852 } |
|
853 |
|
854 // |
|
855 // First Ordinal Functions |
|
856 // |
|
857 extern "C" |
|
858 { |
|
859 IMPORT_C CPhoneFactoryBase* LibEntry(); // Force "Proper Name" export |
|
860 } |
|
861 |
|
862 void CPhoneFactoryDstd::CloseObj(TAny* aObj) |
|
863 /** |
|
864 * A utility function for cleaning up the stack. |
|
865 * |
|
866 * @param aObj a pointer to the CObject to close |
|
867 */ |
|
868 { |
|
869 ((CObject*)aObj)->Close(); |
|
870 } |
|
871 |
|
872 EXPORT_C CPhoneFactoryBase* LibEntry() |
|
873 { |
|
874 CPhoneFactoryDstd* factory = NULL; |
|
875 TRAP_IGNORE(factory = CPhoneFactoryDstd::NewL()); |
|
876 return factory; |
|
877 } |
|
878 |
|
879 // |
|
880 // DSTD Phone Factory Functions |
|
881 // |
|
882 |
|
883 CPhoneFactoryDstd* CPhoneFactoryDstd::NewL() |
|
884 { |
|
885 CPhoneFactoryDstd *phoneFac = new (ELeave) CPhoneFactoryDstd; |
|
886 TCleanupItem newPhoneFacClose(CloseObj,phoneFac); |
|
887 CleanupStack::PushL(newPhoneFacClose); |
|
888 phoneFac->ConstructL(); |
|
889 CleanupStack::Pop(); |
|
890 return phoneFac; |
|
891 } |
|
892 |
|
893 CPhoneFactoryDstd::CPhoneFactoryDstd() |
|
894 { |
|
895 iVersion=TVersion( KTsyEtelMajorVersionNumber, |
|
896 KTsyEtelMinorVersionNumber, |
|
897 KTsyEtelBuildVersionNumber); |
|
898 } |
|
899 |
|
900 CPhoneFactoryDstd::~CPhoneFactoryDstd() |
|
901 {} |
|
902 |
|
903 CPhoneBase* CPhoneFactoryDstd::NewPhoneL(const TDesC& aName) |
|
904 { |
|
905 if (aName.Compare(DSTD_PHONE_NAME)==KErrNone) |
|
906 return CPhoneDstd::NewL(this); |
|
907 if (aName.Compare(DSTDFC_PHONE_NAME)==KErrNone) |
|
908 return CPhoneFc::NewL(this); |
|
909 if (aName.Compare(DSTDPM_PHONE_NAME)==KErrNone) |
|
910 return CPhonePm::NewL(this); |
|
911 if (aName.Compare(DSTD_SLOW_PHONE_NAME)==KErrNone) |
|
912 return CPhoneDstdSlow::NewL(this); |
|
913 return NULL; |
|
914 } |
|
915 |
|
916 TInt CPhoneFactoryDstd::GetPhoneInfo(const TInt aIndex,RTelServer::TPhoneInfo& aInfo) |
|
917 { |
|
918 switch(aIndex) |
|
919 { |
|
920 case 0: |
|
921 aInfo.iNetworkType=DSTD_NETWORK_TYPE; |
|
922 aInfo.iName=DSTD_PHONE_NAME; |
|
923 aInfo.iNumberOfLines=DSTD_NUMBER_OF_LINES; |
|
924 return KErrNone; |
|
925 case 1: |
|
926 aInfo.iNetworkType=DSTDFC_NETWORK_TYPE; |
|
927 aInfo.iName=DSTDFC_PHONE_NAME; |
|
928 aInfo.iNumberOfLines=DSTDFC_NUMBER_OF_LINES; |
|
929 return KErrNone; |
|
930 case 2: |
|
931 aInfo.iNetworkType=DSTDPM_NETWORK_TYPE; |
|
932 aInfo.iName=DSTDPM_PHONE_NAME; |
|
933 aInfo.iNumberOfLines=DSTDPM_NUMBER_OF_LINES; |
|
934 return KErrNone; |
|
935 case 3: |
|
936 aInfo.iNetworkType=DSTDPM_NETWORK_TYPE; |
|
937 aInfo.iName=DSTD_SLOW_PHONE_NAME; |
|
938 aInfo.iNumberOfLines=DSTDPM_NUMBER_OF_LINES; |
|
939 return KErrNone; |
|
940 default: |
|
941 return KErrNotFound; |
|
942 } |
|
943 } |
|
944 |
|
945 TInt CPhoneFactoryDstd::EnumeratePhones() |
|
946 { |
|
947 TVersion version(KTsyEtelMajorVersionNumber, |
|
948 KTsyEtelMinorVersionNumber, |
|
949 KTsyEtelBuildVersionNumber); |
|
950 if (!QueryVersionSupported(version)) |
|
951 return(KErrNotSupported); |
|
952 |
|
953 return (DSTD_NUMBER_OF_PHONES); |
|
954 } |
|
955 |
|
956 |
|
957 // |
|
958 // CPhoneDstdSlow |
|
959 // |
|
960 CPhoneDstdSlow* CPhoneDstdSlow::NewL(CPhoneFactoryDummyBase* aFac) |
|
961 { |
|
962 CPhoneDstdSlow* phone=new(ELeave) CPhoneDstdSlow(aFac); |
|
963 CleanupStack::PushL(phone); |
|
964 phone->ConstructL(); |
|
965 CleanupStack::Pop(); |
|
966 return phone; |
|
967 } |
|
968 |
|
969 CPhoneDstdSlow::CPhoneDstdSlow(CPhoneFactoryDummyBase* aFac) |
|
970 :CPhoneDstd(aFac) |
|
971 {} |
|
972 |
|
973 CPhoneDstdSlow::~CPhoneDstdSlow() |
|
974 {} |
|
975 |
|
976 TInt CPhoneDstdSlow::GetLineInfo(const TTsyReqHandle aTsyReqHandle,TLineInfoIndex* aLineInfo) |
|
977 { |
|
978 User::After(1000); |
|
979 return CPhoneDstd::GetLineInfo(aTsyReqHandle,aLineInfo); |
|
980 } |
|
981 |