FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/cmh_satf.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_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 global functions of the command | |
18 | handler. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #include "config.h" | |
23 #include "fixedconf.h" | |
24 #include "condat-features.h" | |
25 #include "aci_conf.h" | |
26 | |
27 #ifdef SIM_TOOLKIT | |
28 | |
29 #ifndef CMH_SATF_C | |
30 #define CMH_SATF_C | |
31 #endif | |
32 | |
33 #define _PACK_DEF_ALPHA /* apply packing for GSM Default Alphabet */ | |
34 | |
35 #include "aci_all.h" | |
36 /*==== INCLUDES ===================================================*/ | |
37 #ifdef DTI | |
38 #include "dti.h" | |
39 #endif /* DTI */ | |
40 | |
41 #include "pcm.h" | |
42 | |
43 #include "aci.h" | |
44 #include "aci_cmh.h" | |
45 #include "ati_cmd.h" | |
46 #include "aci_mem.h" | |
47 | |
48 #include "ati_src_sat.h" | |
49 | |
50 #ifdef FAX_AND_DATA | |
51 #include "aci_fd.h" | |
52 #endif /* FAX_AND_DATA */ | |
53 | |
54 #include "phb.h" | |
55 #include "ksd.h" | |
56 #include "aoc.h" | |
57 | |
58 #include "psa.h" | |
59 #include "psa_cc.h" | |
60 #include "psa_sat.h" | |
61 #include "psa_sim.h" | |
62 #include "psa_sms.h" | |
63 #include "psa_ss.h" | |
64 #include "psa_util.h" | |
65 #include "psa_mm.h" | |
66 | |
67 #include "cmh.h" | |
68 #include "cmh_ss.h" | |
69 #include "cmh_cc.h" | |
70 #include "cmh_phb.h" | |
71 | |
72 #ifdef DTI | |
73 #include "dti_conn_mng.h" | |
74 #include "dti_cntrl_mng.h" | |
75 #endif /* DTI */ | |
76 | |
77 #include "cmh_sim.h" | |
78 #include "cmh_sat.h" | |
79 #include "cmh_sms.h" | |
80 | |
81 /* #include "cmh_sat.h" */ | |
82 | |
83 #if defined (GPRS) AND defined (DTI) | |
84 #include "gaci.h" | |
85 #include "gaci_cmh.h" | |
86 #include "gaci_srcc.h" | |
87 #include "psa_gmm.h" | |
88 #include "psa_sm.h" | |
89 #include "cmh_sm.h" | |
90 #endif | |
91 | |
92 | |
93 #if defined (FAX_AND_DATA) AND defined (DTI) | |
94 #include "psa_ra.h" | |
95 #include "cmh_ra.h" | |
96 #include "psa_l2r.h" | |
97 #include "cmh_l2r.h" | |
98 #endif /* FAX_AND_DATA */ | |
99 | |
100 #ifdef CO_UDP_IP | |
101 #include "wap_aci.h" | |
102 #include "psa_tcpip.h" | |
103 #endif /* CO_UDP_IP */ | |
104 #include "rtcdrv.h" | |
105 | |
106 /*==== CONSTANTS ==================================================*/ | |
107 #define MAX_CBM_REMEMBERED 9 | |
108 #define SIM_CLASS_E_MAX_BUFFER_SIZE 65535 | |
109 | |
110 /*==== TYPES ======================================================*/ | |
111 typedef struct | |
112 { | |
113 U16 msgIdent; | |
114 U16 msgCode; | |
115 U8 updtNum; | |
116 U8 pageNum; | |
117 } T_SAT_CBM_SEND; | |
118 | |
119 | |
120 /*==== EXPORT =====================================================*/ | |
121 LOCAL void cmhSAT_CBMInitList(); | |
122 | |
123 /*==== VARIABLES ==================================================*/ | |
124 T_SAT_CBM_SEND *CBMsend = NULL; | |
125 | |
126 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams; | |
127 | |
128 | |
129 /*==== FUNCTIONS ==================================================*/ | |
130 | |
131 /* | |
132 +-------------------------------------------------------------------+ | |
133 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
134 | ROUTINE : cmhSAT_GetCmdPrfLocation | | |
135 +-------------------------------------------------------------------+ | |
136 | |
137 PURPOSE : This function will return TRUE if the Command has been found and | |
138 FALSE if the Command or the Qualifier is unknown. | |
139 The byte location and Mask for the given Stk Cmd are returned in the passed paramters, | |
140 a return value of TRUE with Byte Number of 0xFF and Mask of 0xFF indicates an | |
141 END_OF_SESSION, which isn't in the Profile | |
142 */ | |
143 | |
144 LOCAL BOOL cmhSAT_GetCmdPrfLocation (U8 cmd_typ, U8 cmd_qual, U8 *prf_byte_no, U8 *byte_mask) | |
145 { | |
146 /* | |
147 ** Initialise the byte and Mask settings to 0xFF | |
148 */ | |
149 *prf_byte_no = 0xFF; | |
150 *byte_mask = 0xFF; | |
151 | |
152 switch (cmd_typ) | |
153 { | |
154 case SAT_CMD_REFRESH: | |
155 *prf_byte_no = 2; | |
156 *byte_mask = SAT_TP3_REFRESH; | |
157 break; | |
158 | |
159 case SAT_CMD_MORE_TIME: | |
160 *prf_byte_no = 2; | |
161 *byte_mask = SAT_TP3_MORE_TIME; | |
162 break; | |
163 | |
164 case SAT_CMD_POLL_INTERVAL: | |
165 *prf_byte_no = 2; | |
166 *byte_mask = SAT_TP3_POLL_ITV; | |
167 break; | |
168 | |
169 case SAT_CMD_POLL_OFF: | |
170 *prf_byte_no = 2; | |
171 *byte_mask = SAT_TP3_POLL_OFF; | |
172 break; | |
173 | |
174 case SAT_CMD_EVENT_LIST: | |
175 *prf_byte_no = 4; | |
176 *byte_mask = SAT_TP5_EVENT_LIST; | |
177 break; | |
178 | |
179 case SAT_CMD_SETUP_CALL: | |
180 *prf_byte_no = 3; | |
181 *byte_mask = SAT_TP4_SETUP_CALL; | |
182 break; | |
183 | |
184 case SAT_CMD_SEND_SS: | |
185 *prf_byte_no = 3; | |
186 *byte_mask = SAT_TP4_SEND_SS; | |
187 break; | |
188 | |
189 case SAT_CMD_SEND_USSD: | |
190 *prf_byte_no = 3; | |
191 *byte_mask = SAT_TP4_SEND_USSD; | |
192 break; | |
193 | |
194 case SAT_CMD_SEND_SMS: | |
195 *prf_byte_no = 3; | |
196 *byte_mask = SAT_TP4_SEND_SMS; | |
197 break; | |
198 | |
199 case SAT_CMD_SEND_DTMF: | |
200 *prf_byte_no = 8; | |
201 *byte_mask = SAT_TP9_DTMF_CMD; | |
202 break; | |
203 | |
204 case SAT_CMD_LAUNCH_BROWSER: | |
205 *prf_byte_no = 8; | |
206 *byte_mask = SAT_TP9_LAUNCH_BROWSER; | |
207 break; | |
208 | |
209 case SAT_CMD_PLAY_TONE: | |
210 *prf_byte_no = 2; | |
211 *byte_mask = SAT_TP3_PLAY_TONE; | |
212 break; | |
213 | |
214 case SAT_CMD_DISPLAY_TEXT: | |
215 *prf_byte_no = 2; | |
216 *byte_mask = SAT_TP3_DSPL_TXT; | |
217 break; | |
218 | |
219 case SAT_CMD_GET_INKEY: | |
220 *prf_byte_no = 2; | |
221 *byte_mask = SAT_TP3_GET_INKEY; | |
222 break; | |
223 | |
224 case SAT_CMD_GET_INPUT: | |
225 *prf_byte_no = 2; | |
226 *byte_mask = SAT_TP3_GET_INPUT; | |
227 break; | |
228 | |
229 case SAT_CMD_SEL_ITEM: | |
230 *prf_byte_no = 3; | |
231 *byte_mask = SAT_TP4_SEL_ITEM; | |
232 break; | |
233 | |
234 case SAT_CMD_SETUP_MENU: | |
235 *prf_byte_no = 3; | |
236 *byte_mask = SAT_TP4_SETUP_MENU; | |
237 break; | |
238 | |
239 case SAT_CMD_PROV_LOC_INFO: | |
240 /* | |
241 ** Depends on which type of Local Info is requested | |
242 */ | |
243 switch (cmd_qual) | |
244 { | |
245 case 0: | |
246 case 1: | |
247 *prf_byte_no = 3; | |
248 *byte_mask = SAT_TP4_PLI_PLMN_IMEI; | |
249 break; | |
250 | |
251 case 2: | |
252 *prf_byte_no = 3; | |
253 *byte_mask = SAT_TP4_PLI_NMR; | |
254 break; | |
255 | |
256 case 3: | |
257 *prf_byte_no = 7; | |
258 *byte_mask = SAT_TP8_PLI_DTT; | |
259 break; | |
260 | |
261 case 4: | |
262 *prf_byte_no = 8; | |
263 *byte_mask = SAT_TP9_PLI_LANG; | |
264 break; | |
265 | |
266 case 5: | |
267 *prf_byte_no = 8; | |
268 *byte_mask = SAT_TP9_PLI_TIMING_ADV; | |
269 break; | |
270 | |
271 default: | |
272 return (FALSE); /* Command Not recognised */ | |
273 } | |
274 break; | |
275 | |
276 case SAT_CMD_TIMER_MNG: | |
277 *prf_byte_no = 7; | |
278 *byte_mask = SAT_TP8_TMNG_ST | SAT_TP8_TMNG_VAL; | |
279 break; | |
280 | |
281 case SAT_CMD_IDLE_TEXT: | |
282 *prf_byte_no = 7; | |
283 *byte_mask = SAT_TP8_IDLE_TXT; | |
284 break; | |
285 | |
286 case SAT_CMD_RUN_AT: | |
287 *prf_byte_no = 7; | |
288 *byte_mask = SAT_TP8_AT_CMD; | |
289 break; | |
290 | |
291 case SAT_CMD_OPEN_CHANNEL: | |
292 *prf_byte_no = 11; | |
293 *byte_mask = SAT_TP12_OPEN_CHANNEL; | |
294 break; | |
295 | |
296 case SAT_CMD_CLOSE_CHANNEL: | |
297 *prf_byte_no = 11; | |
298 *byte_mask = SAT_TP12_CLOSE_CHANNEL; | |
299 break; | |
300 | |
301 case SAT_CMD_RECEIVE_DATA: | |
302 *prf_byte_no = 11; | |
303 *byte_mask = SAT_TP12_RECEIVE_DATA; | |
304 break; | |
305 | |
306 case SAT_CMD_SEND_DATA: | |
307 *prf_byte_no = 11; | |
308 *byte_mask = SAT_TP12_SEND_DATA; | |
309 break; | |
310 | |
311 case SAT_CMD_GET_CHANNEL_STATUS: | |
312 *prf_byte_no = 11; | |
313 *byte_mask = SAT_TP12_GET_CHANNEL_STAT; | |
314 break; | |
315 | |
316 case SAT_CMD_END_SESSION: | |
317 /* | |
318 ** Do nothing - The command should be handled by the MMI, | |
319 ** but there is no entry in the terminal profile | |
320 */ | |
321 break; | |
322 | |
323 default: | |
324 return (FALSE); /* Command Not recognised */ | |
325 } | |
326 | |
327 return (TRUE); | |
328 } | |
329 | |
330 /* | |
331 +-------------------------------------------------------------------+ | |
332 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
333 | ROUTINE : cmhSAT_IsStkCmdForMmi | | |
334 +-------------------------------------------------------------------+ | |
335 | |
336 PURPOSE : This function will check whether the command should be set to the MMI | |
337 and if so will trigger a SATI indication | |
338 | |
339 */ | |
340 | |
341 GLOBAL BOOL cmhSAT_IsStkCmdForMmi (U8 cmd_typ, U8 cmd_qual) | |
342 { | |
343 BOOL is_handled = FALSE; | |
344 U8 prf_byte_no; | |
345 U8 byte_mask; | |
346 int idx; | |
347 | |
348 /* | |
349 ** End of Session is handled by the | |
350 */ | |
351 if (cmd_typ EQ SAT_CMD_END_SESSION) | |
352 { | |
353 is_handled = TRUE; | |
354 } | |
355 else | |
356 { | |
357 /* | |
358 ** Convert the command type into a Stk Profile Byte Number and Offset | |
359 */ | |
360 if (cmhSAT_GetCmdPrfLocation(cmd_typ, cmd_qual, &prf_byte_no, &byte_mask)) | |
361 { | |
362 /* | |
363 ** For each Attached Service | |
364 */ | |
365 for (idx = 0; idx < CMD_SRC_MAX AND (is_handled EQ FALSE); idx++) | |
366 { | |
367 /* | |
368 ** if the Command is handled | |
369 */ | |
370 if (simShrdPrm.setPrm[idx].STKprof[prf_byte_no] & byte_mask) | |
371 { | |
372 /* | |
373 ** Set a handled flag to TRUE | |
374 */ | |
375 is_handled = TRUE; | |
376 } | |
377 } | |
378 } | |
379 } | |
380 | |
381 /* | |
382 ** if the Command is handled | |
383 */ | |
384 if (is_handled) | |
385 { | |
386 /* | |
387 ** Send the SATI indication | |
388 */ | |
389 cmhSAT_STKCmdInd(); | |
390 } | |
391 | |
392 /* | |
393 ** return the value of the handled flag | |
394 */ | |
395 return (is_handled); | |
396 } | |
397 | |
398 /* | |
399 +-------------------------------------------------------------------+ | |
400 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
401 | ROUTINE : cmhSAT_CalCntrlBySIM | | |
402 +-------------------------------------------------------------------+ | |
403 | |
404 PURPOSE : If call control by SIM is activated and allocated, the | |
405 parameters for the call found in the call table are | |
406 packed into a SIM envelope command and send to the SIM | |
407 for checking. | |
408 | |
409 */ | |
410 | |
411 GLOBAL T_ACI_RETURN cmhSAT_CalCntrlBySIM ( SHORT cId ) | |
412 { | |
413 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
414 | |
415 TRACE_FUNCTION("cmhSAT_CalCntrlBySIM()"); | |
416 | |
417 /* | |
418 *------------------------------------------------------------------- | |
419 * check if Call Control is disabled (Cust1 Customisation) | |
420 *------------------------------------------------------------------- | |
421 */ | |
422 if(simShrdPrm.setPrm[ctb->calOwn].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_INACTIVE) | |
423 { | |
424 simShrdPrm.setPrm[ctb->calOwn].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
425 return( AT_CMPL ); | |
426 } | |
427 | |
428 /* | |
429 *------------------------------------------------------------------- | |
430 * check if service is activated and allocated | |
431 *------------------------------------------------------------------- | |
432 */ | |
433 if( ! psaSIM_ChkSIMSrvSup( SRV_CalCntrl )) return( AT_CMPL ); | |
434 | |
435 /* | |
436 *------------------------------------------------------------------- | |
437 * check if Call Control customization is enabled... if yes return AT_CMPL | |
438 *------------------------------------------------------------------- | |
439 */ | |
440 | |
441 if(cuscfgParams.MO_Call_Control_SIM EQ CUSCFG_STAT_Enabled) | |
442 { | |
443 return( AT_CMPL ); | |
444 } | |
445 | |
446 /* | |
447 *------------------------------------------------------------------- | |
448 * check if a call control request is in progress | |
449 *------------------------------------------------------------------- | |
450 */ | |
451 if( satShrdPrm.SIMCCParm.busy EQ TRUE ) return( AT_BUSY ); | |
452 | |
453 /* | |
454 *------------------------------------------------------------------- | |
455 * build envelope call control command | |
456 *------------------------------------------------------------------- | |
457 */ | |
458 CCD_START; | |
459 psaSAT_BuildEnvCC ( cId, NULL, NULL, NULL, NULL ); | |
460 | |
461 satShrdPrm.SIMCCParm.cId = cId; | |
462 satShrdPrm.SIMCCParm.ccAct = CC_ACT_CAL; | |
463 satShrdPrm.SIMCCParm.owner = ctb->calOwn; | |
464 satShrdPrm.SIMCCParm.busy = TRUE; | |
465 | |
466 satShrdPrm.owner = /*ctb->calOwn;*/ OWN_SRC_INV; | |
467 | |
468 satShrdPrm.Cbch_EvtDnl = FALSE; | |
469 | |
470 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
471 { | |
472 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
473 CCD_END; | |
474 return( AT_FAIL ); | |
475 } | |
476 | |
477 CCD_END; | |
478 return (AT_EXCT); | |
479 | |
480 } | |
481 | |
482 /* | |
483 +-------------------------------------------------------------------+ | |
484 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
485 | ROUTINE : cmhSAT_SSCntrlBySIM | | |
486 +-------------------------------------------------------------------+ | |
487 | |
488 PURPOSE : If call control by SIM is activated and allocated, the | |
489 the passed supplementary service control string is | |
490 packed into a SIM envelope command and send to the SIM | |
491 for checking. | |
492 | |
493 */ | |
494 | |
495 GLOBAL T_ACI_RETURN cmhSAT_SSCntrlBySIM ( T_CLPTY_PRM *cldPty, UBYTE own ) | |
496 { | |
497 TRACE_FUNCTION("cmhSAT_SSCntrlBySIM()"); | |
498 | |
499 /* | |
500 *------------------------------------------------------------------- | |
501 * check if Call Control is disabled (Cust1 Customisation) | |
502 *------------------------------------------------------------------- | |
503 */ | |
504 if(simShrdPrm.setPrm[own].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_INACTIVE) | |
505 { | |
506 simShrdPrm.setPrm[own].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
507 return( AT_CMPL ); | |
508 } | |
509 | |
510 /* | |
511 *------------------------------------------------------------------- | |
512 * check if service is activated and allocated | |
513 *------------------------------------------------------------------- | |
514 */ | |
515 if( ! psaSIM_ChkSIMSrvSup( SRV_CalCntrl )) return( AT_CMPL ); | |
516 | |
517 /* | |
518 *------------------------------------------------------------------- | |
519 * check if Call Control customization is enabled... if yes return AT_CMPL | |
520 *------------------------------------------------------------------- | |
521 */ | |
522 | |
523 if(cuscfgParams.MO_SS_Control_SIM EQ CUSCFG_STAT_Enabled) | |
524 { | |
525 return( AT_CMPL ); | |
526 } | |
527 | |
528 /* | |
529 *------------------------------------------------------------------- | |
530 * check if a call control request is in progress | |
531 *------------------------------------------------------------------- | |
532 */ | |
533 if( satShrdPrm.SIMCCParm.busy EQ TRUE ) return( AT_BUSY ); | |
534 | |
535 /* | |
536 *------------------------------------------------------------------- | |
537 * build envelope call control command | |
538 *------------------------------------------------------------------- | |
539 */ | |
540 CCD_START; | |
541 psaSAT_BuildEnvCC ( NO_ENTRY, cldPty, NULL, NULL, NULL); | |
542 | |
543 if( cldPty NEQ NULL ) | |
544 satShrdPrm.SIMCCParm.ccAct = CC_ACT_SS; | |
545 | |
546 satShrdPrm.SIMCCParm.owner = own; | |
547 satShrdPrm.SIMCCParm.busy = TRUE; | |
548 | |
549 satShrdPrm.owner = OWN_SRC_INV; | |
550 | |
551 satShrdPrm.Cbch_EvtDnl = FALSE; | |
552 | |
553 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
554 { | |
555 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
556 CCD_END; | |
557 return( AT_FAIL ); | |
558 } | |
559 | |
560 CCD_END; | |
561 | |
562 /* | |
563 *------------------------------------------------------------------- | |
564 * save SS string | |
565 *------------------------------------------------------------------- | |
566 */ | |
567 | |
568 if( cldPty NEQ NULL ) | |
569 memcpy(&satPndSetup.clpty, cldPty, sizeof(T_CLPTY_PRM)); | |
570 | |
571 return (AT_EXCT); | |
572 | |
573 } | |
574 | |
575 /* | |
576 +-------------------------------------------------------------------+ | |
577 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
578 | ROUTINE : cmhSAT_USSDCntrlBySIM | | |
579 +-------------------------------------------------------------------+ | |
580 | |
581 PURPOSE : If call control by SIM is activated and allocated, the | |
582 the passed supplementary service control string is | |
583 packed into a SIM envelope command and send to the SIM | |
584 for checking. | |
585 | |
586 */ | |
587 | |
588 GLOBAL T_ACI_RETURN cmhSAT_USSDCntrlBySIM ( T_sat_ussd *ussd, UBYTE own ) | |
589 { | |
590 TRACE_FUNCTION("cmhSAT_USSDCntrlBySIM()"); | |
591 | |
592 /* | |
593 *------------------------------------------------------------------- | |
594 * check if Call Control is disabled (Cust1 Customisation) | |
595 *------------------------------------------------------------------- | |
596 */ | |
597 if(simShrdPrm.setPrm[own].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_INACTIVE) | |
598 { | |
599 simShrdPrm.setPrm[own].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
600 return( AT_CMPL ); | |
601 } | |
602 | |
603 /* | |
604 *------------------------------------------------------------------- | |
605 * check if service is activated and allocated | |
606 *------------------------------------------------------------------- | |
607 */ | |
608 if( ! psaSIM_ChkSIMSrvSup( SRV_CalCntrl )) return( AT_CMPL ); | |
609 | |
610 /* | |
611 *------------------------------------------------------------------- | |
612 * check if Call Control customization is enabled... if yes return AT_CMPL | |
613 *------------------------------------------------------------------- | |
614 */ | |
615 | |
616 if(cuscfgParams.MO_USSD_Control_SIM EQ CUSCFG_STAT_Enabled) | |
617 { | |
618 return( AT_CMPL ); | |
619 } | |
620 | |
621 /* | |
622 *------------------------------------------------------------------- | |
623 * check if a call control request is in progress | |
624 *------------------------------------------------------------------- | |
625 */ | |
626 if( satShrdPrm.SIMCCParm.busy EQ TRUE ) return( AT_BUSY ); | |
627 | |
628 /* | |
629 *------------------------------------------------------------------- | |
630 * save SS string | |
631 *------------------------------------------------------------------- | |
632 */ | |
633 if( ussd ) | |
634 { | |
635 satPndSetup.ussd_str.dcs = ussd->dcs; | |
636 satPndSetup.ussd_str.c_ussd_str = ussd->c_ussd_str; | |
637 memcpy( satPndSetup.ussd_str.ussd_str, ussd->ussd_str, satPndSetup.ussd_str.c_ussd_str); | |
638 /* we have to move the ussd_str pointer since it still points to _decodedMsg | |
639 and would be overwritten by the first memset in psaSAT_BuildEnvCC */ | |
640 ussd->ussd_str = satPndSetup.ussd_str.ussd_str; | |
641 } | |
642 | |
643 /* | |
644 *------------------------------------------------------------------- | |
645 * build envelope call control command | |
646 *------------------------------------------------------------------- | |
647 */ | |
648 CCD_START; | |
649 psaSAT_BuildEnvCC ( NO_ENTRY, NULL, ussd, NULL, NULL ); | |
650 | |
651 if( ussd ) | |
652 satShrdPrm.SIMCCParm.ccAct = CC_ACT_USSD; | |
653 | |
654 satShrdPrm.SIMCCParm.owner = own; | |
655 satShrdPrm.SIMCCParm.busy = TRUE; | |
656 | |
657 satShrdPrm.owner = OWN_SRC_INV; | |
658 | |
659 satShrdPrm.Cbch_EvtDnl = FALSE; | |
660 | |
661 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
662 { | |
663 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
664 CCD_END; | |
665 return( AT_FAIL ); | |
666 } | |
667 | |
668 CCD_END; | |
669 | |
670 | |
671 return (AT_EXCT); | |
672 | |
673 } | |
674 | |
675 | |
676 /* | |
677 +-------------------------------------------------------------------+ | |
678 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
679 | ROUTINE : cmhSAT_CBMInitList | | |
680 +-------------------------------------------------------------------+ | |
681 | |
682 PURPOSE : Allocates and initializes CBM list. | |
683 */ | |
684 | |
685 LOCAL void cmhSAT_CBMInitList() | |
686 { | |
687 TRACE_FUNCTION("cmhSAT_CBMInitList()"); | |
688 | |
689 if ( CBMsend EQ NULL ) | |
690 { | |
691 ACI_MALLOC(CBMsend, sizeof(T_SAT_CBM_SEND) * MAX_CBM_REMEMBERED); | |
692 } | |
693 memset( CBMsend, NOT_PRESENT_8BIT, | |
694 sizeof(T_SAT_CBM_SEND) * MAX_CBM_REMEMBERED ); | |
695 } | |
696 | |
697 | |
698 /* | |
699 +-------------------------------------------------------------------+ | |
700 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
701 | ROUTINE : cmhSAT_CBMDestroyList | | |
702 +-------------------------------------------------------------------+ | |
703 | |
704 PURPOSE : Frees memory of CBM list and sets list pointer to NULL. | |
705 */ | |
706 | |
707 GLOBAL void cmhSAT_CBMDestroyList() | |
708 { | |
709 TRACE_FUNCTION("cmhSAT_CBMDestroyList()"); | |
710 | |
711 if ( CBMsend NEQ NULL ) | |
712 { | |
713 ACI_MFREE( CBMsend ); | |
714 CBMsend = NULL; | |
715 } | |
716 } | |
717 | |
718 | |
719 /* | |
720 +-------------------------------------------------------------------+ | |
721 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
722 | ROUTINE : cmhSAT_CBMAddToList | | |
723 +-------------------------------------------------------------------+ | |
724 | |
725 PURPOSE : Adds new CBM Identifiers to end of CBM list | |
726 */ | |
727 | |
728 LOCAL void cmhSAT_CBMAddToList( UBYTE pos, | |
729 U16 msgIdent, | |
730 U16 msgCode, | |
731 UBYTE updtNum, | |
732 UBYTE pageNum ) | |
733 { | |
734 TRACE_FUNCTION("cmhSAT_CBMAddToList()"); | |
735 | |
736 if ( pos >= MAX_CBM_REMEMBERED ) | |
737 { | |
738 /* remove oldest: | |
739 move all entries one entry to the beginning of the list */ | |
740 memcpy( CBMsend, CBMsend + 1, | |
741 (MAX_CBM_REMEMBERED - 1) * sizeof(T_SAT_CBM_SEND)); | |
742 pos = MAX_CBM_REMEMBERED - 1; | |
743 } | |
744 | |
745 CBMsend[pos].msgIdent = msgIdent; | |
746 CBMsend[pos].msgCode = msgCode; | |
747 CBMsend[pos].updtNum = updtNum; | |
748 CBMsend[pos].pageNum = pageNum; | |
749 } | |
750 | |
751 | |
752 /* | |
753 +-------------------------------------------------------------------+ | |
754 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
755 | ROUTINE : cmhSAT_CBMUpdateList | | |
756 +-------------------------------------------------------------------+ | |
757 | |
758 PURPOSE : Moves last updated CBM to end of the CBM list | |
759 */ | |
760 | |
761 LOCAL void cmhSAT_CBMUpdateList( UBYTE pos ) | |
762 { | |
763 T_SAT_CBM_SEND curCBM; | |
764 | |
765 TRACE_FUNCTION("cmhSAT_CBMUpdateList()"); | |
766 | |
767 /* save data of current CBM */ | |
768 memcpy( &curCBM, CBMsend + pos, sizeof(T_SAT_CBM_SEND) ); | |
769 | |
770 /* move all entries, starting after the current entry, one entry to | |
771 the beginning of the list */ | |
772 memcpy( CBMsend + pos, CBMsend + pos+1, | |
773 ( MAX_CBM_REMEMBERED - (pos+1)) * sizeof(T_SAT_CBM_SEND) ); | |
774 | |
775 /* copy current CBM at last used position */ | |
776 while ( (pos < MAX_CBM_REMEMBERED-1) AND | |
777 (CBMsend[pos].msgIdent NEQ NOT_PRESENT_16BIT) ) | |
778 { | |
779 pos++; | |
780 } | |
781 memcpy( CBMsend + pos, &curCBM, sizeof(T_SAT_CBM_SEND) ); | |
782 | |
783 } | |
784 | |
785 | |
786 /* | |
787 +-------------------------------------------------------------------+ | |
788 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
789 | ROUTINE : cmhSAT_CBMExtractData | | |
790 +-------------------------------------------------------------------+ | |
791 | |
792 PURPOSE : Extracts MessageCode, Messag Identifier, Update number, | |
793 Page number and total numbers of pages from the CBM. | |
794 */ | |
795 | |
796 LOCAL void cmhSAT_CBMExtractData( UBYTE* cbMsg, | |
797 U16* msgIdent, | |
798 U16* msgCode, | |
799 UBYTE* updtNum, | |
800 UBYTE* pageNum, | |
801 UBYTE* pageTotal ) | |
802 { | |
803 UBYTE cnvrt[2]; | |
804 | |
805 TRACE_FUNCTION("cmhSAT_CBMExtractData()"); | |
806 | |
807 /* extract message identifiers: | |
808 cbMsg is not yet enveloped for SAT, so that Bytes 3 - 4 includes | |
809 the message identifiers. | |
810 */ | |
811 memcpy(cnvrt+1, &cbMsg[2], 1); | |
812 memcpy(cnvrt, &cbMsg[3], 1); | |
813 memcpy(msgIdent, cnvrt, 2); | |
814 | |
815 /* decode serial number: | |
816 cbMsg is not yet enveloped for SAT, so that cbMsg starts | |
817 with the serial number. | |
818 update number: | |
819 The serial number includes the message code in bits 0 - 5 of the | |
820 first Byte and in bits 4 -7 in the second Byte. | |
821 */ | |
822 memcpy(cnvrt+1, &cbMsg[0], 1); | |
823 memcpy(cnvrt, &cbMsg[1], 1); | |
824 memcpy(msgCode, cnvrt, 2); | |
825 *msgCode = ( *msgCode >> 4 ) & 1023; | |
826 | |
827 /* | |
828 update number: | |
829 The second Byte of the serial number includes the | |
830 update number in bits 0 - 3. | |
831 the bitwise AND operation with 15 will set bits 4 - 7 to zero. | |
832 */ | |
833 *updtNum = cbMsg[1] & 15; | |
834 | |
835 /* extract page parameter: | |
836 cbMsg is not yet enveloped for SAT, so that the sixth Byte is | |
837 the page parameter. | |
838 It includes the total number of pages in bits 0 - 3. | |
839 The bitwise AND operation with 15 will set bits 4 - 7 to zero. | |
840 The current page number is in bits 4 - 7. | |
841 To get the current page number the bits have to be shifted | |
842 4 positions to the right. | |
843 */ | |
844 *pageTotal = cbMsg[5] & 15; | |
845 *pageNum = cbMsg[5] >> 4; | |
846 } | |
847 | |
848 | |
849 /* | |
850 +-------------------------------------------------------------------+ | |
851 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
852 | ROUTINE : cmhSAT_CBMIsNewMsg | | |
853 +-------------------------------------------------------------------+ | |
854 | |
855 PURPOSE : Checks if CBM is a new CBM or if it already has been | |
856 send to SIM. The Identifiers of already received CBMs | |
857 are stored in a list. | |
858 RETURNS: TRUE, if it is new and shall be send to SIM now. | |
859 FALSE, if it already has been send to SIM. | |
860 */ | |
861 | |
862 LOCAL BOOL cmhSAT_CBMIsNewMsg( UBYTE* cbMsg ) | |
863 { | |
864 | |
865 U16 msgIdent; | |
866 U16 msgCode; | |
867 U8 updtNum; | |
868 U8 pageTotal; | |
869 U8 pageNum; | |
870 UBYTE i; | |
871 | |
872 | |
873 TRACE_FUNCTION("cmhSAT_CBMIsNewMsg()"); | |
874 | |
875 if ( CBMsend EQ NULL ) | |
876 { | |
877 cmhSAT_CBMInitList(); | |
878 } | |
879 | |
880 /*---------------------------------------------------------------- | |
881 * extract CBM identifiers | |
882 *----------------------------------------------------------------*/ | |
883 | |
884 cmhSAT_CBMExtractData( cbMsg, &msgIdent, &msgCode, &updtNum, | |
885 &pageNum, &pageTotal ); | |
886 | |
887 /*---------------------------------------------------------------- | |
888 * check if message has already been send to SIM | |
889 *----------------------------------------------------------------*/ | |
890 | |
891 /* search for message identifiers in CB Messages already send to SIM */ | |
892 for ( i = 0; | |
893 (i < MAX_CBM_REMEMBERED) AND (CBMsend[i].msgCode NEQ NOT_PRESENT_16BIT); | |
894 i++ ) | |
895 { | |
896 if ( (msgIdent EQ CBMsend[i].msgIdent) AND | |
897 (msgCode EQ CBMsend[i].msgCode) ) | |
898 { | |
899 | |
900 /* if update number has changed, CBM shall be send to SIM */ | |
901 /* 23.041 9.4.1.2.1: | |
902 Any Update Number eight or less higher (modulo 16) | |
903 than the last received Update Number will be considered more recent, | |
904 and shall be treated as a new CBS message, | |
905 provided the mobile has not been switched off. */ | |
906 | |
907 U8 delta; | |
908 | |
909 delta = (updtNum - CBMsend[i].updtNum) % 16; /* force explicit negative carry! */ | |
910 if (delta > 0 AND delta <= 8) | |
911 { | |
912 /* for the next check: set update number to new update number | |
913 and reset page number for new update */ | |
914 CBMsend[i].updtNum = updtNum; | |
915 CBMsend[i].pageNum = 0; | |
916 cmhSAT_CBMUpdateList( i ); | |
917 | |
918 return TRUE; | |
919 } | |
920 | |
921 | |
922 /* check if message contains more than one page */ | |
923 if ( pageTotal > 1 ) | |
924 { | |
925 /* check if page is send to SIM */ | |
926 if ( pageNum > CBMsend[i].pageNum ) | |
927 { | |
928 /* mark page now as send for next CBM */ | |
929 CBMsend[i].pageNum = pageNum; | |
930 cmhSAT_CBMUpdateList( i ); | |
931 | |
932 /* page is not yet send to SIM */ | |
933 return TRUE; | |
934 } | |
935 } | |
936 | |
937 /* CBM is not new */ | |
938 return FALSE; | |
939 } | |
940 } | |
941 | |
942 /*---------------------------------------------------------------- | |
943 * mark CBM as send to SIM: insert into list | |
944 *---------------------------------------------------------------*/ | |
945 | |
946 cmhSAT_CBMAddToList( i, msgIdent, msgCode, updtNum, pageNum ); | |
947 | |
948 return TRUE; | |
949 } | |
950 | |
951 /* | |
952 +-------------------------------------------------------------------+ | |
953 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
954 | ROUTINE : cmhSAT_verifyNewLocInfo | | |
955 +-------------------------------------------------------------------+ | |
956 | |
957 PURPOSE : This function verifies the current MM PLMN information | |
958 with the one already stored by SAT and indicates TRUE if | |
959 the information has changed | |
960 | |
961 */ | |
962 LOCAL BOOL cmhSAT_verifyNewLocInfo () | |
963 { | |
964 if (satShrdPrm.locInfo.regStatus EQ mmShrdPrm.regStat) | |
965 { | |
966 /* If registration status is full service, check to proceed | |
967 if the location information has changed*/ | |
968 if (satShrdPrm.locInfo.regStatus EQ RS_FULL_SRV) | |
969 { | |
970 if( memcmp (mmShrdPrm.usedPLMN.mcc, satShrdPrm.locInfo.currPLMN.mcc, SIZE_MCC) EQ 0 | |
971 AND memcmp (mmShrdPrm.usedPLMN.mnc, satShrdPrm.locInfo.currPLMN.mnc, SIZE_MNC) EQ 0 | |
972 AND mmShrdPrm.lac EQ satShrdPrm.locInfo.lac AND mmShrdPrm.cid EQ satShrdPrm.locInfo.cid) | |
973 { | |
974 return FALSE; | |
975 } | |
976 } | |
977 } | |
978 | |
979 satShrdPrm.locInfo.regStatus = mmShrdPrm.regStat; | |
980 | |
981 /* The other information is updated only if ME is in full service mode */ | |
982 if (satShrdPrm.locInfo.regStatus EQ RS_FULL_SRV) | |
983 { | |
984 satShrdPrm.locInfo.cid = mmShrdPrm.cid; | |
985 satShrdPrm.locInfo.lac = mmShrdPrm.lac; | |
986 satShrdPrm.locInfo.currPLMN.v_plmn = mmShrdPrm.usedPLMN.v_plmn; | |
987 memcpy(satShrdPrm.locInfo.currPLMN.mcc, mmShrdPrm.usedPLMN.mcc, SIZE_MCC); | |
988 memcpy(satShrdPrm.locInfo.currPLMN.mnc, mmShrdPrm.usedPLMN.mnc, SIZE_MNC); | |
989 } | |
990 | |
991 return TRUE; | |
992 } | |
993 | |
994 | |
995 /* | |
996 +-------------------------------------------------------------------+ | |
997 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
998 | ROUTINE : cmhSAT_DatDwnLdCB | | |
999 +-------------------------------------------------------------------+ | |
1000 | |
1001 PURPOSE : This function supports the data download to SIM via cell | |
1002 broadcast messages. | |
1003 | |
1004 */ | |
1005 | |
1006 GLOBAL T_ACI_RETURN cmhSAT_DatDwnLdCB ( UBYTE* cbMsg, SHORT cbLen ) | |
1007 { | |
1008 | |
1009 TRACE_FUNCTION("cmhSAT_DatDwnLdCB()"); | |
1010 | |
1011 /* | |
1012 *------------------------------------------------------------------- | |
1013 * build envelope | |
1014 *------------------------------------------------------------------- | |
1015 */ | |
1016 CCD_START; | |
1017 psaSAT_BuildEnvCB ( cbMsg, cbLen ); | |
1018 | |
1019 satShrdPrm.owner = OWN_SRC_INV; | |
1020 | |
1021 satShrdPrm.Cbch_EvtDnl = TRUE; | |
1022 | |
1023 /* only if CBM is not yet send to SIM, CBM shall be send to SIM */ | |
1024 if ( cmhSAT_CBMIsNewMsg( cbMsg ) ) | |
1025 { | |
1026 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
1027 { | |
1028 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
1029 CCD_END; | |
1030 return( AT_FAIL ); | |
1031 } | |
1032 } | |
1033 | |
1034 CCD_END; | |
1035 | |
1036 return( AT_CMPL ); | |
1037 | |
1038 } | |
1039 | |
1040 /* | |
1041 +-------------------------------------------------------------------+ | |
1042 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1043 | ROUTINE : cmhSAT_MoSmCntr | | |
1044 +-------------------------------------------------------------------+ | |
1045 | |
1046 PURPOSE : This function supports the MO SM control. | |
1047 | |
1048 */ | |
1049 | |
1050 GLOBAL T_ACI_RETURN cmhSAT_MoSmCntr ( T_rp_addr sc_addr, | |
1051 T_tp_da dest_addr, | |
1052 UBYTE own) | |
1053 { | |
1054 | |
1055 TRACE_FUNCTION("cmhSAT_MoSmCntr()"); | |
1056 | |
1057 /* | |
1058 *------------------------------------------------------------------- | |
1059 * check if Call Control customization is enabled... if yes return AT_CMPL | |
1060 *------------------------------------------------------------------- | |
1061 */ | |
1062 | |
1063 if(cuscfgParams.MO_SM_Control_SIM EQ CUSCFG_STAT_Enabled) | |
1064 { | |
1065 return( AT_CMPL ); | |
1066 } | |
1067 | |
1068 | |
1069 /* | |
1070 *------------------------------------------------------------------- | |
1071 * check if a call control request is in progress | |
1072 *------------------------------------------------------------------- | |
1073 */ | |
1074 if( satShrdPrm.SIMCCParm.busy EQ TRUE ) return( AT_BUSY ); | |
1075 | |
1076 | |
1077 /* | |
1078 *------------------------------------------------------------------- | |
1079 * build envelope | |
1080 *------------------------------------------------------------------- | |
1081 */ | |
1082 CCD_START; | |
1083 psaSAT_BuildEnvMoSmCntr ( sc_addr, dest_addr ); | |
1084 | |
1085 satShrdPrm.SIMCCParm.ccAct = SMC_ACT_MO; | |
1086 satShrdPrm.SIMCCParm.owner = own; | |
1087 satShrdPrm.SIMCCParm.busy = TRUE; | |
1088 | |
1089 satShrdPrm.owner = OWN_SRC_INV; | |
1090 | |
1091 satShrdPrm.Cbch_EvtDnl = FALSE; | |
1092 | |
1093 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
1094 { | |
1095 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
1096 CCD_END; | |
1097 return( AT_FAIL ); | |
1098 } | |
1099 | |
1100 CCD_END; | |
1101 return( AT_EXCT ); | |
1102 | |
1103 } | |
1104 | |
1105 /* | |
1106 +-------------------------------------------------------------------+ | |
1107 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1108 | ROUTINE : cmhSAT_EventDwn | | |
1109 +-------------------------------------------------------------------+ | |
1110 | |
1111 PURPOSE : This function supports Event download. | |
1112 | |
1113 */ | |
1114 | |
1115 GLOBAL T_ACI_RETURN cmhSAT_EventDwn ( UBYTE event, SHORT callId , T_CC_INITIATER actionSrc ) | |
1116 { | |
1117 | |
1118 TRACE_FUNCTION("cmhSAT_EventDwn()"); | |
1119 | |
1120 /* If the event is Location info download, event download is sent only | |
1121 if the location information has changed or has been updated */ | |
1122 if (event EQ EVENT_LOC_STATUS AND !cmhSAT_verifyNewLocInfo ()) | |
1123 { | |
1124 TRACE_EVENT("No update for SIM app"); | |
1125 return AT_CMPL; | |
1126 } | |
1127 | |
1128 | |
1129 /* | |
1130 *------------------------------------------------------------------- | |
1131 * build envelope | |
1132 *------------------------------------------------------------------- | |
1133 */ | |
1134 CCD_START; | |
1135 | |
1136 /* if events were queued, send them */ | |
1137 if (satShrdPrm.event.c_queued) | |
1138 { | |
1139 do | |
1140 { | |
1141 T_SAT_QUEUE *p_queue; | |
1142 | |
1143 satShrdPrm.event.c_queued--; | |
1144 p_queue = &satShrdPrm.event.queued[satShrdPrm.event.c_queued]; | |
1145 | |
1146 satShrdPrm.owner = p_queue->owner; | |
1147 satShrdPrm.Cbch_EvtDnl = TRUE; | |
1148 if (psaSAT_STKEnvelope(p_queue->stk_cmd) < 0) /* envelope STK command */ | |
1149 { | |
1150 /* ignore event if error */ | |
1151 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
1152 } | |
1153 p_queue->stk_cmd = NULL; | |
1154 } | |
1155 while (satShrdPrm.event.c_queued); | |
1156 } | |
1157 else | |
1158 { | |
1159 if (!psaSAT_BuildEnvEventDwn ( event , callId, actionSrc )) | |
1160 { | |
1161 CCD_END; | |
1162 return AT_BUSY; | |
1163 } | |
1164 | |
1165 /*satShrdPrm.SIMCCParm.busy = TRUE;*/ | |
1166 | |
1167 satShrdPrm.owner = OWN_SRC_INV; | |
1168 | |
1169 satShrdPrm.Cbch_EvtDnl = TRUE; | |
1170 | |
1171 if( psaSAT_STKEnvelope (NULL) < 0 ) /* envelope STK command */ | |
1172 { | |
1173 TRACE_EVENT( "FATAL RETURN SAT in send env" ); | |
1174 CCD_END; | |
1175 return( AT_FAIL ); | |
1176 } | |
1177 } | |
1178 | |
1179 CCD_END; | |
1180 return( AT_CMPL ); | |
1181 | |
1182 } | |
1183 | |
1184 /* | |
1185 +-------------------------------------------------------------------+ | |
1186 | PROJECT : MODULE : SAT | | |
1187 | ROUTINE : cmhSAT_LaunchBrowser | | |
1188 +-------------------------------------------------------------------+ | |
1189 | |
1190 PURPOSE : | |
1191 | |
1192 */ | |
1193 GLOBAL BOOL cmhSAT_launchBrowser (T_LAUNCH_BROWSER* launchBrowser) | |
1194 { | |
1195 T_ACI_SAT_TERM_RESP resp_data; | |
1196 | |
1197 /* check for busy SS condition */ | |
1198 if (psaSS_stbFindActSrv (NO_ENTRY) NEQ NO_ENTRY) | |
1199 { | |
1200 /* respond with "error, ME currently unable to process command" */ | |
1201 resp_data.add_content = ADD_ME_SS_BUSY; | |
1202 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1203 return( FALSE ); /* unused */ | |
1204 } | |
1205 | |
1206 #if defined(MFW) AND defined(FF_WAP) | |
1207 rAT_PercentSATBROW (launchBrowser); /* Info 718: Symbol undeclared, assumed to return int */ | |
1208 return( TRUE ); /* unused */ | |
1209 #else | |
1210 cmhSAT_STKCmdInd(); | |
1211 return( FALSE ); /* unused */ | |
1212 #endif | |
1213 | |
1214 } | |
1215 | |
1216 | |
1217 /* | |
1218 +-------------------------------------------------------------------+ | |
1219 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1220 | ROUTINE : cmhSAT_provLocalInfo | | |
1221 +-------------------------------------------------------------------+ | |
1222 | |
1223 PURPOSE : This function supports Provide Local Information for | |
1224 Date, time and time zone. | |
1225 | |
1226 */ | |
1227 GLOBAL BOOL cmhSAT_provLocalInfo () | |
1228 { | |
1229 T_ACI_SAT_TERM_RESP resp_data; | |
1230 rtc_time_type rtc_time; | |
1231 | |
1232 pcm_FileInfo_Type fileInfo; | |
1233 EF_CLNG lng; | |
1234 | |
1235 | |
1236 TRACE_FUNCTION("cmhSAT_provLocalInfo()"); | |
1237 | |
1238 psaSAT_InitTrmResp( &resp_data ); | |
1239 | |
1240 #ifndef _SIMULATION_ | |
1241 /* if no service is currently available */ | |
1242 if ((mmShrdPrm.regStat EQ RS_NO_SRV) OR (mmShrdPrm.regStat EQ NO_VLD_RS)) | |
1243 { | |
1244 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1245 return(FALSE); | |
1246 } | |
1247 #endif | |
1248 | |
1249 if (satShrdPrm.cmdDet.cmdQlf NEQ QLF_PLOI_DTT AND (satShrdPrm.cmdDet.cmdQlf NEQ QLF_PLOI_LANG_SET)) | |
1250 { | |
1251 return (FALSE); | |
1252 } | |
1253 | |
1254 if (satShrdPrm.cmdDet.cmdQlf EQ QLF_PLOI_DTT) | |
1255 { | |
1256 if ( rtc_read_time ( &rtc_time ) EQ TRUE ) | |
1257 { | |
1258 int i = 0; | |
1259 UBYTE hex2bcd; | |
1260 | |
1261 resp_data.dtt_buf[0] = rtc_time.year; | |
1262 resp_data.dtt_buf[1] = rtc_time.month; | |
1263 resp_data.dtt_buf[2] = rtc_time.day; | |
1264 resp_data.dtt_buf[3] = rtc_time.hour; | |
1265 resp_data.dtt_buf[4] = rtc_time.minute; | |
1266 resp_data.dtt_buf[5] = rtc_time.second; | |
1267 while(i<TIME_STAMP_LENGTH) | |
1268 { | |
1269 hex2bcd = 0; | |
1270 hex2bcd = hex2bcd + resp_data.dtt_buf[i] / 0x0A; | |
1271 hex2bcd = hex2bcd << 4; | |
1272 hex2bcd = hex2bcd + resp_data.dtt_buf[i] % 0x0A; | |
1273 resp_data.dtt_buf[i] = ((hex2bcd & 0x0F) << 4) + ((hex2bcd & 0xF0) >> 4); | |
1274 i++; | |
1275 } | |
1276 #ifdef _SIMULATION_ | |
1277 memset(resp_data.dtt_buf, 0xA0, 6); | |
1278 #endif /* _SIMULATION_ */ | |
1279 | |
1280 resp_data.dtt_buf[6] = mmShrdPrm.tz; | |
1281 | |
1282 if (mmShrdPrm.regStat EQ RS_LMTD_SRV) | |
1283 { | |
1284 psaSAT_SendTrmResp( RSLT_PERF_LIM_SRV, &resp_data ); | |
1285 } | |
1286 else | |
1287 { | |
1288 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
1289 } | |
1290 } | |
1291 else | |
1292 { | |
1293 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1294 return (FALSE); | |
1295 } | |
1296 } | |
1297 else /* Expecting LS Qualifier */ | |
1298 { | |
1299 /* Implements Measure#32: Row 1023 */ | |
1300 if (pcm_GetFileInfo ( ( UBYTE* ) ef_clng_id, &fileInfo) NEQ PCM_OK) | |
1301 { | |
1302 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1303 return (FALSE); | |
1304 } | |
1305 else | |
1306 { | |
1307 /* Implements Measure#32: Row 1023 */ | |
1308 if (pcm_ReadFile( (UBYTE*)ef_clng_id, | |
1309 fileInfo.FileSize, | |
1310 (UBYTE*) &lng, | |
1311 &fileInfo.Version) EQ PCM_OK ) | |
1312 { | |
1313 | |
1314 /*------------------------------------------------------------------- | |
1315 * Read EF ELP or LP from the sim if Automatic language is selected | |
1316 *------------------------------------------------------------------- | |
1317 */ | |
1318 | |
1319 /* Implements Measure#32: Row 1024 */ | |
1320 if (!memcmp(lng.data, au_str, CLAN_CODE_LEN)) | |
1321 { | |
1322 /* Implements Measure 119 */ | |
1323 if (cmhSIM_ReqLanguagePrf_LP_or_ELP ( SIM_ELP, ACI_LEN_LAN_FLD, | |
1324 CLANSimEfData, | |
1325 cmhSIM_RdCnfLangPrfELP) EQ FALSE) | |
1326 { | |
1327 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1328 return (FALSE); | |
1329 } | |
1330 } | |
1331 else | |
1332 { | |
1333 memcpy(&resp_data.lang, &lng.data[0], CLAN_CODE_LEN); | |
1334 | |
1335 #ifdef _SIMULATION_ | |
1336 memset(resp_data.lang, 0xA0, 2); | |
1337 #endif | |
1338 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
1339 } | |
1340 | |
1341 } | |
1342 else | |
1343 { | |
1344 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1345 return (FALSE); | |
1346 } | |
1347 } | |
1348 } | |
1349 return(TRUE); | |
1350 } | |
1351 | |
1352 | |
1353 /* | |
1354 +-------------------------------------------------------------------+ | |
1355 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1356 | ROUTINE : cmhSAT_setupCall | | |
1357 +-------------------------------------------------------------------+ | |
1358 | |
1359 PURPOSE : | |
1360 | |
1361 */ | |
1362 | |
1363 GLOBAL BOOL cmhSAT_setupCall ( T_SETUP_CALL * cal ) | |
1364 { | |
1365 T_CC_CALL_TBL *ctb; /* pointer to call table associated with cId */ | |
1366 T_ACI_RETURN retVal; /* holds return value */ | |
1367 SHORT cId; /* holds call id */ | |
1368 UBYTE idx; /* holds index */ | |
1369 T_ACI_SAT_TERM_RESP resp_data; | |
1370 #ifdef FF_SAT_E | |
1371 T_ACI_SATA_ADD addPrm; | |
1372 #endif /* FF_SAT_E */ | |
1373 SHORT decodeRet; | |
1374 | |
1375 psaSAT_InitTrmResp( &resp_data ); | |
1376 | |
1377 TRACE_FUNCTION("cmhSAT_setupCall()"); | |
1378 | |
1379 //TISH, patch for OMAPS00141208&OMAPS00141392 | |
1380 //start | |
1381 #if 0 | |
1382 //TISH patch | |
1383 //start | |
1384 if(mmShrdPrm.regStat NEQ RS_FULL_SRV) | |
1385 { | |
1386 resp_data.add_content = ADD_ME_NO_SERV; | |
1387 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1388 return FALSE ; | |
1389 } | |
1390 //end | |
1391 #else | |
1392 if(mmShrdPrm.regStat EQ RS_NO_SRV) | |
1393 { | |
1394 resp_data.add_content = ADD_ME_NO_SERV; | |
1395 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1396 return FALSE ; | |
1397 } | |
1398 #endif | |
1399 // add end | |
1400 /* | |
1401 *------------------------------------------------------------------- | |
1402 * get call table entry | |
1403 *------------------------------------------------------------------- | |
1404 */ | |
1405 cId = psaCC_ctbNewEntry(); | |
1406 | |
1407 if( cId EQ NO_ENTRY ) | |
1408 { | |
1409 /* send SAT response */ | |
1410 resp_data.add_content = ADD_NO_CAUSE; | |
1411 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1412 return( FALSE ); /* primitive not needed anymore */ | |
1413 } | |
1414 | |
1415 ctb = ccShrdPrm.ctb[cId]; | |
1416 | |
1417 /* | |
1418 *------------------------------------------------------------------- | |
1419 * build setup parameters | |
1420 *------------------------------------------------------------------- | |
1421 */ | |
1422 /* check dial number */ | |
1423 if( !cal->v_addr ) | |
1424 { | |
1425 /* respond with "error, required values are missing" */ | |
1426 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
1427 psaCC_FreeCtbNtry (cId); | |
1428 return( FALSE ); | |
1429 } | |
1430 | |
1431 cmhSAT_fillSetupPrm ( cId, /* cId is valid */ | |
1432 ((cal->v_addr)?&cal->addr:NULL), | |
1433 ((cal->v_subaddr)?&cal->subaddr:NULL)); | |
1434 | |
1435 //TISH, patch for OMAPS00141208&OMAPS00141392 | |
1436 //start | |
1437 if(mmShrdPrm.regStat EQ RS_LMTD_SRV AND ctb->prio EQ 0) //PRIO_NORM_CALL | |
1438 { | |
1439 resp_data.add_content = ADD_ME_NO_SERV; | |
1440 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1441 psaCC_FreeCtbNtry (cId); | |
1442 return FALSE ; | |
1443 } | |
1444 //end | |
1445 /* check aoc condition */ | |
1446 if ((ctb->prio EQ MNCC_PRIO_NORM_CALL) AND | |
1447 (aoc_check_moc() EQ FALSE)) | |
1448 /* | |
1449 * check ACM exceeds ACMmax | |
1450 * for non-emergency calls | |
1451 */ | |
1452 { | |
1453 resp_data.add_content = ADD_NO_CAUSE; | |
1454 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1455 psaCC_FreeCtbNtry (cId); | |
1456 return( FALSE ); | |
1457 } | |
1458 | |
1459 /* declare the owner and status of the call */ | |
1460 ctb->calOwn = OWN_SRC_SAT; | |
1461 ctb->calStat = CS_SAT_REQ; | |
1462 ctb->curCmd = AT_CMD_D; | |
1463 ctb->SATinv = TRUE; | |
1464 | |
1465 /* Flag the Sat Call */ | |
1466 satShrdPrm.ownSAT = TRUE; | |
1467 | |
1468 | |
1469 /* Update the Duration */ | |
1470 cmhSAT_ChckRedial(cId, cal->v_dur, &cal->dur); | |
1471 | |
1472 /* bearer capabilities */ | |
1473 if ( cal->v_cap_cnf_parms EQ 0 ) | |
1474 { | |
1475 /* | |
1476 * no bearer capabilities => set to speech | |
1477 * this function was called for a SIM_TOOLKIT_IND | |
1478 */ | |
1479 cmhSAT_fillSetupBC ( cId, MNCC_BEARER_SERV_SPEECH, MNCC_BEARER_SERV_NOT_PRES ); | |
1480 memset( &satShrdPrm.stk_ccp, 0, sizeof(BUF_cap_cnf_parms)); | |
1481 } | |
1482 else | |
1483 { | |
1484 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
1485 satShrdPrm.capParm.cId = cId; | |
1486 satShrdPrm.capParm.cntxt = CTX_SAT_SETUP; | |
1487 | |
1488 /* Store the cpp */ | |
1489 memcpy( &satShrdPrm.stk_ccp, &cal->cap_cnf_parms, sizeof(BUF_cap_cnf_parms)); | |
1490 | |
1491 /* check cc by sim service is activated and allocated */ | |
1492 if ( ! psaSIM_ChkSIMSrvSup( SRV_CalCntrl )) | |
1493 { | |
1494 /* SetUpCall Contains one cap_cnf_parms */ | |
1495 decodeRet = psaCC_BCapDecode ( BCRI_SAT, | |
1496 cal->cap_cnf_parms.b_cap_cnf_parms[0], | |
1497 cal->cap_cnf_parms.b_cap_cnf_parms+1 , | |
1498 0, | |
1499 NULL ); | |
1500 if ( decodeRet < 0 ) | |
1501 { | |
1502 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1503 psaCC_FreeCtbNtry (cId); | |
1504 return( FALSE ); | |
1505 } | |
1506 else | |
1507 { | |
1508 return ( TRUE ); | |
1509 } | |
1510 } | |
1511 } | |
1512 | |
1513 /* | |
1514 *------------------------------------------------------------------- | |
1515 * check for emergency call | |
1516 *------------------------------------------------------------------- | |
1517 */ | |
1518 if( ctb->prio EQ MNCC_PRIO_EMERG_CALL ) | |
1519 { | |
1520 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1521 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) | |
1522 { | |
1523 /* | |
1524 * Clear the call table entry as it will be re-created when the MMI | |
1525 * requests the emergency call setup | |
1526 */ | |
1527 psaCC_FreeCtbNtry (cId); | |
1528 | |
1529 /* | |
1530 ** Send the original Setup Call Request to the MMI in a %SATI indication | |
1531 */ | |
1532 cmhSAT_Cust1StkCmdInd(); | |
1533 } | |
1534 else | |
1535 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1536 { | |
1537 /* alert user */ | |
1538 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
1539 { | |
1540 | |
1541 #ifdef FF_SAT_E | |
1542 addPrm.chnType = SATA_CT_VOICE; | |
1543 addPrm.chnEst = SATA_EST_IM; | |
1544 | |
1545 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, | |
1546 cmhSAT_ChckRedial(cId, cal->v_dur, &cal->dur), | |
1547 &addPrm); | |
1548 #else /* FF_SAT_E */ | |
1549 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, | |
1550 cmhSAT_ChckRedial(cId, cal->v_dur, &cal->dur)); | |
1551 #endif /* FF_SAT_E */ | |
1552 } | |
1553 } | |
1554 | |
1555 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
1556 return( TRUE ); | |
1557 } | |
1558 | |
1559 /* | |
1560 *------------------------------------------------------------------- | |
1561 * check for call control by SIM | |
1562 *------------------------------------------------------------------- | |
1563 */ | |
1564 | |
1565 retVal = cmhSAT_CalCntrlBySIM( cId ); | |
1566 | |
1567 | |
1568 switch( retVal ) | |
1569 { | |
1570 case( AT_EXCT ): | |
1571 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
1572 return( TRUE ); | |
1573 | |
1574 case( AT_BUSY ): | |
1575 /* respond with "Interaction with call control by SIM, temporary" */ | |
1576 psaSAT_SendTrmResp( RSLT_CC_SIM_TMP, &resp_data ); | |
1577 psaCC_FreeCtbNtry (cId); | |
1578 return( FALSE ); | |
1579 | |
1580 case( AT_FAIL ): | |
1581 /* respond with "Interaction with call control by SIM, permanent" */ | |
1582 resp_data.add_content = ADD_NO_CAUSE; | |
1583 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data ); | |
1584 psaCC_FreeCtbNtry (cId); | |
1585 return( FALSE ); | |
1586 | |
1587 case( AT_CMPL): | |
1588 TRACE_EVENT_P1("Restoring the Cid = %d",cId); | |
1589 satShrdPrm.SIMCCParm.cId = cId; | |
1590 break; | |
1591 } | |
1592 | |
1593 /* | |
1594 *------------------------------------------------------------------- | |
1595 * alert user if command details are supported | |
1596 *------------------------------------------------------------------- | |
1597 */ | |
1598 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1599 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) | |
1600 { | |
1601 /* | |
1602 * Clear the call table entry as it will be re-created when the MMI | |
1603 * requests the emergency call setup | |
1604 */ | |
1605 psaCC_FreeCtbNtry (cId); | |
1606 | |
1607 /* | |
1608 ** Send the original Setup Call Request to the MMI in a %SATI indication | |
1609 */ | |
1610 cmhSAT_Cust1StkCmdInd(); | |
1611 | |
1612 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
1613 return( TRUE ); | |
1614 } | |
1615 else if( cmhSAT_ChckCmdDet() ) | |
1616 #else | |
1617 if( cmhSAT_ChckCmdDet() ) | |
1618 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1619 { | |
1620 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
1621 { | |
1622 | |
1623 /* | |
1624 ** If cust_mode is not NORMAL_BEHAVIOUR, then don't do anything yet, because the | |
1625 ** %SATI indication will be sent later in the process | |
1626 */ | |
1627 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1628 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_NORMAL_BEHAVIOUR) | |
1629 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1630 { | |
1631 #ifdef FF_SAT_E | |
1632 addPrm.chnType = SATA_CT_VOICE; | |
1633 addPrm.chnEst = SATA_EST_IM; | |
1634 | |
1635 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, | |
1636 cmhSAT_ChckRedial(cId, cal->v_dur, &cal->dur), | |
1637 &addPrm); | |
1638 #else /* FF_SAT_E */ | |
1639 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, | |
1640 cmhSAT_ChckRedial(cId, cal->v_dur, &cal->dur)); | |
1641 #endif /* FF_SAT_E */ | |
1642 | |
1643 } | |
1644 } | |
1645 | |
1646 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
1647 return( TRUE ); | |
1648 } | |
1649 | |
1650 psaCC_FreeCtbNtry (cId); | |
1651 return( FALSE ); | |
1652 } | |
1653 | |
1654 /* | |
1655 +-------------------------------------------------------------------+ | |
1656 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1657 | ROUTINE : cmhSAT_sendSS | | |
1658 +-------------------------------------------------------------------+ | |
1659 | |
1660 PURPOSE : This function starts a SS transaction initiated by SAT. | |
1661 If the request is going to be processed, the function | |
1662 returns TRUE. | |
1663 | |
1664 */ | |
1665 | |
1666 GLOBAL BOOL cmhSAT_sendSS ( T_SEND_SS * ss ) | |
1667 { | |
1668 T_ACI_RETURN retVal; /* holds return value */ | |
1669 T_ACI_D_CLIR_OVRD dummy2; /* dummy value */ | |
1670 T_ACI_D_TOC dummy1; /* dummy value */ | |
1671 T_ACI_SAT_TERM_RESP resp_data; | |
1672 | |
1673 psaSAT_InitTrmResp( &resp_data ); | |
1674 | |
1675 TRACE_FUNCTION("cmhSAT_sendSS()"); | |
1676 | |
1677 // TISH patch for OMAPS00109462 | |
1678 if(mmShrdPrm.regStat NEQ RS_FULL_SRV) | |
1679 { | |
1680 resp_data.add_content = ADD_ME_NO_SERV; | |
1681 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1682 return FALSE ; | |
1683 } | |
1684 | |
1685 // add end | |
1686 /* | |
1687 *------------------------------------------------------------------- | |
1688 * build SS string | |
1689 *------------------------------------------------------------------- | |
1690 */ | |
1691 if( (!ss->v_ss_string) OR | |
1692 (((ss->v_icon) AND (ss->icon.icon_qu & 0x1)) AND (!ss->v_alpha_id))) | |
1693 { | |
1694 /*---------------------------------------------------------------- | |
1695 * respond with "error, required values are missing" OR | |
1696 * Icon information present in SIM_TOOLKIT_IND and icon qualifier is | |
1697 * not self-explanatory(11.14) and no alpha identifier is present, | |
1698 * response should be given with Command data not understood by ME | |
1699 *---------------------------------------------------------------- | |
1700 */ | |
1701 psaSAT_SendTrmResp( RSLT_UNKN_DATA, &resp_data ); | |
1702 return( FALSE ); | |
1703 } | |
1704 | |
1705 if ( !ss->ss_string.c_ss_ctrl_string ) | |
1706 { | |
1707 psaSAT_SendTrmResp(RSLT_ERR_REQ_VAL, &resp_data ); | |
1708 return( FALSE ); | |
1709 } | |
1710 | |
1711 | |
1712 cmhCC_init_cldPty( &satPndSetup.clpty ); | |
1713 | |
1714 utl_BCD2DialStr( ss->ss_string.ss_ctrl_string, satPndSetup.clpty.num, | |
1715 (UBYTE)MINIMUM(ss->ss_string.c_ss_ctrl_string, | |
1716 MAX_DIAL_LEN-1)); | |
1717 | |
1718 satPndSetup.clpty.ton = ss->ss_string.noa; | |
1719 satPndSetup.clpty.npi = ss->ss_string.npi; | |
1720 | |
1721 /* | |
1722 *------------------------------------------------------------------- | |
1723 * check for call control by SIM | |
1724 *------------------------------------------------------------------- | |
1725 */ | |
1726 retVal = cmhSAT_SSCntrlBySIM( &satPndSetup.clpty, OWN_SRC_SAT ); | |
1727 | |
1728 switch( retVal ) | |
1729 { | |
1730 case( AT_EXCT ): | |
1731 satShrdPrm.ntfy = USR_NTF_SEND_SS; | |
1732 return( TRUE ); | |
1733 | |
1734 case( AT_BUSY ): | |
1735 /* respond with "Interaction with call control by SIM, temporary" */ | |
1736 psaSAT_SendTrmResp( RSLT_CC_SIM_TMP, &resp_data ); | |
1737 return( FALSE ); | |
1738 | |
1739 case( AT_FAIL ): | |
1740 /* respond with "Interaction with call control by SIM, permanent" */ | |
1741 resp_data.add_content = ADD_NO_CAUSE; | |
1742 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data ); | |
1743 return( FALSE ); | |
1744 } | |
1745 | |
1746 /* | |
1747 *------------------------------------------------------------------- | |
1748 * check for busy SS condition | |
1749 *------------------------------------------------------------------- | |
1750 */ | |
1751 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY ) | |
1752 { | |
1753 /* respond with "error, ME currently unable to process command" */ | |
1754 resp_data.add_content = ADD_ME_SS_BUSY; | |
1755 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1756 return( FALSE ); | |
1757 } | |
1758 | |
1759 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1760 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) | |
1761 { | |
1762 /* | |
1763 ** Send the original SendSS Request to the MMI in a %SATI indication | |
1764 */ | |
1765 cmhSAT_Cust1StkCmdInd(); | |
1766 | |
1767 satShrdPrm.ntfy = USR_NTF_SEND_SS; | |
1768 return( TRUE ); | |
1769 } | |
1770 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1771 /* | |
1772 *------------------------------------------------------------------- | |
1773 * decode and send SS string | |
1774 *------------------------------------------------------------------- | |
1775 */ | |
1776 retVal = cmhCC_chkKeySeq ( (T_ACI_CMD_SRC)OWN_SRC_SAT, | |
1777 &satPndSetup.clpty, | |
1778 &dummy1, | |
1779 &dummy2, | |
1780 CC_SIM_NO ); | |
1781 if( retVal NEQ AT_EXCT ) | |
1782 { | |
1783 /* respond with "error, beyond ME capabilities" */ | |
1784 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
1785 return( FALSE ); | |
1786 } | |
1787 | |
1788 satShrdPrm.ntfy = USR_NTF_SEND_SS; | |
1789 return( TRUE ); | |
1790 | |
1791 } | |
1792 | |
1793 /* | |
1794 +-------------------------------------------------------------------+ | |
1795 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1796 | ROUTINE : cmhSAT_sendUSSD | | |
1797 +-------------------------------------------------------------------+ | |
1798 | |
1799 PURPOSE : This function starts a USSD transaction initiated by SAT. | |
1800 If the request is going to be processed, the function | |
1801 returns TRUE. | |
1802 | |
1803 */ | |
1804 | |
1805 GLOBAL BOOL cmhSAT_sendUSSD ( T_SEND_USSD * ussd ) | |
1806 { | |
1807 T_ACI_RETURN retVal; /* holds return value */ | |
1808 SHORT sId; /* holds service id */ | |
1809 T_ACI_SAT_TERM_RESP resp_data; | |
1810 T_sat_ussd SATCC_ussd; /* to hold USSD string in case of SAT Control */ | |
1811 | |
1812 psaSAT_InitTrmResp( &resp_data ); | |
1813 | |
1814 TRACE_FUNCTION("cmhSAT_sendUSSD()"); | |
1815 | |
1816 //TISH, patch for OMAPS00115020 | |
1817 //start | |
1818 if(mmShrdPrm.regStat NEQ RS_FULL_SRV) | |
1819 { | |
1820 resp_data.add_content = ADD_ME_NO_SERV; | |
1821 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1822 return FALSE ; | |
1823 } | |
1824 | |
1825 // add end | |
1826 /* | |
1827 *------------------------------------------------------------------- | |
1828 * build SS string | |
1829 *------------------------------------------------------------------- | |
1830 */ | |
1831 if( !ussd->v_ussd_string ) | |
1832 { | |
1833 /* respond with "error, required values are missing" */ | |
1834 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
1835 return( FALSE ); | |
1836 } | |
1837 | |
1838 /* | |
1839 *------------------------------------------------------------------- | |
1840 * Icon information present in SIM_TOOLKIT_IND and icon qualifier is | |
1841 * not self-explanatory(11.14) and no alpha identifier is present, | |
1842 * response should be given with Command data not understood by ME. | |
1843 *------------------------------------------------------------------- | |
1844 */ | |
1845 if(((ussd->v_icon) AND (ussd->icon.icon_qu & 0x1)) AND (!ussd->v_alpha_id)) | |
1846 { | |
1847 psaSAT_SendTrmResp(RSLT_UNKN_DATA, &resp_data ); | |
1848 return( FALSE ); | |
1849 } | |
1850 /* | |
1851 *------------------------------------------------------------------- | |
1852 * check for call control by SIM | |
1853 *------------------------------------------------------------------- | |
1854 */ | |
1855 if ( psaSIM_ChkSIMSrvSup(SRV_USSDsupportInCC) ) | |
1856 { | |
1857 SATCC_ussd.dcs = ussd->ussd_string.dcs; | |
1858 SATCC_ussd.c_ussd_str = ussd->ussd_string.c_ussd_str; | |
1859 SATCC_ussd.ussd_str = ussd->ussd_string.ussd_str; | |
1860 | |
1861 retVal = cmhSAT_USSDCntrlBySIM( &SATCC_ussd, OWN_SRC_SAT ); | |
1862 | |
1863 switch( retVal ) | |
1864 { | |
1865 case( AT_EXCT ): | |
1866 satShrdPrm.ntfy = USR_NTF_SEND_USSD; | |
1867 return( TRUE ); | |
1868 | |
1869 case( AT_BUSY ): | |
1870 /* respond with "Interaction with call control by SIM, temporary" */ | |
1871 psaSAT_SendTrmResp( RSLT_CC_SIM_TMP, &resp_data ); | |
1872 return( FALSE ); | |
1873 | |
1874 case( AT_FAIL ): | |
1875 /* respond with "Interaction with call control by SIM, permanent" */ | |
1876 resp_data.add_content = ADD_NO_CAUSE; | |
1877 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data ); | |
1878 return( FALSE ); | |
1879 } | |
1880 } | |
1881 | |
1882 /*********************************************************** | |
1883 check if a SS or a USSD transaction is already in process | |
1884 ***********************************************************/ | |
1885 | |
1886 sId = psaSS_stbFindActSrv( NO_ENTRY ); | |
1887 | |
1888 if( sId NEQ NO_ENTRY ) | |
1889 { | |
1890 if (ssShrdPrm.stb[sId].curCmd EQ ((T_ACI_AT_CMD)KSD_CMD_USSD) | |
1891 OR ssShrdPrm.stb[sId].curCmd EQ AT_CMD_CUSD) | |
1892 resp_data.add_content = ADD_ME_USSD_BUSY; | |
1893 else | |
1894 resp_data.add_content = ADD_ME_SS_BUSY; | |
1895 | |
1896 resp_data.addLen = 1; | |
1897 | |
1898 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1899 return( FALSE ); | |
1900 } | |
1901 | |
1902 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1903 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) | |
1904 { | |
1905 /* | |
1906 ** Send the original SendSS Request to the MMI in a %SATI indication | |
1907 */ | |
1908 cmhSAT_Cust1StkCmdInd(); | |
1909 | |
1910 satShrdPrm.ntfy = USR_NTF_SEND_USSD; | |
1911 return( TRUE ); | |
1912 } | |
1913 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1914 | |
1915 /* get new service table entry */ | |
1916 sId = psaSS_stbNewEntry(); | |
1917 if( sId EQ NO_ENTRY ) | |
1918 { | |
1919 resp_data.add_content = ADD_ME_USSD_BUSY; | |
1920 resp_data.addLen = 1; | |
1921 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
1922 return( FALSE ); | |
1923 } | |
1924 | |
1925 CCD_START; | |
1926 | |
1927 /* TLU: save DCS for USSD v1 */ | |
1928 ssShrdPrm.ussdDcs = ussd->ussd_string.dcs; | |
1929 | |
1930 /* set data coding scheme */ | |
1931 /* patch !!!!! CLB 11/12/01 */ | |
1932 if( (UBYTE)ussd->ussd_string.dcs EQ 0x40 ) | |
1933 { | |
1934 /* 0x40 means basically default alphabet... | |
1935 yet some asian networks dont seem to accept it (although using it | |
1936 in their own STK !!!) */ | |
1937 ussd->ussd_string.dcs = 0x0F; | |
1938 } | |
1939 /*********************************/ | |
1940 | |
1941 psaSS_asmProcUSSDReq( (UBYTE)ussd->ussd_string.dcs, | |
1942 ussd->ussd_string.ussd_str, | |
1943 ussd->ussd_string.c_ussd_str ); | |
1944 | |
1945 /* start new transaction */ | |
1946 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
1947 ssShrdPrm.stb[sId].curCmd = AT_CMD_NONE; | |
1948 ssShrdPrm.stb[sId].srvOwn = OWN_SRC_SAT; | |
1949 | |
1950 /* save ussd string for possible version 1 retry */ | |
1951 /* if( cmhSMS_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) NOT SURE ABOUT THAT !!!! clb */ | |
1952 { | |
1953 if( ussd->ussd_string.c_ussd_str <= MAX_USSD_STRING ) | |
1954 { | |
1955 ssShrdPrm.ussdLen = ussd->ussd_string.c_ussd_str; | |
1956 memcpy( ssShrdPrm.ussdBuf, | |
1957 ussd->ussd_string.ussd_str, | |
1958 ussd->ussd_string.c_ussd_str ); | |
1959 } | |
1960 } | |
1961 | |
1962 satShrdPrm.SentUSSDid = sId; /* save for response message */ | |
1963 | |
1964 psaSS_NewTrns(sId); | |
1965 | |
1966 CCD_END; | |
1967 | |
1968 return( TRUE ); | |
1969 | |
1970 } | |
1971 | |
1972 /* | |
1973 +-------------------------------------------------------------------+ | |
1974 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
1975 | ROUTINE : cmhSAT_sendDTMF | | |
1976 +-------------------------------------------------------------------+ | |
1977 | |
1978 PURPOSE : This function sends a DTMF sequence to the network. | |
1979 | |
1980 */ | |
1981 | |
1982 LOCAL BOOL cmhSAT_initDTMF ( T_SEND_DTMF *dtmf ) | |
1983 { | |
1984 SHORT cId; /* holds call id */ | |
1985 T_ACI_SAT_TERM_RESP resp_data; | |
1986 CHAR num[MNCC_MAX_CC_CALLED_NUMBER]; | |
1987 UBYTE i; | |
1988 USHORT length; | |
1989 | |
1990 | |
1991 TRACE_FUNCTION("cmhSAT_initDTMF()"); | |
1992 | |
1993 psaSAT_InitTrmResp( &resp_data ); | |
1994 | |
1995 cId = cmhCC_find_call_for_DTMF( ); | |
1996 if (cId EQ NO_ENTRY) | |
1997 { | |
1998 /* respond with "error, no speech call in process" */ | |
1999 resp_data.add_content = ADD_ME_NO_SPCH_CALL; | |
2000 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2001 return( FALSE ); | |
2002 } | |
2003 | |
2004 /* check arguments */ | |
2005 if( dtmf AND !dtmf->v_dtmf_string ) | |
2006 { | |
2007 /* respond with "error, required values are missing" */ | |
2008 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
2009 return( FALSE ); | |
2010 } | |
2011 else | |
2012 { | |
2013 length = MINIMUM((dtmf ? dtmf->dtmf_string.c_bcdDigit : 0), MNCC_MAX_CC_CALLED_NUMBER); | |
2014 if (dtmf NEQ NULL) | |
2015 { | |
2016 for(i=0; i<length; i++) | |
2017 { | |
2018 num[i] = cmhPHB_convertBCD2char(dtmf->dtmf_string.bcdDigit[i]); | |
2019 } | |
2020 } | |
2021 else | |
2022 num[0] = '\0'; | |
2023 | |
2024 cmhCC_chkDTMFDig( num, | |
2025 cId, | |
2026 length, | |
2027 FALSE ); | |
2028 | |
2029 ccShrdPrm.dtmf.cId = cId; /* Update the global parameter with cId */ | |
2030 psaCC_ctb(cId)->dtmfCmd = AT_CMD_NONE ; | |
2031 psaCC_ctb(cId)->dtmfSrc = OWN_SRC_SAT; /* wait for confirmation */ | |
2032 return TRUE; | |
2033 } | |
2034 } | |
2035 | |
2036 | |
2037 GLOBAL BOOL cmhSAT_sendDTMF ( T_SEND_DTMF *dtmf ) | |
2038 { | |
2039 SHORT cId; /* holds call id */ | |
2040 T_ACI_SAT_TERM_RESP resp_data; | |
2041 BOOL param_ok; | |
2042 | |
2043 TRACE_FUNCTION("cmhSAT_sendDTMF()"); | |
2044 | |
2045 psaSAT_InitTrmResp( &resp_data ); | |
2046 | |
2047 // TISH patch for OMAPS00109462 | |
2048 if(mmShrdPrm.regStat NEQ RS_FULL_SRV) | |
2049 { | |
2050 resp_data.add_content = ADD_ME_NO_SERV; | |
2051 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2052 return FALSE ; | |
2053 } | |
2054 | |
2055 // add end | |
2056 /* if no proceeding yet, check for a voice call */ | |
2057 if( ccShrdPrm.dtmf.cId NEQ NO_ENTRY ) | |
2058 { | |
2059 cId = ccShrdPrm.dtmf.cId; | |
2060 if (ccShrdPrm.ctb[cId] EQ NULL OR | |
2061 psaCC_ctb(cId)->dtmfSrc NEQ OWN_SRC_SAT ) | |
2062 { | |
2063 /* respond with "error, busy on DTMF" */ | |
2064 /* resp_data.add_content = ADD_ME_DTMF_BUSY; */ | |
2065 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2066 return( FALSE ); | |
2067 } | |
2068 } | |
2069 else | |
2070 { | |
2071 /* initialize DTMF related parameters */ | |
2072 if (!cmhSAT_initDTMF( dtmf )) | |
2073 return (FALSE); | |
2074 cId = ccShrdPrm.dtmf.cId; | |
2075 } | |
2076 | |
2077 /* send DTMF */ | |
2078 param_ok = cmhCC_SendDTMFdig ( AT_CMD_NONE, cId, | |
2079 ccShrdPrm.dtmf.dig[ccShrdPrm.dtmf.cur], | |
2080 MNCC_DTMF_MOD_AUTO); | |
2081 ccShrdPrm.dtmf.cur++; | |
2082 | |
2083 if( !param_ok ) | |
2084 { | |
2085 /* respond with "value not recognized" */ | |
2086 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
2087 return( FALSE ); | |
2088 } | |
2089 return( TRUE ); | |
2090 } | |
2091 | |
2092 /* | |
2093 +-------------------------------------------------------------------+ | |
2094 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2095 | ROUTINE : cmhSAT_runAt | | |
2096 +-------------------------------------------------------------------+ | |
2097 | |
2098 PURPOSE : This function performs run at command for SAT. | |
2099 */ | |
2100 | |
2101 GLOBAL BOOL cmhSAT_runAt ( T_RUN_AT *run_at) | |
2102 { | |
2103 T_ACI_SAT_TERM_RESP resp_data; | |
2104 | |
2105 psaSAT_InitTrmResp( &resp_data ); | |
2106 | |
2107 TRACE_FUNCTION("cmhSAT_runAt()"); | |
2108 | |
2109 if(!run_at->v_at_string) | |
2110 { | |
2111 /* respond with "error, required values are missing" */ | |
2112 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
2113 return(FALSE); | |
2114 } | |
2115 | |
2116 #ifdef FF_ATI | |
2117 if( sat_src_proc_chars (run_at->at_string) EQ FALSE ) | |
2118 { | |
2119 return(FALSE); | |
2120 } | |
2121 #endif /* FF_ATI */ | |
2122 | |
2123 return(TRUE); | |
2124 } | |
2125 | |
2126 /* | |
2127 +-------------------------------------------------------------------+ | |
2128 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2129 | ROUTINE : cmhSAT_setupEvent_Test | | |
2130 +-------------------------------------------------------------------+ | |
2131 | |
2132 PURPOSE : This function updates the event list to be whatched for SAT. | |
2133 */ | |
2134 | |
2135 GLOBAL BOOL cmhSAT_setupEvent_Test ( T_SETUP_EVENT *set_event, | |
2136 BOOL *aci_events_only ) | |
2137 { | |
2138 SHORT i; | |
2139 BOOL mt_done = FALSE; | |
2140 BOOL conn_done = FALSE; | |
2141 BOOL disc_done = FALSE; | |
2142 BOOL loc_done = FALSE; | |
2143 #ifdef FF_SAT_E | |
2144 BOOL dat_avail = FALSE; | |
2145 BOOL chn_stat = FALSE; | |
2146 #endif /* FF_SAT_E */ | |
2147 BOOL list_in_process; | |
2148 | |
2149 /* ACI-SPR-18200: temporary event list, not processed by ACI */ | |
2150 UBYTE tmpEventList[MAX_EVENT_LIST_LEN]; | |
2151 UBYTE tmpEventListLen = 0; | |
2152 | |
2153 TRACE_FUNCTION("cmhSAT_setupEvent_Test()"); | |
2154 | |
2155 if (set_event -> v_ev_list EQ TRUE) | |
2156 { | |
2157 | |
2158 | |
2159 /* erase previous list if received list is empty */ | |
2160 if (set_event -> ev_list.c_event EQ 0L) | |
2161 { | |
2162 satShrdPrm.event.list = 0L; | |
2163 return TRUE; | |
2164 } | |
2165 | |
2166 /* test events whether they are supported by ACI or not... | |
2167 Moreover, every event shall take place only once in the list */ | |
2168 /* supported by ACI: | |
2169 EVENT_MT_CALL | |
2170 EVENT_CALL_CONN | |
2171 EVENT_CALL_DISC | |
2172 EVENT_LOC_STATUS | |
2173 EVENT_DATA_AVAIL (SAT E) | |
2174 EVENT_CHAN_STAT (SAT E) */ | |
2175 | |
2176 list_in_process = ( satShrdPrm.event.temp_list & 0x8000 ) > 0; | |
2177 | |
2178 if ( list_in_process ) | |
2179 { | |
2180 /*means a setup_event_list is already currently in process */ | |
2181 return FALSE; /* TR(30) is sent by calling function */ | |
2182 } | |
2183 | |
2184 for (i=0;i<set_event -> ev_list.c_event;i++) | |
2185 { | |
2186 switch( set_event -> ev_list.event[i] ) | |
2187 { | |
2188 case( EVENT_MT_CALL ): | |
2189 if (! mt_done ) | |
2190 { | |
2191 mt_done = TRUE; | |
2192 } | |
2193 else | |
2194 { | |
2195 satShrdPrm.event.temp_list = 0L; | |
2196 return FALSE; | |
2197 } | |
2198 break; | |
2199 | |
2200 case( EVENT_CALL_CONN ): | |
2201 if (! conn_done ) | |
2202 { | |
2203 conn_done = TRUE; | |
2204 } | |
2205 else | |
2206 { | |
2207 satShrdPrm.event.temp_list = 0L; | |
2208 return FALSE; | |
2209 } | |
2210 break; | |
2211 | |
2212 case( EVENT_CALL_DISC ): | |
2213 if (! disc_done ) | |
2214 { | |
2215 disc_done = TRUE; | |
2216 } | |
2217 else | |
2218 { | |
2219 satShrdPrm.event.temp_list = 0L; | |
2220 return FALSE; | |
2221 } | |
2222 break; | |
2223 | |
2224 case( EVENT_LOC_STATUS ): | |
2225 if (! loc_done ) | |
2226 { | |
2227 loc_done = TRUE; | |
2228 } | |
2229 else | |
2230 { | |
2231 satShrdPrm.event.temp_list = 0L; | |
2232 return FALSE; | |
2233 } | |
2234 break; | |
2235 | |
2236 #ifdef FF_SAT_E | |
2237 case( EVENT_DATA_AVAIL ): | |
2238 if (! dat_avail ) | |
2239 { | |
2240 dat_avail = TRUE; | |
2241 } | |
2242 else | |
2243 { | |
2244 satShrdPrm.event.temp_list = 0L; | |
2245 return FALSE; | |
2246 } | |
2247 break; | |
2248 | |
2249 case( EVENT_CHAN_STAT ): | |
2250 if (! chn_stat ) | |
2251 { | |
2252 chn_stat = TRUE; | |
2253 } | |
2254 else | |
2255 { | |
2256 satShrdPrm.event.temp_list = 0L; | |
2257 return FALSE; | |
2258 } | |
2259 break; | |
2260 #endif /* FF_SAT_E */ | |
2261 | |
2262 default: | |
2263 satShrdPrm.event.temp_list |= (0x01 << set_event->ev_list.event[i]); | |
2264 /* so that the corresponding bit won't actually be set in temp_list */ | |
2265 /* ACI-SPR-18200: add to local temp event list */ | |
2266 tmpEventList[tmpEventListLen] = set_event->ev_list.event[i]; | |
2267 tmpEventListLen++; | |
2268 break; | |
2269 } | |
2270 satShrdPrm.event.temp_list |= (0x01 << set_event->ev_list.event[i]); | |
2271 } | |
2272 } | |
2273 else | |
2274 { | |
2275 satShrdPrm.event.temp_list = 0L; | |
2276 return FALSE; | |
2277 } | |
2278 | |
2279 satShrdPrm.event.temp_list |= 0x8000; /* to flag that a list is in process */ | |
2280 | |
2281 /* ACI-SPR-18200: Modify the SAT cmd send to MMI */ | |
2282 if ( cmhSAT_copyUnprocEvents ( tmpEventList, | |
2283 tmpEventListLen, | |
2284 set_event->ev_list.c_event ) ) | |
2285 { | |
2286 *aci_events_only = FALSE; | |
2287 } | |
2288 else | |
2289 { | |
2290 *aci_events_only = TRUE; | |
2291 } | |
2292 | |
2293 return TRUE; | |
2294 } | |
2295 | |
2296 /* | |
2297 +-------------------------------------------------------------------+ | |
2298 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2299 | ROUTINE : cmhSAT_copyUnprocEvents | | |
2300 +-------------------------------------------------------------------+ | |
2301 | |
2302 PURPOSE : Modify the event list that will be send to MMI. | |
2303 Insert the events that could not be processed by ACI. | |
2304 Returning TRUE means: Forward the current SAT command | |
2305 to MMI for further analysis. | |
2306 */ | |
2307 | |
2308 GLOBAL BOOL cmhSAT_copyUnprocEvents ( UBYTE* eventList, | |
2309 UBYTE eventListLen, | |
2310 UBYTE oldEventListLen) | |
2311 { | |
2312 USHORT totalLen; | |
2313 UBYTE lenDiff; | |
2314 UBYTE i; | |
2315 UBYTE j; | |
2316 UBYTE shift = 0; /* Holds the shift value */ | |
2317 | |
2318 TRACE_FUNCTION("cmhSAT_copyUnprocEvents()"); | |
2319 | |
2320 /* No modification needed, all events processed in ACI */ | |
2321 if ( (eventListLen EQ 0) AND (oldEventListLen NEQ 0) ) | |
2322 { | |
2323 return FALSE; | |
2324 } | |
2325 /* No modifiction necessary, all events are forwarded */ | |
2326 else if ( eventListLen EQ oldEventListLen ) | |
2327 { | |
2328 return TRUE; | |
2329 } | |
2330 else | |
2331 { | |
2332 /* modify SAT event list string */ | |
2333 /* calculate difference between new and old length of event list */ | |
2334 lenDiff = oldEventListLen - eventListLen; | |
2335 | |
2336 /* modify the total length, always second (and third) byte | |
2337 Note: This is the only length that is critical, if the length | |
2338 decrement changes the total len from 2 to 1 byte representation | |
2339 the whole array has to be shifted one position at the end of | |
2340 modification. */ | |
2341 if ( satShrdPrm.stkCmd[1] EQ 0x81 ) | |
2342 { | |
2343 if ( (satShrdPrm.stkCmd[2] > 0x7F) AND | |
2344 ((satShrdPrm.stkCmd[2] - lenDiff) <= 0x7F )) /* mod changes repres.*/ | |
2345 { | |
2346 /* forces a shift at the end of modification */ | |
2347 shift = 1; | |
2348 } | |
2349 satShrdPrm.stkCmd[2] = satShrdPrm.stkCmd[2] - lenDiff; | |
2350 i = 3; | |
2351 } | |
2352 else | |
2353 { | |
2354 satShrdPrm.stkCmd[1] = satShrdPrm.stkCmd[1] - lenDiff; | |
2355 i = 2; | |
2356 } | |
2357 | |
2358 /* go to index of SET UP EVENT LIST TAG */ | |
2359 while( i < satShrdPrm.stkCmdLen ) | |
2360 { | |
2361 /* Is tag set up event list TAG */ | |
2362 if ( satShrdPrm.stkCmd[i] NEQ 0x99 ) | |
2363 { | |
2364 /* go LENGTH steps ahead */ | |
2365 /* jump over the VALUE field to the next TAG */ | |
2366 if ( satShrdPrm.stkCmd[i+1] EQ 0x81 ) /* 2 byte length representation */ | |
2367 { | |
2368 i = i + ( satShrdPrm.stkCmd[i+2] + 3 ); | |
2369 } | |
2370 else | |
2371 { | |
2372 i = i + ( satShrdPrm.stkCmd[i+1] + 2 ); | |
2373 } | |
2374 } | |
2375 else | |
2376 { | |
2377 /* found index */ | |
2378 break; | |
2379 } | |
2380 } | |
2381 | |
2382 /* insert new events and decrease length */ | |
2383 if ( (i < satShrdPrm.stkCmdLen) AND | |
2384 (satShrdPrm.stkCmd[i] EQ 0x99) ) | |
2385 { | |
2386 /* set index to LENGTH */ | |
2387 i++; | |
2388 /* decrease length */ | |
2389 if ( satShrdPrm.stkCmd[i] EQ 0x81 ) /* 2 byte length representation */ | |
2390 { | |
2391 if ( satShrdPrm.stkCmd[i+1] - lenDiff <= 0x7F ) /*repres. changes to 1*/ | |
2392 { | |
2393 satShrdPrm.stkCmd[i] = satShrdPrm.stkCmd[i+1] - lenDiff; | |
2394 /* set index just one byte ahead to overwrite second length byte */ | |
2395 i++; | |
2396 } | |
2397 else | |
2398 { | |
2399 satShrdPrm.stkCmd[i+1] = satShrdPrm.stkCmd[i+1] - lenDiff; | |
2400 /* set index to value */ | |
2401 i+=2; | |
2402 } | |
2403 } | |
2404 else /* just change the length */ | |
2405 { | |
2406 satShrdPrm.stkCmd[i] = satShrdPrm.stkCmd[i] - lenDiff; | |
2407 /* set index to VALUE */ | |
2408 i++; | |
2409 } | |
2410 /* write out events that have to be forwarded to MMI */ | |
2411 for( j = 0; j < eventListLen; j++) | |
2412 { | |
2413 satShrdPrm.stkCmd[i+j] = eventList[j]; | |
2414 } | |
2415 | |
2416 /* set index to end */ | |
2417 i = i + j; | |
2418 /* clear rest of array */ | |
2419 if ( i < satShrdPrm.stkCmdLen ) | |
2420 { | |
2421 while ( i < satShrdPrm.stkCmdLen ) | |
2422 { | |
2423 satShrdPrm.stkCmd[i] = 0xFF; | |
2424 i++; | |
2425 } | |
2426 } | |
2427 | |
2428 } | |
2429 else | |
2430 { | |
2431 TRACE_EVENT("ERROR: Could not find SET UP EVENT LIST TAG"); | |
2432 /* reset temp list to force error response */ | |
2433 satShrdPrm.event.temp_list = 0L; | |
2434 return FALSE; | |
2435 } | |
2436 | |
2437 /* if shift is needed */ | |
2438 /* set index to first byte of total length */ | |
2439 i = 2; | |
2440 if ( shift ) | |
2441 { | |
2442 for ( i = 2; i < (satShrdPrm.stkCmdLen - 1); i++ ) | |
2443 { | |
2444 satShrdPrm.stkCmd[i] = satShrdPrm.stkCmd[i+1]; | |
2445 } | |
2446 } | |
2447 | |
2448 /* decrease the total length */ | |
2449 totalLen = satShrdPrm.stkCmdLen - (lenDiff*8); | |
2450 satShrdPrm.stkCmdLen = totalLen; | |
2451 | |
2452 return TRUE; | |
2453 } | |
2454 } | |
2455 | |
2456 /* | |
2457 +-------------------------------------------------------------------+ | |
2458 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2459 | ROUTINE : cmhSAT_setupEvent_Perform| | |
2460 +-------------------------------------------------------------------+ | |
2461 | |
2462 PURPOSE : This function updates the event list to be whatched for SAT. | |
2463 */ | |
2464 | |
2465 GLOBAL void cmhSAT_setupEvent_Perform ( void ) | |
2466 { | |
2467 TRACE_FUNCTION("cmhSAT_setupEvent_Perform()"); | |
2468 | |
2469 /* update list */ | |
2470 satShrdPrm.event.list = satShrdPrm.event.temp_list; | |
2471 | |
2472 satShrdPrm.event.temp_list = 0L; /* reinitialize for next setup list */ | |
2473 | |
2474 #if defined (FF_SAT_E) AND defined (DTI) | |
2475 /* inform SIM about a possible DATA AVAIL event */ | |
2476 psaSIM_EvDatAvail(psaSAT_ChkEventList( EVENT_DATA_AVAIL )); | |
2477 #endif /* FF_SAT_E */ | |
2478 | |
2479 /*psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, 0, NULL, NULL ); | |
2480 not needed... what comes from MMI is sent to SAT */ | |
2481 } | |
2482 /* | |
2483 +-------------------------------------------------------------------+ | |
2484 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2485 | ROUTINE : cmhSAT_UserRejCall | | |
2486 +-------------------------------------------------------------------+ | |
2487 | |
2488 PURPOSE : This function sends a terminal response, indicating that | |
2489 the user has not accept the SAT call. | |
2490 | |
2491 */ | |
2492 | |
2493 GLOBAL void cmhSAT_UserRejCall ( UBYTE calStat ) | |
2494 { | |
2495 T_ACI_SAT_TERM_RESP resp_data; | |
2496 | |
2497 TRACE_FUNCTION("cmhSAT_UserRejCall()"); | |
2498 | |
2499 psaSAT_InitTrmResp( &resp_data ); | |
2500 | |
2501 #ifdef FF_SAT_E | |
2502 if( calStat EQ CS_SAT_CSD_REQ ) | |
2503 { | |
2504 resp_data.bearDesc = TRUE; | |
2505 resp_data.bufSize = TRUE; | |
2506 } | |
2507 | |
2508 #endif /* FF_SAT_E */ | |
2509 | |
2510 psaSAT_SendTrmResp( RSLT_USR_REJ, &resp_data ); | |
2511 | |
2512 #ifdef FF_SAT_E | |
2513 if( calStat EQ CS_SAT_CSD_REQ ) | |
2514 { | |
2515 cmhSAT_cleanupOpChnPrms(); | |
2516 } | |
2517 #endif /* FF_SAT_E */ | |
2518 } | |
2519 | |
2520 /* | |
2521 +-------------------------------------------------------------------+ | |
2522 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2523 | ROUTINE : cmhSAT_UserRejCntxt | | |
2524 +-------------------------------------------------------------------+ | |
2525 | |
2526 PURPOSE : This function sends a terminal response, indicating that | |
2527 the user has not accepted the SAT GPRS context. | |
2528 | |
2529 */ | |
2530 | |
2531 #if defined (GPRS) && defined (FF_SAT_E) | |
2532 GLOBAL void cmhSAT_UserRejCntxt( void ) | |
2533 { | |
2534 T_ACI_SAT_TERM_RESP resp_data; | |
2535 | |
2536 TRACE_FUNCTION("cmhSAT_UserRejCntxt()"); | |
2537 | |
2538 psaSAT_InitTrmResp( &resp_data ); | |
2539 resp_data.bearDesc = TRUE; | |
2540 resp_data.bufSize = TRUE; | |
2541 | |
2542 psaSAT_SendTrmResp( RSLT_USR_REJ, &resp_data ); | |
2543 | |
2544 cmhSAT_cleanupOpChnPrms(); | |
2545 | |
2546 } | |
2547 #endif /* GPRS && SAT E */ | |
2548 | |
2549 /* | |
2550 +-------------------------------------------------------------------+ | |
2551 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2552 | ROUTINE : cmhSAT_CallCncted | | |
2553 +-------------------------------------------------------------------+ | |
2554 | |
2555 PURPOSE : This function sends a terminal response, indicating that | |
2556 the SAT call was connected. | |
2557 | |
2558 */ | |
2559 | |
2560 GLOBAL void cmhSAT_CallCncted ( void ) | |
2561 { | |
2562 T_ACI_SAT_TERM_RESP resp_data; | |
2563 | |
2564 TRACE_FUNCTION("cmhSAT_CallCncted()"); | |
2565 | |
2566 psaSAT_InitTrmResp( &resp_data ); | |
2567 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
2568 } | |
2569 | |
2570 /* | |
2571 +-------------------------------------------------------------------+ | |
2572 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2573 | ROUTINE : cmhSAT_NtwErr | | |
2574 +-------------------------------------------------------------------+ | |
2575 | |
2576 PURPOSE : This function sends a terminal response, indicating that | |
2577 the SAT call was not connected due to a network problem. | |
2578 The function will return TRUE if it is OK to send a AT | |
2579 result code. If a result code should be suppressed, the | |
2580 function will return FALSE. | |
2581 | |
2582 */ | |
2583 | |
2584 GLOBAL UBYTE cmhSAT_NtwErr ( UBYTE cs ) | |
2585 { | |
2586 | |
2587 T_ACI_SAT_TERM_RESP resp_data; | |
2588 #if defined (FF_SAT_E) AND defined (DTI) | |
2589 T_SIM_SAT_CHN chnInf; | |
2590 #endif | |
2591 UBYTE ret = TRUE; | |
2592 | |
2593 TRACE_FUNCTION("cmhSAT_NtwErr()"); | |
2594 | |
2595 psaSAT_InitTrmResp( &resp_data ); | |
2596 | |
2597 resp_data.add_content = cs; | |
2598 | |
2599 #if defined (FF_SAT_E) AND defined (DTI) | |
2600 /* in case of a SEND DATA command, close the channel. Terminal response | |
2601 will be sent by SIM entity */ | |
2602 if( satShrdPrm.chnTb.chnUsdFlg AND | |
2603 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA) | |
2604 { | |
2605 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
2606 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
2607 chnInf.chnId = CHANNEL_ID_1; | |
2608 chnInf.genRes = RSLT_NTW_UNAB_PROC; | |
2609 chnInf.addRes = cs; | |
2610 | |
2611 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
2612 ret = FALSE; | |
2613 } | |
2614 /* otherwise send a terminal response */ | |
2615 else | |
2616 { | |
2617 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
2618 satShrdPrm.opchType EQ B_CSD ) | |
2619 { | |
2620 resp_data.chnStat = TRUE; | |
2621 } | |
2622 #endif /* FF_SAT_E */ | |
2623 | |
2624 psaSAT_SendTrmResp( RSLT_NTW_UNAB_PROC, &resp_data ); | |
2625 | |
2626 #if defined (FF_SAT_E) AND defined (DTI) | |
2627 } | |
2628 | |
2629 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
2630 satShrdPrm.opchType EQ B_CSD ) | |
2631 { | |
2632 satShrdPrm.chnTb.chnUsdFlg = FALSE; | |
2633 cmhSAT_cleanupOpChnPrms(); | |
2634 } | |
2635 #endif /* FF_SAT_E */ | |
2636 | |
2637 return ret; | |
2638 } | |
2639 | |
2640 /* | |
2641 +-------------------------------------------------------------------+ | |
2642 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2643 | ROUTINE : cmhSAT_UserClear | | |
2644 +-------------------------------------------------------------------+ | |
2645 | |
2646 PURPOSE : This function sends a terminal response, indicating that | |
2647 the SAT call was not connected due to a user clearance. | |
2648 | |
2649 */ | |
2650 | |
2651 GLOBAL void cmhSAT_UserClear ( void ) | |
2652 { | |
2653 T_ACI_SAT_TERM_RESP resp_data; | |
2654 #if defined (FF_SAT_E) AND defined (DTI) | |
2655 T_SIM_SAT_CHN chnInf; | |
2656 #endif /* FF_SAT_E */ | |
2657 | |
2658 TRACE_FUNCTION("cmhSAT_UserClear()"); | |
2659 | |
2660 psaSAT_InitTrmResp( &resp_data ); | |
2661 | |
2662 #if defined (FF_SAT_E) AND defined (DTI) | |
2663 /* in case of a SEND DATA command, close the channel. Terminal response | |
2664 will be sent by SIM entity */ | |
2665 if( satShrdPrm.chnTb.chnUsdFlg AND | |
2666 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA) | |
2667 { | |
2668 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
2669 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
2670 chnInf.chnId = CHANNEL_ID_1; | |
2671 chnInf.genRes = RSLT_USR_CLR_DWN; | |
2672 chnInf.addRes = ADD_NO_CAUSE; | |
2673 | |
2674 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
2675 } | |
2676 /* otherwise send a terminal response */ | |
2677 else | |
2678 { | |
2679 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
2680 satShrdPrm.opchType EQ B_CSD ) | |
2681 { | |
2682 resp_data.chnStat = TRUE; | |
2683 } | |
2684 #endif /* FF_SAT_E */ | |
2685 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data ); | |
2686 | |
2687 #if defined (FF_SAT_E) AND defined (DTI) | |
2688 } | |
2689 | |
2690 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
2691 satShrdPrm.opchType EQ B_CSD ) | |
2692 { | |
2693 satShrdPrm.chnTb.chnUsdFlg = FALSE; | |
2694 cmhSAT_cleanupOpChnPrms(); | |
2695 } | |
2696 #endif /* FF_SAT_E */ | |
2697 } | |
2698 | |
2699 /* | |
2700 +-------------------------------------------------------------------+ | |
2701 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2702 | ROUTINE : cmhSAT_UserAcptCall | | |
2703 +-------------------------------------------------------------------+ | |
2704 | |
2705 PURPOSE : This function performs the user acceptance of the pending | |
2706 SAT call. If command details do not allow the operation, | |
2707 the function returns FALSE. | |
2708 | |
2709 */ | |
2710 | |
2711 GLOBAL BOOL cmhSAT_UserAcptCall ( SHORT acptId, UBYTE srcId ) | |
2712 { | |
2713 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */ | |
2714 SHORT actId; /* holds id of active call */ | |
2715 UBYTE ctbIdx; /* holds call table index */ | |
2716 BOOL found_call=FALSE; | |
2717 | |
2718 #if defined (FAX_AND_DATA) AND defined (FF_SAT_E) | |
2719 T_SIM_SAT_CHN chnInf; | |
2720 #endif | |
2721 | |
2722 TRACE_FUNCTION("cmhSAT_UserAcptCall()"); | |
2723 | |
2724 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; | |
2725 | |
2726 pCCCmdPrm -> mltyCncFlg = 0; | |
2727 pCCCmdPrm -> mltyDscFlg = 0; | |
2728 | |
2729 psaCC_ctb(acptId)->curCmd = AT_CMD_A; | |
2730 psaCC_ctb(acptId)->curSrc = srcId; | |
2731 | |
2732 /* | |
2733 *------------------------------------------------------------------- | |
2734 * perform according to command details for SETUP CALL command | |
2735 *------------------------------------------------------------------- | |
2736 */ | |
2737 if (psaCC_ctb(acptId)->calStat EQ CS_SAT_REQ) | |
2738 { | |
2739 if( !cmhSAT_ChckCmdDet() ) | |
2740 { | |
2741 psaCC_FreeCtbNtry (acptId); | |
2742 return( FALSE ); | |
2743 } | |
2744 | |
2745 switch( satShrdPrm.cmdDet.cmdQlf ) | |
2746 { | |
2747 case( QLF_CALL_HOLD ): | |
2748 case( QLF_CALL_HOLD_RDL ): | |
2749 | |
2750 actId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT ); | |
2751 | |
2752 if( actId NEQ NO_ENTRY ) | |
2753 { | |
2754 psaCC_ctb(actId)->SATinv = TRUE; | |
2755 | |
2756 cmhCC_HoldCall(actId, (T_ACI_CMD_SRC)psaCC_ctb(acptId)->curSrc, AT_CMD_A); | |
2757 | |
2758 if( psaCC_ctb(actId)->mptyStat NEQ CS_ACT ) | |
2759 { | |
2760 /* do not start building sat call, has to wait for answer for holding */ | |
2761 return( TRUE ); | |
2762 } | |
2763 } | |
2764 break; | |
2765 | |
2766 case( QLF_CALL_DISC ): | |
2767 case( QLF_CALL_DISC_RDL ): | |
2768 | |
2769 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
2770 { | |
2771 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
2772 | |
2773 if (ctbx NEQ NULL AND | |
2774 ctbIdx NEQ acptId ) | |
2775 { | |
2776 cmhCC_flagCall( ctbIdx, &(pCCCmdPrm -> mltyDscFlg)); | |
2777 ctbx->nrmCs = MNCC_CAUSE_CALL_CLEAR; | |
2778 ctbx->curCmd = AT_CMD_H; | |
2779 ctbx->curSrc = psaCC_ctb(acptId)->curSrc; | |
2780 ctbx->SATinv = TRUE; | |
2781 psaCC_ClearCall (ctbIdx); | |
2782 found_call = TRUE; | |
2783 } | |
2784 } | |
2785 | |
2786 if (found_call) | |
2787 { | |
2788 /* do not start building sat call, has to wait for answer for clearing */ | |
2789 return( TRUE ); | |
2790 } | |
2791 break; | |
2792 } | |
2793 } | |
2794 | |
2795 /* | |
2796 *------------------------------------------------------------------- | |
2797 * perform according to command details for OPEN CHANNEL command | |
2798 *------------------------------------------------------------------- | |
2799 */ | |
2800 #if defined (FAX_AND_DATA) AND defined (FF_SAT_E) AND defined (DTI) | |
2801 | |
2802 if( psaCC_ctb(acptId)->calStat EQ CS_SAT_CSD_REQ ) | |
2803 { | |
2804 | |
2805 /* reset own to SAT */ | |
2806 psaCC_ctb(acptId)->calOwn = OWN_SRC_SAT; | |
2807 | |
2808 /* store current command source */ | |
2809 satShrdPrm.opchAcptSrc = srcId; | |
2810 | |
2811 if( satShrdPrm.opchPrm AND | |
2812 ((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->v_itl AND | |
2813 ((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->itl.trans_prot_type EQ UDP ) | |
2814 { | |
2815 satShrdPrm.chnTb.chnTPL = ((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->itl.trans_prot_type; | |
2816 } | |
2817 else | |
2818 { | |
2819 satShrdPrm.chnTb.chnTPL = TPL_NONE; | |
2820 } | |
2821 | |
2822 /* check for on-demand channel establishment */ | |
2823 if(!(satShrdPrm.cmdDet.cmdQlf & QLF_OPCH_IMMDT_LINK_EST)) | |
2824 { | |
2825 /* CASE: ON DEMAND */ | |
2826 /* set open channel status */ | |
2827 satShrdPrm.opchStat = OPCH_ON_DMND; | |
2828 } | |
2829 else /* immediately channel establishment */ | |
2830 { | |
2831 /* CASE: IMMEDIATELY */ | |
2832 /* check temporary problems */ | |
2833 if( cmhSAT_OpChnChkTmpProblem() ) | |
2834 { | |
2835 psaCC_FreeCtbNtry (acptId); | |
2836 satShrdPrm.chnTb.chnUsdFlg = FALSE; | |
2837 | |
2838 return( FALSE ); | |
2839 } | |
2840 | |
2841 /* set open channel status */ | |
2842 satShrdPrm.opchStat = OPCH_EST_REQ; | |
2843 | |
2844 #ifdef DTI | |
2845 #ifdef CO_UDP_IP | |
2846 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
2847 { | |
2848 /* enable establishment of UDP data chain */ | |
2849 sAT_PercentWAP ( (T_ACI_CMD_SRC)psaCC_ctb(acptId)->curSrc , 1 ); | |
2850 | |
2851 /* setup PPP parameters */ | |
2852 cmhSAT_OpChnSetPPP( B_CSD ); | |
2853 } | |
2854 #endif /* CO_UDP_IP */ | |
2855 #endif /* DTI */ | |
2856 } | |
2857 | |
2858 /* Establish BIP channel for immediate and on demand */ | |
2859 chnInf.bipConn = SIM_BIP_OPEN_CHANNEL; | |
2860 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
2861 chnInf.chnId = CHANNEL_ID_1; | |
2862 chnInf.genRes = RSLT_PERF_SUCCESS; | |
2863 chnInf.addRes = ADD_NO_CAUSE; | |
2864 | |
2865 /* SAT_E_PATCH: send SIM_BIP_REQ to open BIP channel */ | |
2866 psaSIM_SATBIPChn( chnInf, cmhSAT_OpBIPChnOpen); | |
2867 | |
2868 return (TRUE); | |
2869 } | |
2870 #endif /* FAX_AND_DATA AND FF_SAT_E */ | |
2871 | |
2872 /* finally set up call */ | |
2873 cmhCC_flagCall( acptId, &(pCCCmdPrm->mltyCncFlg)); | |
2874 cmhCC_NewCall(acptId, (T_ACI_CMD_SRC)srcId, AT_CMD_A); | |
2875 return( TRUE ); | |
2876 } | |
2877 | |
2878 /* | |
2879 +-------------------------------------------------------------------+ | |
2880 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2881 | ROUTINE : cmhSAT_UserAcptCntxt | | |
2882 +-------------------------------------------------------------------+ | |
2883 | |
2884 PURPOSE : This function performs the user acceptance of the pending | |
2885 SAT GPRS context. If conditions occur, which prevent the | |
2886 establishment of the context, the function returns FALSE. | |
2887 | |
2888 */ | |
2889 | |
2890 #if defined (GPRS) AND defined (FF_SAT_E) AND defined (DTI) | |
2891 GLOBAL BOOL cmhSAT_UserAcptCntxt( UBYTE srcId ) | |
2892 { | |
2893 T_SIM_SAT_CHN chnInf; /* holds channel information */ | |
2894 | |
2895 TRACE_FUNCTION("cmhSAT_UserAcptCntxt()"); | |
2896 | |
2897 /* store current command source */ | |
2898 satShrdPrm.opchAcptSrc = srcId; | |
2899 | |
2900 if( satShrdPrm.opchPrm AND | |
2901 ((T_SAT_GPRS_PRM*)satShrdPrm.opchPrm)->v_itl AND | |
2902 ((T_SAT_GPRS_PRM*)satShrdPrm.opchPrm)->itl.trans_prot_type EQ UDP ) | |
2903 { | |
2904 satShrdPrm.chnTb.chnTPL = ((T_SAT_GPRS_PRM*)satShrdPrm.opchPrm)->itl.trans_prot_type; | |
2905 } | |
2906 else | |
2907 { | |
2908 satShrdPrm.chnTb.chnTPL = TPL_NONE; | |
2909 } | |
2910 | |
2911 | |
2912 /* check for on-demand channel establishment */ | |
2913 if(!(satShrdPrm.cmdDet.cmdQlf & QLF_OPCH_IMMDT_LINK_EST)) | |
2914 { | |
2915 /* CASE: ON DEMAND */ | |
2916 | |
2917 /* set open channel status */ | |
2918 satShrdPrm.opchStat = OPCH_ON_DMND; | |
2919 } | |
2920 else | |
2921 { | |
2922 /* CASE: IMMEDIATELY */ | |
2923 | |
2924 /* check temporary problems */ | |
2925 if( cmhSAT_OpChnChkTmpProblem() ) | |
2926 { | |
2927 /* any reset of cid parameters should be placed here, if necessary */ | |
2928 return( FALSE ); | |
2929 } | |
2930 | |
2931 /* set open channel status */ | |
2932 satShrdPrm.opchStat = OPCH_EST_REQ; | |
2933 } | |
2934 /* | |
2935 * The activation of the GPRS context is triggered by cmhSAT_OpBIPChnOpen(), | |
2936 * a function processing the SIM_BIP_CNF. In the new design the BIP channel | |
2937 * has to be established before the bearer is started (see also | |
2938 * cmhSAT_UserAcptCall() for CSD case) | |
2939 */ | |
2940 | |
2941 /* Establish BIP channel for immediate and on demand */ | |
2942 chnInf.bipConn = SIM_BIP_OPEN_CHANNEL; | |
2943 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
2944 chnInf.chnId = CHANNEL_ID_1; | |
2945 chnInf.genRes = RSLT_PERF_SUCCESS; | |
2946 chnInf.addRes = ADD_NO_CAUSE; | |
2947 | |
2948 /* SAT_E_PATCH: send SIM_BIP_REQ to open BIP channel */ | |
2949 psaSIM_SATBIPChn( chnInf, cmhSAT_OpBIPChnOpen); | |
2950 | |
2951 return ( TRUE ); | |
2952 } | |
2953 #endif /* GPRS AND FF_SAT_E */ | |
2954 /* | |
2955 +-------------------------------------------------------------------+ | |
2956 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
2957 | ROUTINE : cmhSAT_ChckRedial | | |
2958 +-------------------------------------------------------------------+ | |
2959 | |
2960 PURPOSE : This function checks the redialling conditions and setup | |
2961 the appropriate parameters. | |
2962 | |
2963 */ | |
2964 | |
2965 GLOBAL LONG cmhSAT_ChckRedial ( SHORT cId, UBYTE v_dur, T_dur * dur ) | |
2966 { | |
2967 TRACE_FUNCTION("cmhSAT_ChckRedial()"); | |
2968 | |
2969 satShrdPrm.dur = -1; | |
2970 | |
2971 /* | |
2972 *------------------------------------------------------------------- | |
2973 * check command qualifier for redialling | |
2974 *------------------------------------------------------------------- | |
2975 */ | |
2976 #ifdef FF_SAT_E | |
2977 /* in case of SETUP CALL command */ | |
2978 if( satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SETUP_CALL ) | |
2979 #endif /* FF_SAT_E */ | |
2980 { | |
2981 switch( satShrdPrm.cmdDet.cmdQlf ) | |
2982 { | |
2983 case( QLF_CALL_IDLE_RDL ): | |
2984 case( QLF_CALL_HOLD_RDL ): | |
2985 case( QLF_CALL_DISC_RDL ): | |
2986 | |
2987 break; | |
2988 | |
2989 default: | |
2990 | |
2991 return( ACI_NumParmNotPresent ); | |
2992 } | |
2993 } | |
2994 | |
2995 #ifdef FF_SAT_E | |
2996 /* in case of OPEN CHANNEL command */ | |
2997 if( satShrdPrm.cmdDet.cmdType EQ SAT_CMD_OPEN_CHANNEL ) | |
2998 { | |
2999 if(!(satShrdPrm.cmdDet.cmdQlf & QLF_OPCH_AUTO_RECONNECT)) | |
3000 | |
3001 return( ACI_NumParmNotPresent ); | |
3002 } | |
3003 #endif /* FF_SAT_E */ | |
3004 | |
3005 /* calculate redial timeout */ | |
3006 psaCC_ctb(cId)->SATinv |= SAT_REDIAL; | |
3007 | |
3008 if( v_dur ) | |
3009 { | |
3010 switch( dur->time_unit ) | |
3011 { | |
3012 /* scale to ms */ | |
3013 case( TU_MIN ): | |
3014 satShrdPrm.dur = dur->time_ivl*60000; | |
3015 break; | |
3016 case( TU_SEC ): | |
3017 satShrdPrm.dur = dur->time_ivl*1000; | |
3018 break; | |
3019 case( TU_100_MSEC ): | |
3020 satShrdPrm.dur = dur->time_ivl*100; | |
3021 break; | |
3022 default: | |
3023 satShrdPrm.dur = -1; | |
3024 } | |
3025 } | |
3026 | |
3027 | |
3028 return((satShrdPrm.dur EQ -1)?ACI_NumParmNotPresent:satShrdPrm.dur); | |
3029 } | |
3030 | |
3031 /* | |
3032 +-------------------------------------------------------------------+ | |
3033 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3034 | ROUTINE : cmhSAT_StartPendingCall | | |
3035 +-------------------------------------------------------------------+ | |
3036 | |
3037 PURPOSE : This function performs the actual start of the pending | |
3038 SAT call. | |
3039 */ | |
3040 | |
3041 GLOBAL BOOL cmhSAT_StartPendingCall ( void ) | |
3042 { | |
3043 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */ | |
3044 SHORT satId; /* id of sat pending call */ | |
3045 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
3046 T_ACI_CLOG cmdLog; /* holds logging info */ | |
3047 #endif | |
3048 | |
3049 TRACE_FUNCTION("cmhSAT_StartPendingCall()"); | |
3050 | |
3051 satId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_REQ, NO_VLD_CT ); | |
3052 | |
3053 if (satId EQ NO_ENTRY) | |
3054 return FALSE; | |
3055 | |
3056 pCCCmdPrm = &cmhPrm[psaCC_ctb(satId)->curSrc].ccCmdPrm; | |
3057 TRACE_EVENT_P1("psaCC_ctb(cId)->curCmd: %d", psaCC_ctb(satId)->curCmd); | |
3058 | |
3059 cmhCC_flagCall( satId, &(pCCCmdPrm -> mltyCncFlg)); | |
3060 psaCC_NewCall(satId); | |
3061 | |
3062 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
3063 cmdLog.atCmd = AT_CMD_A; | |
3064 cmdLog.cmdType = CLOG_TYPE_Set; | |
3065 cmdLog.retCode = AT_EXCT; | |
3066 cmdLog.sId = ACI_NumParmNotPresent; | |
3067 cmdLog.cmdPrm.sA.srcId = (T_ACI_CMD_SRC)psaCC_ctb(satId)->curSrc; | |
3068 cmdLog.cId = satId+1; | |
3069 rAT_PercentCLOG( &cmdLog ); | |
3070 #endif | |
3071 | |
3072 return TRUE; | |
3073 } | |
3074 | |
3075 /* | |
3076 +-------------------------------------------------------------------+ | |
3077 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3078 | ROUTINE : cmhSAT_ChckCmdDet | | |
3079 +-------------------------------------------------------------------+ | |
3080 | |
3081 PURPOSE : This function checks the command details against the | |
3082 current ME status. If the mobile status does not interfere | |
3083 with the command details, the function returns TRUE. | |
3084 | |
3085 */ | |
3086 | |
3087 GLOBAL BOOL cmhSAT_ChckCmdDet ( void ) | |
3088 { | |
3089 SHORT ctbIdx; /* holds call table index */ | |
3090 SHORT actId = NO_ENTRY; /* identifier for active call */ | |
3091 SHORT hldId = NO_ENTRY; /* identifier for held call */ | |
3092 SHORT cId = satShrdPrm.SIMCCParm.cId; /* holds setup call id */ | |
3093 T_ACI_SAT_TERM_RESP resp_data; | |
3094 | |
3095 TRACE_FUNCTION("cmhSAT_ChckCmdDet()"); | |
3096 | |
3097 if (!psaCC_ctbIsValid (cId)) | |
3098 { | |
3099 TRACE_ERROR ("Call table entry disappeared"); | |
3100 return FALSE; | |
3101 } | |
3102 | |
3103 /* | |
3104 * From here it is guaranteed that cId describes an existing (non-NULL) | |
3105 * call table entry. | |
3106 */ | |
3107 | |
3108 psaSAT_InitTrmResp( &resp_data ); | |
3109 /* | |
3110 *------------------------------------------------------------------- | |
3111 * scan call table | |
3112 *------------------------------------------------------------------- | |
3113 */ | |
3114 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
3115 { | |
3116 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL) | |
3117 { | |
3118 switch( psaCC_ctb(ctbIdx)->calStat ) | |
3119 { | |
3120 case( CS_ACT ): | |
3121 case( CS_ACT_REQ ): | |
3122 case( CS_MDF_REQ ): | |
3123 | |
3124 actId = ctbIdx; | |
3125 break; | |
3126 | |
3127 case( CS_HLD ): | |
3128 case( CS_HLD_REQ ): | |
3129 | |
3130 hldId = ctbIdx; | |
3131 break; | |
3132 } | |
3133 } | |
3134 } | |
3135 | |
3136 /* | |
3137 *------------------------------------------------------------------- | |
3138 * check command qualifier against ME status | |
3139 *------------------------------------------------------------------- | |
3140 */ | |
3141 switch( satShrdPrm.cmdDet.cmdQlf ) | |
3142 { | |
3143 case( QLF_CALL_IDLE ): | |
3144 case( QLF_CALL_IDLE_RDL ): | |
3145 | |
3146 if( actId NEQ NO_ENTRY OR hldId NEQ NO_ENTRY ) | |
3147 { | |
3148 resp_data.add_content = ADD_ME_CALL_BUSY; | |
3149 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
3150 /* clear call ID */ | |
3151 psaCC_retMOCTi(psaCC_ctb(cId)->ti); | |
3152 psaCC_chngCalTypCnt(cId, -1); | |
3153 psaCC_FreeCtbNtry (cId); | |
3154 | |
3155 TRACE_EVENT("cmhSAT_ChckCmdDet(): CALL_BUSY, RSLT_ME_UNAB_PROC"); | |
3156 return( FALSE ); | |
3157 } | |
3158 break; | |
3159 | |
3160 case( QLF_CALL_HOLD ): | |
3161 case( QLF_CALL_HOLD_RDL ): | |
3162 | |
3163 if( ( hldId NEQ NO_ENTRY AND actId NEQ NO_ENTRY ) OR | |
3164 ( actId NEQ NO_ENTRY AND | |
3165 psaCC_ctb(actId)->prio EQ MNCC_PRIO_NORM_CALL AND | |
3166 cmhCC_getcalltype(actId) NEQ VOICE_CALL ) ) | |
3167 { | |
3168 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
3169 TRACE_EVENT("cmhSAT_ChckCmdDet(): RSLT_ME_CAP"); | |
3170 return( FALSE ); | |
3171 } | |
3172 break; | |
3173 | |
3174 case( QLF_CALL_DISC ): | |
3175 case( QLF_CALL_DISC_RDL ): | |
3176 | |
3177 break; | |
3178 } | |
3179 | |
3180 return( TRUE ); | |
3181 } | |
3182 | |
3183 /* | |
3184 +-------------------------------------------------------------------+ | |
3185 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3186 | ROUTINE : cmhSAT_fillSetupBC | | |
3187 +-------------------------------------------------------------------+ | |
3188 | |
3189 PURPOSE : This function fills the call table bentry with the | |
3190 necessary bearer service setup parameters. | |
3191 | |
3192 */ | |
3193 | |
3194 GLOBAL void cmhSAT_fillSetupBC ( SHORT cId, | |
3195 UBYTE bearer_serv_1, | |
3196 UBYTE bearer_serv_2 ) | |
3197 { | |
3198 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
3199 | |
3200 TRACE_FUNCTION ("cmhSAT_fillSetupBC()"); | |
3201 | |
3202 /* | |
3203 *----------------------------------------------------------------- | |
3204 * bearer service | |
3205 *----------------------------------------------------------------- | |
3206 */ | |
3207 if ( bearer_serv_1 EQ MNCC_BEARER_SERV_NOT_PRES ) | |
3208 { | |
3209 ctb->BC[0].rate = MNCC_UR_NOT_PRES; | |
3210 ctb->BC[0].bearer_serv = MNCC_BEARER_SERV_SPEECH; | |
3211 ctb->BC[0].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
3212 } | |
3213 else | |
3214 { | |
3215 ctb->BC[0].rate = MNCC_UR_NOT_PRES; | |
3216 ctb->BC[0].bearer_serv = (bearer_serv_1 EQ MNCC_BEARER_SERV_SPEECH) ? | |
3217 cmhCC_set_speech_serv (&cmhPrm[CMD_SRC_LCL].ccCmdPrm) : bearer_serv_1; | |
3218 ctb->BC[0].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
3219 } | |
3220 if ( bearer_serv_2 EQ MNCC_BEARER_SERV_NOT_PRES ) | |
3221 { | |
3222 ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
3223 ctb->BC[1].bearer_serv = MNCC_BEARER_SERV_NOT_PRES; | |
3224 ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
3225 } | |
3226 else | |
3227 { | |
3228 ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
3229 ctb->BC[1].bearer_serv = (bearer_serv_2 EQ MNCC_BEARER_SERV_SPEECH) ? | |
3230 cmhCC_set_speech_serv (&cmhPrm[CMD_SRC_LCL].ccCmdPrm) : bearer_serv_2; | |
3231 ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
3232 } | |
3233 } | |
3234 | |
3235 | |
3236 /* | |
3237 +-------------------------------------------------------------------+ | |
3238 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3239 | ROUTINE : cmhSAT_convertBCDNum | | |
3240 +-------------------------------------------------------------------+ | |
3241 | |
3242 PURPOSE : This function converts the BCD number to an ascii char | |
3243 string | |
3244 | |
3245 */ | |
3246 LOCAL void cmhSAT_convertBCDNum(U8 *bcdNum, U16 len, CHAR *bcdChar) | |
3247 { | |
3248 int i; | |
3249 | |
3250 TRACE_FUNCTION("cmhSAT_convertBCDNum"); | |
3251 | |
3252 memset(bcdChar, 0, MAX_PARTY_NUM_SAT); | |
3253 | |
3254 for ( i=0; i < len; i++) | |
3255 { | |
3256 bcdChar[i] = bcdNum[i] + '0'; | |
3257 } | |
3258 | |
3259 } | |
3260 | |
3261 /* | |
3262 +-------------------------------------------------------------------+ | |
3263 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3264 | ROUTINE : cmhSAT_fillSetupPrm | | |
3265 +-------------------------------------------------------------------+ | |
3266 | |
3267 PURPOSE : This function fills the call table entry with the | |
3268 necessary SAT setup parameters. | |
3269 | |
3270 */ | |
3271 //TISH, patch for call control CLIR | |
3272 //start | |
3273 extern UBYTE getCLIRState(void); | |
3274 //end | |
3275 GLOBAL void cmhSAT_fillSetupPrm ( SHORT cId, | |
3276 T_addr *adr, | |
3277 T_subaddr *sub ) | |
3278 { | |
3279 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
3280 UBYTE i; | |
3281 USHORT dummy=0, length; | |
3282 CHAR *buf_4_dtmf; | |
3283 BOOL end_of_dial_string = FALSE; | |
3284 CHAR *number_buffer; | |
3285 //TISH, patch for call control CLIR | |
3286 //start | |
3287 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */ | |
3288 pCCCmdPrm = &cmhPrm[cId].ccCmdPrm; | |
3289 //end | |
3290 TRACE_FUNCTION ("cmhSAT_fillSetupPrm()"); | |
3291 | |
3292 ACI_MALLOC(number_buffer, MAX_PARTY_NUM_SAT); | |
3293 ACI_MALLOC(buf_4_dtmf, MNCC_MAX_CC_CALLED_NUMBER+1); | |
3294 | |
3295 /* called address */ | |
3296 if( adr NEQ NULL ) | |
3297 { | |
3298 /* check for emergency call code 112 */ | |
3299 if( adr -> c_bcdDigit > 0 AND | |
3300 adr -> bcdDigit[adr -> c_bcdDigit-1] EQ 0x0f ) | |
3301 { | |
3302 adr -> c_bcdDigit -= 1; | |
3303 } | |
3304 | |
3305 cmhSAT_convertBCDNum(adr->bcdDigit, adr->c_bcdDigit, number_buffer); | |
3306 | |
3307 //TISH, patch for OMAPS00141208&OMAPS00141392 | |
3308 //According to JRDC's request, 911 should be treated as emergency call too. | |
3309 //start | |
3310 #if 0 | |
3311 /* Only use 112 as an Emmergency Call on STK */ | |
3312 /* Implements Measure#32: Row 1027 */ | |
3313 if (!strcmp(number_buffer, num_112_str)) | |
3314 #else | |
3315 if (!strcmp(number_buffer,"112") OR !strcmp(number_buffer,"911")) | |
3316 #endif | |
3317 //end | |
3318 { | |
3319 ctb->prio = MNCC_PRIO_EMERG_CALL; | |
3320 TRACE_EVENT("EMERGENCY CALL"); | |
3321 } | |
3322 else | |
3323 ctb->prio = MNCC_PRIO_NORM_CALL; | |
3324 | |
3325 /* Check for DTMF tones within dial string */ | |
3326 length = MINIMUM(adr->c_bcdDigit, MNCC_MAX_CC_CALLED_NUMBER); | |
3327 for(i=0; i<length; i++) | |
3328 { | |
3329 /* convert address: PHB compliant */ | |
3330 buf_4_dtmf[i] = cmhPHB_convertBCD2char( adr->bcdDigit[i] ); | |
3331 if(buf_4_dtmf[i] EQ PHB_DTMF_SEP) | |
3332 { | |
3333 /* DTMF separator */ | |
3334 if(!end_of_dial_string) | |
3335 { | |
3336 adr-> c_bcdDigit = i; /* split number from DTMF tones */ | |
3337 end_of_dial_string = TRUE; | |
3338 } | |
3339 } | |
3340 } | |
3341 | |
3342 buf_4_dtmf[length] = '\0'; | |
3343 cmhCC_chkDTMFDig ( buf_4_dtmf, cId, dummy, TRUE ); | |
3344 | |
3345 /* set address */ | |
3346 ctb->cldPty.ton = adr -> noa; | |
3347 ctb->cldPty.npi = adr -> npi; | |
3348 | |
3349 ctb->cldPty.c_called_num = MINIMUM( MNCC_MAX_CC_CALLED_NUMBER, adr -> c_bcdDigit ); | |
3350 if (ctb->cldPty.called_num NEQ NULL) | |
3351 { | |
3352 ACI_MFREE (ctb->cldPty.called_num); | |
3353 ctb->cldPty.called_num = NULL; | |
3354 } | |
3355 if (ctb->cldPty.c_called_num NEQ 0) | |
3356 { | |
3357 ACI_MALLOC (ctb->cldPty.called_num, ctb->cldPty.c_called_num); | |
3358 memcpy( ctb->cldPty.called_num, | |
3359 adr -> bcdDigit, | |
3360 ctb->cldPty.c_called_num ); | |
3361 } | |
3362 | |
3363 psaCC_phbSrchNum( cId, CT_MOC ); /* get alpha identifier */ | |
3364 | |
3365 } | |
3366 | |
3367 /* | |
3368 *----------------------------------------------------------------- | |
3369 * called subaddress | |
3370 *----------------------------------------------------------------- | |
3371 */ | |
3372 if( sub NEQ NULL ) | |
3373 { | |
3374 if( sub -> c_subadr_str > 0 AND | |
3375 sub -> subadr_str[sub -> c_subadr_str-1] EQ 0x0f ) | |
3376 | |
3377 sub -> c_subadr_str -= 1; | |
3378 | |
3379 ctb->cldPtySub.c_subaddr = | |
3380 MINIMUM( MNCC_SUB_LENGTH, sub -> c_subadr_str ); | |
3381 | |
3382 memcpy( ctb->cldPtySub.subaddr, sub -> subadr_str, | |
3383 ctb->cldPtySub.c_subaddr ); | |
3384 | |
3385 ctb->cldPtySub.tos = sub -> tos; | |
3386 | |
3387 ctb->cldPtySub.odd_even = sub -> oei; | |
3388 } | |
3389 else /* subaddress not found */ | |
3390 { | |
3391 ctb->cldPtySub.tos = MNCC_TOS_NOT_PRES; | |
3392 ctb->cldPtySub.odd_even = MNCC_OE_EVEN; | |
3393 ctb->cldPtySub.c_subaddr = 0; | |
3394 } | |
3395 | |
3396 /* | |
3397 *----------------------------------------------------------------- | |
3398 * clir | |
3399 *----------------------------------------------------------------- | |
3400 */ | |
3401 //TISH, patch for call control CLIR | |
3402 //start | |
3403 // FreeCalypso: reverted | |
3404 #if 1 | |
3405 ctb->CLIRsup = NOT_PRESENT_8BIT; | |
3406 #else | |
3407 switch( getCLIRState()) | |
3408 { | |
3409 case( D_CLIR_OVRD_Supp ): | |
3410 ctb->CLIRsup = 0 ; // CLR_SUP | |
3411 break; | |
3412 | |
3413 case( D_CLIR_OVRD_Invoc ): | |
3414 ctb->CLIRsup = 0xff; //CLR_SUP_NOT; | |
3415 break; | |
3416 | |
3417 case( D_CLIR_OVRD_Default ): | |
3418 | |
3419 switch( pCCCmdPrm -> CLIRmode ) | |
3420 { | |
3421 case( CLIR_MOD_Subscript ): | |
3422 ctb->CLIRsup = 1;//CLR_NOT_PRES; | |
3423 break; | |
3424 case( CLIR_MOD_Invoc ): | |
3425 ctb->CLIRsup = 0xff;//CLR_SUP_NOT; | |
3426 break; | |
3427 case( CLIR_MOD_Supp ): | |
3428 ctb->CLIRsup = 0;//CLR_SUP; | |
3429 break; | |
3430 } | |
3431 break; | |
3432 default: | |
3433 ctb->CLIRsup = NOT_PRESENT_8BIT; | |
3434 } | |
3435 #endif | |
3436 //end | |
3437 ctb->rptInd = MNCC_RI_NOT_PRES; | |
3438 | |
3439 ACI_MFREE(number_buffer); | |
3440 ACI_MFREE(buf_4_dtmf); | |
3441 } | |
3442 | |
3443 /* | |
3444 +-------------------------------------------------------------------+ | |
3445 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3446 | ROUTINE : cmhSAT_chkDTMF | | |
3447 +-------------------------------------------------------------------+ | |
3448 | |
3449 PURPOSE : This function extracs DTMF digit from the dial string and | |
3450 store them in a buffer. | |
3451 */ | |
3452 #if 0 | |
3453 GLOBAL void cmhSAT_chkDTMF ( SHORT cId, T_addr* adr ) | |
3454 { | |
3455 UBYTE cnt = 0; | |
3456 UBYTE dtmf = 0; | |
3457 USHORT len = adr->c_bcdDigit; | |
3458 | |
3459 /* reset dtmf parameters */ | |
3460 satDtmfBuf.cId = -1; | |
3461 satDtmfBuf.cnt = 0; | |
3462 satDtmfBuf.cur = 0; | |
3463 | |
3464 /* search first occurrence of dtmf digit */ | |
3465 while( adr->bcdDigit[cnt] NEQ 0x0C AND cnt < len ) cnt++; | |
3466 | |
3467 /* if none return */ | |
3468 if( cnt EQ adr->c_bcdDigit ) return; | |
3469 | |
3470 /* adjust num digit count */ | |
3471 adr->c_bcdDigit = cnt; | |
3472 | |
3473 /* convert to IA5 */ | |
3474 while( cnt < len AND dtmf < MAX_DTMF_DIG ) | |
3475 { | |
3476 satDtmfBuf.dig[dtmf] = cmhPHB_convertBCD2char( adr->bcdDigit[cnt] ); | |
3477 | |
3478 cnt++; | |
3479 if( satDtmfBuf.dig[dtmf] NEQ '\0' ) | |
3480 { | |
3481 dtmf++; /* else erase it: that was an invalid parameter */ | |
3482 } | |
3483 } | |
3484 | |
3485 /* update dtmf parameter */ | |
3486 satDtmfBuf.cnt = dtmf+1; | |
3487 satDtmfBuf.cur = 0; | |
3488 satDtmfBuf.cId = cId; | |
3489 } | |
3490 #endif /* 0 */ | |
3491 /* | |
3492 +-------------------------------------------------------------------+ | |
3493 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3494 | ROUTINE : cmhSAT_ResCapCode | | |
3495 +-------------------------------------------------------------------+ | |
3496 | |
3497 PURPOSE : This function proceeds after the reception of a capability | |
3498 configuration parameter coding. | |
3499 */ | |
3500 | |
3501 GLOBAL void cmhSAT_ResCapCode ( USHORT cause, T_MNCC_bcconf* bc1, T_MNCC_bcconf2* bc2) | |
3502 { | |
3503 SHORT cId; /* holds call id */ | |
3504 UBYTE cmdBuf; /* buffers command */ | |
3505 UBYTE srcBuf; /* buffers command source */ | |
3506 | |
3507 cId = satShrdPrm.capParm.cId; | |
3508 | |
3509 if (!psaCC_ctbIsValid (cId)) | |
3510 { | |
3511 TRACE_ERROR ("Call table entry disappeared"); | |
3512 return; | |
3513 } | |
3514 | |
3515 switch( cause ) | |
3516 { | |
3517 case( MNCC_CAUSE_SUCCESS ): | |
3518 | |
3519 /* | |
3520 *------------------------------------------------------------------- | |
3521 * build envelope call control command | |
3522 *------------------------------------------------------------------- | |
3523 */ | |
3524 CCD_START; | |
3525 psaSAT_BuildEnvCC ( cId, NULL, NULL, bc1, bc2); | |
3526 | |
3527 satShrdPrm.SIMCCParm.cId = cId; | |
3528 satShrdPrm.SIMCCParm.ccAct = CC_ACT_CAL; | |
3529 satShrdPrm.SIMCCParm.owner = psaCC_ctb(cId)->calOwn; | |
3530 satShrdPrm.SIMCCParm.busy = TRUE; | |
3531 | |
3532 satShrdPrm.owner = OWN_SRC_INV; | |
3533 | |
3534 satShrdPrm.Cbch_EvtDnl = FALSE; | |
3535 | |
3536 psaSAT_STKEnvelope (NULL); | |
3537 | |
3538 CCD_END; | |
3539 break; | |
3540 | |
3541 case( MNCC_CAUSE_MS_INCOMPAT_DEST ): | |
3542 default: | |
3543 | |
3544 /* | |
3545 *------------------------------------------------------------------- | |
3546 * inform MMI about unsuccessful call setup | |
3547 *------------------------------------------------------------------- | |
3548 */ | |
3549 /* at the moment only user caps need to be coded */ | |
3550 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf); | |
3551 psaCC_FreeCtbNtry (cId); | |
3552 | |
3553 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent ); | |
3554 | |
3555 /* log result */ | |
3556 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,(T_ACI_AT_CMD)cmdBuf, | |
3557 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
3558 break; | |
3559 } | |
3560 } | |
3561 | |
3562 /* | |
3563 +-------------------------------------------------------------------+ | |
3564 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3565 | ROUTINE : cmhSAT_ResCapDecode | | |
3566 +-------------------------------------------------------------------+ | |
3567 | |
3568 PURPOSE : This function proceeds after the reception of a capability | |
3569 configuration parameter decoding. | |
3570 */ | |
3571 | |
3572 GLOBAL void cmhSAT_ResCapDecode ( USHORT cause, T_MNCC_bcpara* bc1, T_MNCC_bcpara2* bc2 ) | |
3573 { | |
3574 T_CC_CALL_TBL *ctb; /* Pointer to call table */ | |
3575 SHORT cId; /* holds call id */ | |
3576 UBYTE cmdBuf; /* buffers command */ | |
3577 UBYTE srcBuf; /* buffers command */ | |
3578 UBYTE idx; /* holds index */ | |
3579 T_ACI_SAT_TERM_RESP resp_data; | |
3580 #ifdef FF_SAT_E | |
3581 T_ACI_SATA_ADD addPrm; | |
3582 #endif /* FF_SAT_E */ | |
3583 | |
3584 cId = satShrdPrm.capParm.cId; | |
3585 | |
3586 if (!psaCC_ctbIsValid (cId)) | |
3587 { | |
3588 TRACE_ERROR ("Call table entry disappeared"); | |
3589 return; | |
3590 } | |
3591 | |
3592 ctb = ccShrdPrm.ctb[cId]; | |
3593 | |
3594 psaSAT_InitTrmResp( &resp_data ); | |
3595 | |
3596 | |
3597 switch( cause ) | |
3598 { | |
3599 case( MNCC_CAUSE_SUCCESS ): | |
3600 | |
3601 if( !satShrdPrm.ownSAT ) | |
3602 { | |
3603 if( ccShrdPrm.BC0_send_flag ) | |
3604 { | |
3605 ctb[cId].BC[0] = *bc1; | |
3606 } | |
3607 | |
3608 if( ccShrdPrm.BC1_send_flag ) | |
3609 { | |
3610 ctb[cId].BC[1] = *bc2; | |
3611 } | |
3612 } | |
3613 else | |
3614 { | |
3615 ctb[cId].BC[0] = *bc1; | |
3616 ctb[cId].BC[1] = *bc2; | |
3617 } | |
3618 | |
3619 | |
3620 /* check capability context */ | |
3621 switch( satShrdPrm.capParm.cntxt ) | |
3622 { | |
3623 case( CTX_SAT_SETUP ): | |
3624 /* alert user if command details are supported */ | |
3625 if( cmhSAT_ChckCmdDet() ) | |
3626 { | |
3627 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
3628 { | |
3629 #ifdef FF_SAT_E | |
3630 addPrm.chnType = SATA_CT_VOICE; | |
3631 addPrm.chnEst = SATA_EST_IM; | |
3632 | |
3633 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur, &addPrm ); | |
3634 #else /* FF_SAT_E */ | |
3635 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur); | |
3636 #endif /* FF_SAT_E */ | |
3637 } | |
3638 } | |
3639 else | |
3640 { | |
3641 psaCC_FreeCtbNtry (cId); | |
3642 } | |
3643 break; | |
3644 | |
3645 case( CTX_CC_RESULT ): | |
3646 | |
3647 cmhSAT_SetupCalAfterCCRes ( !satShrdPrm.ownSAT, cId, satShrdPrm.capParm.CCres ); | |
3648 break; | |
3649 } | |
3650 break; | |
3651 | |
3652 case( MNCC_CAUSE_MS_INCOMPAT_DEST ): | |
3653 default: | |
3654 | |
3655 /* | |
3656 *------------------------------------------------------------------- | |
3657 * inform about unsuccessful call setup | |
3658 *------------------------------------------------------------------- | |
3659 */ | |
3660 /* setup initiated by user */ | |
3661 if( !satShrdPrm.ownSAT ) | |
3662 { | |
3663 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf); | |
3664 psaCC_FreeCtbNtry (cId); | |
3665 | |
3666 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent ); | |
3667 | |
3668 /* log result */ | |
3669 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME, (T_ACI_AT_CMD)cmdBuf, | |
3670 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
3671 } | |
3672 /* setup initiated by SAT */ | |
3673 else | |
3674 { | |
3675 /* send SAT response */ | |
3676 resp_data.resCC = (satShrdPrm.capParm.cntxt EQ CTX_CC_RESULT)? | |
3677 &satShrdPrm.capParm.CCres: NULL; | |
3678 | |
3679 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
3680 } | |
3681 break; | |
3682 } | |
3683 } | |
3684 | |
3685 /* | |
3686 +-------------------------------------------------------------------+ | |
3687 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3688 | ROUTINE : cmhSAT_SetupCalAfterCCRes| | |
3689 +-------------------------------------------------------------------+ | |
3690 | |
3691 PURPOSE : This function proceeds with call setup after call control | |
3692 by SIM result. | |
3693 */ | |
3694 | |
3695 GLOBAL BOOL cmhSAT_SetupCalAfterCCRes ( UBYTE ownNotSAT, SHORT cId, | |
3696 UBYTE CCres) | |
3697 { | |
3698 SHORT actId; /* holds active call id */ | |
3699 UBYTE cmdBuf; /* buffers command */ | |
3700 UBYTE srcBuf; /* buffers command source */ | |
3701 UBYTE idx; /* holds list index */ | |
3702 T_ACI_SAT_TERM_RESP resp_data; | |
3703 #ifdef FF_SAT_E | |
3704 T_ACI_SATA_ADD addPrm; | |
3705 #endif /* FF_SAT_E */ | |
3706 | |
3707 psaSAT_InitTrmResp( &resp_data ); | |
3708 | |
3709 /* | |
3710 *------------------------------------------------------------ | |
3711 * perform call setup initiated by user | |
3712 *------------------------------------------------------------ | |
3713 */ | |
3714 if( ownNotSAT ) | |
3715 { | |
3716 /* check for an active call */ | |
3717 actId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT ); | |
3718 | |
3719 if( actId NEQ NO_ENTRY ) | |
3720 { | |
3721 /* put active on hold if possible */ | |
3722 if( psaCC_ctb(actId)->prio EQ MNCC_PRIO_NORM_CALL AND | |
3723 cmhCC_getcalltype(cId) EQ VOICE_CALL ) | |
3724 { | |
3725 cmhCC_HoldCall(actId, (T_ACI_CMD_SRC)psaCC_ctb(cId)->curSrc, AT_CMD_D); | |
3726 } | |
3727 /* reject call setup */ | |
3728 else | |
3729 { | |
3730 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);; | |
3731 psaCC_FreeCtbNtry (cId); | |
3732 | |
3733 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent ); | |
3734 | |
3735 /* log result */ | |
3736 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME, (T_ACI_AT_CMD)cmdBuf, | |
3737 -1,BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
3738 return( FALSE ); | |
3739 } | |
3740 } | |
3741 | |
3742 /* finally set up call */ | |
3743 cmhCC_flagCall( cId, | |
3744 &(cmhPrm[psaCC_ctb(cId)->calOwn].ccCmdPrm.mltyCncFlg)); | |
3745 | |
3746 psaCC_NewCall(cId); | |
3747 | |
3748 return( FALSE ); | |
3749 } | |
3750 | |
3751 /* | |
3752 *------------------------------------------------------------ | |
3753 * perform call setup initiated by SAT | |
3754 *------------------------------------------------------------ | |
3755 */ | |
3756 else | |
3757 { | |
3758 /* alert user if command details are supported */ | |
3759 if( cmhSAT_ChckCmdDet() ) | |
3760 { | |
3761 /* check aoc condition */ | |
3762 if ((psaCC_ctb(cId)->prio EQ MNCC_PRIO_NORM_CALL) AND | |
3763 (aoc_check_moc() EQ FALSE)) | |
3764 /* | |
3765 * check ACM exceeds ACMmax | |
3766 * for non-emergency calls | |
3767 */ | |
3768 { | |
3769 resp_data.add_content = ADD_NO_CAUSE; | |
3770 resp_data.resCC = (CCres EQ CCR_ALLW_WITH_MDFY)? &CCres: NULL; | |
3771 | |
3772 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data); | |
3773 psaCC_FreeCtbNtry (cId); | |
3774 return( FALSE ); | |
3775 } | |
3776 | |
3777 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
3778 { | |
3779 #ifdef FF_SAT_E | |
3780 addPrm.chnType = SATA_CT_VOICE; | |
3781 addPrm.chnEst = SATA_EST_IM; | |
3782 | |
3783 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur, &addPrm ); | |
3784 #else /* FF_SAT_E */ | |
3785 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId+1, satShrdPrm.dur ); | |
3786 #endif /* FF_SAT_E */ | |
3787 } | |
3788 | |
3789 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
3790 | |
3791 return( TRUE ); | |
3792 } | |
3793 return( FALSE); | |
3794 } | |
3795 } | |
3796 | |
3797 /* | |
3798 +-------------------------------------------------------------------+ | |
3799 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
3800 | ROUTINE : cmhSAT_sendSM | | |
3801 +-------------------------------------------------------------------+ | |
3802 | |
3803 PURPOSE : This function sends a Short Message requested by SAT. | |
3804 If the request is going to be processed, the function | |
3805 returns TRUE. | |
3806 | |
3807 */ | |
3808 | |
3809 GLOBAL BOOL cmhSAT_sendSM ( T_SEND_SM * sm ) | |
3810 { | |
3811 T_ACI_RETURN retVal; /* holds return value */ | |
3812 UBYTE fo; | |
3813 USHORT oct_nr; | |
3814 | |
3815 USHORT sca_addr_len; /* length of service center address */ | |
3816 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
3817 T_ACI_SM_DATA pdu; | |
3818 | |
3819 UBYTE packed_data[MAX_SM_LEN]; | |
3820 UBYTE header_len; | |
3821 UBYTE dcs, *p_dcs; | |
3822 UBYTE udl, *p_udl; | |
3823 UBYTE oct_udl; | |
3824 | |
3825 UBYTE *sm_cont; /* pointer to the current position in the pdu */ | |
3826 T_ACI_SAT_TERM_RESP resp_data; | |
3827 | |
3828 TRACE_FUNCTION("cmhSAT_sendSM()"); | |
3829 | |
3830 psaSAT_InitTrmResp( &resp_data ); | |
3831 // here , pinghua add this code for simtookit function : OMAPS00109462 | |
3832 if(mmShrdPrm.regStat NEQ RS_FULL_SRV) | |
3833 { | |
3834 resp_data.add_content = ADD_ME_NO_SERV; | |
3835 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
3836 return FALSE ; | |
3837 } | |
3838 | |
3839 // add end | |
3840 pdu.len = 0; | |
3841 | |
3842 pSMSSetPrm = smsShrdPrm.pSetPrm[OWN_SRC_SAT]; | |
3843 | |
3844 /* | |
3845 *------------------------------------------------------------------- | |
3846 * check presence of SMS TPDU | |
3847 *------------------------------------------------------------------- | |
3848 */ | |
3849 if (!sm->v_smpdu) | |
3850 { | |
3851 /* respond with "error, required values are missing" */ | |
3852 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3853 return( FALSE ); | |
3854 } | |
3855 /* | |
3856 *------------------------------------------------------------------- | |
3857 * get SCA | |
3858 *------------------------------------------------------------------- | |
3859 */ | |
3860 if (sm->v_addr AND sm->addr.c_bcdDigit > 0) | |
3861 { | |
3862 if (sm->addr.c_bcdDigit >= MAX_SMS_NUM_LEN) | |
3863 { | |
3864 TRACE_EVENT("cmhSAT_sendSM: ERROR SMSC address to long"); | |
3865 /* SCA number too long */ | |
3866 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3867 return( FALSE ); | |
3868 } | |
3869 | |
3870 /* copy the sca into the pdu */ | |
3871 sca_addr_len = CodeRPAddress(pdu.data, | |
3872 (UBYTE)sm->addr.c_bcdDigit, | |
3873 sm->addr.noa, | |
3874 sm->addr.npi, | |
3875 sm->addr.bcdDigit); | |
3876 | |
3877 } | |
3878 else | |
3879 { | |
3880 /* ACI-SPR-16431: changes */ | |
3881 if ( psaSIM_ChkSIMSrvSup( SRV_SMS_Parms ) ) /* verify that SMSP is provided */ | |
3882 { | |
3883 if ( pSMSSetPrm -> sca.c_num > 0 ) /* verify that SMSP contains address */ | |
3884 { | |
3885 /* ready to copy the sca into the pdu */ | |
3886 sca_addr_len = CodeRPAddress(pdu.data, | |
3887 pSMSSetPrm -> sca.c_num, | |
3888 pSMSSetPrm -> sca.ton, | |
3889 pSMSSetPrm -> sca.npi, | |
3890 pSMSSetPrm -> sca.num); | |
3891 } | |
3892 else | |
3893 { | |
3894 /* ERROR: SMSP address EMPTY */ | |
3895 TRACE_EVENT("cmhSAT_sendSM: ERROR: SMSP address EMPTY"); | |
3896 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); /* TR(20) */ | |
3897 return( FALSE ); | |
3898 } | |
3899 } | |
3900 else | |
3901 { | |
3902 /* ERROR: SMSP NOT available */ | |
3903 TRACE_EVENT("cmhSAT_sendSM: ERROR: SMSP NOT available"); | |
3904 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); /* TR(20) */ | |
3905 return( FALSE ); | |
3906 } | |
3907 } | |
3908 | |
3909 /* | |
3910 *------------------------------------------------------------------- | |
3911 * check and evaluate SMS TPDU | |
3912 *------------------------------------------------------------------- | |
3913 */ | |
3914 if (sm->smpdu.c_tpdu_data > 0) | |
3915 { | |
3916 fo = sm->smpdu.tpdu_data[0]; /* first octet with Message Type */ | |
3917 switch (fo & TP_MTI_MASK) | |
3918 { | |
3919 case TP_MTI_SMS_SUBMIT: | |
3920 if (sm->smpdu.c_tpdu_data < 7) | |
3921 { | |
3922 /* not the minimum length for TP-SUBMIT */ | |
3923 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3924 return( FALSE ); | |
3925 } | |
3926 if (sm->smpdu.tpdu_data[2] >= MAX_SMS_NUM_LEN) | |
3927 { | |
3928 /* destination number too long */ | |
3929 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3930 return( FALSE ); | |
3931 } | |
3932 | |
3933 /* oct_nr is the number of bytes in address value */ | |
3934 oct_nr = (USHORT)((sm->smpdu.tpdu_data[2] + 1) / 2); | |
3935 if ((oct_nr + 7) > (USHORT)sm->smpdu.c_tpdu_data) | |
3936 { | |
3937 /* number length inconsistent with overall length for TP-SUBMIT */ | |
3938 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3939 return( FALSE ); | |
3940 } | |
3941 | |
3942 /* sm_cont points now to TP-DCS */ | |
3943 sm_cont = &sm->smpdu.tpdu_data[4 + oct_nr + 1]; | |
3944 p_dcs = &pdu.data[sca_addr_len+4 + oct_nr + 1]; | |
3945 | |
3946 /* sm_cont points now to TP-VP */ | |
3947 dcs = *sm_cont++; | |
3948 | |
3949 | |
3950 switch (fo & TP_VPF_MASK) | |
3951 { | |
3952 case TP_VPF_NOT_PRESENT: | |
3953 default: | |
3954 /* oct_nr is length of TP-UD */ | |
3955 oct_nr = (USHORT)sm->smpdu.c_tpdu_data - oct_nr - 7; | |
3956 break; | |
3957 | |
3958 case TP_VPF_RELATIVE: | |
3959 if ((oct_nr + 8) > (USHORT)sm->smpdu.c_tpdu_data) | |
3960 { | |
3961 /* not the required length for TP-SUBMIT with VP-RELATIVE */ | |
3962 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3963 return( FALSE ); | |
3964 } | |
3965 /* sm_cont points now to TP-UDL */ | |
3966 sm_cont++; | |
3967 | |
3968 /* oct_nr is length of TP-UD */ | |
3969 oct_nr = (USHORT)sm->smpdu.c_tpdu_data - oct_nr - 8; | |
3970 break; | |
3971 | |
3972 case TP_VPF_ABSOLUTE: | |
3973 case TP_VPF_ENHANCED: /* treat as VP-ABSOLUTE */ | |
3974 if ((oct_nr + 14) > (USHORT)sm->smpdu.c_tpdu_data) | |
3975 { | |
3976 /* not the required length for TP-SUBMIT with VP-ABSOLUTE */ | |
3977 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
3978 return( FALSE ); | |
3979 } | |
3980 | |
3981 /* sm_cont points now to TP-UDL */ | |
3982 sm_cont += 7; | |
3983 | |
3984 /* oct_nr is length of TP-UD */ | |
3985 oct_nr = (USHORT)sm->smpdu.c_tpdu_data - oct_nr - 14; | |
3986 break; | |
3987 } | |
3988 | |
3989 | |
3990 header_len = sm->smpdu.c_tpdu_data - oct_nr; | |
3991 p_udl = &pdu.data[sca_addr_len + header_len - 1]; | |
3992 | |
3993 | |
3994 switch (cmhSMS_getAlphabetPp (dcs)) | |
3995 { | |
3996 default: /* 7 bit default aphabet */ | |
3997 if (*sm_cont > 160) | |
3998 { | |
3999 /* SM length inconsistent */ | |
4000 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4001 return( FALSE ); | |
4002 } | |
4003 #ifdef _PACK_DEF_ALPHA | |
4004 /* packing required */ | |
4005 if (satShrdPrm.cmdDet.cmdQlf EQ QLF_SMS_PACK AND | |
4006 (USHORT)*sm_cont EQ oct_nr) /* check if packing is valid at all | |
4007 (so *sm_cont must be equal of remaining bytes) | |
4008 otherwise do not repack the data since it seems that | |
4009 data has already been packed. | |
4010 This is CQ18268/MOBil57469 */ | |
4011 { | |
4012 /* length in septets, sm_cont points now to TP-UD */ | |
4013 udl = *sm_cont++; | |
4014 | |
4015 /* oct_udl is the length of packed data in octets */ | |
4016 oct_udl = utl_cvt8To7 (sm_cont, udl, packed_data, 0); | |
4017 | |
4018 /* copy the header into the pdu */ | |
4019 memcpy(&pdu.data[sca_addr_len], sm->smpdu.tpdu_data, | |
4020 header_len); | |
4021 | |
4022 /* copy the packed user data into the pdu */ | |
4023 memcpy (&pdu.data[sca_addr_len+header_len], packed_data, oct_udl); | |
4024 | |
4025 pdu.len = sca_addr_len+header_len+oct_udl; | |
4026 | |
4027 retVal = sAT_PlusCMGSPdu ((T_ACI_CMD_SRC)OWN_SRC_SAT, &pdu); | |
4028 switch (retVal) | |
4029 { | |
4030 case AT_CMPL: | |
4031 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
4032 return TRUE; | |
4033 | |
4034 case AT_BUSY: | |
4035 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4036 return( FALSE ); | |
4037 | |
4038 case AT_FAIL: | |
4039 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4040 return( FALSE ); | |
4041 } | |
4042 return TRUE; | |
4043 } /* if (satShrdPrm.cmdDet.cmdQlf EQ QLF_SMS_PACK) */ | |
4044 else | |
4045 #endif /* _PACK_DEF_ALPHA: ignore PACKING REQUIRED for GSM default | |
4046 alphabet, when not set */ | |
4047 { | |
4048 /* packing not required */ | |
4049 udl = *sm_cont; | |
4050 oct_udl = ((*sm_cont + 1)*7)/8; | |
4051 } | |
4052 break; | |
4053 | |
4054 | |
4055 case 1: /* 8 bit data */ | |
4056 if (satShrdPrm.cmdDet.cmdQlf EQ QLF_SMS_PACK | |
4057 AND ((dcs & 0xE0) NEQ 0x20)) | |
4058 { /* packing only, when text is uncompressed */ | |
4059 if ((USHORT)*sm_cont > oct_nr OR *sm_cont > 160) | |
4060 { | |
4061 /* SM length inconsistent */ | |
4062 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4063 return( FALSE ); | |
4064 } | |
4065 if ((dcs & 0xC0) EQ 0) | |
4066 dcs &= 0xF3; /* adjust coding group 00xx */ | |
4067 else if ((dcs & 0xF0) EQ 0xF0) | |
4068 dcs &= 0xFB; /* adjust coding group 1111 */ | |
4069 | |
4070 /* length in septets, sm_cont points now to TP-UD */ | |
4071 udl = *sm_cont++; | |
4072 | |
4073 /* oct_udl is the length of packed data in octets */ | |
4074 oct_udl = utl_cvt8To7 (sm_cont, udl, packed_data, 0); | |
4075 | |
4076 /* copy the header into the pdu */ | |
4077 memcpy(&pdu.data[sca_addr_len], sm->smpdu.tpdu_data, | |
4078 header_len); | |
4079 | |
4080 /* copy the dcs into the pdu */ | |
4081 *p_dcs = dcs; | |
4082 | |
4083 /* copy the packed user data into the pdu */ | |
4084 memcpy (&pdu.data[sca_addr_len+header_len], packed_data, oct_udl); | |
4085 | |
4086 pdu.len = sca_addr_len+header_len+oct_udl; | |
4087 | |
4088 retVal = sAT_PlusCMGSPdu ((T_ACI_CMD_SRC)OWN_SRC_SAT, &pdu); | |
4089 switch (retVal) | |
4090 { | |
4091 case AT_CMPL: | |
4092 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
4093 return TRUE; | |
4094 | |
4095 case AT_BUSY: | |
4096 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4097 return( FALSE ); | |
4098 | |
4099 case AT_FAIL: | |
4100 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4101 return( FALSE ); | |
4102 } | |
4103 return TRUE; | |
4104 } | |
4105 /* sandip CQ - 18269 | |
4106 * To take care of a case where Command qualifier == 0x00( packing not required ) | |
4107 * DCS == 0x04( 8 -bit packing ) | |
4108 * TPDU length >140 | |
4109 */ | |
4110 | |
4111 /* | |
4112 else if((satShrdPrm.cmdDet.cmdQlf EQ QLF_SMS_NO_PACK) && (oct_nr > 140)) | |
4113 { | |
4114 psaSAT_SendTrmResp(RSLT_UNKN_DATA,&resp_data); | |
4115 return(FALSE); | |
4116 }*/ | |
4117 else | |
4118 { | |
4119 if(oct_nr > 140) | |
4120 { | |
4121 psaSAT_SendTrmResp(RSLT_UNKN_DATA,&resp_data); | |
4122 return(FALSE); | |
4123 } | |
4124 /* packing not required */ | |
4125 udl = *sm_cont; | |
4126 oct_udl = *sm_cont; | |
4127 } | |
4128 break; | |
4129 | |
4130 case 2: /* UCS2 */ | |
4131 /* | |
4132 * Special consideration: are octets (incorrect) or UCS2 | |
4133 * characters (correct) counted by SAT? | |
4134 */ | |
4135 if ((USHORT)*sm_cont EQ oct_nr) | |
4136 oct_udl = *sm_cont++; /* assume octet count */ | |
4137 else | |
4138 oct_udl= *sm_cont++ * 2; /* assume character count */ | |
4139 udl = oct_udl; | |
4140 break; | |
4141 } /* switch (cmhSMS_getAlphabetPp (dcs)) */ | |
4142 | |
4143 | |
4144 if ((USHORT)oct_udl > oct_nr OR oct_udl > MAX_SM_LEN) | |
4145 { | |
4146 /* SM length inconsistent */ | |
4147 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4148 return( FALSE ); | |
4149 } | |
4150 | |
4151 /* copy the tpdu data into the pdu */ | |
4152 memcpy(&pdu.data[sca_addr_len], sm->smpdu.tpdu_data, sm->smpdu.c_tpdu_data); | |
4153 | |
4154 /* copy the udl into the pdu */ | |
4155 *p_udl = udl; | |
4156 | |
4157 pdu.len = sca_addr_len + sm->smpdu.c_tpdu_data; | |
4158 | |
4159 retVal = sAT_PlusCMGSPdu ((T_ACI_CMD_SRC)OWN_SRC_SAT, &pdu); | |
4160 switch (retVal) | |
4161 { | |
4162 case AT_CMPL: | |
4163 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
4164 return TRUE; | |
4165 | |
4166 case AT_BUSY: | |
4167 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4168 return( FALSE ); | |
4169 | |
4170 case AT_FAIL: | |
4171 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4172 return( FALSE ); | |
4173 } /* end switch (retVal) */ | |
4174 return TRUE; | |
4175 | |
4176 | |
4177 case TP_MTI_SMS_COMMAND: | |
4178 if (sm->smpdu.c_tpdu_data < 8) | |
4179 { | |
4180 /* not the minimum length for TP-COMMAND */ | |
4181 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4182 return( FALSE ); | |
4183 } | |
4184 if (sm->smpdu.tpdu_data[5] >= MAX_SMS_NUM_LEN) | |
4185 { | |
4186 /* destination number too long */ | |
4187 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4188 return( FALSE ); | |
4189 } | |
4190 oct_nr = (USHORT)((sm->smpdu.tpdu_data[5] + 1) / 2); | |
4191 if ((oct_nr + 8) > (USHORT)sm->smpdu.c_tpdu_data) | |
4192 { | |
4193 /* number length inconsistent with overall length for TP-SUBMIT */ | |
4194 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4195 return( FALSE ); | |
4196 } | |
4197 | |
4198 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
4199 /* | |
4200 ** If the MMI is a Cust1 Application | |
4201 */ | |
4202 if (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1) | |
4203 { | |
4204 /* | |
4205 ** Having performed some checks, | |
4206 ** don't send the primitve, but pass the entire command to the MMI for processing. | |
4207 ** NOTE: An SMS Command is not passed to the SIM for MO SMS Control By SIM | |
4208 ** | |
4209 ** Ensure that the SMS parameters are reset, so that the SMS Entity is freed to | |
4210 ** process the command later. | |
4211 */ | |
4212 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
4213 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
4214 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
4215 | |
4216 cmhSAT_Cust1StkCmdInd(); | |
4217 return TRUE; | |
4218 } | |
4219 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
4220 | |
4221 memcpy(&pdu.data[sca_addr_len], sm->smpdu.tpdu_data, sm->smpdu.c_tpdu_data); | |
4222 retVal = sAT_PlusCMGCPdu ((T_ACI_CMD_SRC)OWN_SRC_SAT, &pdu); | |
4223 switch (retVal) | |
4224 { | |
4225 case AT_CMPL: | |
4226 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
4227 return TRUE; | |
4228 | |
4229 case AT_BUSY: | |
4230 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4231 return( FALSE ); | |
4232 | |
4233 case AT_FAIL: | |
4234 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4235 return( FALSE ); | |
4236 } | |
4237 return TRUE; | |
4238 | |
4239 default: | |
4240 /* invalid message type */ | |
4241 psaSAT_SendTrmResp( RSLT_UNKN_DATA, &resp_data ); | |
4242 return( FALSE ); | |
4243 } /* end switch (fo & TP_MTI_MASK) */ | |
4244 } | |
4245 else /* if (sm->smpdu.c_tpdu_data > 0) */ | |
4246 { | |
4247 /* respond with "error, required values are missing" */ | |
4248 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4249 return( FALSE ); | |
4250 } | |
4251 } | |
4252 | |
4253 /* | |
4254 +-------------------------------------------------------------------+ | |
4255 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
4256 | ROUTINE : cmhSAT_CheckSetEventResp| | |
4257 +-------------------------------------------------------------------+ | |
4258 | |
4259 PURPOSE : check for an answer to a setup event list. function | |
4260 returns TRUE if caller has to forward the checked | |
4261 SAT response | |
4262 */ | |
4263 | |
4264 GLOBAL BOOL cmhSAT_CheckSetEventResp ( void ) | |
4265 { | |
4266 BOOL list_in_process; | |
4267 const UBYTE TermRespSetEventOk [12] = | |
4268 { | |
4269 0x81, /* command details tag */ | |
4270 0x03, /* command details length */ | |
4271 0x13, /* command number */ | |
4272 0x05, /* command SETUP EVENT LIST */ | |
4273 0x00, /* not used */ | |
4274 0x82, /* device details tag */ | |
4275 0x02, /* device details length */ | |
4276 0x82, /* source ME */ | |
4277 0x81, /* destination SIM */ | |
4278 0x83, /* result tag */ | |
4279 0x01, /* result length */ | |
4280 0x00 /* result OK */ | |
4281 }; | |
4282 const UBYTE TermRespSetEvent [4] = | |
4283 { | |
4284 0x81, /* command details tag */ | |
4285 0x03, /* command details length */ | |
4286 0x13, /* command number */ | |
4287 0x05, /* command SETUP EVENT LIST */ | |
4288 }; | |
4289 UBYTE *p; | |
4290 | |
4291 T_ACI_SAT_TERM_RESP resp_data; | |
4292 | |
4293 TRACE_FUNCTION("cmhSAT_CheckSetEventResp"); | |
4294 | |
4295 psaSAT_InitTrmResp( &resp_data ); | |
4296 | |
4297 list_in_process = ( satShrdPrm.event.temp_list & 0x8000 ) > 0L; | |
4298 | |
4299 if ( list_in_process ) | |
4300 { | |
4301 | |
4302 p = (satShrdPrm.setPrm[satShrdPrm.owner].stkCmd); | |
4303 | |
4304 if ((!memcmp((const UBYTE*) p, TermRespSetEvent,2)) AND (p[3] EQ TermRespSetEvent[3])) /* TRUE means: answer to a SETUP EVENT Command */ | |
4305 { | |
4306 if (!memcmp((const UBYTE*) p+3, TermRespSetEventOk+3, 9)) /* TRUE means: answer ok */ | |
4307 { | |
4308 cmhSAT_setupEvent_Perform(); /* accept list */ | |
4309 TRACE_EVENT("New Download Event List accepted "); | |
4310 return TRUE; /* caller has to send/forward TR */ | |
4311 } | |
4312 else | |
4313 { | |
4314 /* MMI couldn't perform the list: ACI doesn't perform it and returns | |
4315 Beyond Mobile Capabilities */ | |
4316 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4317 TRACE_EVENT("New Download Event List refused by MMI"); | |
4318 satShrdPrm.event.temp_list = 0L; /* reinitialize for next setup list */ | |
4319 return FALSE; /* caller hasn't to send TR, already sent! */ | |
4320 } | |
4321 } | |
4322 else | |
4323 { | |
4324 return TRUE; /* caller has to send/forward TR */ | |
4325 } | |
4326 } | |
4327 return TRUE; /* caller has to send/forward TR */ | |
4328 } | |
4329 | |
4330 /* SAT CLASS E FUNCTIONS START */ | |
4331 #ifdef FF_SAT_E | |
4332 | |
4333 /* | |
4334 +-------------------------------------------------------------------+ | |
4335 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
4336 | ROUTINE : cmhSAT_CloseChannel | | |
4337 +-------------------------------------------------------------------+ | |
4338 | |
4339 PURPOSE : This function handles the request by SAT to close a | |
4340 desired channel. If the request is going to be processed, | |
4341 the function returns TRUE. | |
4342 | |
4343 */ | |
4344 | |
4345 GLOBAL BOOL cmhSAT_CloseChannel ( void ) | |
4346 { | |
4347 T_SIM_SAT_CHN chnInf; | |
4348 | |
4349 TRACE_FUNCTION("cmhSAT_CloseChannel()"); | |
4350 | |
4351 /* | |
4352 *------------------------------------------------------------------- | |
4353 * notify about SAT command | |
4354 *------------------------------------------------------------------- | |
4355 */ | |
4356 cmhSAT_STKUsrNtfy(); | |
4357 | |
4358 | |
4359 /* | |
4360 *------------------------------------------------------------------- | |
4361 * check channel status | |
4362 *------------------------------------------------------------------- | |
4363 */ | |
4364 if( satShrdPrm.chnTb.chnUsdFlg ) | |
4365 { | |
4366 chnInf.bipConn = SIM_BIP_UNKNOWN; | |
4367 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
4368 | |
4369 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN ) | |
4370 { | |
4371 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
4372 | |
4373 } | |
4374 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_CNCT ) | |
4375 { | |
4376 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
4377 chnInf.dtiConn = SIM_DTI_DISCONNECT; | |
4378 } | |
4379 | |
4380 satShrdPrm.opchStat = OPCH_CLS_REQ; | |
4381 | |
4382 if( chnInf.bipConn ) | |
4383 { | |
4384 #ifdef DTI | |
4385 | |
4386 chnInf.chnId = CHANNEL_ID_1; | |
4387 chnInf.genRes = RSLT_PERF_SUCCESS; | |
4388 chnInf.addRes = ADD_NO_CAUSE; | |
4389 | |
4390 psaSIM_SATBIPChn( chnInf, NULL /*cmhSAT_OpChnClose*/); | |
4391 #endif /* DTI */ | |
4392 } | |
4393 else | |
4394 { | |
4395 cmhSAT_OpChnClose( SIM_BIP_CLOSE_CHANNEL, 1 ); | |
4396 } | |
4397 } | |
4398 | |
4399 return TRUE; | |
4400 } | |
4401 | |
4402 /* | |
4403 +-------------------------------------------------------------------+ | |
4404 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
4405 | ROUTINE : cmhSAT_SendData | | |
4406 +-------------------------------------------------------------------+ | |
4407 | |
4408 PURPOSE : This function handles the request by SAT to open a | |
4409 desired channel immediately. If the request is going to | |
4410 be processed, the function returns TRUE. | |
4411 | |
4412 */ | |
4413 | |
4414 GLOBAL BOOL cmhSAT_SendData ( void ) | |
4415 { | |
4416 #ifdef GPRS | |
4417 SHORT cid_array[2] = { 0,PDP_CONTEXT_CID_INVALID }; | |
4418 #endif /* GPRS */ | |
4419 | |
4420 TRACE_FUNCTION("cmhSAT_SendData()"); | |
4421 | |
4422 /* | |
4423 *------------------------------------------------------------------- | |
4424 * notify about SAT command | |
4425 *------------------------------------------------------------------- | |
4426 */ | |
4427 cmhSAT_STKUsrNtfy(); | |
4428 | |
4429 /* | |
4430 *------------------------------------------------------------------- | |
4431 * check if on demand channel activation has to be performed | |
4432 *------------------------------------------------------------------- | |
4433 */ | |
4434 if( satShrdPrm.opchStat EQ OPCH_ON_DMND AND | |
4435 satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN AND | |
4436 satShrdPrm.cmdDet.cmdQlf & QLF_OPCH_IMMDT_LINK_EST ) | |
4437 { | |
4438 satShrdPrm.opchStat = OPCH_EST_REQ; | |
4439 | |
4440 /* | |
4441 *------------------------------------------------------------------- | |
4442 * for a CSD channel | |
4443 *------------------------------------------------------------------- | |
4444 */ | |
4445 if( satShrdPrm.opchType EQ B_CSD ) | |
4446 { | |
4447 if (!psaCC_ctbIsValid (satShrdPrm.chnTb.chnRefId)) | |
4448 { | |
4449 TRACE_ERROR ("Call table entry disappeared"); | |
4450 satShrdPrm.chnTb.chnUsdFlg = FALSE; | |
4451 | |
4452 return ( FALSE ); | |
4453 } | |
4454 | |
4455 /* check temporary problems */ | |
4456 if( cmhSAT_OpChnChkTmpProblem() ) | |
4457 { | |
4458 /* remove call table entry */ | |
4459 psaCC_FreeCtbNtry (satShrdPrm.chnTb.chnRefId); | |
4460 satShrdPrm.chnTb.chnUsdFlg = FALSE; | |
4461 | |
4462 return( FALSE ); | |
4463 } | |
4464 #ifdef DTI | |
4465 #ifdef CO_UDP_IP | |
4466 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
4467 { | |
4468 /* enable establishment of UDP data chain */ | |
4469 sAT_PercentWAP ( (T_ACI_CMD_SRC)psaCC_ctb(satShrdPrm.chnTb.chnRefId)->curSrc , 1 ); | |
4470 | |
4471 /* setup PPP parameters */ | |
4472 cmhSAT_OpChnSetPPP( satShrdPrm.opchType ); | |
4473 } | |
4474 #endif /* CO_UDP_IP */ | |
4475 #endif /* DTI */ | |
4476 | |
4477 /* set up call */ | |
4478 cmhPrm[satShrdPrm.opchAcptSrc].ccCmdPrm.mltyCncFlg = 0; | |
4479 | |
4480 cmhCC_flagCall( satShrdPrm.chnTb.chnRefId, &cmhPrm[satShrdPrm.opchAcptSrc]. | |
4481 ccCmdPrm.mltyCncFlg); | |
4482 /* ccShrdPrm.ctb[satShrdPrm.chnTb.chnRefId].curCmd = AT_CMD_A; */ | |
4483 /* ccShrdPrm.ctb[satShrdPrm.chnTb.chnRefId].curSrc = satShrdPrm.opchAcptSrc; */ | |
4484 /* psaCC_NewCall ( satShrdPrm.chnTb.chnRefId ); */ | |
4485 cmhCC_NewCall( satShrdPrm.chnTb.chnRefId, | |
4486 (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
4487 AT_CMD_A); | |
4488 return( TRUE ); | |
4489 } | |
4490 /* | |
4491 *------------------------------------------------------------------- | |
4492 * for a GPRS channel | |
4493 *------------------------------------------------------------------- | |
4494 */ | |
4495 #if defined (GPRS) AND defined (DTI) | |
4496 else if( satShrdPrm.opchType EQ B_GPRS ) | |
4497 { | |
4498 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
4499 | |
4500 /* check temporary problems */ | |
4501 if( cmhSAT_OpChnChkTmpProblem() ) | |
4502 { | |
4503 /* any reset of cid parameters should be placed here, | |
4504 * if necessary | |
4505 */ | |
4506 return( FALSE ); | |
4507 } | |
4508 | |
4509 #ifdef DTI | |
4510 #ifdef CO_UDP_IP | |
4511 /* activate the context with UDP */ | |
4512 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
4513 { | |
4514 /* enable establishment of UDP data chain */ | |
4515 sAT_PercentWAP ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc , 1 ); | |
4516 | |
4517 /* setup PPP parameters */ | |
4518 cmhSAT_OpChnSetPPP( B_GPRS ); | |
4519 | |
4520 /* activate context with UDP */ | |
4521 cmhSAT_OpChnUDPActivateGprs(); | |
4522 } | |
4523 else | |
4524 #endif /* CO_UDP_IP */ | |
4525 #endif /* DTI */ | |
4526 | |
4527 /* activate context with no transport layer */ | |
4528 if( sAT_PlusCGACT( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, CGACT_STATE_ACTIVATED, cid_array ) | |
4529 NEQ AT_EXCT ) | |
4530 | |
4531 return( FALSE ); | |
4532 | |
4533 satShrdPrm.opchStat = OPCH_EST_REQ; | |
4534 | |
4535 return( TRUE ); | |
4536 } | |
4537 #endif /* GPRS */ | |
4538 /* | |
4539 *------------------------------------------------------------------- | |
4540 * invalid channel | |
4541 *------------------------------------------------------------------- | |
4542 */ | |
4543 else | |
4544 { | |
4545 T_ACI_SAT_TERM_RESP resp_data; | |
4546 | |
4547 TRACE_ERROR("invalid channel found, on demand est. failed"); | |
4548 | |
4549 psaSAT_InitTrmResp( &resp_data ); | |
4550 resp_data.add_content = ADD_NO_CAUSE; | |
4551 | |
4552 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
4553 | |
4554 cmhSAT_cleanupOpChnPrms(); | |
4555 | |
4556 } | |
4557 } | |
4558 | |
4559 return FALSE; | |
4560 } | |
4561 | |
4562 /* | |
4563 +-------------------------------------------------------------------+ | |
4564 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
4565 | ROUTINE : cmhSAT_GetChannelStatus | | |
4566 +-------------------------------------------------------------------+ | |
4567 | |
4568 PURPOSE : This function handles the request by SAT to return the | |
4569 current status of all channels. If the request is going | |
4570 to be processed, the function returns TRUE. | |
4571 | |
4572 */ | |
4573 | |
4574 GLOBAL BOOL cmhSAT_GetChannelStatus ( void ) | |
4575 { | |
4576 T_ACI_SAT_TERM_RESP resp_data; | |
4577 | |
4578 psaSAT_InitTrmResp( &resp_data ); | |
4579 | |
4580 | |
4581 TRACE_FUNCTION("cmhSAT_GetChannelStatus()"); | |
4582 | |
4583 /* | |
4584 *------------------------------------------------------------------- | |
4585 * notify about SAT command | |
4586 *------------------------------------------------------------------- | |
4587 */ | |
4588 cmhSAT_STKUsrNtfy(); | |
4589 | |
4590 /* | |
4591 *------------------------------------------------------------------- | |
4592 * return channel status | |
4593 *------------------------------------------------------------------- | |
4594 */ | |
4595 resp_data.chnStat = TRUE; | |
4596 | |
4597 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
4598 | |
4599 return FALSE; | |
4600 } | |
4601 | |
4602 /* | |
4603 +-------------------------------------------------------------------+ | |
4604 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
4605 | ROUTINE : cmhSAT_OpenChannelReq | | |
4606 +-------------------------------------------------------------------+ | |
4607 | |
4608 PURPOSE : This function handles the request by SAT to open a channel. | |
4609 If the request is going to be processed, the function | |
4610 returns TRUE. | |
4611 | |
4612 */ | |
4613 | |
4614 GLOBAL BOOL cmhSAT_OpenChannelReq ( T_OPEN_CHANNEL *opchCmd ) | |
4615 { | |
4616 #ifdef FAX_AND_DATA | |
4617 T_ACI_RETURN retVal; /* holds return value */ | |
4618 #endif /* FAX_AND_DATA */ | |
4619 SHORT cId; /* holds call id / context id */ | |
4620 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
4621 | |
4622 psaSAT_InitTrmResp( &resp_data ); | |
4623 | |
4624 | |
4625 TRACE_FUNCTION("cmhSAT_OpenChannelReq()"); | |
4626 | |
4627 /* | |
4628 *------------------------------------------------------------------- | |
4629 * check for basic reasons to reject the command | |
4630 *------------------------------------------------------------------- | |
4631 */ | |
4632 resp_data.chnStat = TRUE; | |
4633 satShrdPrm.opchPrmMdf = FALSE; | |
4634 | |
4635 /* Flag the Sat Call */ | |
4636 satShrdPrm.ownSAT = TRUE; | |
4637 | |
4638 /* ME is busy with another open channel command */ | |
4639 if( satShrdPrm.opchStat NEQ OPCH_IDLE ) | |
4640 { | |
4641 TRACE_EVENT("SAT OPCH FAIL, busy with other command"); | |
4642 resp_data.add_content = ADD_NO_CAUSE; | |
4643 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4644 return( FALSE ); | |
4645 } | |
4646 | |
4647 | |
4648 /* is there a IPv6 address given ?*/ | |
4649 if((opchCmd->v_other_addr AND opchCmd->other_addr.v_ipv6_addr) OR | |
4650 (opchCmd->v_data_dest_addr AND opchCmd->data_dest_addr.v_ipv6_addr)) | |
4651 { | |
4652 TRACE_EVENT("SAT OPCH FAIL, IPv6 not supported"); | |
4653 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4654 return( FALSE ); | |
4655 } | |
4656 | |
4657 /* is TCP requested */ | |
4658 if( opchCmd->v_if_transp_lev AND | |
4659 opchCmd->if_transp_lev.trans_prot_type EQ TCP ) | |
4660 { | |
4661 TRACE_EVENT("SAT OPCH FAIL, TCP not supported"); | |
4662 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4663 return( FALSE ); | |
4664 } | |
4665 | |
4666 /* check UDP restrictions, WAP is a synonym for UDP */ | |
4667 if( opchCmd->v_if_transp_lev AND | |
4668 opchCmd->if_transp_lev.trans_prot_type EQ UDP ) | |
4669 { | |
4670 #if !defined (CO_UDP_IP) | |
4671 /* is UDP requested, but WAP not set ?*/ | |
4672 TRACE_EVENT("SAT OPCH FAIL, UDP not supported"); | |
4673 resp_data.add_content = ADD_BIP_SIME_ITL_NAVAIL; | |
4674 psaSAT_SendTrmResp( RSLT_BEARIND_PERR, &resp_data ); | |
4675 return( FALSE ); | |
4676 #endif /* WAP */ | |
4677 | |
4678 /* no destination address given */ | |
4679 if( !opchCmd->v_data_dest_addr ) | |
4680 { | |
4681 TRACE_EVENT("SAT OPCH FAIL, no destination address given"); | |
4682 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4683 return( FALSE ); | |
4684 } | |
4685 } | |
4686 | |
4687 /* requested buffer size is greater than prefered bufffer size 1400 */ | |
4688 if(opchCmd->buffer_size > SIM_CLASS_E_BUFFER_SIZE) | |
4689 { | |
4690 satShrdPrm.opchPrmMdf = TRUE; | |
4691 satShrdPrm.buffer_size = SIM_CLASS_E_BUFFER_SIZE; | |
4692 } | |
4693 else | |
4694 { | |
4695 satShrdPrm.buffer_size = opchCmd->buffer_size; | |
4696 } | |
4697 | |
4698 /**** is CSD channel requested, but not supported ? ****/ | |
4699 #ifndef FAX_AND_DATA | |
4700 if( opchCmd->v_addr ) | |
4701 { | |
4702 /* CSD call not supported by ME */ | |
4703 TRACE_EVENT("SAT OPCH FAIL, CSD not supported"); | |
4704 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4705 return( FALSE ); | |
4706 } | |
4707 #endif /* FAX_AND_DATA */ | |
4708 | |
4709 /**** is GPRS channel requested, but not supported ? ****/ | |
4710 #ifndef GPRS | |
4711 if( !opchCmd->v_addr AND opchCmd->v_bear_desc ) | |
4712 { | |
4713 /* GPRS call not supported by ME */ | |
4714 TRACE_EVENT("SAT OPCH FAIL, GPRS not supported"); | |
4715 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4716 return( FALSE ); | |
4717 } | |
4718 #endif /* GPRS */ | |
4719 | |
4720 | |
4721 /* | |
4722 *------------------------------------------------------------------- | |
4723 * store channel parameters | |
4724 *------------------------------------------------------------------- | |
4725 */ | |
4726 | |
4727 /* | |
4728 *------------------------------------------------------------------- | |
4729 * for a CSD channel use the call table | |
4730 *------------------------------------------------------------------- | |
4731 */ | |
4732 #ifdef FAX_AND_DATA | |
4733 | |
4734 if( opchCmd->v_addr ) | |
4735 { | |
4736 T_CC_CALL_TBL *ctb; | |
4737 | |
4738 /* get call table entry */ | |
4739 cId = psaCC_ctbNewEntry(); | |
4740 | |
4741 if( cId EQ NO_ENTRY ) | |
4742 { | |
4743 /* send SAT response */ | |
4744 TRACE_EVENT("SAT OPCH FAIL, call table full"); | |
4745 resp_data.add_content = ADD_NO_CAUSE; | |
4746 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4747 return( FALSE ); /* primitive not needed anymore */ | |
4748 } | |
4749 | |
4750 ctb = ccShrdPrm.ctb[cId]; | |
4751 | |
4752 /* build setup parameters */ | |
4753 cmhSAT_fillSetupPrm ( cId, | |
4754 &opchCmd->addr, | |
4755 ((opchCmd->v_subaddr)?&opchCmd->subaddr:NULL)); | |
4756 | |
4757 /* check aoc condition */ | |
4758 if ((ctb->prio EQ MNCC_PRIO_NORM_CALL) AND | |
4759 (aoc_check_moc() EQ FALSE)) | |
4760 /* | |
4761 * check ACM exceeds ACMmax | |
4762 * for non-emergency calls | |
4763 */ | |
4764 { | |
4765 TRACE_EVENT("SAT OPCH FAIL, ACM exceeds"); | |
4766 resp_data.add_content = ADD_NO_CAUSE; | |
4767 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4768 psaCC_FreeCtbNtry (cId); | |
4769 return( FALSE ); | |
4770 } | |
4771 | |
4772 /* bearer capabilities */ | |
4773 ctb->rptInd = MNCC_RI_NOT_PRES; | |
4774 | |
4775 if( opchCmd->bear_desc.v_csd_bear_prm ) | |
4776 { | |
4777 UBYTE selVal; | |
4778 | |
4779 /* check and set speed parameter */ | |
4780 selVal = cmhCC_SelRate((T_ACI_BS_SPEED)opchCmd->bear_desc.csd_bear_prm.csd_speed); | |
4781 | |
4782 if( selVal EQ MNCC_UR_NOT_PRES ) | |
4783 { | |
4784 TRACE_EVENT("SAT OPCH FAIL, user rate not supported"); | |
4785 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4786 psaCC_FreeCtbNtry (cId); | |
4787 return( FALSE ); | |
4788 } | |
4789 | |
4790 ctb->BC[0].rate = selVal; | |
4791 | |
4792 /* check and set name parameter */ | |
4793 selVal = cmhCC_SelServ((T_ACI_CBST_NAM)opchCmd->bear_desc.csd_bear_prm.csd_name); | |
4794 | |
4795 if( selVal EQ MNCC_BEARER_SERV_NOT_PRES ) | |
4796 { | |
4797 TRACE_EVENT("SAT OPCH FAIL, user service not supported"); | |
4798 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4799 psaCC_FreeCtbNtry (cId); | |
4800 return( FALSE ); | |
4801 } | |
4802 | |
4803 ctb->BC[0].bearer_serv = selVal; | |
4804 | |
4805 /* check and set ce parameter */ | |
4806 selVal = cmhCC_SelCE((T_ACI_CBST_CE)opchCmd->bear_desc.csd_bear_prm.csd_ce); | |
4807 | |
4808 if( selVal EQ MNCC_CONN_ELEM_NOT_PRES ) | |
4809 { | |
4810 TRACE_EVENT("SAT OPCH FAIL, ce not supported"); | |
4811 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4812 psaCC_FreeCtbNtry (cId); | |
4813 return( FALSE ); | |
4814 } | |
4815 | |
4816 ctb->BC[0].conn_elem = selVal; | |
4817 | |
4818 ctb->BC[0].modem_type = cmhCC_SelMT((T_ACI_BS_SPEED)opchCmd->bear_desc. | |
4819 csd_bear_prm.csd_speed); | |
4820 } | |
4821 | |
4822 else if ( opchCmd->bear_desc.bear_type EQ BT_DEFAULT ) | |
4823 { | |
4824 /* default settings for CSD channel */ | |
4825 ctb->BC[0].rate = MNCC_UR_9_6_KBIT; | |
4826 ctb->BC[0].bearer_serv = MNCC_BEARER_SERV_ASYNC; | |
4827 ctb->BC[0].conn_elem = MNCC_CONN_ELEM_NON_TRANS; | |
4828 ctb->BC[0].modem_type = MNCC_MT_V32; | |
4829 | |
4830 /* store default settings in opchCmd, will be used for term response later on */ | |
4831 opchCmd->bear_desc.csd_bear_prm.csd_speed = BS_SPEED_9600_V32; | |
4832 opchCmd->bear_desc.csd_bear_prm.csd_name = CBST_NAM_Asynch; | |
4833 opchCmd->bear_desc.csd_bear_prm.csd_ce = CBST_CE_NonTransparent; | |
4834 } | |
4835 | |
4836 else /* invalid bearer setting for CSD */ | |
4837 { | |
4838 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4839 psaCC_FreeCtbNtry (cId); | |
4840 return( FALSE ); | |
4841 } | |
4842 | |
4843 ctb->BC[0].stop_bits = MNCC_STOP_1_BIT; | |
4844 ctb->BC[0].data_bits = MNCC_DATA_8_BIT; | |
4845 ctb->BC[0].parity = MNCC_PARITY_NONE; | |
4846 | |
4847 ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
4848 ctb->BC[1].bearer_serv = MNCC_BEARER_SERV_NOT_PRES; | |
4849 ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
4850 | |
4851 /* declare the owner and status of the call */ | |
4852 ctb->calOwn = OWN_SRC_SAT; | |
4853 ctb->calStat = CS_SAT_CSD_REQ; | |
4854 ctb->curCmd = AT_CMD_D; | |
4855 ctb->SATinv = TRUE; | |
4856 | |
4857 /* fill in channel table */ | |
4858 satShrdPrm.chnTb.chnUsdFlg = TRUE; | |
4859 satShrdPrm.chnTb.chnRefId = cId; | |
4860 satShrdPrm.chnTb.chnType = B_CSD; | |
4861 satShrdPrm.chnTb.lnkStat = SIM_NO_LINK; | |
4862 | |
4863 /* store bearer parameters for later use */ | |
4864 cmhSAT_storeCSDPrms (opchCmd); | |
4865 | |
4866 /* check for call control by SIM */ | |
4867 retVal = cmhSAT_CalCntrlBySIM( cId ); | |
4868 | |
4869 switch( retVal ) | |
4870 { | |
4871 case( AT_BUSY ): | |
4872 /* respond with "Interaction with call control by SIM, temporary" */ | |
4873 TRACE_EVENT("SAT OPCH FAIL, CC by SIM busy"); | |
4874 psaSAT_SendTrmResp( RSLT_CC_SIM_TMP, &resp_data ); | |
4875 cmhSAT_cleanupOpChnPrms(); | |
4876 psaCC_FreeCtbNtry (cId); | |
4877 return( FALSE ); | |
4878 | |
4879 case( AT_FAIL ): | |
4880 /* respond with "Interaction with call control by SIM, permanent" */ | |
4881 TRACE_EVENT("SAT OPCH FAIL, CC by SIM failure"); | |
4882 resp_data.add_content = ADD_NO_CAUSE; | |
4883 psaSAT_SendTrmResp( RSLT_CC_SIM_PRM, &resp_data ); | |
4884 cmhSAT_cleanupOpChnPrms(); | |
4885 psaCC_FreeCtbNtry (cId); | |
4886 return( FALSE ); | |
4887 | |
4888 case( AT_EXCT ): | |
4889 /* wait for SIM result */ | |
4890 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
4891 satShrdPrm.opchStat = OPCH_CCSIM_REQ; | |
4892 break; | |
4893 } | |
4894 | |
4895 | |
4896 /* if call control check is performed, return here */ | |
4897 if( satShrdPrm.opchStat EQ OPCH_CCSIM_REQ ) return( TRUE ); | |
4898 } | |
4899 else | |
4900 #endif /* FAX_AND_DATA */ | |
4901 | |
4902 /* | |
4903 *------------------------------------------------------------------- | |
4904 * for a GPRS channel use a context id in GACI | |
4905 *------------------------------------------------------------------- | |
4906 */ | |
4907 #if defined (GPRS) AND defined (DTI) | |
4908 | |
4909 if( opchCmd->v_bear_desc ) | |
4910 { | |
4911 T_PDP_CONTEXT_INTERNAL cntxt; | |
4912 | |
4913 /* get context id */ | |
4914 cId = pdp_context_get_free_cid();//(U8) psaSAT_gprsFindFreeCntxt(); | |
4915 | |
4916 if( cId EQ NO_ENTRY ) | |
4917 { | |
4918 /* send SAT response */ | |
4919 TRACE_EVENT("SAT OPCH FAIL, no free context"); | |
4920 resp_data.add_content = ADD_NO_CAUSE; | |
4921 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
4922 return( FALSE ); /* primitive not needed anymore */ | |
4923 } | |
4924 | |
4925 /* bearer capabilities */ | |
4926 if( opchCmd->bear_desc.v_gprs_bear_prm ) | |
4927 { | |
4928 /* only PDP type IP is supported */ | |
4929 if( opchCmd->bear_desc.gprs_bear_prm.gprs_pdp_type NEQ PDP_TYPE_IP ) | |
4930 { | |
4931 TRACE_EVENT("SAT OPCH FAIL, PDP type diff from IP"); | |
4932 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
4933 return( FALSE ); | |
4934 } | |
4935 | |
4936 cntxt.ctrl_qos = PS_is_R97; | |
4937 cntxt.qos.qos_r97.preced = opchCmd->bear_desc.gprs_bear_prm.gprs_prec; | |
4938 cntxt.qos.qos_r97.delay = opchCmd->bear_desc.gprs_bear_prm.gprs_delay; | |
4939 cntxt.qos.qos_r97.relclass = opchCmd->bear_desc.gprs_bear_prm.gprs_rely; | |
4940 cntxt.qos.qos_r97.peak = opchCmd->bear_desc.gprs_bear_prm.gprs_peak; | |
4941 cntxt.qos.qos_r97.mean = opchCmd->bear_desc.gprs_bear_prm.gprs_mean; | |
4942 | |
4943 } | |
4944 | |
4945 else if ( opchCmd->bear_desc.bear_type EQ BT_DEFAULT ) | |
4946 { | |
4947 /* default settings for GPRS channel = as subscribed */ | |
4948 cntxt.ctrl_qos = PS_is_R97; | |
4949 cntxt.qos.qos_r97.preced = 0; | |
4950 cntxt.qos.qos_r97.delay = 0; | |
4951 cntxt.qos.qos_r97.relclass = 0; | |
4952 cntxt.qos.qos_r97.peak = 0; | |
4953 cntxt.qos.qos_r97.mean = 0; | |
4954 /* store default settings in opchCmd, will be used for term response later on */ | |
4955 opchCmd->bear_desc.gprs_bear_prm.gprs_prec = 0; | |
4956 opchCmd->bear_desc.gprs_bear_prm.gprs_delay = 0; | |
4957 opchCmd->bear_desc.gprs_bear_prm.gprs_rely = 0; | |
4958 opchCmd->bear_desc.gprs_bear_prm.gprs_peak = 0; | |
4959 opchCmd->bear_desc.gprs_bear_prm.gprs_mean = 0; | |
4960 opchCmd->bear_desc.gprs_bear_prm.gprs_pdp_type = PDP_TYPE_IP; | |
4961 } | |
4962 else /* invalid bearer setting for GPRS */ | |
4963 { | |
4964 TRACE_EVENT("SAT OPCH FAIL, invalid GPRS bearer settings"); | |
4965 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
4966 return( FALSE ); | |
4967 } | |
4968 | |
4969 /* if an APN is given */ | |
4970 if( opchCmd->v_nan_buf AND opchCmd->nan_buf.c_n_acc_name ) | |
4971 { | |
4972 cmhSAT_cnvrtAPN2NetworkAdr( (UBYTE *)opchCmd->nan_buf.n_acc_name, | |
4973 (UBYTE) opchCmd->nan_buf.c_n_acc_name, | |
4974 (UBYTE *)cntxt.attributes.pdp_apn ); | |
4975 | |
4976 } | |
4977 else /* use default */ | |
4978 { | |
4979 cntxt.attributes.pdp_apn[0] = 0; | |
4980 } | |
4981 | |
4982 /* if a local address is given */ | |
4983 if( opchCmd->v_other_addr AND opchCmd->other_addr.v_ipv4_addr ) | |
4984 {/* For ACISAT510 | |
4985 Populate the ip address | |
4986 */ | |
4987 cntxt.attributes.pdp_addr.ctrl_ip_address = NAS_is_ipv4; | |
4988 memcpy(cntxt.attributes.pdp_addr.ip_address.ipv4_addr.a4 , | |
4989 &opchCmd->other_addr.ipv4_addr, sizeof(cntxt.attributes.pdp_addr.ip_address.ipv4_addr.a4)); | |
4990 | |
4991 } | |
4992 else /* use default, dynamic address */ | |
4993 { | |
4994 cntxt.attributes.pdp_addr.ctrl_ip_address = NAS_is_ip_not_present; | |
4995 } | |
4996 | |
4997 cntxt.attributes.d_comp = PDP_CONTEXT_D_COMP_OMITTED; | |
4998 cntxt.attributes.h_comp = PDP_CONTEXT_H_COMP_OMITTED; | |
4999 | |
5000 strncpy( cntxt.attributes.pdp_type, "IP", sizeof( T_PDP_CONTEXT_TYPE )); | |
5001 if( sAT_PlusCGDCONT( CMD_SRC_NONE,cId, &cntxt.attributes ) NEQ AT_CMPL ) | |
5002 { | |
5003 TRACE_EVENT("SAT OPCH FAIL, invalid CGDCONT parms"); | |
5004 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
5005 return( FALSE ); /* primitive not needed anymore */ | |
5006 } | |
5007 | |
5008 /* For ACISAT510 | |
5009 Set the working cid */ | |
5010 work_cids[cid_pointer] = cId; | |
5011 | |
5012 /* don't handle R99 QoS */ | |
5013 if( sAT_PlusCGQREQ( CMD_SRC_NONE, (U8)cId, &cntxt.qos) NEQ AT_CMPL ) | |
5014 { | |
5015 TRACE_EVENT("SAT OPCH FAIL, invalid CGQREQ parms"); | |
5016 psaSAT_SendTrmResp( RSLT_ME_CAP, &resp_data ); | |
5017 return( FALSE ); /* primitive not needed anymore */ | |
5018 } | |
5019 | |
5020 /* fill in channel table */ | |
5021 satShrdPrm.chnTb.chnUsdFlg = TRUE; | |
5022 satShrdPrm.chnTb.chnRefId = cId; | |
5023 satShrdPrm.chnTb.chnType = B_GPRS; | |
5024 satShrdPrm.chnTb.lnkStat = SIM_NO_LINK; | |
5025 | |
5026 /* store bearer parameters for later use */ | |
5027 cmhSAT_storeGPRSPrms (opchCmd); | |
5028 | |
5029 } | |
5030 else | |
5031 | |
5032 #endif /* GPRS */ | |
5033 | |
5034 /* | |
5035 *------------------------------------------------------------------- | |
5036 * undefined channel | |
5037 *------------------------------------------------------------------- | |
5038 */ | |
5039 { | |
5040 /* respond with "error, required values are missing" */ | |
5041 TRACE_EVENT("SAT OPCH FAIL, requires values missing"); | |
5042 psaSAT_SendTrmResp( RSLT_ERR_REQ_VAL, &resp_data ); | |
5043 return( FALSE ); | |
5044 } | |
5045 | |
5046 | |
5047 | |
5048 if ( psaCC_ctbCallInUse ( ) ) | |
5049 { | |
5050 /* send SAT response **/ | |
5051 TRACE_EVENT("SAT ME BUSY on CALL"); | |
5052 resp_data.add_content = ADD_ME_CALL_BUSY; | |
5053 resp_data.bufSize = TRUE; | |
5054 resp_data.bearDesc = TRUE; | |
5055 resp_data.chnStat = FALSE; | |
5056 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
5057 return( FALSE ); | |
5058 } | |
5059 /* | |
5060 *------------------------------------------------------------------- | |
5061 * request for user confirmation | |
5062 *------------------------------------------------------------------- | |
5063 */ | |
5064 cmhSAT_OpChnAlert( cId ); | |
5065 | |
5066 return( TRUE ); | |
5067 | |
5068 } | |
5069 | |
5070 /* | |
5071 +-------------------------------------------------------------------+ | |
5072 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5073 | ROUTINE : cmhSAT_storeCSDPrms | | |
5074 +-------------------------------------------------------------------+ | |
5075 | |
5076 PURPOSE : This function stores the CSD open channel parameters for | |
5077 later use. | |
5078 | |
5079 */ | |
5080 | |
5081 GLOBAL void cmhSAT_storeCSDPrms ( T_OPEN_CHANNEL * opchCmd ) | |
5082 { | |
5083 T_SAT_CSD_PRM *p; | |
5084 | |
5085 TRACE_FUNCTION("cmhSAT_storeCSDPrms()"); | |
5086 | |
5087 ACI_MALLOC(satShrdPrm.opchPrm, sizeof(T_SAT_CSD_PRM)); | |
5088 TRACE_EVENT("ALLOC opchPrm"); | |
5089 memset(satShrdPrm.opchPrm, 0, sizeof(T_SAT_CSD_PRM)); | |
5090 | |
5091 p = (T_SAT_CSD_PRM*)satShrdPrm.opchPrm; | |
5092 | |
5093 if(opchCmd->bear_desc.bear_type EQ BT_DEFAULT) | |
5094 p->def_bear_prm = TRUE; | |
5095 | |
5096 p->csd_bear_prm = opchCmd->bear_desc.csd_bear_prm; | |
5097 | |
5098 if(opchCmd->v_dur) | |
5099 { | |
5100 p->v_dur = TRUE; | |
5101 p->dur = opchCmd->dur; | |
5102 } | |
5103 | |
5104 if(opchCmd->v_dur2) | |
5105 { | |
5106 p->v_dur2 = TRUE; | |
5107 p->dur2 = opchCmd->dur2; | |
5108 } | |
5109 | |
5110 if(opchCmd->v_other_addr) | |
5111 { | |
5112 p->v_other_addr = TRUE; | |
5113 p->other_addr = opchCmd->other_addr; | |
5114 } | |
5115 | |
5116 if(opchCmd->v_text) | |
5117 { | |
5118 p->v_log = TRUE; | |
5119 p->log = opchCmd->text; | |
5120 } | |
5121 | |
5122 if(opchCmd->v_text2) | |
5123 { | |
5124 p->v_pwd = TRUE; | |
5125 p->pwd = opchCmd->text2; | |
5126 } | |
5127 | |
5128 if(opchCmd->v_if_transp_lev) | |
5129 { | |
5130 p->v_itl = TRUE; | |
5131 p->itl = opchCmd->if_transp_lev; | |
5132 } | |
5133 | |
5134 if(opchCmd->v_data_dest_addr) | |
5135 { | |
5136 p->v_dda = TRUE; | |
5137 p->dda = opchCmd->data_dest_addr; | |
5138 } | |
5139 | |
5140 satShrdPrm.opchType = B_CSD; | |
5141 } | |
5142 | |
5143 /* | |
5144 +-------------------------------------------------------------------+ | |
5145 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5146 | ROUTINE : cmhSAT_storeGPRSPrms | | |
5147 +-------------------------------------------------------------------+ | |
5148 | |
5149 PURPOSE : This function stores the CSD open channel parameters for | |
5150 later use. | |
5151 | |
5152 */ | |
5153 | |
5154 GLOBAL void cmhSAT_storeGPRSPrms ( T_OPEN_CHANNEL * opchCmd ) | |
5155 { | |
5156 T_SAT_GPRS_PRM *p; | |
5157 | |
5158 TRACE_FUNCTION("cmhSAT_storeGPRSPrms()"); | |
5159 | |
5160 ACI_MALLOC(satShrdPrm.opchPrm, sizeof(T_SAT_GPRS_PRM)); | |
5161 TRACE_EVENT("ALLOC opchPrm"); | |
5162 memset(satShrdPrm.opchPrm, 0, sizeof(T_SAT_GPRS_PRM)); | |
5163 | |
5164 p = (T_SAT_GPRS_PRM*)satShrdPrm.opchPrm; | |
5165 | |
5166 if(opchCmd->bear_desc.bear_type EQ BT_DEFAULT) | |
5167 p->def_bear_prm = TRUE; | |
5168 | |
5169 p->gprs_bear_prm = opchCmd->bear_desc.gprs_bear_prm; | |
5170 | |
5171 if(opchCmd->v_nan_buf) | |
5172 { | |
5173 p->v_apn = TRUE; | |
5174 p->c_apn = opchCmd->nan_buf.c_n_acc_name; | |
5175 memcpy(p->apn, opchCmd->nan_buf.n_acc_name, opchCmd->nan_buf.c_n_acc_name); | |
5176 } | |
5177 | |
5178 if(opchCmd->v_other_addr) | |
5179 { | |
5180 p->v_other_addr = TRUE; | |
5181 p->other_addr = opchCmd->other_addr; | |
5182 } | |
5183 | |
5184 if(opchCmd->v_if_transp_lev) | |
5185 { | |
5186 p->v_itl = TRUE; | |
5187 p->itl = opchCmd->if_transp_lev; | |
5188 } | |
5189 | |
5190 if(opchCmd->v_data_dest_addr) | |
5191 { | |
5192 p->v_dda = TRUE; | |
5193 p->dda = opchCmd->data_dest_addr; | |
5194 } | |
5195 | |
5196 satShrdPrm.opchType = B_GPRS; | |
5197 } | |
5198 | |
5199 /* | |
5200 +-------------------------------------------------------------------+ | |
5201 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5202 | ROUTINE : cmhSAT_cleanupOpChnPrms | | |
5203 +-------------------------------------------------------------------+ | |
5204 | |
5205 PURPOSE : This function cleans the Op channel parameters | |
5206 | |
5207 */ | |
5208 | |
5209 GLOBAL void cmhSAT_cleanupOpChnPrms ( void ) | |
5210 { | |
5211 TRACE_FUNCTION("cmhSAT_cleanupOpChnPrms()"); | |
5212 | |
5213 if( satShrdPrm.opchPrm ) | |
5214 { | |
5215 ACI_MFREE(satShrdPrm.opchPrm); | |
5216 satShrdPrm.opchPrm = NULL; | |
5217 TRACE_EVENT("FREE opchPrm"); | |
5218 } | |
5219 | |
5220 satShrdPrm.opchPrmMdf = FALSE; | |
5221 satShrdPrm.opchCCMdfy = FALSE; | |
5222 satShrdPrm.opchStat = OPCH_IDLE; | |
5223 satShrdPrm.opchType = 0; | |
5224 satShrdPrm.gprsNtwCs = 0; | |
5225 | |
5226 } | |
5227 | |
5228 /* | |
5229 +--------------------------------------------------------------------+ | |
5230 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5231 | ROUTINE : cmhSAT_OpChnResetCnctFalg| | |
5232 +--------------------------------------------------------------------+ | |
5233 | |
5234 PURPOSE : This function cleans the Op channel parameters | |
5235 | |
5236 */ | |
5237 | |
5238 GLOBAL void cmhSAT_OpChnResetCnctFlag ( void ) | |
5239 { | |
5240 TRACE_FUNCTION("cmhSAT_cleanupOpChnWAP()"); | |
5241 #ifdef CO_UDP_IP | |
5242 /* If transport layer is UDP, reset wap_call flag */ | |
5243 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
5244 { | |
5245 sAT_PercentWAP ( CMD_SRC_NONE, 0 ); | |
5246 } | |
5247 #endif /* CO_UDP_IP */ | |
5248 } | |
5249 | |
5250 /* | |
5251 +-------------------------------------------------------------------+ | |
5252 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5253 | ROUTINE : cmhSAT_OpChnFailed | | |
5254 +-------------------------------------------------------------------+ | |
5255 | |
5256 PURPOSE : Indication that an open channel command has failed due to | |
5257 a reason indicated by cause and add_cause. If the failure | |
5258 occured in context with the OPEN CHANNEL command, a terminal | |
5259 response will be sent and parameters will be cleaned up. | |
5260 If the failure was in context with a SEND DATA command, the | |
5261 SIM BIP channel will be closed and parameters will be cleared | |
5262 up. If the failure was unexpected, a channel status event | |
5263 message will be sent, if enabled. | |
5264 | |
5265 */ | |
5266 | |
5267 GLOBAL void cmhSAT_OpChnFailed( UBYTE cause, T_ACI_SAT_TERM_RESP *resp_data ) | |
5268 { | |
5269 T_SIM_SAT_CHN chnInf; | |
5270 | |
5271 TRACE_FUNCTION("cmhSAT_OpChnFailed()"); | |
5272 | |
5273 /* command context is OPEN CHANNEL */ | |
5274 if((satShrdPrm.opchStat EQ OPCH_EST_REQ OR | |
5275 satShrdPrm.opchStat EQ OPCH_CCSIM_REQ OR | |
5276 satShrdPrm.opchStat EQ OPCH_WAIT_CNF) AND | |
5277 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_OPEN_CHANNEL ) | |
5278 { | |
5279 resp_data->chnStat = TRUE; | |
5280 psaSAT_SendTrmResp( cause, resp_data ); | |
5281 | |
5282 if(!(satShrdPrm.opchStat EQ OPCH_WAIT_CNF)) | |
5283 { | |
5284 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A, CME_ERR_NotPresent ); | |
5285 | |
5286 /* log result */ | |
5287 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, RAT_CME, AT_CMD_A, | |
5288 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
5289 } | |
5290 cmhSAT_cleanupOpChnPrms(); | |
5291 } | |
5292 | |
5293 /* command context is SEND DATA */ | |
5294 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
5295 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA ) | |
5296 { | |
5297 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN ) | |
5298 { | |
5299 /* check if user has cleared down the call */ | |
5300 if( satShrdPrm.chnTb.chnType EQ B_CSD AND | |
5301 (!psaCC_ctbIsValid (satShrdPrm.chnTb.chnRefId) OR | |
5302 psaCC_ctb(satShrdPrm.chnTb.chnRefId)->curCmd EQ AT_CMD_H OR | |
5303 psaCC_ctb(satShrdPrm.chnTb.chnRefId)->curCmd EQ AT_CMD_CHUP)) | |
5304 { | |
5305 cause = RSLT_USR_CLR_DWN; | |
5306 } | |
5307 #ifdef DTI | |
5308 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
5309 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
5310 chnInf.chnId = CHANNEL_ID_1; | |
5311 chnInf.genRes = cause; | |
5312 chnInf.addRes = resp_data->add_content; | |
5313 | |
5314 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
5315 #endif /* DTI */ | |
5316 } | |
5317 } | |
5318 /* unsolicited problem */ | |
5319 else if( satShrdPrm.opchStat EQ OPCH_IDLE ) | |
5320 { | |
5321 chnInf.bipConn = SIM_BIP_UNKNOWN; | |
5322 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
5323 | |
5324 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN ) | |
5325 { | |
5326 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
5327 } | |
5328 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_CNCT ) | |
5329 { | |
5330 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
5331 chnInf.dtiConn = SIM_DTI_DISCONNECT; | |
5332 } | |
5333 #ifdef DTI | |
5334 if( chnInf.bipConn ) | |
5335 { | |
5336 chnInf.chnId = CHANNEL_ID_1; | |
5337 chnInf.genRes = RSLT_BEARIND_PERR; | |
5338 chnInf.addRes = ADD_BIP_CHAN_CLOSD; | |
5339 | |
5340 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
5341 | |
5342 cmhSAT_OpChnStatEvnt(); | |
5343 } | |
5344 #endif /* DTI */ | |
5345 } | |
5346 } | |
5347 | |
5348 /* | |
5349 +-------------------------------------------------------------------+ | |
5350 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5351 | ROUTINE : cmhSAT_OpChnAlert | | |
5352 +-------------------------------------------------------------------+ | |
5353 | |
5354 PURPOSE : This function alerts the user about a pending SAT open | |
5355 channel command, which is ready for execution. | |
5356 | |
5357 */ | |
5358 | |
5359 GLOBAL void cmhSAT_OpChnAlert( SHORT cId ) | |
5360 | |
5361 { | |
5362 UBYTE idx; | |
5363 LONG rdl = ACI_NumParmNotPresent; | |
5364 T_ACI_SATA_ADD addPrm; | |
5365 | |
5366 if( satShrdPrm.opchType EQ B_CSD ) | |
5367 { | |
5368 rdl = cmhSAT_ChckRedial(cId, ((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->v_dur, | |
5369 &(((T_SAT_CSD_PRM*)satShrdPrm.opchPrm)->dur)); | |
5370 | |
5371 addPrm.chnType = SATA_CT_CSD; | |
5372 cId += 1; | |
5373 } | |
5374 else if ( satShrdPrm.opchType EQ B_GPRS ) | |
5375 | |
5376 addPrm.chnType = SATA_CT_GPRS; | |
5377 | |
5378 addPrm.chnEst = ( satShrdPrm.cmdDet.cmdQlf & QLF_OPCH_IMMDT_LINK_EST )? | |
5379 SATA_EST_IM:SATA_EST_OD; | |
5380 | |
5381 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
5382 { | |
5383 R_AT( RAT_SATA, (T_ACI_CMD_SRC)idx )( cId, rdl, &addPrm ); | |
5384 } | |
5385 | |
5386 satShrdPrm.ntfy = USR_NTF_SETUP_CAL; | |
5387 satShrdPrm.opchStat = OPCH_WAIT_CNF; | |
5388 } | |
5389 | |
5390 /* | |
5391 +-------------------------------------------------------------------+ | |
5392 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5393 | ROUTINE : cmhSAT_OpChnChkTmpProblem| | |
5394 +-------------------------------------------------------------------+ | |
5395 | |
5396 PURPOSE : This function checks for a temporary situation, which | |
5397 prevents the open channel command to be completed. If such | |
5398 a condition exists, the open channel command will be aborted | |
5399 with a suitable terminal response and the function returns | |
5400 TRUE | |
5401 | |
5402 */ | |
5403 | |
5404 GLOBAL BOOL cmhSAT_OpChnChkTmpProblem( void ) | |
5405 | |
5406 { | |
5407 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
5408 BOOL cleanup = FALSE; | |
5409 | |
5410 psaSAT_InitTrmResp( &resp_data ); | |
5411 | |
5412 | |
5413 TRACE_FUNCTION("cmhSAT_OpChnChkTmpProblem()"); | |
5414 | |
5415 /* | |
5416 *------------------------------------------------------------------- | |
5417 * check channel type independent conditions | |
5418 *------------------------------------------------------------------- | |
5419 */ | |
5420 #ifdef CO_UDP_IP | |
5421 /* check for a busy UDP situation, WAP is a synonym for UDP */ | |
5422 if( satShrdPrm.chnTb.chnTPL EQ UDP AND | |
5423 Wap_Call ) | |
5424 { | |
5425 TRACE_EVENT("SAT OPCH FAIL, UDP is busy"); | |
5426 resp_data.add_content = ADD_NO_CAUSE; | |
5427 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5428 cleanup = TRUE; | |
5429 } | |
5430 /* | |
5431 *------------------------------------------------------------------- | |
5432 * check CSD channel conditions | |
5433 *------------------------------------------------------------------- | |
5434 */ | |
5435 else | |
5436 #endif /* CO_UDP_IP */ | |
5437 | |
5438 if( satShrdPrm.opchType EQ B_CSD ) | |
5439 { | |
5440 /* check for busy SS condition */ | |
5441 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY ) | |
5442 { | |
5443 /* send SAT response */ | |
5444 TRACE_EVENT("SAT OPCH FAIL, SS busy"); | |
5445 resp_data.add_content = ADD_ME_SS_BUSY; | |
5446 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5447 | |
5448 cleanup = TRUE; | |
5449 } | |
5450 | |
5451 /* check for busy call condition */ | |
5452 else if( psaSAT_ctbFindActCall() NEQ NO_ENTRY ) | |
5453 { | |
5454 /* send SAT response */ | |
5455 TRACE_EVENT("SAT OPCH FAIL, busy on call"); | |
5456 resp_data.add_content = ADD_ME_CALL_BUSY; | |
5457 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5458 | |
5459 cleanup = TRUE; | |
5460 } | |
5461 #if defined (GPRS) AND defined (DTI) | |
5462 /* CSD channel, but class CG */ | |
5463 else if( gmmShrdPrm.mobile_class EQ GMMREG_CLASS_CG ) | |
5464 { | |
5465 /* send SAT response */ | |
5466 TRACE_EVENT("SAT OPCH FAIL, no channel avail"); | |
5467 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5468 cmhSAT_OpChnFailed( RSLT_BEARIND_PERR, &resp_data ); | |
5469 | |
5470 cleanup = TRUE; | |
5471 } | |
5472 #endif /* GPRS */ | |
5473 | |
5474 } | |
5475 | |
5476 /* | |
5477 *------------------------------------------------------------------- | |
5478 * check GPRS channel conditions | |
5479 *------------------------------------------------------------------- | |
5480 */ | |
5481 #if defined (GPRS) AND defined (DTI) | |
5482 else if( satShrdPrm.opchType EQ B_GPRS ) | |
5483 { | |
5484 /* GPRS channel, class B */ | |
5485 if( gmmShrdPrm.mobile_class EQ GMMREG_CLASS_BC OR | |
5486 gmmShrdPrm.mobile_class EQ GMMREG_CLASS_BG ) | |
5487 { | |
5488 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY ) | |
5489 { | |
5490 /* send SAT response */ | |
5491 TRACE_EVENT("SAT OPCH FAIL, SS busy"); | |
5492 resp_data.add_content = ADD_ME_SS_BUSY; | |
5493 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5494 | |
5495 cleanup = TRUE; | |
5496 } | |
5497 | |
5498 /* check for busy call condition */ | |
5499 else if( psaSAT_ctbFindActCall() NEQ NO_ENTRY ) | |
5500 { | |
5501 /* send SAT response */ | |
5502 TRACE_EVENT("SAT OPCH FAIL, busy on call"); | |
5503 resp_data.add_content = ADD_ME_CALL_BUSY; | |
5504 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5505 | |
5506 cleanup = TRUE; | |
5507 } | |
5508 } | |
5509 | |
5510 /* GPRS channel, but class CC */ | |
5511 else if( gmmShrdPrm.mobile_class EQ GMMREG_CLASS_CC ) | |
5512 { | |
5513 /* send SAT response */ | |
5514 TRACE_EVENT("SAT OPCH FAIL, no channel avail"); | |
5515 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5516 cmhSAT_OpChnFailed( RSLT_BEARIND_PERR, &resp_data ); | |
5517 | |
5518 cleanup = TRUE; | |
5519 } | |
5520 | |
5521 /* no channel left for GPRS */ | |
5522 else if( pdp_context_get_free_cid() EQ PDP_CONTEXT_CID_INVALID ) | |
5523 { | |
5524 /* send SAT response */ | |
5525 TRACE_EVENT("SAT OPCH FAIL, no channel avail"); | |
5526 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5527 cmhSAT_OpChnFailed( RSLT_BEARIND_PERR, &resp_data ); | |
5528 | |
5529 cleanup = TRUE; | |
5530 } | |
5531 | |
5532 /* check SM entity status */ | |
5533 else if( smEntStat.entOwn NEQ CMD_SRC_NONE OR | |
5534 smEntStat.curCmd NEQ AT_CMD_NONE ) | |
5535 { | |
5536 /* send SAT response */ | |
5537 TRACE_EVENT("SAT OPCH FAIL, SM entity busy"); | |
5538 resp_data.add_content = ADD_NO_CAUSE; | |
5539 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5540 | |
5541 cleanup = TRUE; | |
5542 } | |
5543 } | |
5544 #endif /* GPRS */ | |
5545 | |
5546 /* | |
5547 *------------------------------------------------------------------- | |
5548 * cleanup if necessary | |
5549 *------------------------------------------------------------------- | |
5550 */ | |
5551 if( cleanup ) | |
5552 { | |
5553 if( satShrdPrm.opchType EQ B_CSD ) | |
5554 { | |
5555 /* free ctb entry */ | |
5556 psaCC_FreeCtbNtry (satShrdPrm.chnTb.chnRefId); | |
5557 } | |
5558 | |
5559 cmhSAT_cleanupOpChnPrms(); | |
5560 | |
5561 return ( TRUE ); | |
5562 } | |
5563 | |
5564 return( FALSE ); | |
5565 } | |
5566 | |
5567 | |
5568 /* | |
5569 +-------------------------------------------------------------------+ | |
5570 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5571 | ROUTINE : cmhSAT_OpChnUDPActiveCsd| | |
5572 +-------------------------------------------------------------------+ | |
5573 | |
5574 PURPOSE : This callback function will be called when the UDP stack | |
5575 is active | |
5576 | |
5577 */ | |
5578 | |
5579 GLOBAL void cmhSAT_OpChnUDPActiveCsd(T_ACI_RETURN result) | |
5580 { | |
5581 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
5582 | |
5583 TRACE_FUNCTION("cmhSAT_OpChnUDPActiveCsd()"); | |
5584 | |
5585 /* Ensure we never dereference NULL in the CC call table */ | |
5586 if (!psaCC_ctbIsValid (tcpipShrdPrm.wap_call_id)) | |
5587 { | |
5588 TRACE_ERROR ("Call table entry disappeared"); | |
5589 ccShrdPrm.datStat = DS_IDL ; | |
5590 psaSAT_InitTrmResp( &resp_data ); | |
5591 resp_data.add_content = ADD_NO_CAUSE; | |
5592 | |
5593 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5594 return; | |
5595 } | |
5596 | |
5597 /* | |
5598 * activate RA connection: in case of failure clear call ! | |
5599 */ | |
5600 ccShrdPrm.datStat = DS_ACT_REQ; | |
5601 | |
5602 if(cmhRA_Activate((T_ACI_CMD_SRC)psaCC_ctb(tcpipShrdPrm.wap_call_id)->curSrc, | |
5603 (T_ACI_AT_CMD)psaCC_ctb(tcpipShrdPrm.wap_call_id)->curCmd, | |
5604 tcpipShrdPrm.wap_call_id) | |
5605 NEQ AT_EXCT) | |
5606 { | |
5607 TRACE_EVENT("RA ACTIVATION FAILURE -> DISC CALL"); | |
5608 ccShrdPrm.datStat = DS_IDL ; | |
5609 psaCC_ctb(tcpipShrdPrm.wap_call_id)->nrmCs = MNCC_CAUSE_CALL_CLEAR; | |
5610 psaCC_ClearCall (tcpipShrdPrm.wap_call_id); | |
5611 | |
5612 | |
5613 psaSAT_InitTrmResp( &resp_data ); | |
5614 resp_data.add_content = ADD_NO_CAUSE; | |
5615 | |
5616 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5617 } | |
5618 } | |
5619 | |
5620 | |
5621 /* | |
5622 +-------------------------------------------------------------------+ | |
5623 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5624 | ROUTINE : cmhSAT_OpChnUDPConfCsd | | |
5625 +-------------------------------------------------------------------+ | |
5626 | |
5627 PURPOSE : This callback function will be called when the UDP stack | |
5628 is configured | |
5629 | |
5630 */ | |
5631 GLOBAL void cmhSAT_OpChnUDPConfCsd(T_ACI_RETURN result) | |
5632 { | |
5633 | |
5634 TRACE_FUNCTION("cmhSAT_OpChnUDPConfCsd()"); | |
5635 /* | |
5636 * send the SIM_BIP_CONFIG_REQ primitive providing details of the connection | |
5637 * to SIM | |
5638 */ | |
5639 psaSIM_Bip_Config_Req(); | |
5640 } | |
5641 | |
5642 /* | |
5643 +-------------------------------------------------------------------+ | |
5644 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5645 | ROUTINE : cmhSAT_OpChnUDPDeactCsd | | |
5646 +-------------------------------------------------------------------+ | |
5647 | |
5648 PURPOSE : This callback function will be called when the UDP stack | |
5649 is deactive | |
5650 | |
5651 */ | |
5652 | |
5653 GLOBAL void cmhSAT_OpChnUDPDeactCsd(T_ACI_RETURN result) | |
5654 { | |
5655 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
5656 | |
5657 TRACE_FUNCTION("cmhSAT_OpChnUDPDeactCsd()"); | |
5658 | |
5659 psaSAT_InitTrmResp( &resp_data ); | |
5660 | |
5661 /* | |
5662 *------------------------------------------------------------------- | |
5663 * check if deactivation was intended | |
5664 *------------------------------------------------------------------- | |
5665 */ | |
5666 if( satShrdPrm.opchStat EQ OPCH_CLS_REQ ) | |
5667 { | |
5668 /* nothing to do here anymore */ | |
5669 } | |
5670 | |
5671 /* | |
5672 *------------------------------------------------------------------- | |
5673 * deactivation during an establish request | |
5674 *------------------------------------------------------------------- | |
5675 */ | |
5676 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ ) | |
5677 { | |
5678 if (cmhL2R_Deactivate() NEQ AT_EXCT) | |
5679 { | |
5680 TRACE_EVENT("L2R DEACTIVATION FAILURE "); | |
5681 if (psaCC_ctbIsValid (tcpipShrdPrm.wap_call_id)) | |
5682 { | |
5683 psaCC_ctb(tcpipShrdPrm.wap_call_id)->nrmCs = MNCC_CAUSE_CALL_CLEAR; | |
5684 psaCC_ClearCall(tcpipShrdPrm.wap_call_id); | |
5685 } | |
5686 } | |
5687 | |
5688 resp_data.add_content = ADD_NO_CAUSE; | |
5689 | |
5690 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
5691 | |
5692 } | |
5693 } | |
5694 /* | |
5695 +-------------------------------------------------------------------+ | |
5696 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5697 | ROUTINE : cmhSAT_OpBIPChnOpen | | |
5698 +-------------------------------------------------------------------+ | |
5699 | |
5700 PURPOSE : This callback function will be called when the SIM entity | |
5701 has tried to open a BIP channel | |
5702 | |
5703 */ | |
5704 | |
5705 GLOBAL void cmhSAT_OpBIPChnOpen( UBYTE bipConn, UBYTE chnId ) | |
5706 { | |
5707 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */ | |
5708 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
5709 UBYTE srcId; /* holds source ID */ | |
5710 UBYTE cause; | |
5711 SHORT cId; /* holds caller ID for pending CSD call (case immediately) */ | |
5712 #ifdef GPRS | |
5713 SHORT cid_array[2] = { 0,PDP_CONTEXT_CID_INVALID/*INVALID_CID*/ }; /* holds cids for GPRS context */ | |
5714 #endif /* GPRS */ | |
5715 | |
5716 TRACE_FUNCTION("cmhSAT_OpBIPChnOpen()"); | |
5717 | |
5718 /* get source id */ | |
5719 srcId = satShrdPrm.opchAcptSrc; | |
5720 | |
5721 psaSAT_InitTrmResp( &resp_data ); | |
5722 | |
5723 /* send TR in the case of on demand establishment */ | |
5724 if( satShrdPrm.opchStat EQ OPCH_ON_DMND ) | |
5725 { | |
5726 /* CASE: ON DEMAND */ | |
5727 | |
5728 /* check if opening has been successful */ | |
5729 if( bipConn & SIM_BIP_OPEN_CHANNEL ) | |
5730 { | |
5731 /* BEARER: GPRS OR CSD */ | |
5732 | |
5733 /* set link state to OPEN */ | |
5734 satShrdPrm.chnTb.lnkStat = SIM_LINK_OPEN; | |
5735 | |
5736 resp_data.chnStat = TRUE; | |
5737 resp_data.bearDesc = TRUE; | |
5738 resp_data.bufSize = TRUE; | |
5739 cause = (satShrdPrm.opchCCMdfy)?RSLT_PERF_MDFY_SIM:RSLT_PERF_SUCCESS; | |
5740 | |
5741 psaSAT_SendTrmResp( cause, &resp_data ); | |
5742 | |
5743 R_AT( RAT_OK, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A ); | |
5744 | |
5745 /* log result */ | |
5746 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, RAT_OK, AT_CMD_A, | |
5747 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
5748 } | |
5749 /* unsuccessful channel opening */ | |
5750 else | |
5751 { | |
5752 /* BEARER: GPRS OR CSD */ | |
5753 | |
5754 TRACE_ERROR("cmhSAT_OpChnOpen: ERROR: OPEN BIP CHANNEL unsuccessful"); | |
5755 | |
5756 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5757 cause = RSLT_BEARIND_PERR; | |
5758 | |
5759 cmhSAT_cleanupOpChnPrms(); | |
5760 | |
5761 psaSAT_SendTrmResp( cause, &resp_data ); | |
5762 | |
5763 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A, CME_ERR_NotPresent ); | |
5764 | |
5765 /* log result */ | |
5766 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, RAT_CME, AT_CMD_A, | |
5767 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
5768 } | |
5769 | |
5770 } | |
5771 else if ( satShrdPrm.opchStat EQ OPCH_EST_REQ ) | |
5772 { | |
5773 /* CASE: IMMEDIATELY */ | |
5774 /* Check whether OPEN BIP CHANNEL successful */ | |
5775 if( bipConn & SIM_BIP_OPEN_CHANNEL ) | |
5776 { | |
5777 | |
5778 /* set link state to OPEN, since the BIP and DTI establishment has split | |
5779 * this state is alse used for "immediately" OPEN CHANNEL command */ | |
5780 satShrdPrm.chnTb.lnkStat = SIM_LINK_OPEN; | |
5781 | |
5782 /* check for BEARER */ | |
5783 if (satShrdPrm.opchType EQ B_CSD) | |
5784 { | |
5785 /* BEARER: CSD */ | |
5786 /* proceed to set up bearer for CSD */ | |
5787 | |
5788 /* get SAT call cId */ | |
5789 cId = psaCC_ctbFindCall( OWN_SRC_SAT, CS_SAT_CSD_REQ, NO_VLD_CT ); | |
5790 | |
5791 /* check if a call has been found */ | |
5792 if ( cId NEQ (-1)) | |
5793 { | |
5794 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; | |
5795 | |
5796 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
5797 { | |
5798 /* TRANSPORT LAYER: UDP */ | |
5799 | |
5800 /* enable establishment of UDP data chain */ | |
5801 sAT_PercentWAP ( (T_ACI_CMD_SRC)psaCC_ctb(cId)->curSrc , 1 ); | |
5802 | |
5803 /* setup PPP parameters */ | |
5804 cmhSAT_OpChnSetPPP( B_CSD ); | |
5805 } | |
5806 /* finally set up call */ | |
5807 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg)); | |
5808 cmhCC_NewCall(cId, (T_ACI_CMD_SRC)srcId, AT_CMD_A); | |
5809 } | |
5810 else | |
5811 { | |
5812 TRACE_FUNCTION("cmhSAT_OpChnOpen: No CSD call pending"); | |
5813 } | |
5814 } | |
5815 #if defined (GPRS) AND defined (DTI) | |
5816 else if (satShrdPrm.opchType EQ B_GPRS) | |
5817 { | |
5818 /* BEARER: GPRS */ | |
5819 | |
5820 /* copy channel reference ID */ | |
5821 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
5822 | |
5823 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
5824 { | |
5825 /* TRANSPORT LAYER: UDP */ | |
5826 | |
5827 /* enable establishment of UDP data chain */ | |
5828 sAT_PercentWAP ( (T_ACI_CMD_SRC)srcId , 1 ); | |
5829 | |
5830 /* setup PPP parameters */ | |
5831 cmhSAT_OpChnSetPPP( B_GPRS ); | |
5832 | |
5833 /* activate context with UDP */ | |
5834 cmhSAT_OpChnUDPActivateGprs(); | |
5835 } | |
5836 else | |
5837 { | |
5838 /* NO TRANSPORT LAYER: SNDCP only */ | |
5839 | |
5840 /* activate context with no transport layer */ | |
5841 if( sAT_PlusCGACT( (T_ACI_CMD_SRC)srcId, CGACT_STATE_ACTIVATED, cid_array ) NEQ AT_EXCT ) | |
5842 { | |
5843 /* activate context command could not proccessed */ | |
5844 /* throw error */ | |
5845 TRACE_ERROR("cmhSAT_OpChnOpen: ERROR: activate context with no TRL failed"); | |
5846 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A, CME_ERR_NoConnect ); | |
5847 } | |
5848 } | |
5849 } /* end bearer B_GPRS */ | |
5850 #endif /* GPRS AND DTI */ | |
5851 } | |
5852 else /* OPEN BIP CHANNEL unsuccessful */ | |
5853 { | |
5854 /* CASE: ON DEMAND and IMMEDIATELY */ | |
5855 /* BEARER: CSD and GPRS */ | |
5856 | |
5857 TRACE_ERROR("cmhSAT_OpChnOpen: ERROR: OPEN BIP CHANNEL unsuccessful"); | |
5858 | |
5859 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5860 cause = RSLT_BEARIND_PERR; | |
5861 | |
5862 /* store current status of BIP channel */ | |
5863 simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
5864 | |
5865 cmhSAT_cleanupOpChnPrms(); | |
5866 | |
5867 psaSAT_SendTrmResp( cause, &resp_data ); | |
5868 | |
5869 R_AT( RAT_CME, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A, CME_ERR_NotPresent ); | |
5870 | |
5871 /* log result */ | |
5872 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, RAT_CME, AT_CMD_A, | |
5873 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent ); | |
5874 } | |
5875 } /* end if ( satShrdPrm.opchStat EQ OPCH_EST_REQ ) */ | |
5876 } | |
5877 | |
5878 | |
5879 /* | |
5880 +-------------------------------------------------------------------+ | |
5881 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5882 | ROUTINE : cmhSAT_OpChnCnct | | |
5883 +-------------------------------------------------------------------+ | |
5884 | |
5885 PURPOSE : This callback function will be called when the SIM entity | |
5886 has tried to connect a DTI channel | |
5887 | |
5888 */ | |
5889 | |
5890 GLOBAL void cmhSAT_OpChnCnct( UBYTE dtiConn, UBYTE chnId ) | |
5891 { | |
5892 #ifdef DTI | |
5893 T_SIM_SAT_CHN chnInf; | |
5894 | |
5895 #ifdef GPRS | |
5896 SHORT cid_array[2] = { 0, PDP_CONTEXT_CID_INVALID }; | |
5897 #endif /* GPRS */ | |
5898 | |
5899 | |
5900 TRACE_FUNCTION("cmhSAT_OpChnCnct()"); | |
5901 | |
5902 /* connection was successful */ | |
5903 if( dtiConn & SIM_DTI_CONNECT ) | |
5904 { | |
5905 satShrdPrm.chnTb.lnkStat = SIM_LINK_CNCT; | |
5906 TRACE_EVENT("cmhSAT_OpChnCnct: SIM-DTI connection successful"); | |
5907 } | |
5908 else | |
5909 { | |
5910 /* unsuccessful connection */ | |
5911 TRACE_EVENT("cmhSAT_OpChnCnct: ERROR: SIM-DTI connection unsuccessful!"); | |
5912 | |
5913 /* if the channel is still open */ | |
5914 | |
5915 /* SAT E patch: Since this information isn't available from incoming | |
5916 * SIM_DTI_CNF look into the shrd parameters whether there has been a | |
5917 * already BIP channel established within this channel connection */ | |
5918 /* former checked: dtiConn & SIM_BIP_OPEN_CHANNEL*/ | |
5919 if( (satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN) ) | |
5920 { | |
5921 /* check for SEND DATA/OPEN CHANNEL command context */ | |
5922 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
5923 (satShrdPrm.cmdDet.cmdType EQ SAT_CMD_OPEN_CHANNEL OR | |
5924 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA)) | |
5925 { | |
5926 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
5927 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
5928 chnInf.chnId = CHANNEL_ID_1; | |
5929 chnInf.genRes = RSLT_BEARIND_PERR; | |
5930 chnInf.addRes = ADD_BIP_NO_CHAN_AVAIL; | |
5931 | |
5932 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
5933 } | |
5934 | |
5935 satShrdPrm.chnTb.lnkStat = SIM_LINK_OPEN; | |
5936 } | |
5937 /* if bearer is still in use */ | |
5938 else if ( satShrdPrm.chnTb.chnUsdFlg ) | |
5939 { | |
5940 /* if a CSD is still in progress */ | |
5941 if( satShrdPrm.chnTb.chnType EQ B_CSD ) | |
5942 { | |
5943 SHORT dummy; | |
5944 | |
5945 cmhCC_ClearCall( satShrdPrm.chnTb.chnRefId, | |
5946 MNCC_CAUSE_CALL_CLEAR, | |
5947 (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
5948 AT_CMD_NONE, | |
5949 &dummy); | |
5950 } | |
5951 | |
5952 #ifdef GPRS | |
5953 /* if a GPRS context is still in progress */ | |
5954 if( satShrdPrm.chnTb.chnType EQ B_GPRS ) | |
5955 { | |
5956 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
5957 | |
5958 sAT_PlusCGACT( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
5959 CGACT_STATE_DEACTIVATED, cid_array ); | |
5960 } | |
5961 #endif /* GPRS */ | |
5962 } | |
5963 } | |
5964 #endif /* DTI */ | |
5965 } | |
5966 | |
5967 /* | |
5968 +-------------------------------------------------------------------+ | |
5969 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
5970 | ROUTINE : cmhSAT_OpChnClose | | |
5971 +-------------------------------------------------------------------+ | |
5972 | |
5973 PURPOSE : This callback function will be called when the SIM entity | |
5974 has tried to close a channel | |
5975 | |
5976 */ | |
5977 | |
5978 GLOBAL void cmhSAT_OpChnClose( UBYTE bipConn, UBYTE chnId ) | |
5979 { | |
5980 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
5981 | |
5982 TRACE_FUNCTION("cmhSAT_OpChnClose()"); | |
5983 | |
5984 /* channel closed */ | |
5985 if( bipConn & SIM_BIP_CLOSE_CHANNEL ) | |
5986 { | |
5987 satShrdPrm.chnTb.lnkStat = SIM_NO_LINK; | |
5988 | |
5989 psaSAT_InitTrmResp( &resp_data ); | |
5990 | |
5991 /* check for OPEN CHANNEL command context, immediate channel */ | |
5992 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
5993 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_OPEN_CHANNEL ) | |
5994 { | |
5995 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
5996 resp_data.chnStat = TRUE; | |
5997 | |
5998 cmhSAT_OpChnFailed(RSLT_BEARIND_PERR, &resp_data); | |
5999 cmhSAT_cleanupOpChnPrms(); | |
6000 | |
6001 } | |
6002 | |
6003 /* check for SEND DATA command context, on-demand channel */ | |
6004 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
6005 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA ) | |
6006 { | |
6007 cmhSAT_cleanupOpChnPrms(); | |
6008 } | |
6009 | |
6010 /* check for intented channel closing */ | |
6011 else if( satShrdPrm.opchStat EQ OPCH_CLS_REQ AND | |
6012 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_CLOSE_CHANNEL) | |
6013 { | |
6014 resp_data.chnStat = FALSE; | |
6015 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
6016 if ( dti_cntrl_is_dti_channel_connected (DTI_ENTITY_UDP, simShrdPrm.sat_class_e_dti_id) | |
6017 #ifdef GPRS | |
6018 OR dti_cntrl_is_dti_channel_connected (DTI_ENTITY_SNDCP, simShrdPrm.sat_class_e_dti_id) | |
6019 #endif /* GPRS */ | |
6020 ) | |
6021 { | |
6022 cmhSAT_cleanupOpChnPrms(); | |
6023 } | |
6024 else /* L2R or TRA - dti channel has to be closed explicitly */ | |
6025 { | |
6026 /* close existing DTI channel first */ | |
6027 dti_cntrl_close_dpath_from_dti_id(simShrdPrm.sat_class_e_dti_id); | |
6028 cmhSAT_cleanupOpChnPrms(); | |
6029 } | |
6030 } | |
6031 | |
6032 | |
6033 /* if bearer is still in use */ | |
6034 if( satShrdPrm.chnTb.chnUsdFlg ) | |
6035 { | |
6036 /* if a CSD is still in progress */ | |
6037 if( satShrdPrm.chnTb.chnType EQ B_CSD ) | |
6038 { | |
6039 SHORT dummy; | |
6040 | |
6041 cmhCC_ClearCall( satShrdPrm.chnTb.chnRefId, | |
6042 MNCC_CAUSE_CALL_CLEAR, | |
6043 (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
6044 AT_CMD_NONE, | |
6045 &dummy); | |
6046 } | |
6047 #if defined (GPRS) AND defined (DTI) | |
6048 /* if a GPRS context is still in progress */ | |
6049 if( satShrdPrm.chnTb.chnType EQ B_GPRS ) | |
6050 { | |
6051 SHORT cid_array[2] = { 0,PDP_CONTEXT_CID_INVALID }; | |
6052 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
6053 | |
6054 sAT_PlusCGACT( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
6055 CGACT_STATE_DEACTIVATED, cid_array ); | |
6056 } | |
6057 #endif /* GPRS */ | |
6058 } | |
6059 } | |
6060 } | |
6061 | |
6062 /* | |
6063 +-------------------------------------------------------------------+ | |
6064 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6065 | ROUTINE : cmhSAT_OpChnCSDDown | | |
6066 +-------------------------------------------------------------------+ | |
6067 | |
6068 PURPOSE : This function is used to indictate that the CSD data | |
6069 connection is down. | |
6070 | |
6071 */ | |
6072 | |
6073 GLOBAL void cmhSAT_OpChnCSDDown( SHORT cId, UBYTE tpl ) | |
6074 { | |
6075 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
6076 | |
6077 TRACE_FUNCTION("cmhSAT_OpChnCSDDown()"); | |
6078 | |
6079 psaSAT_InitTrmResp( &resp_data ); | |
6080 resp_data.add_content = ADD_NO_CAUSE; | |
6081 | |
6082 if( satShrdPrm.chnTb.chnUsdFlg AND | |
6083 satShrdPrm.chnTb.chnType EQ B_CSD AND | |
6084 (satShrdPrm.chnTb.chnTPL EQ tpl OR tpl EQ TPL_DONT_CARE) AND | |
6085 satShrdPrm.chnTb.chnRefId EQ cId ) | |
6086 { | |
6087 | |
6088 /* If transport layer is UDP, reset wap_call flag */ | |
6089 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
6090 { | |
6091 sAT_PercentWAP ( CMD_SRC_NONE, 0 ); | |
6092 | |
6093 /* clear parameters of dti connection */ | |
6094 } | |
6095 | |
6096 if(simShrdPrm.sat_class_e_dti_id NEQ DTI_DTI_ID_NOTPRESENT) | |
6097 { | |
6098 dti_cntrl_erase_entry(simShrdPrm.sat_class_e_dti_id); | |
6099 dti_cntrl_clear_conn_parms(simShrdPrm.sat_class_e_dti_id); | |
6100 simShrdPrm.sat_class_e_dti_id = DTI_DTI_ID_NOTPRESENT; | |
6101 TRACE_EVENT("sat_class_e_dti_id reset"); | |
6102 } | |
6103 | |
6104 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
6105 } | |
6106 } | |
6107 | |
6108 /* | |
6109 +-------------------------------------------------------------------+ | |
6110 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6111 | ROUTINE : cmhSAT_OpChnGPRSDeact | | |
6112 +-------------------------------------------------------------------+ | |
6113 | |
6114 PURPOSE : This function is used to indictate that the CSD data | |
6115 connection is down. | |
6116 | |
6117 */ | |
6118 #ifdef GPRS | |
6119 GLOBAL void cmhSAT_OpChnGPRSDeact( void ) | |
6120 { | |
6121 | |
6122 SHORT cid; | |
6123 TRACE_FUNCTION("cmhSAT_OpChnGPRSDeact()"); | |
6124 | |
6125 cid = gaci_get_cid_over_dti_id(wap_dti_id); | |
6126 | |
6127 /* If transport layer is UDP, reset wap_call flag */ | |
6128 if( satShrdPrm.chnTb.chnTPL EQ UDP ) | |
6129 { | |
6130 cmhSM_disconnect_cid(cid, GC_TYPE_WAP ); | |
6131 sAT_PercentWAP ( CMD_SRC_NONE, 0 ); | |
6132 if(work_cids[cid_pointer] EQ cid) | |
6133 { | |
6134 smEntStat.curCmd = AT_CMD_NONE; | |
6135 *work_cids = 0; | |
6136 cid_pointer = 0; | |
6137 } | |
6138 } | |
6139 | |
6140 /* clear parameters of dti connection */ | |
6141 if(simShrdPrm.sat_class_e_dti_id NEQ DTI_DTI_ID_NOTPRESENT) | |
6142 { | |
6143 dti_cntrl_erase_entry(simShrdPrm.sat_class_e_dti_id); | |
6144 dti_cntrl_clear_conn_parms(simShrdPrm.sat_class_e_dti_id); | |
6145 simShrdPrm.sat_class_e_dti_id = DTI_DTI_ID_NOTPRESENT; | |
6146 TRACE_EVENT("sat_class_e_dti_id reset"); | |
6147 } | |
6148 | |
6149 } | |
6150 #endif /* GPRS */ | |
6151 /* | |
6152 +-------------------------------------------------------------------+ | |
6153 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6154 | ROUTINE : cmhSAT_OpChnSIMFail | | |
6155 +-------------------------------------------------------------------+ | |
6156 | |
6157 PURPOSE : This callback function will be called when the SIM entity | |
6158 has reported a failure | |
6159 | |
6160 */ | |
6161 | |
6162 GLOBAL void cmhSAT_OpChnSIMFail( UBYTE dtiConn, UBYTE bipConn, UBYTE chnId ) | |
6163 { | |
6164 #ifdef DTI | |
6165 T_SIM_SAT_CHN chnInf; | |
6166 | |
6167 TRACE_FUNCTION("cmhSAT_OpChnSIMFail()"); | |
6168 | |
6169 /* if the channel is still open */ | |
6170 if( bipConn & SIM_BIP_OPEN_CHANNEL ) | |
6171 { | |
6172 chnInf.bipConn = SIM_BIP_CLOSE_CHANNEL; | |
6173 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
6174 chnInf.chnId = CHANNEL_ID_1; | |
6175 chnInf.genRes = RSLT_BEARIND_PERR; | |
6176 chnInf.addRes = ADD_BIP_NO_CHAN_AVAIL; | |
6177 | |
6178 psaSIM_SATBIPChn( chnInf, cmhSAT_OpChnClose ); | |
6179 | |
6180 satShrdPrm.chnTb.lnkStat = SIM_LINK_OPEN; | |
6181 } | |
6182 /* if bearer is still in use */ | |
6183 else if ( satShrdPrm.chnTb.chnUsdFlg ) | |
6184 { | |
6185 /* if a CSD is still in progress */ | |
6186 if( satShrdPrm.chnTb.chnType EQ B_CSD ) | |
6187 { | |
6188 SHORT dummy; | |
6189 | |
6190 cmhCC_ClearCall( satShrdPrm.chnTb.chnRefId, | |
6191 MNCC_CAUSE_CALL_CLEAR, | |
6192 (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
6193 AT_CMD_NONE, | |
6194 &dummy); | |
6195 } | |
6196 | |
6197 #ifdef GPRS | |
6198 /* if a GPRS context is still in progress */ | |
6199 if( satShrdPrm.chnTb.chnType EQ B_GPRS ) | |
6200 { | |
6201 SHORT cid_array[2] = { 0,INVALID_CID }; | |
6202 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
6203 | |
6204 sAT_PlusCGACT( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, | |
6205 CGACT_STATE_DEACTIVATED, cid_array ); | |
6206 } | |
6207 #endif /* GPRS */ | |
6208 } | |
6209 #endif /* DTI */ | |
6210 } | |
6211 | |
6212 /* | |
6213 +-------------------------------------------------------------------+ | |
6214 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6215 | ROUTINE : cmhSAT_OpChnChckCSD | | |
6216 +-------------------------------------------------------------------+ | |
6217 | |
6218 PURPOSE : This function is used to check if an open channel command | |
6219 for CSD with the given TPL is pending | |
6220 | |
6221 */ | |
6222 | |
6223 GLOBAL BOOL cmhSAT_OpChnChckCSD( UBYTE tpl ) | |
6224 { | |
6225 | |
6226 /* in case of a SAT channel establishment */ | |
6227 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND | |
6228 satShrdPrm.chnTb.chnTPL EQ tpl AND | |
6229 satShrdPrm.opchType EQ B_CSD ) | |
6230 { | |
6231 return( TRUE ); | |
6232 } | |
6233 | |
6234 return( FALSE ); | |
6235 } | |
6236 | |
6237 /* | |
6238 +-------------------------------------------------------------------+ | |
6239 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6240 | ROUTINE : cmhSAT_OpChnSIMCnctReq | | |
6241 +-------------------------------------------------------------------+ | |
6242 | |
6243 PURPOSE : This function is used to request a connection between SIM | |
6244 and the specified unit | |
6245 */ | |
6246 | |
6247 GLOBAL void cmhSAT_OpChnSIMCnctReq(UBYTE unit) | |
6248 { | |
6249 #ifdef DTI | |
6250 T_SIM_SAT_CHN chnInf; | |
6251 | |
6252 TRACE_FUNCTION("cmhSAT_OpChnSIMCnctReq()"); | |
6253 | |
6254 if( satShrdPrm.opchStat EQ OPCH_EST_REQ ) | |
6255 { | |
6256 /* DTI CHANNEL ESTABLISHMENT requested */ | |
6257 | |
6258 /* check for modification of bearer parameters */ | |
6259 cmhSAT_OpChnChckBear(); | |
6260 | |
6261 /* setup channel info for PSA */ | |
6262 chnInf.dtiUnit = unit; | |
6263 chnInf.chnId = CHANNEL_ID_1; | |
6264 chnInf.dtiConn = 0; | |
6265 chnInf.dtiConn = SIM_DTI_CONNECT; | |
6266 | |
6267 if ( unit NEQ DTI_ENTITY_UDP ) | |
6268 { | |
6269 /* init DTI channel for SIM -> SNDCP, L2R and TRA */ | |
6270 psaSIM_SATChn( chnInf, cmhSAT_OpChnCnct ); | |
6271 } | |
6272 else | |
6273 { | |
6274 /* prepare parameters for SIM -> UDP connection */ | |
6275 /* copy settings into shrd prms */ | |
6276 memcpy(&simShrdPrm.sim_dti_chPrm->sat_chn_prm,&chnInf,sizeof(T_SIM_SAT_CHN)); | |
6277 /* callback for results of DTI connection has to be cmhSAT_OpChnCnct */ | |
6278 simShrdPrm.sim_dti_chPrm->dti_cb = cmhSAT_OpChnCnct; | |
6279 } | |
6280 } | |
6281 #endif /* DTI */ | |
6282 } | |
6283 | |
6284 /* | |
6285 +-------------------------------------------------------------------+ | |
6286 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6287 | ROUTINE : cmhSAT_OpChnChckBear | | |
6288 +-------------------------------------------------------------------+ | |
6289 | |
6290 PURPOSE : This function is used to check whether the bearer parameters | |
6291 differ from the orignal settings by the SAT command. | |
6292 If so, the new parameters will overwrite the settings in | |
6293 opchPrm and the opchPrmMdf will be set to TRUE. | |
6294 | |
6295 */ | |
6296 | |
6297 GLOBAL void cmhSAT_OpChnChckBear(void) | |
6298 { | |
6299 UBYTE mt; | |
6300 | |
6301 TRACE_FUNCTION("cmhSAT_OpChnChckBear()"); | |
6302 | |
6303 /* | |
6304 *------------------------------------------------------------------- | |
6305 * for CSD bearer parameters | |
6306 *------------------------------------------------------------------- | |
6307 */ | |
6308 if( satShrdPrm.chnTb.chnType EQ B_CSD ) | |
6309 { | |
6310 T_CC_CALL_TBL * pCtbNtry; | |
6311 UBYTE cmdSpeed; | |
6312 UBYTE cmdName; | |
6313 UBYTE cmdCE; | |
6314 T_SAT_CSD_PRM *p = (T_SAT_CSD_PRM*)satShrdPrm.opchPrm; | |
6315 | |
6316 if (!psaCC_ctbIsValid (satShrdPrm.chnTb.chnRefId)) | |
6317 { | |
6318 /* Avoid to dereference NULL */ | |
6319 TRACE_ERROR ("Call table entry disappeared"); | |
6320 return; | |
6321 } | |
6322 | |
6323 pCtbNtry = ccShrdPrm.ctb[satShrdPrm.chnTb.chnRefId]; | |
6324 | |
6325 if( !p->def_bear_prm ) | |
6326 { | |
6327 cmdSpeed = cmhCC_SelRate((T_ACI_BS_SPEED)p->csd_bear_prm.csd_speed); | |
6328 cmdName = cmhCC_SelServ((T_ACI_CBST_NAM)p->csd_bear_prm.csd_name); | |
6329 cmdCE = cmhCC_SelCE ((T_ACI_CBST_CE)p->csd_bear_prm.csd_ce); | |
6330 | |
6331 if((cmdSpeed NEQ pCtbNtry->BC[0].rate) OR | |
6332 (cmdName NEQ pCtbNtry->BC[0].bearer_serv) OR | |
6333 (cmdCE NEQ pCtbNtry->BC[0].conn_elem )) | |
6334 { | |
6335 satShrdPrm.opchPrmMdf = TRUE; | |
6336 } | |
6337 } | |
6338 | |
6339 /* update bearer parms with current values */ | |
6340 p->csd_bear_prm.csd_speed = (UBYTE)cmhCC_GetDataRate(&pCtbNtry->BC[0]); | |
6341 mt = pCtbNtry->BC[0].modem_type; | |
6342 | |
6343 switch( pCtbNtry->BC[0].rate ) | |
6344 { | |
6345 case( MNCC_UR_0_3_KBIT ): | |
6346 if( mt EQ MNCC_MT_V21 ) p->csd_bear_prm.csd_speed = BS_SPEED_300_V21; | |
6347 break; | |
6348 case( MNCC_UR_1_2_KBIT ): | |
6349 if ( mt EQ MNCC_MT_V22 ) p->csd_bear_prm.csd_speed = BS_SPEED_1200_V22; | |
6350 else if ( mt EQ MNCC_MT_V23 ) p->csd_bear_prm.csd_speed = BS_SPEED_1200_75_V23; | |
6351 else if ( mt EQ MNCC_MT_NONE ) p->csd_bear_prm.csd_speed = BS_SPEED_1200_V110; | |
6352 break; | |
6353 case( MNCC_UR_2_4_KBIT ): | |
6354 if ( mt EQ MNCC_MT_V22_BIS ) p->csd_bear_prm.csd_speed = BS_SPEED_2400_V22bis; | |
6355 else if ( mt EQ MNCC_MT_V26_TER ) p->csd_bear_prm.csd_speed = BS_SPEED_2400_V26ter; | |
6356 else if ( mt EQ MNCC_MT_NONE ) p->csd_bear_prm.csd_speed = BS_SPEED_2400_V110; | |
6357 break; | |
6358 case( MNCC_UR_4_8_KBIT ): | |
6359 if ( mt EQ MNCC_MT_V32 ) p->csd_bear_prm.csd_speed = BS_SPEED_4800_V32; | |
6360 else if ( mt EQ MNCC_MT_NONE ) p->csd_bear_prm.csd_speed = BS_SPEED_4800_V110; | |
6361 break; | |
6362 case( MNCC_UR_9_6_KBIT ): | |
6363 if ( mt EQ MNCC_MT_V32 ) p->csd_bear_prm.csd_speed = BS_SPEED_9600_V32; | |
6364 else if ( mt EQ MNCC_MT_V34 ) p->csd_bear_prm.csd_speed = BS_SPEED_9600_V34; | |
6365 else if ( mt EQ MNCC_MT_NONE ) p->csd_bear_prm.csd_speed = BS_SPEED_9600_V110; | |
6366 break; | |
6367 case( MNCC_UR_14_4_KBIT ): | |
6368 if ( mt EQ MNCC_MT_V34 ) p->csd_bear_prm.csd_speed = BS_SPEED_14400_V34; | |
6369 else if ( mt EQ MNCC_MT_NONE ) p->csd_bear_prm.csd_speed = BS_SPEED_14400_V110; | |
6370 break; | |
6371 default: | |
6372 break; /* leave it the way it is */ | |
6373 } | |
6374 | |
6375 switch( pCtbNtry->BC[0].bearer_serv ) | |
6376 { | |
6377 case( MNCC_BEARER_SERV_ASYNC ): | |
6378 p->csd_bear_prm.csd_name = CBST_NAM_Asynch; break; | |
6379 | |
6380 case( MNCC_BEARER_SERV_SYNC ): | |
6381 p->csd_bear_prm.csd_name = CBST_NAM_Synch; break; | |
6382 | |
6383 default: break; /* leave it the way it is */ | |
6384 } | |
6385 | |
6386 switch( pCtbNtry->BC[0].conn_elem ) | |
6387 { | |
6388 case( MNCC_CONN_ELEM_TRANS ): | |
6389 p->csd_bear_prm.csd_ce = CBST_CE_Transparent; break; | |
6390 | |
6391 case( MNCC_CONN_ELEM_NON_TRANS ): | |
6392 p->csd_bear_prm.csd_ce = CBST_CE_NonTransparent; break; | |
6393 | |
6394 default: break; /* leave it the way it is */ | |
6395 } | |
6396 } | |
6397 /* | |
6398 *------------------------------------------------------------------- | |
6399 * for GPRS bearer parameters | |
6400 *------------------------------------------------------------------- | |
6401 */ | |
6402 #ifdef GPRS | |
6403 if( satShrdPrm.chnTb.chnType EQ B_GPRS ) | |
6404 { | |
6405 T_PS_qos *curQOS; | |
6406 T_SAT_GPRS_PRM *p = (T_SAT_GPRS_PRM*)satShrdPrm.opchPrm; | |
6407 | |
6408 curQOS = cmhSM_getCurQOS( satShrdPrm.chnTb.chnRefId ); | |
6409 | |
6410 if( !p->def_bear_prm ) | |
6411 { | |
6412 if((curQOS->qos_r97.preced NEQ p->gprs_bear_prm.gprs_prec) OR | |
6413 (curQOS->qos_r97.delay NEQ p->gprs_bear_prm.gprs_delay) OR | |
6414 (curQOS->qos_r97.relclass NEQ p->gprs_bear_prm.gprs_rely ) OR | |
6415 (curQOS->qos_r97.peak NEQ p->gprs_bear_prm.gprs_peak ) OR | |
6416 (curQOS->qos_r97.mean NEQ p->gprs_bear_prm.gprs_mean ) ) | |
6417 { | |
6418 satShrdPrm.opchPrmMdf = TRUE; | |
6419 } | |
6420 } | |
6421 /* update bearer parms with current values */ | |
6422 p->gprs_bear_prm.gprs_prec = curQOS->qos_r97.preced; | |
6423 p->gprs_bear_prm.gprs_delay = curQOS->qos_r97.delay; | |
6424 p->gprs_bear_prm.gprs_rely = curQOS->qos_r97.relclass; | |
6425 p->gprs_bear_prm.gprs_peak = curQOS->qos_r97.peak; | |
6426 p->gprs_bear_prm.gprs_mean = curQOS->qos_r97.mean; | |
6427 } | |
6428 #endif /* GPRS */ | |
6429 } | |
6430 #ifdef DTI | |
6431 /* | |
6432 +-------------------------------------------------------------------+ | |
6433 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6434 | ROUTINE : cmhSAT_OpChnSetPPP | | |
6435 +-------------------------------------------------------------------+ | |
6436 | |
6437 PURPOSE : This function is used to set up PPP parameters. | |
6438 | |
6439 */ | |
6440 | |
6441 GLOBAL void cmhSAT_OpChnSetPPP(UBYTE chnType) | |
6442 { | |
6443 | |
6444 CHAR log[PPP_LOGIN_NAME_LENGTH+1]; /* holds login name */ | |
6445 CHAR pwd[PPP_LOGIN_NAME_LENGTH+1]; /* holds password */ | |
6446 | |
6447 T_SAT_CSD_PRM *p = (T_SAT_CSD_PRM*)satShrdPrm.opchPrm; | |
6448 | |
6449 TRACE_FUNCTION("cmhSAT_OpChnSetPPP()"); | |
6450 | |
6451 log[0] = 0; /* empty login name */ | |
6452 pwd[0] = 0; /* empty user name */ | |
6453 | |
6454 if( chnType EQ B_CSD ) | |
6455 { | |
6456 /* set login name and password, if available */ | |
6457 if(p->v_log AND p->log.c_text_str) | |
6458 { | |
6459 strncpy(pwd,(const CHAR *)p->log.text_str,MINIMUM(p->log.c_text_str, PPP_LOGIN_NAME_LENGTH)); | |
6460 log[MINIMUM(p->log.c_text_str, PPP_LOGIN_NAME_LENGTH)] ='\0'; | |
6461 } | |
6462 | |
6463 if(p->v_pwd AND p->pwd.c_text_str) | |
6464 { | |
6465 strncpy(pwd,(const CHAR *)p->pwd.text_str,MINIMUM(p->pwd.c_text_str, PPP_LOGIN_NAME_LENGTH)); | |
6466 pwd[MINIMUM(p->pwd.c_text_str, PPP_LOGIN_NAME_LENGTH)] ='\0'; | |
6467 } | |
6468 } | |
6469 | |
6470 sAT_PercentPPP( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, A_PAP, log, pwd, USE_NO_PPP_FOR_AAA ); | |
6471 } | |
6472 #endif /* DTI */ | |
6473 | |
6474 /* | |
6475 +-------------------------------------------------------------------+ | |
6476 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6477 | ROUTINE : cmhSAT_OpChnStatEvnt | | |
6478 +-------------------------------------------------------------------+ | |
6479 | |
6480 PURPOSE : This function is used to send a channel status event if | |
6481 enabled by SAT | |
6482 | |
6483 */ | |
6484 | |
6485 GLOBAL void cmhSAT_OpChnStatEvnt( void ) | |
6486 { | |
6487 | |
6488 TRACE_FUNCTION("cmhSAT_OpChnStatEvnt()"); | |
6489 | |
6490 if( psaSAT_ChkEventList( EVENT_CHAN_STAT ) ) | |
6491 { | |
6492 cmhSAT_EventDwn( EVENT_CHAN_STAT, -1, NEAR_END ); | |
6493 } | |
6494 | |
6495 } | |
6496 | |
6497 /* | |
6498 +-------------------------------------------------------------------+ | |
6499 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6500 | ROUTINE : cmhSAT_OpChnGPRSPend | | |
6501 +-------------------------------------------------------------------+ | |
6502 | |
6503 PURPOSE : This function is used to check for a pending GPRS open | |
6504 channel command. | |
6505 | |
6506 */ | |
6507 #ifdef GPRS | |
6508 GLOBAL BOOL cmhSAT_OpChnGPRSPend( SHORT cid, UBYTE opchStat ) | |
6509 { | |
6510 if( satShrdPrm.chnTb.chnUsdFlg AND | |
6511 satShrdPrm.chnTb.chnType EQ B_GPRS AND | |
6512 (opchStat EQ OPCH_NONE OR opchStat EQ satShrdPrm.opchStat)AND | |
6513 (cid EQ PDP_CONTEXT_CID_INVALID OR cid EQ satShrdPrm.chnTb.chnRefId)) | |
6514 | |
6515 return( TRUE ); | |
6516 | |
6517 else | |
6518 | |
6519 return( FALSE ); | |
6520 } | |
6521 #endif /* GPRS */ | |
6522 | |
6523 /* | |
6524 +-------------------------------------------------------------------+ | |
6525 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6526 | ROUTINE : cmhSAT_OpChnUDPActivateGprs | | |
6527 +-------------------------------------------------------------------+ | |
6528 | |
6529 PURPOSE : This function is used to activate the UDP data chain and | |
6530 GPRS context. | |
6531 | |
6532 */ | |
6533 #if defined (GPRS) AND defined (DTI) | |
6534 GLOBAL void cmhSAT_OpChnUDPActivateGprs( void ) | |
6535 { | |
6536 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL; | |
6537 U8 cid_array[PDP_CONTEXT_CID_MAX + 1]; | |
6538 T_ACI_SAT_TERM_RESP resp_data; | |
6539 | |
6540 TRACE_FUNCTION("cmhSAT_OpChnUDPActivateGprs()"); | |
6541 | |
6542 memset( &cid_array, PDP_CONTEXT_CID_INVALID, sizeof(cid_array) ); | |
6543 | |
6544 cid_array[0] = (U8)satShrdPrm.chnTb.chnRefId; | |
6545 | |
6546 /* final check of context id and link status */ | |
6547 /*if(!cmhSM_define_cid_list((T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, cid_array ) OR */ | |
6548 if(cmhSM_make_active_cid_list((T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, cid_array ) OR | |
6549 !srcc_reserve_sources( SRCC_IP_SNDCP_LINK, satShrdPrm.chnTb.chnRefId)) | |
6550 { | |
6551 psaSAT_InitTrmResp( &resp_data ); | |
6552 resp_data.add_content = ADD_BIP_NO_CHAN_AVAIL; | |
6553 cmhSAT_OpChnFailed( RSLT_BEARIND_PERR, &resp_data ); | |
6554 } | |
6555 | |
6556 srcc_new_count(SRCC_IP_SNDCP_LINK); | |
6557 | |
6558 /* create a SAT class E DTI ID if not present */ | |
6559 if ( simShrdPrm.sat_class_e_dti_id EQ DTI_DTI_ID_NOTPRESENT ) | |
6560 { | |
6561 simShrdPrm.sat_class_e_dti_id = dti_cntrl_new_dti(DTI_DTI_ID_NOTPRESENT); | |
6562 TRACE_EVENT_P1("sat_class_e_dti_id = %d", simShrdPrm.sat_class_e_dti_id); | |
6563 } | |
6564 | |
6565 /* get dti id for SNDCP/IP link */ | |
6566 p_pdp_context_node = pdp_context_find_node_from_cid( cid_array[0] ); | |
6567 if( p_pdp_context_node ) | |
6568 { | |
6569 | |
6570 /*pdp_context[satShrdPrm.chnTb.chnRefId-1].link_id = */ | |
6571 p_pdp_context_node->internal_data.link_id = | |
6572 dti_conn_compose_link_id (0,0, simShrdPrm.sat_class_e_dti_id, DTI_TUPLE_NO_NOTPRESENT); | |
6573 } | |
6574 else | |
6575 { | |
6576 TRACE_FUNCTION ("cmhSAT_OpChnUDPActivateGprs()"); | |
6577 TRACE_EVENT("Context Not Found"); | |
6578 } | |
6579 | |
6580 /* send request to ACI WAP to activate WAP */ | |
6581 smShrdPrm.owner = satShrdPrm.opchAcptSrc; | |
6582 smEntStat.entOwn = (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc; | |
6583 smEntStat.curCmd = AT_CMD_CGACT; | |
6584 | |
6585 #if defined (FF_WAP) || defined (FF_SAT_E) | |
6586 psaTCPIP_Activate( satShrdPrm.opchAcptSrc, | |
6587 simShrdPrm.sat_class_e_dti_id, | |
6588 0, TCPIP_ACT_OPTION_V4 | TCPIP_ACT_OPTION_UDP, | |
6589 TCPIP_CONNECTION_TYPE_GPRS_WAP, | |
6590 cmhSM_IP_activate_cb); | |
6591 #endif /*WAP or SATE*/ | |
6592 | |
6593 | |
6594 } | |
6595 #endif /* GPRS */ | |
6596 | |
6597 /* | |
6598 +-------------------------------------------------------------------+ | |
6599 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6600 | ROUTINE : cmhSAT_OpChnUDPConfGprs | | |
6601 +-------------------------------------------------------------------+ | |
6602 | |
6603 PURPOSE : This callback function will be called when the UDP stack | |
6604 is configured | |
6605 | |
6606 */ | |
6607 | |
6608 #if defined(GPRS) | |
6609 GLOBAL void cmhSAT_OpChnUDPConfGprs(void) | |
6610 { | |
6611 | |
6612 TRACE_FUNCTION("cmhSAT_OpChnUDPConfGprs()"); | |
6613 /* | |
6614 * send the SIM_BIP_CONFIG_REQ primitive providing details of the connection | |
6615 * to SIM | |
6616 */ | |
6617 psaSIM_Bip_Config_Req(); | |
6618 | |
6619 } | |
6620 #endif /* GPRS */ | |
6621 | |
6622 /* | |
6623 +-------------------------------------------------------------------+ | |
6624 | PROJECT : GSM-PS (6147) MODULE : SAT | | |
6625 | ROUTINE : cmhSAT_OpChnUDPDeactGprs| | |
6626 +-------------------------------------------------------------------+ | |
6627 | |
6628 PURPOSE : This callback function will be called when the UDP stack | |
6629 is deactive | |
6630 | |
6631 */ | |
6632 | |
6633 #if defined(GPRS) | |
6634 GLOBAL void cmhSAT_OpChnUDPDeactGprs(void) | |
6635 { | |
6636 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
6637 UBYTE cause; | |
6638 | |
6639 TRACE_FUNCTION("cmhSAT_OpChnUDPDeactGprs()"); | |
6640 | |
6641 psaSAT_InitTrmResp( &resp_data ); | |
6642 | |
6643 /* | |
6644 *------------------------------------------------------------------- | |
6645 * check if deactivation was intended | |
6646 *------------------------------------------------------------------- | |
6647 */ | |
6648 if( satShrdPrm.opchStat EQ OPCH_CLS_REQ ) | |
6649 { | |
6650 /* nothing to do here anymore */ | |
6651 } | |
6652 | |
6653 /* | |
6654 *------------------------------------------------------------------- | |
6655 * deactivation during an establish request | |
6656 *------------------------------------------------------------------- | |
6657 */ | |
6658 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ ) | |
6659 { | |
6660 if( satShrdPrm.gprsNtwCs ) | |
6661 { | |
6662 resp_data.add_content = satShrdPrm.gprsNtwCs | 0x80; | |
6663 | |
6664 cause = RSLT_NTW_UNAB_PROC; | |
6665 } | |
6666 else | |
6667 { | |
6668 resp_data.add_content = ADD_NO_CAUSE; | |
6669 cause = RSLT_ME_UNAB_PROC; | |
6670 } | |
6671 | |
6672 cmhSAT_OpChnFailed( cause, &resp_data ); | |
6673 } | |
6674 } | |
6675 #endif /* GPRS */ | |
6676 | |
6677 /* | |
6678 +-------------------------------------------------------------------+ | |
6679 | PROJECT : GPRS (8441) MODULE : CMH_SMF | | |
6680 | STATE : finished ROUTINE : cmhSAT_OpChnGPRSStat | | |
6681 +-------------------------------------------------------------------+ | |
6682 | |
6683 PURPOSE : This function will be called if the status of the requested | |
6684 GPRS context has changed. | |
6685 | |
6686 */ | |
6687 #if defined (GPRS) AND defined (DTI) | |
6688 GLOBAL void cmhSAT_OpChnGPRSStat(T_SAT_GPRS_CB_STAT stat, UBYTE cause) | |
6689 { | |
6690 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */ | |
6691 T_SIM_SAT_CHN chnInf; | |
6692 | |
6693 TRACE_FUNCTION ("cmhSAT_OpChnGPRSStat()"); | |
6694 | |
6695 if( cause ) satShrdPrm.gprsNtwCs = cause; | |
6696 | |
6697 /* in case of UDP, we will wait for the UDP status */ | |
6698 if( satShrdPrm.chnTb.chnTPL EQ UDP AND | |
6699 stat NEQ SAT_GPRS_SUSPEND AND | |
6700 stat NEQ SAT_GPRS_RESUME) | |
6701 | |
6702 return; | |
6703 | |
6704 psaSAT_InitTrmResp( &resp_data ); | |
6705 | |
6706 /* | |
6707 *------------------------------------------------------------------- | |
6708 * during a close channel request | |
6709 *------------------------------------------------------------------- | |
6710 */ | |
6711 if( satShrdPrm.opchStat EQ OPCH_CLS_REQ ) | |
6712 { | |
6713 /* nothing to do here anymore */ | |
6714 } | |
6715 | |
6716 /* | |
6717 *------------------------------------------------------------------- | |
6718 * during an open channel establish request | |
6719 *------------------------------------------------------------------- | |
6720 */ | |
6721 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ ) | |
6722 { | |
6723 switch ( stat ) | |
6724 { | |
6725 case( SAT_GPRS_DEACT ): | |
6726 case( SAT_GPRS_ATT_FAILED ): | |
6727 case( SAT_GPRS_ACT_FAILED ): | |
6728 | |
6729 if( satShrdPrm.gprsNtwCs ) | |
6730 { | |
6731 resp_data.add_content = satShrdPrm.gprsNtwCs | 0x80; | |
6732 | |
6733 cause = RSLT_NTW_UNAB_PROC; | |
6734 } | |
6735 else | |
6736 { | |
6737 resp_data.add_content = ADD_NO_CAUSE; | |
6738 cause = RSLT_ME_UNAB_PROC; | |
6739 } | |
6740 | |
6741 cmhSAT_OpChnFailed( cause, &resp_data ); | |
6742 break; | |
6743 | |
6744 case( SAT_GPRS_SUSPEND ): | |
6745 | |
6746 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY ) | |
6747 { | |
6748 TRACE_EVENT("SAT GPRS channel suspend, SS busy"); | |
6749 resp_data.add_content = ADD_ME_SS_BUSY; | |
6750 } | |
6751 | |
6752 /* check for busy call condition */ | |
6753 else if( psaSAT_ctbFindActCall() NEQ NO_ENTRY ) | |
6754 { | |
6755 TRACE_EVENT("SAT GPRS channel suspend, busy on call"); | |
6756 resp_data.add_content = ADD_ME_CALL_BUSY; | |
6757 } | |
6758 | |
6759 cmhSAT_OpChnFailed( RSLT_ME_UNAB_PROC, &resp_data ); | |
6760 break; | |
6761 | |
6762 case( SAT_GPRS_ACT ): | |
6763 | |
6764 cmhSAT_OpChnSIMCnctReq( DTI_ENTITY_SNDCP ); | |
6765 break; | |
6766 | |
6767 default: | |
6768 | |
6769 break; | |
6770 } | |
6771 } | |
6772 /* | |
6773 *------------------------------------------------------------------- | |
6774 * expected status change | |
6775 *------------------------------------------------------------------- | |
6776 */ | |
6777 else | |
6778 { | |
6779 switch ( stat ) | |
6780 { | |
6781 case( SAT_GPRS_DEACT ): | |
6782 case( SAT_GPRS_ATT_FAILED ): | |
6783 case( SAT_GPRS_ACT_FAILED ): | |
6784 | |
6785 resp_data.add_content = ADD_BIP_CHAN_CLOSD; | |
6786 cmhSAT_OpChnFailed( RSLT_BEARIND_PERR, &resp_data ); | |
6787 break; | |
6788 | |
6789 case( SAT_GPRS_SUSPEND ): | |
6790 | |
6791 chnInf.addRes = ADD_NO_CAUSE; | |
6792 | |
6793 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN OR | |
6794 satShrdPrm.chnTb.lnkStat EQ SIM_LINK_CNCT ) | |
6795 { | |
6796 if( psaSS_stbFindActSrv( NO_ENTRY ) NEQ NO_ENTRY ) | |
6797 { | |
6798 TRACE_EVENT("SAT GPRS channel suspend, SS busy"); | |
6799 chnInf.addRes = ADD_ME_SS_BUSY; | |
6800 } | |
6801 | |
6802 /* check for busy call condition */ | |
6803 else if( psaSAT_ctbFindActCall() NEQ NO_ENTRY ) | |
6804 { | |
6805 TRACE_EVENT("SAT GPRS channel suspend, busy on call"); | |
6806 chnInf.addRes = ADD_ME_CALL_BUSY; | |
6807 } | |
6808 | |
6809 /* setup channel info for PSA */ | |
6810 chnInf.chnId = CHANNEL_ID_1; | |
6811 chnInf.genRes = RSLT_ME_UNAB_PROC; | |
6812 chnInf.bipConn = SIM_BIP_CHANNEL_SUSPENDED; | |
6813 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
6814 | |
6815 psaSIM_SATBIPChn( chnInf, NULL ); | |
6816 } | |
6817 break; | |
6818 | |
6819 case( SAT_GPRS_RESUME ): | |
6820 | |
6821 if( satShrdPrm.chnTb.lnkStat EQ SIM_LINK_OPEN OR | |
6822 satShrdPrm.chnTb.lnkStat EQ SIM_LINK_CNCT ) | |
6823 { | |
6824 /* setup channel info for PSA */ | |
6825 chnInf.chnId = CHANNEL_ID_1; | |
6826 chnInf.genRes = RSLT_PERF_SUCCESS; | |
6827 chnInf.addRes = ADD_NO_CAUSE; | |
6828 chnInf.bipConn = SIM_BIP_CHANNEL_RESUMED; | |
6829 chnInf.dtiConn = SIM_DTI_UNKNOWN; | |
6830 | |
6831 psaSIM_SATBIPChn( chnInf, NULL ); | |
6832 } | |
6833 break; | |
6834 | |
6835 case( SAT_GPRS_ACT ): | |
6836 default: | |
6837 | |
6838 break; | |
6839 } | |
6840 } | |
6841 | |
6842 } | |
6843 #endif /* GPRS */ | |
6844 /* | |
6845 +-------------------------------------------------------------------+ | |
6846 | PROJECT : GPRS (8441) MODULE : CMH_SMF | | |
6847 | STATE : finished ROUTINE : cmhSAT_cnvrtAPN2NetworkAdr| | |
6848 +-------------------------------------------------------------------+ | |
6849 | |
6850 PURPOSE : converts a APN with a given length into a null terminated | |
6851 domain name | |
6852 | |
6853 */ | |
6854 | |
6855 #ifdef GPRS | |
6856 GLOBAL void cmhSAT_cnvrtAPN2NetworkAdr( UBYTE *apn, UBYTE c_apn, UBYTE *dom_name ) | |
6857 { | |
6858 UBYTE lblLen; | |
6859 UBYTE apnIdx = 0; | |
6860 UBYTE dnIdx = 0; | |
6861 | |
6862 TRACE_FUNCTION ("cmhSAT_cnvrtAPN2NetworkAdr()"); | |
6863 | |
6864 while( apnIdx < c_apn ) | |
6865 { | |
6866 lblLen = apn[apnIdx++]; | |
6867 | |
6868 memcpy( &dom_name[dnIdx], &apn[apnIdx], lblLen ); | |
6869 | |
6870 dnIdx += lblLen; | |
6871 apnIdx += lblLen; | |
6872 | |
6873 dom_name[dnIdx++] = '.'; | |
6874 } | |
6875 | |
6876 dom_name[dnIdx-1] = 0; | |
6877 } | |
6878 #endif /* GPRS */ | |
6879 | |
6880 #endif /* FF_SAT_E */ | |
6881 | |
6882 #endif /* SIM_TOOLKIT */ | |
6883 /*==== EOF ========================================================*/ |