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