FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/ati_ret.c @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Sep 2016 00:29:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:c41a534f33c6 | 3:93999a60b835 |
---|---|
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 Call-Back Functions | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_RET_C | |
22 #define ATI_RET_C | |
23 | |
24 #include "aci_all.h" /* defines FF_TIMEZONE */ | |
25 | |
26 #include "line_edit.h" | |
27 #include "aci_cmh.h" /* uses FF_TIMEZONE */ | |
28 #include "ati_cmd.h" | |
29 #include "aci_cmd.h" | |
30 #include "aci_io.h" | |
31 #include "p_aci.h" | |
32 #include "aci.h" | |
33 #include "l4_tim.h" | |
34 #include "ksd.h" | |
35 | |
36 #include "psa.h" | |
37 #include "psa_sms.h" | |
38 #include "psa_sim.h" | |
39 #include "cmh.h" | |
40 #include "cmh_sms.h" | |
41 #include "psa_cc.h" | |
42 #include "psa_ss.h" | |
43 #include "cmh_ss.h" | |
44 #include "cmh_cc.h" | |
45 #include "cmh_mm.h" | |
46 | |
47 #include "psa_util.h" | |
48 #include "cmh_mm.h" | |
49 | |
50 #ifdef DTI | |
51 #include "dti.h" /* functionality of the dti library */ | |
52 #endif | |
53 #include "dti_conn_mng.h" | |
54 | |
55 #ifdef GPRS | |
56 #include "gaci.h" | |
57 #include "gaci_cmh.h" | |
58 #include "psa_sm.h" | |
59 #include "cmh_sm.h" | |
60 #endif /* GPRS */ | |
61 | |
62 #include "aci_mem.h" | |
63 | |
64 #include "aci_lst.h" | |
65 #ifdef UART | |
66 #include "psa_uart.h" | |
67 #include "cmh_uart.h" | |
68 #endif | |
69 #include "conc_sms.h" | |
70 | |
71 #ifdef FF_PSI | |
72 #include "psa_psi.h" | |
73 #include "cmh_psi.h" | |
74 #endif /*FF_PSI*/ | |
75 | |
76 #ifdef GPRS | |
77 #include "gaci_cmd.h" | |
78 #endif | |
79 #include "aci_cmd.h" | |
80 | |
81 #if defined FF_EOTD | |
82 #include "cmh_lc.h" | |
83 #endif | |
84 | |
85 #include "ati_int.h" | |
86 | |
87 #ifdef ACI | |
88 #include "cmh_mmi.h" | |
89 #endif /* ACI */ | |
90 | |
91 #ifdef FF_ATI | |
92 | |
93 GLOBAL T_CIEV_SIGNAL_BUFFER asCievSignalBuf; | |
94 GLOBAL T_CIEV_SMSFULL_BUFFER asCievSmsFullBuf; | |
95 | |
96 EXTERN CHAR *CPIN_RESULT(T_ACI_CPIN_RSLT code); | |
97 EXTERN UBYTE src_id_ext; /* this source runs currently an extension command */ | |
98 | |
99 EXTERN T_ATI_IO_MODE ati_get_mode (UBYTE srcId ); | |
100 EXTERN T_ATI_RSLT ati_execute_cmd_line (T_ATI_SRC_PARAMS *src_params); | |
101 | |
102 /* | |
103 * needed for rCI_Z | |
104 */ | |
105 EXTERN void ati_cmd_reset (UBYTE srcId); | |
106 EXTERN void ati_zn_retrieve_params ( UBYTE srcId ); | |
107 | |
108 | |
109 LOCAL UBYTE aci_writeCnumMsisdn (UBYTE srcId, T_ACI_CNUM_MSISDN* msisdn ); | |
110 LOCAL void aci_frmtOutput ( UBYTE fo, | |
111 UBYTE dcs, | |
112 T_ACI_SM_DATA *data ); | |
113 | |
114 LOCAL void r_Plus_Percent_COPS( T_ACI_AT_CMD cmd, | |
115 SHORT lastIdx, | |
116 T_ACI_COPS_OPDESC * operLst); | |
117 /* | |
118 typedef struct | |
119 { | |
120 char *name; | |
121 T_ACI_CPWD_FAC fac; | |
122 } net_fac; */ | |
123 | |
124 LOCAL BOOL allowCCCM = TRUE; | |
125 LOCAL UBYTE callTime = 0; | |
126 | |
127 LOCAL const SMS_Memory sms_mem [] = | |
128 | |
129 { | |
130 {"ME", SMS_STOR_Me}, | |
131 {"me", SMS_STOR_Me}, | |
132 {"SM", SMS_STOR_Sm}, | |
133 {"sm", SMS_STOR_Sm}, | |
134 {0,0} | |
135 }; | |
136 | |
137 #if defined (SMS_PDU_SUPPORT) | |
138 | |
139 LOCAL void rCI_PlusCMTText ( T_MNSMS_MESSAGE_IND * mnsms_message_ind); | |
140 LOCAL void rCI_PlusCDSText ( T_MNSMS_STATUS_IND * mnsms_status_ind ); | |
141 LOCAL void rCI_PlusCBMText ( T_MMI_CBCH_IND * mmi_cbch_ind ); | |
142 LOCAL void rCI_PlusCMGSText( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf); | |
143 LOCAL void rCI_PlusCMSSText( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf); | |
144 LOCAL void rCI_PlusCMGCText( T_MNSMS_COMMAND_CNF * mnsms_command_cnf); | |
145 | |
146 | |
147 #endif | |
148 | |
149 LOCAL void rCI_Plus_Percent_CMGLText ( T_MNSMS_READ_CNF *mnsms_read_cnf, | |
150 T_ACI_AT_CMD cmd); | |
151 LOCAL void rCI_Plus_Percent_CMGRText ( T_MNSMS_READ_CNF * mnsms_read_cnf, | |
152 T_ACI_CMGR_CBM * cbm, | |
153 T_ACI_AT_CMD cmd); | |
154 LOCAL void rCI_Plus_Percent_CMGLTextSP ( T_MNSMS_READ_CNF* mnsms_read_cnf, | |
155 T_ACI_AT_CMD cmdId); | |
156 LOCAL void rCI_Plus_Percent_CMGRTextSP ( T_MNSMS_READ_CNF* mnsms_read_cnf, | |
157 T_ACI_AT_CMD cmdId); | |
158 | |
159 GLOBAL CHAR *sms_status (T_ACI_SMS_STAT stat) /* used in text mode by CMGL and CMGR */ | |
160 { | |
161 switch(stat) | |
162 { | |
163 case(SMS_STAT_Invalid): return "INVALID MESSAGE"; | |
164 case(SMS_STAT_RecUnread): return "REC UNREAD"; | |
165 case(SMS_STAT_RecRead): return "REC READ"; | |
166 case(SMS_STAT_StoUnsent): return "STO UNSENT"; | |
167 case(SMS_STAT_StoSent): return "STO SENT"; | |
168 case(SMS_STAT_All): return "ALL"; | |
169 default: return 0; | |
170 } | |
171 } | |
172 | |
173 GLOBAL char *ring_stat(T_ACI_CRING_TYP type) | |
174 { | |
175 switch(type) | |
176 { | |
177 case(CRING_TYP_NotPresent): return "Not Present"; | |
178 case(CRING_TYP_Async): return "ASYNC"; | |
179 case(CRING_TYP_Sync): return "SYNC"; | |
180 case(CRING_TYP_RelAsync): return "REL ASYNC"; | |
181 case(CRING_TYP_RelSync): return "REL SYNC"; | |
182 case(CRING_TYP_Fax): return "FAX"; | |
183 case(CRING_TYP_Voice): return "VOICE"; | |
184 case(CRING_TYP_AuxVoice): return "AUX VOICE"; | |
185 default: return "Error"; | |
186 } | |
187 } | |
188 #define RING_STAT_LTH 15 | |
189 /* | |
190 +--------------------------------------------------------------------+ | |
191 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
192 | STATE : code ROUTINE : rCI_OK | | |
193 +--------------------------------------------------------------------+ | |
194 | |
195 PURPOSE : handles AT_OK call back | |
196 | |
197 */ | |
198 | |
199 GLOBAL void rCI_OK ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId ) | |
200 { | |
201 UBYTE srcId = srcId_cb; | |
202 T_ATI_RSLT rv_ati = ATI_FAIL; | |
203 | |
204 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
205 | |
206 TRACE_FUNCTION("rCI_OK()"); | |
207 | |
208 src_params->curAtCmd = AT_CMD_NONE; | |
209 | |
210 switch (cmdId) | |
211 { | |
212 case (AT_CMD_D): | |
213 TRACE_EVENT("AT command line successfully processed") ; | |
214 /*lint -fallthrough*/ | |
215 case (AT_CMD_NONE): | |
216 case (AT_CMD_EXT): | |
217 #if FF_FAX | |
218 case (AT_CMD_FDR): | |
219 case (AT_CMD_FDT): | |
220 case (AT_CMD_FKS): | |
221 #endif | |
222 /* | |
223 * tell line edit that the cmd line is finished/aborted | |
224 * and to be able to receive a new one | |
225 */ | |
226 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
227 io_sendConfirm (srcId, cmdAtError(atOk), ATI_NORMAL_OUTPUT); | |
228 curAbrtCmd = AT_CMD_NONE; | |
229 cmdErrStr = NULL; | |
230 break; | |
231 | |
232 default: | |
233 /* | |
234 * there are possibly further AT cmds after re-entering the ACI context | |
235 */ | |
236 /* this is only a bypass for ATI sources which uses the functional interface */ | |
237 if (src_params->cmd_state EQ CMD_IDLE) | |
238 { | |
239 io_sendConfirm (src_params->src_id, cmdAtError(atOk), ATI_NORMAL_OUTPUT); | |
240 } | |
241 else | |
242 { | |
243 /* | |
244 * there are possibly further AT cmds after re-entering the ACI context | |
245 */ | |
246 rv_ati = ati_execute_cmd_line (src_params); | |
247 } | |
248 break; | |
249 } | |
250 #ifdef ACI /* for ATI only version */ | |
251 cmhMMI_handleAudioTone ( cmdId, RAT_OK, CPI_MSG_NotPresent ); | |
252 #endif | |
253 } | |
254 | |
255 | |
256 /* | |
257 +--------------------------------------------------------------------+ | |
258 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
259 | STATE : code ROUTINE : rCI_NO_CARRIER | | |
260 +--------------------------------------------------------------------+ | |
261 | |
262 PURPOSE : handles AT_NO_CARRIER call back | |
263 | |
264 */ | |
265 | |
266 GLOBAL void rCI_NO_CARRIER ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId, SHORT cId ) | |
267 { | |
268 UBYTE srcId = srcId_cb; | |
269 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
270 | |
271 TRACE_FUNCTION("rCI_NO_CARRIER()"); | |
272 | |
273 if ( src_params->curAtCmd EQ AT_CMD_D | |
274 OR src_params->curAtCmd EQ AT_CMD_A | |
275 OR src_params->curAtCmd EQ AT_CMD_H | |
276 OR src_params->curAtCmd EQ AT_CMD_CGDATA | |
277 OR src_params->curAtCmd EQ AT_CMD_CGANS | |
278 #ifdef FF_FAX | |
279 OR src_params->curAtCmd EQ AT_CMD_FDR | |
280 OR src_params->curAtCmd EQ AT_CMD_FDT | |
281 #endif | |
282 ) | |
283 { | |
284 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
285 src_params->curAtCmd = AT_CMD_NONE; | |
286 io_sendConfirm(srcId, cmdAtError(atNoCarrier), ATI_ERROR_OUTPUT | ATI_RESULT_CODE_OUTPUT); | |
287 } | |
288 else | |
289 { | |
290 /* | |
291 * According to the v25ter NO CARRIER is stated as a final result code. | |
292 * | |
293 * This implementation differ in this case from the standard. | |
294 * There are two differnt reasons: | |
295 * - Data transfer on a different source than the transfer was started | |
296 * - NO CARRIER if the other peer of a CS call hangs up | |
297 * | |
298 * For the first reason the CONNECT will be the final result code (standard: intermediate) | |
299 * For the second reason the ATD resuts an OK. | |
300 */ | |
301 io_sendIndication(srcId, cmdAtError(atNoCarrier), ATI_FORCED_OUTPUT | ATI_RESULT_CODE_OUTPUT); | |
302 } | |
303 | |
304 cmdErrStr = NULL; | |
305 | |
306 #ifdef ACI /* for ATI only version */ | |
307 cmhMMI_handleAudioTone ( cmdId, RAT_NO_CARRIER, CPI_MSG_NotPresent ); | |
308 #endif | |
309 } | |
310 | |
311 /* | |
312 +--------------------------------------------------------------------+ | |
313 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
314 | STATE : code ROUTINE : rCI_BUSY | | |
315 +--------------------------------------------------------------------+ | |
316 | |
317 PURPOSE : handles AT_BUSY call back | |
318 | |
319 */ | |
320 | |
321 GLOBAL void rCI_BUSY ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId, SHORT cId ) | |
322 { | |
323 UBYTE srcId = srcId_cb; | |
324 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
325 | |
326 | |
327 TRACE_FUNCTION("rCI_BUSY()"); | |
328 | |
329 src_params->curAtCmd = AT_CMD_NONE; | |
330 | |
331 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
332 | |
333 io_sendConfirm(srcId, cmdAtError(atBusy), ATI_ERROR_OUTPUT); | |
334 | |
335 #ifdef ACI /* for ATI only version */ | |
336 cmhMMI_handleAudioTone ( cmdId, RAT_BUSY, CPI_MSG_NotPresent ); | |
337 #endif | |
338 | |
339 cmdErrStr = NULL; | |
340 } | |
341 | |
342 /* | |
343 +--------------------------------------------------------------------+ | |
344 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
345 | STATE : code ROUTINE : rCI_NO_ANSWER | | |
346 +--------------------------------------------------------------------+ | |
347 | |
348 PURPOSE : handles AT_NO_ANSWER call back | |
349 | |
350 */ | |
351 | |
352 GLOBAL void rCI_NO_ANSWER ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId, SHORT cId ) | |
353 { | |
354 UBYTE srcId = srcId_cb; | |
355 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
356 | |
357 | |
358 TRACE_FUNCTION("rCI_NO_ANSWER()"); | |
359 | |
360 src_params->curAtCmd = AT_CMD_NONE; | |
361 | |
362 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
363 | |
364 io_sendConfirm(srcId, cmdAtError(atNoAnswer), ATI_ERROR_OUTPUT); | |
365 | |
366 cmdErrStr = NULL; | |
367 | |
368 #ifdef ACI /* for ATI only version */ | |
369 cmhMMI_handleAudioTone ( cmdId, RAT_NO_ANSWER, CPI_MSG_NotPresent ); | |
370 #endif | |
371 } | |
372 | |
373 /* | |
374 +--------------------------------------------------------------------+ | |
375 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
376 | STATE : code ROUTINE : rCI_CONNECT | | |
377 +--------------------------------------------------------------------+ | |
378 | |
379 PURPOSE : handles AT_CONNECT call back. | |
380 flow_cntr = TRUE flow control active. | |
381 flow_cntr = FALSE " " inactive. | |
382 | |
383 */ | |
384 | |
385 GLOBAL void rCI_CONNECT ( /*UBYTE srcId,*/ | |
386 T_ACI_AT_CMD cmdId, | |
387 T_ACI_BS_SPEED speed, | |
388 SHORT cId, | |
389 BOOL flow_cntr ) | |
390 { | |
391 LONG val; | |
392 LONG val_nv=-1; | |
393 UBYTE srcId = srcId_cb; | |
394 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
395 CHAR *cmd_key = ""; | |
396 | |
397 TRACE_FUNCTION("rCI_CONNECT()"); | |
398 | |
399 src_params->curAtCmd = AT_CMD_NONE; | |
400 | |
401 switch(speed) | |
402 { | |
403 case(BS_SPEED_300_V110): val=300; val_nv = 10; break; | |
404 case(BS_SPEED_1200_V110): val=1200; val_nv = 11; break; | |
405 case(BS_SPEED_2400_V110): val=2400; val_nv = 13; break; | |
406 case(BS_SPEED_4800_V110): val=4800; val_nv = 14; break; | |
407 case(BS_SPEED_9600_V110): val=9600; val_nv = 15; break; | |
408 case(BS_SPEED_14400_V110): val=14400; val_nv = 16; break; | |
409 case(BS_SPEED_19200_V110): val=19200; break; | |
410 case(BS_SPEED_38400_V110): val=38400; break; | |
411 default: val=-1; | |
412 } | |
413 | |
414 if (src_params EQ NULL) | |
415 { | |
416 TRACE_EVENT_P1 ("[ERR] rCI_CONNECT(): srcId=%d not found", srcId); | |
417 return; | |
418 } | |
419 #ifdef UART | |
420 if (src_params->src_type EQ ATI_SRC_TYPE_UART) | |
421 { | |
422 T_ACI_DTI_PRC *uart_infos; | |
423 | |
424 uart_infos = find_element (uart_src_params, | |
425 (UBYTE)srcId, | |
426 cmhUARTtest_srcId); | |
427 if( flow_cntr ) | |
428 { | |
429 /* this is in case of fax sending */ | |
430 BITFIELD_SET (uart_infos->data_cntr, UART_DTI_FLOW_OFF); | |
431 } | |
432 else | |
433 { | |
434 BITFIELD_CLEAR (uart_infos->data_cntr, UART_DTI_FLOW_OFF); | |
435 } | |
436 } | |
437 #endif | |
438 #ifdef FF_PSI | |
439 if (src_params->src_type EQ ATI_SRC_TYPE_PSI) | |
440 { | |
441 T_ACI_DTI_PRC_PSI *psi_infos; | |
442 | |
443 psi_infos = find_element (psi_src_params, | |
444 (UBYTE)srcId, | |
445 cmhPSItest_srcId); | |
446 if( flow_cntr ) | |
447 { | |
448 /* this is in case of fax sending */ | |
449 BITFIELD_SET (psi_infos->data_cntr, PSI_DTI_FLOW_OFF); | |
450 } | |
451 else | |
452 { | |
453 BITFIELD_CLEAR (psi_infos->data_cntr, PSI_DTI_FLOW_OFF); | |
454 } | |
455 } | |
456 #endif /*FF_PSI*/ | |
457 | |
458 if(val > 0 AND ati_user_output_cfg[srcId].atX > 0) | |
459 { | |
460 if(at.s1415.atV NEQ 0) /*Verbose case*/ | |
461 { | |
462 sprintf(g_sa,"CONNECT %d",val); | |
463 io_sendConfirm(srcId, g_sa, (ATI_NORMAL_OUTPUT | ATI_CONNECT_OUTPUT)); | |
464 } | |
465 else if(val_nv > 0) /*Nonverbose case*/ | |
466 { | |
467 sprintf(g_sa,"%d",val_nv); | |
468 io_sendConfirm(srcId, g_sa, (ATI_NORMAL_OUTPUT | ATI_CONNECT_OUTPUT) ); | |
469 } | |
470 else | |
471 io_sendConfirm(srcId, cmdAtError(atConnect), (ATI_NORMAL_OUTPUT | ATI_CONNECT_OUTPUT)); | |
472 } | |
473 else | |
474 { | |
475 io_sendConfirm(srcId, cmdAtError(atConnect), (ATI_NORMAL_OUTPUT | ATI_CONNECT_OUTPUT)); | |
476 } | |
477 | |
478 /* | |
479 * tell line edit that the cmd line is finished/aborted | |
480 * and to be able to receive a new one | |
481 */ | |
482 ati_get_cmds_key(cmdId, &cmd_key, NULL); | |
483 TRACE_EVENT_P1("%s completed", cmd_key); | |
484 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
485 | |
486 cmdErrStr = NULL; | |
487 | |
488 #ifdef ACI /* for ATI only version */ | |
489 cmhMMI_handleAudioTone ( cmdId, RAT_CONNECT, CPI_MSG_NotPresent ); | |
490 #endif | |
491 } | |
492 | |
493 /* | |
494 +--------------------------------------------------------------------+ | |
495 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
496 | STATE : code ROUTINE : rCI_PlusCME | | |
497 +--------------------------------------------------------------------+ | |
498 | |
499 PURPOSE : handles AT_PlusCME call back | |
500 | |
501 */ | |
502 | |
503 GLOBAL void rCI_PlusCME ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId, T_ACI_CME_ERR err ) | |
504 { | |
505 UBYTE srcId = srcId_cb; | |
506 | |
507 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
508 | |
509 TRACE_FUNCTION("rCI_PLusCME()"); | |
510 /* | |
511 * tell line edit that the cmd line is finished/aborted | |
512 * and to be able to receive a new one | |
513 */ | |
514 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
515 /* | |
516 * if (asynchroniously) extension command, reset the global src_id_ext | |
517 */ | |
518 if (src_id_ext EQ src_params->src_id) | |
519 { | |
520 src_id_ext = 0xFF; | |
521 } | |
522 if ( curAbrtCmd EQ AT_CMD_NONE ) | |
523 { | |
524 src_params->curAtCmd = AT_CMD_NONE; | |
525 | |
526 io_sendConfirm(srcId, cmdCmeError(err), ATI_ERROR_OUTPUT); | |
527 | |
528 cmdErrStr = NULL; | |
529 | |
530 #ifdef ACI /* for ATI only version */ | |
531 cmhMMI_handleAudioTone ( cmdId, RAT_CME, CPI_MSG_NotPresent ); | |
532 #endif | |
533 } | |
534 else | |
535 { | |
536 curAbrtCmd = AT_CMD_NONE; | |
537 | |
538 io_sendMessage ( srcId, cmdCmeError ( CME_ERR_FailedToAbort ), | |
539 ATI_NORMAL_OUTPUT | ATI_RESULT_CODE_OUTPUT); | |
540 } | |
541 } | |
542 | |
543 /* | |
544 +--------------------------------------------------------------------+ | |
545 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
546 | STATE : code ROUTINE : rCI_PlusCPIN | | |
547 +--------------------------------------------------------------------+ | |
548 | |
549 PURPOSE : handles AT_PlusCPIN call back | |
550 | |
551 */ | |
552 | |
553 GLOBAL void rCI_PlusCPIN (/*UBYTE srcId,*/ T_ACI_CPIN_RSLT rslt ) | |
554 { | |
555 UBYTE srcId = srcId_cb; | |
556 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
557 | |
558 | |
559 TRACE_FUNCTION("rCI_PLusCPIN()"); | |
560 | |
561 src_params->curAtCmd = AT_CMD_NONE; | |
562 | |
563 sprintf(g_sa,"%s%s","+CPIN: ",CPIN_RESULT(rslt)); | |
564 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
565 } | |
566 | |
567 typedef enum | |
568 { | |
569 STAT_NotPresent = -1, | |
570 STAT_Other, /* other than registered and Roaming */ | |
571 STAT_Reg, | |
572 STAT_Roam | |
573 } T_ACI_NTW_STATUS; | |
574 | |
575 LOCAL T_ACI_NTW_STATUS get_raw_stat_among_CREG( T_ACI_CREG_STAT status ) | |
576 { | |
577 switch(status) | |
578 { | |
579 case(CREG_STAT_NotPresent): | |
580 return(STAT_NotPresent); | |
581 | |
582 case(CREG_STAT_Reg): | |
583 return(STAT_Reg); | |
584 | |
585 case(CREG_STAT_Roam): | |
586 return(STAT_Roam); | |
587 | |
588 default: | |
589 return(STAT_Other); | |
590 } | |
591 } | |
592 | |
593 #ifdef GPRS | |
594 LOCAL T_ACI_NTW_STATUS get_raw_stat_among_CGREG( T_CGREG_STAT status ) | |
595 { | |
596 switch(status) | |
597 { | |
598 case(CGREG_STAT_REG_HOME): | |
599 return(STAT_Reg); | |
600 | |
601 case(CGREG_STAT_REG_ROAM): | |
602 return(STAT_Roam); | |
603 | |
604 default: | |
605 return(STAT_Other); | |
606 } | |
607 } | |
608 | |
609 LOCAL T_ACI_NTW_STATUS get_raw_stat_among_P_CGREG( T_P_CGREG_STAT status ) | |
610 { | |
611 switch(status) | |
612 { | |
613 case(P_CGREG_STAT_REG_HOME): | |
614 return(STAT_Reg); | |
615 | |
616 case(P_CGREG_STAT_REG_ROAM): | |
617 return(STAT_Roam); | |
618 | |
619 default: | |
620 return(STAT_Other); | |
621 } | |
622 } | |
623 #endif /* GPRS */ | |
624 | |
625 /* function fills up registration status parameters according to type of | |
626 user notification (+CREG/+CGREG/%CGREG) | |
627 returns whether network status has changed or not: BOOL */ | |
628 LOCAL BOOL get_registration_data_among_cmd( UBYTE srcId, | |
629 int status, | |
630 T_ATI_REG_MOD_LAC_CID *mod_lac_cid, | |
631 T_ACI_NTW_STATUS *raw_status, | |
632 CHAR *cmd_string, | |
633 T_ACI_CREG_CMD cmd) | |
634 { | |
635 USHORT previous_status, | |
636 current_status; | |
637 | |
638 current_status = previous_status = status; | |
639 | |
640 switch(cmd) | |
641 { | |
642 case(CREG_CMD): | |
643 *mod_lac_cid = ati_user_output_cfg[srcId].creg.mod_lac_cid; | |
644 previous_status = ati_user_output_cfg[srcId].creg.last_presented_state; | |
645 | |
646 *raw_status = get_raw_stat_among_CREG((T_ACI_CREG_STAT) current_status); | |
647 strcpy(cmd_string, "+CREG: "); | |
648 break; | |
649 | |
650 case(PercentCREG_CMD): | |
651 *mod_lac_cid = ati_user_output_cfg[srcId].percent_creg.mod_lac_cid; | |
652 previous_status = ati_user_output_cfg[srcId].percent_creg.last_presented_state; | |
653 | |
654 *raw_status = get_raw_stat_among_CREG((T_ACI_CREG_STAT) current_status); | |
655 strcpy(cmd_string, "%CREG: "); | |
656 break; | |
657 | |
658 | |
659 #if defined (GPRS) AND defined (DTI) | |
660 case(PlusCGREG_CMD): | |
661 *mod_lac_cid = ati_gprs_user_output_cfg[srcId].plus_cgreg.mod_lac_cid; | |
662 previous_status = ati_gprs_user_output_cfg[srcId].plus_cgreg.last_presented_state; | |
663 | |
664 *raw_status = get_raw_stat_among_CGREG((T_CGREG_STAT) current_status); | |
665 strcpy(cmd_string, "+CGREG: "); | |
666 break; | |
667 | |
668 case(PercentCGREG_CMD): | |
669 *mod_lac_cid = ati_gprs_user_output_cfg[srcId].percent_cgreg.mod_lac_cid; | |
670 previous_status = ati_gprs_user_output_cfg[srcId].percent_cgreg.last_presented_state; | |
671 | |
672 *raw_status = get_raw_stat_among_P_CGREG((T_P_CGREG_STAT) current_status); | |
673 strcpy(cmd_string, "%CGREG: "); | |
674 break; | |
675 #endif | |
676 } | |
677 | |
678 if( current_status NEQ previous_status) | |
679 { | |
680 return TRUE; | |
681 } | |
682 | |
683 return FALSE; | |
684 } | |
685 | |
686 LOCAL void update_last_presented_datas_among_cmd( UBYTE srcId, | |
687 int status, | |
688 USHORT lac, | |
689 USHORT cid, | |
690 T_ACI_CREG_CMD cmd) | |
691 { | |
692 T_ATI_REG_MOD_LAC_CID *mod_lac_cid; | |
693 | |
694 switch(cmd) | |
695 { | |
696 case(CREG_CMD): | |
697 ati_user_output_cfg[srcId].creg.last_presented_state = (T_ACI_CREG_STAT)status; | |
698 mod_lac_cid = &ati_user_output_cfg[srcId].creg.mod_lac_cid; | |
699 break; | |
700 | |
701 case(PercentCREG_CMD): | |
702 ati_user_output_cfg[srcId].percent_creg.last_presented_state = (T_ACI_CREG_STAT)status; | |
703 mod_lac_cid = &ati_user_output_cfg[srcId].percent_creg.mod_lac_cid; | |
704 break; | |
705 | |
706 #if defined (GPRS) AND defined (DTI) | |
707 case(PlusCGREG_CMD): | |
708 ati_gprs_user_output_cfg[srcId].plus_cgreg.last_presented_state = (T_CGREG_STAT)status; | |
709 mod_lac_cid = &ati_gprs_user_output_cfg[srcId].plus_cgreg.mod_lac_cid; | |
710 break; | |
711 | |
712 case(PercentCGREG_CMD): | |
713 ati_gprs_user_output_cfg[srcId].percent_cgreg.last_presented_state = (T_P_CGREG_STAT)status; | |
714 mod_lac_cid = &ati_gprs_user_output_cfg[srcId].percent_cgreg.mod_lac_cid; | |
715 break; | |
716 #endif /* GPRS */ | |
717 | |
718 default: | |
719 return; | |
720 } | |
721 | |
722 if( lac NEQ NOT_PRESENT_16BIT ) | |
723 { | |
724 mod_lac_cid->last_presented_lac = lac; | |
725 } | |
726 if( cid NEQ NOT_PRESENT_16BIT ) | |
727 { | |
728 mod_lac_cid->last_presented_cid = cid; | |
729 } | |
730 | |
731 } | |
732 | |
733 /* function sends notification to user about network registration status. | |
734 Functionnality centralised for either +CREG/+CGREG/%CGREG... */ | |
735 GLOBAL void r_plus_percent_CREG ( UBYTE srcId, | |
736 int status, | |
737 USHORT lac, | |
738 USHORT cid, | |
739 T_ACI_CREG_CMD cmd, | |
740 T_ACI_P_CREG_GPRS_IND gprs_ind, | |
741 BOOL bActiveContext ) | |
742 { | |
743 T_ATI_CREG_MOD mode; | |
744 T_ATI_REG_MOD_LAC_CID mod_lac_cid; | |
745 USHORT previous_lac, | |
746 previous_cid; | |
747 BOOL network_status_has_changed = FALSE; | |
748 BOOL cell_has_changed = FALSE; | |
749 CHAR loc_info[LOC_INFO_STRLTH] = ""; /* enough to get e.g. ",A1F4, F4D0" */ | |
750 CHAR gprs_info[GPRS_INFO_STRLTH] = ""; /* enough to get e.g. ", 2" */ | |
751 CHAR *ctxtInfo = ""; | |
752 T_ACI_NTW_STATUS raw_status; | |
753 CHAR cmd_key[KEY]; | |
754 USHORT presented_lac = NOT_PRESENT_16BIT, | |
755 presented_cid = NOT_PRESENT_16BIT; | |
756 | |
757 /* check whether cell has changed */ | |
758 network_status_has_changed = get_registration_data_among_cmd( srcId, | |
759 status, | |
760 &mod_lac_cid, | |
761 &raw_status, | |
762 cmd_key, | |
763 cmd ); | |
764 if( network_status_has_changed ) | |
765 { | |
766 TRACE_EVENT_P3("cmd: %d, source: %d, new network status: %d !", cmd, srcId, status); | |
767 } | |
768 | |
769 mode = mod_lac_cid.pres_mode; | |
770 previous_lac = mod_lac_cid.last_presented_lac; | |
771 previous_cid = mod_lac_cid.last_presented_cid; | |
772 | |
773 /* check whether cell has changed */ | |
774 if( ((lac NEQ NOT_PRESENT_16BIT) AND (lac NEQ previous_lac)) | |
775 OR | |
776 ((cid NEQ NOT_PRESENT_16BIT) AND (cid NEQ previous_cid)) ) | |
777 { | |
778 if(raw_status EQ STAT_Reg OR raw_status EQ STAT_Roam) | |
779 { | |
780 /* cell info is only relevant when registered or in roaming */ | |
781 TRACE_EVENT_P2("cell has changed !, lac: %04X, cId: %04X", lac, cid); | |
782 cell_has_changed = TRUE; | |
783 } | |
784 } | |
785 | |
786 /* comma always needed */ | |
787 if (cmd EQ PercentCREG_CMD OR | |
788 mode EQ CREG_MOD_LOC_INF_ON_CTXACT) | |
789 { | |
790 strcat(loc_info,",,"); | |
791 } | |
792 | |
793 /* check if presentation should occur */ | |
794 switch( mode ) | |
795 { | |
796 case(CREG_MOD_NotPresent): | |
797 case(CREG_MOD_OFF): | |
798 /* no presentation to user */ | |
799 return; | |
800 | |
801 case(CREG_MOD_ON): | |
802 if( !network_status_has_changed ) | |
803 { | |
804 return; | |
805 } | |
806 /* network status is available and has changed */ | |
807 break; | |
808 | |
809 case(CREG_MOD_LOC_INF_ON_CTXACT): | |
810 case(CREG_MOD_LOC_INF_ON): | |
811 if( (raw_status EQ STAT_Reg OR | |
812 raw_status EQ STAT_Roam) AND | |
813 | |
814 cell_has_changed ) | |
815 { | |
816 presented_lac = lac; | |
817 presented_cid = cid; | |
818 } | |
819 else if( (raw_status EQ STAT_Reg OR | |
820 raw_status EQ STAT_Roam) AND | |
821 | |
822 network_status_has_changed ) | |
823 { | |
824 /* show last presented lac/cid */ | |
825 presented_lac = mod_lac_cid.last_presented_lac; | |
826 presented_cid = mod_lac_cid.last_presented_cid; | |
827 } | |
828 else if( network_status_has_changed ) | |
829 { | |
830 /* mobile is not registered: do not show location information | |
831 parameters have already been initialized, so no need to set them */ | |
832 } | |
833 else | |
834 { | |
835 TRACE_EVENT_P3("%s presentation denied. mode: %d, network status: %d", cmd_key, mode, status); | |
836 return; | |
837 } | |
838 | |
839 if( presented_lac NEQ NOT_PRESENT_16BIT AND | |
840 presented_cid NEQ NOT_PRESENT_16BIT ) | |
841 { | |
842 sprintf(loc_info, ",\"%04X\",\"%04X\"", presented_lac, presented_cid); | |
843 } | |
844 else if (mode EQ CREG_MOD_LOC_INF_ON_CTXACT) | |
845 sprintf(loc_info, ",,"); | |
846 break; | |
847 } | |
848 | |
849 /* ACI-SPR-17218: attach gprs information for %CREG */ | |
850 if ( cmd EQ PercentCREG_CMD ) | |
851 { | |
852 sprintf(gprs_info, ",%01X", gprs_ind ); | |
853 } | |
854 | |
855 #ifdef GPRS | |
856 if ( (cmd EQ PercentCGREG_CMD) AND | |
857 (mode EQ CREG_MOD_LOC_INF_ON_CTXACT) ) | |
858 { | |
859 if( bActiveContext EQ TRUE ) | |
860 ctxtInfo = ",1"; | |
861 else | |
862 ctxtInfo = ",0"; | |
863 } | |
864 #endif /* GPRS */ | |
865 | |
866 sprintf(g_sa,"%s%d%s%s%s", cmd_key, status, loc_info, gprs_info, ctxtInfo ); | |
867 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
868 | |
869 update_last_presented_datas_among_cmd( srcId, | |
870 status, | |
871 presented_lac, | |
872 presented_cid, | |
873 cmd ); | |
874 } | |
875 | |
876 /* | |
877 +--------------------------------------------------------------------+ | |
878 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
879 | STATE : code ROUTINE : rCI_PlusCREG | | |
880 +--------------------------------------------------------------------+ | |
881 | |
882 PURPOSE : handles AT_PlusCREG call backs(change in network registration status) | |
883 | |
884 */ | |
885 | |
886 GLOBAL void rCI_PlusCREG ( T_ACI_CREG_STAT status, | |
887 USHORT lac, | |
888 USHORT cid ) | |
889 { | |
890 UBYTE srcId = srcId_cb; | |
891 | |
892 TRACE_FUNCTION("rCI_PlusCREG()"); | |
893 | |
894 r_plus_percent_CREG ( srcId, | |
895 status, | |
896 lac, | |
897 cid, | |
898 CREG_CMD, | |
899 P_CREG_GPRS_Support_Unknown, /*ACI-SPR-17218: ignored*/ | |
900 FALSE ); | |
901 } | |
902 | |
903 /* | |
904 +--------------------------------------------------------------------+ | |
905 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
906 | STATE : code ROUTINE : rCI_PercentCREG | | |
907 +--------------------------------------------------------------------+ | |
908 | |
909 PURPOSE : handles AT_PercentCREG call backs(change in network registration status) | |
910 | |
911 */ | |
912 | |
913 GLOBAL void rCI_PercentCREG ( T_ACI_CREG_STAT status, | |
914 USHORT lac, | |
915 USHORT cid, | |
916 T_ACI_P_CREG_GPRS_IND gprs_ind) | |
917 { | |
918 UBYTE srcId = srcId_cb; | |
919 | |
920 TRACE_FUNCTION("rCI_PercentCREG()"); | |
921 | |
922 r_plus_percent_CREG ( srcId, | |
923 status, | |
924 lac, | |
925 cid, | |
926 PercentCREG_CMD, /*ACI-SPR-17218: introduced for %CREG*/ | |
927 gprs_ind, | |
928 FALSE ); | |
929 } | |
930 | |
931 | |
932 | |
933 /* | |
934 +--------------------------------------------------------------------+ | |
935 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
936 | STATE : code ROUTINE : rCI_PlusCRING | | |
937 +--------------------------------------------------------------------+ | |
938 | |
939 PURPOSE : handles AT_PlusCRING call back | |
940 | |
941 */ | |
942 /* should be called when ringing indications should stop */ | |
943 GLOBAL void ati_stop_ring(void) | |
944 { | |
945 TRACE_FUNCTION("ati_stop_ring()"); | |
946 | |
947 at.rngPrms.rngCnt = 1; | |
948 at.rngPrms.isRng = FALSE; | |
949 at.S[1] = 0; /* S1 register will hold the ring counts */ | |
950 | |
951 /* Reset the CLIP parameters to default values */ | |
952 at.clipPrms.stat = CLIP_STAT_NotPresent; | |
953 memset( at.clipPrms.number, 0, sizeof(at.clipPrms.number)); | |
954 memset(&at.clipPrms.type, 0, sizeof(T_ACI_TOA)); | |
955 at.clipPrms.validity = PRES_NOT_PRES; | |
956 memset( at.clipPrms.subaddr, 0, sizeof(at.clipPrms.subaddr)); | |
957 memset(&at.clipPrms.satype, 0, sizeof(T_ACI_TOS)); | |
958 #ifdef NO_ASCIIZ | |
959 memset(&at.clipPrms.alpha, 0, sizeof(T_ACI_PB_TEXT)); | |
960 #else | |
961 memset(at.clipPrms.alpha, 0, sizeof(at.clipPrms.alpha)); | |
962 #endif | |
963 | |
964 TIMERSTOP( ACI_TRING ); | |
965 } | |
966 | |
967 GLOBAL void rCI_PlusCRING ( /*UBYTE srcId,*/ | |
968 T_ACI_CRING_MOD mode, | |
969 T_ACI_CRING_TYP type1, | |
970 T_ACI_CRING_TYP type2 ) | |
971 { | |
972 static T_ACI_CMD_SRC first_ringing_srcId = CMD_SRC_NONE; /* Source which will handle the ringing-timer */ | |
973 UBYTE srcId = srcId_cb, | |
974 autoAnswerSrcId = at.rngPrms.srcID_S0; | |
975 | |
976 T_ACI_AT_CMD autoanswer_command; | |
977 T_ACI_RETURN ret; | |
978 int DTR=0; | |
979 UBYTE DTR_behaviour = DTR_BEHAVIOUR_Ignore; | |
980 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
981 | |
982 TRACE_FUNCTION("rCI_PlusCRING()"); | |
983 | |
984 if (first_ringing_srcId EQ CMD_SRC_NONE) | |
985 first_ringing_srcId = srcId; /* catch the first source id for setting up the ring timer */ | |
986 | |
987 /* save ringing parameter at the first call to rCI_PlusCRING */ | |
988 if( !at.rngPrms.isRng AND | |
989 at.rngPrms.rngCnt EQ 1 AND /* this is only done on the first ring, not on any subsequent*/ | |
990 srcId EQ first_ringing_srcId) /* only first source will reach the setting of "at.rngPrms.isRng = TRUE" */ | |
991 { | |
992 at.rngPrms.mode = mode; | |
993 at.rngPrms.type1 = type1; | |
994 at.rngPrms.type2 = type2; | |
995 at.rngPrms.isRng = TRUE; | |
996 } | |
997 | |
998 if (!at.rngPrms.isRng) | |
999 { | |
1000 return; /* dont emmit any "RING" but escape here if ringing has been stopped | |
1001 in a multi-source configuration on any source in rhe RAT_CRING loop */ | |
1002 } | |
1003 | |
1004 at.S[1] = at.rngPrms.rngCnt; /* S1 register will return the ring counts */ | |
1005 | |
1006 /* check for automatic reject of an network initiated context activation */ | |
1007 #if defined (GPRS) AND defined (DTI) | |
1008 if( at.rngPrms.mode EQ CRING_MOD_Gprs AND | |
1009 first_ringing_srcId EQ srcId AND /* it is sufficent to check this only for one ringing source */ | |
1010 cmhSM_call_reject(at.rngPrms.rngCnt, mode) ) | |
1011 { | |
1012 TRACE_EVENT_P2("PDP context is to be automatically rejected: RING count: %d, srcId %d", at.rngPrms.rngCnt, srcId_cb); | |
1013 | |
1014 ati_stop_ring(); | |
1015 | |
1016 ret=sAT_PlusCGANS(srcId, 0, NULL, GPRS_CID_OMITTED); | |
1017 if( ret EQ AT_CMPL ) | |
1018 return; | |
1019 | |
1020 TRACE_EVENT_P1("auto reject return error: %d", ret); | |
1021 cmdAtError(atError); | |
1022 return; | |
1023 } | |
1024 #endif | |
1025 | |
1026 #ifdef UART | |
1027 if (src_params->src_type EQ ATI_SRC_TYPE_UART) | |
1028 { | |
1029 T_ACI_DTI_PRC *uart_infos; | |
1030 | |
1031 uart_infos = find_element (uart_src_params, | |
1032 (UBYTE)srcId, | |
1033 cmhUARTtest_srcId); | |
1034 | |
1035 if (BITFIELD_CHECK (uart_infos->data_cntr, UART_DTI_SA_BIT)) | |
1036 DTR=1; | |
1037 } | |
1038 #endif | |
1039 #if defined (FF_PSI) AND defined (DTI) | |
1040 if (src_params->src_type EQ ATI_SRC_TYPE_PSI) | |
1041 { | |
1042 T_ACI_DTI_PRC_PSI *psi_infos; | |
1043 | |
1044 psi_infos = find_element (psi_src_params, | |
1045 (UBYTE)srcId, | |
1046 cmhPSItest_srcId); | |
1047 | |
1048 if (BITFIELD_CHECK (psi_infos->data_cntr, PSI_DTI_SA_BIT)) | |
1049 DTR=1; | |
1050 } | |
1051 #endif | |
1052 | |
1053 qAT_AndD ( srcId, &DTR_behaviour); | |
1054 | |
1055 if(DTR EQ 0 AND | |
1056 DTR_behaviour EQ DTR_BEHAVIOUR_ClearCall) | |
1057 { | |
1058 /* V.250 6.2.9 Circuit 108 (Data terminal ready) behaviour: | |
1059 Automatic answer is disabled while circuit 108/2 remains off. */ | |
1060 ; | |
1061 /* Also don't emit any RING while 108/2 remains off */ | |
1062 } | |
1063 else | |
1064 { | |
1065 if (at.rngPrms.rngCnt EQ 1 OR | |
1066 !check_should_buffer_ind(src_params)) /* Ring indications are not buffered, except of the first one */ | |
1067 { | |
1068 if(ati_user_output_cfg[srcId].CRC_stat) | |
1069 { | |
1070 switch(mode) | |
1071 { | |
1072 case CRING_MOD_Direct: | |
1073 sprintf(g_sa,"+CRING: %s",ring_stat(at.rngPrms.type1)); | |
1074 break; | |
1075 case CRING_MOD_Alternate: | |
1076 sprintf(g_sa,"+CRING: %s/%s",ring_stat(at.rngPrms.type1),ring_stat(at.rngPrms.type2)); | |
1077 break; | |
1078 #if defined (GPRS) AND defined (DTI) | |
1079 case CRING_MOD_Gprs: | |
1080 sprintf(g_sa,"+CRING: %s", cmhSM_ring_gprs_par()); | |
1081 break; | |
1082 #endif /* GPRS && DTI */ | |
1083 } | |
1084 } | |
1085 else | |
1086 { | |
1087 strcpy(g_sa, cmdAtError(atRing)); | |
1088 cmdErrStr = NULL; | |
1089 } | |
1090 | |
1091 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1092 } | |
1093 | |
1094 /* check for automatic answer */ | |
1095 #ifdef GPRS | |
1096 if( at.rngPrms.mode EQ CRING_MOD_Gprs ) | |
1097 { | |
1098 autoAnswerSrcId = at.rngPrms.srcID_CGAUTO NEQ CMD_SRC_NONE ? | |
1099 at.rngPrms.srcID_CGAUTO : at.rngPrms.srcID_S0; | |
1100 } | |
1101 #endif | |
1102 | |
1103 if( srcId EQ autoAnswerSrcId AND /* Caution !!! */ | |
1104 at.rngPrms.type1 NEQ CRING_TYP_Fax AND /* Never auto answer FAX calls !!! */ | |
1105 at.rngPrms.type1 NEQ CRING_TYP_AuxVoice AND /* Instead continue ringing! */ | |
1106 #if defined (GPRS) AND defined (DTI) | |
1107 cmhSM_call_answer(at.rngPrms.rngCnt, at.rngPrms.mode) EQ TRUE | |
1108 #else /* GPRS */ | |
1109 (at.S[0] AND at.rngPrms.rngCnt >= at.S[0]) | |
1110 #endif /* GPRS */ | |
1111 ) | |
1112 { | |
1113 TRACE_EVENT_P2("Call is to be automatically answered: RING count: %d, srcId %d", at.rngPrms.rngCnt, srcId_cb); | |
1114 | |
1115 ati_stop_ring(); | |
1116 | |
1117 #if defined (GPRS) AND defined (DTI) | |
1118 if ( at.rngPrms.mode EQ CRING_MOD_Gprs ) | |
1119 { | |
1120 ret = sAT_PlusCGANS(autoAnswerSrcId, 1, "PPP", INVALID_CID); | |
1121 autoanswer_command = AT_CMD_CGANS; | |
1122 } | |
1123 else | |
1124 #endif | |
1125 { | |
1126 ret = sAT_A(autoAnswerSrcId); | |
1127 autoanswer_command = AT_CMD_A; | |
1128 } | |
1129 | |
1130 if( ret EQ AT_EXCT ) | |
1131 { | |
1132 src_params->curAtCmd = autoanswer_command; | |
1133 return; | |
1134 } | |
1135 | |
1136 TRACE_EVENT_P1("auto answer return error: %d", ret); | |
1137 cmdAtError(atError); | |
1138 return; | |
1139 } | |
1140 } | |
1141 | |
1142 if( first_ringing_srcId EQ srcId AND /* only the first source will start the ringing timer */ | |
1143 at.rngPrms.isRng AND /* ringing is still valid? */ | |
1144 at.rngPrms.rngCnt EQ 1 ) /* since Timer is self-retriggering */ | |
1145 { | |
1146 TRACE_EVENT_P1("start RING timer on Source: %d", srcId); | |
1147 PTIMERSTART( TRING_VALUE, TRING_VALUE, ACI_TRING ); | |
1148 } | |
1149 } | |
1150 | |
1151 /* | |
1152 +--------------------------------------------------------------------+ | |
1153 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1154 | STATE : code ROUTINE : rCI_PlusCRING_OFF | | |
1155 +--------------------------------------------------------------------+ | |
1156 | |
1157 PURPOSE : handles AT_PlusCRING off call back | |
1158 | |
1159 */ | |
1160 | |
1161 GLOBAL void rCI_PlusCRING_OFF ( /*UBYTE srcId,*/ SHORT cId ) | |
1162 { | |
1163 UBYTE srcId = srcId_cb; | |
1164 | |
1165 TRACE_FUNCTION("rCI_PlusCRING_OFF()"); | |
1166 | |
1167 if( at.rngPrms.isRng ) | |
1168 { | |
1169 ati_stop_ring(); | |
1170 } | |
1171 } | |
1172 | |
1173 /* | |
1174 +--------------------------------------------------------------------+ | |
1175 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1176 | STATE : code ROUTINE : rCI_PercentSIMREM | | |
1177 +--------------------------------------------------------------------+ | |
1178 | |
1179 PURPOSE : handles AT_PercentSIMREM call back | |
1180 | |
1181 */ | |
1182 | |
1183 GLOBAL void rCI_PercentSIMREM ( /*UBYTE srcId,*/ T_ACI_SIMREM_TYPE srType ) | |
1184 { | |
1185 UBYTE srcId = srcId_cb; | |
1186 | |
1187 TRACE_FUNCTION("rCI_PercentSIMREM()"); | |
1188 | |
1189 if (ati_user_output_cfg[srcId].SIMIND_stat) | |
1190 { | |
1191 sprintf (g_sa, "%s%d", "%SIMREM: ", srType); | |
1192 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1193 } | |
1194 } | |
1195 | |
1196 /* | |
1197 +--------------------------------------------------------------------+ | |
1198 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1199 | STATE : code ROUTINE : rCI_PercentSIMINS | | |
1200 +--------------------------------------------------------------------+ | |
1201 | |
1202 PURPOSE : handles AT_PercentSIMINS call back | |
1203 | |
1204 */ | |
1205 | |
1206 GLOBAL void rCI_PercentSIMINS ( /*UBYTE srcId,*/ T_ACI_CME_ERR err ) | |
1207 { | |
1208 UBYTE srcId = srcId_cb; | |
1209 | |
1210 TRACE_FUNCTION("rCI_PercentSIMINS()"); | |
1211 | |
1212 if (ati_user_output_cfg[srcId].SIMIND_stat) | |
1213 { | |
1214 sprintf (g_sa, "%s%d", "%SIMINS: ", err); | |
1215 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1216 } | |
1217 } | |
1218 | |
1219 | |
1220 /* | |
1221 +--------------------------------------------------------------------+ | |
1222 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1223 | STATE : code ROUTINE : rCI_PercentKSIR | | |
1224 +--------------------------------------------------------------------+ | |
1225 | |
1226 PURPOSE : handles PercentKSIR call back. | |
1227 Code is in aci_util.c to share the code with BAT | |
1228 */ | |
1229 GLOBAL void rCI_PercentKSIR ( /*UBYTE srcId,*/ T_ACI_KSIR * ksStat ) | |
1230 { | |
1231 TRACE_FUNCTION("rCI_PercentKSIR()"); | |
1232 | |
1233 utl_cb_percentKSIR (srcId_cb, ksStat); | |
1234 } | |
1235 | |
1236 /* | |
1237 +--------------------------------------------------------------------+ | |
1238 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1239 | STATE : code ROUTINE : rCI_PlusCLIR | | |
1240 +--------------------------------------------------------------------+ | |
1241 | |
1242 PURPOSE : handles AT_PlusCLIR call back | |
1243 | |
1244 */ | |
1245 | |
1246 GLOBAL void rCI_PlusCLIR ( /*UBYTE srcId,*/ | |
1247 T_ACI_CLIR_MOD mode, | |
1248 T_ACI_CLIR_STAT stat) | |
1249 { | |
1250 UBYTE srcId = srcId_cb; | |
1251 | |
1252 sprintf(g_sa,"+CLIR: %d,%d",mode,stat); | |
1253 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1254 } | |
1255 | |
1256 | |
1257 | |
1258 /* | |
1259 +--------------------------------------------------------------------+ | |
1260 | PROJECT : ACI/MMI MODULE : ACI_RET | | |
1261 | STATE : code ROUTINE : rCI_PercentCSQ | | |
1262 +--------------------------------------------------------------------+ | |
1263 | |
1264 PURPOSE : handles AT_PercentCSQ call back | |
1265 | |
1266 Shen,Chao | |
1267 | |
1268 */ | |
1269 | |
1270 GLOBAL void rCI_PercentCSQ(UBYTE rssi, UBYTE ber, UBYTE actlevel) | |
1271 { | |
1272 UBYTE srcId = srcId_cb; | |
1273 | |
1274 TRACE_FUNCTION("rCI_PercentCSQ()"); | |
1275 | |
1276 | |
1277 sprintf (g_sa, "%s %d, %d, %d", "%CSQ: ",rssi, ber, actlevel); | |
1278 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
1279 | |
1280 } | |
1281 | |
1282 | |
1283 /* | |
1284 +--------------------------------------------------------------------+ | |
1285 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1286 | STATE : code ROUTINE : rCI_PlusClip | | |
1287 +--------------------------------------------------------------------+ | |
1288 | |
1289 PURPOSE : handles AT_PlusCLIP call back | |
1290 | |
1291 */ | |
1292 #ifdef NO_ASCIIZ | |
1293 GLOBAL void rCI_PlusCLIP ( /*UBYTE srcId,*/ | |
1294 T_ACI_CLIP_STAT stat, | |
1295 CHAR * number, | |
1296 T_ACI_TOA * type, | |
1297 U8 validity, | |
1298 CHAR * subaddr, | |
1299 T_ACI_TOS * satype, | |
1300 T_ACI_PB_TEXT * alpha) | |
1301 #else /* ifdef NO_ASCIIZ */ | |
1302 GLOBAL void rCI_PlusCLIP ( /*UBYTE srcId, */ | |
1303 T_ACI_CLIP_STAT stat, | |
1304 CHAR* number, | |
1305 T_ACI_TOA* type, | |
1306 U8 validity, | |
1307 CHAR* subaddr, | |
1308 T_ACI_TOS* satype, | |
1309 CHAR* alpha) | |
1310 #endif /* ifdef NO_ASCIIZ */ | |
1311 { | |
1312 char* me = "+CLIP: "; | |
1313 SHORT pos = 0; | |
1314 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
1315 USHORT lenCvtdAlpha; | |
1316 UBYTE *uniAlpha = NULL; | |
1317 UBYTE uniAlphaLen = 0; | |
1318 UBYTE srcId = srcId_cb; | |
1319 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1320 | |
1321 | |
1322 TRACE_FUNCTION("rCI_PLusCLIP()"); | |
1323 | |
1324 /* save CLIP parameter */ | |
1325 | |
1326 at.clipPrms.stat = stat; | |
1327 if ( number ) | |
1328 memcpy(at.clipPrms.number, number, strlen(number)); | |
1329 if ( type ) | |
1330 memcpy(&at.clipPrms.type, type, sizeof(T_ACI_TOA)); | |
1331 at.clipPrms.validity = validity; | |
1332 if ( subaddr ) | |
1333 memcpy(at.clipPrms.subaddr, subaddr, strlen(subaddr)); | |
1334 if ( satype ) | |
1335 memcpy(&at.clipPrms.satype, satype, sizeof(T_ACI_TOS)); | |
1336 #ifdef NO_ASCIIZ | |
1337 if ( alpha ) | |
1338 memcpy(&at.clipPrms.alpha, alpha, sizeof(T_ACI_PB_TEXT)); | |
1339 #else | |
1340 if ( alpha ) | |
1341 memcpy(at.clipPrms.alpha, alpha, strlen(alpha)); | |
1342 #endif | |
1343 | |
1344 #ifdef NO_ASCIIZ | |
1345 if ( alpha NEQ NULL ) | |
1346 { | |
1347 uniAlpha = alpha->data; | |
1348 uniAlphaLen = alpha->len; | |
1349 } | |
1350 #else /* ifdef NO_ASCIIZ */ | |
1351 if ( alpha NEQ NULL ) | |
1352 { | |
1353 uniAlpha = (UBYTE *)alpha; | |
1354 uniAlphaLen = strlen(alpha); | |
1355 } | |
1356 #endif /* ifdef NO_ASCIIZ */ | |
1357 | |
1358 pos = sprintf(g_sa,"%s",me); | |
1359 | |
1360 if ( stat EQ CLIP_STAT_NotPresent ) /*Function call when connection is made*/ | |
1361 { | |
1362 if ( ati_user_output_cfg[srcId].CLIP_stat | |
1363 /* AND | |
1364 ( | |
1365 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
1366 io_getIoMode ( ) EQ IO_MODE_RUN | |
1367 )*/ | |
1368 ) | |
1369 { | |
1370 if (number) | |
1371 { | |
1372 pos += sprintf(g_sa+pos,"\"%s\",",number); | |
1373 if (type) | |
1374 pos += sprintf(g_sa+pos,"%d,",toa_merge(*type)); | |
1375 else | |
1376 pos += sprintf(g_sa+pos,","); | |
1377 } | |
1378 else | |
1379 pos += sprintf(g_sa+pos,"\"\",128,"); | |
1380 if (subaddr) | |
1381 { | |
1382 pos += sprintf(g_sa+pos,"\"%s\",",subaddr); | |
1383 if (satype) | |
1384 pos += sprintf(g_sa+pos,"%d,",tos_merge(*satype)); | |
1385 else | |
1386 pos += sprintf(g_sa+pos,","); | |
1387 } | |
1388 else if (alpha) | |
1389 pos += sprintf(g_sa+pos,"\"\",,"); | |
1390 else if (validity NEQ PRES_NOT_PRES) | |
1391 pos += sprintf(g_sa+pos,","); | |
1392 | |
1393 if (alpha) | |
1394 { | |
1395 utl_chsetFromSim ( uniAlpha, | |
1396 uniAlphaLen, | |
1397 (UBYTE*)cvtdAlpha, | |
1398 sizeof(cvtdAlpha), | |
1399 &lenCvtdAlpha, | |
1400 GSM_ALPHA_Def ); | |
1401 pos+=sprints(g_sa+pos,cvtdAlpha,lenCvtdAlpha); | |
1402 } | |
1403 else if (validity NEQ PRES_NOT_PRES) | |
1404 pos += sprintf(g_sa+pos,","); | |
1405 | |
1406 if (validity NEQ PRES_NOT_PRES) | |
1407 pos += sprintf(g_sa+pos,",%d",validity); | |
1408 | |
1409 ci_remTrailCom(g_sa, pos); | |
1410 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1411 } | |
1412 } | |
1413 else /* Answer for qA_PlusCLIP*/ | |
1414 { | |
1415 src_params->curAtCmd = AT_CMD_NONE; | |
1416 | |
1417 sprintf(g_sa+pos,"%d,%d",ati_user_output_cfg[srcId].CLIP_stat,stat); | |
1418 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1419 } | |
1420 } | |
1421 | |
1422 /* | |
1423 +--------------------------------------------------------------------+ | |
1424 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1425 | STATE : code ROUTINE : rCI_PlusCdip | | |
1426 +--------------------------------------------------------------------+ | |
1427 | |
1428 PURPOSE : handles AT_PlusCDIP call back | |
1429 | |
1430 */ | |
1431 GLOBAL void rCI_PlusCDIP (CHAR * number, | |
1432 T_ACI_TOA * type, | |
1433 CHAR * subaddr, | |
1434 T_ACI_TOS * satype) | |
1435 { | |
1436 char* me = "+CDIP: "; | |
1437 SHORT pos = 0; | |
1438 UBYTE srcId = srcId_cb; | |
1439 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1440 | |
1441 | |
1442 TRACE_FUNCTION("rCI_PlusCDIP()"); | |
1443 | |
1444 pos = sprintf(g_sa,"%s",me); | |
1445 | |
1446 if ( ati_user_output_cfg[srcId].CDIP_stat) | |
1447 { | |
1448 if (number) | |
1449 { | |
1450 pos += sprintf(g_sa+pos,"\"%s\",",number); | |
1451 if (type) | |
1452 { | |
1453 pos += sprintf(g_sa+pos,"%d,",toa_merge(*type)); | |
1454 | |
1455 if (subaddr) /* Only check to display subaddr if Number and Type are present */ | |
1456 { | |
1457 pos += sprintf(g_sa+pos,"\"%s\",",subaddr); | |
1458 if (satype) | |
1459 pos += sprintf(g_sa+pos,"%d",tos_merge(*satype)); | |
1460 } | |
1461 } | |
1462 else /* No Number Type present */ | |
1463 { | |
1464 pos += sprintf(g_sa+pos,","); | |
1465 } | |
1466 } | |
1467 else /* No Number present */ | |
1468 { | |
1469 pos += sprintf(g_sa+pos,"\"\",128,"); | |
1470 } | |
1471 | |
1472 ci_remTrailCom(g_sa, pos); | |
1473 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1474 } | |
1475 } | |
1476 | |
1477 /* | |
1478 +--------------------------------------------------------------------+ | |
1479 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1480 | STATE : code ROUTINE : rCI_PlusCOLP | | |
1481 +--------------------------------------------------------------------+ | |
1482 | |
1483 PURPOSE : handles AT_PlusCOLP call back | |
1484 | |
1485 */ | |
1486 #ifdef NO_ASCIIZ | |
1487 GLOBAL void rCI_PlusCOLP ( /*UBYTE srcId,*/ | |
1488 T_ACI_COLP_STAT stat, | |
1489 CHAR *number, | |
1490 T_ACI_TOA *type, | |
1491 CHAR *subaddr, | |
1492 T_ACI_TOS *satype, | |
1493 T_ACI_PB_TEXT *alpha) | |
1494 #else /* ifdef NO_ASCIIZ */ | |
1495 GLOBAL void rCI_PlusCOLP ( /*UBYTE srcId, */ | |
1496 T_ACI_COLP_STAT stat, | |
1497 CHAR *number, | |
1498 T_ACI_TOA *type, | |
1499 CHAR *subaddr, | |
1500 T_ACI_TOS *satype, | |
1501 CHAR *alpha) | |
1502 #endif /* ifdef NO_ASCIIZ */ | |
1503 { | |
1504 char* me = "+COLP: "; | |
1505 int pos = 0; | |
1506 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
1507 USHORT lenCvtdAlpha; | |
1508 UBYTE *uniAlpha = NULL; | |
1509 UBYTE uniAlphaLen = 0; | |
1510 UBYTE srcId = srcId_cb; | |
1511 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1512 | |
1513 | |
1514 TRACE_FUNCTION("rCI_PLusCOLP()"); | |
1515 | |
1516 #ifdef NO_ASCIIZ | |
1517 if ( alpha NEQ NULL ) | |
1518 { | |
1519 uniAlpha = alpha->data; | |
1520 uniAlphaLen = alpha->len; | |
1521 } | |
1522 #else /* ifdef NO_ASCIIZ */ | |
1523 if ( alpha NEQ NULL ) | |
1524 { | |
1525 uniAlpha = (UBYTE *)alpha; | |
1526 uniAlphaLen = strlen(alpha); | |
1527 } | |
1528 #endif /* ifdef NO_ASCIIZ */ | |
1529 | |
1530 pos = sprintf(g_sa,"%s",me); | |
1531 if (stat==COLP_STAT_NotPresent) /* Function call if connection is made*/ | |
1532 { | |
1533 if ( at.flags.COLP_stat | |
1534 /* AND | |
1535 ( | |
1536 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
1537 io_getIoMode ( ) EQ IO_MODE_RUN | |
1538 ) */ | |
1539 ) | |
1540 { | |
1541 if (number) | |
1542 { | |
1543 pos += sprintf(g_sa+pos,"\"%s\",",number); | |
1544 if (type) | |
1545 pos += sprintf(g_sa+pos,"%d,",toa_merge(*type)); | |
1546 else | |
1547 pos += sprintf(g_sa+pos,"128,"); | |
1548 } | |
1549 else | |
1550 pos += sprintf(g_sa+pos,"\"\",128,"); | |
1551 | |
1552 if (subaddr) | |
1553 { | |
1554 pos += sprintf(g_sa+pos,"\"%s\",",subaddr); | |
1555 if (satype) | |
1556 pos += sprintf(g_sa+pos,"%d,",tos_merge(*satype)); | |
1557 else pos += sprintf(g_sa+pos,","); | |
1558 } | |
1559 else | |
1560 pos += sprintf(g_sa+pos,",,"); | |
1561 | |
1562 if (alpha) | |
1563 { | |
1564 utl_chsetFromSim ( uniAlpha, | |
1565 uniAlphaLen, | |
1566 (UBYTE*)cvtdAlpha, | |
1567 sizeof(cvtdAlpha), | |
1568 &lenCvtdAlpha, | |
1569 GSM_ALPHA_Def ); | |
1570 pos+=sprints(g_sa+pos,cvtdAlpha,lenCvtdAlpha); | |
1571 } | |
1572 | |
1573 ci_remTrailCom(g_sa,(USHORT)pos); | |
1574 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1575 } | |
1576 } | |
1577 else /* Answer for qAT_PlusCOLP*/ | |
1578 { | |
1579 src_params->curAtCmd = AT_CMD_NONE; | |
1580 | |
1581 if (at.flags.COLP_stat) | |
1582 sprintf(g_sa+pos,"1,%d",stat); | |
1583 else | |
1584 sprintf(g_sa+pos,"0,%d",stat); | |
1585 | |
1586 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
1587 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1588 } | |
1589 } | |
1590 | |
1591 /* | |
1592 +--------------------------------------------------------------------+ | |
1593 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1594 | STATE : code ROUTINE : rCI_PercentCOLR | | |
1595 +--------------------------------------------------------------------+ | |
1596 | |
1597 PURPOSE : handles AT_PercentCOLR call back | |
1598 | |
1599 */ | |
1600 | |
1601 GLOBAL void rCI_PercentCOLR ( /*UBYTE srcId,*/ T_ACI_COLR_STAT stat) | |
1602 { | |
1603 UBYTE srcId = srcId_cb; | |
1604 | |
1605 TRACE_FUNCTION("rCI_PercentCOLR()"); | |
1606 | |
1607 sprintf(g_sa, "%s: %d", "%COLR", stat); | |
1608 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1609 } | |
1610 | |
1611 /* | |
1612 +--------------------------------------------------------------------+ | |
1613 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1614 | STATE : code ROUTINE : rCI_DR | | |
1615 +--------------------------------------------------------------------+ | |
1616 | |
1617 PURPOSE : handles AT_DR call back | |
1618 | |
1619 */ | |
1620 | |
1621 GLOBAL void rCI_PlusDR ( /*UBYTE srcId,*/ T_ACI_DR_TYP type ) | |
1622 { | |
1623 UBYTE srcId = srcId_cb; | |
1624 | |
1625 | |
1626 TRACE_FUNCTION("rCI_PLusDR()"); | |
1627 | |
1628 if ( ati_user_output_cfg[srcId].DR_stat | |
1629 /* AND | |
1630 ( | |
1631 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
1632 io_getIoMode ( ) EQ IO_MODE_RUN | |
1633 )*/ | |
1634 ) | |
1635 { | |
1636 sprintf(g_sa,"+DR: %d",type); | |
1637 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1638 } | |
1639 } | |
1640 | |
1641 /* | |
1642 +--------------------------------------------------------------------+ | |
1643 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1644 | STATE : code ROUTINE : rCI_CR | | |
1645 +--------------------------------------------------------------------+ | |
1646 | |
1647 PURPOSE : handles AT_CR call back | |
1648 | |
1649 */ | |
1650 | |
1651 GLOBAL void rCI_PlusCR ( /*UBYTE srcId,*/ T_ACI_CR_SERV service ) | |
1652 { | |
1653 UBYTE srcId = srcId_cb; | |
1654 | |
1655 | |
1656 TRACE_FUNCTION("rCI_PLusCR()"); | |
1657 | |
1658 | |
1659 if ( ati_user_output_cfg[srcId].CR_stat | |
1660 /* AND | |
1661 ( | |
1662 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
1663 io_getIoMode ( ) EQ IO_MODE_RUN | |
1664 ) */ | |
1665 ) | |
1666 { | |
1667 sprintf(g_sa,"+CR: %s",ring_stat(service)); | |
1668 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1669 } | |
1670 } | |
1671 | |
1672 | |
1673 /* | |
1674 +--------------------------------------------------------------------+ | |
1675 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1676 | STATE : code ROUTINE : rCI_PlusCOPS | | |
1677 +--------------------------------------------------------------------+ | |
1678 | |
1679 PURPOSE : handles AT_PlusCOPS call back | |
1680 | |
1681 */ | |
1682 GLOBAL void rCI_PlusCOPS(/*UBYTE srcId, */ | |
1683 SHORT lastIdx, | |
1684 T_ACI_COPS_OPDESC * operLst) | |
1685 { | |
1686 TRACE_FUNCTION("rCI_PLusCOPS()"); | |
1687 | |
1688 r_Plus_Percent_COPS(AT_CMD_COPS, lastIdx, operLst); | |
1689 | |
1690 } | |
1691 | |
1692 /* | |
1693 +--------------------------------------------------------------------+ | |
1694 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1695 | STATE : code ROUTINE : rCI_PlusCOPS | | |
1696 +--------------------------------------------------------------------+ | |
1697 | |
1698 PURPOSE : handles AT_PecentCOPS call back | |
1699 | |
1700 */ | |
1701 GLOBAL void rCI_PercentCOPS(/*UBYTE srcId, */ | |
1702 SHORT lastIdx, | |
1703 T_ACI_COPS_OPDESC * operLst) | |
1704 { | |
1705 TRACE_FUNCTION("rCI_PercentCOPS()"); | |
1706 | |
1707 r_Plus_Percent_COPS(AT_CMD_P_COPS, lastIdx, operLst); | |
1708 | |
1709 } | |
1710 | |
1711 | |
1712 /* | |
1713 +--------------------------------------------------------------------+ | |
1714 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1715 | STATE : code ROUTINE : rCI_Plus_Percent_COPS | | |
1716 +--------------------------------------------------------------------+ | |
1717 | |
1718 PURPOSE : common functioality for rCI_PlusCOPS and rCI_PercentCOPS | |
1719 | |
1720 */ | |
1721 LOCAL void r_Plus_Percent_COPS ( T_ACI_AT_CMD cmd, | |
1722 SHORT lastIdx, | |
1723 T_ACI_COPS_OPDESC * operLst) | |
1724 { | |
1725 char *format; | |
1726 USHORT i; | |
1727 BOOL END_OF_LIST = FALSE; | |
1728 T_ACI_RETURN ret; | |
1729 SHORT startIdx=0; | |
1730 int pos=0; | |
1731 UBYTE srcId = srcId_cb; | |
1732 | |
1733 char longName[MAX_ALPHA_OPER_LEN] = { '\0' }; | |
1734 char shrtName[MAX_ALPHA_OPER_LEN] = { '\0' }; | |
1735 | |
1736 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1737 | |
1738 TRACE_FUNCTION("r_Plus_Percent_COPS()"); | |
1739 | |
1740 | |
1741 | |
1742 if (lastIdx < 0) /* no operLst available */ | |
1743 { | |
1744 TRACE_EVENT("No operator list available"); | |
1745 return; | |
1746 } | |
1747 | |
1748 if (lastIdx < MAX_OPER) | |
1749 { | |
1750 if(cmd EQ AT_CMD_P_COPS) | |
1751 { | |
1752 pos=sprintf(g_sa,"%s","%COPS: "); | |
1753 } | |
1754 else | |
1755 { | |
1756 pos=sprintf(g_sa,"%s","+COPS: "); | |
1757 } | |
1758 | |
1759 } | |
1760 | |
1761 src_params->curAtCmd = AT_CMD_NONE; | |
1762 | |
1763 for(i=0; i < MAX_OPER; i++) | |
1764 { | |
1765 if (operLst[i].status < 0) | |
1766 { | |
1767 END_OF_LIST = TRUE; | |
1768 break; | |
1769 } | |
1770 | |
1771 format = ",(%d,\"%s\",\"%s\",\"%s\")"; | |
1772 if (i EQ 0) | |
1773 format++; /* the first recond begins without a comma */ | |
1774 | |
1775 if (operLst[i].pnn) | |
1776 { | |
1777 if (operLst[i].long_len) | |
1778 { | |
1779 switch (operLst[i].long_ext_dcs>>4 & 0x07) | |
1780 { | |
1781 case 0x00: /* GSM default alphabet */ | |
1782 utl_cvtPnn7To8((UBYTE *)operLst[i].longOper, | |
1783 operLst[i].long_len, | |
1784 operLst[i].long_ext_dcs, | |
1785 (UBYTE *)longName); | |
1786 break; | |
1787 case 0x01: /* UCS2 */ | |
1788 TRACE_ERROR ("Unhandled UCS2 in PNN entry"); | |
1789 break; | |
1790 default: | |
1791 TRACE_ERROR ("Unknown DCS in PNN entry"); | |
1792 break; | |
1793 } | |
1794 } | |
1795 if (operLst[i].shrt_len) | |
1796 { | |
1797 switch (operLst[i].shrt_ext_dcs>>4 & 0x07) | |
1798 { | |
1799 case 0x00: /* GSM default alphabet */ | |
1800 utl_cvtPnn7To8((UBYTE *)operLst[i].shortOper, | |
1801 operLst[i].shrt_len, | |
1802 operLst[i].shrt_ext_dcs, | |
1803 (UBYTE *)shrtName); | |
1804 break; | |
1805 case 0x01: /* UCS2 */ | |
1806 TRACE_ERROR ("ERROR: Unhandled UCS2"); | |
1807 break; | |
1808 default: | |
1809 TRACE_ERROR ("ERROR: Unknown DCS"); | |
1810 break; | |
1811 } | |
1812 } | |
1813 pos+=sprintf(g_sa+pos, format, operLst[i].status, longName, shrtName, operLst[i].numOper); | |
1814 } | |
1815 else | |
1816 { | |
1817 pos+=sprintf(g_sa+pos, format, operLst[i].status, operLst[i].longOper, operLst[i].shortOper, operLst[i].numOper); | |
1818 } | |
1819 | |
1820 /* Beware of overwriting of g_sa */ | |
1821 #ifdef _SIMULATION_ /* Option for line by line output in simulation */ | |
1822 if (pos > 1) /* line-by-line in simulation */ | |
1823 { | |
1824 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1825 g_sa[0]='\0'; | |
1826 pos=0; | |
1827 } | |
1828 #else | |
1829 if (pos > sizeof(g_sa)-80) /* a single plmn should not exceed 80 bytes */ | |
1830 { | |
1831 io_sendMessageEx(srcId, g_sa, ATI_ECHO_OUTPUT); | |
1832 g_sa[0]='\0'; | |
1833 pos=0; | |
1834 } | |
1835 #endif /* _SIMULATION_ */ | |
1836 | |
1837 } | |
1838 | |
1839 if (i EQ MAX_PLMN_ID) | |
1840 END_OF_LIST = TRUE; | |
1841 | |
1842 if (!END_OF_LIST) | |
1843 { | |
1844 startIdx=lastIdx+1; | |
1845 do | |
1846 { | |
1847 if(cmd EQ AT_CMD_P_COPS) | |
1848 { | |
1849 ret=tAT_PercentCOPS(srcId,startIdx,&lastIdx,&operLst[0]); | |
1850 } | |
1851 else | |
1852 { | |
1853 ret=tAT_PlusCOPS(srcId,startIdx,&lastIdx,&operLst[0]); | |
1854 } | |
1855 | |
1856 if (ret EQ AT_CMPL) | |
1857 { | |
1858 END_OF_LIST=FALSE; | |
1859 for(i=0;i<MAX_OPER;i++) | |
1860 { | |
1861 if (operLst[i].status < 0) | |
1862 { | |
1863 END_OF_LIST = TRUE; | |
1864 break; | |
1865 } | |
1866 pos+=sprintf(g_sa+pos,",(%d,\"%s\",\"%s\",\"%s\")", | |
1867 operLst[i].status,operLst[i].longOper, | |
1868 operLst[i].shortOper,operLst[i].numOper); | |
1869 | |
1870 /* Beware of overwriting of g_sa */ | |
1871 #ifdef _SIMULATION_ | |
1872 if (pos > 1) /* line-by-line in simulation */ | |
1873 { | |
1874 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1875 g_sa[0]='\0'; | |
1876 pos=0; | |
1877 } | |
1878 #else | |
1879 if (pos > sizeof(g_sa)-80) /* a single plmn should not exceed 80 bytes */ | |
1880 { | |
1881 io_sendMessageEx(srcId, g_sa, ATI_ECHO_OUTPUT); | |
1882 g_sa[0]='\0'; | |
1883 pos=0; | |
1884 } | |
1885 #endif /* _SIMULATION_ */ | |
1886 | |
1887 } | |
1888 } | |
1889 if (ret EQ AT_EXCT) | |
1890 { | |
1891 src_params->curAtCmd = cmd; | |
1892 break; | |
1893 } | |
1894 if (ret EQ AT_FAIL) | |
1895 { | |
1896 cmdCmeError(CME_ERR_Unknown); | |
1897 break; | |
1898 } | |
1899 } | |
1900 while(!END_OF_LIST); | |
1901 } | |
1902 if (END_OF_LIST) | |
1903 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1904 | |
1905 } | |
1906 | |
1907 /* | |
1908 +--------------------------------------------------------------------+ | |
1909 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
1910 | STATE : code ROUTINE : rCI_CCWA | | |
1911 +--------------------------------------------------------------------+ | |
1912 | |
1913 PURPOSE : handles AT_CCWA call back | |
1914 | |
1915 */ | |
1916 #ifdef NO_ASCIIZ | |
1917 GLOBAL void rCI_PlusCCWA ( /*UBYTE srcId,*/ | |
1918 T_ACI_CLSSTAT * clsStat, | |
1919 CHAR * number, | |
1920 T_ACI_TOA * type, | |
1921 U8 validity, | |
1922 T_ACI_CLASS class_type, | |
1923 T_ACI_PB_TEXT * alpha ) | |
1924 #else /* ifdef NO_ASCIIZ */ | |
1925 GLOBAL void rCI_PlusCCWA (/*UBYTE srcId, */ | |
1926 T_ACI_CLSSTAT * clsStat, | |
1927 CHAR * number, | |
1928 T_ACI_TOA * type, | |
1929 U8 validity, | |
1930 T_ACI_CLASS class_type, | |
1931 CHAR * alpha ) | |
1932 #endif /* ifdef NO_ASCIIZ */ | |
1933 { | |
1934 char* me = "+CCWA: "; | |
1935 int i = 0; | |
1936 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
1937 USHORT lenCvtdAlpha; | |
1938 UBYTE *uniAlpha = NULL; | |
1939 UBYTE uniAlphaLen = 0; | |
1940 UBYTE srcId = srcId_cb; | |
1941 T_ACI_CLASS test_class; | |
1942 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1943 | |
1944 | |
1945 TRACE_FUNCTION("rCI_PlusCCWA()"); | |
1946 | |
1947 #ifdef NO_ASCIIZ | |
1948 if ( alpha NEQ NULL ) | |
1949 { | |
1950 uniAlpha = alpha->data; | |
1951 uniAlphaLen = alpha->len; | |
1952 } | |
1953 #else /* ifdef NO_ASCIIZ */ | |
1954 if ( alpha NEQ NULL ) | |
1955 { | |
1956 uniAlpha = (UBYTE *)alpha; | |
1957 uniAlphaLen = strlen(alpha); | |
1958 } | |
1959 #endif /* ifdef NO_ASCIIZ */ | |
1960 | |
1961 if(clsStat) /*Callback for q_AT_PlusCCWA*/ | |
1962 { | |
1963 | |
1964 if (clsStat->status EQ STATUS_Active) | |
1965 { | |
1966 src_params->curAtCmd = AT_CMD_NONE; | |
1967 test_class = 1; | |
1968 while( test_class < 2*CLASS_Fax ) | |
1969 { | |
1970 if( clsStat->class_type & test_class ) | |
1971 { | |
1972 TRACE_EVENT_P1("test_class: %d", test_class); | |
1973 | |
1974 sprintf(g_sa,"%s%d,%d", me, clsStat->status, test_class); | |
1975 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1976 } | |
1977 test_class *= 2; /* test next class */ | |
1978 } | |
1979 } | |
1980 else | |
1981 { | |
1982 sprintf ( g_sa, "%s0,%d",me, clsStat->class_type ); | |
1983 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
1984 } | |
1985 } | |
1986 else /*call waiting indication*/ | |
1987 { | |
1988 if ( at.flags.CCWA_stat | |
1989 /* AND | |
1990 ( | |
1991 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
1992 io_getIoMode ( ) EQ IO_MODE_RUN | |
1993 )*/ | |
1994 ) | |
1995 { | |
1996 i=sprintf(g_sa,"%s",me); | |
1997 if (number) | |
1998 { | |
1999 i+=sprintf(g_sa+i,"\"%s\",",number); | |
2000 if (type) | |
2001 i+=sprintf(g_sa+i,"%d,",toa_merge(*type)); | |
2002 else | |
2003 i+=sprintf(g_sa+i,"128,"); | |
2004 } | |
2005 else | |
2006 i+=sprintf(g_sa+i,"\"\",128,"); | |
2007 | |
2008 if (class_type >=0) | |
2009 i+=sprintf(g_sa+i,"%d,",class_type); | |
2010 else | |
2011 i+=sprintf(g_sa+i,","); | |
2012 | |
2013 if (alpha) | |
2014 { | |
2015 utl_chsetFromSim ( uniAlpha, | |
2016 uniAlphaLen, | |
2017 (UBYTE*)cvtdAlpha, | |
2018 sizeof(cvtdAlpha), | |
2019 &lenCvtdAlpha, | |
2020 GSM_ALPHA_Def ); | |
2021 i+=sprints(g_sa+i,cvtdAlpha,lenCvtdAlpha); | |
2022 } | |
2023 | |
2024 if (validity NEQ PRES_NOT_PRES) | |
2025 { | |
2026 i += sprintf(g_sa+i,",%d",validity); | |
2027 } | |
2028 | |
2029 ci_remTrailCom(g_sa, (USHORT)i); | |
2030 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2031 | |
2032 #ifdef ACI /* for ATI only version */ | |
2033 cmhMMI_handleAudioTone ( AT_CMD_NONE, RAT_CCWA, CPI_MSG_NotPresent ); | |
2034 #endif | |
2035 } | |
2036 } | |
2037 } | |
2038 | |
2039 /* | |
2040 +--------------------------------------------------------------------+ | |
2041 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2042 | STATE : code ROUTINE : rCI_CCFC | | |
2043 +--------------------------------------------------------------------+ | |
2044 | |
2045 PURPOSE : handles AT_CCFC call back | |
2046 | |
2047 */ | |
2048 | |
2049 GLOBAL void rCI_PlusCCFC (/*UBYTE srcId,*/ T_ACI_CCFC_SET* setting) | |
2050 { | |
2051 char *me="+CCFC: "; | |
2052 int i=0; | |
2053 UBYTE srcId = srcId_cb; | |
2054 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2055 | |
2056 TRACE_FUNCTION("rCI_PlusCCFC()"); | |
2057 | |
2058 src_params->curAtCmd = AT_CMD_NONE; | |
2059 | |
2060 if (setting) /*Callback for qAT_PlusCCFC*/ | |
2061 { | |
2062 if (setting->clsstat.status EQ STATUS_Active) | |
2063 { | |
2064 i=sprintf(g_sa,"%s",me); | |
2065 | |
2066 if (setting->clsstat.status NEQ STATUS_NotPresent) | |
2067 i+=sprintf(g_sa+i,"%d,",setting->clsstat.status); | |
2068 else | |
2069 i+=sprintf(g_sa+i,","); | |
2070 if (setting->clsstat.class_type NEQ CLASS_NotPresent) | |
2071 i+=sprintf(g_sa+i,"%d,",setting->clsstat.class_type); | |
2072 else | |
2073 i+=sprintf(g_sa+i,","); | |
2074 if (setting->number[0] NEQ 0x0 ) | |
2075 i+=sprintf(g_sa+i,"\"%s\",",setting->number); | |
2076 else | |
2077 i+=sprintf(g_sa+i,","); | |
2078 if (setting->type.npi NEQ NPI_NotPresent ) | |
2079 i+=sprintf(g_sa+i,"%d,",toa_merge(setting->type)); | |
2080 else | |
2081 i+=sprintf(g_sa+i,","); | |
2082 if (setting->subaddr[0] NEQ 0x0 ) | |
2083 i+=sprintf(g_sa+i,"\"%s\",",setting->subaddr); | |
2084 else | |
2085 i+=sprintf(g_sa+i,","); | |
2086 if (setting->satype.tos NEQ TOS_NotPresent ) | |
2087 i+=sprintf(g_sa+i,"%d,",tos_merge(setting->satype)); | |
2088 else | |
2089 i+=sprintf(g_sa+i,","); | |
2090 if (setting->time NEQ ACI_NumParmNotPresent) | |
2091 i+=sprintf(g_sa+i,"%d",setting->time); | |
2092 | |
2093 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
2094 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2095 } | |
2096 else | |
2097 { | |
2098 sprintf ( g_sa, "%s0,%d",me, setting->clsstat.class_type ); | |
2099 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
2100 } | |
2101 } | |
2102 } | |
2103 | |
2104 /* | |
2105 +--------------------------------------------------------------------+ | |
2106 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2107 | STATE : code ROUTINE : rCI_CLCK | | |
2108 +--------------------------------------------------------------------+ | |
2109 | |
2110 PURPOSE : handles AT_CLCK call back | |
2111 | |
2112 */ | |
2113 | |
2114 GLOBAL void rCI_PlusCLCK (/*UBYTE srcId,*/ T_ACI_CLSSTAT * clsStat) | |
2115 | |
2116 { | |
2117 char *me="+CLCK: "; | |
2118 int i=0; | |
2119 UBYTE srcId = srcId_cb; | |
2120 T_ACI_CLASS test_class; | |
2121 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2122 | |
2123 | |
2124 | |
2125 TRACE_FUNCTION("rCI_PlusCLCK()"); | |
2126 | |
2127 src_params->curAtCmd = AT_CMD_NONE; | |
2128 | |
2129 if(clsStat) /*Callback for qAT_PlusCLCK*/ | |
2130 { | |
2131 if (clsStat->status EQ STATUS_Active) | |
2132 { | |
2133 test_class = 1; | |
2134 | |
2135 while( test_class < 2*CLASS_Sms ) | |
2136 { | |
2137 if( clsStat->class_type & test_class ) | |
2138 { | |
2139 sprintf(g_sa,"%s%d,%d",me,clsStat->status,test_class); | |
2140 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2141 } | |
2142 test_class *= 2; /* test next class */ | |
2143 } | |
2144 } | |
2145 else | |
2146 { | |
2147 sprintf ( g_sa, "%s0,%d", me, clsStat->class_type ); | |
2148 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
2149 } | |
2150 } | |
2151 } | |
2152 | |
2153 /* | |
2154 +--------------------------------------------------------------------+ | |
2155 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2156 | STATE : code ROUTINE : rCI_CRSM | | |
2157 +--------------------------------------------------------------------+ | |
2158 | |
2159 PURPOSE : handles AT_CRSM call back | |
2160 | |
2161 */ | |
2162 | |
2163 GLOBAL void rCI_PlusCRSM ( /*UBYTE srcId,*/ | |
2164 SHORT sw1, | |
2165 SHORT sw2, | |
2166 SHORT rspLen, | |
2167 UBYTE *rsp ) | |
2168 { | |
2169 int i=0; | |
2170 UBYTE srcId = srcId_cb; | |
2171 | |
2172 | |
2173 TRACE_FUNCTION("rCI_PlusCRSM()"); | |
2174 | |
2175 i=sprintf(g_sa,"%s","+CRSM: "); | |
2176 | |
2177 if (sw1 NEQ ACI_NumParmNotPresent) | |
2178 i+=sprintf(g_sa+i,"%d,",sw1); | |
2179 else | |
2180 i+=sprintf(g_sa+i,","); | |
2181 if (sw2 NEQ ACI_NumParmNotPresent) | |
2182 i+=sprintf(g_sa+i,"%d,",sw2); | |
2183 else | |
2184 i+=sprintf(g_sa+i,","); | |
2185 if (rspLen AND rsp) | |
2186 { | |
2187 utl_binToHex( rsp, rspLen, g_sa+i ); | |
2188 } | |
2189 | |
2190 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
2191 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2192 } | |
2193 | |
2194 /* | |
2195 +--------------------------------------------------------------------+ | |
2196 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2197 | STATE : code ROUTINE : rCI_CSIM | | |
2198 +--------------------------------------------------------------------+ | |
2199 | |
2200 PURPOSE : handles AT_CSIM call back | |
2201 | |
2202 */ | |
2203 | |
2204 GLOBAL void rCI_PlusCSIM ( /*UBYTE srcId,*/ | |
2205 SHORT len, | |
2206 UBYTE *rsp ) | |
2207 { | |
2208 UBYTE i; | |
2209 UBYTE srcId = srcId_cb; | |
2210 SHORT rstLen = 0; | |
2211 SHORT tmpLen; | |
2212 | |
2213 TRACE_FUNCTION("rCI_PlusCSIM()"); | |
2214 | |
2215 i=sprintf(g_sa,"%s%d,","+CSIM: ",len*2); | |
2216 | |
2217 if (len AND rsp) | |
2218 { | |
2219 if( len*2+i > (MAX_CMD_LEN-1) ) rstLen = (len*2+i) - (MAX_CMD_LEN-1); | |
2220 | |
2221 tmpLen = (rstLen)?len-rstLen/2:len; | |
2222 | |
2223 utl_binToHex( rsp, tmpLen, g_sa+i ); | |
2224 io_sendMessageEx(srcId, g_sa, ATI_NORMAL_OUTPUT|ATI_BEGIN_CRLF_OUTPUT ); | |
2225 while( rstLen ) | |
2226 { | |
2227 rsp += tmpLen; | |
2228 tmpLen = rstLen/2; | |
2229 | |
2230 rstLen =( tmpLen*2 > (MAX_CMD_LEN-1))?tmpLen*2 - (MAX_CMD_LEN-1):0; | |
2231 | |
2232 if(rstLen) tmpLen = tmpLen-rstLen/2; | |
2233 | |
2234 utl_binToHex( rsp, tmpLen, g_sa ); | |
2235 io_sendMessageEx(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2236 } | |
2237 g_sa[0] = '\0'; | |
2238 io_sendMessageEx(srcId, g_sa, ATI_NORMAL_OUTPUT|ATI_END_CRLF_OUTPUT); | |
2239 } | |
2240 else | |
2241 { | |
2242 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2243 } | |
2244 } | |
2245 | |
2246 /* | |
2247 +--------------------------------------------------------------------+ | |
2248 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2249 | STATE : code ROUTINE : rCI_CSMS | | |
2250 +--------------------------------------------------------------------+ | |
2251 | |
2252 PURPOSE : handles AT_CSMS call back | |
2253 | |
2254 */ | |
2255 | |
2256 GLOBAL void rCI_PlusCSMS ( /*UBYTE srcId,*/ | |
2257 T_ACI_CSMS_SERV service, | |
2258 T_ACI_CSMS_SUPP mt, | |
2259 T_ACI_CSMS_SUPP mo, | |
2260 T_ACI_CSMS_SUPP bm) | |
2261 | |
2262 { | |
2263 UBYTE srcId = srcId_cb; | |
2264 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2265 | |
2266 char *me="+CSMS: "; | |
2267 int i=0; | |
2268 | |
2269 TRACE_FUNCTION("rCI_PlusCSMS()"); | |
2270 | |
2271 src_params->curAtCmd = AT_CMD_NONE; | |
2272 if (service < 0) | |
2273 sprintf(g_sa,"%s%d,%d,%d",me,mt,mo,bm); | |
2274 else | |
2275 sprintf(g_sa,"%s%d,%d,%d,%d",me,service,mt,mo,bm); | |
2276 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2277 } | |
2278 /* | |
2279 +--------------------------------------------------------------------+ | |
2280 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2281 | STATE : code ROUTINE : rCI_CPMS | | |
2282 +--------------------------------------------------------------------+ | |
2283 | |
2284 PURPOSE : handles AT_CPMS call back | |
2285 | |
2286 */ | |
2287 | |
2288 GLOBAL void rCI_PlusCPMS ( /*UBYTE srcId,*/ | |
2289 T_ACI_SMS_STOR_OCC * mem1, | |
2290 T_ACI_SMS_STOR_OCC * mem2, | |
2291 T_ACI_SMS_STOR_OCC * mem3 ) | |
2292 | |
2293 { | |
2294 CHAR* me = "+CPMS: "; | |
2295 CHAR memstr1[3] = {0}; | |
2296 CHAR memstr2[3] = {0}; | |
2297 CHAR memstr3[3] = {0}; | |
2298 BOOL f1 = TRUE; | |
2299 BOOL f2 = TRUE; | |
2300 BOOL f3 = TRUE; | |
2301 int i = 0; | |
2302 UBYTE srcId = srcId_cb; | |
2303 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2304 | |
2305 | |
2306 TRACE_FUNCTION("rCI_PlusCPMS()"); | |
2307 | |
2308 src_params->curAtCmd = AT_CMD_NONE; | |
2309 | |
2310 if ( cpmsCallType EQ QAT_CALL ) | |
2311 { | |
2312 for ( i=0; sms_mem[i].name != NULL; i++ ) | |
2313 { | |
2314 if ( ( sms_mem[i].stor EQ mem1->mem ) AND f1 ) | |
2315 { | |
2316 strcpy ( memstr1, sms_mem[i].name ); | |
2317 f1 = FALSE; | |
2318 } | |
2319 | |
2320 if ( ( sms_mem[i].stor EQ mem2->mem ) AND f2 ) | |
2321 { | |
2322 strcpy ( memstr2, sms_mem[i].name ); | |
2323 f2 = FALSE; | |
2324 } | |
2325 | |
2326 if ( ( sms_mem[i].stor EQ mem3->mem ) AND f3 ) | |
2327 { | |
2328 strcpy ( memstr3, sms_mem[i].name ); | |
2329 f3 = FALSE; | |
2330 } | |
2331 | |
2332 } | |
2333 sprintf ( g_sa, "%s\"%s\",%d,%d,\"%s\",%d,%d,\"%s\",%d,%d", | |
2334 me, memstr1, mem1->used, mem1->total, | |
2335 memstr2, mem2->used, mem2->total, | |
2336 memstr3, mem3->used, mem3->total ); | |
2337 } | |
2338 else | |
2339 { | |
2340 sprintf ( g_sa, "%s%d,%d,%d,%d,%d,%d", | |
2341 me, mem1->used, mem1->total, | |
2342 mem2->used, mem2->total, | |
2343 mem3->used, mem3->total ); | |
2344 } | |
2345 | |
2346 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
2347 | |
2348 cpmsCallType = NONE_CALL; | |
2349 } | |
2350 | |
2351 /* | |
2352 +--------------------------------------------------------------------+ | |
2353 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2354 | STATE : code ROUTINE : rCI_PlusCMS | | |
2355 +--------------------------------------------------------------------+ | |
2356 | |
2357 PURPOSE : handles AT_PlusCMS call back | |
2358 */ | |
2359 | |
2360 GLOBAL void rCI_PlusCMS ( /*UBYTE srcId,*/ T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err, | |
2361 T_EXT_CMS_ERROR *conc_error) | |
2362 { | |
2363 UBYTE srcId = srcId_cb; | |
2364 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2365 | |
2366 | |
2367 TRACE_FUNCTION("rCI_PLusCMS()"); | |
2368 | |
2369 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL); | |
2370 | |
2371 if ( curAbrtCmd EQ AT_CMD_NONE ) | |
2372 { | |
2373 src_params->curAtCmd = AT_CMD_NONE; | |
2374 io_sendConfirm(srcId, cmdCmsError(err), ATI_NORMAL_OUTPUT); | |
2375 cmdErrStr = NULL; | |
2376 } | |
2377 else | |
2378 { | |
2379 curAbrtCmd = AT_CMD_NONE; | |
2380 io_sendMessage ( srcId, cmdCmsError ( CMS_ERR_FailedToAbort ), | |
2381 ATI_NORMAL_OUTPUT | ATI_RESULT_CODE_OUTPUT); | |
2382 } | |
2383 } | |
2384 | |
2385 /* | |
2386 +--------------------------------------------------------------------+ | |
2387 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2388 | STATE : code ROUTINE : rCI_PlusCBM | | |
2389 +--------------------------------------------------------------------+ | |
2390 | |
2391 PURPOSE : handles AT_PlusCBM call back | |
2392 */ | |
2393 | |
2394 GLOBAL void rCI_PlusCBM ( T_MMI_CBCH_IND * mmi_cbch_ind ) | |
2395 { | |
2396 | |
2397 UBYTE srcId = srcId_cb; | |
2398 T_ATI_IO_MODE ioMode; | |
2399 #if defined (SMS_PDU_SUPPORT) | |
2400 T_ACI_CMGF_MOD mode; | |
2401 #endif | |
2402 | |
2403 TRACE_FUNCTION("rCI_PlusCBM()"); | |
2404 | |
2405 /* Check if the source invoking this function is the same as the one | |
2406 * interested in SMS indications */ /* Issue 25033 */ | |
2407 if (srcId NEQ smsShrdPrm.smsSrcId) | |
2408 return; | |
2409 | |
2410 ioMode = ati_get_mode( srcId_cb ); | |
2411 | |
2412 if ( !cnmiFlushInProgress | |
2413 AND (ioMode NEQ ATI_UNKN_MODE) | |
2414 AND ( (at.CNMI_mode EQ CNMI_MOD_Buffer) | |
2415 OR | |
2416 ((ioMode EQ ATI_DATA_MODE) AND (at.CNMI_mode EQ CNMI_MOD_BufferAndFlush)) ) ) | |
2417 { | |
2418 T_CNMI_IND ind; | |
2419 | |
2420 memcpy (&ind.cbm, mmi_cbch_ind, sizeof(T_MMI_CBCH_IND)); | |
2421 cmd_addCnmiNtry ( CNMI_CBM, &ind ); | |
2422 } | |
2423 else if ( cnmiFlushInProgress OR | |
2424 ( ioMode EQ ATI_CMD_MODE AND | |
2425 at.CNMI_mode NEQ CNMI_MOD_Buffer ) ) | |
2426 #if defined (SMS_PDU_SUPPORT) | |
2427 { | |
2428 /* | |
2429 * request current mode | |
2430 */ | |
2431 qAT_PlusCMGF(srcId, &mode); | |
2432 if (mode EQ 0) | |
2433 { | |
2434 /* | |
2435 * handle PDU mode | |
2436 */ | |
2437 rCI_PlusCBMPdu (mmi_cbch_ind); | |
2438 } | |
2439 else | |
2440 { | |
2441 /* | |
2442 * handle Text mode | |
2443 */ | |
2444 rCI_PlusCBMText (mmi_cbch_ind); | |
2445 } | |
2446 } | |
2447 } | |
2448 | |
2449 /* | |
2450 +--------------------------------------------------------------------+ | |
2451 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2452 | STATE : code ROUTINE : rCI_PlusCBM | | |
2453 +--------------------------------------------------------------------+ | |
2454 | |
2455 PURPOSE : handles AT_PlusCBM call back | |
2456 */ | |
2457 | |
2458 LOCAL void rCI_PlusCBMText ( T_MMI_CBCH_IND * mmi_cbch_ind ) | |
2459 #endif /* SMS_PDU_SUPPORT */ | |
2460 { | |
2461 USHORT pos; | |
2462 USHORT lenCvtdData = 0; | |
2463 CHAR cvtdData[2*MAX_CBM_LEN] = {0x00}; | |
2464 UBYTE srcId = srcId_cb; | |
2465 USHORT sn; /* serial number */ | |
2466 USHORT mid; /* message identifier */ | |
2467 UBYTE dcs; /* data coding scheme */ | |
2468 UBYTE page; /* actual page number */ | |
2469 UBYTE pages; /* total number of pages */ | |
2470 T_ACI_CBM_DATA msg; /* cell broadcast message data */ | |
2471 | |
2472 TRACE_FUNCTION("rCI_PLusCBMText()"); | |
2473 | |
2474 | |
2475 /* | |
2476 *----------------------------------------------------------------- | |
2477 * process parameters for new message indication | |
2478 *----------------------------------------------------------------- | |
2479 */ | |
2480 sn = ( ( SHORT )mmi_cbch_ind->cbch_msg[0] << 8 ) + | |
2481 mmi_cbch_ind->cbch_msg[1]; | |
2482 mid = ( ( SHORT )mmi_cbch_ind->cbch_msg[2] << 8 ) + | |
2483 mmi_cbch_ind->cbch_msg[3]; | |
2484 dcs = mmi_cbch_ind->cbch_msg[4]; | |
2485 page = ( mmi_cbch_ind->cbch_msg[5] & 0xF0 ) >> 4; | |
2486 pages = ( mmi_cbch_ind->cbch_msg[5] & 0x0F ); | |
2487 | |
2488 /* | |
2489 *----------------------------------------------------------------- | |
2490 * process message data, expanding from 7 to 8 bit | |
2491 *----------------------------------------------------------------- | |
2492 */ | |
2493 cmhSMS_expdSmsCb ( dcs, | |
2494 &mmi_cbch_ind->cbch_msg[CBCH_HEAD_LEN], | |
2495 (UBYTE)(mmi_cbch_ind->cbch_len - CBCH_HEAD_LEN), | |
2496 msg.data, &msg.len ); | |
2497 | |
2498 pos=sprintf(g_sa,"+CBM: %d,%d,%d,%d,%d",sn,mid,dcs,page,pages); | |
2499 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
2500 if (msg.len > 0) | |
2501 { | |
2502 pos = 0; | |
2503 | |
2504 utl_cbmDtaToTe((UBYTE*)msg.data, | |
2505 msg.len, | |
2506 (UBYTE*)cvtdData, | |
2507 sizeof(cvtdData), | |
2508 &lenCvtdData, | |
2509 0, | |
2510 (UBYTE)dcs); | |
2511 | |
2512 pos+=sprintq(g_sa+pos,cvtdData,lenCvtdData); | |
2513 | |
2514 io_sendMessageEx(srcId, g_sa, ATI_INDICATION_OUTPUT + | |
2515 ATI_FORCED_OUTPUT + | |
2516 ATI_END_CRLF_OUTPUT); | |
2517 } | |
2518 } | |
2519 #if !defined (SMS_PDU_SUPPORT) | |
2520 } /* rCI_PlusCBM */ | |
2521 #endif | |
2522 | |
2523 /* | |
2524 +--------------------------------------------------------------------+ | |
2525 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2526 | STATE : code ROUTINE : rCI_PlusCDS | | |
2527 +--------------------------------------------------------------------+ | |
2528 | |
2529 PURPOSE : handles AT_PlusCDS call back | |
2530 */ | |
2531 | |
2532 GLOBAL void rCI_PlusCDS ( T_MNSMS_STATUS_IND * mnsms_status_ind ) | |
2533 { | |
2534 | |
2535 UBYTE srcId = srcId_cb; | |
2536 T_ATI_IO_MODE ioMode; | |
2537 #if defined (SMS_PDU_SUPPORT) | |
2538 T_ACI_CMGF_MOD mode; | |
2539 #endif | |
2540 | |
2541 TRACE_FUNCTION("rCI_PLusCDS()"); | |
2542 | |
2543 /* Check if the source invoking this function is the same as the one | |
2544 * interested in SMS indications */ /* Issue 25033 */ | |
2545 if (srcId NEQ smsShrdPrm.smsSrcId) | |
2546 return; | |
2547 | |
2548 ioMode = ati_get_mode( srcId_cb ); | |
2549 | |
2550 if ( !cnmiFlushInProgress | |
2551 AND (ioMode NEQ ATI_UNKN_MODE) | |
2552 AND ( (at.CNMI_mode EQ CNMI_MOD_Buffer) | |
2553 OR | |
2554 ((ioMode EQ ATI_DATA_MODE) AND (at.CNMI_mode EQ CNMI_MOD_BufferAndFlush)) ) ) | |
2555 { | |
2556 T_CNMI_IND ind; | |
2557 | |
2558 memcpy ( &ind.cds, mnsms_status_ind, sizeof ( T_MNSMS_STATUS_IND) ); | |
2559 cmd_addCnmiNtry ( CNMI_CDS, &ind ); | |
2560 } | |
2561 else if ( cnmiFlushInProgress OR | |
2562 ( ioMode EQ ATI_CMD_MODE AND | |
2563 at.CNMI_mode NEQ CNMI_MOD_Buffer ) ) | |
2564 #if defined (SMS_PDU_SUPPORT) | |
2565 { | |
2566 /* | |
2567 * request current mode | |
2568 */ | |
2569 qAT_PlusCMGF(srcId, &mode); | |
2570 if (mode EQ 0) | |
2571 { | |
2572 /* | |
2573 * handle PDU mode | |
2574 */ | |
2575 rCI_PlusCDSPdu (mnsms_status_ind); | |
2576 } | |
2577 else | |
2578 { | |
2579 /* | |
2580 * handle Text mode | |
2581 */ | |
2582 rCI_PlusCDSText (mnsms_status_ind); | |
2583 } | |
2584 } | |
2585 } | |
2586 | |
2587 /* | |
2588 +--------------------------------------------------------------------+ | |
2589 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2590 | STATE : code ROUTINE : rCI_PlusCDSText | | |
2591 +--------------------------------------------------------------------+ | |
2592 | |
2593 PURPOSE : handles AT_PlusCDS call back for text mode | |
2594 */ | |
2595 | |
2596 LOCAL void rCI_PlusCDSText (T_MNSMS_STATUS_IND * mnsms_status_ind) | |
2597 #endif /* SMS_PDU_SUPPORT */ | |
2598 { | |
2599 | |
2600 UBYTE srcId = srcId_cb; | |
2601 T_ACI_CDS_SM* p_st; | |
2602 SHORT pos = 0; | |
2603 | |
2604 TRACE_FUNCTION("rCI_PLusCDSText()"); | |
2605 | |
2606 | |
2607 | |
2608 /* is the SM already decoded ? */ | |
2609 if (smsShrdPrm.pDecMsg) | |
2610 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
2611 else | |
2612 { | |
2613 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CDS_SM) ); | |
2614 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
2615 cmhSMS_cpyStatInd ( p_st, mnsms_status_ind); | |
2616 } | |
2617 | |
2618 pos=sprintf(g_sa,"+CDS: %d,%d,",p_st->fo, p_st->msg_ref); | |
2619 if (strlen(p_st->addr)) | |
2620 pos+=sprintf(g_sa+pos,"\"%s\"",p_st->addr); | |
2621 else | |
2622 pos+=sprintf(g_sa+pos,","); | |
2623 if( (p_st->toa.ton NEQ TON_NotPresent) AND (p_st->toa.npi NEQ NPI_NotPresent) ) | |
2624 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_st->toa)); | |
2625 else | |
2626 pos+=sprintf(g_sa+pos,","); | |
2627 | |
2628 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
2629 p_st->vpabs_scts.year [0], p_st->vpabs_scts.year [1], | |
2630 p_st->vpabs_scts.month [0], p_st->vpabs_scts.month [1], | |
2631 p_st->vpabs_scts.day [0], p_st->vpabs_scts.day [1], | |
2632 p_st->vpabs_scts.hour [0], p_st->vpabs_scts.hour [1], | |
2633 p_st->vpabs_scts.minute[0], p_st->vpabs_scts.minute[1], | |
2634 p_st->vpabs_scts.second[0], p_st->vpabs_scts.second[1], | |
2635 p_st->vpabs_scts.timezone); | |
2636 | |
2637 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\",%d", | |
2638 p_st->vpabs_dt.year [0], p_st->vpabs_dt.year [1], | |
2639 p_st->vpabs_dt.month [0], p_st->vpabs_dt.month [1], | |
2640 p_st->vpabs_dt.day [0], p_st->vpabs_dt.day [1], | |
2641 p_st->vpabs_dt.hour [0], p_st->vpabs_dt.hour [1], | |
2642 p_st->vpabs_dt.minute[0], p_st->vpabs_dt.minute[1], | |
2643 p_st->vpabs_dt.second[0], p_st->vpabs_dt.second[1], | |
2644 p_st->vpabs_dt.timezone , p_st->tp_status); | |
2645 | |
2646 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
2647 } | |
2648 #if !defined (SMS_PDU_SUPPORT) | |
2649 } /* rCI_PlusCDS */ | |
2650 #endif | |
2651 | |
2652 /* | |
2653 +--------------------------------------------------------------------+ | |
2654 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2655 | STATE : code ROUTINE : rCI_PlusCMT | | |
2656 +--------------------------------------------------------------------+ | |
2657 | |
2658 PURPOSE : handles AT_PlusCMT call back | |
2659 */ | |
2660 | |
2661 GLOBAL void rCI_PlusCMT (T_MNSMS_MESSAGE_IND* mnsms_message_ind) | |
2662 { | |
2663 UBYTE srcId = srcId_cb; | |
2664 T_ATI_IO_MODE ioMode; | |
2665 #if defined (SMS_PDU_SUPPORT) | |
2666 T_ACI_CMGF_MOD mode; | |
2667 #endif | |
2668 | |
2669 TRACE_EVENT_P1("rCI_PlusCMT(): source Id: %d", srcId); | |
2670 | |
2671 /* Check if the source invoking this function is the same as the one | |
2672 * interested in SMS indications */ /* Issue 25033 */ | |
2673 if (srcId NEQ smsShrdPrm.smsSrcId) | |
2674 return; | |
2675 | |
2676 ioMode = ati_get_mode( srcId ); | |
2677 if( ioMode EQ ATI_UNKN_MODE ) | |
2678 { | |
2679 TRACE_EVENT("rCI_PlusCMT(): unused source (unknown ioMode) -> return"); | |
2680 return; | |
2681 } | |
2682 | |
2683 if ( !cnmiFlushInProgress AND | |
2684 ( (at.CNMI_mode EQ CNMI_MOD_Buffer) | |
2685 OR | |
2686 ( (ioMode EQ ATI_DATA_MODE) AND | |
2687 (at.CNMI_mode EQ CNMI_MOD_BufferAndFlush)) ) ) | |
2688 { /* terminal is busy --> store data into CNMI buffer */ | |
2689 T_CNMI_IND ind; | |
2690 | |
2691 TRACE_EVENT("rCI_PlusCMT(): terminal busy or buffer mode --> store data into CNMI buffer"); | |
2692 memcpy ( &ind.cmt, mnsms_message_ind, sizeof ( T_MNSMS_MESSAGE_IND) ); | |
2693 cmd_addCnmiNtry ( CNMI_CMT, &ind ); | |
2694 if ( smsShrdPrm.cnma_ack_expected EQ TRUE ) | |
2695 { /* the acknowledge must be send automatically, because terminal is busy */ | |
2696 PALLOC (mnsms_ack_res, MNSMS_ACK_RES); | |
2697 | |
2698 TRACE_EVENT("rCI_PlusCMT(): send 'automatic' acknowledge (Phase2+ mode and buffer)"); | |
2699 | |
2700 mnsms_ack_res->resp = SMS_RP_ACK; | |
2701 mnsms_ack_res->sms_sdu.o_buf = 0; | |
2702 mnsms_ack_res->sms_sdu.l_buf = 0; | |
2703 | |
2704 PSENDX (SMS, mnsms_ack_res); | |
2705 | |
2706 smsShrdPrm.cnma_ack_expected = FALSE; | |
2707 } | |
2708 } | |
2709 else | |
2710 { /* flush in progress or terminal is not busy */ | |
2711 TRACE_EVENT("rCI_PlusCMT(): flush in progress or command mode --> show +CMT on terminal"); | |
2712 if ( cnmiFlushInProgress OR | |
2713 ( (ioMode EQ ATI_CMD_MODE) AND | |
2714 (at.CNMI_mode NEQ CNMI_MOD_Buffer) ) ) | |
2715 #if defined (SMS_PDU_SUPPORT) | |
2716 { /* request current mode (text or PDU) */ | |
2717 if( smsShrdPrm.CNMImt EQ 0 ) | |
2718 { | |
2719 TRACE_EVENT("rCI_PlusCMT(): +CNMI <mt>=0 --> no routing to terminal (error in SMS entity)"); | |
2720 return; | |
2721 } | |
2722 qAT_PlusCMGF(srcId, &mode); | |
2723 if (mode EQ 0) | |
2724 { | |
2725 /* | |
2726 * handle PDU mode | |
2727 */ | |
2728 rCI_PlusCMTPdu (mnsms_message_ind); | |
2729 } | |
2730 else | |
2731 { | |
2732 /* | |
2733 * handle Text mode | |
2734 */ | |
2735 rCI_PlusCMTText (mnsms_message_ind); | |
2736 } | |
2737 } | |
2738 else | |
2739 { | |
2740 TRACE_EVENT_P3("rCI_PlusCMT(): cannot display the +CMT --> flushInProgess?: %d, ioMode: %d, CNMI Mode: % d", | |
2741 cnmiFlushInProgress, ioMode, at.CNMI_mode); | |
2742 } | |
2743 } | |
2744 } | |
2745 | |
2746 | |
2747 LOCAL void rCI_PlusCMTText (T_MNSMS_MESSAGE_IND* mnsms_message_ind) | |
2748 #endif /* SMS_PDU_SUPPORT */ | |
2749 { | |
2750 SHORT pos = 0; | |
2751 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
2752 USHORT lenCvtdAlpha; | |
2753 CHAR cvtdData[2*MAX_SM_LEN]; | |
2754 USHORT lenCvtdData; | |
2755 UBYTE srcId = srcId_cb; | |
2756 T_ACI_CMGL_SM* p_sm; | |
2757 #if defined FF_EOTD | |
2758 T_LOC_MLC_ADDRESS* lc_orig_addr_ptr; | |
2759 int i = 0; | |
2760 #endif | |
2761 | |
2762 TRACE_FUNCTION("rCI_PlusCMTText()"); | |
2763 | |
2764 pos=sprintf(g_sa,"+CMT: "); | |
2765 | |
2766 /* is the SM already decoded ? */ | |
2767 if (smsShrdPrm.pDecMsg) | |
2768 p_sm = smsShrdPrm.pDecMsg; | |
2769 else | |
2770 { | |
2771 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
2772 p_sm = smsShrdPrm.pDecMsg; | |
2773 cmhSMS_cpyMsgInd ( p_sm, mnsms_message_ind); | |
2774 } | |
2775 | |
2776 #if defined FF_EOTD | |
2777 memset(&lc_orig_addr,0,sizeof(T_LOC_MLC_ADDRESS)); | |
2778 lc_orig_addr_ptr = &lc_orig_addr; | |
2779 lc_orig_addr_ptr->toa.npi = p_sm->toa.npi; | |
2780 lc_orig_addr_ptr->toa.ton = p_sm->toa.ton; | |
2781 if(lc_orig_addr_ptr->toa.ton EQ TON_International) | |
2782 { | |
2783 lc_orig_addr_ptr->address[i] = '+'; | |
2784 i++; | |
2785 } | |
2786 strncpy(lc_orig_addr_ptr->address+i,p_sm->adress,sizeof(p_sm->adress)-(size_t)i); | |
2787 #endif /* FF_EOTD */ | |
2788 | |
2789 pos+=sprintf(g_sa+pos,"\"%s\",",p_sm->adress); | |
2790 | |
2791 #ifdef FF_ATI_BAT | |
2792 | |
2793 /* | |
2794 * Extracting the alphanumeric data from the phonebook at this point | |
2795 * would defeat the object (testing the BAT message). Having this | |
2796 * data stored globally represents an easier solution to the | |
2797 * problem of conveying it here. | |
2798 */ | |
2799 if (smsShrdPrm.alpha_len) | |
2800 { | |
2801 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
2802 } | |
2803 | |
2804 #else | |
2805 | |
2806 if( p_sm->alpha.len > 0 ) | |
2807 { | |
2808 utl_chsetFromGsm((UBYTE*)p_sm->alpha.data, | |
2809 p_sm->alpha.len, | |
2810 (UBYTE*)cvtdAlpha, | |
2811 sizeof(cvtdAlpha), | |
2812 &lenCvtdAlpha, | |
2813 GSM_ALPHA_Def); | |
2814 pos+=sprints(g_sa+pos,cvtdAlpha,lenCvtdAlpha); | |
2815 } | |
2816 | |
2817 #endif | |
2818 | |
2819 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", /* SCTS */ | |
2820 p_sm->scts.year [0], p_sm->scts.year [1], | |
2821 p_sm->scts.month [0], p_sm->scts.month [1], | |
2822 p_sm->scts.day [0], p_sm->scts.day [1], | |
2823 p_sm->scts.hour [0], p_sm->scts.hour [1], | |
2824 p_sm->scts.minute[0], p_sm->scts.minute[1], | |
2825 p_sm->scts.second[0], p_sm->scts.second[1], | |
2826 p_sm->scts.timezone); | |
2827 | |
2828 if (ati_user_output_cfg[srcId].CSDH_stat) | |
2829 { | |
2830 if(strlen(p_sm->adress)) | |
2831 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_sm->toa)); | |
2832 else | |
2833 pos+=sprintf(g_sa+pos,","); | |
2834 pos+=sprintf(g_sa+pos,",%d,%d,%d",p_sm->fo,p_sm->pid,p_sm->dcs); /*FO, PID, DCS*/ | |
2835 | |
2836 if(strlen(p_sm->sca)) | |
2837 { | |
2838 pos+=sprintf(g_sa+pos,",\"%s\"",p_sm->sca); | |
2839 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_sm->tosca)); | |
2840 } | |
2841 else | |
2842 pos+=sprintf(g_sa+pos,",,"); | |
2843 } | |
2844 | |
2845 if (((UBYTE)p_sm->fo & TP_UDHI_MASK) EQ TP_UDHI_WITH_HEADER) | |
2846 { | |
2847 T_ACI_SM_DATA data; | |
2848 | |
2849 aci_frmtOutput(p_sm->fo, p_sm->dcs, &data); | |
2850 | |
2851 utl_smDtaToTe((UBYTE*)data.data, | |
2852 data.len, | |
2853 (UBYTE*)cvtdData, | |
2854 sizeof(cvtdData), | |
2855 &lenCvtdData, | |
2856 (UBYTE)p_sm->fo, | |
2857 (UBYTE)p_sm->dcs); | |
2858 | |
2859 if (ati_user_output_cfg[srcId].CSDH_stat) | |
2860 pos+=sprintf(g_sa+pos,",%d",data.len); | |
2861 | |
2862 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
2863 | |
2864 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
2865 io_sendMessageEx(srcId, g_sa, ATI_INDICATION_OUTPUT + | |
2866 ATI_FORCED_OUTPUT + | |
2867 ATI_END_CRLF_OUTPUT); | |
2868 } | |
2869 else | |
2870 { | |
2871 if (ati_user_output_cfg[srcId].CSDH_stat) | |
2872 pos+=sprintf(g_sa+pos,",%d",p_sm->data.len); | |
2873 | |
2874 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
2875 | |
2876 if (p_sm->data.len > 0) | |
2877 { | |
2878 utl_smDtaToTe((UBYTE*)p_sm->data.data, | |
2879 p_sm->data.len, | |
2880 (UBYTE*)cvtdData, | |
2881 sizeof(cvtdData), | |
2882 &lenCvtdData, | |
2883 (UBYTE)p_sm->fo, | |
2884 (UBYTE)p_sm->dcs); | |
2885 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
2886 } | |
2887 else | |
2888 { | |
2889 g_sa[0]='\0'; | |
2890 } | |
2891 io_sendMessageEx(srcId, g_sa, ATI_INDICATION_OUTPUT + | |
2892 ATI_FORCED_OUTPUT + | |
2893 ATI_END_CRLF_OUTPUT); | |
2894 } | |
2895 } | |
2896 #if !defined (SMS_PDU_SUPPORT) | |
2897 } /* else in previous function */ | |
2898 } /* rCI_PlusCMT */ | |
2899 #endif | |
2900 | |
2901 /* | |
2902 +--------------------------------------------------------------------+ | |
2903 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
2904 | STATE : code ROUTINE : rCI_PlusCMGR | | |
2905 +--------------------------------------------------------------------+ | |
2906 | |
2907 PURPOSE : handles AT_PlusCMGR call back (Read Message) | |
2908 */ | |
2909 | |
2910 GLOBAL void rCI_PlusCMGR ( T_MNSMS_READ_CNF* mnsms_read_cnf, | |
2911 T_ACI_CMGR_CBM * cbm) | |
2912 { | |
2913 UBYTE msg_type; | |
2914 #if defined (SMS_PDU_SUPPORT) | |
2915 UBYTE srcId = srcId_cb; | |
2916 T_ACI_CMGF_MOD mode; | |
2917 | |
2918 /* | |
2919 * request current mode | |
2920 */ | |
2921 qAT_PlusCMGF(srcId, &mode); | |
2922 if (mode EQ 0) | |
2923 /* | |
2924 * handle PDU mode | |
2925 */ | |
2926 rCI_Plus_Percent_CMGRPdu (mnsms_read_cnf, AT_CMD_CMGR); | |
2927 else | |
2928 #endif | |
2929 /* | |
2930 * handle Text mode | |
2931 */ | |
2932 { | |
2933 /* querying the type of the SM */ | |
2934 cmhSMS_SMSQueryType (&mnsms_read_cnf->sms_sdu, &msg_type); | |
2935 | |
2936 if (msg_type EQ TP_MTI_SMS_STATUS_REP) | |
2937 rCI_Plus_Percent_CMGRTextSP (mnsms_read_cnf, AT_CMD_CMGR); | |
2938 else | |
2939 rCI_Plus_Percent_CMGRText (mnsms_read_cnf, cbm, AT_CMD_CMGR); | |
2940 } | |
2941 } | |
2942 | |
2943 LOCAL void rCI_Plus_Percent_CMGRText (T_MNSMS_READ_CNF* mnsms_read_cnf, | |
2944 T_ACI_CMGR_CBM * cbm, | |
2945 T_ACI_AT_CMD cmd ) | |
2946 { | |
2947 CHAR* buf; | |
2948 SHORT pos = 0; | |
2949 | |
2950 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
2951 USHORT lenCvtdAlpha; | |
2952 CHAR cvtdData[2*MAX_SM_LEN]; | |
2953 USHORT lenCvtdData; | |
2954 UBYTE srcId = srcId_cb; | |
2955 T_ACI_CMGL_SM* p_sm; | |
2956 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2957 char vpenh_str[15]; | |
2958 | |
2959 TRACE_FUNCTION("rCI_Plus_Percent_CMGRText()"); | |
2960 | |
2961 src_params->curAtCmd = AT_CMD_NONE; | |
2962 | |
2963 /* is the SM already decoded ? */ | |
2964 if (smsShrdPrm.pDecMsg) | |
2965 p_sm = smsShrdPrm.pDecMsg; | |
2966 else | |
2967 { | |
2968 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
2969 p_sm = smsShrdPrm.pDecMsg; | |
2970 cmhSMS_cpyReadCnf (p_sm, mnsms_read_cnf); | |
2971 } | |
2972 | |
2973 buf=sms_status(p_sm->stat); | |
2974 | |
2975 if (buf) /* STATUS */ | |
2976 { | |
2977 if (cmd EQ AT_CMD_CMGR) | |
2978 { | |
2979 pos=sprintf(g_sa,"+CMGR: \"%s\"",buf); | |
2980 } | |
2981 else | |
2982 { | |
2983 pos=sprintf (g_sa, " %s: \"%s\"", "%CMGR", buf); | |
2984 } | |
2985 } | |
2986 else | |
2987 { | |
2988 if (cmd EQ AT_CMD_CMGR) | |
2989 { | |
2990 pos=sprintf(g_sa,"+CMGR: ,"); | |
2991 } | |
2992 else | |
2993 { | |
2994 pos=sprintf (g_sa, " %s", "%CMGR: ,"); | |
2995 } | |
2996 } | |
2997 pos+=sprintf(g_sa+pos,",\"%s\"",p_sm->adress); /*Destination Address*/ | |
2998 | |
2999 #ifdef FF_ATI_BAT | |
3000 | |
3001 /* | |
3002 * Extracting the alphanumeric data from the phonebook at this point | |
3003 * would defeat the object (testing the BAT message). Having this | |
3004 * data stored globally represents a quick and dirty solution to the | |
3005 * problem of conveying it here. | |
3006 */ | |
3007 if (smsShrdPrm.alpha_len) | |
3008 { | |
3009 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
3010 } | |
3011 else | |
3012 { | |
3013 pos+=sprintf(g_sa+pos,","); | |
3014 } | |
3015 | |
3016 #else | |
3017 | |
3018 if (p_sm->alpha.len > 0) /*ALPHA*/ | |
3019 { | |
3020 pos+=sprintf(g_sa+pos,","); | |
3021 utl_chsetFromGsm((UBYTE*)p_sm->alpha.data, | |
3022 p_sm->alpha.len, | |
3023 (UBYTE*)cvtdAlpha, | |
3024 sizeof(cvtdAlpha), | |
3025 &lenCvtdAlpha, | |
3026 GSM_ALPHA_Def); | |
3027 pos+=sprints(g_sa+pos,cvtdAlpha,lenCvtdAlpha); | |
3028 } | |
3029 else | |
3030 pos+=sprintf(g_sa+pos,","); | |
3031 | |
3032 #endif /*FF_ATI_BAT*/ | |
3033 | |
3034 if ((p_sm->fo & TP_MTI_MASK) EQ TP_MTI_SMS_DELIVER) | |
3035 { | |
3036 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
3037 p_sm->scts.year [0], p_sm->scts.year [1], | |
3038 p_sm->scts.month [0], p_sm->scts.month [1], | |
3039 p_sm->scts.day [0], p_sm->scts.day [1], | |
3040 p_sm->scts.hour [0], p_sm->scts.hour [1], | |
3041 p_sm->scts.minute[0], p_sm->scts.minute[1], | |
3042 p_sm->scts.second[0], p_sm->scts.second[1], | |
3043 p_sm->scts.timezone); | |
3044 } | |
3045 | |
3046 if(ati_user_output_cfg[srcId].CSDH_stat) | |
3047 { | |
3048 if(strlen(p_sm->adress)) /*TOA Destination*/ | |
3049 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_sm->toa)); | |
3050 else | |
3051 pos+=sprintf(g_sa+pos,","); | |
3052 pos+=sprintf(g_sa+pos,",%d,%d,%d",p_sm->fo,p_sm->pid,p_sm->dcs); /*FO, PID, DCS*/ | |
3053 | |
3054 if ((p_sm->fo & TP_MTI_MASK) EQ TP_MTI_SMS_SUBMIT) | |
3055 { | |
3056 if ((p_sm->fo & TP_VPF_MASK) EQ TP_VPF_ABSOLUTE) | |
3057 { | |
3058 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
3059 p_sm->scts.year [0], p_sm->scts.year [1], | |
3060 p_sm->scts.month [0], p_sm->scts.month [1], | |
3061 p_sm->scts.day [0], p_sm->scts.day [1], | |
3062 p_sm->scts.hour [0], p_sm->scts.hour [1], | |
3063 p_sm->scts.minute[0], p_sm->scts.minute[1], | |
3064 p_sm->scts.second[0], p_sm->scts.second[1], | |
3065 p_sm->scts.timezone); | |
3066 } | |
3067 else if ((p_sm->fo & TP_VPF_MASK) EQ TP_VPF_ENHANCED) | |
3068 { | |
3069 aci_encodeVpenh ( vpenh_str, &p_sm->vp_enh ); | |
3070 pos+=sprintf(g_sa+pos,",\"%s\"",vpenh_str); | |
3071 } | |
3072 else if ((p_sm->fo & TP_VPF_MASK) EQ TP_VPF_RELATIVE) | |
3073 pos+=sprintf(g_sa+pos,",%d",p_sm->vp_rel); | |
3074 else | |
3075 pos+=sprintf(g_sa+pos,","); | |
3076 } | |
3077 if(strlen(p_sm->sca)) /*Destination Address*/ | |
3078 { | |
3079 pos+=sprintf(g_sa+pos,",\"%s\"",p_sm->sca); | |
3080 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_sm->tosca)); | |
3081 } | |
3082 else | |
3083 pos+=sprintf(g_sa+pos,",,"); | |
3084 } | |
3085 | |
3086 if (((UBYTE)p_sm->fo & TP_UDHI_MASK) EQ TP_UDHI_WITH_HEADER) | |
3087 { | |
3088 T_ACI_SM_DATA data; | |
3089 | |
3090 aci_frmtOutput (p_sm->fo, p_sm->dcs, &data); | |
3091 | |
3092 utl_smDtaToTe((UBYTE*)data.data, | |
3093 data.len, | |
3094 (UBYTE*)cvtdData, | |
3095 sizeof(cvtdData), | |
3096 &lenCvtdData, | |
3097 (UBYTE)p_sm->fo, | |
3098 (UBYTE)p_sm->dcs); | |
3099 | |
3100 if(ati_user_output_cfg[srcId].CSDH_stat) | |
3101 pos+=sprintf(g_sa+pos,",%d",data.len); | |
3102 | |
3103 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3104 | |
3105 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
3106 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3107 } | |
3108 else | |
3109 { | |
3110 if(ati_user_output_cfg[srcId].CSDH_stat) | |
3111 pos+=sprintf(g_sa+pos,",%d",p_sm->data.len); | |
3112 | |
3113 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3114 | |
3115 if (p_sm->data.len > 0) | |
3116 { | |
3117 utl_smDtaToTe( (UBYTE*)p_sm->data.data, | |
3118 p_sm->data.len, | |
3119 (UBYTE*)cvtdData, | |
3120 sizeof(cvtdData), | |
3121 &lenCvtdData, | |
3122 (UBYTE)p_sm->fo, | |
3123 (UBYTE)p_sm->dcs); | |
3124 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
3125 } | |
3126 else /* empty SMS passed */ | |
3127 { | |
3128 g_sa[0]='\0'; | |
3129 } | |
3130 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3131 } | |
3132 } | |
3133 | |
3134 /* | |
3135 +--------------------------------------------------------------------+ | |
3136 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3137 | STATE : code ROUTINE : rCI_PlusCMTI | | |
3138 +--------------------------------------------------------------------+ | |
3139 | |
3140 PURPOSE : handles AT_PlusCMTI call back | |
3141 */ | |
3142 | |
3143 GLOBAL void rCI_PlusCMTI ( /*UBYTE srcId,*/ T_ACI_SMS_STOR mem, UBYTE index) | |
3144 { | |
3145 UBYTE srcId = srcId_cb; | |
3146 char mem_str[3]; | |
3147 SHORT i; | |
3148 T_ATI_IO_MODE ioMode; | |
3149 | |
3150 /* Check if the source invoking this function is the same as the one | |
3151 * interested in SMS indications */ /* Issue 25033 */ | |
3152 if (srcId NEQ smsShrdPrm.smsSrcId) | |
3153 return; | |
3154 | |
3155 TRACE_EVENT_P1("rCI_PlusCMTI(): source Id: %d", srcId); | |
3156 ioMode = ati_get_mode( srcId_cb ); | |
3157 | |
3158 if ( !cnmiFlushInProgress | |
3159 AND (ioMode NEQ ATI_UNKN_MODE) | |
3160 AND ( (at.CNMI_mode EQ CNMI_MOD_Buffer) | |
3161 OR | |
3162 ((ioMode EQ ATI_DATA_MODE) AND (at.CNMI_mode EQ CNMI_MOD_BufferAndFlush)) ) ) | |
3163 { | |
3164 T_CNMI_IND ind; | |
3165 | |
3166 ind.cmti.mem = mem; | |
3167 ind.cmti.index = index; | |
3168 | |
3169 cmd_addCnmiNtry ( CNMI_CMTI, &ind ); | |
3170 } | |
3171 else if ( cnmiFlushInProgress OR | |
3172 ( ioMode EQ ATI_CMD_MODE AND | |
3173 at.CNMI_mode NEQ CNMI_MOD_Buffer ) ) | |
3174 { | |
3175 for (i=0;sms_mem[i].name != 0;i++) | |
3176 { | |
3177 if (sms_mem[i].stor EQ mem) | |
3178 { | |
3179 strcpy(mem_str,sms_mem[i].name); | |
3180 break; | |
3181 } | |
3182 } | |
3183 sprintf(g_sa,"+CMTI: \"%s\",%d",mem_str,index); | |
3184 io_sendIndication(srcId, g_sa, ATI_FORCED_OUTPUT); | |
3185 } | |
3186 } | |
3187 | |
3188 /* | |
3189 +--------------------------------------------------------------------+ | |
3190 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3191 | STATE : code ROUTINE : rCI_PlusCMGS | | |
3192 +--------------------------------------------------------------------+ | |
3193 | |
3194 PURPOSE : handles AT_PlusCMGS call back | |
3195 */ | |
3196 | |
3197 GLOBAL void rCI_PlusCMGS (T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf) | |
3198 #if defined (SMS_PDU_SUPPORT) | |
3199 { | |
3200 UBYTE srcId = srcId_cb; | |
3201 | |
3202 T_ACI_CMGF_MOD mode; | |
3203 | |
3204 /* | |
3205 * request current mode | |
3206 */ | |
3207 qAT_PlusCMGF(srcId, &mode); | |
3208 if (mode EQ 0) | |
3209 /* | |
3210 * handle PDU mode | |
3211 */ | |
3212 rCI_PlusCMGSPdu (mnsms_submit_cnf); | |
3213 else | |
3214 /* | |
3215 * handle Text mode | |
3216 */ | |
3217 rCI_PlusCMGSText (mnsms_submit_cnf); | |
3218 } | |
3219 | |
3220 LOCAL void rCI_PlusCMGSText ( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf ) | |
3221 #endif | |
3222 { | |
3223 SHORT pos = 0; | |
3224 T_ACI_VP_ABS scts; | |
3225 UBYTE srcId = srcId_cb; | |
3226 UBYTE *buf; | |
3227 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3228 | |
3229 TRACE_FUNCTION("rCI_PlusCMGSText()"); | |
3230 | |
3231 src_params->curAtCmd = AT_CMD_NONE; | |
3232 | |
3233 pos=sprintf(g_sa,"+CMGS: %d", mnsms_submit_cnf->tp_mr); | |
3234 | |
3235 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
3236 { | |
3237 if (mnsms_submit_cnf->sms_sdu.l_buf) | |
3238 { | |
3239 /* skip SCA in SIM-PDU, buf points to SMS-SUBMIT-REPORT */ | |
3240 buf = mnsms_submit_cnf->sms_sdu.buf + mnsms_submit_cnf->sms_sdu.buf[0] + 1; | |
3241 | |
3242 /* advance to TP-SCTS */ | |
3243 if (mnsms_submit_cnf->cause EQ SMS_NO_ERROR) | |
3244 buf += 2; /* offset in SMS-SUBMIT-REPORT for RP-ACK */ | |
3245 else | |
3246 buf += 3; /* offset in SMS-SUBMIT-REPORT for RP-ERROR */ | |
3247 | |
3248 cmh_unpackSCTS (&scts, buf); | |
3249 | |
3250 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", /* SCTS */ | |
3251 scts.year [0], scts.year [1], | |
3252 scts.month [0], scts.month [1], | |
3253 scts.day [0], scts.day [1], | |
3254 scts.hour [0], scts.hour [1], | |
3255 scts.minute[0], scts.minute[1], | |
3256 scts.second[0], scts.second[1], | |
3257 scts.timezone); | |
3258 } | |
3259 } | |
3260 | |
3261 io_sendMessageEx( srcId, g_sa, | |
3262 ATI_NORMAL_OUTPUT | ATI_BEGIN_CRLF_OUTPUT | ATI_END_CRLF_OUTPUT); | |
3263 } | |
3264 | |
3265 | |
3266 /* | |
3267 +--------------------------------------------------------------------+ | |
3268 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3269 | STATE : code ROUTINE : rCI_PlusCMSS | | |
3270 +--------------------------------------------------------------------+ | |
3271 | |
3272 PURPOSE : handles AT_PlusCMSS call back | |
3273 */ | |
3274 | |
3275 GLOBAL void rCI_PlusCMSS (T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf) | |
3276 #if defined (SMS_PDU_SUPPORT) | |
3277 { | |
3278 UBYTE srcId = srcId_cb; | |
3279 | |
3280 T_ACI_CMGF_MOD mode; | |
3281 | |
3282 /* | |
3283 * request current mode | |
3284 */ | |
3285 qAT_PlusCMGF(srcId, &mode); | |
3286 if (mode EQ 0) | |
3287 /* | |
3288 * handle PDU mode | |
3289 */ | |
3290 rCI_PlusCMSSPdu (mnsms_submit_cnf); | |
3291 else | |
3292 /* | |
3293 * handle Text mode | |
3294 */ | |
3295 rCI_PlusCMSSText (mnsms_submit_cnf); | |
3296 } | |
3297 | |
3298 LOCAL void rCI_PlusCMSSText ( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf ) | |
3299 #endif | |
3300 { | |
3301 SHORT pos = 0; | |
3302 T_ACI_VP_ABS scts; | |
3303 UBYTE srcId = srcId_cb; | |
3304 UBYTE *buf; | |
3305 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3306 | |
3307 TRACE_FUNCTION("rCI_PlusCMSSText()"); | |
3308 | |
3309 src_params->curAtCmd = AT_CMD_NONE; | |
3310 | |
3311 pos=sprintf(g_sa,"+CMSS: %d", mnsms_submit_cnf->tp_mr); | |
3312 | |
3313 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
3314 { | |
3315 if (mnsms_submit_cnf->sms_sdu.l_buf) | |
3316 { | |
3317 /* skip SCA in SIM-PDU, buf points to SMS-SUBMIT-REPORT */ | |
3318 buf = mnsms_submit_cnf->sms_sdu.buf + mnsms_submit_cnf->sms_sdu.buf[0] + 1; | |
3319 | |
3320 /* advance to TP-SCTS */ | |
3321 if (mnsms_submit_cnf->cause EQ SMS_NO_ERROR) | |
3322 buf += 2; /* offset in SMS-SUBMIT-REPORT for RP-ACK */ | |
3323 else | |
3324 buf += 3; /* offset in SMS-SUBMIT-REPORT for RP-ERROR */ | |
3325 | |
3326 cmh_unpackSCTS (&scts, buf); | |
3327 | |
3328 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", /* SCTS */ | |
3329 scts.year [0], scts.year [1], | |
3330 scts.month [0], scts.month [1], | |
3331 scts.day [0], scts.day [1], | |
3332 scts.hour [0], scts.hour [1], | |
3333 scts.minute[0], scts.minute[1], | |
3334 scts.second[0], scts.second[1], | |
3335 scts.timezone); | |
3336 } | |
3337 } | |
3338 | |
3339 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3340 } | |
3341 | |
3342 /* | |
3343 +--------------------------------------------------------------------+ | |
3344 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3345 | STATE : code ROUTINE : rCI_PlusCMGW | | |
3346 +--------------------------------------------------------------------+ | |
3347 | |
3348 PURPOSE : handles AT_PlusCMGW call back | |
3349 */ | |
3350 | |
3351 GLOBAL void rCI_PlusCMGW ( /*UBYTE srcId,*/ UBYTE index) | |
3352 { | |
3353 UBYTE srcId = srcId_cb; | |
3354 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3355 | |
3356 | |
3357 TRACE_FUNCTION("rCI_PLusCMGW()"); | |
3358 | |
3359 src_params->curAtCmd = AT_CMD_NONE; | |
3360 | |
3361 sprintf(g_sa,"+CMGW: %d",index); | |
3362 io_sendMessageEx( srcId, g_sa, | |
3363 ATI_NORMAL_OUTPUT | ATI_BEGIN_CRLF_OUTPUT | ATI_END_CRLF_OUTPUT); | |
3364 } | |
3365 | |
3366 /* | |
3367 +--------------------------------------------------------------------+ | |
3368 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3369 | STATE : code ROUTINE : rCI_PlusCMGC | | |
3370 +--------------------------------------------------------------------+ | |
3371 | |
3372 PURPOSE : handles AT_PlusCMGC call back | |
3373 */ | |
3374 | |
3375 GLOBAL void rCI_PlusCMGC (T_MNSMS_COMMAND_CNF * mnsms_command_cnf) | |
3376 #if defined (SMS_PDU_SUPPORT) | |
3377 { | |
3378 UBYTE srcId = srcId_cb; | |
3379 | |
3380 T_ACI_CMGF_MOD mode; | |
3381 | |
3382 /* | |
3383 * request current mode | |
3384 */ | |
3385 qAT_PlusCMGF(srcId, &mode); | |
3386 if (mode EQ 0) | |
3387 /* | |
3388 * handle PDU mode | |
3389 */ | |
3390 rCI_PlusCMGCPdu (mnsms_command_cnf); | |
3391 else | |
3392 /* | |
3393 * handle Text mode | |
3394 */ | |
3395 rCI_PlusCMGCText (mnsms_command_cnf); | |
3396 } | |
3397 | |
3398 LOCAL void rCI_PlusCMGCText ( T_MNSMS_COMMAND_CNF * mnsms_command_cnf ) | |
3399 #endif | |
3400 { | |
3401 SHORT pos = 0; | |
3402 T_ACI_VP_ABS scts; | |
3403 UBYTE srcId = srcId_cb; | |
3404 UBYTE *buf; | |
3405 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3406 | |
3407 TRACE_FUNCTION("rCI_PlusCMGCText()"); | |
3408 | |
3409 src_params->curAtCmd = AT_CMD_NONE; | |
3410 | |
3411 pos=sprintf(g_sa,"+CMGC: %d", mnsms_command_cnf->tp_mr); | |
3412 | |
3413 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
3414 { | |
3415 if (mnsms_command_cnf->sms_sdu.l_buf) | |
3416 { | |
3417 /* skip SCA in SIM-PDU, buf points to SMS-STATUS-REPORT */ | |
3418 buf = mnsms_command_cnf->sms_sdu.buf + mnsms_command_cnf->sms_sdu.buf[0] + 1; | |
3419 | |
3420 /* advance to to TP-RA */ | |
3421 buf += 2; | |
3422 | |
3423 /* skip variable TP-RA and advance to TP-SCTS */ | |
3424 buf += (*buf+1)/2 + 2; /* length is in BCD digits! TON/NPI is also skipped */ | |
3425 | |
3426 cmh_unpackSCTS (&scts, buf); | |
3427 | |
3428 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", /* SCTS */ | |
3429 scts.year [0], scts.year [1], | |
3430 scts.month [0], scts.month [1], | |
3431 scts.day [0], scts.day [1], | |
3432 scts.hour [0], scts.hour [1], | |
3433 scts.minute[0], scts.minute[1], | |
3434 scts.second[0], scts.second[1], | |
3435 scts.timezone); | |
3436 } | |
3437 } | |
3438 | |
3439 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3440 } | |
3441 | |
3442 | |
3443 | |
3444 /* | |
3445 +--------------------------------------------------------------------+ | |
3446 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3447 | STATE : code ROUTINE : rCI_PlusILRR | | |
3448 +--------------------------------------------------------------------+ | |
3449 | |
3450 PURPOSE : handles CI_PlusILRR call back | |
3451 */ | |
3452 | |
3453 GLOBAL void rCI_PlusILRR( /*UBYTE srcId, */ | |
3454 T_ACI_BS_SPEED speed, | |
3455 T_ACI_BS_FRM format, | |
3456 T_ACI_BS_PAR parity) | |
3457 | |
3458 { | |
3459 LONG val; | |
3460 UBYTE srcId = srcId_cb; | |
3461 | |
3462 TRACE_FUNCTION("rCI_PlusILRR()"); | |
3463 | |
3464 if ( ati_user_output_cfg[srcId].ILRR_stat ) | |
3465 { | |
3466 switch(speed) | |
3467 { | |
3468 case(BS_SPEED_300_V110): val= 300; break; | |
3469 case(BS_SPEED_1200_V110): val= 1200; break; | |
3470 case(BS_SPEED_2400_V110): val= 2400; break; | |
3471 case(BS_SPEED_4800_V110): val= 4800; break; | |
3472 case(BS_SPEED_9600_V110): val= 9600; break; | |
3473 case(BS_SPEED_14400_V110): val=14400; break; | |
3474 case(BS_SPEED_19200_V110): val=19200; break; | |
3475 case(BS_SPEED_38400_V110): val=38400; break; | |
3476 default: val= 1; break; | |
3477 } | |
3478 sprintf(g_sa,"+ILRR: %d,%d,%d",val,format,parity); | |
3479 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3480 } | |
3481 } | |
3482 | |
3483 | |
3484 /* | |
3485 +--------------------------------------------------------------------+ | |
3486 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3487 | STATE : code ROUTINE : rCI_PercentBC | | |
3488 +--------------------------------------------------------------------+ | |
3489 | |
3490 PURPOSE : handles AT_OK call back | |
3491 | |
3492 */ | |
3493 | |
3494 GLOBAL void rCI_PercentBC (BYTE segm); | |
3495 | |
3496 /* | |
3497 +--------------------------------------------------------------------+ | |
3498 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3499 | STATE : code ROUTINE : rCI_PercentDRV | | |
3500 +--------------------------------------------------------------------+ | |
3501 | |
3502 PURPOSE : handles AT_OK call back | |
3503 | |
3504 */ | |
3505 | |
3506 GLOBAL void rCI_PercentDRV( T_ACI_DRV_DEV device, | |
3507 T_ACI_DRV_FCT function, | |
3508 UBYTE val1, | |
3509 UBYTE val2); | |
3510 | |
3511 /* | |
3512 +--------------------------------------------------------------------+ | |
3513 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3514 | STATE : code ROUTINE : rCI_PlusCMGL | | |
3515 +--------------------------------------------------------------------+ | |
3516 | |
3517 PURPOSE : handles AT_PlusCMGL call back | |
3518 | |
3519 */ | |
3520 | |
3521 GLOBAL void rCI_PlusCMGL (T_MNSMS_READ_CNF *mnsms_read_cnf) | |
3522 { | |
3523 UBYTE msg_type; | |
3524 #if defined (SMS_PDU_SUPPORT) | |
3525 UBYTE srcId = srcId_cb; | |
3526 T_ACI_CMGF_MOD mode; | |
3527 | |
3528 /* | |
3529 * request current mode | |
3530 */ | |
3531 qAT_PlusCMGF(srcId, &mode); | |
3532 if (mode EQ 0) | |
3533 /* | |
3534 * handle PDU mode | |
3535 */ | |
3536 rCI_Plus_Percent_CMGLPdu (mnsms_read_cnf, AT_CMD_CMGL); | |
3537 else | |
3538 #endif | |
3539 /* | |
3540 * handle Text mode | |
3541 */ | |
3542 { | |
3543 /* querying the type of the SM */ | |
3544 cmhSMS_SMSQueryType (&mnsms_read_cnf->sms_sdu, &msg_type); | |
3545 | |
3546 if (msg_type EQ TP_MTI_SMS_STATUS_REP) | |
3547 rCI_Plus_Percent_CMGLTextSP (mnsms_read_cnf, AT_CMD_CMGL); | |
3548 else | |
3549 rCI_Plus_Percent_CMGLText (mnsms_read_cnf, AT_CMD_CMGL); | |
3550 } | |
3551 } | |
3552 | |
3553 | |
3554 LOCAL void rCI_Plus_Percent_CMGLText (T_MNSMS_READ_CNF *mnsms_read_cnf, | |
3555 T_ACI_AT_CMD cmd) | |
3556 { | |
3557 SHORT i = 0; | |
3558 SHORT pos = 0; | |
3559 CHAR* buf; | |
3560 | |
3561 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
3562 USHORT lenCvtdAlpha; | |
3563 CHAR cvtdData[2*MAX_SM_LEN]; | |
3564 USHORT lenCvtdData; | |
3565 UBYTE srcId = srcId_cb; | |
3566 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3567 | |
3568 T_ACI_CMGL_SM* p_sm; | |
3569 | |
3570 TRACE_FUNCTION("rCI_Plus_Percent_CMGLText()"); | |
3571 | |
3572 src_params->curAtCmd = AT_CMD_NONE; | |
3573 | |
3574 | |
3575 /* is the SM already decoded ? */ | |
3576 if (smsShrdPrm.pDecMsg) | |
3577 p_sm = smsShrdPrm.pDecMsg; | |
3578 else | |
3579 { | |
3580 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
3581 p_sm = smsShrdPrm.pDecMsg; | |
3582 cmhSMS_cpyReadCnf (p_sm, mnsms_read_cnf); | |
3583 } | |
3584 | |
3585 buf = sms_status ( p_sm->stat ); | |
3586 | |
3587 if (cmd EQ AT_CMD_CMGL ) | |
3588 { | |
3589 pos = sprintf ( g_sa, "+CMGL: %d", p_sm->msg_ref); | |
3590 } | |
3591 else | |
3592 { | |
3593 pos=sprintf (g_sa, " %s: %d", "%CMGL", p_sm->msg_ref); | |
3594 } | |
3595 if ( buf ) | |
3596 { | |
3597 pos += sprintf ( g_sa + pos, ",\"%s\"", buf ); /* STATUS */ | |
3598 } | |
3599 else | |
3600 { | |
3601 pos += sprintf ( g_sa + pos, "," ); | |
3602 } | |
3603 | |
3604 if (p_sm->stat EQ SMS_STAT_Invalid) | |
3605 { | |
3606 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); /* emit "INVALID MESSAGE" only */ | |
3607 return; | |
3608 } | |
3609 pos += sprintf ( g_sa + pos, ",\"%s\",", p_sm->adress); | |
3610 | |
3611 #ifdef FF_ATI_BAT | |
3612 | |
3613 /* | |
3614 * Extracting the alphanumeric data from the phonebook at this point | |
3615 * would defeat the object (testing the BAT message). Having this | |
3616 * data stored globally represents a quick and dirty solution to the | |
3617 * problem of conveying it here. | |
3618 */ | |
3619 if (smsShrdPrm.alpha_len) | |
3620 { | |
3621 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
3622 } | |
3623 | |
3624 #else | |
3625 | |
3626 if ( p_sm->alpha.len NEQ 0 ) | |
3627 { | |
3628 utl_chsetFromGsm ( (UBYTE*)p_sm->alpha.data, | |
3629 p_sm->alpha.len, | |
3630 (UBYTE*)cvtdAlpha, | |
3631 sizeof(cvtdAlpha), | |
3632 &lenCvtdAlpha, | |
3633 GSM_ALPHA_Def ); | |
3634 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
3635 } | |
3636 | |
3637 #endif /*FF_ATI_BAT*/ | |
3638 | |
3639 if ((p_sm->fo & TP_MTI_MASK) NEQ TP_MTI_SMS_DELIVER) | |
3640 { | |
3641 pos += sprintf ( g_sa + pos, "," ); | |
3642 } | |
3643 else | |
3644 { | |
3645 pos += sprintf ( g_sa + pos, ",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
3646 p_sm->scts.year [0], p_sm->scts.year [1], | |
3647 p_sm->scts.month [0], p_sm->scts.month [1], | |
3648 p_sm->scts.day [0], p_sm->scts.day [1], | |
3649 p_sm->scts.hour [0], p_sm->scts.hour [1], | |
3650 p_sm->scts.minute[0], p_sm->scts.minute[1], | |
3651 p_sm->scts.second[0], p_sm->scts.second[1], | |
3652 p_sm->scts.timezone); | |
3653 } | |
3654 | |
3655 if (((UBYTE)p_sm->fo & TP_UDHI_MASK) EQ TP_UDHI_WITH_HEADER) | |
3656 { | |
3657 T_ACI_SM_DATA data; | |
3658 | |
3659 aci_frmtOutput(p_sm->fo, p_sm->dcs, &data); | |
3660 | |
3661 utl_smDtaToTe((UBYTE*)data.data, | |
3662 data.len, | |
3663 (UBYTE*)cvtdData, | |
3664 sizeof(cvtdData), | |
3665 &lenCvtdData, | |
3666 (UBYTE)p_sm->fo, | |
3667 (UBYTE)p_sm->dcs); | |
3668 | |
3669 if(ati_user_output_cfg[srcId].CSDH_stat) | |
3670 pos += sprintf ( g_sa + pos, ",%d,%d",toa_merge ( p_sm->toa ), data.len ); | |
3671 | |
3672 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3673 | |
3674 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
3675 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3676 } | |
3677 else | |
3678 { | |
3679 if(ati_user_output_cfg[srcId].CSDH_stat) | |
3680 pos += sprintf ( g_sa + pos, ",%d,%d", | |
3681 toa_merge ( p_sm->toa ), p_sm->data.len ); | |
3682 | |
3683 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3684 | |
3685 if (p_sm->data.len > 0) | |
3686 { | |
3687 utl_smDtaToTe( (UBYTE*)p_sm->data.data, | |
3688 p_sm->data.len, | |
3689 (UBYTE*)cvtdData, | |
3690 sizeof(cvtdData), | |
3691 &lenCvtdData, | |
3692 (UBYTE)p_sm->fo, | |
3693 (UBYTE)p_sm->dcs); | |
3694 pos=sprintq(g_sa,cvtdData,lenCvtdData); | |
3695 } | |
3696 else | |
3697 { | |
3698 g_sa[0]='\0'; | |
3699 } | |
3700 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3701 } | |
3702 } | |
3703 | |
3704 /* | |
3705 +--------------------------------------------------------------------+ | |
3706 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3707 | STATE : code ROUTINE : rCI_PlusCSSI | | |
3708 +--------------------------------------------------------------------+ | |
3709 | |
3710 PURPOSE : handles AT_PlusCSSI call back | |
3711 | |
3712 */ | |
3713 GLOBAL void rCI_PlusCSSI ( T_ACI_CSSI_CODE code, | |
3714 SHORT index) | |
3715 { | |
3716 SHORT pos=0; | |
3717 char *me="+CSSI: "; | |
3718 UBYTE srcId = srcId_cb; | |
3719 | |
3720 | |
3721 TRACE_FUNCTION("rCI_PLusCSSI()"); | |
3722 | |
3723 if ( ati_user_output_cfg[srcId].CSSI_stat | |
3724 /* AND | |
3725 ( | |
3726 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
3727 io_getIoMode ( ) EQ IO_MODE_RUN | |
3728 ) */ | |
3729 ) | |
3730 { | |
3731 | |
3732 pos = sprintf(g_sa,"%s",me); | |
3733 | |
3734 if (code NEQ CSSI_CODE_NotPresent) pos += sprintf(g_sa+pos,"%d,",code); | |
3735 else pos += sprintf(g_sa+pos,","); | |
3736 if (index NEQ ACI_NumParmNotPresent) sprintf(g_sa+pos,"%d",index); | |
3737 | |
3738 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
3739 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3740 } | |
3741 } | |
3742 | |
3743 /* | |
3744 +--------------------------------------------------------------------+ | |
3745 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3746 | STATE : code ROUTINE : rCI_PlusCSSU | | |
3747 +--------------------------------------------------------------------+ | |
3748 | |
3749 PURPOSE : handles AT_PlusCSSU call back | |
3750 | |
3751 */ | |
3752 | |
3753 GLOBAL void rCI_PlusCSSU ( /*UBYTE srcId,*/ | |
3754 T_ACI_CSSU_CODE code, | |
3755 SHORT index, | |
3756 CHAR *number, | |
3757 T_ACI_TOA *type, | |
3758 CHAR *subaddr, | |
3759 T_ACI_TOS *satype) | |
3760 { | |
3761 char *me="+CSSU: "; | |
3762 SHORT pos=0; | |
3763 UBYTE srcId = srcId_cb; | |
3764 | |
3765 | |
3766 TRACE_FUNCTION("rCI_PLusCSSU()"); | |
3767 | |
3768 if ( ati_user_output_cfg[srcId].CSSU_stat | |
3769 /* AND | |
3770 ( | |
3771 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
3772 io_getIoMode ( ) EQ IO_MODE_RUN | |
3773 ) */ | |
3774 ) | |
3775 { | |
3776 | |
3777 pos = sprintf(g_sa,"%s",me); | |
3778 if (code NEQ CSSI_CODE_NotPresent) pos += sprintf(g_sa+pos,"%d,",code); | |
3779 else pos += sprintf(g_sa+pos,","); | |
3780 if (index NEQ ACI_NumParmNotPresent) pos += sprintf(g_sa+pos,"%d,",index); | |
3781 else pos += sprintf(g_sa+pos,","); | |
3782 if (number) | |
3783 { | |
3784 pos += sprintf(g_sa+pos,"\"%s\",",number); | |
3785 if (type) | |
3786 pos += sprintf(g_sa+pos,"%d,",toa_merge(*type)); | |
3787 else | |
3788 pos += sprintf(g_sa+pos,"128,"); | |
3789 } | |
3790 else | |
3791 pos += sprintf(g_sa+pos,"\"\",128,"); | |
3792 | |
3793 if (subaddr) | |
3794 { | |
3795 pos += sprintf(g_sa+pos,"\"%s\",",subaddr); | |
3796 if (satype) | |
3797 pos += sprintf(g_sa+pos,"%d",tos_merge(*satype)); | |
3798 } | |
3799 | |
3800 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
3801 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3802 } | |
3803 } | |
3804 | |
3805 /* | |
3806 +--------------------------------------------------------------------+ | |
3807 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3808 | STATE : code ROUTINE : rCI_PlusCUSD | | |
3809 +--------------------------------------------------------------------+ | |
3810 | |
3811 PURPOSE : handles AT_PlusCUSD call back | |
3812 | |
3813 */ | |
3814 | |
3815 GLOBAL void rCI_PlusCUSD ( /*UBYTE srcId,*/ | |
3816 T_ACI_CUSD_MOD m, | |
3817 T_ACI_USSD_DATA *ussd, | |
3818 SHORT dcs) | |
3819 { | |
3820 UBYTE srcId = srcId_cb; | |
3821 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3822 | |
3823 TRACE_FUNCTION("rCI_PlusCUSD()"); | |
3824 | |
3825 src_params->curAtCmd = AT_CMD_NONE; | |
3826 | |
3827 if ( ati_user_output_cfg[srcId].CUSD_stat ) | |
3828 { | |
3829 if (ussd != NULL) | |
3830 { | |
3831 #ifdef FF_ATI_BAT | |
3832 rci_display_USSD( srcId, m, ussd->data, ussd->len, FALSE, dcs ); | |
3833 #else | |
3834 rci_display_USSD( srcId, m, ussd->data, ussd->len, CONVERT_STRING, dcs ); | |
3835 #endif | |
3836 } | |
3837 else | |
3838 { | |
3839 #ifdef FF_ATI_BAT | |
3840 rci_display_USSD( srcId, m, NULL, 0, FALSE, dcs ); | |
3841 #else | |
3842 rci_display_USSD( srcId, m, NULL, 0, CONVERT_STRING, dcs ); | |
3843 #endif | |
3844 } | |
3845 | |
3846 } | |
3847 } | |
3848 | |
3849 /* | |
3850 +--------------------------------------------------------------------+ | |
3851 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3852 | STATE : code ROUTINE : rCI_PlusCIMI | | |
3853 +--------------------------------------------------------------------+ | |
3854 | |
3855 PURPOSE : handles AT_PlusCIMI call back | |
3856 | |
3857 */ | |
3858 | |
3859 GLOBAL void rCI_PlusCIMI ( /*UBYTE srcId,*/ CHAR *imsi) | |
3860 { | |
3861 UBYTE srcId = srcId_cb; | |
3862 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3863 | |
3864 | |
3865 TRACE_FUNCTION("rCI_PlusCIMI()"); | |
3866 | |
3867 src_params->curAtCmd = AT_CMD_NONE; | |
3868 if (imsi) | |
3869 { | |
3870 sprintf(g_sa,"%s",imsi); | |
3871 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3872 } | |
3873 } | |
3874 | |
3875 /* | |
3876 +--------------------------------------------------------------------+ | |
3877 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3878 | STATE : code ROUTINE : rCI_PlusCNUM | | |
3879 +--------------------------------------------------------------------+ | |
3880 | |
3881 PURPOSE : handles AT_PlusCNUM call back | |
3882 | |
3883 */ | |
3884 | |
3885 GLOBAL void rCI_PlusCNUM ( /*UBYTE srcId,*/ T_ACI_CNUM_MSISDN *msisdn, | |
3886 UBYTE num ) | |
3887 { | |
3888 UBYTE count = 0; | |
3889 UBYTE i; | |
3890 T_ACI_RETURN ret; | |
3891 UBYTE srcId = srcId_cb; | |
3892 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3893 | |
3894 | |
3895 TRACE_FUNCTION("rCI_PlusCNUM()"); | |
3896 | |
3897 for ( i = 0; i < MAX_MSISDN; i++ ) | |
3898 { | |
3899 count += aci_writeCnumMsisdn ( srcId, &msisdn[i] ); | |
3900 } | |
3901 | |
3902 if ( count EQ MAX_MSISDN ) | |
3903 { | |
3904 ret = qAT_PlusCNUM ( srcId, CNUM_MOD_NextRead ) ; | |
3905 | |
3906 if ( ret EQ AT_EXCT ) | |
3907 { | |
3908 src_params->curAtCmd = AT_CMD_CNUM; | |
3909 } | |
3910 else if ( ret EQ AT_CMPL ) | |
3911 { | |
3912 src_params->curAtCmd = AT_CMD_NONE; | |
3913 cmdErrStr = NULL; | |
3914 } | |
3915 else | |
3916 { | |
3917 src_params->curAtCmd = AT_CMD_NONE; | |
3918 cmdErrStr = NULL; | |
3919 } | |
3920 } | |
3921 } | |
3922 | |
3923 /* | |
3924 +--------------------------------------------------------------------+ | |
3925 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3926 | STATE : code ROUTINE : rCI_PlusCPOL | | |
3927 +--------------------------------------------------------------------+ | |
3928 | |
3929 PURPOSE : handles AT_PlusCPOL call back | |
3930 | |
3931 */ | |
3932 GLOBAL void rCI_PlusCPOL ( /*UBYTE srcId,*/ SHORT startIdx, | |
3933 SHORT lastIdx, | |
3934 T_ACI_CPOL_OPDESC *operLst, | |
3935 SHORT usdNtry ) | |
3936 { | |
3937 UBYTE idx; | |
3938 BOOL loop; | |
3939 UBYTE srcId = srcId_cb; | |
3940 | |
3941 | |
3942 TRACE_FUNCTION("rCI_PlusCPOL()"); | |
3943 | |
3944 loop = TRUE; | |
3945 | |
3946 /* if oper list is present, reply to read command */ | |
3947 if( operLst ) | |
3948 { | |
3949 do | |
3950 { | |
3951 for( idx=0; idx < MAX_OPER; idx++ ) | |
3952 { | |
3953 if( operLst[idx].index EQ ACI_NumParmNotPresent ) | |
3954 { | |
3955 loop = FALSE; | |
3956 break; | |
3957 } | |
3958 sprintf(g_sa,"+CPOL: %d,%d,\"%s\"", operLst[idx].index, | |
3959 operLst[idx].format, | |
3960 operLst[idx].oper ); | |
3961 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3962 } | |
3963 | |
3964 if( lastIdx EQ ACI_NumParmNotPresent ) break; | |
3965 | |
3966 startIdx = lastIdx+1; | |
3967 | |
3968 #ifdef WIN32 | |
3969 if( qAT_PlusCPOL(srcId, startIdx, &lastIdx, operLst, | |
3970 cpolMode ) | |
3971 #else | |
3972 if( qAT_PlusCPOL(srcId, startIdx, &lastIdx, operLst, | |
3973 CPOL_MOD_NotPresent ) | |
3974 #endif | |
3975 EQ AT_FAIL OR !loop) | |
3976 break; | |
3977 | |
3978 } | |
3979 while( loop ); | |
3980 } | |
3981 /* else, reply to test command */ | |
3982 else | |
3983 { | |
3984 sprintf(g_sa,"+CPOL: (1-%d),(0-2)", lastIdx); | |
3985 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3986 } | |
3987 } | |
3988 | |
3989 /* | |
3990 +--------------------------------------------------------------------+ | |
3991 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
3992 | STATE : code ROUTINE : rCI_PlusCLAN | | |
3993 +--------------------------------------------------------------------+ | |
3994 | |
3995 PURPOSE : handles AT_PlusCLAN call back | |
3996 | |
3997 */ | |
3998 GLOBAL void rCI_PlusCLAN ( T_ACI_LAN_SUP *CLang) | |
3999 | |
4000 { | |
4001 UBYTE srcId = srcId_cb; | |
4002 | |
4003 TRACE_FUNCTION("rCI_PlusCLAN()"); | |
4004 | |
4005 sprintf(g_sa,"+CLAN: %s",CLang->str ); | |
4006 io_sendMessage(srcId,g_sa, ATI_NORMAL_OUTPUT); | |
4007 } | |
4008 | |
4009 /* | |
4010 +--------------------------------------------------------------------+ | |
4011 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4012 | STATE : code ROUTINE : rCI_PlusCLAE | | |
4013 +--------------------------------------------------------------------+ | |
4014 | |
4015 PURPOSE : handles AT_PlusCLAE call back | |
4016 | |
4017 */ | |
4018 GLOBAL void rCI_PlusCLAE (T_ACI_LAN_SUP *CLang) | |
4019 | |
4020 { | |
4021 UBYTE srcId = srcId_cb; | |
4022 | |
4023 TRACE_FUNCTION("rCI_PlusCLAE()"); | |
4024 | |
4025 sprintf(g_sa,"+CLAV: %s",CLang->str ); | |
4026 io_sendMessage(srcId,g_sa, ATI_NORMAL_OUTPUT); | |
4027 } | |
4028 | |
4029 /* | |
4030 +--------------------------------------------------------------------+ | |
4031 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4032 | STATE : code ROUTINE : rCI_PlusCCCM | | |
4033 +--------------------------------------------------------------------+ | |
4034 | |
4035 PURPOSE : handles AT_PlusCCCM call back | |
4036 | |
4037 */ | |
4038 | |
4039 GLOBAL void rCI_PlusCCCM ( /*UBYTE srcId,*/ LONG *ccm ) | |
4040 { | |
4041 static LONG oldCCM = 0; | |
4042 UBYTE srcId = srcId_cb; | |
4043 | |
4044 | |
4045 TRACE_FUNCTION("rCI_PlusCCCM()"); | |
4046 | |
4047 if( *ccm < oldCCM ) | |
4048 { | |
4049 allowCCCM = TRUE; | |
4050 callTime = 0; | |
4051 } | |
4052 | |
4053 if (ccm AND allowCCCM AND ati_user_output_cfg[srcId].CAOC_stat) | |
4054 { | |
4055 allowCCCM = FALSE; | |
4056 sprintf(g_sa,"+CCCM: \"%6X\"",*ccm); | |
4057 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4058 } | |
4059 } | |
4060 | |
4061 /* | |
4062 +--------------------------------------------------------------------+ | |
4063 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4064 | STATE : code ROUTINE : rCI_PlusCCWV | | |
4065 +--------------------------------------------------------------------+ | |
4066 | |
4067 PURPOSE : handles unsolicited result code +CCWV | |
4068 | |
4069 */ | |
4070 | |
4071 GLOBAL void rCI_PlusCCWV ( /*UBYTE srcId,*/ T_ACI_CCWV_CHRG charging ) | |
4072 { | |
4073 UBYTE srcId = srcId_cb; | |
4074 | |
4075 TRACE_FUNCTION("rCI_PlusCCWV()"); | |
4076 | |
4077 if ( charging NEQ CCWV_CHRG_NotPresent ) | |
4078 { | |
4079 ati_user_output_cfg[srcId].CCWV_charging = charging; | |
4080 } | |
4081 else | |
4082 { | |
4083 charging = ati_user_output_cfg[srcId].CCWV_charging; | |
4084 } | |
4085 | |
4086 if ( charging EQ CCWV_CHRG_Shortage AND | |
4087 ati_user_output_cfg[srcId].CCWE_stat EQ 1 /* AND | |
4088 ( | |
4089 io_getIoMode ( ) EQ IO_MODE_CMD OR | |
4090 io_getIoMode ( ) EQ IO_MODE_RUN | |
4091 ) */ | |
4092 ) | |
4093 { | |
4094 io_sendIndication(srcId, "+CCWV", ATI_NORMAL_OUTPUT); | |
4095 } | |
4096 } | |
4097 | |
4098 /* | |
4099 +--------------------------------------------------------------------+ | |
4100 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4101 | STATE : code ROUTINE : rCI_PercentCPI | | |
4102 +--------------------------------------------------------------------+ | |
4103 | |
4104 PURPOSE : handles AT_PercentCPI call back | |
4105 | |
4106 */ | |
4107 | |
4108 GLOBAL void rCI_PercentCPI ( /*UBYTE srcId,*/ SHORT cId, | |
4109 T_ACI_CPI_MSG msgType, | |
4110 T_ACI_CPI_IBT ibt, | |
4111 T_ACI_CPI_TCH tch, | |
4112 USHORT cause) | |
4113 { | |
4114 SHORT pos = 0; | |
4115 UBYTE srcId = srcId_cb; | |
4116 SHORT idx; | |
4117 T_ACI_CLCC_CALDESC *calLst; | |
4118 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
4119 USHORT lenCvtdAlpha; | |
4120 UBYTE type; | |
4121 | |
4122 TRACE_FUNCTION("rCI_PercentCPI()"); | |
4123 TRACE_EVENT_P1("msgType: %d", msgType); | |
4124 | |
4125 #ifdef ACI | |
4126 if (ibt NEQ CPI_IBT_NotPresent) | |
4127 ibt_params.ati_currIbt = ibt; | |
4128 | |
4129 if (tch NEQ CPI_TCH_NotPresent) | |
4130 ibt_params.ati_currTch = tch; | |
4131 #endif | |
4132 | |
4133 if ( (ati_user_output_cfg[srcId].CPI_stat > 0) ) | |
4134 { | |
4135 pos = sprintf(g_sa,"%s: ","%CPI"); | |
4136 | |
4137 if (cId NEQ ACI_NumParmNotPresent) | |
4138 pos += sprintf(g_sa+pos,"%d,",cId); | |
4139 else | |
4140 pos += sprintf(g_sa+pos,","); | |
4141 if (msgType NEQ CPI_MSG_NotPresent) | |
4142 pos += sprintf(g_sa+pos,"%d,",msgType); | |
4143 else | |
4144 pos += sprintf(g_sa+pos,","); | |
4145 if (ibt NEQ CPI_IBT_NotPresent) | |
4146 pos += sprintf(g_sa+pos,"%d,",ibt); | |
4147 else | |
4148 pos += sprintf(g_sa+pos,","); | |
4149 if (tch NEQ CPI_TCH_NotPresent) | |
4150 pos += sprintf(g_sa+pos,"%d",tch); | |
4151 else | |
4152 pos += sprintf(g_sa+pos,","); | |
4153 | |
4154 ACI_MALLOC (calLst, MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC)); | |
4155 if ((ati_user_output_cfg[srcId].CPI_stat > 1) AND | |
4156 (qAT_PlusCLCC(srcId, calLst) EQ AT_CMPL)) | |
4157 { | |
4158 | |
4159 | |
4160 for (idx = 0; idx < MAX_CALL_NR; idx++) | |
4161 { | |
4162 if( calLst[idx].idx EQ ACI_NumParmNotPresent ) | |
4163 { | |
4164 if (ati_user_output_cfg[srcId].CPI_stat > 2) | |
4165 { | |
4166 pos += sprintf(g_sa + pos,",,,,,"); | |
4167 } | |
4168 break; | |
4169 } | |
4170 else | |
4171 { | |
4172 if (calLst[idx].idx NEQ cId) | |
4173 { | |
4174 //continue; | |
4175 } | |
4176 else /* if (calLst[idx].idx NEQ cId) */ | |
4177 { | |
4178 if (calLst[idx].dir NEQ CLCC_DIR_NotPresent) | |
4179 pos += sprintf(g_sa+pos,",%d",calLst[idx].dir); | |
4180 else | |
4181 pos += sprintf(g_sa+pos,","); | |
4182 if (calLst[idx].mode NEQ CLCC_MODE_NotPresent) | |
4183 pos += sprintf(g_sa+pos,",%d",calLst[idx].mode); | |
4184 else | |
4185 pos += sprintf(g_sa+pos,","); | |
4186 if (calLst[idx].number[0] NEQ 0x0) | |
4187 { | |
4188 pos += sprintf(g_sa+pos,",\"%s\"",calLst[idx].number); | |
4189 if (calLst[idx].type.ton NEQ TON_NotPresent) | |
4190 { | |
4191 type = toa_merge(calLst[idx].type); | |
4192 pos += sprintf(g_sa+pos,",%d",(int)type); | |
4193 } | |
4194 else | |
4195 pos += sprintf(g_sa+pos,","); | |
4196 #ifdef NO_ASCIIZ | |
4197 if (calLst[idx].alpha.len NEQ 0x0) | |
4198 { | |
4199 pos += sprintf(g_sa+pos,","); | |
4200 utl_chsetFromGsm ( calLst[idx].alpha.data, | |
4201 calLst[idx].alpha.len, | |
4202 (UBYTE*)cvtdAlpha, | |
4203 sizeof(cvtdAlpha), | |
4204 &lenCvtdAlpha, | |
4205 GSM_ALPHA_Def ); | |
4206 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
4207 } | |
4208 #else /* #ifdef NO_ASCIIZ */ | |
4209 if (calLst[idx].alpha[0] NEQ 0x0) | |
4210 { | |
4211 pos += sprintf(g_sa+pos,","); | |
4212 utl_chsetFromGsm ( (UBYTE*)calLst[idx].alpha, | |
4213 0, | |
4214 (UBYTE*)cvtdAlpha, | |
4215 sizeof(cvtdAlpha), | |
4216 &lenCvtdAlpha, | |
4217 GSM_ALPHA_Int ); | |
4218 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
4219 } | |
4220 #endif /* #ifdef NO_ASCIIZ */ | |
4221 else if(ati_user_output_cfg[srcId].CPI_stat > 2) | |
4222 { | |
4223 pos += sprintf(g_sa + pos,","); | |
4224 } | |
4225 } /* if (calLst[idx].number[0] NEQ 0x0) */ | |
4226 else | |
4227 { | |
4228 pos += sprintf(g_sa + pos,",,,"); | |
4229 } | |
4230 break; | |
4231 } /* else of - if (calLst[idx].idx NEQ cId) */ | |
4232 | |
4233 } /* else of - if( calLst[idx].idx EQ ACI_NumParmNotPresent ) */ | |
4234 | |
4235 } /*for (idx = 0; idx < MAX_CALL_NR; idx++) */ | |
4236 | |
4237 | |
4238 if (ati_user_output_cfg[srcId].CPI_stat > 2) | |
4239 { | |
4240 if (ati_user_output_cfg[srcId].CPI_stat EQ 4) | |
4241 { | |
4242 pos += sprintf(g_sa + pos,",0x%4x", cause); | |
4243 } | |
4244 else | |
4245 { | |
4246 if(( GET_CAUSE_ORIGIN_ENTITY(cause) EQ CC_ORIGINATING_ENTITY AND | |
4247 GET_CAUSE_DEFBY(cause) EQ DEFBY_STD ) | |
4248 OR (cause EQ MNCC_CAUSE_REEST_STARTED OR cause EQ MNCC_CAUSE_REEST_FINISHED)) | |
4249 { | |
4250 TRACE_EVENT_P2("cause: %d pos: %d",cId, cause); | |
4251 pos += sprintf ( g_sa + pos,",%d", GET_CAUSE_VALUE(cause) ); | |
4252 } | |
4253 else | |
4254 { | |
4255 pos += sprintf(g_sa + pos,","); | |
4256 } | |
4257 } | |
4258 | |
4259 /* Report the the ALS bearer */ | |
4260 if(calLst[idx].class_type EQ CLCC_CLASS_Line2) | |
4261 { | |
4262 pos += sprintf ( g_sa + pos,",1"); | |
4263 } | |
4264 else | |
4265 { | |
4266 pos += sprintf ( g_sa + pos,",0"); | |
4267 } | |
4268 | |
4269 } | |
4270 | |
4271 | |
4272 }//if ( (ati_user_output_cfg[srcId].CPI_stat > 0) ) | |
4273 | |
4274 ACI_MFREE (calLst); | |
4275 ci_remTrailCom(g_sa, pos); | |
4276 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4277 } | |
4278 #ifdef ACI /* for ATI only version */ | |
4279 cmhMMI_handleAudioTone ( AT_CMD_NONE, RAT_CPI, msgType ); | |
4280 #endif | |
4281 } | |
4282 | |
4283 /* | |
4284 +--------------------------------------------------------------------+ | |
4285 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4286 | STATE : code ROUTINE : rCI_PercentCTYI | | |
4287 +--------------------------------------------------------------------+ | |
4288 | |
4289 PURPOSE : handles AT_PercentCTYI call back | |
4290 | |
4291 */ | |
4292 | |
4293 GLOBAL void rCI_PercentCTYI (T_ACI_CTTY_NEG neg, | |
4294 T_ACI_CTTY_TRX trx) | |
4295 { | |
4296 int pos = 0; | |
4297 | |
4298 TRACE_FUNCTION ("rCI_PercentCTYI()"); | |
4299 | |
4300 if (cmhPrm[srcId_cb].ccCmdPrm.CTTYmode EQ CTTY_MOD_Enable) | |
4301 { | |
4302 pos = sprintf (g_sa, "%s: %d", "%CTYI", (int)neg); | |
4303 | |
4304 if (trx NEQ CTTY_TRX_Unknown) | |
4305 pos += sprintf (g_sa + pos, ",%d", trx); | |
4306 | |
4307 io_sendMessage (srcId_cb, g_sa, ATI_NORMAL_OUTPUT); | |
4308 } | |
4309 } | |
4310 | |
4311 /* | |
4312 +--------------------------------------------------------------------+ | |
4313 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4314 | STATE : code ROUTINE : rCI_PercentCTV | | |
4315 +--------------------------------------------------------------------+ | |
4316 | |
4317 PURPOSE : handles AT_PercentCTV call back | |
4318 | |
4319 */ | |
4320 | |
4321 GLOBAL void rCI_PercentCTV ( /*UBYTE srcId*/ void ) | |
4322 { | |
4323 UBYTE srcId = srcId_cb; | |
4324 | |
4325 TRACE_FUNCTION("rCI_PercentCTV()"); | |
4326 | |
4327 callTime++; | |
4328 | |
4329 if( callTime EQ 10 ) | |
4330 { | |
4331 callTime = 0; | |
4332 allowCCCM = TRUE; | |
4333 } | |
4334 } | |
4335 | |
4336 /* | |
4337 +--------------------------------------------------------------------+ | |
4338 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4339 | STATE : code ROUTINE : sAT_URC | | |
4340 +--------------------------------------------------------------------+ | |
4341 | |
4342 PURPOSE : this function handles unsolicited result codes generated | |
4343 using the extension mechanism for unknown AT commands. | |
4344 | |
4345 */ | |
4346 | |
4347 GLOBAL T_ACI_RETURN sAT_URC ( CHAR * out ) | |
4348 { | |
4349 T_ACI_RETURN retCode = AT_FAIL; | |
4350 | |
4351 TRACE_FUNCTION("sAT_URC ()"); | |
4352 | |
4353 if (ati_get_mode( src_id_ext ) NEQ ATI_UNKN_MODE) /* Send only to "serial" sources, no SAT etc. */ | |
4354 { | |
4355 aci_sendPString( src_id_ext, out ); | |
4356 } | |
4357 | |
4358 return AT_CMPL; | |
4359 } | |
4360 | |
4361 /* | |
4362 +--------------------------------------------------------------------+ | |
4363 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4364 | STATE : code ROUTINE : sAT_FRI | | |
4365 +--------------------------------------------------------------------+ | |
4366 | |
4367 PURPOSE : this function handles final result codes generated | |
4368 using the extension mechanism for unknown AT commands. | |
4369 | |
4370 */ | |
4371 | |
4372 GLOBAL T_ACI_RETURN sAT_FRI ( USHORT cmdLen ) | |
4373 { | |
4374 T_ACI_RETURN rslt = AT_FAIL; | |
4375 UBYTE srcId = srcId_cb; | |
4376 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
4377 | |
4378 if ( src_params->curAtCmd EQ AT_CMD_EXT ) | |
4379 { | |
4380 rslt = AT_CMPL; | |
4381 } | |
4382 | |
4383 return ( rslt ); | |
4384 } | |
4385 | |
4386 | |
4387 /* | |
4388 +--------------------------------------------------------------------+ | |
4389 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4390 | STATE : code ROUTINE : rCI_PercentCCBS | | |
4391 +--------------------------------------------------------------------+ | |
4392 | |
4393 PURPOSE : handles rCI_PercentCCBS call back | |
4394 | |
4395 */ | |
4396 | |
4397 GLOBAL void rCI_PercentCCBS ( /*UBYTE srcId,*/ T_ACI_CCBS_IND ind, | |
4398 T_ACI_CCBS_STAT status, | |
4399 T_ACI_CCBS_SET *setting, | |
4400 BOOL intermediate_result ) | |
4401 { | |
4402 SHORT pos = 0; | |
4403 UBYTE srcId = srcId_cb; | |
4404 | |
4405 | |
4406 TRACE_FUNCTION("rCI_PercentCCBS()"); | |
4407 | |
4408 if ( at.flags.CCBS_stat OR | |
4409 ind EQ CCBS_IND_IrgtResult ) | |
4410 { | |
4411 pos=sprintf(g_sa,"%s: ","%CCBS"); | |
4412 | |
4413 /* 1st param */ | |
4414 switch(ind) | |
4415 { | |
4416 case(CCBS_IND_NotPresent): | |
4417 pos+=sprintf(g_sa+pos,","); | |
4418 break; | |
4419 | |
4420 case(CCBS_IND_IrgtResult): | |
4421 if(status NEQ CCBS_STAT_NotPresent) | |
4422 { | |
4423 pos+=sprintf(g_sa+pos,"%d,",ind); | |
4424 } | |
4425 break; | |
4426 | |
4427 default: | |
4428 pos+=sprintf(g_sa+pos,"%d,",ind); | |
4429 break; | |
4430 } | |
4431 | |
4432 if(setting EQ NULL) | |
4433 { | |
4434 /* do nothing: if later a parameter is added, extra commas may be needed...*/ | |
4435 } | |
4436 else | |
4437 { | |
4438 /* 2nd param: CCBS index */ | |
4439 if(setting->idx NEQ ACI_NumParmNotPresent) | |
4440 pos+=sprintf(g_sa+pos,"%d,",setting->idx); | |
4441 else | |
4442 pos+=sprintf(g_sa+pos,","); | |
4443 | |
4444 /* 3rd param: Number */ | |
4445 if (setting->number[0] NEQ 0x0 ) | |
4446 pos+=sprintf(g_sa+pos,"\"%s\",",setting->number); | |
4447 else | |
4448 pos+=sprintf(g_sa+pos,","); | |
4449 | |
4450 /* 4th param: Type of number */ | |
4451 if (setting->type.npi NEQ NPI_NotPresent ) | |
4452 pos+=sprintf(g_sa+pos,"%d,",toa_merge(setting->type)); | |
4453 else | |
4454 pos+=sprintf(g_sa+pos,","); | |
4455 | |
4456 /* 5th param: sub address */ | |
4457 if (setting->subaddr[0] NEQ 0x0 ) | |
4458 pos+=sprintf(g_sa+pos,"\"%s\",",setting->subaddr); | |
4459 else | |
4460 pos+=sprintf(g_sa+pos,","); | |
4461 | |
4462 /* 6th param: type of subaddress */ | |
4463 if (setting->satype.tos NEQ TOS_NotPresent ) | |
4464 pos+=sprintf(g_sa+pos,"%d,",tos_merge(setting->satype)); | |
4465 else | |
4466 pos+=sprintf(g_sa+pos,","); | |
4467 | |
4468 /* 7th param: CCBS class */ | |
4469 if (setting->class_type NEQ CLASS_NotPresent) | |
4470 pos+=sprintf(g_sa+pos,"%d,",setting->class_type); | |
4471 else | |
4472 pos+=sprintf(g_sa+pos,","); | |
4473 | |
4474 /* 8th param: ALPT */ | |
4475 if (setting->alrtPtn NEQ ALPT_NotPresent) | |
4476 pos+=sprintf(g_sa+pos,"%d",setting->alrtPtn); | |
4477 } | |
4478 | |
4479 ci_remTrailCom(g_sa, pos); | |
4480 | |
4481 if(intermediate_result) | |
4482 { | |
4483 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4484 } | |
4485 else | |
4486 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4487 | |
4488 } | |
4489 } | |
4490 | |
4491 /* | |
4492 +--------------------------------------------------------------------+ | |
4493 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4494 | STATE : code ROUTINE : rCI_sms_ready | | |
4495 +--------------------------------------------------------------------+ | |
4496 | |
4497 PURPOSE : handles AT_sms_ready call back | |
4498 | |
4499 */ | |
4500 | |
4501 GLOBAL void rCI_sms_ready ( /*UBYTE srcId*/ void ) | |
4502 { | |
4503 UBYTE srcId = srcId_cb; | |
4504 | |
4505 TRACE_FUNCTION("rCI_sms_ready()"); | |
4506 } | |
4507 | |
4508 /* | |
4509 +--------------------------------------------------------------------+ | |
4510 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4511 | STATE : code ROUTINE : rCI_phb_status | | |
4512 +--------------------------------------------------------------------+ | |
4513 | |
4514 PURPOSE : handles AT_phb_status call back | |
4515 | |
4516 */ | |
4517 | |
4518 GLOBAL void rCI_phb_status ( /*UBYTE srcId,*/ T_ACI_PB_STAT status ) | |
4519 { | |
4520 UBYTE srcId = srcId_cb; | |
4521 | |
4522 TRACE_FUNCTION("rCI_phb_status()"); | |
4523 | |
4524 } | |
4525 | |
4526 | |
4527 GLOBAL void rCI_PlusCMGD () | |
4528 { | |
4529 /* dummy function */ | |
4530 } | |
4531 | |
4532 | |
4533 /* | |
4534 +--------------------------------------------------------------------+ | |
4535 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4536 | STATE : code ROUTINE : aci_writeCnumMsisdn| | |
4537 +--------------------------------------------------------------------+ | |
4538 | |
4539 PURPOSE : This function writes the formatted string to AT command | |
4540 interface. | |
4541 */ | |
4542 LOCAL UBYTE aci_writeCnumMsisdn ( UBYTE srcId, T_ACI_CNUM_MSISDN* msisdn ) | |
4543 { | |
4544 USHORT pos = 0; | |
4545 | |
4546 #ifndef FF_ATI_BAT | |
4547 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
4548 USHORT lenCvtdAlpha; | |
4549 #endif | |
4550 | |
4551 TRACE_FUNCTION ("aci_writeCnumMsisdn()"); | |
4552 | |
4553 if ( msisdn -> vldFlag EQ FALSE ) | |
4554 { | |
4555 return 0; | |
4556 } | |
4557 | |
4558 pos = sprintf ( g_sa, "+CNUM: " ); | |
4559 | |
4560 /* | |
4561 *----------------------------------------------------------------- | |
4562 * process parameter <alpha> | |
4563 *----------------------------------------------------------------- | |
4564 */ | |
4565 | |
4566 if ( msisdn -> alpha[0] NEQ '\0' ) | |
4567 { | |
4568 #ifdef FF_ATI_BAT | |
4569 pos += sprints ( g_sa + pos, (char *)msisdn->alpha, (USHORT)strlen(msisdn->alpha) ); | |
4570 #else | |
4571 utl_chsetFromGsm((UBYTE*)msisdn->alpha, | |
4572 strlen(msisdn->alpha), | |
4573 (UBYTE*)cvtdAlpha, | |
4574 sizeof(cvtdAlpha), | |
4575 &lenCvtdAlpha, | |
4576 GSM_ALPHA_Int); | |
4577 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
4578 #endif | |
4579 } | |
4580 | |
4581 /* | |
4582 *----------------------------------------------------------------- | |
4583 * process parameter <number> and <type> | |
4584 *----------------------------------------------------------------- | |
4585 */ | |
4586 pos += sprintf ( g_sa + pos, ",\"%s\",%d", | |
4587 msisdn -> number, | |
4588 toa_merge ( msisdn -> type ) ); | |
4589 | |
4590 /* | |
4591 *----------------------------------------------------------------- | |
4592 * process parameter <speed> | |
4593 *----------------------------------------------------------------- | |
4594 */ | |
4595 if ( msisdn -> speed NEQ BS_SPEED_NotPresent ) | |
4596 { | |
4597 pos += sprintf ( g_sa + pos, ",%d", msisdn -> speed ); | |
4598 } | |
4599 else | |
4600 { | |
4601 pos += sprintf ( g_sa + pos, "," ); | |
4602 } | |
4603 | |
4604 /* | |
4605 *----------------------------------------------------------------- | |
4606 * process parameter <service> | |
4607 *----------------------------------------------------------------- | |
4608 */ | |
4609 if ( msisdn -> service NEQ CNUM_SERV_NotPresent ) | |
4610 { | |
4611 pos += sprintf ( g_sa + pos, ",%d", msisdn -> service ); | |
4612 } | |
4613 else | |
4614 { | |
4615 pos += sprintf ( g_sa + pos, "," ); | |
4616 } | |
4617 | |
4618 /* | |
4619 *----------------------------------------------------------------- | |
4620 * process parameter <itc> | |
4621 *----------------------------------------------------------------- | |
4622 */ | |
4623 if ( msisdn -> itc NEQ CNUM_ITC_NotPresent ) | |
4624 { | |
4625 pos += sprintf ( g_sa + pos, ",%d", msisdn -> itc ); | |
4626 } | |
4627 | |
4628 ci_remTrailCom ( g_sa, ( USHORT ) strlen ( g_sa ) ); | |
4629 | |
4630 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
4631 | |
4632 return 1; | |
4633 } | |
4634 | |
4635 /* | |
4636 +--------------------------------------------------------------------+ | |
4637 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4638 | STATE : code ROUTINE : rCI_PercentCNAP | | |
4639 +--------------------------------------------------------------------+ | |
4640 | |
4641 PURPOSE : handles rCI_PercentCNAP call back | |
4642 | |
4643 */ | |
4644 typedef enum | |
4645 { | |
4646 CNAP_PRES_ALLOWED = 0, | |
4647 CNAP_PRES_RESTRICTED, | |
4648 CNAP_NAME_UNAVAILABLE, | |
4649 CNAP_NAME_PRES_RESTRICTED | |
4650 } T_ATI_CNAP_PRESENTATION; | |
4651 | |
4652 LOCAL void send_cnap_name_information(UBYTE srcId, | |
4653 T_ATI_CNAP_PRESENTATION pres_mode, | |
4654 T_callingName *NameId) | |
4655 { | |
4656 T_namePresentationAllowed *cnap_name_info = NULL; | |
4657 UBYTE number_of_chars = 0; | |
4658 CHAR *cnap_name = NULL; | |
4659 int pos = 0; | |
4660 | |
4661 TRACE_FUNCTION("send_cnap_name_information()"); | |
4662 | |
4663 switch(pres_mode) | |
4664 { | |
4665 case(CNAP_PRES_ALLOWED): | |
4666 TRACE_EVENT("CNAP: name presentation is allowed"); | |
4667 cnap_name_info = &(NameId->namePresentationAllowed); | |
4668 break; | |
4669 | |
4670 case(CNAP_NAME_PRES_RESTRICTED): | |
4671 TRACE_EVENT("CNAP: name presentation is restricted"); | |
4672 cnap_name_info = &(NameId->namePresentationRestricted); | |
4673 break; | |
4674 | |
4675 default: | |
4676 TRACE_ERROR("CNAP: wrong presentation mode"); | |
4677 return; | |
4678 } | |
4679 if(cnap_name_info EQ NULL) | |
4680 { | |
4681 TRACE_ERROR("CNAP cnap_name_info is NULL"); | |
4682 return; | |
4683 } | |
4684 | |
4685 pos += sprintf(g_sa+pos,"%s%d,", "%CNAP: ", pres_mode); | |
4686 | |
4687 if(cnap_name_info->v_dataCodingScheme) | |
4688 { | |
4689 pos += sprintf(g_sa+pos,"%d,", cnap_name_info->dataCodingScheme); | |
4690 } | |
4691 if(cnap_name_info->v_lengthInCharacters) | |
4692 { | |
4693 number_of_chars = cnap_name_info->lengthInCharacters; | |
4694 pos += sprintf(g_sa+pos,"%d,", number_of_chars); | |
4695 number_of_chars = MINIMUM(number_of_chars, sizeof(g_sa)-(size_t)pos); | |
4696 } | |
4697 if(cnap_name_info->v_nameString AND | |
4698 number_of_chars NEQ 0) | |
4699 { | |
4700 ACI_MALLOC(cnap_name, number_of_chars+3); /* 1 char for \0 and 2 chars for " */ | |
4701 memcpy(cnap_name, &(cnap_name_info->nameString.b_nameString), number_of_chars); | |
4702 cnap_name[number_of_chars] = 0; /* Null terminated */ | |
4703 pos += sprintf(g_sa+pos,"\"%s\"", cnap_name); | |
4704 } | |
4705 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa)); | |
4706 | |
4707 io_sendIndication( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
4708 | |
4709 if(cnap_name NEQ NULL) | |
4710 { | |
4711 ACI_MFREE(cnap_name); | |
4712 } | |
4713 } | |
4714 | |
4715 LOCAL void unsolicited_rci_percent_cnap(UBYTE srcId, T_callingName *NameId) | |
4716 { | |
4717 TRACE_FUNCTION("unsolicited_rci_percent_cnap()"); | |
4718 | |
4719 if(ati_user_output_cfg[srcId].cnap_mode EQ CNAP_DISABLED) | |
4720 { | |
4721 TRACE_EVENT_P1("unsolicited message CNAP ignored: CNAP not enable for source: %d", srcId); | |
4722 return; | |
4723 } | |
4724 | |
4725 if(NameId->v_namePresentationAllowed) | |
4726 { | |
4727 send_cnap_name_information(srcId, CNAP_PRES_ALLOWED, NameId); | |
4728 return; | |
4729 } | |
4730 | |
4731 if(NameId->v_presentationRestricted) | |
4732 { | |
4733 sprintf(g_sa, "%s%d", "%CNAP: ", CNAP_PRES_RESTRICTED); | |
4734 io_sendIndication( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
4735 return; | |
4736 } | |
4737 | |
4738 if(NameId->v_nameUnavailable) | |
4739 { | |
4740 sprintf(g_sa, "%s%d", "%CNAP: ", CNAP_NAME_UNAVAILABLE); | |
4741 io_sendIndication( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
4742 return; | |
4743 } | |
4744 | |
4745 if(NameId->v_namePresentationRestricted) | |
4746 { | |
4747 send_cnap_name_information(srcId, CNAP_NAME_PRES_RESTRICTED, NameId); | |
4748 return; | |
4749 } | |
4750 } | |
4751 | |
4752 LOCAL void intermediate_result_rci_percent_cnap(UBYTE srcId, T_ACI_CNAP_STATUS status) | |
4753 { | |
4754 TRACE_FUNCTION("intermediate_result_rci_percent_cnap()"); | |
4755 | |
4756 sprintf(g_sa, "%s%d,%d", "%CNAP: ", ati_user_output_cfg[srcId].cnap_mode, status); | |
4757 io_sendMessage( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
4758 } | |
4759 | |
4760 GLOBAL void rCI_PercentCNAP ( T_callingName *NameId, T_ACI_CNAP_STATUS status ) | |
4761 { | |
4762 UBYTE srcId = srcId_cb; | |
4763 | |
4764 TRACE_FUNCTION("rCI_PercentCNAP()"); | |
4765 | |
4766 if(NameId NEQ NULL) | |
4767 { | |
4768 unsolicited_rci_percent_cnap(srcId, NameId); | |
4769 return; | |
4770 } | |
4771 | |
4772 if(status NEQ CNAP_SERVICE_STATUS_NOT_PRESENT) | |
4773 { | |
4774 intermediate_result_rci_percent_cnap(srcId, status); | |
4775 } | |
4776 } | |
4777 | |
4778 | |
4779 /* | |
4780 +--------------------------------------------------------------------+ | |
4781 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4782 | STATE : code ROUTINE : rCI_PlusCMS_Conc | | |
4783 +--------------------------------------------------------------------+ | |
4784 | |
4785 PURPOSE : handles new rCI_PlusCMS call back for concatenated SMS | |
4786 | |
4787 */ | |
4788 GLOBAL void rCI_PlusCMS_Conc ( T_ACI_AT_CMD cmdId, | |
4789 T_ACI_CMS_ERR err, | |
4790 T_EXT_CMS_ERROR *conc_error ) | |
4791 { | |
4792 TRACE_FUNCTION("rCI_PlusCMS_Conc()"); | |
4793 } | |
4794 | |
4795 | |
4796 /* | |
4797 +--------------------------------------------------------------------+ | |
4798 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4799 | STATE : code ROUTINE : rCI_SignalSMS | | |
4800 +--------------------------------------------------------------------+ | |
4801 | |
4802 PURPOSE : handles rCI_SignalSMS call back for concatenated SMS | |
4803 | |
4804 */ | |
4805 GLOBAL void rCI_SignalSMS ( UBYTE state ) | |
4806 { | |
4807 TRACE_FUNCTION("rCI_SignalSMS()"); | |
4808 } | |
4809 | |
4810 /* | |
4811 +--------------------------------------------------------------------+ | |
4812 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
4813 | STATE : code ROUTINE : rCI_PlusCIEV | | |
4814 +--------------------------------------------------------------------+ | |
4815 | |
4816 PURPOSE : handles rCI_SignalCIEV call back for signal strength | |
4817 and SIM-full indications | |
4818 | |
4819 */ | |
4820 GLOBAL void rCI_PlusCIEV ( T_ACI_MM_CIND_VAL_TYPE sCindValues, | |
4821 T_ACI_MM_CMER_VAL_TYPE sCmerSettings ) | |
4822 { | |
4823 CHAR* me = "+CIEV: "; | |
4824 SHORT pos = 0; | |
4825 | |
4826 UBYTE srcId = srcId_cb; | |
4827 T_ATI_IO_MODE sIoMode; | |
4828 char *acTempString = ""; | |
4829 UINT uiCount; | |
4830 | |
4831 TRACE_FUNCTION("rCI_PlusCIEV()"); | |
4832 | |
4833 pos = sprintf(g_sa,"%s",me); | |
4834 | |
4835 /* check settings in 'cmhCmdPrm' and depends on, send the indication or buffer it */ | |
4836 sIoMode = ati_get_mode(srcId_cb); | |
4837 if( sIoMode == ATI_UNKN_MODE ) | |
4838 { | |
4839 acTempString = "internal ACI error at rCI_PlusCIEV() ->> ATI unknown mode !!"; | |
4840 sprintf( g_sa+pos, "%s, 0", acTempString ); | |
4841 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4842 return; | |
4843 } | |
4844 if( (sIoMode == ATI_CMD_MODE) && | |
4845 (sCmerSettings.sCmerModeParam != CMER_MODE_INVALID) && /* 'invalid' == 'mode_0' */ | |
4846 (sCmerSettings.sCmerModeParam != CMER_MODE_0) ) | |
4847 /* ---------------------------------------------------------------------------------- */ | |
4848 { /* ----------- UART is in command mode --> send the +CIEV to terminal --------------- */ | |
4849 /* ---------------------------------------------------------------------------------- */ | |
4850 if( sCindValues.sCindSignalParam != CIND_SIGNAL_INDICATOR_INVALID ) | |
4851 { | |
4852 acTempString = "1"; /* the 'signal' indicator has the order number '1' in +CIND */ | |
4853 sprintf( g_sa+pos, "%s, %d", acTempString, sCindValues.sCindSignalParam ); | |
4854 } | |
4855 else | |
4856 { | |
4857 if( sCindValues.sCindSmsFullParam != CIND_SMSFULL_INDICATOR_INVALID ) | |
4858 { | |
4859 acTempString = "2"; /* the 'smsfull' indicator has the order number '2' in +CIND */ | |
4860 sprintf( g_sa+pos, "%s, %d", acTempString, sCindValues.sCindSmsFullParam ); | |
4861 } | |
4862 else | |
4863 { /* error!! --> no signal has to be send */ | |
4864 acTempString = "internal ACI error at rCI_PlusCIEV() !!"; | |
4865 sprintf( g_sa+pos, "%s, 0", acTempString); | |
4866 } | |
4867 } | |
4868 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
4869 } | |
4870 /* -------------------------------------------------------------------------------- */ | |
4871 else /* -- UART is in data mode or CMER-mode == '0' --> buffer the +CIEV if necessary -- */ | |
4872 { /* -------------------------------------------------------------------------------- */ | |
4873 if( sCmerSettings.sCmerModeParam != CMER_MODE_1 ) | |
4874 { /* discard message in case of MODE=='1' */ | |
4875 if( sCindValues.sCindSignalParam != CIND_SIGNAL_INDICATOR_INVALID ) | |
4876 { /* storing of SIGNAL Value */ | |
4877 if( asCievSignalBuf.uiLastIndex < CIEV_BUF_SIZE ) | |
4878 { /* free space in buffer -> store +CIEV indication for further purpose */ | |
4879 asCievSignalBuf.asBufferValues[asCievSignalBuf.uiLastIndex] = sCindValues.sCindSignalParam; | |
4880 asCievSignalBuf.uiLastIndex++; | |
4881 } | |
4882 else /* = buffer is full (uiLastIndex == CIEV_BUF_SIZE) = */ | |
4883 { /* -> drop the oldest one and try to store it again */ | |
4884 uiCount = 0; | |
4885 while( uiCount < (CIEV_BUF_SIZE-1) ) | |
4886 { /* drop the oldes one */ | |
4887 asCievSignalBuf.asBufferValues[uiCount] = asCievSignalBuf.asBufferValues[uiCount+1]; | |
4888 uiCount++; | |
4889 } | |
4890 asCievSignalBuf.asBufferValues[asCievSignalBuf.uiLastIndex-1] = sCindValues.sCindSignalParam; | |
4891 } | |
4892 } | |
4893 else | |
4894 { /* storing of SMS full Value */ | |
4895 if( asCievSmsFullBuf.uiLastIndex < CIEV_BUF_SIZE ) | |
4896 { /* free space in buffer -> store +CIEV indication for further purpose */ | |
4897 asCievSmsFullBuf.asBufferValues[asCievSmsFullBuf.uiLastIndex] = sCindValues.sCindSmsFullParam; | |
4898 asCievSmsFullBuf.uiLastIndex++; | |
4899 } | |
4900 else /* = buffer is full (uiLastIndex == CIEV_BUF_SIZE) = */ | |
4901 { /* -> drop the oldest one and try to store it again */ | |
4902 uiCount = 0; | |
4903 while( uiCount < (CIEV_BUF_SIZE-1) ) | |
4904 { /* drop the oldes one */ | |
4905 asCievSmsFullBuf.asBufferValues[uiCount] = asCievSmsFullBuf.asBufferValues[uiCount+1]; | |
4906 uiCount++; | |
4907 } | |
4908 asCievSmsFullBuf.asBufferValues[asCievSmsFullBuf.uiLastIndex-1] = sCindValues.sCindSmsFullParam; | |
4909 } | |
4910 } | |
4911 } | |
4912 } | |
4913 } | |
4914 | |
4915 | |
4916 /* | |
4917 +--------------------------------------------------------------------+ | |
4918 | PROJECT : GSM-PS (6147) MODULE : ACI_RET | | |
4919 | STATE : code ROUTINE : aci_frmtOutput | | |
4920 +--------------------------------------------------------------------+ | |
4921 | |
4922 PURPOSE : fills T_ACI_SM_DATA data structure for UD with UDHI | |
4923 */ | |
4924 LOCAL void aci_frmtOutput ( UBYTE fo, | |
4925 UBYTE dcs, | |
4926 T_ACI_SM_DATA *data ) | |
4927 { | |
4928 switch (fo & TP_MTI_MASK) | |
4929 { | |
4930 case TP_MTI_SMS_DELIVER: | |
4931 { | |
4932 T_TP_DELIVER *sms_deliver = (T_TP_DELIVER*)_decodedMsg; | |
4933 data->data[0] = sms_deliver->tp_udh_inc.tp_udh.c_data; | |
4934 memcpy(data->data+1, | |
4935 sms_deliver->tp_udh_inc.tp_udh.data, | |
4936 sms_deliver->tp_udh_inc.tp_udh.c_data); | |
4937 | |
4938 memcpy(data->data+sms_deliver->tp_udh_inc.tp_udh.c_data+1, | |
4939 sms_deliver->tp_udh_inc.data, | |
4940 sms_deliver->tp_udh_inc.c_data); | |
4941 | |
4942 /* | |
4943 data->len = sms_deliver->tp_udh_inc.tp_udh.c_data + | |
4944 sms_deliver->tp_udh_inc.c_data + 1; | |
4945 */ | |
4946 | |
4947 if (cmhSMS_getAlphabetPp (dcs) EQ 0) | |
4948 data->len = (sms_deliver->tp_udh_inc.length * 7 + 7)/8; | |
4949 else | |
4950 data->len = sms_deliver->tp_udh_inc.length; | |
4951 } | |
4952 break; | |
4953 | |
4954 case TP_MTI_SMS_SUBMIT: | |
4955 { | |
4956 T_TP_SUBMIT *sms_submit = (T_TP_SUBMIT*)_decodedMsg; | |
4957 data->data[0] = sms_submit->tp_udh_inc.tp_udh.c_data; | |
4958 memcpy(data->data+1, | |
4959 sms_submit->tp_udh_inc.tp_udh.data, | |
4960 sms_submit->tp_udh_inc.tp_udh.c_data); | |
4961 | |
4962 memcpy(data->data+sms_submit->tp_udh_inc.tp_udh.c_data+1, | |
4963 sms_submit->tp_udh_inc.data, | |
4964 sms_submit->tp_udh_inc.c_data); | |
4965 | |
4966 /* | |
4967 data->len = sms_submit->tp_udh_inc.tp_udh.c_data + | |
4968 sms_submit->tp_udh_inc.c_data + 1; | |
4969 */ | |
4970 | |
4971 if (cmhSMS_getAlphabetPp (dcs) EQ 0) | |
4972 data->len = (sms_submit->tp_udh_inc.length * 7 + 7)/8; | |
4973 else | |
4974 data->len = sms_submit->tp_udh_inc.length; | |
4975 } | |
4976 break; | |
4977 | |
4978 case TP_MTI_SMS_COMMAND: | |
4979 { | |
4980 T_TP_COMMAND *sms_command = (T_TP_COMMAND*)_decodedMsg; | |
4981 data->data[0] = sms_command->tp_cdh_inc.tp_udh.c_data; | |
4982 memcpy(data->data+1, | |
4983 sms_command->tp_cdh_inc.tp_udh.data, | |
4984 sms_command->tp_cdh_inc.tp_udh.c_data); | |
4985 | |
4986 memcpy(data->data+sms_command->tp_cdh_inc.tp_udh.c_data+1, | |
4987 sms_command->tp_cdh_inc.data, | |
4988 sms_command->tp_cdh_inc.c_data); | |
4989 | |
4990 /* | |
4991 data->len = sms_command->tp_cdh_inc.tp_udh.c_data + | |
4992 sms_command->tp_cdh_inc.c_data + 1; | |
4993 */ | |
4994 | |
4995 data->len = sms_command->tp_cdh_inc.c_data; | |
4996 } | |
4997 break; | |
4998 /* | |
4999 case TP_MTI_SMS_STATUS_REP: | |
5000 { | |
5001 T_TP_STATUS *sms_status = (T_TP_STATUS*)_decodedMsg; | |
5002 data->data[0] = sms_status->tp_udh_inc.tp_udh.c_data; | |
5003 memcpy(data->data+1, | |
5004 sms_status->tp_udh_inc.tp_udh.data, | |
5005 sms_status->tp_udh_inc.tp_udh.c_data); | |
5006 | |
5007 memcpy(data->data+sms_status->tp_udh_inc.tp_udh.c_data+1, | |
5008 sms_status->tp_udh_inc.data, | |
5009 sms_status->tp_udh_inc.c_data); | |
5010 | |
5011 data->len = sms_status->tp_udh_inc.tp_udh.c_data + | |
5012 sms_status->tp_udh_inc.c_data + 1; | |
5013 } | |
5014 break; | |
5015 */ | |
5016 default: | |
5017 data->data[0] = '\0'; | |
5018 data->len = 0; | |
5019 } | |
5020 } | |
5021 | |
5022 /* | |
5023 +--------------------------------------------------------------------+ | |
5024 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5025 | STATE : code ROUTINE : rCI_PercentCPRI | | |
5026 +--------------------------------------------------------------------+ | |
5027 | |
5028 PURPOSE : handles AT_PercentCPRI call back | |
5029 */ | |
5030 | |
5031 GLOBAL void rCI_PercentCPRI ( UBYTE gsm_ciph, UBYTE gprs_ciph ) | |
5032 { | |
5033 UBYTE srcId = srcId_cb; | |
5034 | |
5035 TRACE_FUNCTION("rCI_PLusCPRI()"); | |
5036 | |
5037 /* %CPRI notification is sent only to the source through which the status is enabled */ | |
5038 if (ati_user_output_cfg[srcId].CPRI_stat EQ CI_SHOW) | |
5039 { | |
5040 sprintf(g_sa, "%s: %d,%d", "%CPRI", gsm_ciph, gprs_ciph); | |
5041 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5042 } | |
5043 } | |
5044 | |
5045 /* | |
5046 +--------------------------------------------------------------------+ | |
5047 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5048 | STATE : code ROUTINE : rCI_PlusCTZR | | |
5049 +--------------------------------------------------------------------+ | |
5050 | |
5051 PURPOSE : handles AT_PlusCTZV call back. | |
5052 timezone is a range from -48..0..+48 and expresses the deviation | |
5053 from GMT in steps of 15 minutes. | |
5054 */ | |
5055 #ifdef FF_TIMEZONE | |
5056 GLOBAL void rCI_PlusCTZV ( S32 timezone ) | |
5057 { | |
5058 UBYTE srcId = srcId_cb; | |
5059 TRACE_FUNCTION("rCI_PlusCTZV()"); | |
5060 | |
5061 sprintf (g_sa, "%s\"%+02d\"", "+CTZV: ", timezone); | |
5062 | |
5063 /* Send response to AT interface */ | |
5064 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5065 } | |
5066 #else | |
5067 GLOBAL void rCI_PlusCTZV ( UBYTE* timezone ) | |
5068 { | |
5069 UBYTE srcId = srcId_cb; | |
5070 | |
5071 TRACE_FUNCTION("rCI_PlusCTZV()"); | |
5072 | |
5073 sprintf (g_sa, "%s%d", "+CTZV: ", *timezone); | |
5074 | |
5075 /* Send response to AT interface */ | |
5076 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5077 } | |
5078 #endif | |
5079 | |
5080 | |
5081 /* | |
5082 +--------------------------------------------------------------------+ | |
5083 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5084 | STATE : code ROUTINE : rCI_PercentCTZV | | |
5085 +--------------------------------------------------------------------+ | |
5086 | |
5087 PURPOSE : handles AT_PercentCTZV call back, the parameter mmr_info_ind | |
5088 includes time and time zone information. | |
5089 | |
5090 */ | |
5091 | |
5092 GLOBAL void rCI_PercentCTZV (T_MMR_INFO_IND *mmr_info_ind, S32 timezone) | |
5093 { | |
5094 UBYTE srcId = srcId_cb; | |
5095 | |
5096 TRACE_FUNCTION("rCI_PercentCTZV()"); | |
5097 | |
5098 /*Report the network time in time zone 0*/ | |
5099 sprintf (g_sa, "%s\"%02d/%02d/%02d,%02d:%02d:%02d%+02d\"", "%CTZV: ", | |
5100 mmr_info_ind->time.year, | |
5101 mmr_info_ind->time.month, | |
5102 mmr_info_ind->time.day, | |
5103 mmr_info_ind->time.hour, | |
5104 mmr_info_ind->time.minute, | |
5105 mmr_info_ind->time.second, | |
5106 timezone); | |
5107 | |
5108 /* Send response to AT interface */ | |
5109 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5110 } | |
5111 | |
5112 | |
5113 /* | |
5114 +--------------------------------------------------------------------+ | |
5115 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5116 | STATE : code ROUTINE : rCI_PercentCNIV | | |
5117 +--------------------------------------------------------------------+ | |
5118 | |
5119 PURPOSE : handles AT_PercentCNIV call back | |
5120 | |
5121 */ | |
5122 | |
5123 GLOBAL void rCI_PercentCNIV (T_MMR_INFO_IND *mmr_info_ind) | |
5124 { | |
5125 UBYTE srcId = srcId_cb; | |
5126 char buf1[33]; /* be prepared for 16 UCS2 full names */ | |
5127 char buf2[33]; /* be prepared for 16 UCS2 full names */ | |
5128 char plmn[7] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | |
5129 SHORT mcc = 0; | |
5130 SHORT mnc = 0; | |
5131 | |
5132 TRACE_FUNCTION("rCI_PercentCNIV()"); | |
5133 | |
5134 memset(buf1, 0, 33); | |
5135 memset(buf2, 0, 33); | |
5136 | |
5137 if (mmr_info_ind->plmn.v_plmn) | |
5138 { | |
5139 cmhMM_CnvrtPLMN2INT( mmr_info_ind->plmn.mcc, | |
5140 mmr_info_ind->plmn.mnc, | |
5141 &mcc, &mnc ); | |
5142 } | |
5143 | |
5144 /* build numeric plmn representation */ | |
5145 if ((mnc & 0x000F) EQ 0x000F) | |
5146 { | |
5147 sprintf (plmn, "\"%03X%02X\"", mcc, (mnc & 0x0FF0) >> 4); | |
5148 } | |
5149 else | |
5150 { | |
5151 sprintf (plmn, "\"%03X%03X\"", mcc, mnc); | |
5152 } | |
5153 | |
5154 if (mmr_info_ind->short_name.v_name AND /* short name only */ | |
5155 !mmr_info_ind->full_name.v_name) | |
5156 { | |
5157 strncpy (buf2, (char *)mmr_info_ind->short_name.text, mmr_info_ind->short_name.c_text); | |
5158 sprintf (g_sa, "%s\"\",\"%s\",%s", "%CNIV: ", buf2, plmn); | |
5159 } | |
5160 else | |
5161 if (!mmr_info_ind->short_name.v_name AND | |
5162 mmr_info_ind->full_name.v_name) /* full name only */ | |
5163 { | |
5164 strncpy (buf1, (char *)mmr_info_ind->full_name.text, mmr_info_ind->full_name.c_text); | |
5165 sprintf (g_sa, "%s\"%s\",\"\",%s", "%CNIV: ", buf1, plmn); | |
5166 } | |
5167 else | |
5168 if (mmr_info_ind->short_name.v_name AND /* both given */ | |
5169 mmr_info_ind->full_name.v_name) | |
5170 { | |
5171 strncpy (buf1, (char *)mmr_info_ind->full_name.text, mmr_info_ind->full_name.c_text); | |
5172 strncpy (buf2, (char *)mmr_info_ind->short_name.text, mmr_info_ind->short_name.c_text); | |
5173 sprintf (g_sa, "%s\"%s\",\"%s\",%s", "%CNIV: ", buf1, buf2, plmn); | |
5174 } | |
5175 else | |
5176 { | |
5177 TRACE_EVENT("rCI_PercentCNIV(): no network name given"); | |
5178 sprintf (g_sa, "%s\"\",\"\",%s", "%CNIV: ", plmn); | |
5179 } | |
5180 | |
5181 /* Send response to AT interface */ | |
5182 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5183 } | |
5184 | |
5185 | |
5186 /* | |
5187 +--------------------------------------------------------------------+ | |
5188 | PROJECT : GSM-PS (6147) MODULE : ACI_RET | | |
5189 | STATE : code ROUTINE : rCI_Z | | |
5190 +--------------------------------------------------------------------+ | |
5191 | |
5192 PURPOSE : RAT callback for ATZ, for abstraction of ATI and CMH. | |
5193 */ | |
5194 GLOBAL void rCI_Z ( void ) | |
5195 { | |
5196 UBYTE srcId = srcId_cb; | |
5197 | |
5198 ati_cmd_reset( srcId ); | |
5199 ati_zn_retrieve_params( srcId ); | |
5200 } | |
5201 | |
5202 #endif /* FF_ATI */ | |
5203 | |
5204 | |
5205 #if defined FF_EOTD | |
5206 /* | |
5207 +--------------------------------------------------------------------+ | |
5208 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5209 | STATE : code ROUTINE : rCI_PlusCLPS | | |
5210 +--------------------------------------------------------------------+ | |
5211 | |
5212 PURPOSE : handles AT_PlusCLPS call back | |
5213 */ | |
5214 | |
5215 GLOBAL void rCI_PlusCLPS ( UBYTE srcId, T_LOC_POS_DATA * p_aci_lc_data ) | |
5216 { | |
5217 TRACE_FUNCTION("rCI_PlusCLPS()"); | |
5218 | |
5219 io_sendIndication(srcId, "%CLPS:", ATI_NORMAL_OUTPUT); | |
5220 } | |
5221 #endif /* FF_EOTD */ | |
5222 | |
5223 /* | |
5224 +--------------------------------------------------------------------+ | |
5225 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5226 | STATE : code ROUTINE : rCI_PercentALS | | |
5227 +--------------------------------------------------------------------+ | |
5228 | |
5229 PURPOSE : handles AT_PlusALS call back | |
5230 */ | |
5231 | |
5232 GLOBAL void rCI_PercentALS ( T_ACI_ALS_MOD ALSmode ) | |
5233 { | |
5234 UBYTE srcId = srcId_cb; | |
5235 char *me = "%ALS"; | |
5236 | |
5237 TRACE_FUNCTION("rCI_PlusALS()"); | |
5238 | |
5239 if (ALSmode EQ ALS_MOD_SPEECH) | |
5240 sprintf(g_sa,"%s: (0)", me); | |
5241 if (ALSmode EQ ALS_MOD_AUX_SPEECH) | |
5242 sprintf(g_sa,"%s: (1)", me); | |
5243 if (ALSmode EQ (ALS_MOD_SPEECH | ALS_MOD_AUX_SPEECH)) | |
5244 sprintf(g_sa,"%s: (0,1)", me); | |
5245 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5246 } | |
5247 /* | |
5248 +--------------------------------------------------------------------+ | |
5249 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5250 | STATE : code ROUTINE : rCI_PercentRDL | | |
5251 +--------------------------------------------------------------------+ | |
5252 | |
5253 PURPOSE : handles AT%RDL call back | |
5254 */ | |
5255 GLOBAL void rCI_PercentRDL ( T_ACI_CC_REDIAL_STATE state ) | |
5256 { | |
5257 UBYTE srcId = srcId_cb; | |
5258 char *me = "%RDL:"; | |
5259 | |
5260 TRACE_FUNCTION("rCI_PercentRDL()"); | |
5261 | |
5262 if(rdlPrm.rdlModN EQ NOTIF_USER) | |
5263 { | |
5264 sprintf(g_sa,"%s %d",me,state); | |
5265 io_sendMessage(srcId, g_sa, ATI_INDICATION_OUTPUT); | |
5266 } | |
5267 } | |
5268 | |
5269 /* | |
5270 +--------------------------------------------------------------------+ | |
5271 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5272 | STATE : code ROUTINE : rCI_PercentRDLB | | |
5273 +--------------------------------------------------------------------+ | |
5274 | |
5275 PURPOSE : handles AT%RDLB call back | |
5276 */ | |
5277 GLOBAL void rCI_PercentRDLB ( T_ACI_CC_RDL_BLACKL_STATE state ) | |
5278 { | |
5279 UBYTE srcId = srcId_cb; | |
5280 | |
5281 TRACE_FUNCTION("rCI_PercentRDLB()"); | |
5282 | |
5283 if(rdlPrm.rdlBlN EQ NOTIF_USER) | |
5284 { | |
5285 sprintf(g_sa,"%s: %d","%RDLB",state); | |
5286 io_sendMessage(srcId, g_sa, ATI_INDICATION_OUTPUT); | |
5287 } | |
5288 } | |
5289 | |
5290 /* | |
5291 +--------------------------------------------------------------------+ | |
5292 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5293 | STATE : code ROUTINE : rCI_PercentCSTAT | | |
5294 +--------------------------------------------------------------------+ | |
5295 | |
5296 PURPOSE : handles rCI_PercentCSTAT call back | |
5297 | |
5298 */ | |
5299 GLOBAL void rCI_PercentCSTAT ( T_ACI_STATE_MSG msgType ) | |
5300 { | |
5301 SHORT pos = 0; | |
5302 UBYTE srcId = srcId_cb; | |
5303 | |
5304 TRACE_FUNCTION("rCI_PercentCSTAT()"); | |
5305 | |
5306 if (ati_user_output_cfg[srcId].CSTAT_stat == 1) | |
5307 { | |
5308 pos = sprintf(g_sa,"%s: ","%CSTAT"); | |
5309 | |
5310 switch(msgType.entityId) | |
5311 { | |
5312 case STATE_MSG_PBOOK: | |
5313 pos += sprintf(g_sa+pos,"PHB, %d",msgType.entityState); | |
5314 break; | |
5315 case STATE_MSG_SMS: | |
5316 pos += sprintf(g_sa+pos,"SMS, %d",msgType.entityState); | |
5317 break; | |
5318 case STATE_MSG_EONS: | |
5319 pos += sprintf(g_sa+pos,"EONS, %d",msgType.entityState); | |
5320 break; | |
5321 case STATE_MSG_RDY: | |
5322 pos += sprintf(g_sa+pos,"RDY, %d",msgType.entityState); | |
5323 break; | |
5324 default: | |
5325 return; | |
5326 } | |
5327 | |
5328 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5329 | |
5330 } | |
5331 | |
5332 } | |
5333 | |
5334 /* | |
5335 +------------------------------------------------------------------------+ | |
5336 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5337 | STATE : code ROUTINE : ati_printRemainFieElem | | |
5338 +------------------------------------------------------------------------+ | |
5339 | |
5340 PURPOSE : this function prints all remained FIE-elemnts onto terminal | |
5341 */ | |
5342 LOCAL void ati_printRemainFieElem( T_fac_inf *fie, | |
5343 UBYTE srcId ) | |
5344 { | |
5345 UBYTE uTotalCharCounter = 0; | |
5346 USHORT uLineCounter = 0; | |
5347 UBYTE const cuNbrOfMsgElem = fie->l_fac >> 3; | |
5348 | |
5349 TRACE_FUNCTION("ati_printRemainFieElem()"); | |
5350 | |
5351 /* print FIE elements */ | |
5352 while(uTotalCharCounter < cuNbrOfMsgElem) | |
5353 { | |
5354 uLineCounter += sprintf(g_sa+uLineCounter, "%02X", fie->fac[uTotalCharCounter++]); | |
5355 if ( uLineCounter > (MAX_CMD_LEN-((MAX_CMD_LEN*95)/100)) ) /* only 5% of g_sa buffer used */ | |
5356 { /* allows better sim test */ | |
5357 g_sa[++uLineCounter] = 0x00; /* terminate g_sa after last char */ | |
5358 #ifdef _SIMULATION_ | |
5359 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); /* and send the data in chunks with CRLF */ | |
5360 #else /* _SIMULATION_ */ | |
5361 io_sendMessage(srcId, g_sa, ATI_ECHO_OUTPUT); | |
5362 #endif | |
5363 uLineCounter=0; /* go to beginning of g_sa for next chunk */ | |
5364 } | |
5365 } | |
5366 g_sa[++uLineCounter] = 0x00; /* terminate g_sa after last char in last chunk */ | |
5367 #ifdef _SIMULATION_ | |
5368 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); /* and send the data in chunks with CRLF */ | |
5369 #else /* _SIMULATION_ */ | |
5370 io_sendMessage(srcId, g_sa, ATI_ECHO_OUTPUT); | |
5371 g_sa[0] = 0x0; /* print CR/LF after last chunk only on target */ | |
5372 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5373 #endif | |
5374 } | |
5375 | |
5376 /* | |
5377 +--------------------------------------------------------------------+ | |
5378 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5379 | STATE : code ROUTINE : rCI_PercentCCCN | | |
5380 +--------------------------------------------------------------------+ | |
5381 | |
5382 PURPOSE : handles unsolicited CC-network changes callback | |
5383 */ | |
5384 | |
5385 GLOBAL void rCI_PercentCCCN ( T_ACI_FAC_DIR tDirection, | |
5386 SHORT cId, | |
5387 T_fac_inf *fie ) | |
5388 { | |
5389 UBYTE srcId = srcId_cb; | |
5390 char *me = "%CCCN"; | |
5391 | |
5392 TRACE_FUNCTION("rCI_PercentCCCN()"); | |
5393 | |
5394 /* no output in case of empty FIE-string */ | |
5395 if( (fie->l_fac >> 3) EQ 0) | |
5396 { | |
5397 TRACE_FUNCTION("rCI_PercentCCCN() : Empty FIE-string"); | |
5398 return; | |
5399 } | |
5400 | |
5401 sprintf(g_sa, "%s: %d,%d,", me, tDirection, cId); /* Preamble */ | |
5402 | |
5403 #ifdef _SIMULATION_ /* 'ATI_ECHO_OUTPUT' doesn't work while Windows simulation */ | |
5404 io_sendMessage( srcId, g_sa, ATI_NORMAL_OUTPUT ); /* print preamble while SIM-test */ | |
5405 #else /* _SIMULATION_ */ | |
5406 io_sendMessage( srcId, g_sa, ATI_ECHO_OUTPUT ); /* print preamble to target */ | |
5407 #endif | |
5408 | |
5409 ati_printRemainFieElem( fie, srcId ); | |
5410 } | |
5411 | |
5412 | |
5413 /* | |
5414 +--------------------------------------------------------------------+ | |
5415 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5416 | STATE : code ROUTINE : rCI_PercentCSSN | | |
5417 +--------------------------------------------------------------------+ | |
5418 | |
5419 PURPOSE : handles unsolicited CC-network changes callback | |
5420 */ | |
5421 | |
5422 GLOBAL void rCI_PercentCSSN ( T_ACI_FAC_DIR tDirection, | |
5423 T_ACI_FAC_TRANS_TYPE tType, | |
5424 T_fac_inf *fie ) | |
5425 { | |
5426 UBYTE srcId = srcId_cb; | |
5427 char *me = "%CSSN"; | |
5428 | |
5429 TRACE_FUNCTION("rCI_PercentCSSN()"); | |
5430 | |
5431 /* no output in case of empty FIE-string */ | |
5432 if( (fie->l_fac >> 3) EQ 0) | |
5433 { | |
5434 TRACE_FUNCTION("rCI_PercentCSSN() : Empty FIE-string"); | |
5435 return; | |
5436 } | |
5437 | |
5438 sprintf(g_sa, "%s: %d,%d,", me, tDirection, tType); /* Preamble */ | |
5439 | |
5440 #ifdef _SIMULATION_ /* 'ATI_ECHO_OUTPUT' doesn't work while Windows simulation */ | |
5441 io_sendMessage( srcId, g_sa, ATI_NORMAL_OUTPUT); /* print preamble while SIM-test */ | |
5442 #else /* _SIMULATION_ */ | |
5443 io_sendMessage( srcId, g_sa, ATI_ECHO_OUTPUT ); /* print preamble to target */ | |
5444 #endif | |
5445 | |
5446 ati_printRemainFieElem( fie, srcId ); | |
5447 } | |
5448 | |
5449 /* | |
5450 +--------------------------------------------------------------------+ | |
5451 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5452 | STATE : code ROUTINE : rCI_PercentCPRSM | | |
5453 +--------------------------------------------------------------------+ | |
5454 | |
5455 PURPOSE : handles callback for %CPRSM? querying the SMS delivery status | |
5456 which can be either PAUSE or RESUME | |
5457 */ | |
5458 | |
5459 GLOBAL void rCI_PercentCPRSM ( T_ACI_CPRSM_MOD mode ) | |
5460 { | |
5461 UBYTE srcId = srcId_cb; | |
5462 char *me = "%CPRSM"; | |
5463 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
5464 | |
5465 TRACE_FUNCTION("rCI_PercentCPRSM()"); | |
5466 | |
5467 sprintf(g_sa,"%s: %d", me, mode); | |
5468 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5469 } | |
5470 | |
5471 /* | |
5472 +--------------------------------------------------------------------+ | |
5473 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5474 | STATE : code ROUTINE : rCI_PercentSIMEF | | |
5475 +--------------------------------------------------------------------+ | |
5476 | |
5477 PURPOSE : | |
5478 */ | |
5479 GLOBAL void rCI_PercentSIMEF( | |
5480 SHORT *ef, | |
5481 UBYTE count) | |
5482 { | |
5483 UBYTE srcId=srcId_cb; | |
5484 SHORT pos; | |
5485 UBYTE n; | |
5486 | |
5487 TRACE_FUNCTION("rCI_PercentSIMEF()"); | |
5488 | |
5489 pos=sprintf(g_sa,"%s: ","%SIMEF"); | |
5490 | |
5491 for (n=0;n<count;n++) | |
5492 { | |
5493 pos+=sprintf(g_sa+pos,"%04X",ef[n]); | |
5494 | |
5495 if (n NEQ count-1) | |
5496 *(g_sa+pos++)=','; | |
5497 } | |
5498 | |
5499 io_sendMessage(srcId,g_sa,ATI_NORMAL_OUTPUT); | |
5500 } | |
5501 | |
5502 /* | |
5503 +--------------------------------------------------------------------+ | |
5504 | PROJECT : GSM-PS (6147) MODULE : ACI_RET | | |
5505 | STATE : code ROUTINE : mfwExtOut | | |
5506 +--------------------------------------------------------------------+ | |
5507 | |
5508 PURPOSE : This function is used as a dummy to fullfill display | |
5509 driver calls. | |
5510 */ | |
5511 #ifndef MFW | |
5512 | |
5513 int mfwExtOut (char *cmd) | |
5514 { | |
5515 TRACE_FUNCTION ("mfwExtOut"); | |
5516 | |
5517 return 1; | |
5518 } | |
5519 | |
5520 #endif /* no MFW */ | |
5521 | |
5522 /* | |
5523 +--------------------------------------------------------------------+ | |
5524 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5525 | STATE : code ROUTINE : rCI_PercentCMGR | | |
5526 +--------------------------------------------------------------------+ | |
5527 | |
5528 PURPOSE : handles AT_PercentCMGR call back (Read Message) | |
5529 */ | |
5530 | |
5531 GLOBAL void rCI_PercentCMGR ( T_MNSMS_READ_CNF* mnsms_read_cnf, | |
5532 T_ACI_CMGR_CBM * cbm) | |
5533 | |
5534 { | |
5535 UBYTE msg_type; | |
5536 #if defined (SMS_PDU_SUPPORT) | |
5537 UBYTE srcId = srcId_cb; | |
5538 T_ACI_CMGF_MOD mode; | |
5539 | |
5540 | |
5541 /* | |
5542 * request current mode | |
5543 */ | |
5544 qAT_PlusCMGF(srcId, &mode); | |
5545 if (mode EQ 0) | |
5546 /* | |
5547 * handle PDU mode | |
5548 */ | |
5549 rCI_Plus_Percent_CMGRPdu (mnsms_read_cnf, AT_CMD_P_CMGR); | |
5550 else | |
5551 #endif | |
5552 /* | |
5553 * handle Text mode | |
5554 */ | |
5555 { | |
5556 /* querying the type of the SM */ | |
5557 cmhSMS_SMSQueryType (&mnsms_read_cnf->sms_sdu, &msg_type); | |
5558 | |
5559 if (msg_type EQ TP_MTI_SMS_STATUS_REP) | |
5560 rCI_Plus_Percent_CMGRTextSP (mnsms_read_cnf, AT_CMD_P_CMGR); | |
5561 else | |
5562 rCI_Plus_Percent_CMGRText (mnsms_read_cnf, cbm, AT_CMD_P_CMGR); | |
5563 } | |
5564 } | |
5565 | |
5566 /* | |
5567 +--------------------------------------------------------------------+ | |
5568 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
5569 | STATE : code ROUTINE : rCI_PercentCMGL | | |
5570 +--------------------------------------------------------------------+ | |
5571 | |
5572 PURPOSE : handles AT_PercentCMGL call back | |
5573 | |
5574 */ | |
5575 | |
5576 GLOBAL void rCI_PercentCMGL (T_MNSMS_READ_CNF *mnsms_read_cnf) | |
5577 { | |
5578 UBYTE msg_type; | |
5579 #if defined (SMS_PDU_SUPPORT) | |
5580 UBYTE srcId = srcId_cb; | |
5581 T_ACI_CMGF_MOD mode; | |
5582 | |
5583 /* | |
5584 * request current mode | |
5585 */ | |
5586 qAT_PlusCMGF(srcId, &mode); | |
5587 if (mode EQ 0) | |
5588 /* | |
5589 * handle PDU mode | |
5590 */ | |
5591 rCI_Plus_Percent_CMGLPdu (mnsms_read_cnf, AT_CMD_P_CMGL); | |
5592 else | |
5593 #endif | |
5594 /* | |
5595 * handle Text mode | |
5596 */ | |
5597 | |
5598 { | |
5599 /* querying the type of the SM */ | |
5600 cmhSMS_SMSQueryType (&mnsms_read_cnf->sms_sdu, &msg_type); | |
5601 | |
5602 if (msg_type EQ TP_MTI_SMS_STATUS_REP) | |
5603 rCI_Plus_Percent_CMGLTextSP (mnsms_read_cnf, AT_CMD_P_CMGL); | |
5604 else | |
5605 rCI_Plus_Percent_CMGLText (mnsms_read_cnf, AT_CMD_P_CMGL); | |
5606 } | |
5607 } | |
5608 | |
5609 LOCAL void rCI_Plus_Percent_CMGLTextSP (T_MNSMS_READ_CNF* mnsms_read_cnf, | |
5610 T_ACI_AT_CMD cmdId) | |
5611 { | |
5612 UBYTE srcId = srcId_cb; | |
5613 T_ACI_CDS_SM* p_st; | |
5614 SHORT pos = 0; | |
5615 CHAR* buf; | |
5616 T_MNSMS_STATUS_IND mnsms_status_ind; | |
5617 | |
5618 TRACE_FUNCTION("rCI_Plus_Percent_CMGLTextSP()"); | |
5619 | |
5620 /* is the SM already decoded ? */ | |
5621 if (smsShrdPrm.pDecMsg) | |
5622 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
5623 else | |
5624 { | |
5625 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CDS_SM) ); | |
5626 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
5627 memcpy (&mnsms_status_ind.sms_sdu, &mnsms_read_cnf->sms_sdu, | |
5628 sizeof (T_sms_sdu)); | |
5629 cmhSMS_cpyStatInd ( p_st, &mnsms_status_ind); | |
5630 } | |
5631 | |
5632 buf=sms_status(mnsms_read_cnf->status ); | |
5633 if (cmdId EQ AT_CMD_CMGL ) | |
5634 { | |
5635 pos = sprintf ( g_sa, "+CMGL: %d", mnsms_read_cnf->rec_num); | |
5636 } | |
5637 else | |
5638 { | |
5639 pos=sprintf (g_sa, " %s: %d", "%CMGL", mnsms_read_cnf->rec_num); | |
5640 } | |
5641 if ( buf ) | |
5642 { | |
5643 pos += sprintf ( g_sa + pos, ",\"%s\"", buf ); /* STATUS */ | |
5644 } | |
5645 else | |
5646 { | |
5647 pos += sprintf ( g_sa + pos, "," ); | |
5648 } | |
5649 pos+=sprintf(g_sa+pos,",%d,%d,",p_st->fo, p_st->msg_ref); | |
5650 if(strlen(p_st->addr)) | |
5651 pos+=sprintf(g_sa+pos,"\"%s\"",p_st->addr); | |
5652 else | |
5653 pos+=sprintf(g_sa+pos,","); | |
5654 if( (p_st->toa.ton NEQ TON_NotPresent) AND (p_st->toa.npi NEQ NPI_NotPresent) ) | |
5655 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_st->toa)); | |
5656 else | |
5657 pos+=sprintf(g_sa+pos,","); | |
5658 | |
5659 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
5660 p_st->vpabs_scts.year [0], p_st->vpabs_scts.year [1], | |
5661 p_st->vpabs_scts.month [0], p_st->vpabs_scts.month [1], | |
5662 p_st->vpabs_scts.day [0], p_st->vpabs_scts.day [1], | |
5663 p_st->vpabs_scts.hour [0], p_st->vpabs_scts.hour [1], | |
5664 p_st->vpabs_scts.minute[0], p_st->vpabs_scts.minute[1], | |
5665 p_st->vpabs_scts.second[0], p_st->vpabs_scts.second[1], | |
5666 p_st->vpabs_scts.timezone); | |
5667 | |
5668 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\",%d", | |
5669 p_st->vpabs_dt.year [0], p_st->vpabs_dt.year [1], | |
5670 p_st->vpabs_dt.month [0], p_st->vpabs_dt.month [1], | |
5671 p_st->vpabs_dt.day [0], p_st->vpabs_dt.day [1], | |
5672 p_st->vpabs_dt.hour [0], p_st->vpabs_dt.hour [1], | |
5673 p_st->vpabs_dt.minute[0], p_st->vpabs_dt.minute[1], | |
5674 p_st->vpabs_dt.second[0], p_st->vpabs_dt.second[1], | |
5675 p_st->vpabs_dt.timezone , p_st->tp_status); | |
5676 | |
5677 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5678 } | |
5679 | |
5680 LOCAL void rCI_Plus_Percent_CMGRTextSP (T_MNSMS_READ_CNF* mnsms_read_cnf, | |
5681 T_ACI_AT_CMD cmdId) | |
5682 { | |
5683 UBYTE srcId = srcId_cb; | |
5684 T_ACI_CDS_SM* p_st; | |
5685 SHORT pos = 0; | |
5686 CHAR* buf; | |
5687 T_MNSMS_STATUS_IND mnsms_status_ind; | |
5688 | |
5689 TRACE_FUNCTION("rCI_Plus_Percent_CMGRTextSP()"); | |
5690 | |
5691 /* is the SM already decoded ? */ | |
5692 if (smsShrdPrm.pDecMsg) | |
5693 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
5694 else | |
5695 { | |
5696 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CDS_SM) ); | |
5697 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
5698 memcpy (&mnsms_status_ind.sms_sdu, &mnsms_read_cnf->sms_sdu, | |
5699 sizeof (T_sms_sdu)); | |
5700 cmhSMS_cpyStatInd ( p_st, &mnsms_status_ind); | |
5701 } | |
5702 | |
5703 buf=sms_status(mnsms_read_cnf->status ); | |
5704 if (buf) /* STATUS */ | |
5705 { | |
5706 if (cmdId EQ AT_CMD_CMGR) | |
5707 { | |
5708 pos=sprintf(g_sa,"+CMGR: \"%s\"",buf); | |
5709 } | |
5710 else | |
5711 { | |
5712 pos=sprintf (g_sa, " %s: \"%s\"", "%CMGR", buf); | |
5713 } | |
5714 } | |
5715 else | |
5716 { | |
5717 if (cmdId EQ AT_CMD_CMGR) | |
5718 { | |
5719 pos=sprintf(g_sa,"+CMGR: ,"); | |
5720 } | |
5721 else | |
5722 { | |
5723 pos=sprintf (g_sa, " %s", "%CMGR: ,"); | |
5724 } | |
5725 } | |
5726 pos+=sprintf(g_sa+pos,",%d,%d,",p_st->fo, p_st->msg_ref); | |
5727 if(strlen(p_st->addr)) | |
5728 pos+=sprintf(g_sa+pos,"\"%s\"",p_st->addr); | |
5729 else | |
5730 pos+=sprintf(g_sa+pos,","); | |
5731 if( (p_st->toa.ton NEQ TON_NotPresent) AND (p_st->toa.npi NEQ NPI_NotPresent) ) | |
5732 pos+=sprintf(g_sa+pos,",%d",toa_merge(p_st->toa)); | |
5733 else | |
5734 pos+=sprintf(g_sa+pos,","); | |
5735 | |
5736 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
5737 p_st->vpabs_scts.year [0], p_st->vpabs_scts.year [1], | |
5738 p_st->vpabs_scts.month [0], p_st->vpabs_scts.month [1], | |
5739 p_st->vpabs_scts.day [0], p_st->vpabs_scts.day [1], | |
5740 p_st->vpabs_scts.hour [0], p_st->vpabs_scts.hour [1], | |
5741 p_st->vpabs_scts.minute[0], p_st->vpabs_scts.minute[1], | |
5742 p_st->vpabs_scts.second[0], p_st->vpabs_scts.second[1], | |
5743 p_st->vpabs_scts.timezone); | |
5744 | |
5745 pos+=sprintf(g_sa+pos,",\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\",%d", | |
5746 p_st->vpabs_dt.year [0], p_st->vpabs_dt.year [1], | |
5747 p_st->vpabs_dt.month [0], p_st->vpabs_dt.month [1], | |
5748 p_st->vpabs_dt.day [0], p_st->vpabs_dt.day [1], | |
5749 p_st->vpabs_dt.hour [0], p_st->vpabs_dt.hour [1], | |
5750 p_st->vpabs_dt.minute[0], p_st->vpabs_dt.minute[1], | |
5751 p_st->vpabs_dt.second[0], p_st->vpabs_dt.second[1], | |
5752 p_st->vpabs_dt.timezone , p_st->tp_status); | |
5753 | |
5754 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
5755 } | |
5756 | |
5757 #endif /* ATI_RET_C */ |