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