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