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