comparison g23m/condat/ms/src/aci/cmh_ccq.c @ 0:509db1a7b7b8

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