comparison gsm-fw/g23m-aci/aci/cmh_ccq.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children e8f37d3414b6
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_CCQ
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module provides the query functions related to the
18 | protocol stack adapter for mobility management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_CCQ_C
23 #define CMH_CCQ_C
24 #endif
25
26 /*==== INCLUDES ===================================================*/
27
28 #include "aci_all.h"
29 #include "aci_cmh.h"
30
31 #ifdef FAX_AND_DATA
32 #include "aci_fd.h"
33 #endif /* of #ifdef FAX_AND_DATA */
34
35 #include "psa.h"
36 #include "psa_cc.h"
37 #include "cmh.h"
38 #include "cmh_cc.h"
39
40 #include "aoc.h"
41 #include "audio.h"
42
43 #include "dti_conn_mng.h"
44 #include "psa_sim.h"
45 #include "cmh_sim.h"
46 #include "psa_mm.h"
47
48 /*==== CONSTANTS ==================================================*/
49 #ifdef TI_PS_FF_AT_P_CMD_RDLB
50 EXTERN T_ACI_CC_REDIAL_BLACKL * cc_blacklist_ptr;
51 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
52
53 const UBYTE aci_clcc_dir [5][2] = {
54 { NO_VLD_CT, NO_VLD_CT },
55 { CLCC_DIR_MOC, CLCC_DIR_MOC },
56 { CLCC_DIR_MTC, CLCC_DIR_MTC },
57 { CLCC_DIR_MOC, CLCC_DIR_MOC_NI },
58 { CLCC_DIR_MOC, CLCC_DIR_MOC_RDL }
59 };
60
61 /*==== EXPORT =====================================================*/
62
63 /*==== VARIABLES ==================================================*/
64 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG
65 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams;
66 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */
67
68 GLOBAL T_PCEER causeMod = P_CEER_mod; /* Hold which module caused the extended error */
69 GLOBAL SHORT causeCeer; /* Hold extended error for sim, mm and ss */
70 EXTERN UBYTE std;
71
72 /*==== FUNCTIONS ==================================================*/
73 LOCAL T_ACI_RETURN qAT_plus_percent_CLCC( T_ACI_CMD_SRC srcId,
74 T_ACI_CLCC_CALDESC *calLst,
75 T_ACI_AT_CMD at_cmd_id,
76 SHORT rdlcId );
77
78 /*
79 +--------------------------------------------------------------------+
80 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
81 | STATE : code ROUTINE : qAT_PlusCSTA |
82 +--------------------------------------------------------------------+
83
84 PURPOSE : This is the functional counterpart to the +CSTA? AT command
85 which returns the current setting for type of address.
86
87 <toa>: type of address.
88 */
89
90 GLOBAL T_ACI_RETURN qAT_PlusCSTA ( T_ACI_CMD_SRC srcId,
91 T_ACI_TOA * toa )
92 {
93 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
94
95 TRACE_FUNCTION ("qAT_PlusCSTA()");
96
97 /*
98 *-------------------------------------------------------------------
99 * check command source
100 *-------------------------------------------------------------------
101 */
102 if(!cmh_IsVldCmdSrc (srcId))
103 {
104 return( AT_FAIL );
105 }
106
107 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
108
109 /*
110 *-------------------------------------------------------------------
111 * fill in parameters
112 *-------------------------------------------------------------------
113 */
114 *toa = pCCCmdPrm -> CSTAtoa;
115
116 return( AT_CMPL );
117 }
118
119 /*
120 +--------------------------------------------------------------------+
121 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
122 | STATE : code ROUTINE : qAT_PlusCMOD |
123 +--------------------------------------------------------------------+
124
125 PURPOSE : This is the functional counterpart to the +CMOD? AT command
126 which returns the current setting for call mode.
127
128 <mode>: call mode.
129 */
130
131 GLOBAL T_ACI_RETURN qAT_PlusCMOD ( T_ACI_CMD_SRC srcId,
132 T_ACI_CMOD_MOD* mode )
133 {
134 TRACE_FUNCTION ("qAT_PlusCMOD()");
135
136 /* check command source */
137 if(!cmh_IsVldCmdSrc (srcId))
138 {
139 return( AT_FAIL );
140 }
141
142
143 /* fill in parameters */
144 *mode = ccShrdPrm.CMODmode;
145
146 return( AT_CMPL );
147 }
148
149 #ifdef FAX_AND_DATA
150 /*
151 +--------------------------------------------------------------------+
152 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
153 | STATE : code ROUTINE : qAT_PlusCBST |
154 +--------------------------------------------------------------------+
155
156 PURPOSE : This is the functional counterpart to the +CBST? AT command
157 which returns the current setting for bearer service type.
158
159 */
160
161 GLOBAL T_ACI_RETURN qAT_PlusCBST ( T_ACI_CMD_SRC srcId,
162 T_ACI_BS_SPEED* speed,
163 T_ACI_CBST_NAM* name,
164 T_ACI_CBST_CE* ce)
165 {
166 TRACE_FUNCTION ("qAT_PlusCBST()");
167
168 /*
169 *-------------------------------------------------------------------
170 * check command source
171 *-------------------------------------------------------------------
172 */
173 if(!cmh_IsVldCmdSrc (srcId))
174 {
175 return( AT_FAIL );
176 }
177
178 /*
179 *-------------------------------------------------------------------
180 * fill in parameters
181 *-------------------------------------------------------------------
182 */
183 *speed = ccShrdPrm.CBSTspeed;
184 *name = ccShrdPrm.CBSTname;
185 *ce = ccShrdPrm.CBSTce;
186
187 return( AT_CMPL );
188 }
189 #endif /* FAX_AND_DATA */
190
191 /*
192 +--------------------------------------------------------------------+
193 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
194 | STATE : code ROUTINE : qAT_PlusCCUG |
195 +--------------------------------------------------------------------+
196
197 PURPOSE : This is the functional counterpart to the +CCUG AT command
198 which is responsible to query the parameters for closed user
199 group supplementary services.
200
201 <mode> : CUG mode.
202 <index> : CUG index.
203 <info> : CUG info.
204 */
205
206 GLOBAL T_ACI_RETURN qAT_PlusCCUG ( T_ACI_CMD_SRC srcId,
207 T_ACI_CCUG_MOD *mode,
208 T_ACI_CCUG_IDX *index,
209 T_ACI_CCUG_INFO *info)
210 {
211 T_CC_CMD_PRM * pCCCmdPrm; /* points to SS command parameters */
212
213 TRACE_FUNCTION ("qAT_PlusCCUG()");
214
215 /*
216 *-------------------------------------------------------------------
217 * check command source
218 *-------------------------------------------------------------------
219 */
220 if(!cmh_IsVldCmdSrc (srcId))
221 {
222 return( AT_FAIL );
223 }
224
225 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
226
227 /*
228 *-------------------------------------------------------------------
229 * fill in parameters
230 *-------------------------------------------------------------------
231 */
232 *mode = pCCCmdPrm -> CCUGmode;
233 *index = pCCCmdPrm -> CCUGidx;
234 *info = pCCCmdPrm -> CCUGinfo;
235
236 return( AT_CMPL );
237 }
238
239 /*
240 +--------------------------------------------------------------------+
241 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
242 | STATE : code ROUTINE : qAT_PlusCLCC |
243 +--------------------------------------------------------------------+
244
245 PURPOSE : This is the functional counterpart to the +CLCC? AT command
246 which returns the current call status.
247
248 */
249
250 GLOBAL T_ACI_RETURN qAT_PlusCLCC ( T_ACI_CMD_SRC srcId,
251 T_ACI_CLCC_CALDESC *calLst)
252 {
253 /* Implements Measure 47 and 216 */
254 return ( qAT_plus_percent_CLCC(srcId, calLst, AT_CMD_CLCC, rdlPrm.rdlcId) );
255 }
256
257 /*
258 +--------------------------------------------------------------------+
259 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
260 | STATE : code ROUTINE : qAT_PercentCLCC |
261 +--------------------------------------------------------------------+
262
263 PURPOSE : This is the functional counterpart to the %CLCC? AT command
264 which returns the current call status.
265
266 */
267
268 GLOBAL T_ACI_RETURN qAT_PercentCLCC ( T_ACI_CMD_SRC srcId,
269 T_ACI_CLCC_CALDESC *calLst)
270 {
271 /* Implements Measure 47 and 216 */
272 return ( qAT_plus_percent_CLCC(srcId, calLst, AT_CMD_P_CLCC, NO_ENTRY) );
273 }
274
275 /*
276 +--------------------------------------------------------------------+
277 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
278 | STATE : code ROUTINE : qAT_PlusCEER |
279 +--------------------------------------------------------------------+
280
281 PURPOSE : This is the functional counterpart to the +CEER AT command
282 which returns an extended error report.
283
284 */
285
286 GLOBAL T_ACI_RETURN qAT_PlusCEER ( T_ACI_CMD_SRC srcId,
287 USHORT *cause)
288 {
289 T_CC_CALL_TBL *ctbFail = ccShrdPrm.ctb[ccShrdPrm.cIdFail];
290
291 TRACE_FUNCTION ("qAT_PlusCEER()");
292
293 /*
294 *-------------------------------------------------------------------
295 * check command source
296 *-------------------------------------------------------------------
297 */
298 if(!cmh_IsVldCmdSrc (srcId))
299 {
300 return( AT_FAIL );
301 }
302
303 /*
304 *-------------------------------------------------------------------
305 * get error report
306 *-------------------------------------------------------------------
307 */
308
309 /* Extended error report to indicate attach related problems */
310 if ((causeCeer NEQ CEER_NotPresent) AND (causeMod EQ P_CEER_mm))
311 {
312 *cause = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_NET, MM_ORIGINATING_ENTITY, causeCeer);
313 return( AT_CMPL );
314 }
315 if ((causeCeer NEQ CEER_NotPresent) AND (causeMod EQ P_CEER_ss))
316 {
317 *cause = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_NET, SS_ORIGINATING_ENTITY, causeCeer);
318 return( AT_CMPL );
319 }
320 if ((causeCeer EQ P_CEER_ACMMaxReachedOrExceeded) AND (causeMod EQ P_CEER_sim)) /* ACI cause check */
321 {
322 *cause = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, P_CEER_ACMMaxReachedOrExceeded);
323 return( AT_CMPL );
324 }
325
326 if ((causeCeer EQ P_CEER_InvalidFDN) AND (causeMod EQ P_CEER_sim)) /* ACI cause check */
327 {
328 *cause = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, P_CEER_InvalidFDN );
329 return( AT_CMPL );
330 }
331
332 if( ccShrdPrm.cIdFail < 0 OR ccShrdPrm.cIdFail > MAX_CALL_NR )
333 {
334 *cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, NOT_PRESENT_8BIT);
335 return( AT_CMPL );
336 }
337
338 /*
339 * This code has to become better understood, probably it can be simplified
340 * Be sure to use ctbFail here because TI compiler 1.22e may have a problem
341 * otherwise.
342 */
343 if (ctbFail NEQ NULL)
344 {
345 /* Call table entry still existant */
346 if (GET_CAUSE_VALUE(ctbFail->rejCs) NEQ NOT_PRESENT_8BIT)
347 {
348 *cause = ctbFail->rejCs;
349 }
350 else if (GET_CAUSE_VALUE(ctbFail->nrmCs) NEQ NOT_PRESENT_8BIT)
351 {
352 *cause = ctbFail->nrmCs;
353 }
354 else if (GET_CAUSE_VALUE(ctbFail->rslt) NEQ NOT_PRESENT_8BIT)
355 {
356 *cause = ctbFail->rslt;
357 }
358 else
359 {
360 /* in case network has sent no extended report */
361 *cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, NOT_PRESENT_8BIT);
362 }
363 }
364 else
365 {
366 /* Call table entry already freed */
367 *cause = ccShrdPrm.ccCs[ccShrdPrm.cIdFail];
368 }
369 return AT_CMPL;
370 }
371
372 /*
373 +--------------------------------------------------------------------+
374 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
375 | STATE : code ROUTINE : sAT_PlusPAS |
376 +--------------------------------------------------------------------+
377
378 PURPOSE : This is the functional counterpart to the +CPAS AT command
379 which returns the phone activity status.
380 */
381
382 GLOBAL T_ACI_RETURN qAT_PlusCPAS ( T_ACI_CMD_SRC srcId,
383 T_ACI_CPAS_PAS *pas)
384 {
385 SHORT cId; /* holds call id */
386 T_ACI_CFUN_FUN cfun_stat;
387
388 TRACE_FUNCTION ("qAT_PlusCPAS()");
389
390 /*
391 *-------------------------------------------------------------------
392 * check command source
393 *-------------------------------------------------------------------
394 */
395 if(!cmh_IsVldCmdSrc (srcId))
396 {
397 return( AT_FAIL );
398 }
399
400 /*
401 *-------------------------------------------------------------------
402 * get phone activity status
403 *-------------------------------------------------------------------
404 */
405
406 /* check if power is off (+CFUN=0) */
407 if ( qAT_PlusCFUN(srcId, &cfun_stat) EQ AT_FAIL )
408 {
409 return( AT_FAIL );
410 }
411
412 if ( cfun_stat EQ CFUN_FUN_Minimum )
413 {
414 *pas = CPAS_PAS_Asleep;
415 return( AT_CMPL );
416 }
417
418 /* search for active call */
419 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
420
421 if( cId NEQ NO_ENTRY )
422 {
423 *pas = CPAS_PAS_CallProg;
424 return( AT_CMPL );
425 }
426
427 /* search for call on hold */
428 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_HLD, NO_VLD_CT );
429
430 if( cId NEQ NO_ENTRY )
431 {
432 *pas = CPAS_PAS_CallProg;
433 return( AT_CMPL );
434 }
435
436 /* search for an incoming call */
437 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_MTC );
438
439 if( cId NEQ NO_ENTRY )
440 {
441 *pas = CPAS_PAS_Ring;
442 return( AT_CMPL );
443 }
444
445 /* ready to accept commands */
446 *pas = CPAS_PAS_Ready;
447 return( AT_CMPL );
448 }
449
450 /*
451 +--------------------------------------------------------------------+
452 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
453 | STATE : code ROUTINE : sAT_PlusCSNS |
454 +--------------------------------------------------------------------+
455
456 PURPOSE : This is the functional counterpart to the +CSNS AT command
457 which returns the single numbering scheme mode.
458 */
459
460 GLOBAL T_ACI_RETURN qAT_PlusCSNS ( T_ACI_CMD_SRC srcId,
461 T_ACI_CSNS_MOD *mode)
462 {
463
464 TRACE_FUNCTION ("qAT_PlusCSNS()");
465
466 /*
467 *-------------------------------------------------------------------
468 * check command source
469 *-------------------------------------------------------------------
470 */
471 if(!cmh_IsVldCmdSrc (srcId))
472 {
473 return( AT_FAIL );
474 }
475
476 /*
477 *-------------------------------------------------------------------
478 * get SNS mode
479 *-------------------------------------------------------------------
480 */
481 *mode = (T_ACI_CSNS_MOD)ccShrdPrm.snsMode;
482
483 return( AT_CMPL );
484 }
485
486 /*
487 +--------------------------------------------------------------------+
488 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
489 | STATE : code ROUTINE : qAT_PercentCAL |
490 +--------------------------------------------------------------------+
491
492 PURPOSE : This is the functional counterpart to the %CAL? AT command
493 which returns the current call status.
494 03.06.03 SKA: This function is called by MFW only. It uses
495 this function to get the called number for emitting on display.
496 But there is a protocoll between ACI and MFW which says, that
497 the RAT_COLP signal sent by ACI to MFW at receiving of MNCC_SETUP_CNF
498 to tell MFW/BMI whether it can emit the called number caused by the
499 content of mncc_setup_cnf->connected_number.present sent by the network or not.
500 If present = PRES_PRES_REST, ACI does not send RAT_COLP to MFW, but in this
501 function ACI did copy the number to the MFW callTable structure!
502 Now, ACI does not copy the called number in case of PRES_PRES_REST and
503 MFW/BMI will emit an empty string on display. Therefore we could save
504 a lot of memory and internal traffic between ACI and MFW, if we keep
505 all the logic within ACI!
506 */
507
508 GLOBAL T_ACI_RETURN qAT_PercentCAL( T_ACI_CMD_SRC srcId,
509 T_ACI_CAL_ENTR* callTable )
510 {
511 SHORT ctbIdx; /* holds call table index */
512 SHORT lstIdx; /* holds call list index */
513
514 TRACE_FUNCTION ("qAT_PercentCAL()");
515
516 /*
517 *-------------------------------------------------------------------
518 * for every call of the call table
519 *-------------------------------------------------------------------
520 */
521 for( ctbIdx = 0, lstIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
522 {
523 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL)
524 {
525
526 /*
527 *---------------------------------------------------------------
528 * fill in call type
529 *---------------------------------------------------------------
530 */
531 switch( psaCC_ctb(ctbIdx)->calType )
532 {
533 case( CT_MOC ):
534 case( CT_MOC_RDL ):
535 case( CT_NI_MOC ):
536 callTable[lstIdx].calType = CAL_TYPE_MOC;
537 break;
538
539 case( CT_MTC ):
540 callTable[lstIdx].calType = CAL_TYPE_MTC;
541 break;
542
543 default:
544 callTable[lstIdx].calType = CAL_TYPE_NotPresent;
545 }
546
547 /*
548 *---------------------------------------------------------------
549 * fill in call status
550 *---------------------------------------------------------------
551 */
552 switch( psaCC_ctb(ctbIdx)->calStat )
553 {
554 case( CS_ACT_REQ ):
555 switch( psaCC_ctb(ctbIdx)->calType )
556 {
557 case( CT_MOC ):
558 case( CT_MOC_RDL ):
559 case( CT_NI_MOC ):
560 if( psaCC_ctb(ctbIdx)->alrtStat EQ AS_SND )
561 {
562 callTable[lstIdx].status = CAL_STAT_Alerting;
563 }
564 else
565 {
566 callTable[lstIdx].status = CAL_STAT_Dial;
567 }
568 break;
569
570 case( CT_MTC ):
571 if( psaCC_ctbFindCall ( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, NO_VLD_CT )
572 NEQ -1 )
573 {
574 callTable[lstIdx].status = CAL_STAT_Wait;
575 }
576 else
577 {
578 callTable[lstIdx].status = CAL_STAT_Incomming;
579 }
580 break;
581
582 default:
583 callTable[lstIdx].status = CAL_STAT_NotPresent;
584
585 }
586 break;
587
588 case( CS_ACT ):
589 case( CS_MDF_REQ ):
590 case( CS_HLD_REQ ):
591 callTable[lstIdx].status = CAL_STAT_Active;
592 break;
593
594 case( CS_HLD ):
595 callTable[lstIdx].status = CAL_STAT_Held;
596 break;
597
598 case( CS_IDL ):
599 case( CS_DSC_REQ ):
600 callTable[lstIdx].status = CAL_STAT_DeactiveReq;
601
602 /*
603 * reset of all other values
604 */
605 callTable[lstIdx].mpty = CAL_MPTY_NotPresent;
606 callTable[lstIdx].type.ton = TON_NotPresent;
607 callTable[lstIdx].type.npi = NPI_NotPresent;
608 callTable[lstIdx].number[0] = '\0';
609 #ifdef NO_ASCIIZ
610 callTable[lstIdx].alpha.cs = CS_NotPresent;
611 callTable[lstIdx].alpha.len = 0;
612 #else /* #ifdef NO_ASCIIZ */
613 callTable[lstIdx].alpha[0] = '\0';
614 #endif /* #ifdef NO_ASCIIZ */
615 callTable[lstIdx].calType = CAL_TYPE_NotPresent;
616 callTable[lstIdx].calMode = CAL_MODE_NotPresent;
617 callTable[lstIdx].calOwner = CAL_OWN_NotPresent;
618
619
620 /*
621 * indes and next entry, because of the continue statement
622 */
623 callTable[lstIdx].index = ctbIdx+1;
624 lstIdx++;
625 continue;
626
627 case( CS_CPL_REQ ):
628 continue;
629 }
630
631 /*
632 *---------------------------------------------------------------
633 * fill in number of connected party
634 *---------------------------------------------------------------
635 */
636 switch( psaCC_ctb(ctbIdx)->calType )
637 {
638
639 case( CT_MOC ):
640 case( CT_MOC_RDL ):
641 case( CT_NI_MOC ):
642 /* presentation restricted FTA 31.1.4.2 procedure 1 */
643 /* number not available due to interworking FTA 31.1.4.2 procedure 2 */
644 if ((psaCC_ctb(ctbIdx)->clgPty.present NEQ MNCC_PRES_NOT_PRES) /* any .present indicator received from MSC? */
645 AND (psaCC_ctb(ctbIdx)->clgPty.c_num EQ 0) ) /* but no number available? */
646 {
647 /*
648 * this prevents MFW/BMI to emit the called number, but it
649 * ignores the NOT received COLP signal. Without a COLP signal
650 * MFW/BMI should not emit the called number. (FTA 31.1.4.2)
651 */
652 callTable[lstIdx].number[0] = '\0';
653 callTable[lstIdx].type.ton = TON_NotPresent;
654 callTable[lstIdx].type.npi = NPI_NotPresent;
655 }
656 else
657 {
658 psaCC_ctbCldAdr2Num (ctbIdx, callTable[lstIdx].number,
659 MAX_CC_ORIG_NUM_LEN);
660 callTable[lstIdx].type.ton = (T_ACI_TOA_TON)psaCC_ctb(ctbIdx)->cldPty.ton;
661 callTable[lstIdx].type.npi = (T_ACI_TOA_NPI)psaCC_ctb(ctbIdx)->cldPty.npi;
662 }
663 break;
664
665 case( CT_MTC ):
666 psaCC_ctbClrAdr2Num (ctbIdx, callTable[lstIdx].number,
667 MAX_CC_ORIG_NUM_LEN);
668 callTable[lstIdx].type.ton = (T_ACI_TOA_TON)psaCC_ctb(ctbIdx)->clgPty.ton;
669 callTable[lstIdx].type.npi = (T_ACI_TOA_NPI)psaCC_ctb(ctbIdx)->clgPty.npi;
670 break;
671
672 case( NO_VLD_CT ):
673 default:
674 callTable[lstIdx].number[0] = '\0';
675 callTable[lstIdx].type.ton = TON_NotPresent;
676 callTable[lstIdx].type.npi = NPI_NotPresent;
677 break;
678 }
679
680 #ifdef NO_ASCIIZ
681 memcpy( ( UBYTE* ) &callTable[lstIdx].alpha,
682 ( UBYTE* ) &psaCC_ctb(ctbIdx)->alphIdUni,
683 sizeof( T_ACI_PB_TEXT ) );
684 #else /* NO_ASCIIZ */
685 memcpy( callTable[lstIdx].alpha,
686 psaCC_ctb(ctbIdx)->alphIdUni.data,
687 psaCC_ctb(ctbIdx)->alphIdUni.len );
688
689 cmh_cvtFromDefGsm ( ( CHAR* ) psaCC_ctb(ctbIdx)->alphIdUni.data,
690 ( USHORT ) psaCC_ctb(ctbIdx)->alphIdUni.len,
691 callTable[lstIdx].alpha );
692 #endif /* NO_ASCIIZ */
693
694 /*
695 *---------------------------------------------------------------
696 * fill in in-band tones setting
697 *---------------------------------------------------------------
698 */
699 switch( psaCC_ctb(ctbIdx)->inBndTns )
700 {
701 case( TRUE ):
702 callTable[lstIdx].ibtUse = CAL_IBT_TRUE;
703 break;
704
705 case( FALSE ):
706 callTable[lstIdx].ibtUse = CAL_IBT_FALSE;
707 break;
708 }
709
710
711 /*
712 *---------------------------------------------------------------
713 * fill in call mode
714 *---------------------------------------------------------------
715 */
716 switch( cmhCC_getcalltype(ctbIdx) )
717 {
718 case( VOICE_CALL ):
719 switch( psaCC_ctb(ctbIdx)->BC
720 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
721 bearer_serv)
722 {
723 case( MNCC_BEARER_SERV_ASYNC ):
724 if( psaCC_ctb(ctbIdx)->rptInd EQ MNCC_RI_CIRCULAR )
725 callTable[lstIdx].calMode = CAL_MODE_VAD_Voice;
726 else
727 callTable[lstIdx].calMode = CAL_MODE_VFD_Voice;
728 break;
729
730 case( MNCC_BEARER_SERV_FAX ):
731 callTable[lstIdx].calMode = CAL_MODE_VAF_Voice;
732 break;
733
734 case( MNCC_BEARER_SERV_NOT_PRES ):
735 callTable[lstIdx].calMode = CAL_MODE_Voice;
736 break;
737
738 default:
739 callTable[lstIdx].calMode = CAL_MODE_Unknown;
740 }
741 break;
742
743 #ifdef FAX_AND_DATA
744 case( TRANS_CALL ):
745 case( NON_TRANS_CALL ):
746 switch( psaCC_ctb(ctbIdx)->BC
747 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
748 bearer_serv)
749 {
750 case( MNCC_BEARER_SERV_SPEECH ):
751 if( psaCC_ctb(ctbIdx)->rptInd EQ MNCC_RI_CIRCULAR )
752 callTable[lstIdx].calMode = CAL_MODE_VAD_Data;
753 else
754 callTable[lstIdx].calMode = CAL_MODE_VFD_Data;
755 break;
756
757 case( MNCC_BEARER_SERV_NOT_PRES ):
758 callTable[lstIdx].calMode = CAL_MODE_Data;
759 break;
760
761 default:
762 callTable[lstIdx].calMode = CAL_MODE_Unknown;
763 }
764 break;
765
766 case( FAX_CALL ):
767 switch( psaCC_ctb(ctbIdx)->BC
768 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
769 bearer_serv)
770 {
771 case( MNCC_BEARER_SERV_SPEECH ):
772 callTable[lstIdx].calMode = CAL_MODE_VAF_Fax;
773 break;
774
775 case( MNCC_BEARER_SERV_NOT_PRES ):
776 callTable[lstIdx].calMode = CAL_MODE_Fax;
777 break;
778
779 default:
780 callTable[lstIdx].calMode = CAL_MODE_Unknown;
781 }
782 break;
783 #endif /* #ifdef FAX_AND_DATA */
784
785 #if defined CO_UDP_IP || defined(FF_GPF_TCPIP)
786
787 /* SPR#1983 - SH - Identify WAP call */
788 #ifdef CO_UDP_IP
789
790 case( UDPIP_CALL ):
791 /*fallthrough if both defined*/
792 #endif
793 #if defined(FF_GPF_TCPIP)
794 case (TCPIP_CALL):
795 #endif /* FF_GPF_TCPIP */
796 switch( psaCC_ctb(ctbIdx)->BC
797 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
798 bearer_serv)
799 {
800 case( MNCC_BEARER_SERV_SPEECH ):
801 if( psaCC_ctb(ctbIdx)->rptInd EQ MNCC_RI_CIRCULAR )
802 callTable[lstIdx].calMode = CAL_MODE_VAD_Data;
803 else
804 callTable[lstIdx].calMode = CAL_MODE_VFD_Data;
805 break;
806
807 case( MNCC_BEARER_SERV_NOT_PRES ):
808 callTable[lstIdx].calMode = CAL_MODE_Data;
809 break;
810
811 default:
812 callTable[lstIdx].calMode = CAL_MODE_Unknown;
813 break;
814 }
815 break;
816 #endif /* (CO_UDP_IP) || defined(FF_GPF_TCPIP) */
817 default:
818 callTable[lstIdx].calMode = CAL_MODE_Unknown;
819 }
820 /*
821 *---------------------------------------------------------------
822 * fill in call owner
823 *---------------------------------------------------------------
824 */
825 switch( (T_ACI_CMD_SRC)psaCC_ctb(ctbIdx)->calOwn )
826 {
827 case( CMD_SRC_LCL ):
828 callTable[lstIdx].calOwner = CAL_OWN_LCL;
829 break;
830 #ifdef FF_ATI
831 case(CMD_SRC_ATI_1):
832 case(CMD_SRC_ATI_2):
833 case(CMD_SRC_ATI_3):
834 case(CMD_SRC_ATI_4):
835 callTable[lstIdx].calOwner = CAL_OWN_RMT;
836 break;
837 #endif /* FF_ATI */
838 default:
839 callTable[lstIdx].calOwner = CAL_OWN_NONE;
840 }
841
842 /*
843 *---------------------------------------------------------------
844 * fill in multiparty status
845 *---------------------------------------------------------------
846 */
847 callTable[lstIdx].mpty = (psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT)?
848 CAL_MPTY_IsMember : CAL_MPTY_NoMember;
849 /*
850 *---------------------------------------------------------------
851 * fill in call index
852 *---------------------------------------------------------------
853 */
854 callTable[lstIdx].index = ctbIdx+1;
855 lstIdx++;
856 }
857 }
858
859 /*
860 *-------------------------------------------------------------------
861 * terminate list of calls
862 *-------------------------------------------------------------------
863 */
864 if( lstIdx < ctbIdx )
865 {
866 callTable[lstIdx].index = -1;
867 }
868
869 return( AT_CMPL );
870 }
871
872
873 /*
874 +--------------------------------------------------------------------+
875 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
876 | STATE : code ROUTINE : qAT_CallActive |
877 +--------------------------------------------------------------------+
878
879 PURPOSE : The function checks whether at least one call is in an
880 active state. This is not an official AT command !
881 */
882
883 GLOBAL UBYTE qAT_CallActive ( void )
884 {
885 SHORT ctbIdx; /* holds call table index */
886
887 TRACE_FUNCTION ("qAT_CallActive()");
888
889 /*
890 *-------------------------------------------------------------------
891 * for every call of the call table
892 *-------------------------------------------------------------------
893 */
894 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
895 {
896 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL)
897 {
898 /*
899 *---------------------------------------------------------------
900 * check call status
901 *---------------------------------------------------------------
902 */
903 switch( psaCC_ctb(ctbIdx)->calStat )
904 {
905 case CS_ACT:
906 case CS_HLD_REQ:
907 case CS_HLD:
908 case CS_MDF_REQ:
909 return TRUE;
910 default:
911 break;
912 }
913 }
914
915 }
916 return FALSE;
917 }
918
919 /*
920 +-------------------------------------------------------------------+
921 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF |
922 | ROUTINE : qAT_PercentALS |
923 +-------------------------------------------------------------------+
924
925 PURPOSE : get the ALS mode for outgoing calls (voice)
926 0: indicates bearer capability => BEARER_SERV_SPEECH
927 1: indicates bearer capability => BEARER_SERV_AUX_SPEECH
928 */
929
930 GLOBAL void cmhCC_get_active_als_mode( T_ACI_CMD_SRC srcId, T_ACI_ALS_MOD *mode )
931 {
932 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
933
934 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
935 *mode = pCCCmdPrm->ALSmode;
936 }
937
938 GLOBAL T_ACI_RETURN qAT_PercentALS( T_ACI_CMD_SRC srcId, T_ACI_ALS_MOD *mode )
939 {
940 TRACE_FUNCTION("qAT_PercentALS()");
941
942 if( !cmh_IsVldCmdSrc( srcId ) )
943 {
944 return( AT_FAIL );
945 }
946
947 cmhCC_get_active_als_mode( srcId, mode );
948
949 return( AT_CMPL );
950 }
951
952 /*
953 +-------------------------------------------------------------------+
954 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF |
955 | ROUTINE : qAT_PercentCTTY |
956 +-------------------------------------------------------------------+
957
958 PURPOSE : Query the state of the TTY Service
959 */
960
961 GLOBAL T_ACI_RETURN qAT_PercentCTTY (T_ACI_CMD_SRC srcId,
962 T_ACI_CTTY_MOD *mode,
963 T_ACI_CTTY_REQ *req,
964 T_ACI_CTTY_STAT *stat,
965 T_ACI_CTTY_TRX *trx)
966 {
967 SHORT ctNr;
968 BOOL fnd_act = FALSE;;
969
970 if( !cmh_IsVldCmdSrc( srcId ) )
971 {
972 return( AT_FAIL );
973 }
974 *mode = cmhPrm[srcId].ccCmdPrm.CTTYmode;
975 #ifdef FF_TTY
976 if (ccShrdPrm.ctmReq EQ MNCC_CTM_DISABLED)
977 {
978 *req = CTTY_REQ_Off;
979 }
980 else switch (ccShrdPrm.ttyCmd)
981 {
982 case TTY_ALL:
983 *req = CTTY_REQ_On;
984 break;
985 case TTY_HCO:
986 *req = CTTY_REQ_HCO;
987 break;
988 case TTY_VCO:
989 *req = CTTY_REQ_VCO;
990 break;
991 default:
992 *req = CTTY_REQ_Off;
993 break;
994 }
995 for (ctNr = 0; !fnd_act AND ctNr < MAX_CALL_NR; ctNr++)
996 {
997 if (ccShrdPrm.ctb[ctNr] NEQ NULL)
998 {
999 switch (psaCC_ctb(ctNr)->calStat)
1000 {
1001 case CS_ACT_REQ:
1002 case CS_ACT:
1003 case CS_HLD_REQ:
1004 case CS_HLD:
1005 case CS_MDF_REQ:
1006 *stat = (ccShrdPrm.ctmState EQ TTY_STATE_ACTIVE)?
1007 CTTY_STAT_On: CTTY_STAT_Off;
1008 if (*stat EQ CTTY_STAT_On)
1009 {
1010 *trx = cmhCC_getTTYtrx_state ((int)ccShrdPrm.ttyCmd);
1011 }
1012 else
1013 {
1014 *trx = CTTY_TRX_Unknown;
1015 }
1016 fnd_act = TRUE;
1017 break;
1018 default:
1019 break;
1020 }
1021 }
1022 }
1023 if (!fnd_act)
1024 #else
1025 *req = CTTY_REQ_Off;
1026 #endif /* FF_TTY */
1027 {
1028 *stat = CTTY_STAT_Unknown;
1029 *trx = CTTY_TRX_Unknown;
1030 }
1031 return( AT_CMPL );
1032 }
1033
1034 /*
1035 +--------------------------------------------------------------------+
1036 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1037 | STATE : code ROUTINE : qAT_PercentRDL |
1038 +--------------------------------------------------------------------+
1039
1040 PURPOSE : This is the functional counterpart to the %RDL? AT command
1041 which returns the current setting for redial mode.
1042 */
1043
1044 GLOBAL T_ACI_RETURN qAT_PercentRDL ( T_ACI_CMD_SRC srcId,
1045 T_ACI_CC_REDIAL_MODE* redial_mode,
1046 T_ACI_CC_REDIAL_NOTIF* notification)
1047 {
1048 TRACE_FUNCTION ("qAT_PercentRDL()");
1049
1050 /* check command source */
1051 if(!cmh_IsVldCmdSrc (srcId))
1052 {
1053 return( AT_FAIL );
1054 }
1055
1056 /* fill in parameter */
1057 switch(rdlPrm.rdlMod)
1058 {
1059 case AUTOM_REPEAT_OFF:
1060 case AUTOM_REPEAT_ON:
1061 *redial_mode = rdlPrm.rdlMod;
1062 break;
1063 default:
1064 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1065 return( AT_FAIL );
1066 }
1067 switch(rdlPrm.rdlModN)
1068 {
1069 case NO_NOTIF_USER:
1070 case NOTIF_USER:
1071 *notification = rdlPrm.rdlModN;
1072 return( AT_CMPL );
1073 default:
1074 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1075 return( AT_FAIL );
1076 }
1077 }
1078
1079 #ifdef TI_PS_FF_AT_P_CMD_RDLB
1080 /*
1081 +--------------------------------------------------------------------+
1082 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1083 | STATE : code ROUTINE : qAT_PercentRDLB |
1084 +--------------------------------------------------------------------+
1085
1086 PURPOSE : This is the functional counterpart to the %RDLB? AT command
1087 which returns the current black list.
1088 */
1089
1090 GLOBAL T_ACI_RETURN qAT_PercentRDLB ( T_ACI_CMD_SRC srcId,
1091 T_ACI_CC_REDIAL_BLACKL *blackl,
1092 T_ACI_CC_REDIAL_NOTIF* notification)
1093 {
1094 TRACE_FUNCTION ("qAT_PercentRDLB()");
1095
1096 /* check command source */
1097 if(!cmh_IsVldCmdSrc (srcId))
1098 {
1099 return( AT_FAIL );
1100 }
1101
1102 if (rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
1103 {
1104 if((cc_blacklist_ptr NEQ NULL) AND (cc_blacklist_ptr->blCount NEQ 0))
1105 {/* fill in parameter */
1106 memcpy(blackl,cc_blacklist_ptr,sizeof(T_ACI_CC_REDIAL_BLACKL));
1107 }
1108 *notification = rdlPrm.rdlBlN;
1109 return( AT_CMPL );
1110 }
1111 else
1112 {
1113 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1114 return( AT_FAIL );
1115 }
1116 }
1117 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
1118 /*
1119 +--------------------------------------------------------------------+
1120 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1121 | STATE : code ROUTINE : qAT_PercentCSSD |
1122 +--------------------------------------------------------------------+
1123
1124 PURPOSE : This is the functional counterpart to the AT%CSSD command
1125 which returns an extended error report.
1126
1127 */
1128
1129 GLOBAL T_ACI_RETURN qAT_PercentCSSD ( T_ACI_CMD_SRC srcId,
1130 UBYTE *ss_diag)
1131 {
1132 T_CC_CALL_TBL *ctbFail = ccShrdPrm.ctb[ccShrdPrm.cIdFail];
1133
1134 TRACE_FUNCTION ("qAT_PercentCSSD()");
1135
1136 /*
1137 *-------------------------------------------------------------------
1138 * check command source
1139 *-------------------------------------------------------------------
1140 */
1141 if(!cmh_IsVldCmdSrc (srcId))
1142 {
1143 return( AT_FAIL );
1144 }
1145
1146 /*
1147 *-------------------------------------------------------------------
1148 * get ss diagnostic
1149 *-------------------------------------------------------------------
1150 */
1151
1152 /*
1153 * check whether this diagnostic is within the specified parameters
1154 * cross-check also MNCC SAP: VAL_ss_diag
1155 * (This implementation follows version V3.19.0 (2004-06))
1156 */
1157 if( (ctbFail->ssDiag >= MNCC_SS_DIAG_MOC_BAR_CUG) AND
1158 (ctbFail->ssDiag <= MNCC_SS_DIAG_CCBS_NOT_POSSIBLE ))
1159 {
1160 *ss_diag = ctbFail->ssDiag;
1161 return( AT_CMPL );
1162 }
1163 /* not yet initialized or not defined, return no information available */
1164 else
1165 {
1166 /*reset ccShrdPrm.ctb[ccShrdPrm.cIdFail].ssDiag */
1167 *ss_diag = ctbFail->ssDiag = MNCC_SS_DIAG_NOT_PROVIDED;
1168 return( AT_CMPL );
1169 }
1170 }
1171
1172 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG
1173 /*
1174 +--------------------------------------------------------------------+
1175 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1176 | STATE : code ROUTINE : qAT_PercentCUSCFG |
1177 +--------------------------------------------------------------------+
1178
1179 PURPOSE : This is the functional counterpart to the AT%CUSCFG query command
1180 which returns the customization status of the facility requested.
1181
1182 */
1183 GLOBAL T_ACI_RETURN qAT_PercentCUSCFG ( T_ACI_CMD_SRC srcId,
1184 T_ACI_CUSCFG_FAC facility,
1185 T_ACI_CUSCFG_STAT *status)
1186 {
1187 TRACE_FUNCTION ("qAT_PercentCUSCFG()");
1188
1189 /*
1190 *-------------------------------------------------------------------
1191 * check command source
1192 *-------------------------------------------------------------------
1193 */
1194 if(!cmh_IsVldCmdSrc (srcId))
1195 {
1196 return( AT_FAIL );
1197 }
1198
1199 switch(facility)
1200 {
1201 case CUSCFG_FAC_MO_SM_Control:
1202 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.MO_SM_Control_SIM;
1203 break;
1204
1205 case CUSCFG_FAC_MO_Call_Control:
1206 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.MO_Call_Control_SIM;
1207 break;
1208
1209 case CUSCFG_FAC_MO_SS_Control:
1210 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.MO_SS_Control_SIM;
1211 break;
1212
1213 case CUSCFG_FAC_MO_USSD_Control:
1214 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.MO_USSD_Control_SIM;
1215 break;
1216
1217 case CUSCFG_FAC_2_Digit_Call:
1218 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.Two_digit_MO_Call;
1219 break;
1220
1221 case CUSCFG_FAC_Ext_USSD_Res:
1222 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.Ext_USSD_Response;
1223 break;
1224
1225 case CUSCFG_FAC_T_MOBILE_Eons:
1226 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.T_MOBILE_Eons;
1227 break;
1228
1229 case CUSCFG_FAC_USSD_As_MO_Call:
1230 *status = (T_ACI_CUSCFG_STAT)cuscfgParams.USSD_As_MO_Call;
1231 break;
1232
1233
1234 default:
1235 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1236 return( AT_FAIL );
1237 }
1238 return(AT_CMPL);
1239 }
1240 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */
1241
1242 #ifdef TI_PS_FF_AT_P_CMD_STDR
1243 /*
1244 +--------------------------------------------------------------------+
1245 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1246 | STATE : code ROUTINE : qAT_PercentSTDR |
1247 +--------------------------------------------------------------------+
1248
1249 PURPOSE : This is the functional counterpart to the AT%STDR command
1250 which returns the value of global variable <std>.
1251
1252 */
1253
1254 GLOBAL T_ACI_RETURN qAT_PercentSTDR ( T_ACI_CMD_SRC srcId,
1255 UBYTE *rvstd)
1256 {
1257 TRACE_FUNCTION ("qAT_PercentSTDR()");
1258
1259 /*
1260 *-------------------------------------------------------------------
1261 * check command source
1262 *-------------------------------------------------------------------
1263 */
1264 if(!cmh_IsVldCmdSrc (srcId))
1265 {
1266 return( AT_FAIL );
1267 }
1268
1269 /*
1270 *-------------------------------------------------------------------
1271 * Read <std>
1272 *-------------------------------------------------------------------
1273 */
1274 *rvstd = std;
1275
1276 return( AT_CMPL );
1277 }
1278 #endif /* TI_PS_FF_AT_P_CMD_STDR */
1279
1280 /* Implements Measure 47 and 216 */
1281 /*
1282 +------------------------------------------------------------------------------
1283 | Function : qAT_plus_percent_CLCC
1284 +------------------------------------------------------------------------------
1285 | Purpose : This is common functional counterpart to the %CLCC? and +CLCC?
1286 |
1287 | Parameters : srcId - AT command source identifier
1288 | calLst - Points to CLCC current call
1289 | list element.
1290 | at_cmd_id - AT Command Identifier
1291 | ( AT_CMD_CLCC or AT_CMD_P_CLCC )
1292 |
1293 | rdlcId - Redial Call Identifier , NO_ENTRY if no redial
1294 |
1295 | Return : ACI functional return codes
1296 +------------------------------------------------------------------------------
1297 */
1298
1299 LOCAL T_ACI_RETURN qAT_plus_percent_CLCC( T_ACI_CMD_SRC srcId,
1300 T_ACI_CLCC_CALDESC *calLst,
1301 T_ACI_AT_CMD at_cmd_id,
1302 SHORT rdlcId )
1303 {
1304 SHORT ctbIdx;
1305 SHORT lstIdx;
1306 int index;
1307
1308 TRACE_FUNCTION ("qAT_plus_percent_CLCC()");
1309
1310 index = ( at_cmd_id EQ AT_CMD_P_CLCC )?1:0;
1311 /*
1312 *-------------------------------------------------------------------
1313 * for every call of the call table
1314 *-------------------------------------------------------------------
1315 */
1316 for( ctbIdx = 0, lstIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
1317 {
1318 if ( (ccShrdPrm.ctb[ctbIdx] NEQ NULL) AND (rdlcId EQ NO_ENTRY) )
1319 {
1320 /*
1321 *---------------------------------------------------------------
1322 * fill in call type
1323 *---------------------------------------------------------------
1324 */
1325 if ( ( psaCC_ctb(ctbIdx)->calType >= CT_MOC ) AND
1326 ( psaCC_ctb(ctbIdx)->calType <= CT_MOC_RDL ))
1327 {
1328 calLst[lstIdx].dir =
1329 (T_ACI_CLCC_DIR) aci_clcc_dir[psaCC_ctb(ctbIdx)->calType][index];
1330 }
1331
1332
1333 /*
1334 *---------------------------------------------------------------
1335 * fill in call status
1336 *---------------------------------------------------------------
1337 */
1338 switch( psaCC_ctb(ctbIdx)->calStat )
1339 {
1340 case( CS_ACT_REQ ):
1341 switch( psaCC_ctb(ctbIdx)->calType )
1342 {
1343 case( CT_MOC ):
1344 case( CT_MOC_RDL ):
1345 if( psaCC_ctb(ctbIdx)->alrtStat EQ AS_SND )
1346 {
1347 calLst[lstIdx].stat = CLCC_STAT_Alerting;
1348 }
1349 else
1350 {
1351 calLst[lstIdx].stat = CLCC_STAT_Dialing;
1352 }
1353 break;
1354
1355 case( CT_MTC ):
1356 if ( psaCC_ctbCallInUse ( ) )
1357 {
1358 calLst[lstIdx].stat = CLCC_STAT_Waiting;
1359 }
1360 else
1361 {
1362 calLst[lstIdx].stat = CLCC_STAT_Incoming;
1363 }
1364 break;
1365 }
1366 break;
1367
1368 case( CS_ACT ):
1369 case( CS_DSC_REQ ):
1370 /*
1371 * Also show calls in disconnecting state since in 4.08/5.4.4.2.1.1 ii)
1372 * the user is still connected to the network.
1373 * This call is then either terminated from the network side.
1374 * (after the operator announcement) or user initiated by ATH
1375 */
1376 case( CS_MDF_REQ ):
1377 case( CS_HLD_REQ ):
1378 calLst[lstIdx].stat = CLCC_STAT_Active;
1379 break;
1380
1381 case( CS_HLD ):
1382 calLst[lstIdx].stat = CLCC_STAT_Held;
1383 break;
1384
1385 case( CS_IDL ):
1386 case( CS_CPL_REQ ):
1387 continue;
1388 }
1389
1390 /*
1391 *---------------------------------------------------------------
1392 * fill in number of connected party
1393 *---------------------------------------------------------------
1394 */
1395 switch( psaCC_ctb(ctbIdx)->calType )
1396 {
1397 case( CT_MOC ):
1398 case( CT_MOC_RDL ):
1399 psaCC_ctbCldAdr2Num (ctbIdx, calLst[lstIdx].number,
1400 MAX_CC_ORIG_NUM_LEN);
1401 calLst[lstIdx].type.ton = (T_ACI_TOA_TON)psaCC_ctb(ctbIdx)->cldPty.ton;
1402 calLst[lstIdx].type.npi = (T_ACI_TOA_NPI)psaCC_ctb(ctbIdx)->cldPty.npi;
1403 break;
1404
1405 case( CT_MTC ):
1406 psaCC_ctbClrAdr2Num (ctbIdx, calLst[lstIdx].number,
1407 MAX_CC_ORIG_NUM_LEN);
1408 calLst[lstIdx].type.ton = (T_ACI_TOA_TON)psaCC_ctb(ctbIdx)->clgPty.ton;
1409 calLst[lstIdx].type.npi = (T_ACI_TOA_NPI)psaCC_ctb(ctbIdx)->clgPty.npi;
1410 break;
1411 }
1412 #ifdef NO_ASCIIZ
1413 memcpy( ( UBYTE* ) &calLst[lstIdx].alpha,
1414 ( UBYTE* ) &psaCC_ctb(ctbIdx)->alphIdUni,
1415 sizeof( T_ACI_PB_TEXT ) );
1416 #else /* NO_ASCIIZ */
1417 memcpy( calLst[lstIdx].alpha,
1418 ccShrdPrm.ctb[ctbIdx].alphIdUni.data,
1419 ccShrdPrm.ctb[ctbIdx].alphIdUni.len );
1420
1421 cmh_cvtFromDefGsm ( ( CHAR* ) ccShrdPrm.ctb[ctbIdx].alphIdUni.data,
1422 ( USHORT ) ccShrdPrm.ctb[ctbIdx].alphIdUni.len,
1423 calLst[lstIdx].alpha );
1424 #endif /* NO_ASCIIZ */
1425
1426 /*
1427 *---------------------------------------------------------------
1428 * fill in call mode
1429 *---------------------------------------------------------------
1430 */
1431 switch( cmhCC_getcalltype(ctbIdx) )
1432 {
1433 case( VOICE_CALL ):
1434 switch( psaCC_ctb(ctbIdx)->BC
1435 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
1436 bearer_serv)
1437 {
1438 case( MNCC_BEARER_SERV_ASYNC ):
1439 if( psaCC_ctb(ctbIdx)->rptInd EQ MNCC_RI_CIRCULAR )
1440 calLst[lstIdx].mode = CLCC_MODE_Voice;
1441 else
1442 calLst[lstIdx].mode = CLCC_MODE_VFDVoice;
1443 break;
1444
1445 case( MNCC_BEARER_SERV_FAX ):
1446 calLst[lstIdx].mode = CLCC_MODE_VAFVoice;
1447 break;
1448
1449 case( MNCC_BEARER_SERV_NOT_PRES ):
1450 calLst[lstIdx].mode = CLCC_MODE_Voice;
1451 break;
1452
1453 default:
1454 calLst[lstIdx].mode = CLCC_MODE_Unknown;
1455 }
1456 break;
1457
1458 #ifdef FAX_AND_DATA
1459 case( TRANS_CALL ):
1460 case( NON_TRANS_CALL ):
1461 switch( psaCC_ctb(ctbIdx)->BC
1462 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
1463 bearer_serv)
1464 {
1465 case( MNCC_BEARER_SERV_SPEECH ):
1466 if( psaCC_ctb(ctbIdx)->rptInd EQ MNCC_RI_CIRCULAR )
1467 calLst[lstIdx].mode = CLCC_MODE_VADData;
1468 else
1469 calLst[lstIdx].mode = CLCC_MODE_VFDData;
1470 break;
1471
1472 case( MNCC_BEARER_SERV_NOT_PRES ):
1473 calLst[lstIdx].mode = CLCC_MODE_Data;
1474 break;
1475
1476 default:
1477 calLst[lstIdx].mode = CLCC_MODE_Unknown;
1478 }
1479 break;
1480
1481 case( FAX_CALL ):
1482 switch( psaCC_ctb(ctbIdx)->BC
1483 [(psaCC_ctb(ctbIdx)->curBC EQ 0)?1:0].
1484 bearer_serv)
1485 {
1486 case( MNCC_BEARER_SERV_SPEECH ):
1487 calLst[lstIdx].mode = CLCC_MODE_VAFFax;
1488 break;
1489
1490 case( MNCC_BEARER_SERV_NOT_PRES ):
1491 calLst[lstIdx].mode = CLCC_MODE_Fax;
1492 break;
1493
1494 default:
1495 calLst[lstIdx].mode = CLCC_MODE_Unknown;
1496 }
1497 break;
1498 #endif /* #ifdef FAX_AND_DATA */
1499
1500 default:
1501 calLst[lstIdx].mode = CLCC_MODE_Unknown;
1502 }
1503
1504 /*
1505 *---------------------------------------------------------------
1506 * fill in multiparty status
1507 *---------------------------------------------------------------
1508 */
1509 calLst[lstIdx].mpty = (psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT)?
1510 CLCC_MPTY_IsMember : CLCC_MPTY_NoMember;
1511 /*
1512 *---------------------------------------------------------------
1513 * fill in line1 or line2
1514 *---------------------------------------------------------------
1515 */
1516 switch (cmhCC_GetCallType_from_bearer( &psaCC_ctb(ctbIdx)->BC[psaCC_ctb(ctbIdx)->curBC] ))
1517 {
1518 case ( CRING_SERV_TYP_Voice):
1519 calLst[lstIdx].class_type = CLCC_CLASS_Line1;
1520 break;
1521
1522 case ( CRING_SERV_TYP_AuxVoice):
1523 calLst[lstIdx].class_type = CLCC_CLASS_Line2;
1524 break;
1525
1526 default:
1527 calLst[lstIdx].class_type = CLCC_CLASS_NotPresent;
1528 break;
1529 }
1530 /*
1531 *---------------------------------------------------------------
1532 * fill in progress description if using BAT interface
1533 *---------------------------------------------------------------
1534 */
1535 #ifdef FF_BAT
1536 if ( at_cmd_id EQ AT_CMD_P_CLCC )
1537 {
1538 calLst[lstIdx].prog_desc = psaCC_ctb(ctbIdx)->prgDesc;
1539 }
1540 #endif
1541
1542 /*
1543 *---------------------------------------------------------------
1544 * fill in call index
1545 *---------------------------------------------------------------
1546 */
1547 calLst[lstIdx].idx = ctbIdx+1;
1548 lstIdx++;
1549
1550 }
1551 }
1552
1553 /*
1554 *-------------------------------------------------------------------
1555 * terminate list of calls
1556 *-------------------------------------------------------------------
1557 */
1558 if( lstIdx < ctbIdx )
1559 {
1560 calLst[lstIdx].idx = ACI_NumParmNotPresent;
1561 calLst[lstIdx].dir = CLCC_DIR_NotPresent;
1562 calLst[lstIdx].stat = CLCC_STAT_NotPresent;
1563 calLst[lstIdx].mode = CLCC_MODE_NotPresent;
1564 calLst[lstIdx].mpty = CLCC_MPTY_NotPresent;
1565 calLst[lstIdx].type.ton = TON_NotPresent;
1566 calLst[lstIdx].number[0] = 0x0;
1567 if( at_cmd_id EQ AT_CMD_P_CLCC )
1568 {
1569 calLst[lstIdx].class_type = CLCC_CLASS_NotPresent;
1570 #ifdef FF_BAT
1571 calLst[lstIdx].prog_desc = NOT_PRESENT_8BIT;
1572 #endif
1573 }
1574 #ifdef NO_ASCIIZ
1575 calLst[lstIdx].alpha.cs = CS_NotPresent;
1576 calLst[lstIdx].alpha.len = 0;
1577 #else /* #ifdef NO_ASCIIZ */
1578 calLst[lstIdx].alpha[0] = 0x0;
1579 #endif /* #ifdef NO_ASCIIZ */
1580 }
1581
1582 return( AT_CMPL );
1583 }
1584
1585 /*
1586 +--------------------------------------------------------------------+
1587 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
1588 | STATE : code ROUTINE : qAT_PlusCVHU |
1589 +--------------------------------------------------------------------+
1590
1591 PURPOSE : This is query call for +CVHU for the control of the voice
1592 hangup
1593
1594 */
1595 GLOBAL T_ACI_RETURN qAT_PlusCVHU ( T_ACI_CMD_SRC srcId, T_ACI_CVHU_MODE *mode)
1596 {
1597 TRACE_FUNCTION("qAT_PlusCVHU()");
1598
1599 if(!cmh_IsVldCmdSrc (srcId))
1600 {
1601 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1602 return( AT_FAIL );
1603 }
1604
1605 *mode = ccShrdPrm.cvhu;
1606
1607 return( AT_CMPL );
1608 }
1609 /*==== EOF ========================================================*/