FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/psa_satf.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 : PSA_SATF | |
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 for the protocol | |
18 | stack adapter for the SIM application toolkit. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifdef SIM_TOOLKIT | |
23 | |
24 #ifndef PSA_SATF_C | |
25 #define PSA_SATF_C | |
26 #endif | |
27 | |
28 #include "aci_all.h" | |
29 | |
30 /*==== INCLUDES ===================================================*/ | |
31 #include "aci_cmh.h" | |
32 #include "aci_mem.h" | |
33 | |
34 #ifdef GPRS | |
35 #include "gaci_cmh.h" | |
36 #endif | |
37 | |
38 #ifdef FAX_AND_DATA | |
39 #include "aci_fd.h" | |
40 #endif /* of #ifdef FAX_AND_DATA */ | |
41 | |
42 | |
43 #include "aci.h" | |
44 #include "psa.h" | |
45 #include "psa_cc.h" | |
46 #include "psa_sat.h" | |
47 #include "psa_util.h" | |
48 #include "cmh.h" | |
49 #include "cmh_sat.h" | |
50 | |
51 #include "psa_mm.h" | |
52 #include "psa_ss.h" | |
53 #include "psa_sim.h" | |
54 #include "cmh_cc.h" | |
55 | |
56 #include "ksd.h" | |
57 | |
58 /*==== CONSTANTS ==================================================*/ | |
59 | |
60 #define ITM_WDT (14) /* item width in chars */ | |
61 #define HDR_WDT (10) /* header width in chars */ | |
62 | |
63 /*==== TYPES ======================================================*/ | |
64 | |
65 | |
66 /*==== EXPORT =====================================================*/ | |
67 | |
68 | |
69 /*==== VARIABLES ==================================================*/ | |
70 LOCAL UBYTE ssResPrms[MAXIMUM( sizeof(BUF_res_params_sat), | |
71 MAXIMUM(sizeof(BUF_rej_params_sat), | |
72 sizeof(BUF_err_params_sat)))]; | |
73 | |
74 /*==== FUNCTIONS ==================================================*/ | |
75 | |
76 LOCAL void psaSAT_getTonNpi(CHAR *inSeq, BOOL call_active, | |
77 UBYTE *ton, UBYTE *npi); | |
78 | |
79 | |
80 | |
81 /* | |
82 +-------------------------------------------------------------------+ | |
83 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
84 | ROUTINE : psaSAT_BuildEnvCC | | |
85 +-------------------------------------------------------------------+ | |
86 | |
87 PURPOSE : Build envelope call control command. | |
88 | |
89 */ | |
90 | |
91 GLOBAL void psaSAT_BuildEnvCC ( SHORT cId, | |
92 T_CLPTY_PRM *ss_cldPty, | |
93 T_sat_ussd *ussd, | |
94 T_MNCC_bcconf *ccp1, | |
95 T_MNCC_bcconf *ccp2) | |
96 { | |
97 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId]; | |
98 UBYTE ton; | |
99 UBYTE npi; | |
100 | |
101 /* | |
102 *------------------------------------------------------------------- | |
103 * build envelope call control command | |
104 *------------------------------------------------------------------- | |
105 */ | |
106 { | |
107 MCAST( env, ENV_CMD ); | |
108 | |
109 memset( env, 0, sizeof( T_ENV_CMD )); | |
110 | |
111 env->v_cc_cmd = TRUE; | |
112 | |
113 /* device identities */ | |
114 env->cc_cmd.v_dev_ids = TRUE; | |
115 env->cc_cmd.dev_ids.src_dev = DEV_SRC_ME; | |
116 env->cc_cmd.dev_ids.dest_dev = DEV_DST_SIM; | |
117 | |
118 if( cId NEQ NO_ENTRY ) | |
119 { | |
120 /* address */ | |
121 env->cc_cmd.v_addr = TRUE; | |
122 | |
123 if( (pCtbNtry->SATinv & SAT_REDIAL_ECCBE) AND | |
124 (rdlPrm.rdlState) ) | |
125 { | |
126 memcpy(&env->cc_cmd.addr, &satRdlCCEnv.addr, sizeof(T_addr)); | |
127 } | |
128 else | |
129 { | |
130 /* address */ | |
131 env->cc_cmd.addr.v_noa = TRUE; | |
132 env->cc_cmd.addr.noa = pCtbNtry->cldPty.ton; | |
133 | |
134 env->cc_cmd.addr.v_npi = TRUE; | |
135 env->cc_cmd.addr.npi = pCtbNtry->cldPty.npi; | |
136 | |
137 env->cc_cmd.addr.c_bcdDigit = pCtbNtry->cldPty.c_called_num; | |
138 memcpy( env->cc_cmd.addr.bcdDigit, | |
139 pCtbNtry->cldPty.called_num, | |
140 pCtbNtry->cldPty.c_called_num ); | |
141 } | |
142 | |
143 #ifdef SIM_TOOLKIT | |
144 if ( !rdlPrm.rdlState ) | |
145 { | |
146 memcpy(&satRdlCCEnv.addr, &env->cc_cmd.addr, sizeof(T_addr)); | |
147 } | |
148 #endif | |
149 | |
150 | |
151 /* capability configuration parameters 1*/ | |
152 if( ccp1 ) | |
153 { | |
154 env->cc_cmd.v_cap_cnf_parms = TRUE; | |
155 env->cc_cmd.cap_cnf_parms.l_cap_cnf_parms = ccp1->bc_len<<3; | |
156 | |
157 memcpy( env->cc_cmd.cap_cnf_parms.b_cap_cnf_parms, ccp1->bc, | |
158 ccp1->bc_len ); | |
159 } | |
160 | |
161 /* capability configuration parameters 2*/ | |
162 if( ccp2 ) | |
163 { | |
164 env->cc_cmd.v_cap_cnf_parms_2 = TRUE; | |
165 env->cc_cmd.cap_cnf_parms_2.l_cap_cnf_parms_2 = ccp2->bc_len<<3; | |
166 | |
167 memcpy( env->cc_cmd.cap_cnf_parms_2.b_cap_cnf_parms_2, ccp2->bc, | |
168 ccp2->bc_len ); | |
169 } | |
170 | |
171 /* If ccp is present in the setUpCall */ | |
172 if ((satShrdPrm.capParm.cntxt EQ CTX_SAT_SETUP) AND satShrdPrm.stk_ccp.l_cap_cnf_parms ) | |
173 { | |
174 env->cc_cmd.v_cap_cnf_parms = TRUE; | |
175 /* Storing the ccp if ECCBE is enabled */ | |
176 if( (ccShrdPrm.ctb[cId]->SATinv & SAT_REDIAL_ECCBE) AND | |
177 (rdlPrm.rdlState) ) | |
178 { | |
179 memcpy(&env->cc_cmd.cap_cnf_parms, &satRdlCCEnv.ccp, sizeof(BUF_cap_cnf_parms)); | |
180 } | |
181 else | |
182 { | |
183 env->cc_cmd.cap_cnf_parms.l_cap_cnf_parms = satShrdPrm.stk_ccp.l_cap_cnf_parms; | |
184 memcpy( env->cc_cmd.cap_cnf_parms.b_cap_cnf_parms, &satShrdPrm.stk_ccp.b_cap_cnf_parms, | |
185 satShrdPrm.stk_ccp.l_cap_cnf_parms ); | |
186 } | |
187 #ifdef SIM_TOOLKIT | |
188 if ( !rdlPrm.rdlState ) | |
189 { | |
190 memcpy( &satRdlCCEnv.ccp, &env->cc_cmd.cap_cnf_parms, sizeof(BUF_cap_cnf_parms)); | |
191 } | |
192 #endif | |
193 } | |
194 | |
195 /* subaddress */ | |
196 if( pCtbNtry->cldPtySub.c_subaddr ) | |
197 { | |
198 env->cc_cmd.v_subaddr = TRUE; | |
199 | |
200 if( (pCtbNtry->SATinv & SAT_REDIAL_ECCBE) AND | |
201 (rdlPrm.rdlState) ) | |
202 { | |
203 memcpy( &env->cc_cmd.subaddr, &satRdlCCEnv.sub_addr, sizeof(T_subaddr) ); | |
204 } | |
205 else | |
206 { | |
207 | |
208 env->cc_cmd.subaddr.v_tos = TRUE; | |
209 env->cc_cmd.subaddr.tos = pCtbNtry->cldPtySub.tos; | |
210 | |
211 env->cc_cmd.subaddr.v_oei = TRUE; | |
212 env->cc_cmd.subaddr.oei = pCtbNtry->cldPtySub.odd_even; | |
213 | |
214 env->cc_cmd.subaddr.c_subadr_str = pCtbNtry->cldPtySub.c_subaddr; | |
215 memcpy( env->cc_cmd.subaddr.subadr_str, pCtbNtry->cldPtySub.subaddr, | |
216 pCtbNtry->cldPtySub.c_subaddr ); | |
217 } | |
218 | |
219 #ifdef SIM_TOOLKIT | |
220 if ( !rdlPrm.rdlState ) | |
221 { | |
222 memcpy( &satRdlCCEnv.sub_addr, &env->cc_cmd.subaddr, sizeof(T_subaddr)); | |
223 } | |
224 #endif | |
225 | |
226 } | |
227 } | |
228 | |
229 else if( ss_cldPty NEQ NULL ) | |
230 { | |
231 /* SS string */ | |
232 env->cc_cmd.v_ss_string = TRUE; | |
233 | |
234 psaSAT_getTonNpi(ss_cldPty->num, FALSE, &ton, &npi); | |
235 | |
236 env->cc_cmd.ss_string.v_noa = TRUE; | |
237 env->cc_cmd.ss_string.noa = ton; | |
238 env->cc_cmd.ss_string.v_npi = TRUE; | |
239 env->cc_cmd.ss_string.npi = npi; | |
240 | |
241 env->cc_cmd.ss_string.c_ss_ctrl_string = | |
242 (UBYTE)utl_dialStr2BCD (ss_cldPty->num, /*ssStr,*/ | |
243 env->cc_cmd.ss_string.ss_ctrl_string, | |
244 MAX_SS_STRING_LEN); | |
245 } | |
246 | |
247 else if( ussd NEQ NULL ) | |
248 { | |
249 /* USSD string */ | |
250 env->cc_cmd.v_ussd_string = TRUE; | |
251 | |
252 env->cc_cmd.ussd_string.dcs = ussd->dcs; | |
253 env->cc_cmd.ussd_string.c_ussd_str = MINIMUM (ussd->c_ussd_str, MAX_SAT_USSD_LEN); | |
254 | |
255 memcpy( env->cc_cmd.ussd_string.ussd_str, | |
256 ussd->ussd_str, | |
257 env->cc_cmd.ussd_string.c_ussd_str); | |
258 } | |
259 | |
260 /* location information */ | |
261 | |
262 /* code MCC */ | |
263 env->cc_cmd.cc_smc_loc_info.mnc_mcc |= ((mmShrdPrm.usedPLMN.mcc[1]<<4) + mmShrdPrm.usedPLMN.mcc[0]) <<16; | |
264 env->cc_cmd.cc_smc_loc_info.mnc_mcc |= ((mmShrdPrm.usedPLMN.mnc[2]<<4) + mmShrdPrm.usedPLMN.mcc[2]) << 8; | |
265 | |
266 /* code MNC */ | |
267 env->cc_cmd.cc_smc_loc_info.mnc_mcc |= (mmShrdPrm.usedPLMN.mnc[1]<<4)+mmShrdPrm.usedPLMN.mnc[0]; | |
268 | |
269 /* code LAC */ | |
270 env->cc_cmd.cc_smc_loc_info.lac = mmShrdPrm.lac; | |
271 | |
272 /* code CID */ | |
273 env->cc_cmd.cc_smc_loc_info.cid = mmShrdPrm.cid; | |
274 | |
275 env->cc_cmd.v_cc_smc_loc_info = TRUE; | |
276 } | |
277 } | |
278 | |
279 | |
280 /* | |
281 +--------------------------------------------------------------------+ | |
282 | PROJECT : GSM-PS (6147) MODULE : psa_sat | | |
283 | STATE : code ROUTINE : psaSAT_getTonNpi | | |
284 +--------------------------------------------------------------------+ | |
285 | |
286 PURPOSE : Get TON and NPI. The SS string in inSeq will be | |
287 decoded to check if it contains a phone number. If | |
288 SS String contains a number, its TON and NPI will be | |
289 returned. Otherwise TON and NPI will be set to FF as | |
290 required in GSM 11.14/GSM 11.11. | |
291 */ | |
292 LOCAL void psaSAT_getTonNpi(CHAR *inSeq, BOOL call_active, | |
293 UBYTE *ton, UBYTE *npi) | |
294 { | |
295 T_KSD_SEQGRP grp; | |
296 CHAR *rest; | |
297 T_KSD_SEQPARAM para; | |
298 CHAR seq[MAX_DIAL_LEN]; | |
299 | |
300 *ton = MNCC_TON_NOT_PRES; | |
301 *npi = MNCC_NPI_NOT_PRES; | |
302 | |
303 strcpy(seq, inSeq); | |
304 | |
305 /* decode sequence */ | |
306 ksd_decode(seq, call_active, &grp, &rest, ¶); | |
307 | |
308 /* analyse TON and NPI */ | |
309 switch( grp ) | |
310 { | |
311 case SEQGRP_CF: | |
312 | |
313 if ( (para.cf.num NEQ NULL) AND (para.cf.num[0] NEQ 0) ) | |
314 { | |
315 *ton = para.cf.ton; | |
316 *npi = para.cf.npi; | |
317 } | |
318 break; | |
319 | |
320 case SEQGRP_DIAL: | |
321 | |
322 if ( ( para.dial.number NEQ NULL ) AND | |
323 ( para.dial.number[0] EQ 0 ) ) | |
324 { | |
325 if ( para.dial.number[0] EQ '+' ) | |
326 { | |
327 *ton = TON_International; | |
328 } | |
329 else | |
330 { | |
331 *ton = TON_Unknown; | |
332 } | |
333 *npi = NPI_IsdnTelephony; | |
334 } | |
335 | |
336 break; | |
337 | |
338 #ifdef SMI | |
339 case SEQGRP_SET_ABBR_DIAL: | |
340 | |
341 if ( (para.abbrDial.number NEQ NULL) AND | |
342 ( para.abbrDial.number[0] EQ 0 ) ) | |
343 { | |
344 if ( para.abbrDial.number[0] EQ '+' ) | |
345 { | |
346 *ton = TON_International; | |
347 } | |
348 else | |
349 { | |
350 *ton = TON_Unknown; | |
351 } | |
352 *npi = NPI_IsdnTelephony; | |
353 } | |
354 break; | |
355 #endif /* SMI */ | |
356 | |
357 default: | |
358 /* Sequence group does not contain number. TON and NPI still set to FF */ | |
359 break; | |
360 } | |
361 } | |
362 | |
363 /* | |
364 +-------------------------------------------------------------------+ | |
365 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
366 | ROUTINE : psaSAT_BuildEnvCB | | |
367 +-------------------------------------------------------------------+ | |
368 | |
369 PURPOSE : Build envelope cell broadcast data download command. | |
370 | |
371 */ | |
372 | |
373 GLOBAL void psaSAT_BuildEnvCB ( UBYTE *cbMsg, SHORT cbLen ) | |
374 { | |
375 | |
376 /* | |
377 *------------------------------------------------------------------- | |
378 * build envelope cell broadcast data download command | |
379 *------------------------------------------------------------------- | |
380 */ | |
381 { | |
382 MCAST( env, ENV_CMD ); | |
383 | |
384 memset( env, 0, sizeof( T_ENV_CMD )); | |
385 | |
386 env->v_cbd_cmd = TRUE; | |
387 | |
388 /* device identities */ | |
389 env->cbd_cmd.v_dev_ids = TRUE; | |
390 env->cbd_cmd.dev_ids.src_dev = DEV_SRC_NTW; | |
391 env->cbd_cmd.dev_ids.dest_dev = DEV_DST_SIM; | |
392 | |
393 /* CB message */ | |
394 env->cbd_cmd.v_cb_page = TRUE; | |
395 env->cbd_cmd.cb_page.l_cb_page = cbLen<<3; | |
396 env->cbd_cmd.cb_page.o_cb_page = 0; | |
397 | |
398 memcpy( env->cbd_cmd.cb_page.b_cb_page, cbMsg, cbLen ); | |
399 } | |
400 } | |
401 | |
402 /* | |
403 +-------------------------------------------------------------------+ | |
404 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
405 | ROUTINE : psaSAT_BuildEnvMoSmCntr | | |
406 +-------------------------------------------------------------------+ | |
407 | |
408 PURPOSE : Build envelope cell broadcast data download command. | |
409 | |
410 */ | |
411 | |
412 GLOBAL void psaSAT_BuildEnvMoSmCntr ( T_rp_addr sc_addr, | |
413 T_tp_da dest_addr ) | |
414 { | |
415 | |
416 /* | |
417 *------------------------------------------------------------------- | |
418 * build envelope | |
419 *------------------------------------------------------------------- | |
420 */ | |
421 { | |
422 MCAST( env, ENV_CMD ); | |
423 | |
424 memset( env, 0, sizeof( T_ENV_CMD )); | |
425 | |
426 env->v_smc_cmd = TRUE; | |
427 | |
428 /* device identities */ | |
429 env->smc_cmd.v_dev_ids = TRUE; | |
430 env->smc_cmd.dev_ids.src_dev = DEV_DST_ME; | |
431 env->smc_cmd.dev_ids.dest_dev = DEV_DST_SIM; | |
432 | |
433 /* short message address */ | |
434 env->smc_cmd.v_sm_addr = TRUE; | |
435 | |
436 env->smc_cmd.sm_addr.v_noa = TRUE; | |
437 env->smc_cmd.sm_addr.noa = sc_addr.ton; | |
438 | |
439 env->smc_cmd.sm_addr.v_npi = TRUE; | |
440 env->smc_cmd.sm_addr.npi = sc_addr.npi; | |
441 | |
442 env->smc_cmd.sm_addr.c_bcdDigit = sc_addr.c_num; | |
443 memcpy(&(env->smc_cmd.sm_addr.bcdDigit[0]), | |
444 &(sc_addr.num[0]), | |
445 sc_addr.c_num /*MAX_SMS_DIGIT_LEN*/); | |
446 | |
447 /* address 2 */ | |
448 env->smc_cmd.v_sm_addr_2 = TRUE; | |
449 | |
450 env->smc_cmd.sm_addr_2.v_noa = TRUE; | |
451 env->smc_cmd.sm_addr_2.noa = dest_addr.ton; | |
452 | |
453 env->smc_cmd.sm_addr_2.v_npi = TRUE; | |
454 env->smc_cmd.sm_addr_2.npi = dest_addr.npi; | |
455 | |
456 env->smc_cmd.sm_addr_2.c_bcdDigit = dest_addr.c_num; | |
457 memcpy(&(env->smc_cmd.sm_addr_2.bcdDigit[0]), | |
458 &(dest_addr.num[0]), | |
459 dest_addr.c_num /*MAX_SMS_DIGIT_LEN*/); | |
460 | |
461 /* location information */ | |
462 | |
463 /* code MCC */ | |
464 env->smc_cmd.cc_smc_loc_info.mnc_mcc |= ((mmShrdPrm.usedPLMN.mcc[1]<<4) + mmShrdPrm.usedPLMN.mcc[0]) <<16; | |
465 env->smc_cmd.cc_smc_loc_info.mnc_mcc |= ((mmShrdPrm.usedPLMN.mnc[2]<<4) + mmShrdPrm.usedPLMN.mcc[2]) << 8; | |
466 | |
467 /* code MNC */ | |
468 env->smc_cmd.cc_smc_loc_info.mnc_mcc |= (mmShrdPrm.usedPLMN.mnc[1]<<4)+mmShrdPrm.usedPLMN.mnc[0]; | |
469 | |
470 /* code LAC */ | |
471 env->smc_cmd.cc_smc_loc_info.lac = mmShrdPrm.lac; | |
472 | |
473 /* code CID */ | |
474 env->smc_cmd.cc_smc_loc_info.cid = mmShrdPrm.cid; | |
475 | |
476 env->smc_cmd.v_cc_smc_loc_info = TRUE; | |
477 | |
478 } | |
479 } | |
480 | |
481 | |
482 | |
483 /* | |
484 +-------------------------------------------------------------------+ | |
485 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
486 | ROUTINE : psaSAT_BuildEnvEventDwn | | |
487 +-------------------------------------------------------------------+ | |
488 | |
489 PURPOSE : Build envelope event download command. | |
490 | |
491 */ | |
492 | |
493 GLOBAL BOOL psaSAT_BuildEnvEventDwn ( UBYTE event, SHORT callId, T_CC_INITIATER actionSrc ) | |
494 { | |
495 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
496 BOOL MT_flag; | |
497 UBYTE trans_id = 0xFF; | |
498 UBYTE ti_flag = 0xFF; /* lint: initialization warning */ | |
499 | |
500 TRACE_FUNCTION("psaSAT_BuildEnvEventDwn()"); | |
501 | |
502 pCtbNtry = ccShrdPrm.ctb[callId]; | |
503 | |
504 /* | |
505 *------------------------------------------------------------------- | |
506 * build envelope | |
507 *------------------------------------------------------------------- | |
508 */ | |
509 { | |
510 MCAST( env, ENV_CMD ); | |
511 | |
512 memset( env, 0, sizeof( T_ENV_CMD )); | |
513 | |
514 env->v_evd_cmd = TRUE; | |
515 | |
516 /* event */ | |
517 env->evd_cmd.v_ev_list = TRUE; | |
518 env->evd_cmd.ev_list.c_event = 1; | |
519 env->evd_cmd.ev_list.event[0] = event; | |
520 | |
521 /* device identities */ | |
522 env->evd_cmd.v_dev_ids = TRUE; | |
523 env->evd_cmd.dev_ids.dest_dev = DEV_DST_SIM; | |
524 switch( actionSrc ) | |
525 { | |
526 case( NEAR_END ): | |
527 env->evd_cmd.dev_ids.src_dev = DEV_SRC_ME; | |
528 break; | |
529 | |
530 case( FAR_END ): | |
531 env->evd_cmd.dev_ids.src_dev = DEV_SRC_NTW; | |
532 break; | |
533 | |
534 default: | |
535 env->evd_cmd.v_dev_ids = FALSE; | |
536 } | |
537 | |
538 if ( event EQ EVENT_MT_CALL OR | |
539 event EQ EVENT_CALL_CONN OR | |
540 event EQ EVENT_CALL_DISC ) | |
541 { | |
542 /* process ti identifier */ | |
543 env->evd_cmd.v_ti_list = TRUE; | |
544 env->evd_cmd.ti_list.c_ti_oct = 1; | |
545 | |
546 MT_flag = pCtbNtry -> ti & 0x08; /* TRUE if MS terminated transaction */ | |
547 trans_id = ( pCtbNtry -> ti) & 0x07; /* see GSM 04.07 ?1.2.3.1.3 */ | |
548 } | |
549 | |
550 switch( event ) | |
551 { | |
552 case( EVENT_MT_CALL ): | |
553 | |
554 /* ti identifier */ | |
555 /* MNCC_SETUP_IND means message sent from the side that originated the TI */ | |
556 env->evd_cmd.ti_list.ti_oct[0].ti = /*lint -e(644) */ trans_id; | |
557 | |
558 /* address */ | |
559 if (pCtbNtry->clgPty.c_num NEQ 0) | |
560 { | |
561 env->evd_cmd.v_addr = TRUE; | |
562 | |
563 env->evd_cmd.addr.v_noa = TRUE; | |
564 env->evd_cmd.addr.noa = pCtbNtry->clgPty.ton; | |
565 | |
566 env->evd_cmd.addr.v_npi = TRUE; | |
567 env->evd_cmd.addr.npi = pCtbNtry->clgPty.npi; | |
568 | |
569 env->evd_cmd.addr.c_bcdDigit = pCtbNtry->clgPty.c_num; | |
570 memcpy(&(env->evd_cmd.addr.bcdDigit[0]), | |
571 &(pCtbNtry->clgPty.num[0]), | |
572 pCtbNtry->clgPty.c_num); | |
573 } | |
574 | |
575 /* called party subaddress */ | |
576 if (pCtbNtry->clgPtySub.c_subaddr NEQ 0) | |
577 { | |
578 env->evd_cmd.v_subaddr = TRUE; | |
579 | |
580 env->evd_cmd.subaddr.v_tos = TRUE; | |
581 env->evd_cmd.subaddr.tos = pCtbNtry -> clgPtySub.tos; | |
582 | |
583 env->evd_cmd.subaddr.v_oei = TRUE; | |
584 env->evd_cmd.subaddr.oei = pCtbNtry -> clgPtySub.odd_even; | |
585 | |
586 env->evd_cmd.subaddr.c_subadr_str = pCtbNtry->clgPtySub.c_subaddr; | |
587 memcpy(&(env->evd_cmd.subaddr.subadr_str[0]), | |
588 &(pCtbNtry->clgPtySub.subaddr[0]), | |
589 pCtbNtry->clgPtySub.c_subaddr); | |
590 } | |
591 break; | |
592 | |
593 | |
594 case( EVENT_CALL_CONN ): | |
595 /* ti identifier */ | |
596 /* MNCC_SETUP_CNF context with MO Call | |
597 or: MNCC_SETUP_RES context with MT Call | |
598 means: message sent to the side that originates the TI */ | |
599 ti_flag = 0x08; | |
600 env->evd_cmd.ti_list.ti_oct[0].ti = trans_id | ti_flag; | |
601 break; | |
602 | |
603 | |
604 case( EVENT_CALL_DISC ): | |
605 /* ti identifier */ | |
606 /* | |
607 means: message sent to the side that originates the TI */ | |
608 switch (actionSrc) | |
609 { | |
610 case( NEAR_END ): | |
611 /* MNCC_REJ_IND / MNCC_DISC_REQ / MNCC_REL_REQ */ | |
612 if ( /*lint -e(644) */ MT_flag ) | |
613 ti_flag = 0x08; | |
614 else | |
615 ti_flag = 0x00; | |
616 break; | |
617 | |
618 case( FAR_END ): | |
619 /* MNCC_DISC_IND / MNCC_REL_IND / MNCC_REL_REQ */ | |
620 if ( MT_flag ) | |
621 ti_flag = 0x00; | |
622 else | |
623 ti_flag = 0x08; | |
624 break; | |
625 } | |
626 env->evd_cmd.ti_list.ti_oct[0].ti = trans_id | ti_flag; | |
627 | |
628 /* Cause */ | |
629 env->evd_cmd.v_cause = TRUE; | |
630 if (pCtbNtry -> numRawCauseBytes EQ 0) | |
631 { | |
632 if (GET_CAUSE_VALUE(pCtbNtry -> rejCs) NEQ NOT_PRESENT_8BIT) /* radio-link failure */ | |
633 { | |
634 env->evd_cmd.cause.c_cs = 0; | |
635 } | |
636 else | |
637 { | |
638 if (GET_CAUSE_VALUE(pCtbNtry -> nrmCs) NEQ NOT_PRESENT_8BIT) | |
639 { | |
640 env->evd_cmd.cause.c_cs = 2; | |
641 | |
642 /*Location is user : 0 and coding standard defined for the GSM PLMNS : 3 */ | |
643 env->evd_cmd.cause.cs[0] =0xE0; | |
644 | |
645 env->evd_cmd.cause.cs[1] = GET_CAUSE_VALUE(pCtbNtry -> nrmCs) |0x80 ; | |
646 } | |
647 else | |
648 { | |
649 env->evd_cmd.v_cause = FALSE; | |
650 } | |
651 } | |
652 } | |
653 else | |
654 { | |
655 env->evd_cmd.cause.c_cs = pCtbNtry -> numRawCauseBytes; | |
656 memcpy( env->evd_cmd.cause.cs, | |
657 pCtbNtry -> rawCauseBytes, | |
658 pCtbNtry -> numRawCauseBytes ); | |
659 } | |
660 break; | |
661 | |
662 | |
663 case( EVENT_LOC_STATUS ): | |
664 env->evd_cmd.v_loc_state = TRUE; | |
665 | |
666 switch( satShrdPrm.locInfo.regStatus ) | |
667 { | |
668 case( NO_VLD_RS ): | |
669 env->evd_cmd.v_loc_state = FALSE; | |
670 break; | |
671 | |
672 case( RS_NO_SRV ): | |
673 env->evd_cmd.loc_state = 0x02; | |
674 break; | |
675 | |
676 case( RS_LMTD_SRV ): | |
677 env->evd_cmd.loc_state = 0x01; | |
678 break; | |
679 | |
680 case( RS_FULL_SRV ): | |
681 env->evd_cmd.loc_state = 0x00; | |
682 | |
683 /*--------------------------------------------------- | |
684 only in this case would location info be included | |
685 ----------------------------------------------------*/ | |
686 | |
687 /* location information */ | |
688 | |
689 /* code MCC */ | |
690 env->evd_cmd.cc_smc_loc_info.mnc_mcc |= | |
691 ((satShrdPrm.locInfo.currPLMN.mcc[1]<<4) + satShrdPrm.locInfo.currPLMN.mcc[0]) <<16; | |
692 env->evd_cmd.cc_smc_loc_info.mnc_mcc |= | |
693 ((satShrdPrm.locInfo.currPLMN.mnc[2]<<4) + satShrdPrm.locInfo.currPLMN.mcc[2]) << 8; | |
694 | |
695 /* code MNC */ | |
696 env->evd_cmd.cc_smc_loc_info.mnc_mcc |= | |
697 (satShrdPrm.locInfo.currPLMN.mnc[1]<<4)+satShrdPrm.locInfo.currPLMN.mnc[0]; | |
698 | |
699 /* code LAC */ | |
700 env->evd_cmd.cc_smc_loc_info.lac = satShrdPrm.locInfo.lac; | |
701 | |
702 /* code CID */ | |
703 env->evd_cmd.cc_smc_loc_info.cid = satShrdPrm.locInfo.cid; | |
704 | |
705 env->evd_cmd.v_cc_smc_loc_info = TRUE; | |
706 | |
707 break; | |
708 } | |
709 | |
710 break; | |
711 | |
712 #ifdef FF_SAT_E | |
713 case( EVENT_CHAN_STAT ): | |
714 env->evd_cmd.v_chan_stat = TRUE; | |
715 env->evd_cmd.chan_stat.chan_id = CHANNEL_ID_1; | |
716 env->evd_cmd.chan_stat.chan_stat_link = LINK_NO_ESTABL; | |
717 env->evd_cmd.chan_stat.chan_stat_inf2 = LINK_DROPPED; | |
718 break; | |
719 #endif /* FF_SAT_E */ | |
720 | |
721 default: | |
722 env->v_evd_cmd = FALSE; | |
723 TRACE_EVENT("wrong event id for SAT event download"); | |
724 break; | |
725 } | |
726 /* | |
727 *------------------------------------------------------------------- | |
728 * check if a call control request is already in progress | |
729 *------------------------------------------------------------------- | |
730 */ | |
731 if( satShrdPrm.SIMCCParm.busy EQ TRUE ) | |
732 { | |
733 /* event has to be queued */ | |
734 T_SAT_QUEUE *p_queue; | |
735 | |
736 if (satShrdPrm.event.c_queued >= MAX_EVENT_QUEUED - 1 ) | |
737 { | |
738 TRACE_EVENT("Too many events have been queued: failed to queue this new event"); | |
739 return FALSE; | |
740 } | |
741 | |
742 p_queue = &satShrdPrm.event.queued[satShrdPrm.event.c_queued - 1]; | |
743 p_queue->owner = (T_OWN)satShrdPrm.owner; | |
744 | |
745 if (p_queue->stk_cmd NEQ NULL) | |
746 { | |
747 MFREE (p_queue->stk_cmd); /* Should not happen */ | |
748 } | |
749 ACI_MALLOC (p_queue->stk_cmd, sizeof (T_stk_cmd)); | |
750 if (psaSAT_STKBuildCmd (p_queue->stk_cmd) < 0) | |
751 { | |
752 ACI_MFREE (p_queue->stk_cmd); | |
753 p_queue->stk_cmd = NULL; | |
754 TRACE_ERROR ("problem encoding SAT cmd"); | |
755 return FALSE; | |
756 } | |
757 satShrdPrm.event.c_queued++; | |
758 } | |
759 return TRUE; | |
760 } | |
761 } | |
762 | |
763 | |
764 | |
765 | |
766 /* | |
767 +-------------------------------------------------------------------+ | |
768 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
769 | ROUTINE : psaSAT_SendTrmResp | | |
770 +-------------------------------------------------------------------+ | |
771 | |
772 PURPOSE : Send a terminal response for a previous SAT command. | |
773 | |
774 */ | |
775 | |
776 GLOBAL void psaSAT_InitTrmResp ( T_ACI_SAT_TERM_RESP *init_resp ) | |
777 { | |
778 init_resp->addLen = 0; | |
779 init_resp->add = NULL; | |
780 init_resp->add_content = 0; | |
781 init_resp->resCC = NULL; | |
782 init_resp->text = NULL; | |
783 init_resp->at_resp = NULL; | |
784 init_resp->at_resp_count = 0; | |
785 #ifdef FF_SAT_E | |
786 init_resp->chnStat = FALSE; | |
787 init_resp->bearDesc = FALSE; | |
788 init_resp->bufSize = FALSE; | |
789 #endif /* FF_SAT_E */ | |
790 memset (init_resp->dtt_buf, 0xFF, TIME_STAMP_LENGTH); | |
791 memset (init_resp->lang, 0xFF, CLAN_CODE_LEN); | |
792 } | |
793 | |
794 LOCAL void sat_build_cc_action_resp(UBYTE rspId, | |
795 UBYTE addLen, | |
796 UBYTE *add, | |
797 UBYTE *resCC, | |
798 T_TERM_RESP *res) | |
799 { | |
800 UBYTE byteLen; /* holds byte length */ | |
801 UBYTE *p; /* byte pointer */ | |
802 | |
803 if( satShrdPrm.stkCnfPrim OR resCC ) | |
804 { | |
805 p = (resCC)? resCC : satShrdPrm.stkCnfPrim->stk_cmd.cmd; | |
806 | |
807 if( p[1] EQ 0x81 ) | |
808 { | |
809 byteLen = p[2]; | |
810 p = &p[3]; | |
811 } | |
812 else | |
813 { | |
814 byteLen = p[1]; | |
815 p = &p[2]; | |
816 } | |
817 | |
818 res->v_cc_req_act = TRUE; | |
819 res->cc_req_act.l_cc_req_act = byteLen<<3; | |
820 memcpy( res->cc_req_act.b_cc_req_act, p, byteLen ); | |
821 | |
822 /* result 2 */ | |
823 res->v_res_2 = TRUE; | |
824 res->res_2.gen = res->res.gen; | |
825 | |
826 /* adjust first result according to second result (GSM 11.14 / 9.1) */ | |
827 if( rspId <= 0x1F ) | |
828 | |
829 res->res.gen = RSLT_PERF_MDFY_SIM; | |
830 | |
831 else if( rspId >= 0x20 AND rspId <= 0x2F ) | |
832 | |
833 res->res.gen = RSLT_CC_SIM_TMP; | |
834 | |
835 else if( rspId >= 0x30 AND rspId <= 0x3F ) | |
836 { | |
837 res->res.gen = RSLT_CC_SIM_PRM; | |
838 res->res.v_add = TRUE; | |
839 res->res.add.l_add = 8; | |
840 res->res.add.b_add[0] = ADD_CC_REQ_CHNG; | |
841 } | |
842 if( addLen ) | |
843 { | |
844 if( res->res.gen NEQ RSLT_CC_SIM_PRM ) res->res.v_add = FALSE; | |
845 res->res_2.v_add = TRUE; | |
846 res->res_2.add.l_add = addLen<<3; | |
847 memcpy( res->res_2.add.b_add, | |
848 add, | |
849 addLen ); | |
850 } | |
851 | |
852 /* free the primitive */ | |
853 if( satShrdPrm.stkCnfPrim ) | |
854 { | |
855 PFREE( satShrdPrm.stkCnfPrim ); | |
856 satShrdPrm.stkCnfPrim = NULL; | |
857 } | |
858 } | |
859 } | |
860 | |
861 GLOBAL BOOL psaSAT_SendTrmResp ( UBYTE rspId, | |
862 T_ACI_SAT_TERM_RESP *data_for_term_resp) | |
863 { | |
864 TRACE_FUNCTION("psaSAT_SendTrmResp()"); | |
865 | |
866 /* | |
867 *------------------------------------------------------------------- | |
868 * build terminal response | |
869 *------------------------------------------------------------------- | |
870 */ | |
871 CCD_START; | |
872 { | |
873 MCAST( res, TERM_RESP ); | |
874 | |
875 memset( res, 0, sizeof( T_TERM_RESP )); | |
876 | |
877 /* init of data_for_term_resp */ | |
878 /* return network error cause GSM 11.14 / 12.12.3 (it's mandatory) */ | |
879 if( ( data_for_term_resp->add_content NEQ 0 ) OR | |
880 ( rspId EQ RSLT_NTW_UNAB_PROC ) ) | |
881 { | |
882 data_for_term_resp->add = &(data_for_term_resp->add_content); | |
883 data_for_term_resp->addLen = 1; | |
884 } | |
885 | |
886 /* device identities */ | |
887 res->v_cmd_details = TRUE; | |
888 res->cmd_details.cmd_nr = satShrdPrm.cmdDet.cmdNr; | |
889 res->cmd_details.cmd_typ = satShrdPrm.cmdDet.cmdType; | |
890 res->cmd_details.cmd_qlf = satShrdPrm.cmdDet.cmdQlf; | |
891 | |
892 /* device identities */ | |
893 res->v_dev_ids = TRUE; | |
894 res->dev_ids.src_dev = DEV_SRC_ME; | |
895 res->dev_ids.dest_dev = DEV_DST_SIM; | |
896 | |
897 /* result */ | |
898 res->v_res = TRUE; | |
899 res->res.gen = (rspId EQ RSLT_PERF_SUCCESS AND cmpFlg)? | |
900 RSLT_PERF_PART_CMPR:rspId; | |
901 if( data_for_term_resp->addLen ) | |
902 { | |
903 res->res.v_add = TRUE; | |
904 res->res.add.l_add = data_for_term_resp->addLen<<3; | |
905 memcpy( res->res.add.b_add, data_for_term_resp->add, data_for_term_resp->addLen ); | |
906 } | |
907 | |
908 /* call control requested action */ | |
909 sat_build_cc_action_resp( rspId, | |
910 data_for_term_resp->addLen, | |
911 data_for_term_resp->add, | |
912 data_for_term_resp->resCC, | |
913 res ); | |
914 | |
915 /* USSD related terminal response */ | |
916 if( data_for_term_resp->text NEQ NULL ) | |
917 { | |
918 res->v_text = TRUE; | |
919 res->text.dcs = data_for_term_resp->text->dcs; | |
920 res->text.c_text_str = data_for_term_resp->text->c_text_str; | |
921 memcpy( &(res->text.text_str), | |
922 data_for_term_resp->text->text_str, | |
923 data_for_term_resp->text->c_text_str); | |
924 } | |
925 | |
926 /* Run AT related terminal response */ | |
927 if( data_for_term_resp->at_resp NEQ NULL ) | |
928 { | |
929 res->v_at_resp = TRUE; | |
930 | |
931 memcpy( res->at_resp.text_str, | |
932 data_for_term_resp->at_resp, | |
933 data_for_term_resp->at_resp_count ); | |
934 | |
935 res->at_resp.c_text_str = (UBYTE)data_for_term_resp->at_resp_count; | |
936 } | |
937 | |
938 /* | |
939 Provide Local Information (date, time and time zone) | |
940 related terminal response | |
941 */ | |
942 if( data_for_term_resp->dtt_buf[0] NEQ 0xFF) | |
943 { | |
944 res->v_dtt = TRUE; | |
945 | |
946 memcpy( res->dtt.text_str, | |
947 data_for_term_resp->dtt_buf, | |
948 TIME_STAMP_LENGTH ); | |
949 | |
950 res->dtt.c_text_str = (UBYTE)TIME_STAMP_LENGTH; | |
951 } | |
952 | |
953 /* | |
954 Provide Local Information (Language Setting) | |
955 */ | |
956 | |
957 if( data_for_term_resp->lang[0] NEQ 0xFF) | |
958 { | |
959 res->v_lang = TRUE; | |
960 | |
961 memcpy( res->lang.lang_buf, | |
962 data_for_term_resp->lang, | |
963 CLAN_CODE_LEN ); | |
964 | |
965 res->lang.c_lang_buf = (UBYTE)CLAN_CODE_LEN; | |
966 } | |
967 | |
968 #ifdef FF_SAT_E | |
969 /* add channel status to terminal response */ | |
970 if( data_for_term_resp->chnStat NEQ FALSE ) | |
971 { | |
972 /* restricted to only one channel for class e */ | |
973 res->v_chan_stat = TRUE; | |
974 res->c_chan_stat = 1; | |
975 res->chan_stat[0].chan_id = CHANNEL_ID_1; | |
976 | |
977 res->chan_stat[0].chan_stat_inf2 = NO_FURTH_INFO; | |
978 res->chan_stat[0].chan_stat_link = LINK_NO_ESTABL; | |
979 | |
980 if( satShrdPrm.chnTb.chnUsdFlg ) | |
981 { | |
982 switch( satShrdPrm.chnTb.lnkStat ) | |
983 { | |
984 case( SIM_LINK_CNCT ): | |
985 | |
986 res->chan_stat[0].chan_stat_link = LINK_ESTABL; | |
987 break; | |
988 | |
989 case( SIM_LINK_DROP ): | |
990 | |
991 res->chan_stat[0].chan_stat_inf2 = LINK_DROPPED; | |
992 break; | |
993 | |
994 default: /* already handled by pre-setting */ | |
995 | |
996 break; | |
997 } | |
998 } | |
999 } | |
1000 /* add bearer description to terminal response */ | |
1001 if( data_for_term_resp->bearDesc NEQ FALSE AND satShrdPrm.opchPrm ) | |
1002 { | |
1003 if( satShrdPrm.opchType EQ B_CSD ) | |
1004 { | |
1005 res->v_bear_desc = TRUE; | |
1006 res->bear_desc.bear_type = BT_CSD; | |
1007 res->bear_desc.v_csd_bear_prm = TRUE; | |
1008 res->bear_desc.csd_bear_prm = ((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->csd_bear_prm; | |
1009 } | |
1010 if( satShrdPrm.opchType EQ B_GPRS ) | |
1011 { | |
1012 res->v_bear_desc = TRUE; | |
1013 res->bear_desc.bear_type = BT_GPRS; | |
1014 res->bear_desc.v_gprs_bear_prm = TRUE; | |
1015 res->bear_desc.gprs_bear_prm = ((T_SAT_GPRS_PRM*)satShrdPrm.opchPrm)->gprs_bear_prm; | |
1016 } | |
1017 } | |
1018 /* add buffer size to terminal response */ | |
1019 if( data_for_term_resp->bufSize NEQ FALSE ) | |
1020 { | |
1021 res->v_buffer_size = TRUE; | |
1022 res->buffer_size = satShrdPrm.buffer_size; | |
1023 } | |
1024 #endif /* FF_SAT_E */ | |
1025 | |
1026 cmpFlg = FALSE; | |
1027 } | |
1028 | |
1029 /* | |
1030 *------------------------------------------------------------------- | |
1031 * send terminal response | |
1032 *------------------------------------------------------------------- | |
1033 */ | |
1034 satShrdPrm.owner = OWN_SRC_INV; | |
1035 | |
1036 satShrdPrm.ownSAT = FALSE; | |
1037 memset( &satShrdPrm.stk_ccp, 0, sizeof(BUF_cap_cnf_parms)); | |
1038 | |
1039 | |
1040 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1041 if (satShrdPrm.cust1StkCmd != (void *)0) | |
1042 { | |
1043 ACI_MFREE(satShrdPrm.cust1StkCmd); /* Free the dynamically allocated Cust1 Stk Cmd memory */ | |
1044 | |
1045 satShrdPrm.cust1StkCmd = (void *)0; | |
1046 satShrdPrm.cust1StkCmdLen = 0; | |
1047 } | |
1048 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1049 | |
1050 if( psaSAT_STKResponse() < 0 ) /* STK command response */ | |
1051 { | |
1052 TRACE_EVENT( "FATAL RETURN SAT in send term resp" ); | |
1053 CCD_END; | |
1054 return( FALSE ); | |
1055 } | |
1056 | |
1057 CCD_END; | |
1058 return (TRUE); | |
1059 } | |
1060 | |
1061 /* | |
1062 +-------------------------------------------------------------------+ | |
1063 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1064 | ROUTINE : psaSAT_dasmMECmd | | |
1065 +-------------------------------------------------------------------+ | |
1066 | |
1067 PURPOSE : disassemble ME proactive SIM command. | |
1068 */ | |
1069 | |
1070 GLOBAL BOOL psaSAT_dasmMECmd ( BUF_cmd_prms *cmdPrm ) | |
1071 { | |
1072 UBYTE ccdRet, err; | |
1073 T_ACI_SAT_TERM_RESP resp_data; | |
1074 | |
1075 BOOL aciOnlyEvents; /* holds information whether only ACI events are in SET UP | |
1076 EVENT LIST */ | |
1077 BOOL sendRes; /* holds temporaly return result whether to send response | |
1078 or not */ | |
1079 | |
1080 /* response message in the case of SET UP EVENT LIST, only ACI events */ | |
1081 static UBYTE TRSetEventOk [12] = | |
1082 { | |
1083 0x81, /* command details tag */ | |
1084 0x03, /* command details length */ | |
1085 0x00, /* will be updated to current cmd num */ | |
1086 0x05, /* command SETUP EVENT LIST */ | |
1087 0x00, /* not used */ | |
1088 0x82, /* device details tag */ | |
1089 0x02, /* device details length */ | |
1090 0x82, /* source ME */ | |
1091 0x81, /* destination SIM */ | |
1092 0x83, /* result tag */ | |
1093 0x01, /* result length */ | |
1094 0x00 /* result OK */ | |
1095 }; | |
1096 | |
1097 TRACE_FUNCTION("psaSAT_dasmMECmd"); | |
1098 | |
1099 psaSAT_InitTrmResp( &resp_data ); | |
1100 | |
1101 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1102 if ((satShrdPrm.cmdDet.cmdType NEQ SAT_CMD_EVENT_LIST) AND /* ACI has to process the event before */ | |
1103 (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_NORMAL_BEHAVIOUR)) /* and NOT Cust1 behaviour */ | |
1104 #else | |
1105 if (satShrdPrm.cmdDet.cmdType NEQ SAT_CMD_EVENT_LIST) | |
1106 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1107 cmhSAT_STKUsrNtfy(); | |
1108 | |
1109 if( cmdPrm EQ NULL ) /* no parameter */ | |
1110 { | |
1111 memset(&satShrdPrm.stkCmdPrm, 0, | |
1112 sizeof(satShrdPrm.stkCmdPrm)); | |
1113 } | |
1114 else | |
1115 { | |
1116 memcpy( &satShrdPrm.stkCmdPrm, cmdPrm, | |
1117 sizeof(satShrdPrm.stkCmdPrm)); | |
1118 | |
1119 ccdRet = ccd_decodeMsg (CCDENT_SAT, | |
1120 DOWNLINK, | |
1121 (T_MSGBUF *) &satShrdPrm.stkCmdPrm, | |
1122 (UBYTE *) _decodedMsg, | |
1123 satShrdPrm.cmdDet.cmdType ); | |
1124 | |
1125 /* check for CCD error */ | |
1126 if( ccdRet NEQ ccdOK ) | |
1127 { | |
1128 TRACE_EVENT_P1( "CCD Decoding Error: %d", ccdRet ); | |
1129 | |
1130 err = psaSAT_ccdErrChk(); | |
1131 if( err NEQ 0 ) | |
1132 { | |
1133 psaSAT_SendTrmResp( err, &resp_data ); | |
1134 return( FALSE ); | |
1135 } | |
1136 } | |
1137 } | |
1138 | |
1139 /* continue processing */ | |
1140 switch( satShrdPrm.cmdDet.cmdType ) | |
1141 { | |
1142 case( SAT_CMD_SETUP_CALL ): | |
1143 { | |
1144 MCAST( calCmd, SETUP_CALL ); | |
1145 | |
1146 return( cmhSAT_setupCall( calCmd )); | |
1147 } | |
1148 | |
1149 case( SAT_CMD_SEND_SS ): | |
1150 { | |
1151 MCAST( ssCmd, SEND_SS ); | |
1152 | |
1153 return( cmhSAT_sendSS( ssCmd )); | |
1154 } | |
1155 | |
1156 case( SAT_CMD_SEND_USSD ): | |
1157 { | |
1158 MCAST( ussdCmd, SEND_USSD ); | |
1159 | |
1160 return( cmhSAT_sendUSSD( ussdCmd )); | |
1161 } | |
1162 | |
1163 case( SAT_CMD_SEND_SMS ): | |
1164 { | |
1165 MCAST( smCmd, SEND_SM ); | |
1166 | |
1167 return( cmhSAT_sendSM( smCmd )); | |
1168 } | |
1169 | |
1170 case( SAT_CMD_SEND_DTMF ): | |
1171 { | |
1172 MCAST( dtmfCmd, SEND_DTMF ); | |
1173 | |
1174 return( cmhSAT_sendDTMF( dtmfCmd )); | |
1175 } | |
1176 | |
1177 case( SAT_CMD_EVENT_LIST ): | |
1178 { | |
1179 MCAST( setEvent, SETUP_EVENT ); | |
1180 | |
1181 if (cmhSAT_setupEvent_Test( setEvent, &aciOnlyEvents )) | |
1182 { | |
1183 /* ACI-SPR-18200: If there are no Events to be processed by MMI | |
1184 ACI bypasses the MMI functionality and returns TR by itself */ | |
1185 | |
1186 /* something went wrong, temp event list is empty --> TR(30) */ | |
1187 if ( satShrdPrm.event.temp_list EQ 0L ) | |
1188 { | |
1189 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
1190 return FALSE; | |
1191 } | |
1192 | |
1193 if ( aciOnlyEvents ) | |
1194 { | |
1195 /* prepare response to signal OK to SATK */ | |
1196 TRSetEventOk[2] = satShrdPrm.cmdDet.cmdNr; | |
1197 satShrdPrm.setPrm[satShrdPrm.owner].stkCmd = TRSetEventOk; | |
1198 satShrdPrm.setPrm[satShrdPrm.owner].stkCmdLen = 12; | |
1199 | |
1200 /* inform SIM about acknowledged event list */ | |
1201 sendRes = cmhSAT_CheckSetEventResp( ); | |
1202 | |
1203 if (sendRes) | |
1204 { | |
1205 if( psaSAT_STKResponse() < 0 ) /* respond to STK command */ | |
1206 { | |
1207 TRACE_EVENT( "FATAL RETURN - TR could not be send" ); | |
1208 } | |
1209 } | |
1210 } | |
1211 else /* signal MMI to process further events */ | |
1212 { | |
1213 cmhSAT_STKCmdInd(); | |
1214 } | |
1215 return TRUE; | |
1216 } | |
1217 else | |
1218 { | |
1219 if ( satShrdPrm.event.temp_list NEQ 0L ) | |
1220 { | |
1221 satShrdPrm.event.temp_list = 0L; /* reinitialize temp_event_list */ | |
1222 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
1223 } | |
1224 } | |
1225 } | |
1226 break; | |
1227 | |
1228 case( SAT_CMD_RUN_AT ): | |
1229 { | |
1230 MCAST( calCmd, RUN_AT ); | |
1231 | |
1232 return( cmhSAT_runAt( calCmd )); | |
1233 } | |
1234 | |
1235 case( SAT_CMD_LAUNCH_BROWSER ): | |
1236 { | |
1237 MCAST( launchBrowserCmd, LAUNCH_BROWSER ); | |
1238 | |
1239 return( cmhSAT_launchBrowser( launchBrowserCmd )); | |
1240 } | |
1241 | |
1242 case( SAT_CMD_PROV_LOC_INFO): | |
1243 { | |
1244 return( cmhSAT_provLocalInfo()); | |
1245 } | |
1246 #ifdef FF_SAT_E | |
1247 case( SAT_CMD_OPEN_CHANNEL ): | |
1248 { | |
1249 MCAST( opchCmd, OPEN_CHANNEL ); | |
1250 | |
1251 return( cmhSAT_OpenChannelReq( opchCmd )); | |
1252 } | |
1253 #endif /* FF_SAT_E */ | |
1254 } | |
1255 return( FALSE ); | |
1256 } | |
1257 | |
1258 /* | |
1259 +-------------------------------------------------------------------+ | |
1260 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1261 | ROUTINE : psaSAT_SSResComp | | |
1262 +-------------------------------------------------------------------+ | |
1263 | |
1264 PURPOSE : SS result component handling. | |
1265 */ | |
1266 | |
1267 GLOBAL void psaSAT_SSResComp ( T_res_comp* resCmp ) | |
1268 { | |
1269 UBYTE addLen = 0; | |
1270 T_ACI_SAT_TERM_RESP resp_data; | |
1271 | |
1272 psaSAT_InitTrmResp( &resp_data ); | |
1273 | |
1274 /* Add the operation code and parameters to terminal response | |
1275 (reference: section 12.12.1 "Additional information for SEND SS" of 11.14) | |
1276 */ | |
1277 if( resCmp -> v_sequence AND | |
1278 resCmp -> sequence.v_op_code ) | |
1279 { | |
1280 ssResPrms[0] = resCmp -> sequence.op_code; | |
1281 | |
1282 if( resCmp -> sequence.params.l_params ) | |
1283 { | |
1284 addLen = resCmp -> sequence.params.l_params >> 3; | |
1285 | |
1286 memcpy( &ssResPrms[1], resCmp -> sequence.params.b_params, addLen); | |
1287 } | |
1288 ++addLen; | |
1289 } | |
1290 resp_data.add = ssResPrms; | |
1291 resp_data.addLen = addLen; | |
1292 | |
1293 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
1294 } | |
1295 | |
1296 /* | |
1297 +-------------------------------------------------------------------+ | |
1298 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1299 | ROUTINE : psaSAT_SSErrComp | | |
1300 +-------------------------------------------------------------------+ | |
1301 | |
1302 PURPOSE : SS error result component handling. | |
1303 */ | |
1304 | |
1305 GLOBAL void psaSAT_SSErrComp ( T_fac_inf* errCmp, BOOL is_fac_ussd ) | |
1306 { | |
1307 UBYTE ccdRet; | |
1308 UBYTE addLen = 1; | |
1309 T_ACI_SAT_TERM_RESP resp_data; | |
1310 | |
1311 MCAST( com, COMP_SAT ); | |
1312 | |
1313 TRACE_FUNCTION("psaSAT_SSErrComp()"); | |
1314 | |
1315 psaSAT_InitTrmResp( &resp_data ); | |
1316 *ssResPrms = ADD_NO_CAUSE; | |
1317 | |
1318 memset( com, 0, sizeof( T_COMP_SAT )); | |
1319 | |
1320 ccdRet = ccd_decodeMsg (CCDENT_FAC, | |
1321 DOWNLINK, | |
1322 (T_MSGBUF *) errCmp, | |
1323 (UBYTE *) _decodedMsg, | |
1324 COMP_SAT); | |
1325 | |
1326 if( ccdRet NEQ ccdOK ) | |
1327 { | |
1328 TRACE_EVENT_P1("CCD Decoding Error: %d",ccdRet ); | |
1329 } | |
1330 else | |
1331 { | |
1332 if( com->err_comp_sat.err_desc_sat.err_params_sat. | |
1333 l_err_params_sat ) | |
1334 { | |
1335 addLen = com->err_comp_sat.err_desc_sat.err_params_sat. | |
1336 l_err_params_sat >> 3; | |
1337 | |
1338 memcpy( ssResPrms,com->err_comp_sat.err_desc_sat.err_params_sat. | |
1339 b_err_params_sat, addLen ); | |
1340 } | |
1341 } | |
1342 resp_data.add = ssResPrms; | |
1343 resp_data.addLen = addLen; | |
1344 | |
1345 if( is_fac_ussd ) | |
1346 { | |
1347 psaSAT_SendTrmResp( RSLT_USSD_ERR, &resp_data ); | |
1348 } | |
1349 else | |
1350 { | |
1351 psaSAT_SendTrmResp( RSLT_SS_ERR, &resp_data ); | |
1352 } | |
1353 } | |
1354 | |
1355 /* | |
1356 +-------------------------------------------------------------------+ | |
1357 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1358 | ROUTINE : psaSAT_SSRejComp | | |
1359 +-------------------------------------------------------------------+ | |
1360 | |
1361 PURPOSE : SS reject component handling. | |
1362 */ | |
1363 | |
1364 GLOBAL void psaSAT_SSRejComp ( UBYTE cRejectInfo ) | |
1365 { | |
1366 UBYTE addLen = 1; | |
1367 T_ACI_SAT_TERM_RESP resp_data; | |
1368 | |
1369 TRACE_FUNCTION("psaSAT_SSRejComp()"); | |
1370 | |
1371 psaSAT_InitTrmResp( &resp_data ); | |
1372 *ssResPrms = ADD_NO_CAUSE; | |
1373 | |
1374 resp_data.add = ssResPrms; | |
1375 resp_data.addLen = addLen; | |
1376 | |
1377 psaSAT_SendTrmResp( cRejectInfo, &resp_data ); | |
1378 } | |
1379 | |
1380 /* | |
1381 +-------------------------------------------------------------------+ | |
1382 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1383 | ROUTINE : psaSAT_ss_end_ind | | |
1384 +-------------------------------------------------------------------+ | |
1385 | |
1386 PURPOSE : handles SAT responses to SAT after a SAT originated SS. | |
1387 */ | |
1388 | |
1389 GLOBAL T_ACI_RETURN psaSAT_ss_end_ind ( SHORT sId, | |
1390 T_COMPONENT *com, | |
1391 T_MNSS_END_IND *mnss_end_ind, | |
1392 BOOL is_fac_ussd ) | |
1393 { | |
1394 TRACE_FUNCTION("psaSAT_ss_end_ind()"); | |
1395 | |
1396 if( com->v_res_comp ) | |
1397 { | |
1398 if( is_fac_ussd EQ FALSE ) /* not for USSD !! */ | |
1399 { | |
1400 //TISH, patch for ASTec20762 | |
1401 //start | |
1402 psaSS_dasmResultCmp( sId, &com->res_comp ); | |
1403 //end | |
1404 psaSAT_SSResComp( &com->res_comp ); | |
1405 } | |
1406 else | |
1407 { | |
1408 psaSS_dasmResultCmp( sId, &com->res_comp ); | |
1409 } | |
1410 return( AT_EXCT ); | |
1411 } | |
1412 | |
1413 if( com->v_err_comp ) | |
1414 { | |
1415 ssShrdPrm.stb[sId].failType = SSF_SS_ERR; | |
1416 psaSAT_SSErrComp( &mnss_end_ind -> fac_inf, is_fac_ussd ); | |
1417 return( AT_FAIL ); | |
1418 } | |
1419 | |
1420 if( com->v_rej_comp ) | |
1421 { | |
1422 UBYTE cRejectInfo = RSLT_NTW_UNAB_PROC; | |
1423 | |
1424 /* check for protocol incompatibility for USSD */ | |
1425 if ( (is_fac_ussd) AND | |
1426 (com->rej_comp.v_inv_problem) ) | |
1427 { | |
1428 switch( com->rej_comp.inv_problem ) | |
1429 { | |
1430 case 0x01 : /* invoke problem code #1 */ | |
1431 { | |
1432 if (psaSS_asmUSSDProt1(sId)) | |
1433 { | |
1434 /* facility with Protocole 1 format has been sent: wait for answer */ | |
1435 return( AT_CMPL ); | |
1436 } | |
1437 cRejectInfo = RSLT_NTW_UNAB_PROC; | |
1438 break; | |
1439 } | |
1440 case 0x02 : /* invoke problem code #2 */ | |
1441 { | |
1442 cRejectInfo = RSLT_USSD_ERR; | |
1443 break; | |
1444 } | |
1445 default : | |
1446 { | |
1447 TRACE_EVENT_P1("psaSAT_ss_end_ind(): unknown invoke problem: %x", com->rej_comp.inv_problem ); | |
1448 break; | |
1449 } | |
1450 } | |
1451 ssShrdPrm.stb[sId].failType = SSF_INV_PRB; | |
1452 } | |
1453 | |
1454 /* check for protocol incompatibility for USSD */ | |
1455 if ((is_fac_ussd EQ FALSE) AND (com->rej_comp.v_gen_problem)) | |
1456 { | |
1457 ssShrdPrm.stb[sId].failType = SSF_GEN_PRB; | |
1458 /* for 27.22.4.11.1 Seq. 1.3 SEND SS */ | |
1459 if (com->rej_comp.gen_problem EQ GEN_PROB_UNRECOG_CMP) | |
1460 { | |
1461 cRejectInfo = RSLT_SS_ERR; | |
1462 } | |
1463 } | |
1464 | |
1465 psaSAT_SSRejComp( cRejectInfo ); | |
1466 return( AT_FAIL ); | |
1467 } | |
1468 return(AT_FAIL); | |
1469 } | |
1470 | |
1471 /* | |
1472 +-------------------------------------------------------------------+ | |
1473 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF | | |
1474 | ROUTINE : psaSAT_ccdErrChk | | |
1475 +-------------------------------------------------------------------+ | |
1476 | |
1477 PURPOSE : CCD error checking. The function returns a SAT result | |
1478 value unequal to 0 if the operation is must be terminated. | |
1479 Otherwise the condition is only a warning and the operation | |
1480 should be proceeded. | |
1481 */ | |
1482 | |
1483 GLOBAL UBYTE psaSAT_ccdErrChk ( void ) | |
1484 { | |
1485 USHORT parLst[MAX_ERR_PAR]; | |
1486 UBYTE ccdErr; | |
1487 UBYTE fstFlg = TRUE; | |
1488 | |
1489 TRACE_FUNCTION("psaSAT_ccdErrChk()"); | |
1490 | |
1491 /* | |
1492 *------------------------------------------------------------------- | |
1493 * handling of first error | |
1494 *------------------------------------------------------------------- | |
1495 */ | |
1496 do | |
1497 { | |
1498 memset (parLst,0, sizeof (parLst)); | |
1499 | |
1500 if( fstFlg ) | |
1501 { | |
1502 ccdErr = ccd_getFirstError (CCDENT_SAT, parLst); | |
1503 fstFlg = FALSE; | |
1504 } | |
1505 else | |
1506 | |
1507 ccdErr = ccd_getNextError (CCDENT_SAT, parLst); | |
1508 | |
1509 switch (ccdErr) | |
1510 { | |
1511 case( ERR_IE_NOT_EXPECTED ): /* unexpected element */ | |
1512 if( !((UBYTE)parLst[0] & 0x80) ) | |
1513 { | |
1514 cmpFlg = TRUE; | |
1515 break; | |
1516 } | |
1517 /* otherwise continue, no break */ | |
1518 /*lint -fallthrough*/ | |
1519 case( ERR_COMPREH_REQUIRED ): /* comprehension required */ | |
1520 | |
1521 return( RSLT_UNKN_DATA ); | |
1522 | |
1523 case( ERR_MAND_ELEM_MISS ): /* mandatory elements missing */ | |
1524 | |
1525 return( RSLT_ERR_REQ_VAL ); | |
1526 } | |
1527 } while( ccdErr NEQ ERR_NO_MORE_ERROR ); | |
1528 | |
1529 return( 0 ); | |
1530 } | |
1531 | |
1532 /* | |
1533 +-------------------------------------------------------------------+ | |
1534 | PROJECT : GSM-PS (6147) MODULE : PSA_SAT | | |
1535 | ROUTINE : psaSAT_DumpCmd | | |
1536 +-------------------------------------------------------------------+ | |
1537 | |
1538 PURPOSE : Dump SAT command to debug output. | |
1539 | |
1540 */ | |
1541 | |
1542 GLOBAL void psaSAT_DumpCmd ( T_stk_cmd * cmd ) | |
1543 { | |
1544 #define SAT_TRC_LEN 32 | |
1545 | |
1546 CHAR strBuf[2*SAT_TRC_LEN+1]; /* holds string buffer */ | |
1547 ULONG idx, cnt, mcnt; /* buffer index */ | |
1548 CHAR *pDest; /* points to destination */ | |
1549 | |
1550 TRACE_FUNCTION("psaSAT_DumpCmd()"); | |
1551 | |
1552 /* | |
1553 *------------------------------------------------------------------- | |
1554 * format command | |
1555 *------------------------------------------------------------------- | |
1556 */ | |
1557 TRACE_EVENT( "SAT CMD SENT/RECEIVED:" ); | |
1558 | |
1559 mcnt = (ULONG)cmd->l_cmd >> 3; | |
1560 | |
1561 if( !mcnt ) | |
1562 { | |
1563 TRACE_EVENT_P1("an empty envelope. (%d)", (ULONG)cmd->l_cmd); | |
1564 return; | |
1565 } | |
1566 | |
1567 for( cnt = 0; cnt < mcnt; cnt += SAT_TRC_LEN ) | |
1568 { | |
1569 pDest = strBuf; | |
1570 | |
1571 for( idx = 0; idx < SAT_TRC_LEN AND (idx + cnt) < mcnt; idx++ ) | |
1572 { | |
1573 /* Implements Measure#32: Row 1277 */ | |
1574 pDest += sprintf( pDest, format_2X_str, (UBYTE)cmd->cmd[idx + cnt] ); | |
1575 } | |
1576 | |
1577 *pDest = 0x0; | |
1578 | |
1579 TRACE_EVENT_P1("%s", strBuf ); | |
1580 } | |
1581 } | |
1582 | |
1583 /* | |
1584 +-------------------------------------------------------------------+ | |
1585 | PROJECT : GSM-PS (6147) MODULE : PSA_SAT | | |
1586 | ROUTINE : psaSAT_FURegister | | |
1587 +-------------------------------------------------------------------+ | |
1588 | |
1589 PURPOSE : Register a handler for FILE UPDATE. | |
1590 | |
1591 */ | |
1592 | |
1593 GLOBAL BOOL psaSAT_FURegister ( T_SAT_FU_FUNC fu_func ) | |
1594 { | |
1595 int i; | |
1596 | |
1597 TRACE_FUNCTION("psaSAT_FURegister()"); | |
1598 | |
1599 for (i = 0; i < MAX_FU_OPS; i++) | |
1600 { | |
1601 if (satShrdPrm.fu_func[i] EQ fu_func) | |
1602 { | |
1603 TRACE_EVENT ("FU func already registered"); | |
1604 return TRUE; | |
1605 } | |
1606 if (satShrdPrm.fu_func[i] EQ NULL) | |
1607 { | |
1608 satShrdPrm.fu_func[i] = fu_func; | |
1609 return TRUE; | |
1610 } | |
1611 } | |
1612 return FALSE; | |
1613 } | |
1614 | |
1615 /* | |
1616 +-------------------------------------------------------------------+ | |
1617 | PROJECT : GSM-PS (6147) MODULE : PSA_SAT | | |
1618 | ROUTINE : psaSAT_FUConfirm | | |
1619 +-------------------------------------------------------------------+ | |
1620 | |
1621 PURPOSE : Confirm a handled FILE UPDATE. The parameter is the same | |
1622 with which the handler was called and refers to the entry | |
1623 of the callback table. | |
1624 | |
1625 */ | |
1626 | |
1627 GLOBAL void psaSAT_FUConfirm (int currFU, USHORT resFU) | |
1628 { | |
1629 BOOL fu_active; | |
1630 BOOL aci_sent_no_primitive; | |
1631 | |
1632 TRACE_EVENT_P2("psaSAT_FUConfirm(): currFU: %d, resFU: %d", currFU, resFU); | |
1633 | |
1634 if (resFU EQ SIM_FU_ERROR) /*If there is one error, the rest of the procedure is to be cancelled */ | |
1635 { | |
1636 PALLOC (fu_res, SIM_FILE_UPDATE_RES); | |
1637 | |
1638 fu_res->source = SRC_MMI; | |
1639 fu_res->fu_rsc = SIM_FU_ERROR; | |
1640 | |
1641 if (satShrdPrm.fu_func_notif) | |
1642 (void)satShrdPrm.fu_func_notif((int)fu_res->fu_rsc,satShrdPrm.fu_ind); /*Sends the final result to MMI */ | |
1643 | |
1644 PSENDX (SIM, fu_res); | |
1645 | |
1646 return; | |
1647 } | |
1648 | |
1649 TRACE_EVENT_P1("satShrdPrm.fu_ind: %d", satShrdPrm.fu_ind); | |
1650 | |
1651 if (satShrdPrm.fu_ind NEQ NULL AND currFU < MAX_FU_OPS) | |
1652 { | |
1653 if (currFU < 0) | |
1654 { | |
1655 if (satShrdPrm.fu_func_notif) | |
1656 { /*Sends the file update request notification to MMI */ | |
1657 if (!satShrdPrm.fu_func_notif(-1,satShrdPrm.fu_ind)) | |
1658 { | |
1659 PALLOC (fu_res, SIM_FILE_UPDATE_RES); /* If rejected, send negative response to SIM */ | |
1660 | |
1661 fu_res->source = SRC_MMI; | |
1662 fu_res->fu_rsc = SIM_FU_ERROR; | |
1663 PSENDX (SIM, fu_res); | |
1664 } | |
1665 | |
1666 } | |
1667 currFU = 0; | |
1668 /*satShrdPrm.fu_rsc = SIM_FU_ERROR;*/ /* default*/ | |
1669 fu_active = FALSE; | |
1670 } | |
1671 else | |
1672 { | |
1673 ++currFU; | |
1674 | |
1675 if ( (resFU EQ SIM_FU_SUCC_ADD) AND (satShrdPrm.fu_rsc NEQ SIM_FU_ERROR) ) | |
1676 { | |
1677 satShrdPrm.fu_rsc = resFU; | |
1678 } | |
1679 | |
1680 /* | |
1681 switch (resFU) | |
1682 { | |
1683 case SIM_FU_SUCCESS: | |
1684 if (satShrdPrm.fu_rsc EQ SIM_FU_SUCC_ADD) | |
1685 break; | |
1686 case SIM_FU_SUCC_ADD: | |
1687 satShrdPrm.fu_rsc = resFU; | |
1688 } | |
1689 */ | |
1690 fu_active = TRUE; | |
1691 } | |
1692 | |
1693 for ( ; currFU < MAX_FU_OPS; currFU++) | |
1694 { | |
1695 if (satShrdPrm.fu_func[currFU] EQ NULL) | |
1696 continue; | |
1697 /* else | |
1698 fu_active = TRUE;*/ | |
1699 | |
1700 aci_sent_no_primitive = satShrdPrm.fu_func[currFU](currFU, satShrdPrm.fu_ind); | |
1701 | |
1702 if (!aci_sent_no_primitive) | |
1703 { | |
1704 return; /* otherwise, result would be sent directly, and not at the end */ | |
1705 } | |
1706 } | |
1707 | |
1708 { | |
1709 PALLOC (fu_res, SIM_FILE_UPDATE_RES); | |
1710 | |
1711 fu_res->source = SRC_MMI; | |
1712 fu_res->fu_rsc = (fu_active)? satShrdPrm.fu_rsc: SIM_FU_SUCCESS; | |
1713 | |
1714 if (satShrdPrm.fu_func_notif) | |
1715 (void)satShrdPrm.fu_func_notif((int)fu_res->fu_rsc,satShrdPrm.fu_ind); /*Sends the final result to MMI */ | |
1716 | |
1717 TRACE_EVENT("FREE satShrdPrm.fu_ind"); | |
1718 PFREE (satShrdPrm.fu_ind); | |
1719 satShrdPrm.fu_ind = NULL; | |
1720 | |
1721 PSENDX (SIM, fu_res); | |
1722 simShrdPrm.fuRef = -1; | |
1723 } | |
1724 } | |
1725 } | |
1726 | |
1727 | |
1728 /* | |
1729 +-------------------------------------------------------------------+ | |
1730 | PROJECT : GSM-PS (6147) MODULE : PSA_SAT | | |
1731 | ROUTINE : psaSAT_FUNotifyRegister | | |
1732 +-------------------------------------------------------------------+ | |
1733 | |
1734 PURPOSE : Register a handler for FILE UPDATE. | |
1735 | |
1736 */ | |
1737 | |
1738 GLOBAL BOOL psaSAT_FUNotifyRegister ( T_SAT_FU_FUNC fu_func ) | |
1739 { | |
1740 | |
1741 TRACE_FUNCTION("psaSAT_FUNotifyRegister()"); | |
1742 | |
1743 if (fu_func) | |
1744 { | |
1745 satShrdPrm.fu_func_notif = fu_func; | |
1746 return TRUE; | |
1747 } | |
1748 else | |
1749 return FALSE; | |
1750 } | |
1751 | |
1752 | |
1753 | |
1754 /* | |
1755 +-------------------------------------------------------------------+ | |
1756 | PROJECT : GSM-PS (6147) MODULE : PSA_SAT | | |
1757 | ROUTINE : psaSAT_Init | | |
1758 +-------------------------------------------------------------------+ | |
1759 | |
1760 PURPOSE : initialize the protocol stack adapter for SAT. | |
1761 | |
1762 */ | |
1763 | |
1764 /* MACRO: initializer for set parameter */ | |
1765 #define INIT_SAT_SET_PARM( dest, def )\ | |
1766 for( LpCnt = 0; LpCnt < OWN_SRC_MAX; LpCnt++ )\ | |
1767 satShrdPrm.setPrm[LpCnt].dest = def | |
1768 | |
1769 GLOBAL void psaSAT_Init ( void ) | |
1770 { | |
1771 | |
1772 TRACE_FUNCTION("psaSAT_Init()"); | |
1773 /* | |
1774 *------------------------------------------------------------------- | |
1775 * set default parms | |
1776 *------------------------------------------------------------------- | |
1777 */ | |
1778 memset( &satShrdPrm, 0, sizeof(T_SAT_SHRD_PRM)); | |
1779 satShrdPrm.dur = -1; | |
1780 satShrdPrm.SentUSSDid = NO_ENTRY; | |
1781 satShrdPrm.fu_rsc = SIM_FU_SUCCESS; | |
1782 satShrdPrm.fu_ind = NULL; | |
1783 satShrdPrm.sId_pwd_requested = NO_ENTRY; | |
1784 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1785 satShrdPrm.cust1SimRefreshRespRqd = FALSE; | |
1786 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1787 satShrdPrm.locInfo.currPLMN.v_plmn = INVLD_PLMN; | |
1788 satShrdPrm.Cbch_EvtDnl = FALSE; | |
1789 satShrdPrm.ownSAT = FALSE; | |
1790 } | |
1791 | |
1792 /* | |
1793 +-------------------------------------------------------------------+ | |
1794 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1795 | ROUTINE : psaSAT_ChkEventList | | |
1796 +-------------------------------------------------------------------+ | |
1797 | |
1798 PURPOSE : Check if the event is monitored and shall alert SAT. | |
1799 | |
1800 */ | |
1801 | |
1802 GLOBAL BOOL psaSAT_ChkEventList( UBYTE eventNr ) | |
1803 { | |
1804 BOOL event_listed = FALSE; | |
1805 | |
1806 TRACE_FUNCTION("psaSAT_ChkEventList()"); | |
1807 | |
1808 event_listed = (satShrdPrm.event.list >> eventNr ) & 0x01; | |
1809 | |
1810 if( event_listed ) | |
1811 return( TRUE ); | |
1812 | |
1813 return( FALSE ); | |
1814 } | |
1815 | |
1816 #ifdef FF_SAT_E | |
1817 | |
1818 /* | |
1819 +-------------------------------------------------------------------+ | |
1820 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1821 | ROUTINE : psaSAT_ctbFindActCall | | |
1822 +-------------------------------------------------------------------+ | |
1823 | |
1824 PURPOSE : Return the call id of a call which is in an active state. | |
1825 If no call could be found the function returns NO_ENTRY. | |
1826 | |
1827 */ | |
1828 | |
1829 GLOBAL SHORT psaSAT_ctbFindActCall( void ) | |
1830 { | |
1831 UBYTE ctbIdx; | |
1832 SHORT actId = NO_ENTRY; | |
1833 | |
1834 TRACE_FUNCTION("psaSAT_ctbFindActCall()"); | |
1835 | |
1836 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
1837 { | |
1838 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL) | |
1839 { | |
1840 switch( psaCC_ctb(ctbIdx)->calStat ) | |
1841 { | |
1842 case( CS_ACT ): | |
1843 case( CS_ACT_REQ ): | |
1844 case( CS_MDF_REQ ): | |
1845 | |
1846 actId = ctbIdx; | |
1847 break; | |
1848 } | |
1849 } | |
1850 } | |
1851 | |
1852 return( actId ); | |
1853 } | |
1854 | |
1855 /* | |
1856 +-------------------------------------------------------------------+ | |
1857 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1858 | ROUTINE : psaSAT_gprsFindFreeCntxt| | |
1859 +-------------------------------------------------------------------+ | |
1860 | |
1861 PURPOSE : Return a free context id, if busy return NO_ENTRY. | |
1862 | |
1863 */ | |
1864 #ifdef GPRS | |
1865 GLOBAL SHORT psaSAT_gprsFindFreeCntxt( void ) | |
1866 { | |
1867 BOOL cntxtStat[MAX_CID+1]; | |
1868 SHORT cntxtId[MAX_CID+1]; | |
1869 SHORT cid = NO_ENTRY; | |
1870 UBYTE idx; | |
1871 | |
1872 TRACE_FUNCTION("psaSAT_gprsFindFreeCntxt()"); | |
1873 | |
1874 if( qAT_PlusCGACT( CMD_SRC_LCL, cntxtStat, cntxtId ) NEQ AT_CMPL ) | |
1875 | |
1876 return( NO_ENTRY ); | |
1877 | |
1878 for( idx = 0; idx < MAX_CID; idx++ ) | |
1879 { | |
1880 if( cntxtId[idx] NEQ INVALID_CID AND cntxtStat[idx] EQ TRUE ) continue; | |
1881 | |
1882 cid = (cntxtId[idx] EQ INVALID_CID)? idx+1:cntxtId[idx]; | |
1883 break; | |
1884 } | |
1885 | |
1886 return( cid ); | |
1887 | |
1888 } | |
1889 #endif /* GPRS */ | |
1890 | |
1891 #endif /* FF_SAT_E */ | |
1892 | |
1893 #endif /* #ifdef SIM_TOOLKIT */ | |
1894 | |
1895 /*==== EOF ========================================================*/ |