comparison src/g23m-aci/aci/ati_ret.c @ 1:fa8dc04885d8

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