comparison src/g23m-aci/aci/cmh_satr.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_SATR
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 defines the functions which are responsible
18 | for the responses of the protocol stack adapter for
19 | the SIM application toolkit.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifdef SIM_TOOLKIT
24
25 #ifndef CMH_SATR_C
26 #define CMH_SATR_C
27 #endif
28
29 #include "aci_all.h"
30 /*==== INCLUDES ===================================================*/
31 #include "aci_cmh.h"
32 #include "aci_mem.h"
33
34 #ifdef FAX_AND_DATA
35 #include "aci_fd.h"
36 #endif /* of #ifdef FAX_AND_DATA */
37
38 #include "aci.h"
39 #include "psa.h"
40 #include "psa_cc.h"
41 #include "psa_ss.h"
42 #include "psa_sat.h"
43 #include "psa_sim.h" /* for simShrdPrm declaration */
44 #include "psa_sms.h"
45 #include "psa_util.h"
46 #include "cmh.h"
47 #include "cmh_cc.h"
48 #include "cmh_sat.h"
49 #include "cmh_sms.h"
50 #include "aoc.h"
51
52 #include "phb.h"
53 #include "cmh_phb.h"
54 #include "l4_tim.h"
55 /*==== CONSTANTS ==================================================*/
56
57
58 /*==== TYPES ======================================================*/
59
60
61 /*==== EXPORT =====================================================*/
62
63 /*==== PROTOTYPES==================================================*/
64 /* Implements Measure # 57, 77 */
65 LOCAL void cmhSAT_ResCntrlBySIM (T_ACI_AT_CMD cmdBuf,
66 UBYTE simRslt,
67 T_ACI_SAT_TERM_RESP *resp_data);
68
69 /* Implements Measure # 174 */
70 LOCAL void cmhSAT_SIMCntrlAlertUser (BOOL ownNotSAT,
71 SHORT cId
72 #ifdef FF_SAT_E
73 ,T_ACI_SATA_ADD *addPrm
74 #endif
75 );
76
77 /*==== VARIABLES ==================================================*/
78
79 /*==== FUNCTIONS ==================================================*/
80
81 /*
82 +--------------------------------------------------------------------+
83 | PROJECT : MODULE : CMH_SATR |
84 | STATE : code ROUTINE : cmhSAT_ModifyScaPdu |
85 +--------------------------------------------------------------------+
86
87 PURPOSE : modifies the SCA in a SUBMIT PDU
88
89 */
90 LOCAL void cmhSAT_ModifyScaPdu( T_sms_sdu *sms_sdu,
91 UBYTE *sca_buf,
92 UBYTE sca_len )
93 {
94 UBYTE old_sca_len;
95 UBYTE *rest;
96 USHORT rest_len;
97 UBYTE *old_sdu;
98 UBYTE old_sdu_len;
99
100 ACI_MALLOC(old_sdu, SIM_PDU_LEN);
101 old_sdu_len = sms_sdu->l_buf/8;
102 memcpy ( old_sdu, sms_sdu->buf, old_sdu_len );
103
104 old_sca_len = *old_sdu+1;
105 rest = old_sdu + old_sca_len;
106 rest_len = old_sdu_len - old_sca_len;
107
108 /* copy new SCA */
109 memcpy(sms_sdu->buf, sca_buf, sca_len);
110
111 /* copy the rest of the PDU */
112 memcpy(sms_sdu->buf+sca_len, rest, rest_len);
113
114 /* set the length */
115 sms_sdu->l_buf = (sca_len+rest_len) * 8;
116
117 ACI_MFREE(old_sdu);
118 }
119
120
121 /*
122 +--------------------------------------------------------------------+
123 | PROJECT : MODULE : CMH_SATR |
124 | STATE : code ROUTINE : cmhSAT_ModifyDaPdu |
125 +--------------------------------------------------------------------+
126
127 PURPOSE : modifies the destination address in a SUBMIT PDU
128
129 */
130 LOCAL void cmhSAT_ModifyDaPdu( T_sms_sdu *sms_sdu,
131 UBYTE *da_buf,
132 UBYTE da_len )
133 {
134 UBYTE old_sca_len;
135 UBYTE old_da_len;
136 UBYTE *rest;
137 USHORT rest_len;
138 UBYTE *old_sdu;
139 UBYTE *new_sdu;
140 UBYTE old_sdu_len;
141
142 ACI_MALLOC(old_sdu, SIM_PDU_LEN);
143 old_sdu_len = sms_sdu->l_buf/8;
144 memcpy ( old_sdu, sms_sdu->buf, old_sdu_len );
145
146 new_sdu = sms_sdu->buf;
147
148 old_sca_len = *old_sdu+1;
149 old_da_len = (*(old_sdu + old_sca_len + 2)+1)/2 + 2;
150 rest = old_sdu + old_sca_len + 2 + old_da_len;
151 rest_len = old_sdu_len - old_sca_len - 2 - old_da_len;
152
153 /* copy old sca, fo, mr */
154 memcpy(new_sdu, old_sdu, old_sca_len+2);
155 new_sdu += old_sca_len+2;
156
157 /* copy the new DA */
158 memcpy(new_sdu, da_buf, da_len);
159 new_sdu += da_len;
160
161 /* copy the rest of the PDU */
162 memcpy(new_sdu, rest, rest_len);
163
164 /* set the length */
165 sms_sdu->l_buf = (old_sca_len+2+da_len+rest_len) * 8;
166
167 ACI_MFREE(old_sdu);
168 }
169
170
171 /*
172 +-------------------------------------------------------------------+
173 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
174 | ROUTINE : cmhSAT_STKCmdCnf |
175 +-------------------------------------------------------------------+
176
177 PURPOSE : STK command confirmation
178
179 */
180
181 GLOBAL SHORT cmhSAT_STKCmdCnf ( void )
182 {
183
184 TRACE_FUNCTION ("cmhSAT_STKCmdCnf()");
185
186 /*
187 *-------------------------------------------------------------------
188 * check for command context
189 *-------------------------------------------------------------------
190 */
191 switch( satEntStat.curCmd )
192 {
193 case( AT_CMD_SATE ):
194 /*
195 *----------------------------------------------------------------
196 * process event for %SATE command
197 *----------------------------------------------------------------
198 */
199 satEntStat.curCmd = AT_CMD_NONE;
200
201 TRACE_EVENT_P1("SAT reponse with SIM cause: %d", satShrdPrm.stkError);
202
203 switch (satShrdPrm.stkError)
204 {
205 case SIM_NO_ERROR:
206 R_AT( RAT_SATE, satEntStat.entOwn )
207 ( satShrdPrm.stkCmdLen>>3, satShrdPrm.stkCmd );
208
209 R_AT( RAT_OK, satEntStat.entOwn )
210 ( AT_CMD_SATE );
211 break;
212
213 case SIM_CAUSE_SAT_BUSY:
214 R_AT( RAT_CME, satEntStat.entOwn )
215 ( AT_CMD_SATE, CME_ERR_SimSatBusy );
216 break;
217
218 case SIM_CAUSE_PUK1_BLOCKED:
219 R_AT( RAT_CME, satEntStat.entOwn )
220 ( AT_CMD_SATE, CME_ERR_SimFail );
221 break;
222
223 default:
224 R_AT( RAT_CME, satEntStat.entOwn )
225 ( AT_CMD_SATE, CME_ERR_Unknown );
226 break;
227 }
228 break;
229 }
230
231 return 0;
232 }
233
234 /*
235 +-------------------------------------------------------------------+
236 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
237 | ROUTINE : cmhSAT_STKCmdInd |
238 +-------------------------------------------------------------------+
239
240 PURPOSE : STK command indication
241
242 */
243
244 GLOBAL SHORT cmhSAT_STKCmdInd ( void )
245 {
246 SHORT idx; /* holds list index */
247
248 TRACE_FUNCTION ("cmhSAT_STKCmdInd()");
249
250 /*
251 *----------------------------------------------------------------
252 * send unsolicited result
253 *----------------------------------------------------------------
254 */
255
256 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
257 {
258 R_AT( RAT_SATI, (T_ACI_CMD_SRC)idx )
259 ( satShrdPrm.stkCmdLen>>3, satShrdPrm.stkCmd );
260 }
261 return 0;
262 }
263
264 #ifdef TI_PS_FF_AT_P_CMD_CUST
265 /*
266 +-------------------------------------------------------------------+
267 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
268 | ROUTINE : cmhSAT_Cust1StkCmdInd |
269 +-------------------------------------------------------------------+
270
271 PURPOSE : Used for Sending the Origianl STK command indication to a Cust1 MMI,
272 when performing Setup Call, Send SS, Send USSD or Send SMS
273 */
274
275 GLOBAL SHORT cmhSAT_Cust1StkCmdInd ( void )
276 {
277 SHORT idx; /* holds list index */
278
279 TRACE_FUNCTION ("cmhSAT_Cust1StkCmdInd()");
280
281 if (satShrdPrm.cust1StkCmd != (void *)0)
282 {
283 /*
284 *----------------------------------------------------------------
285 * send %SATI the MMI with the Stk Cmd
286 *----------------------------------------------------------------
287 */
288
289 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
290 {
291 R_AT( RAT_SATI,(T_ACI_CMD_SRC)idx )
292 ( satShrdPrm.cust1StkCmdLen >>3, satShrdPrm.cust1StkCmd);
293 }
294
295 ACI_MFREE(satShrdPrm.cust1StkCmd);
296
297 satShrdPrm.cust1StkCmd = (void *)0;
298 satShrdPrm.cust1StkCmdLen = 0;
299 }
300
301 return 0;
302 }
303 #endif /* TI_PS_FF_AT_P_CMD_CUST */
304 /*
305 +-------------------------------------------------------------------+
306 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
307 | ROUTINE : cmhSAT_STKUsrNtfy |
308 +-------------------------------------------------------------------+
309
310 PURPOSE : STK user notification
311
312 */
313
314 GLOBAL SHORT cmhSAT_STKUsrNtfy ( void )
315 {
316 SHORT idx; /* holds list index */
317
318 T_ACI_SATN_CNTRL_TYPE cntrl_type = SATN_CNTRL_BY_SIM_Not_Present;
319
320 TRACE_FUNCTION ("cmhSAT_STKUsrNtfy()");
321
322 /*
323 *----------------------------------------------------------------
324 * determine user notification
325 *----------------------------------------------------------------
326 */
327 switch( satShrdPrm.ntfy )
328 {
329 case( USR_NTF_CC_SIM ):
330
331 #ifdef TI_PS_FF_AT_P_CMD_CUST
332 if (simShrdPrm.overall_cust_mode EQ CUST_MODE_BEHAVIOUR_1)
333 {
334 switch (satShrdPrm.SIMCCParm.ccAct)
335 {
336 case CC_ACT_CAL:
337 cntrl_type = SATN_CNTRL_BY_SIM_CALL;
338 break ;
339
340 case CC_ACT_SS:
341 cntrl_type = SATN_CNTRL_BY_SIM_SS;
342 break ;
343
344 case CC_ACT_USSD:
345 cntrl_type = SATN_CNTRL_BY_SIM_USSD;
346 break ;
347
348 case SMC_ACT_MO:
349 cntrl_type = SATN_CNTRL_BY_SIM_SMS;
350 break ;
351
352 default:
353 cntrl_type = SATN_CNTRL_BY_SIM_Not_Present;
354 }
355 }
356 #endif /* TI_PS_FF_AT_P_CMD_CUST */
357
358 if(psa_IsVldOwnId((T_OWN)satShrdPrm.owner) AND
359 satShrdPrm.owner NEQ OWN_SRC_INV )
360 {
361 R_AT( RAT_SATN, (T_ACI_CMD_SRC)satShrdPrm.owner )
362 ( satShrdPrm.stkCmdLen>>3, satShrdPrm.stkCmd, cntrl_type );
363 break;
364 }
365 /* otherwise continue, no break */
366 /*lint -fallthrough*/
367 default:
368
369 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
370 {
371 R_AT( RAT_SATN, (T_ACI_CMD_SRC)idx )
372 ( satShrdPrm.stkCmdLen>>3, satShrdPrm.stkCmd, cntrl_type );
373 }
374 }
375
376 return 0;
377 }
378
379 LOCAL void send_error_to_user( BOOL ownNotSAT,
380 UBYTE command,
381 UBYTE result,
382 UBYTE additional_result,
383 UBYTE *resId,
384 BOOL satopc )
385 {
386 T_ACI_SAT_TERM_RESP resp_data;
387
388 psaSAT_InitTrmResp( &resp_data );
389
390 if( ownNotSAT )
391 {
392 /* setup initiated by user */
393 R_AT( RAT_CME,(T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
394 ( command, CME_ERR_NotPresent );
395 /* log result */
396 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner, RAT_CME,
397 (T_ACI_AT_CMD)command, -1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
398 return;
399 }
400
401 /* setup initiated by SAT */
402 /* send SAT response */
403 resp_data.add_content = additional_result;
404
405 /* if source was open channel command */
406 #ifdef FF_SAT_E
407 if(satopc)
408 {
409 if( satShrdPrm.opchStat EQ OPCH_CCSIM_REQ )
410 {
411 cmhSAT_OpChnFailed( result, &resp_data );
412 return;
413 }
414 }
415 #endif /* FF_SAT_E */
416
417 if( resId NEQ NULL )
418 {
419 resp_data.resCC = resId;
420 }
421 psaSAT_SendTrmResp( result, &resp_data );
422 }
423
424 /* return TRUE if key sequence accepted, FALSE otherwise */
425 LOCAL BOOL sim_control_send_ss( T_CLPTY_PRM *ss_clpty,
426 UBYTE command,
427 BOOL ownNotSAT,
428 UBYTE *resCC )
429 {
430 T_ACI_RETURN retVal; /* holds return value */
431 T_ACI_D_CLIR_OVRD dummy2; /* dummy value */
432 T_ACI_D_TOC dummy1; /* dummy value */
433
434 /* check for busy SS condition */
435 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY )
436 {
437 /* NOTE: shouldn't that be:
438 send_error_to_user( ownNotSAT, RSLT_CC_SIM_PRM, ADD_ME_SS_BUSY, resCC, FALSE);
439 or send_error_to_user( ownNotSAT, RSLT_CC_SIM_PRM, RSLT_ME_CAP, resCC, FALSE);
440 ??*/
441 send_error_to_user( ownNotSAT, command, RSLT_ME_UNAB_PROC, ADD_ME_SS_BUSY, resCC, FALSE);
442 return FALSE;
443 }
444
445 /* send SS control string */
446 retVal = cmhCC_chkKeySeq ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner,
447 ss_clpty,
448 &dummy1,
449 &dummy2,
450 CC_SIM_NO );
451 if( retVal NEQ AT_EXCT )
452 {
453 /* string is not SS: terminate with error */
454 //TISH, patch for OMAPS00126322
455 //start
456 if (retVal EQ AT_CMPL)
457 {
458 TRACE_ERROR("send RSLT_PERF_SUCCESS");
459 send_error_to_user( ownNotSAT, command, RSLT_PERF_SUCCESS, RSLT_PERF_MDFY_SIM, resCC, FALSE);
460 return(TRUE);
461 }
462 //end
463 send_error_to_user( ownNotSAT, command, RSLT_CC_SIM_PRM, RSLT_ME_CAP, resCC, FALSE);
464 return(FALSE);
465 }
466 else
467 {
468 #ifdef FF_SAT_E
469 if(!ownNotSAT AND satShrdPrm.opchStat EQ OPCH_CCSIM_REQ )
470 {
471 return( FALSE );
472 }
473 #endif /* FF_SAT_E */
474 return(TRUE);
475 }
476 }
477
478 /*
479 +-------------------------------------------------------------------+
480 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
481 | ROUTINE : cmhSAT_ResCalCntrlBySIM |
482 +-------------------------------------------------------------------+
483
484 PURPOSE : Handle SIM call control result. Return TRUE if primitive
485 is needed for building a terminal response.
486
487 */
488 LOCAL BOOL cmhSAT_result_sim_cc_ss( SHORT cId,
489 UBYTE *resId,
490 T_ccr_allw *ccr )
491 {
492 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
493 T_ACI_SAT_TERM_RESP resp_data;
494 BOOL ownNotSAT = (satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT); /* flags that the owner is not SAT */
495 UBYTE cmdBuf; /* buffer command */
496
497 TRACE_FUNCTION("cmhSAT_result_sim_cc_ss()");
498
499 psaSAT_InitTrmResp( &resp_data );
500
501 #ifdef FF_SAT_E
502 /* check for a pending OPEN CHANNEL command */
503 if (ctb->calStat EQ CS_SAT_CSD_REQ)
504 {
505 /* free ctb entry */
506 psaCC_FreeCtbNtry (cId);
507
508 /* respond with "error, Interaction with CC by SIM, perm problem" */
509 resp_data.add_content = ADD_CC_REQ_CHNG;
510 resp_data.chnStat = TRUE;
511
512 cmhSAT_OpChnFailed( RSLT_CC_SIM_PRM, &resp_data );
513
514 return( FALSE );
515 }
516 #endif /* FF_SAT_E */
517
518 cmdBuf = ctb->curCmd;
519 psaCC_FreeCtbNtry (cId);
520
521 cmhCC_init_cldPty( &satPndSetup.clpty );
522
523 utl_BCD2DialStr( ccr->ss_string.ss_ctrl_string,
524 satPndSetup.clpty.num,
525 (UBYTE)MINIMUM(ccr->ss_string.c_ss_ctrl_string,
526 MAX_DIAL_LEN-1));
527
528 satPndSetup.clpty.ton = ccr->ss_string.noa;
529 satPndSetup.clpty.npi = ccr->ss_string.npi;
530
531 if( sim_control_send_ss( &satPndSetup.clpty, cmdBuf, ownNotSAT, resId ) )
532 return( !ownNotSAT );
533 return( FALSE ); /* primitive not needed anymore */
534 }
535
536 LOCAL BOOL cmhSAT_result_sim_cc_address( SHORT cId, T_ccr_allw *ccr )
537 {
538 SHORT retVal = 0;
539 T_ACI_SAT_TERM_RESP resp_data;
540
541 TRACE_FUNCTION("cmhSAT_result_sim_cc_address()");
542
543 psaSAT_InitTrmResp( &resp_data );
544
545 /* adjust called address */
546 cmhSAT_fillSetupPrm ( cId,
547 &ccr->addr,
548 ((ccr->v_subaddr)?&ccr->subaddr:NULL));
549 #ifdef FF_SAT_E
550 if( psaCC_ctb(cId)->calStat NEQ CS_SAT_CSD_REQ )
551 #endif /* FF_SAT_E */
552 {
553 /* new call table entry set default bearer capabilities */
554 cmhSAT_fillSetupBC ( cId, MNCC_BEARER_SERV_SPEECH, MNCC_BEARER_SERV_NOT_PRES );
555 }
556
557 /* Store the BC repeat indicator */
558 if ( ccr->v_bc_rpi )
559
560
561 {
562 ccShrdPrm.ctb[cId]->rptInd = ccr->bc_rpi;
563 }
564
565 /* adjust bearer capabilities */
566 if( ccr->v_cap_cnf_parms OR ccr->v_cap_cnf_parms_2 )
567 {
568 satShrdPrm.capParm.cId = cId;
569 satShrdPrm.capParm.CCres = CCR_ALLW_WITH_MDFY;
570 satShrdPrm.capParm.cntxt = CTX_CC_RESULT;
571
572 if ( ccr->v_cap_cnf_parms AND ccr->v_cap_cnf_parms_2 )
573 {
574 retVal= psaCC_BCapDecode( BCRI_SAT,
575 (UINT16)(ccr->cap_cnf_parms.l_cap_cnf_parms>>3),
576 ccr->cap_cnf_parms.b_cap_cnf_parms,
577 (UINT16)(ccr->cap_cnf_parms_2.l_cap_cnf_parms_2>>3),
578 ccr->cap_cnf_parms_2.b_cap_cnf_parms_2);
579 }
580 else if ( ccr->v_cap_cnf_parms )
581 {
582 retVal= psaCC_BCapDecode( BCRI_SAT,
583 (UINT16)(ccr->cap_cnf_parms.l_cap_cnf_parms>>3),
584 ccr->cap_cnf_parms.b_cap_cnf_parms,
585 0,
586 NULL);
587 }
588 if( retVal < 0 )
589 {
590 resp_data.resCC = &satShrdPrm.capParm.CCres;
591 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data );
592 psaCC_FreeCtbNtry (cId);
593 }
594 return( FALSE );
595 }
596 return( TRUE );
597 }
598
599
600 LOCAL BOOL cmhSAT_result_sim_cc_ussd( SHORT cId,
601 UBYTE *resId,
602 T_ccr_allw *ccr )
603 {
604 T_ACI_SAT_TERM_RESP resp_data;
605 BOOL ownNotSAT = (satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT); /* flags that the owner is not SAT */
606 UBYTE cmdBuf; /* buffer command */
607 UBYTE len = 0;
608 T_ACI_RETURN retVal;
609 T_ACI_D_TOC dummy1;
610 T_ACI_D_CLIR_OVRD dummy2;
611
612 TRACE_FUNCTION("cmhSAT_result_sim_cc_ussd()");
613
614 psaSAT_InitTrmResp( &resp_data );
615
616 /* check for busy SS condition */
617 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY )
618 {
619 /* respond with "error, ME currently unable to process command" */
620 resp_data.add_content = ADD_ME_SS_BUSY;
621 resp_data.resCC = resId;
622 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data );
623 return( FALSE );
624 }
625
626 /* call adr to be modified with USSD string*/
627 cmdBuf = psaCC_ctb(cId)->curCmd;
628 psaCC_FreeCtbNtry (cId);
629 /* Implements Measure 25 */
630 /* This function is more correct than utl_getAlphabetCb as it takes care
631 of reserved codings */
632 if( cmh_getAlphabetCb( (UBYTE) ccr->ussd_string.dcs) EQ 0 ) /* 7bit alphabet */
633 {
634 len=utl_cvt7To8( ccr->ussd_string.ussd_str,
635 ccr->ussd_string.c_ussd_str,
636 (UBYTE*)&satPndSetup.clpty.num, 0);
637 satPndSetup.clpty.num[len]=0x00;
638 }
639 else
640 {
641 memcpy( satPndSetup.clpty.num, ccr->ussd_string.ussd_str,
642 ccr->ussd_string.c_ussd_str );
643 satPndSetup.clpty.num[ccr->ussd_string.c_ussd_str]=0x00;
644 }
645
646 retVal = cmhCC_chkKeySeq ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner,
647 &satPndSetup.clpty,
648 &dummy1, &dummy2,
649 CC_SIM_NO );
650
651 if( retVal EQ AT_EXCT )
652 {
653 return( !ownNotSAT );
654 }
655 /* Implements Measure # 57 */
656 /* Implements Measure # 57, 77 */
657
658 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
659 in cmhSAT_ResCntrlBySIM */
660 resp_data.resCC = resId;
661
662 cmhSAT_ResCntrlBySIM ((T_ACI_AT_CMD)cmdBuf, RSLT_ME_CAP, &resp_data);
663
664 return( FALSE ); /* primitive not needed anymore */
665 }
666
667
668 GLOBAL BOOL cmhSAT_ResCalCntrlBySIM( UBYTE* resId, void *ccRes )
669 {
670 UBYTE cmdBuf; /* buffer command */
671 SHORT cId = satShrdPrm.SIMCCParm.cId; /* holds setup call id */
672 SHORT actId; /* holds active call id */
673 T_ccr_allw * ccr; /* points to CC result */
674 UBYTE idx; /* holds index */
675 T_ACI_SAT_TERM_RESP resp_data;
676
677 #if defined SMI OR defined MFW
678 T_ACI_CLOG cmdLog; /* holds logging info */
679 CHAR cmdlog_num_buf[MNCC_MAX_CC_CALLED_NUMBER]; /* buffer where number is written for cmdLog */
680 USHORT length; /* length of number */
681 #endif
682
683 TRACE_FUNCTION("cmhSAT_ResCalCntrlBySIM()");
684
685 psaSAT_InitTrmResp( &resp_data );
686
687 ccr = (T_ccr_allw*)ccRes;
688
689 /* check if queued event download */
690 if (satShrdPrm.event.c_queued)
691 {
692 cmhSAT_EventDwn((UBYTE)-1, -1, END_UNDEFINED);
693 }
694
695 satShrdPrm.SIMCCParm.busy = FALSE;
696
697 if (!psaCC_ctbIsValid (cId))
698 {
699 TRACE_ERROR ("Call table entry disappeared");
700 return FALSE;
701 }
702
703 #ifdef TI_PS_FF_AT_P_CMD_CUST
704 /*
705 ** If this is a Cust1 MMI and The originator was a STK Cmd
706 */
707 if ((simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) AND
708 (satShrdPrm.ownSAT EQ TRUE))
709 {
710 /*
711 ** Customised behaviour for the Cust1 MMI
712 */
713 if (*resId EQ CCR_NOT_ALLW)
714 {
715 /* Call Setup not allowed */
716 send_error_to_user( !satShrdPrm.ownSAT, psaCC_ctb(cId)->curCmd,
717 RSLT_CC_SIM_PRM, ADD_CC_NOT_ALLWD,
718 NULL, TRUE);
719 }
720 else
721 {
722 /*
723 ** This was a SAT initiated call. For the Cust1 the ACI does not yet have any
724 ** actions to perform, other than the CC By SIM which has been done. So :
725 ** Send the Original STK Cmd to the MMI in a %SATI for the MMI to process.
726 **
727 ** The second action will cause the MMI to request the approriate Call Setup, SS
728 ** or USSD Request and the required Call Table entry will then be re-created.
729 */
730 cmhSAT_Cust1StkCmdInd();
731 }
732
733 /* Free the Call Table Entry
734 ** The SATI indication (if sent) will cause the MMI to request the approriate Call Setup, SS
735 ** or USSD Request and the required Call Table entry will then be re-created.
736 */
737 psaCC_FreeCtbNtry (cId);
738
739 return( FALSE ); /* primitive not needed anymore */
740 }
741 #endif /* TI_PS_FF_AT_P_CMD_CUST */
742
743 /* determine result id */
744 switch( *resId )
745 {
746 case( CCR_NOT_ALLW ):
747 /* call setup not allowed */
748 send_error_to_user( !satShrdPrm.ownSAT, psaCC_ctb(cId)->curCmd,
749 RSLT_CC_SIM_PRM, ADD_CC_NOT_ALLWD,
750 NULL, TRUE);
751
752 /* memory for number has also been allocated in case of SAT setup call !! */
753 psaCC_FreeCtbNtry (cId);
754 return( FALSE ); /* primitive not needed anymore */
755
756 case( CCR_ALLW_WITH_MDFY ):
757 /* call setup allowed with modification */
758 if( ccr->v_ss_string )
759 {
760 /* if setup was converted into a SS control string */
761 return(cmhSAT_result_sim_cc_ss( cId, resId, ccr ));
762 }
763 else if( ccr->v_addr )
764 {
765 /* Replace call parameters for this cId with the ones provided by SIM */
766 if ( !(cmhSAT_result_sim_cc_address( cId, ccr )) )
767 {
768 return TRUE;
769 }
770 }
771 else if (ccr->v_ussd_string)
772 {
773 /* if setup was converted into a USSD control string */
774 return(cmhSAT_result_sim_cc_ussd( cId, resId, ccr ));
775 }
776 else
777 {} /* do not change cId parameters */
778 break;
779
780 case( CCR_ALLW_NO_MDFY ):
781 /* call setup allowed no modification */
782 /* use parameters already linked to cId */
783 break;
784 }
785
786 /* perform call setup initiated by user */
787 if( !satShrdPrm.ownSAT )
788 {
789 /* check for an active call */
790 actId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
791
792 if( actId NEQ NO_ENTRY )
793 {
794 /* put active on hold if possible */
795 if( psaCC_ctb(actId)->prio EQ MNCC_PRIO_NORM_CALL AND
796 cmhCC_getcalltype(actId) EQ VOICE_CALL )
797 {
798 //TISH, patch for OMAPS00129157
799 //start
800 #if 0
801 cmhCC_HoldCall(actId, psaCC_ctb(cId)->curSrc, AT_CMD_D);
802 #else
803 CHLDaddInfo=CHLD_ADD_INFO_DIAL_CAL;
804 cmhPrm[actId].ccCmdPrm.CHLDmode = CHLD_MOD_HldActDial;
805 cmhCC_HoldCall(actId, psaCC_ctb(cId)->curSrc, AT_CMD_D);
806 #endif
807 //end
808 }
809 /* reject call setup: already data or emergency call on going */
810 else
811 {
812 cmdBuf = psaCC_ctb(cId)->curCmd;
813 psaCC_FreeCtbNtry (cId);
814
815 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
816 ( cmdBuf, CME_ERR_NotPresent );
817
818 /* log result */
819 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner, RAT_CME,
820 (T_ACI_AT_CMD)cmdBuf,-1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
821
822 return( FALSE ); /* primitive not needed anymore */
823 }
824 }
825
826 /* finally set up call */
827 cmhCC_flagCall( cId,
828 &(cmhPrm[psaCC_ctb(cId)->calOwn].ccCmdPrm.mltyCncFlg));
829
830 //TISH, patch for OMAPS00129157
831 //start
832 if (CHLDaddInfo!=CHLD_ADD_INFO_DIAL_CAL || cmhPrm[actId].ccCmdPrm.CHLDmode != CHLD_MOD_HldActDial)
833 //end
834 psaCC_NewCall (cId);
835
836
837 #if defined SMI OR defined MFW
838 /* log command */
839 cmdLog.atCmd = AT_CMD_D;
840 cmdLog.cmdType = CLOG_TYPE_Set;
841 cmdLog.retCode = AT_EXCT;
842 cmdLog.cId = cId+1;
843 cmdLog.sId = ACI_NumParmNotPresent;
844 cmdLog.cmdPrm.sD.srcId = (T_ACI_CMD_SRC)psaCC_ctb(cId)->curSrc;
845
846 cmdLog.cmdPrm.sD.number = cmdlog_num_buf;
847
848 /*
849 * For this block wrong code is generated by target compiler 1.22e
850 * Use psaCC_ctb() to simplify pointer expression.
851 */
852 #if 0
853 if(ccShrdPrm.ctb[cId]->cldPty.c_called_num < MNCC_MAX_CC_CALLED_NUMBER)
854 {
855 length = ccShrdPrm.ctb[cId]->cldPty.c_called_num;
856 }
857 else
858 length = MNCC_MAX_CC_CALLED_NUMBER;
859
860 utl_BCD2String( cmdLog.cmdPrm.sD.number,
861 (UBYTE *) ccShrdPrm.ctb[cId]->cldPty.called_num,
862 length);
863 #else
864 if(psaCC_ctb(cId)->cldPty.c_called_num < MNCC_MAX_CC_CALLED_NUMBER)
865 {
866 length = psaCC_ctb(cId)->cldPty.c_called_num;
867 }
868 else
869 length = MNCC_MAX_CC_CALLED_NUMBER;
870
871 utl_BCD2String (cmdLog.cmdPrm.sD.number,
872 psaCC_ctb(cId)->cldPty.called_num,
873 length);
874 #endif /* else, #if 0 */
875
876 cmdLog.cmdPrm.sD.clirOvrd = D_CLIR_OVRD_Default; /* ??? */
877 cmdLog.cmdPrm.sD.cugCtrl = D_CUG_CTRL_NotPresent; /* ??? */
878 cmdLog.cmdPrm.sD.callType = (T_ACI_D_TOC)psaCC_ctb(cId)->calType;
879 #ifdef SIM_TOOLKIT
880 cmdLog.cmdPrm.sD.simCallCtrl= D_SIMCC_ACTIVE;
881 #endif /* SIM tOOLKIT */
882 rAT_PercentCLOG( &cmdLog );
883 #endif /* SMI or MFW */
884 return( FALSE );
885 }
886 /* perform call setup initiated by SAT */
887 else /* Must be normal behaviour, otherwise it would have been trapped earlier in the function */
888 {
889
890 #ifdef FF_SAT_E
891 /* if source was open channel command */
892 if( satShrdPrm.opchStat EQ OPCH_CCSIM_REQ )
893 {
894 if(*resId EQ CCR_ALLW_WITH_MDFY)
895 satShrdPrm.opchCCMdfy = TRUE;
896
897 cmhSAT_OpChnAlert( cId );
898 return( FALSE );
899 }
900 #endif /* FF_SAT_E */
901
902 #ifdef SIM_TOOLKIT
903 /* When Envelope Call Control is Enabled SATA should not go again */
904 if (ccShrdPrm.ctb[cId]->SATinv & SAT_REDIAL_ECCBE)
905 {
906 return( *resId EQ CCR_ALLW_WITH_MDFY );
907 }
908 #endif
909
910 /* alert user if command details are supported */
911 if( cmhSAT_ChckCmdDet() )
912 {
913 /* check aoc condition */
914 if ((psaCC_ctb(cId)->prio EQ MNCC_PRIO_NORM_CALL) AND
915 (aoc_check_moc() EQ FALSE))
916 /*
917 * check ACM exceeds ACMmax
918 * for non-emergency calls
919 */
920 {
921 resp_data.add_content = ADD_NO_CAUSE;
922 resp_data.resCC = (*resId EQ CCR_ALLW_WITH_MDFY)? resId: NULL;
923
924
925 psaSAT_SendTrmResp(RSLT_ME_UNAB_PROC, &resp_data);
926 psaCC_FreeCtbNtry (cId);
927 return( FALSE );
928 }
929
930 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
931 {
932
933 #ifdef FF_SAT_E
934 T_ACI_SATA_ADD addPrm;
935
936 addPrm.chnType = SATA_CT_VOICE;
937 addPrm.chnEst = SATA_EST_IM;
938
939 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur, &addPrm );
940 #else
941 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur );
942 #endif /* FF_SAT_E */
943 }
944
945 satShrdPrm.ntfy = USR_NTF_SETUP_CAL;
946 }
947 return( FALSE );
948 }
949 }
950
951 LOCAL BOOL sim_control_setup_call( T_ccr_allw *ccr, BOOL ownNotSAT )
952 {
953 SHORT cId = satShrdPrm.SIMCCParm.cId; /* holds setup call id */
954
955 #ifdef FF_SAT_E
956 T_ACI_SATA_ADD addPrm;
957 #endif /* FF_SAT_E */
958 cId = psaCC_ctbNewEntry();
959
960 if( cId EQ NO_ENTRY )
961 {
962 send_error_to_user( ownNotSAT, AT_CMD_D, RSLT_ME_UNAB_PROC, ADD_NO_CAUSE, NULL, FALSE);
963 return( FALSE ); /* primitive not needed anymore */
964 }
965
966 /* fill in setup parameter for called address */
967 cmhSAT_fillSetupPrm ( cId,
968 ((ccr->v_addr)?&ccr->addr:NULL),
969 ((ccr->v_subaddr)?&ccr->subaddr:NULL));
970 /* new call table entry set default bearer capabilities */
971 cmhSAT_fillSetupBC ( cId, MNCC_BEARER_SERV_SPEECH, MNCC_BEARER_SERV_NOT_PRES );
972
973 /* check aoc condition */
974 if ((psaCC_ctb(cId)->prio EQ MNCC_PRIO_NORM_CALL) AND
975 (aoc_check_moc() EQ FALSE))
976 /* check ACM exceeds ACMmax for non-emergency calls */
977 {
978 send_error_to_user( ownNotSAT, AT_CMD_D, RSLT_ME_UNAB_PROC, ADD_NO_CAUSE, NULL, FALSE);
979 psaCC_FreeCtbNtry (cId);
980 return( FALSE );
981 }
982
983 if( ccr->v_cap_cnf_parms )
984 {
985 /* check bearer caps, ctb not allocated */
986 }
987
988 /* declare call table entry as used and the owner and status
989 of the call */
990 psaCC_ctb(cId)->calOwn = (T_OWN)satShrdPrm.SIMCCParm.owner;
991 psaCC_ctb(cId)->calStat = CS_SAT_REQ;
992 psaCC_ctb(cId)->curCmd = AT_CMD_D;
993 psaCC_ctb(cId)->curSrc = satShrdPrm.SIMCCParm.owner;
994
995 if( !ownNotSAT ) psaCC_ctb(cId)->SATinv = TRUE;
996
997 /* Implements Measure # 174 */
998 cmhSAT_SIMCntrlAlertUser (ownNotSAT, cId
999 #ifdef FF_SAT_E
1000 , &addPrm
1001 #endif
1002 );
1003 return( !ownNotSAT );
1004 }
1005
1006
1007 /*
1008 +-------------------------------------------------------------------+
1009 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
1010 | ROUTINE : cmhSAT_ResSSCntrlBySIM |
1011 +-------------------------------------------------------------------+
1012
1013 PURPOSE : Handle SIM SS control result. Return TRUE if primitive
1014 is needed for building a terminal response.
1015
1016 */
1017
1018 GLOBAL BOOL cmhSAT_ResSSCntrlBySIM( UBYTE* resId, void *ccRes )
1019 {
1020 SHORT cId = satShrdPrm.SIMCCParm.cId; /* holds setup call id */
1021 T_ccr_allw * ccr; /* points to CC result */
1022 BOOL ownNotSAT; /* flags that the owner is not SAT */
1023
1024 TRACE_FUNCTION("cmhSAT_ResSSCntrlBySIM()");
1025
1026 ccr = (T_ccr_allw*)ccRes;
1027
1028 /* check if queued event download */
1029 if (satShrdPrm.event.c_queued)
1030 {
1031 cmhSAT_EventDwn( (UBYTE)-1, -1, END_UNDEFINED);
1032 }
1033
1034 satShrdPrm.SIMCCParm.busy = FALSE;
1035
1036 ownNotSAT = satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT;
1037
1038 #ifdef TI_PS_FF_AT_P_CMD_CUST
1039 /*
1040 ** If this is a Cust1 MMI and The originator was a STK Cmd
1041 */
1042 if ((simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) AND
1043 (ownNotSAT == FALSE))
1044 {
1045 /*
1046 ** Customised behaviour for the Cust1 MMI
1047 */
1048 if (*resId EQ CCR_NOT_ALLW)
1049 {
1050 send_error_to_user( ownNotSAT,
1051 AT_CMD_D,
1052 RSLT_CC_SIM_PRM,
1053 ADD_CC_NOT_ALLWD,
1054 NULL, FALSE);
1055 }
1056 else
1057 {
1058 /*
1059 ** This was a SAT initiated Request. For the Cust1 the ACI does not yet have any
1060 ** actions to perform, other than the CC By SIM which has been done. So :
1061 ** Send the Original STK Cmd to the MMI in a %SATI for the MMI to process.
1062 **
1063 ** The second action will cause the MMI to request the approriate Call Setup, SS
1064 ** or USSD Request and the required Call Table entry will then be re-created.
1065 */
1066 cmhSAT_Cust1StkCmdInd();
1067 }
1068
1069 /* Free the Call Table Entry
1070 ** The SATI indication (if sent) will cause the MMI to request the approriate Call Setup, SS
1071 ** or USSD Request and the required Call Table entry will then be re-created.
1072 */
1073 if (psaCC_ctbIsValid (cId))
1074 {
1075 psaCC_retMOCTi(psaCC_ctb(cId)->ti);
1076 psaCC_chngCalTypCnt(cId, -1);
1077 psaCC_FreeCtbNtry (cId);
1078 }
1079 return( FALSE ); /* primitive not needed anymore */
1080 }
1081 #endif /* TI_PS_FF_AT_P_CMD_CUST */
1082
1083 /* determine result id */
1084 switch( *resId )
1085 {
1086 case( CCR_NOT_ALLW ): /* SS not allowed */
1087 {
1088 send_error_to_user( ownNotSAT, AT_CMD_D, RSLT_CC_SIM_PRM, ADD_CC_NOT_ALLWD, NULL, FALSE);
1089 if (ownNotSAT EQ FALSE)
1090 {
1091 /* clear call ID */
1092 if (psaCC_ctbIsValid (cId))
1093 {
1094 psaCC_retMOCTi(psaCC_ctb(cId)->ti);
1095 psaCC_chngCalTypCnt(cId, -1);
1096 psaCC_FreeCtbNtry (cId);
1097 }
1098 }
1099 return( FALSE ); /* primitive not needed anymore */
1100 }
1101 case( CCR_ALLW_WITH_MDFY ): /* SS allowed with modification */
1102 {
1103 if( ccr->v_addr )
1104 {
1105 /* if SS control string was converted into a call setup */
1106 return(sim_control_setup_call( ccr, ownNotSAT ));
1107 }
1108 else if( ccr->v_ss_string )
1109 {
1110 /* if SS control string was changed by sim control */
1111
1112 /* adjust SS control string */
1113 cmhCC_init_cldPty( &satPndSetup.clpty ); /* erase previous ss string */
1114
1115 utl_BCD2DialStr( ccr->ss_string.ss_ctrl_string,
1116 satPndSetup.clpty.num,
1117 (UBYTE)MINIMUM(ccr->ss_string.c_ss_ctrl_string,
1118 MAX_DIAL_LEN-1));
1119 satPndSetup.clpty.ton = ccr->ss_string.noa;
1120 satPndSetup.clpty.npi = ccr->ss_string.npi;
1121
1122 sim_control_send_ss( &satPndSetup.clpty, AT_CMD_D, ownNotSAT, NULL );
1123 return(FALSE);
1124 }
1125 else /* if no optionnal field, then assume no modification see 11.14 ?9.1.6 */
1126 sim_control_send_ss( &satPndSetup.clpty, AT_CMD_D, ownNotSAT, NULL );
1127 return(FALSE);
1128 }
1129 /* SS allowed no modification */
1130 default:
1131 TRACE_ERROR ("Unknown resID in cmhSAT_ResSSCntrlBySIM!");
1132 /*lint -fallthrough*/
1133 case( CCR_ALLW_NO_MDFY ):
1134 sim_control_send_ss( &satPndSetup.clpty, AT_CMD_D, ownNotSAT, NULL );
1135 return( FALSE ); /* primitive not needed anymore */
1136 }
1137 }
1138
1139 /*
1140 +-------------------------------------------------------------------+
1141 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
1142 | ROUTINE : cmhSAT_ResUSSDCntrlBySIM |
1143 +-------------------------------------------------------------------+
1144
1145 PURPOSE : Handle SIM USSD control result. Return TRUE if primitive
1146 is needed for building a terminal response.
1147
1148 */
1149
1150 GLOBAL BOOL cmhSAT_ResUSSDCntrlBySIM( UBYTE* resId, void *ccRes )
1151 {
1152 T_ACI_RETURN retVal; /* holds return value */
1153 T_ccr_allw * ccr; /* points to CC result */
1154 BOOL ownNotSAT; /* flags that the owner is not SAT */
1155 SHORT sId;
1156 T_ACI_SAT_TERM_RESP resp_data;
1157 #ifdef FF_SAT_E
1158 T_ACI_SATA_ADD addPrm;
1159 #endif
1160 UBYTE *ussdString;
1161 UBYTE ussdLen;
1162 UBYTE src_len;
1163
1164
1165
1166 TRACE_FUNCTION ("cmhSAT_ResUSSDCntrlBySIM()");
1167
1168 psaSAT_InitTrmResp( &resp_data );
1169
1170 ccr = (T_ccr_allw*)ccRes;
1171
1172 /* check if queued event download */
1173 if (satShrdPrm.event.c_queued)
1174 {
1175 cmhSAT_EventDwn((UBYTE)-1, -1, END_UNDEFINED);
1176 }
1177
1178 satShrdPrm.SIMCCParm.busy = FALSE;
1179
1180 ownNotSAT = satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT;
1181
1182 #ifdef TI_PS_FF_AT_P_CMD_CUST
1183 /*
1184 ** If this is a Cust1 MMI and The originator was a STK Cmd
1185 */
1186 if ((simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) AND
1187 (ownNotSAT EQ FALSE))
1188 {
1189 /*
1190 ** Customised behaviour for the Cust1 MMI
1191 */
1192 if (*resId EQ CCR_NOT_ALLW)
1193 {
1194 /* send SAT response */
1195 resp_data.add_content = ADD_CC_NOT_ALLWD;
1196 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data );
1197 }
1198 else
1199 {
1200 /*
1201 ** This was a SAT initiated Request. For the Cust1 the ACI does not yet have any
1202 ** actions to perform, other than the CC By SIM which has been done. So :
1203 ** Send the Original STK Cmd to the MMI in a %SATI for the MMI to process.
1204 */
1205 cmhSAT_Cust1StkCmdInd();
1206 }
1207
1208 return( FALSE ); /* primitive not needed anymore */
1209 }
1210 #endif /* TI_PS_FF_AT_P_CMD_CUST */
1211 /*
1212 *----------------------------------------------------------------
1213 * determine result id
1214 *----------------------------------------------------------------
1215 */
1216 switch( *resId )
1217 {
1218 /*
1219 *------------------------------------------------------------
1220 * SS not allowed
1221 *------------------------------------------------------------
1222 */
1223 case( CCR_NOT_ALLW ):
1224
1225 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
1226 in cmhSAT_ResCntrlBySIM */
1227 resp_data.add_content = ADD_CC_NOT_ALLWD;
1228
1229 /* Implements Measure # 57, 77 */
1230 cmhSAT_ResCntrlBySIM (AT_CMD_D, RSLT_CC_SIM_PRM, &resp_data);
1231 return( FALSE ); /* primitive not needed anymore */
1232
1233 /*
1234 *------------------------------------------------------------
1235 * USSD allowed with modification
1236 *------------------------------------------------------------
1237 */
1238 case( CCR_ALLW_WITH_MDFY ):
1239
1240 /* if USSD control string was converted into a call setup */
1241 if( ccr->v_addr )
1242 {
1243 SHORT cId = psaCC_ctbNewEntry();
1244
1245 if( cId EQ NO_ENTRY )
1246 {
1247 /*
1248 * We got no free slot in the call table
1249 */
1250 /* Implements Measure # 77 */
1251 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
1252 in cmhSAT_ResCntrlBySIM */
1253 resp_data.add_content = ADD_NO_CAUSE;
1254 cmhSAT_ResCntrlBySIM (AT_CMD_D, RSLT_ME_UNAB_PROC, &resp_data);
1255 return( FALSE ); /* primitive not needed anymore */
1256 }
1257
1258 /*
1259 * We have successfully allocated a slot in the call table
1260 */
1261
1262 /* fill in setup parameter for called address */
1263 cmhSAT_fillSetupPrm ( cId,
1264 ((ccr->v_addr)?&ccr->addr:NULL),
1265 ((ccr->v_subaddr)?&ccr->subaddr:NULL));
1266 /* new call table entry set default bearer capabilities */
1267 cmhSAT_fillSetupBC ( cId, MNCC_BEARER_SERV_SPEECH, MNCC_BEARER_SERV_NOT_PRES );
1268
1269 /* check aoc condition */
1270 if ((psaCC_ctb(cId)->prio EQ MNCC_PRIO_NORM_CALL) AND
1271 (aoc_check_moc() EQ FALSE))
1272 /*
1273 * check ACM exceeds ACMmax
1274 * for non-emergency calls
1275 */
1276 {
1277 /* Implements Measure # 77 */
1278 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
1279 in cmhSAT_ResCntrlBySIM */
1280 resp_data.add_content = ADD_NO_CAUSE;
1281 cmhSAT_ResCntrlBySIM (AT_CMD_D, RSLT_ME_UNAB_PROC, &resp_data);
1282 psaCC_FreeCtbNtry (cId);
1283 return( FALSE );
1284 }
1285
1286 if( ccr->v_cap_cnf_parms )
1287 {
1288 /* check bearer caps, ctb not allocated */
1289 }
1290
1291
1292 /* declare call table entry as used and the owner and status
1293 of the call */
1294 psaCC_ctb(cId)->calOwn = (T_OWN)satShrdPrm.SIMCCParm.owner;
1295 psaCC_ctb(cId)->calStat = CS_SAT_REQ;
1296 psaCC_ctb(cId)->curCmd = AT_CMD_D;
1297 psaCC_ctb(cId)->curSrc = satShrdPrm.SIMCCParm.owner;
1298
1299 if( !ownNotSAT )
1300 psaCC_ctb(cId)->SATinv = TRUE;
1301
1302 /* Implements Measure # 174 */
1303 cmhSAT_SIMCntrlAlertUser (ownNotSAT, cId
1304 #ifdef FF_SAT_E
1305 , &addPrm
1306 #endif
1307 );
1308
1309 return( !ownNotSAT );
1310 }
1311
1312 /* --- no break, continue with next case --- */
1313 /*lint -fallthrough*/
1314
1315 /*
1316 *------------------------------------------------------------
1317 * USSD allowed no modification
1318 *------------------------------------------------------------
1319 */
1320 default:
1321 TRACE_ERROR ("unknown resID in cmhSAT_ResUSSDCntrlBySIM");
1322 /*lint -fallthrough*/
1323 case( CCR_ALLW_NO_MDFY ):
1324
1325 /* check for busy SS condition */
1326 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY )
1327 {
1328 /* respond with "error, ME currently unable to process command" */
1329 resp_data.add_content = ADD_ME_USSD_BUSY;
1330 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data );
1331 return( FALSE );
1332 }
1333
1334 /* adjust SS control string */
1335 if( ccr->v_ussd_string )
1336 {
1337 memcpy( &(satPndSetup.ussd_str),
1338 &ccr->ussd_string,
1339 sizeof(T_ussd_string));
1340 }
1341
1342 /********************************************************************************/
1343 /*
1344 *-------------------------------------------------------------------
1345 * check if there is a USSD request pending
1346 *-------------------------------------------------------------------
1347 */
1348 sId = psaSS_stbFindUssdReq();
1349
1350 if( sId EQ NO_ENTRY )
1351 {
1352 /* check if there is another service in progress */
1353 if( psaSS_stbFindActSrv( sId ) NEQ NO_ENTRY )
1354 {
1355 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_ParallelUSSD );
1356 return(FALSE);
1357 }
1358
1359 /* get new service table entry */
1360 sId = psaSS_stbNewEntry();
1361 if( sId EQ NO_ENTRY )
1362 {
1363 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
1364 return(FALSE);
1365 }
1366
1367 CCD_START;
1368
1369 MALLOC(ussdString, MAX_USSD_STRING);
1370
1371 /* set data coding scheme */
1372 /* patch !!!!! CLB 11/12/01 */
1373 if( (UBYTE)satPndSetup.ussd_str.dcs EQ 0x40 )
1374 {
1375 /* 0x40 means basically default alphabet...
1376 yet some asian networks dont seem to accept it (although using it
1377 in their own STK !!!) */
1378 satPndSetup.ussd_str.dcs = 0x0F;
1379 }
1380 /*********************************/
1381 /* Implements Measure 25 */
1382 /* This function is more correct than utl_getAlphabetCb as it takes care
1383 of reserved codings */
1384 if( cmh_getAlphabetCb( (UBYTE)satPndSetup.ussd_str.dcs ) EQ 0 ) /* 7bit alphabet */
1385 {
1386 src_len = (UBYTE)MINIMUM( MAX_USSD_STRING, satPndSetup.ussd_str.c_ussd_str);
1387 ussdLen = utl_cvt8To7( satPndSetup.ussd_str.ussd_str,
1388 src_len,
1389 ussdString, 0 );
1390 /* According to spec 23.038 section 6.1.2.3 for USSD packing, for bytes end with
1391 * (8*n)-1 i.e where n is 1,2,3....i.e byte 7, 15, 23 ... to be padded
1392 * with carriage return <CR>(0xD)
1393 */
1394 if ((src_len+1)%8 EQ 0)
1395 {
1396 ussdString[ussdLen-1] |= (0xD << 1);
1397 }
1398 }
1399 else
1400 {
1401 ussdLen = satPndSetup.ussd_str.c_ussd_str;
1402 memcpy(ussdString, satPndSetup.ussd_str.ussd_str, MAX_USSD_STRING);
1403 }
1404 psaSS_asmProcUSSDReq( (UBYTE)satPndSetup.ussd_str.dcs /*dcs*/,
1405 ussdString,
1406 ussdLen);
1407 //TISH, patch for OMAPS00122397
1408 //patch for get network reject information: "A406020100810101"
1409 //start
1410 ssShrdPrm.ussdLen= ussdLen;
1411 TRACE_EVENT_P1("ssShrdPrm.ussdLen = %d", ssShrdPrm.ussdLen);
1412 memcpy(ssShrdPrm.ussdBuf,ussdString,ussdLen);
1413 ssShrdPrm.ussdDcs=0x0f;
1414 satShrdPrm.SentUSSDid=sId;
1415 //end
1416
1417
1418 MFREE(ussdString);
1419
1420 /* start new transaction */
1421 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
1422
1423 if (ownNotSAT)
1424 {
1425 ssShrdPrm.stb[sId].curCmd = AT_CMD_CUSD;
1426 ssShrdPrm.stb[sId].srvOwn = (T_OWN)satShrdPrm.SIMCCParm.owner;
1427 }
1428 else
1429 {
1430 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE;
1431 ssShrdPrm.stb[sId].srvOwn = OWN_SRC_SAT;
1432 satShrdPrm.SentUSSDid = sId;
1433 }
1434 psaSS_NewTrns(sId);
1435
1436 if (ownNotSAT)
1437 {
1438 R_AT( RAT_OK, (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
1439 ( AT_CMD_CUSD);
1440
1441 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner,
1442 RAT_OK, AT_CMD_CUSD, -1, BS_SPEED_NotPresent, CME_ERR_NotPresent);
1443 }
1444
1445 CCD_END;
1446
1447 retVal = AT_EXCT;
1448 }
1449 else
1450 {
1451 CCD_START;
1452
1453 psaSS_asmCnfUSSDReq( (UBYTE)satPndSetup.ussd_str.dcs,
1454 satPndSetup.ussd_str.ussd_str,
1455 satPndSetup.ussd_str.c_ussd_str );
1456
1457 ssShrdPrm.stb[sId].ussdReqFlg = FALSE;
1458
1459 /* continue existing transaction */
1460 psaSS_CntTrns(sId);
1461
1462 CCD_END;
1463
1464 retVal = AT_CMPL;
1465 }
1466 /**********************************************************************************/
1467
1468 if( retVal EQ AT_EXCT )
1469 return( FALSE ); /* primitive not needed anymore */
1470 /* Implements Measure # 57 */
1471 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
1472 in cmhSAT_ResCntrlBySIM */
1473 resp_data.resCC = resId;
1474 cmhSAT_ResCntrlBySIM (AT_CMD_D, RSLT_ME_CAP, &resp_data);
1475
1476 return( FALSE ); /* primitive not needed anymore */
1477 }
1478 }
1479
1480 /*
1481 +-------------------------------------------------------------------+
1482 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
1483 | ROUTINE : cmhSAT_ResSMCntrlBySIM |
1484 +-------------------------------------------------------------------+
1485
1486 PURPOSE : Handle SIM SM control result. Return TRUE if primitive
1487 is needed for building a terminal response.
1488
1489 */
1490
1491 GLOBAL BOOL cmhSAT_ResSMCntrlBySIM( UBYTE* resId, void *smcRes )
1492 {
1493 BOOL ownNotSAT; /* flags that the owner is not SAT */
1494 T_smcr_allw *smcr; /* points to SM result */
1495 T_ACI_CMGF_MOD mode;
1496 UBYTE sca_buf[MAX_SMS_ADDR_DIG/2 + 2];
1497 UBYTE da_buf[MAX_SMS_ADDR_DIG/2 + 2];
1498 UBYTE sca_len = 0;
1499 UBYTE da_len = 0;
1500 T_ACI_SAT_TERM_RESP resp_data;
1501 UBYTE srcId = smsShrdPrm.smsEntStat.entOwn;
1502
1503 TRACE_FUNCTION ("cmhSAT_ResSMCntrlBySIM()");
1504
1505
1506 psaSAT_InitTrmResp( &resp_data );
1507
1508 smcr = (T_smcr_allw*)smcRes;
1509
1510 /* check if queued event download */
1511 if (satShrdPrm.event.c_queued)
1512 {
1513 cmhSAT_EventDwn((UBYTE)-1, -1, END_UNDEFINED);
1514 }
1515
1516 satShrdPrm.SIMCCParm.busy = FALSE;
1517
1518 ownNotSAT = satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT;
1519
1520 #ifdef TI_PS_FF_AT_P_CMD_CUST
1521 /*
1522 ** If this is a Cust1 MMI and The originator was a STK Cmd
1523 */
1524 if ((simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) AND
1525 (ownNotSAT EQ FALSE))
1526 {
1527 /*
1528 ** Customised behaviour for the Cust1 MMI
1529 */
1530 if (*resId EQ CCR_NOT_ALLW)
1531 {
1532 /* send SAT response */
1533 resp_data.add_content = ADD_CC_NOT_ALLWD;
1534 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data );
1535 }
1536 else
1537 {
1538 /*
1539 ** This was a SAT initiated Request. For the Cust1 the ACI does not yet have any
1540 ** actions to perform, other than the CC By SIM which has been done. So :
1541 ** Send the Original STK Cmd to the MMI in a %SATI for the MMI to process.
1542 **
1543 ** The second action will cause the MMI to request the approriate Call Setup, SS
1544 ** or USSD Request and the required Call Table entry will then be re-created.
1545 */
1546 cmhSAT_Cust1StkCmdInd();
1547 }
1548
1549 if ( (sat_mnsms_submit_req->rec_num EQ SMS_RECORD_NOT_EXIST) OR
1550 (sat_mnsms_submit_req->modify NEQ SMS_MODIFY_NON) )
1551 {
1552 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
1553 {
1554 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
1555 smsShrdPrm.tpdu.tp_submit = NULL;
1556 }
1557 }
1558 PFREE( sat_mnsms_submit_req );
1559
1560 /*
1561 ** Ensure that the SMS parameters are reset, so that the SMS Entity is freed to
1562 ** process the command later.
1563 */
1564 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE;
1565 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE;
1566 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE;
1567
1568 return( FALSE ); /* primitive not needed anymore */
1569 }
1570 #endif /* TI_PS_FF_AT_P_CMD_CUST */
1571
1572 if (smsShrdPrm.smsEntStat.curCmd EQ AT_CMD_CMSS)
1573 {
1574 mode = CMGF_MOD_Txt;
1575 }
1576 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_
1577 else if (smsShrdPrm.smsEntStat.entOwn EQ CMD_SRC_LCL)
1578 {
1579 mode = CMGF_MOD_Txt; /* since text mode (AT+CMGF=1) is never set in MMI */
1580 }
1581 #endif
1582 else if (ownNotSAT EQ FALSE)
1583 {
1584 mode = CMGF_MOD_Pdu;
1585 }
1586 else
1587 {
1588 /*
1589 * request current mode
1590 */
1591 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode);
1592 }
1593
1594 /*
1595 *----------------------------------------------------------------
1596 * determine result id
1597 *----------------------------------------------------------------
1598 */
1599 switch( *resId )
1600 {
1601 /*
1602 *------------------------------------------------------------
1603 * send message not allowed
1604 *------------------------------------------------------------
1605 */
1606 case( CCR_NOT_ALLW ):
1607 /* setup initiated by user */
1608 /* Implements Measure # 57 */
1609 /* Fill resp_data content in case it is needed for psaSAT_SendTrmResp
1610 in cmhSAT_ResCntrlBySIM */
1611 resp_data.add_content = ADD_CC_NOT_ALLWD;
1612 cmhSAT_ResCntrlBySIM (smsShrdPrm.smsEntStat.curCmd, RSLT_CC_SIM_PRM, &resp_data);
1613 /* The following has not been taken into as a parameter will have to be
1614 * added in all places where it is called for this setting alone */
1615 if( ownNotSAT )
1616 {
1617 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE;
1618 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE;
1619 }
1620 if ( (sat_mnsms_submit_req->rec_num EQ SMS_RECORD_NOT_EXIST) OR
1621 (sat_mnsms_submit_req->modify NEQ SMS_MODIFY_NON) )
1622 {
1623 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
1624 {
1625 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
1626 smsShrdPrm.tpdu.tp_submit = NULL;
1627 }
1628 }
1629 PFREE( sat_mnsms_submit_req );
1630 return( FALSE ); /* primitive not needed anymore */
1631
1632
1633 case( CCR_ALLW_WITH_MDFY ):
1634 if ( smcr->v_sm_addr )
1635 {
1636 /*
1637 * RP Service Center Address
1638 */
1639
1640 sat_mnsms_submit_req->modify |= SMS_MODIFY_SCA;
1641
1642 if (mode EQ CMGF_MOD_Pdu)
1643 {
1644 /* PDU mode */
1645 sca_len = CodeRPAddress( sca_buf,
1646 smcr->sm_addr.c_bcdDigit,
1647 smcr->sm_addr.noa,
1648 smcr->sm_addr.npi,
1649 smcr->sm_addr.bcdDigit );
1650
1651 cmhSAT_ModifyScaPdu( &sat_mnsms_submit_req->sms_sdu,
1652 sca_buf,
1653 sca_len );
1654 }
1655 else
1656 {
1657 /* Text mode */
1658 smsShrdPrm.tpdu.sc_addr.v_ton = 1;
1659 smsShrdPrm.tpdu.sc_addr.ton = smcr->sm_addr.noa;
1660 smsShrdPrm.tpdu.sc_addr.v_npi = 1;
1661 smsShrdPrm.tpdu.sc_addr.npi = smcr->sm_addr.npi;
1662 smsShrdPrm.tpdu.sc_addr.c_num = smcr->sm_addr.c_bcdDigit;
1663 memcpy(smsShrdPrm.tpdu.sc_addr.num, smcr->sm_addr.bcdDigit,
1664 smcr->sm_addr.c_bcdDigit);
1665 }
1666 }
1667
1668 if ( smcr->v_sm_addr_2)
1669 {
1670 /*
1671 * TP Destination Address
1672 */
1673
1674 sat_mnsms_submit_req->modify |= SMS_MODIFY_TPOA;
1675
1676 if (mode EQ CMGF_MOD_Pdu)
1677 {
1678 /* PDU mode */
1679 da_len = CodeTPAddress( da_buf,
1680 smcr->sm_addr_2.c_bcdDigit,
1681 smcr->sm_addr_2.noa,
1682 smcr->sm_addr_2.npi,
1683 smcr->sm_addr_2.bcdDigit );
1684
1685 cmhSAT_ModifyDaPdu( &sat_mnsms_submit_req->sms_sdu,
1686 da_buf,
1687 da_len );
1688 }
1689 else
1690 {
1691 /* Text mode */
1692 smsShrdPrm.tpdu.tp_submit->tp_da.ton = smcr->sm_addr_2.noa;
1693 smsShrdPrm.tpdu.tp_submit->tp_da.npi = smcr->sm_addr_2.npi;
1694 smsShrdPrm.tpdu.tp_submit->tp_da.c_num = smcr->sm_addr_2.c_bcdDigit;
1695 smsShrdPrm.tpdu.tp_submit->tp_da.digits = smcr->sm_addr_2.c_bcdDigit;
1696 memcpy(smsShrdPrm.tpdu.tp_submit->tp_da.num, smcr->sm_addr_2.bcdDigit,
1697 smcr->sm_addr_2.c_bcdDigit);
1698 }
1699 }
1700 /* no break needed !!!! */
1701 /*lint -fallthrough*/
1702 case( CCR_ALLW_NO_MDFY ):
1703 if( sat_mnsms_submit_req )
1704 {
1705 if (mode EQ CMGF_MOD_Txt) /* Text mode */
1706 {
1707 /* code sm here */
1708 cmhSMS_codeMsg (&sat_mnsms_submit_req->sms_sdu,
1709 SMS_VT_SUBMIT,
1710 &smsShrdPrm.tpdu.sc_addr,
1711 SMS_SUBMIT,
1712 (UBYTE*)smsShrdPrm.tpdu.tp_submit);
1713
1714 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
1715 {
1716 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
1717 smsShrdPrm.tpdu.tp_submit = NULL;
1718 }
1719 }
1720
1721 PSENDX (SMS, sat_mnsms_submit_req);
1722 }
1723 else
1724 TRACE_EVENT("error provoked by SAT");
1725 break;
1726
1727 default:
1728 if ( (sat_mnsms_submit_req->rec_num EQ SMS_RECORD_NOT_EXIST) OR
1729 (sat_mnsms_submit_req->modify NEQ SMS_MODIFY_NON) )
1730 {
1731 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
1732 {
1733 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
1734 smsShrdPrm.tpdu.tp_submit = NULL;
1735 }
1736 }
1737 TRACE_EVENT("wrong type of result received from SIM");
1738 PFREE( sat_mnsms_submit_req );
1739 return( FALSE ); /* primitive not needed anymore */
1740 }
1741
1742 return FALSE;
1743 }
1744
1745 /*
1746 +-------------------------------------------------------------------+
1747 | PROJECT : GSM-PS (6147) MODULE : CMH |
1748 | ROUTINE : cmhCC_SatDTMFsent |
1749 +-------------------------------------------------------------------+
1750
1751 PURPOSE : confirmation for sent SAT DTMF
1752 */
1753 GLOBAL void cmhCC_SatDTMFsent ( SHORT cId )
1754 {
1755 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1756 T_ACI_SAT_TERM_RESP resp_data;
1757 static UBYTE dtmf_separator_count = 0;
1758
1759 TRACE_FUNCTION ("cmhCC_SatDTMFsent()");
1760
1761 psaSAT_InitTrmResp( &resp_data );
1762
1763 /*
1764 * Use ctb here because TI compiler 1.22e may have a problem otherwise here.
1765 * See cmhCC_SndDiscRsn() for the details.
1766 */
1767 if (GET_CAUSE_VALUE(ctb->nrmCs) NEQ NOT_PRESENT_8BIT AND
1768 ctb->nrmCs NEQ MNCC_CAUSE_DTMF_START_SUCCESS)
1769 {
1770 TRACE_EVENT_P1("network reported error when sending DTMF: %d", ctb->nrmCs);
1771
1772 psaSAT_SendTrmResp( RSLT_NTW_UNAB_PROC, &resp_data );
1773 dtmf_separator_count = 0;
1774 return;
1775 }
1776
1777 if(is_digit_dtmf_separator(ccShrdPrm.dtmf.dig[ccShrdPrm.dtmf.cur]))
1778 {
1779 if (dtmf_separator_count EQ 0)
1780 {
1781 dtmf_separator_count = 1;
1782 if(ctb->dtmfCmd NEQ AT_CMD_VTS) /* this is only valid within a number to dial */
1783 {
1784 /* p within a number string: this is a 3 seconds pause */
1785 TRACE_EVENT("DTMF pause requested: 3 seconds");
1786 #if defined (NEW_FRAME)
1787 TIMERSTART( TDTMF_VALUE, ACI_TDTMF );
1788 #else
1789 TIMERSTART( TDTMF_VALUE, t_dtmf_handle );
1790 #endif
1791 ccShrdPrm.dtmf.cur++; /* skip the DTMF seperator */
1792
1793 return;
1794 }
1795 ccShrdPrm.dtmf.cur++; /* skip the DTMF seperator */
1796 }
1797 }
1798 else
1799 {
1800 dtmf_separator_count = 0;
1801 }
1802
1803 if (ccShrdPrm.dtmf.cur < ccShrdPrm.dtmf.cnt)
1804 {
1805 cmhSAT_sendDTMF ( NULL );
1806 }
1807 else /* whole DTMF string has been sent */
1808 {
1809 ccShrdPrm.dtmf.cId = NO_ENTRY; /* Reset cId after sending the whole DTMF string */
1810 ctb->dtmfCmd = AT_CMD_NONE;
1811 ctb->dtmfSrc = (T_OWN)CMD_SRC_NONE;
1812 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data );
1813 dtmf_separator_count = 0;
1814 }
1815 }
1816
1817 /* Implements Measure # 57,77 */
1818
1819 /*
1820 +-------------------------------------------------------------------+
1821 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
1822 | ROUTINE : cmhSAT_ResCntrlBySIM |
1823 +-------------------------------------------------------------------+
1824 PARAMETERS : cmdBuf - AT Command identifier
1825 simRslt - Result of SIM operation
1826 resp_data - Data for terminal response
1827 RETURN : None
1828
1829
1830 PURPOSE : Handle common portion of sending reponse to SIM call or
1831 USSD control result depending on the owner of call setup.
1832
1833 */
1834 LOCAL void cmhSAT_ResCntrlBySIM (T_ACI_AT_CMD cmdBuf,
1835 UBYTE simRslt,
1836 T_ACI_SAT_TERM_RESP *resp_data)
1837 {
1838 BOOL ownNotSAT = (satShrdPrm.SIMCCParm.owner NEQ OWN_SRC_SAT);
1839
1840 TRACE_FUNCTION ("cmhSAT_ResCntrlBySIM ()");
1841 if( ownNotSAT )
1842 {
1843 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
1844 ( cmdBuf, CME_ERR_NotPresent );
1845 /* log result */
1846 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner, RAT_CME,
1847 (T_ACI_AT_CMD)cmdBuf,-1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
1848 }
1849 /* setup initiated by SAT */
1850 else
1851 {
1852 /* resp_data will be filled in caller */
1853 psaSAT_SendTrmResp( simRslt, resp_data );
1854 }
1855 }
1856
1857 /* Implements Measure # 174 */
1858
1859 /*
1860 +-------------------------------------------------------------------+
1861 | PROJECT : GSM-PS (6147) MODULE : CMH_SATR |
1862 | ROUTINE : cmhSAT_SIMCntrlAlertUser |
1863 +-------------------------------------------------------------------+
1864 PARAMETERS : ownNotSAT - Boolean flag indicating that the owner is not SAT
1865 cId - Holds setup call id
1866 addPrm - additional information for SAT E
1867 RETURN : None
1868
1869 PURPOSE : Handle common portion of Alerting User.
1870
1871 */
1872 LOCAL void cmhSAT_SIMCntrlAlertUser (BOOL ownNotSAT,
1873 SHORT cId
1874 #ifdef FF_SAT_E
1875 ,T_ACI_SATA_ADD *addPrm
1876 #endif
1877 )
1878 {
1879 UBYTE idx;
1880
1881 TRACE_FUNCTION ("cmhSAT_SIMCntrlAlertUser ()");
1882
1883 if( ownNotSAT )
1884 {
1885 #ifdef FF_SAT_E
1886 addPrm->chnType = SATA_CT_VOICE;
1887 addPrm->chnEst = SATA_EST_IM;
1888
1889 R_AT( RAT_SATA,(T_ACI_CMD_SRC) satShrdPrm.SIMCCParm.owner )
1890 ( cId+1, satShrdPrm.dur, &addPrm );
1891 #else
1892 R_AT( RAT_SATA, (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
1893 ( cId+1, satShrdPrm.dur);
1894 #endif /* FF_SAT_E */
1895
1896 R_AT( RAT_OK, (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner )
1897 ( AT_CMD_D );
1898 /* log result */
1899 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.SIMCCParm.owner,
1900 RAT_OK, AT_CMD_D, -1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
1901 }
1902 /* setup initiated by SAT */
1903 else
1904 {
1905 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
1906 {
1907 #ifdef FF_SAT_E
1908 addPrm->chnType = SATA_CT_VOICE;
1909 addPrm->chnEst = SATA_EST_IM;
1910 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )
1911 ( cId+1, satShrdPrm.dur, &addPrm );
1912 #else
1913 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )
1914 ( cId+1, satShrdPrm.dur);
1915 #endif /* FF_SAT_E */
1916 }
1917 }
1918 }
1919
1920 #endif /* #ifdef SIM_TOOLKIT */
1921 /*==== EOF ========================================================*/