FreeCalypso > hg > fc-selenite
comparison src/g23m-aci/aci/ati_sat.c @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ATI | |
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 : AT Command Interpreter for SAT related commands | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifdef SIM_TOOLKIT | |
22 | |
23 #ifndef ATI_SAT_C | |
24 #define ATI_SAT_C | |
25 | |
26 #include "aci_all.h" | |
27 /*==== INCLUDES ===================================================*/ | |
28 #include "aci_cmh.h" | |
29 #include "ati_cmd.h" | |
30 #include "aci_cmd.h" | |
31 #include "aci_lst.h" | |
32 | |
33 #include "aci_io.h" | |
34 #include "aci_prs.h" | |
35 | |
36 #include "ati_int.h" | |
37 | |
38 #ifdef FF_ATI_BAT | |
39 | |
40 #include "typedefs.h" | |
41 #include "gdd.h" | |
42 #include "bat.h" | |
43 | |
44 #include "ati_bat.h" | |
45 #endif /* FF_ATI_BAT */ | |
46 | |
47 /*==== CONSTANTS ==================================================*/ | |
48 | |
49 /*==== TYPES ======================================================*/ | |
50 | |
51 /*==== EXPORT =====================================================*/ | |
52 | |
53 /*==== VARIABLES ==================================================*/ | |
54 GLOBAL UBYTE sat[CMD_SRC_MAX]; | |
55 | |
56 EXTERN UBYTE run_at_id; | |
57 | |
58 /*==== FUNCTIONS ==================================================*/ | |
59 | |
60 /* | |
61 +--------------------------------------------------------------------+ | |
62 | PROJECT : GSM-F&D (8411) MODULE : ACI_SAT_CMD | | |
63 | STATE : code ROUTINE : atPercentSATC | | |
64 +--------------------------------------------------------------------+ | |
65 | |
66 PURPOSE : %SATC Configuration for SIM application toolkit. | |
67 */ | |
68 | |
69 GLOBAL void aci_sat_cmd_init (void) | |
70 { | |
71 T_ACI_CMD_SRC i; | |
72 for (i=CMD_SRC_LCL; i<CMD_SRC_MAX; i++) | |
73 sat[i] = 0; /* no SIM Toolkit indications */ | |
74 } | |
75 | |
76 /* | |
77 +--------------------------------------------------------------------+ | |
78 | PROJECT : GSM-F&D (8411) MODULE : ACI_SAT_CMD | | |
79 | STATE : code ROUTINE : atPercentSATC | | |
80 +--------------------------------------------------------------------+ | |
81 | |
82 PURPOSE : %SATC Configuration for SIM application toolkit. | |
83 */ | |
84 | |
85 GLOBAL T_ATI_RSLT setatPercentSATC(char *cl, UBYTE srcId) | |
86 { | |
87 T_ACI_RETURN ret = AT_FAIL; | |
88 USHORT lenPrfl = 0; | |
89 USHORT lenPrflStr = 0; | |
90 SHORT stat = -1; | |
91 UBYTE *satPrflStr = NULL; | |
92 | |
93 cl=parse(cl,"rl", &stat,&lenPrflStr,&satPrflStr ); | |
94 #ifdef FF_SAT_E | |
95 if(!cl OR (stat NEQ -1 AND stat > SATC_ENA_CL_E)) | |
96 #else | |
97 if(!cl OR (stat NEQ -1 AND stat > 1)) | |
98 #endif | |
99 { | |
100 cmdCmeError(CME_ERR_OpNotAllow); | |
101 return(ATI_FAIL); | |
102 } | |
103 | |
104 if( stat NEQ -1 ) | |
105 { | |
106 sat[srcId] = (UBYTE)stat; | |
107 } | |
108 | |
109 if( lenPrflStr ) | |
110 { | |
111 utl_hexToGsm( satPrflStr, lenPrflStr, satPrflStr, &lenPrfl, GSM_ALPHA_Def, | |
112 CSCS_ALPHA_Reserved ); | |
113 | |
114 #ifdef FF_ATI_BAT | |
115 { | |
116 T_BAT_cmd_send cmd; | |
117 T_BAT_cmd_set_percent_satc my_bat_set_percent_satc = {0}; | |
118 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
119 | |
120 TRACE_FUNCTION("setatPercentSATC() calls bat_send() <=== as APPLICATION"); | |
121 | |
122 cmd.ctrl_params = BAT_CMD_SET_PERCENT_SATC; | |
123 cmd.params.ptr_set_percent_satc = &my_bat_set_percent_satc; | |
124 | |
125 /* Copy and trucate if necessary the satcmd string */ | |
126 if(my_bat_set_percent_satc.c_satprfl = (U8)lenPrfl) | |
127 { | |
128 memcpy(my_bat_set_percent_satc.satprfl, | |
129 satPrflStr, | |
130 my_bat_set_percent_satc.c_satprfl <= BAT_MAX_CPIN_PIN_LEN ? | |
131 my_bat_set_percent_satc.c_satprfl : BAT_MAX_CPIN_PIN_LEN); | |
132 } | |
133 | |
134 src_params->curAtCmd = AT_CMD_SATC; | |
135 | |
136 bat_send(ati_bat_get_client(srcId), &cmd); | |
137 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
138 } | |
139 | |
140 #else /* no FF_ATI_BAT */ | |
141 | |
142 TRACE_FUNCTION("setatPercentSATC"); | |
143 | |
144 ret = sAT_PercentSATC( (T_ACI_CMD_SRC)srcId, lenPrfl, satPrflStr ); | |
145 if (ret EQ AT_FAIL) | |
146 { | |
147 cmdCmeError(CME_ERR_Unknown); | |
148 } | |
149 return (map_aci_2_ati_rslt(ret)); | |
150 #endif /* no FF_ATI_BAT */ | |
151 } | |
152 return(ATI_CMPL); | |
153 } | |
154 | |
155 GLOBAL T_ATI_RSLT tesatPercentSATC(char *cl, UBYTE srcId) | |
156 { | |
157 TRACE_FUNCTION("tesatPercentSATC"); | |
158 | |
159 sprintf(g_sa,"%s: (0,1),(%d)", "%SATC", MAX_STK_PRF*2); | |
160 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
161 return ATI_CMPL; | |
162 } | |
163 | |
164 GLOBAL T_ATI_RSLT queatPercentSATC(char *cl, UBYTE srcId) | |
165 { | |
166 #ifdef FF_ATI_BAT | |
167 | |
168 T_BAT_cmd_send cmd; | |
169 T_BAT_no_parameter dummy; | |
170 | |
171 TRACE_FUNCTION("queatPercentSATC() calls bat_send() <=== as APPLICATION"); | |
172 | |
173 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_SATC; | |
174 dummy.bat_dummy = 0xFF; | |
175 cmd.params.ptr_que_percent_satc = &dummy; | |
176 bat_send(ati_bat_get_client(srcId), &cmd); | |
177 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
178 | |
179 #else /* no FF_ATI_BAT */ | |
180 | |
181 T_ACI_RETURN ret = AT_FAIL; | |
182 USHORT lenPrfl = 0; | |
183 UBYTE satPrfl[MAX_STK_PRF]; | |
184 UBYTE i; | |
185 | |
186 TRACE_FUNCTION("queatPercentSATC"); | |
187 | |
188 ret = qAT_PercentSATC((T_ACI_CMD_SRC)srcId,(SHORT*)&lenPrfl, satPrfl); | |
189 if (ret EQ AT_CMPL) | |
190 { | |
191 i=sprintf(g_sa,"%s: %d,\"", "%SATC", sat[srcId]); | |
192 | |
193 if (lenPrfl) | |
194 { | |
195 utl_binToHex( satPrfl, lenPrfl, g_sa +i ); | |
196 } | |
197 | |
198 i+=lenPrfl*2; | |
199 g_sa[i++]='"'; | |
200 g_sa[i]='\0'; | |
201 | |
202 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
203 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
204 } | |
205 else | |
206 { | |
207 cmdCmeError(CME_ERR_Unknown); | |
208 } | |
209 return (map_aci_2_ati_rslt(ret)); | |
210 | |
211 #endif /* no FF_ATI_BAT */ | |
212 } | |
213 | |
214 /* | |
215 +--------------------------------------------------------------------+ | |
216 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
217 | STATE : code ROUTINE : atPercentSATE | | |
218 +--------------------------------------------------------------------+ | |
219 | |
220 PURPOSE : %SATE Send SAT envelope command | |
221 */ | |
222 GLOBAL T_ATI_RSLT atPercentSATE(char *cl, UBYTE srcId) | |
223 { | |
224 T_ACI_RETURN ret = AT_FAIL; | |
225 UBYTE *satCmd = NULL ; | |
226 USHORT lenCmd = 0; | |
227 USHORT lenCmdStr = 0; | |
228 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
229 | |
230 cl = parse(cl,"l", &lenCmdStr,&satCmd ); | |
231 | |
232 if(!cl) | |
233 { | |
234 cmdCmeError(CME_ERR_OpNotAllow); | |
235 return ATI_FAIL; | |
236 } | |
237 | |
238 utl_hexToGsm( satCmd, lenCmdStr, satCmd, &lenCmd, GSM_ALPHA_Def, | |
239 CSCS_ALPHA_Reserved ); | |
240 | |
241 #ifdef FF_ATI_BAT | |
242 { | |
243 T_BAT_cmd_send cmd; | |
244 T_BAT_cmd_set_percent_sate my_bat_set_percent_sate = {0}; | |
245 | |
246 TRACE_FUNCTION("setatPercentSATE() calls bat_send() <=== as APPLICATION"); | |
247 | |
248 cmd.ctrl_params = BAT_CMD_SET_PERCENT_SATE; | |
249 cmd.params.ptr_set_percent_sate = &my_bat_set_percent_sate; | |
250 | |
251 /* Copy and trucate if necessary the satemd string */ | |
252 if(my_bat_set_percent_sate.c_satcmd = (U8)lenCmd) | |
253 { | |
254 memcpy(my_bat_set_percent_sate.satcmd, | |
255 satCmd, | |
256 my_bat_set_percent_sate.c_satcmd <= BAT_MAX_STK_CMD ? | |
257 my_bat_set_percent_sate.c_satcmd : BAT_MAX_STK_CMD); | |
258 } | |
259 | |
260 src_params->curAtCmd = AT_CMD_SATE; | |
261 | |
262 bat_send(ati_bat_get_client(srcId), &cmd); | |
263 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
264 } | |
265 | |
266 #else /* no FF_ATI_BAT */ | |
267 | |
268 TRACE_FUNCTION("atPercentSATE"); | |
269 | |
270 ret = sAT_PercentSATE( (T_ACI_CMD_SRC)srcId, lenCmd, satCmd ); | |
271 if (ret EQ AT_EXCT) | |
272 { | |
273 src_params->curAtCmd = AT_CMD_SATE; | |
274 } | |
275 if (ret EQ AT_FAIL) | |
276 { | |
277 cmdCmeError(CME_ERR_Unknown); | |
278 } | |
279 return (map_aci_2_ati_rslt(ret)); | |
280 #endif /* no FF_ATI_BAT */ | |
281 } | |
282 | |
283 /* | |
284 +--------------------------------------------------------------------+ | |
285 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
286 | STATE : code ROUTINE : atPercentSATR | | |
287 +--------------------------------------------------------------------+ | |
288 | |
289 PURPOSE : %SATE Send SAT command response | |
290 */ | |
291 GLOBAL T_ATI_RSLT atPercentSATR(char *cl, UBYTE srcId) | |
292 { | |
293 T_ACI_RETURN ret = AT_FAIL; | |
294 UBYTE *satRsp = NULL ; | |
295 USHORT lenRsp = 0; | |
296 USHORT lenRspStr = 0; | |
297 | |
298 cl = parse(cl,"l", &lenRspStr,&satRsp ); | |
299 | |
300 if(!cl) | |
301 { | |
302 cmdCmeError(CME_ERR_OpNotAllow); | |
303 return ATI_FAIL; | |
304 } | |
305 | |
306 utl_hexToGsm( satRsp, lenRspStr, satRsp, &lenRsp, GSM_ALPHA_Def, | |
307 CSCS_ALPHA_Reserved ); | |
308 | |
309 #ifdef FF_ATI_BAT | |
310 { | |
311 T_BAT_cmd_send cmd; | |
312 T_BAT_cmd_set_percent_satr my_bat_set_percent_satr = {0}; | |
313 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
314 | |
315 TRACE_FUNCTION("setatPercentSATR() calls bat_send() <=== as APPLICATION"); | |
316 | |
317 cmd.ctrl_params = BAT_CMD_SET_PERCENT_SATR; | |
318 cmd.params.ptr_set_percent_satr = &my_bat_set_percent_satr; | |
319 | |
320 /* Copy and trucate if necessary the satrmd string */ | |
321 if(my_bat_set_percent_satr.c_satrsp = (U8)lenRsp) | |
322 { | |
323 memcpy(my_bat_set_percent_satr.satrsp, | |
324 satRsp, | |
325 my_bat_set_percent_satr.c_satrsp <= BAT_MAX_STK_CMD ? | |
326 my_bat_set_percent_satr.c_satrsp : BAT_MAX_STK_CMD); | |
327 } | |
328 | |
329 src_params->curAtCmd = AT_CMD_SATR; | |
330 | |
331 bat_send(ati_bat_get_client(srcId), &cmd); | |
332 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
333 } | |
334 | |
335 #else /* no FF_ATI_BAT */ | |
336 | |
337 TRACE_FUNCTION("atPercentSATR"); | |
338 | |
339 ret = sAT_PercentSATR((T_ACI_CMD_SRC)srcId, lenRsp, satRsp ); | |
340 | |
341 if (ret NEQ AT_CMPL) | |
342 { | |
343 cmdCmeError(CME_ERR_Unknown); | |
344 } | |
345 return (map_aci_2_ati_rslt(ret)); | |
346 #endif /* no FF_ATI_BAT */ | |
347 } | |
348 | |
349 /* | |
350 +--------------------------------------------------------------------+ | |
351 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
352 | STATE : code ROUTINE : atPercentSATT | | |
353 +--------------------------------------------------------------------+ | |
354 | |
355 PURPOSE : %SATT Terminate SAT command or session | |
356 */ | |
357 GLOBAL T_ATI_RSLT atPercentSATT(char *cl, UBYTE srcId) | |
358 { | |
359 T_ACI_RETURN ret = AT_FAIL; | |
360 T_ACI_SATT_CS cs = SATT_CS_NotPresent; | |
361 | |
362 | |
363 cl = parse(cl,"d", &cs ); | |
364 if(!cl) | |
365 { | |
366 cmdCmeError(CME_ERR_OpNotAllow); | |
367 return ATI_FAIL; | |
368 } | |
369 | |
370 #ifdef FF_ATI_BAT | |
371 { | |
372 T_BAT_cmd_send cmd; | |
373 T_BAT_cmd_set_percent_satt my_bat_set_percent_satt = {0}; | |
374 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
375 | |
376 TRACE_FUNCTION("setatPercentSATT() calls bat_send() <=== as APPLICATION"); | |
377 | |
378 cmd.ctrl_params = BAT_CMD_SET_PERCENT_SATT; | |
379 cmd.params.ptr_set_percent_satt = &my_bat_set_percent_satt; | |
380 | |
381 my_bat_set_percent_satt.cs = (T_BAT_percent_satt_cs)cs; | |
382 | |
383 src_params->curAtCmd = AT_CMD_SATT; | |
384 | |
385 bat_send(ati_bat_get_client(srcId), &cmd); | |
386 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
387 } | |
388 | |
389 #else /* no FF_ATI_BAT */ | |
390 | |
391 TRACE_FUNCTION("atPercentSATT"); | |
392 | |
393 ret = sAT_PercentSATT( (T_ACI_CMD_SRC)srcId, cs ); | |
394 | |
395 if (ret NEQ AT_CMPL) | |
396 { | |
397 cmdCmeError(CME_ERR_Unknown); | |
398 } | |
399 return (map_aci_2_ati_rslt(ret)); | |
400 #endif /* no FF_ATI_BAT */ | |
401 } | |
402 | |
403 /* | |
404 +--------------------------------------------------------------------+ | |
405 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
406 | STATE : code ROUTINE : setatPercentEFRSLT | | |
407 +--------------------------------------------------------------------+ | |
408 | |
409 PURPOSE : %EFRSLT Response to EF update indication | |
410 */ | |
411 GLOBAL T_ATI_RSLT setatPercentEFRSLT(char *cl,UBYTE srcId) | |
412 { | |
413 T_ACI_EFRSLT_RES res; | |
414 T_ACI_RETURN ret; | |
415 | |
416 TRACE_FUNCTION("setatPercentEFRSLT()"); | |
417 | |
418 switch(*cl) | |
419 { | |
420 case '0': | |
421 res=EFRSLT_RES_FAIL; | |
422 break; | |
423 | |
424 case '1': | |
425 res=EFRSLT_RES_OK; | |
426 break; | |
427 | |
428 default: | |
429 cmdCmeError(CME_ERR_OpNotSupp); | |
430 return(ATI_FAIL); | |
431 } | |
432 | |
433 #ifdef FF_ATI_BAT | |
434 | |
435 { | |
436 T_BAT_cmd_send cmd; | |
437 T_BAT_cmd_set_percent_efrslt efrslt; | |
438 | |
439 cmd.ctrl_params=BAT_CMD_SET_PERCENT_EFRSLT; | |
440 cmd.params.ptr_set_percent_efrslt=&efrslt; | |
441 | |
442 /* | |
443 * This relies on T_BAT_percent_efrslt_result and T_ACI_EFRSLT_RES | |
444 * being identical. | |
445 */ | |
446 efrslt.result=(T_BAT_percent_efrslt_result)res; | |
447 | |
448 bat_send(ati_bat_get_client(srcId),&cmd); | |
449 return(ATI_EXCT); | |
450 } | |
451 | |
452 #else | |
453 | |
454 ret=sAT_PercentEFRSLT((T_ACI_CMD_SRC)srcId,res); | |
455 return(map_aci_2_ati_rslt(ret)); | |
456 | |
457 #endif /*FF_ATI_BAT*/ | |
458 } | |
459 | |
460 | |
461 /* | |
462 +--------------------------------------------------------------------+ | |
463 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
464 | STATE : code ROUTINE : setatPercentSIMEF | | |
465 +--------------------------------------------------------------------+ | |
466 | |
467 PURPOSE : %SIMEF Receive notification of EF updates | |
468 */ | |
469 GLOBAL T_ATI_RSLT setatPercentSIMEF(char *cl,UBYTE srcId) | |
470 { | |
471 T_ACI_SIMEF_MODE mode; | |
472 T_ACI_RETURN ret; | |
473 | |
474 TRACE_FUNCTION("setatPercentSIMEF()"); | |
475 | |
476 switch(*cl) | |
477 { | |
478 case '0': | |
479 mode=SIMEF_MODE_OFF; | |
480 break; | |
481 | |
482 case '1': | |
483 mode=SIMEF_MODE_ON; | |
484 break; | |
485 | |
486 default: | |
487 cmdCmeError(CME_ERR_OpNotSupp); | |
488 return(ATI_FAIL); | |
489 } | |
490 #ifdef FF_ATI_BAT | |
491 | |
492 { | |
493 T_BAT_cmd_send cmd; | |
494 T_BAT_cmd_set_percent_simef simef; | |
495 | |
496 cmd.ctrl_params=BAT_CMD_SET_PERCENT_SIMEF; | |
497 cmd.params.ptr_set_percent_simef=&simef; | |
498 | |
499 /* | |
500 * This relies on T_BAT_percent_simef_mode and T_ACI_SIMEF_MODE | |
501 * being identical. | |
502 */ | |
503 simef.mode = (T_BAT_percent_simef_mode)mode; | |
504 | |
505 bat_send(ati_bat_get_client(srcId),&cmd); | |
506 return(ATI_EXCT); | |
507 } | |
508 | |
509 #else | |
510 ret=sAT_PercentSIMEF((T_ACI_CMD_SRC)srcId,mode); | |
511 | |
512 return(map_aci_2_ati_rslt(ret)); | |
513 #endif /*FF_ATI_BAT*/ | |
514 } | |
515 | |
516 | |
517 /* | |
518 +--------------------------------------------------------------------+ | |
519 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
520 | STATE : code ROUTINE : queatPercentSIMEF | | |
521 +--------------------------------------------------------------------+ | |
522 | |
523 PURPOSE : %SIMEF Receive notification of EF updates | |
524 */ | |
525 GLOBAL T_ATI_RSLT queatPercentSIMEF(char *cl, UBYTE srcId) | |
526 { | |
527 #ifdef FF_ATI_BAT | |
528 | |
529 T_BAT_cmd_send cmd; | |
530 T_BAT_no_parameter dummy; | |
531 | |
532 TRACE_FUNCTION("queatPercentSIMEF() calls bat_send() <=== as APPLICATION"); | |
533 | |
534 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_SIMEF; | |
535 dummy.bat_dummy = 0xFF; | |
536 cmd.params.ptr_que_percent_simef = &dummy; | |
537 bat_send(ati_bat_get_client(srcId), &cmd); | |
538 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
539 | |
540 #else /* no FF_ATI_BAT */ | |
541 T_ACI_RETURN ret; | |
542 T_ACI_SIMEF_MODE mode; | |
543 | |
544 TRACE_FUNCTION("queatPercentSIMEF"); | |
545 | |
546 ret=qAT_PercentSIMEF((T_ACI_CMD_SRC)srcId,&mode); | |
547 | |
548 if (ret EQ AT_CMPL) | |
549 { | |
550 sprintf(g_sa,"%s: %d","%SIMEF",mode); | |
551 io_sendMessage(srcId,g_sa,ATI_NORMAL_OUTPUT); | |
552 } | |
553 | |
554 return(map_aci_2_ati_rslt(ret)); | |
555 #endif /* no FF_ATI_BAT */ | |
556 } | |
557 | |
558 | |
559 /* | |
560 +--------------------------------------------------------------------+ | |
561 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
562 | STATE : code ROUTINE : handle_rCI_PercentSATx | | |
563 +--------------------------------------------------------------------+ | |
564 | |
565 PURPOSE : handles chunked output for several rCI_PercentSAT functions | |
566 */ | |
567 | |
568 LOCAL void handle_rCI_PercentSATx ( CHAR *prefix, | |
569 SHORT len, | |
570 UBYTE *satCmd, | |
571 T_ACI_SATN_CNTRL_TYPE cntrl_type) | |
572 { | |
573 SHORT i; | |
574 UBYTE srcId = srcId_cb; | |
575 SHORT chunksize; | |
576 T_ATI_OUTPUT_TYPE output_type =(T_ATI_OUTPUT_TYPE) (ATI_INDICATION_OUTPUT | | |
577 ATI_BEGIN_CRLF_OUTPUT); | |
578 | |
579 if( sat[srcId] ) | |
580 { | |
581 i=sprintf(g_sa, "%s: \"", prefix); | |
582 do | |
583 { | |
584 chunksize = (sizeof(g_sa)-i-2)/2; /* -2 for '"' and '\0' at the end, /2 since we occupy two bytes after binToHex */ | |
585 | |
586 if (cntrl_type NEQ SATN_CNTRL_BY_SIM_Not_Present) | |
587 { | |
588 chunksize -= 2; /* Take another 2 characters off for the ,<cntrl_type> */ | |
589 } | |
590 chunksize = MINIMUM(len, chunksize); | |
591 | |
592 utl_binToHex( satCmd, chunksize, g_sa+i ); | |
593 | |
594 if ((len -= chunksize) EQ 0) | |
595 { | |
596 /* end reached? then append CRLF to the last output */ | |
597 output_type |= ATI_END_CRLF_OUTPUT; | |
598 | |
599 i+=2*chunksize; | |
600 | |
601 g_sa[i++]='"'; /* closing quotation marks */ | |
602 | |
603 /* | |
604 ** Add the control type onto the end, if given | |
605 */ | |
606 if (cntrl_type NEQ SATN_CNTRL_BY_SIM_Not_Present) | |
607 { | |
608 g_sa[i++] = ','; | |
609 switch(cntrl_type) | |
610 { | |
611 case SATN_CNTRL_BY_SIM_CALL: | |
612 g_sa[i++] = '0'; | |
613 break; | |
614 | |
615 case SATN_CNTRL_BY_SIM_SS: | |
616 g_sa[i++] = '1'; | |
617 break; | |
618 | |
619 case SATN_CNTRL_BY_SIM_USSD: | |
620 g_sa[i++] = '2'; | |
621 break; | |
622 | |
623 case SATN_CNTRL_BY_SIM_SMS: | |
624 g_sa[i++] = '3'; | |
625 break; | |
626 | |
627 default: | |
628 i--; | |
629 break; | |
630 } | |
631 | |
632 } | |
633 | |
634 g_sa[i]='\0'; | |
635 } | |
636 | |
637 io_sendMessageEx(srcId, g_sa, output_type); | |
638 | |
639 /* remove the BEGIN_CRLF for the next possible chunk */ | |
640 output_type &= (T_ATI_OUTPUT_TYPE)~ATI_BEGIN_CRLF_OUTPUT; | |
641 | |
642 g_sa[0] = '\0'; | |
643 i=0; | |
644 satCmd += chunksize; | |
645 } while (len); | |
646 } | |
647 } | |
648 | |
649 | |
650 /* | |
651 +--------------------------------------------------------------------+ | |
652 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
653 | STATE : code ROUTINE : rCI_PercentSATI | | |
654 +--------------------------------------------------------------------+ | |
655 | |
656 PURPOSE : handles AT_PercentSATI call back | |
657 | |
658 */ | |
659 | |
660 GLOBAL void rCI_PercentSATI ( /*UBYTE srcId,*/ | |
661 SHORT len, | |
662 UBYTE *satCmd) | |
663 { | |
664 TRACE_FUNCTION("rCI_PercentSATI()"); | |
665 handle_rCI_PercentSATx ("%SATI", len, satCmd, SATN_CNTRL_BY_SIM_Not_Present); | |
666 } | |
667 | |
668 /* | |
669 +--------------------------------------------------------------------+ | |
670 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
671 | STATE : code ROUTINE : rCI_PercentSATE | | |
672 +--------------------------------------------------------------------+ | |
673 | |
674 PURPOSE : handles AT_PercentSATE call back | |
675 | |
676 */ | |
677 | |
678 GLOBAL void rCI_PercentSATE ( /*UBYTE srcId,*/ | |
679 SHORT len, | |
680 UBYTE *satCmd) | |
681 { | |
682 TRACE_FUNCTION("rCI_PercentSATE()"); | |
683 handle_rCI_PercentSATx ("%SATE", len, satCmd, SATN_CNTRL_BY_SIM_Not_Present); | |
684 } | |
685 | |
686 /* | |
687 +--------------------------------------------------------------------+ | |
688 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
689 | STATE : code ROUTINE : rCI_PercentSATN | | |
690 +--------------------------------------------------------------------+ | |
691 | |
692 PURPOSE : handles AT_PercentSATN call back | |
693 | |
694 */ | |
695 | |
696 GLOBAL void rCI_PercentSATN ( /*UBYTE srcId,*/ | |
697 SHORT len, | |
698 UBYTE *satCmd, | |
699 T_ACI_SATN_CNTRL_TYPE cntrl_type) | |
700 { | |
701 UBYTE srcId = srcId_cb; | |
702 | |
703 TRACE_FUNCTION("rCI_PercentSATN()"); | |
704 | |
705 if(srcId NEQ run_at_id) | |
706 { | |
707 handle_rCI_PercentSATx ("%SATN", len, satCmd, cntrl_type); | |
708 } | |
709 } | |
710 | |
711 /* | |
712 +--------------------------------------------------------------------+ | |
713 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
714 | STATE : code ROUTINE : rCI_PercentSATA | | |
715 +--------------------------------------------------------------------+ | |
716 | |
717 PURPOSE : handles AT_PercentSATA call back | |
718 | |
719 */ | |
720 | |
721 #ifdef FF_SAT_E | |
722 GLOBAL void rCI_PercentSATA ( /*UBYTE srcId,*/ | |
723 SHORT cId, | |
724 LONG rdlTimeout_ms, | |
725 T_ACI_SATA_ADD *addParm ) | |
726 #else | |
727 GLOBAL void rCI_PercentSATA ( /*UBYTE srcId,*/ | |
728 SHORT cId, | |
729 LONG rdlTimeout_ms) | |
730 #endif /* FF_SAT_E */ | |
731 { | |
732 UBYTE i; | |
733 UBYTE srcId = srcId_cb; | |
734 | |
735 TRACE_FUNCTION("rCI_PercentSATA()"); | |
736 | |
737 if( sat[srcId] ) | |
738 { | |
739 i=sprintf(g_sa,"%s: ","%SATA"); | |
740 | |
741 if(rdlTimeout_ms NEQ ACI_NumParmNotPresent) | |
742 { | |
743 i+=sprintf( g_sa+i, "%d", rdlTimeout_ms ); | |
744 } | |
745 | |
746 #ifdef FF_SAT_E | |
747 if( sat[srcId] EQ SATC_ENA_CL_E ) | |
748 { | |
749 sprintf( g_sa+i, ",%d,%d", addParm->chnType, addParm->chnEst ); | |
750 } | |
751 #endif /* FF_SAT_E */ | |
752 | |
753 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
754 } | |
755 } | |
756 | |
757 #endif /* ATI_SAT_C */ | |
758 | |
759 #endif /* #ifdef SIM_TOOLKIT */ | |
760 |