FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/ati_sms.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
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: SMS related functions. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_SMS_C | |
22 #define ATI_SMS_C | |
23 | |
24 #undef DUMMY_ATI_STRINGS | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 #include "aci_cmh.h" | |
29 #include "ati_cmd.h" | |
30 #include "aci_io.h" | |
31 #include "aci_cmd.h" | |
32 #include "l4_tim.h" | |
33 | |
34 #include "aci_mem.h" | |
35 | |
36 #include "aci_lst.h" | |
37 #include "conc_sms.h" | |
38 #include "aci_prs.h" | |
39 | |
40 #include "ati_int.h" | |
41 | |
42 #include "cmh_sms.h" | |
43 #include "psa.h" | |
44 #include "psa_sms.h" | |
45 #include "aci.h" | |
46 | |
47 #ifdef FF_ATI_BAT | |
48 | |
49 #include "typedefs.h" | |
50 #include "gdd.h" | |
51 #include "bat.h" | |
52 | |
53 #include "ati_bat.h" | |
54 | |
55 #endif /*FF_ATI_BAT*/ | |
56 | |
57 //TISH modified for MSIM | |
58 #undef WIN32 | |
59 | |
60 EXTERN T_SMS_SHRD_PRM smsShrdPrm; | |
61 | |
62 const SMS_Memory sms_mem [] = | |
63 { | |
64 {"ME", SMS_STOR_Me}, | |
65 {"SM", SMS_STOR_Sm}, | |
66 {0,SMS_STOR_Me} | |
67 }; | |
68 | |
69 #if defined (SMS_PDU_SUPPORT) | |
70 LOCAL T_ATI_RSLT atPlusCMGSText (char *cl, UBYTE srcId); | |
71 LOCAL T_ATI_RSLT atPlusCMGWText (char *cl, UBYTE srcId); | |
72 LOCAL T_ATI_RSLT atPlusCMGCText (char *cl, UBYTE srcId); | |
73 LOCAL T_ATI_RSLT atPlusCNMAText (char *cl, UBYTE srcId); | |
74 #endif | |
75 | |
76 /* move the define into aci_cmd.h */ | |
77 | |
78 GLOBAL void cmd_clearCnmiBuf (void); | |
79 | |
80 LOCAL T_CNMI_BUFFER cnmiBuf; | |
81 GLOBAL BOOL cnmiFlushInProgress = FALSE; | |
82 GLOBAL S16 waitForCnmaFromBuffer_SrcId = CMD_SRC_NONE; | |
83 LOCAL CHAR daBuf[MAX_SMS_NUM_LEN*4]; /* multyply by 4 is required in case of UCS2 charecters */ | |
84 | |
85 EXTERN SHORT cmhSMS_getPrfRge ( void ); | |
86 EXTERN BOOL check_str(char * string,char * sample); | |
87 | |
88 #ifdef _SIMULATION_ | |
89 GLOBAL char subBuf[MAX_SUBADDR_LEN*4]; | |
90 #endif /* _SIMULATION_ */ | |
91 | |
92 GLOBAL SHORT toda_val; | |
93 GLOBAL SHORT fo, ct, pid, mn; | |
94 | |
95 GLOBAL UBYTE cpmsCallType = NONE_CALL; | |
96 | |
97 /* | |
98 * | |
99 ----------------------------SMS Commands----------------------------------- | |
100 * | |
101 */ | |
102 | |
103 /* | |
104 +--------------------------------------------------------------------+ | |
105 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
106 | STATE : code ROUTINE : atPlusCSMS | | |
107 +--------------------------------------------------------------------+ | |
108 | |
109 PURPOSE : +CSMS command (Select Message Service) | |
110 */ | |
111 | |
112 GLOBAL T_ATI_RSLT atPlusCSMS (char *cl, UBYTE srcId) | |
113 { | |
114 T_ACI_RETURN ret = AT_FAIL; | |
115 T_ACI_CSMS_SERV service; | |
116 | |
117 TRACE_FUNCTION("atPlusCSMS()"); | |
118 | |
119 /*input functionality*/ | |
120 cl = parse (cl,"d",&service); | |
121 if ( !cl ) | |
122 { | |
123 cmdCmsError(CMS_ERR_OpNotAllowed); | |
124 return (ATI_FAIL); | |
125 } | |
126 ret = sAT_PlusCSMS((T_ACI_CMD_SRC)srcId,service); | |
127 if (ret EQ AT_FAIL) | |
128 { | |
129 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
130 return (ATI_FAIL); | |
131 } | |
132 return (ATI_CMPL); | |
133 } | |
134 | |
135 GLOBAL T_ATI_RSLT queatPlusCSMS (char *cl, UBYTE srcId) | |
136 { | |
137 T_ACI_RETURN ret = AT_FAIL; | |
138 T_ACI_CSMS_SERV service; | |
139 T_ACI_CSMS_SUPP mt; | |
140 T_ACI_CSMS_SUPP mo; | |
141 T_ACI_CSMS_SUPP bm; | |
142 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
143 | |
144 | |
145 ret = qAT_PlusCSMS((T_ACI_CMD_SRC)srcId,&service,&mt,&mo,&bm); | |
146 if (ret EQ AT_CMPL) | |
147 { | |
148 sprintf(g_sa,"+CSMS: %d,%d,%d,%d",service,mt,mo,bm); | |
149 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
150 return (ATI_CMPL); | |
151 } | |
152 if (ret EQ AT_EXCT) | |
153 { | |
154 src_params->curAtCmd = AT_CMD_CSMS; | |
155 return (ATI_EXCT); | |
156 } | |
157 else | |
158 { | |
159 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
160 return (ATI_FAIL); | |
161 } | |
162 } | |
163 | |
164 /* | |
165 +--------------------------------------------------------------------+ | |
166 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
167 | STATE : code ROUTINE : atPlusCPMS | | |
168 +--------------------------------------------------------------------+ | |
169 | |
170 PURPOSE : +CPMS command (Select Preferred Message Storage) | |
171 */ | |
172 | |
173 GLOBAL T_ATI_RSLT atPlusCPMS (char *cl, UBYTE srcId) | |
174 { | |
175 CHAR memstr1[3] = {0}; | |
176 CHAR memstr2[3] = {0}; | |
177 CHAR memstr3[3] = {0}; | |
178 T_ACI_RETURN ret = AT_FAIL; | |
179 T_ACI_SMS_STOR_OCC mem1; | |
180 T_ACI_SMS_STOR_OCC mem2; | |
181 T_ACI_SMS_STOR_OCC mem3; | |
182 BOOL f1 = TRUE; | |
183 BOOL f2 = TRUE; | |
184 BOOL f3 = TRUE; | |
185 SHORT i; | |
186 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
187 | |
188 TRACE_FUNCTION("atPlusCPMS()"); | |
189 | |
190 mem1.mem = SMS_STOR_NotPresent; | |
191 mem2.mem = SMS_STOR_NotPresent; | |
192 mem3.mem = SMS_STOR_NotPresent; | |
193 | |
194 /*input functionality*/ | |
195 cl = parse ( cl, "sss", (LONG)3, memstr1, | |
196 (LONG)3, memstr2, | |
197 (LONG)3, memstr3 ); | |
198 | |
199 strupper ( memstr1 ); | |
200 strupper ( memstr2 ); | |
201 strupper ( memstr3 ); | |
202 | |
203 for ( i=0; sms_mem[i].name NEQ NULL; i++ ) | |
204 { | |
205 if ( ( strcmp ( sms_mem[i].name, memstr1 ) EQ 0 ) AND f1 ) | |
206 { | |
207 mem1.mem = sms_mem[i].stor; | |
208 f1 = FALSE; | |
209 } | |
210 | |
211 if ( ( strcmp ( sms_mem[i].name, memstr2 ) EQ 0 ) AND f2 ) | |
212 { | |
213 mem2.mem = sms_mem[i].stor; | |
214 f2 = FALSE; | |
215 } | |
216 | |
217 if ( ( strcmp ( sms_mem[i].name, memstr3 ) EQ 0 ) AND f3 ) | |
218 { | |
219 mem3.mem = sms_mem[i].stor; | |
220 f3 = FALSE; | |
221 } | |
222 } | |
223 | |
224 if (!cl OR f1 /*OR f2 OR f3*/ ) | |
225 { | |
226 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
227 return (ATI_FAIL); | |
228 } | |
229 | |
230 #ifdef FF_ATI_BAT | |
231 { | |
232 T_BAT_cmd_send cmd; | |
233 T_BAT_cmd_set_plus_cpms cpms; | |
234 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPMS; | |
235 cmd.params.ptr_set_plus_cpms = &cpms; | |
236 | |
237 cpms.mem1 = (T_BAT_plus_cpms_mem1)mem1.mem; | |
238 cpms.mem2 = (T_BAT_plus_cpms_mem2)mem2.mem; | |
239 cpms.mem3 = (T_BAT_plus_cpms_mem3)mem3.mem; | |
240 | |
241 TRACE_FUNCTION("atPlusCPMS() calls bat_send() <=== as APPLICATION"); | |
242 bat_send(ati_bat_get_client(srcId), &cmd); | |
243 | |
244 return (AT_EXCT); | |
245 } | |
246 #else /* FF_ATI_BAT */ | |
247 | |
248 ret = sAT_PlusCPMS ( (T_ACI_CMD_SRC)srcId, mem1.mem, mem2.mem, mem3.mem ); | |
249 | |
250 switch(ret) | |
251 { | |
252 case(AT_CMPL): | |
253 { | |
254 src_params->curAtCmd = AT_CMD_NONE; | |
255 return (ATI_CMPL); | |
256 } | |
257 default: | |
258 { | |
259 cmdCmsError (CMS_ERR_NotPresent); /* use aciErrDesc */ | |
260 return (ATI_FAIL); | |
261 } | |
262 } | |
263 #endif /* FF_ATI_BAT */ | |
264 } | |
265 | |
266 GLOBAL T_ATI_RSLT queatPlusCPMS (char *cl, UBYTE srcId) | |
267 { | |
268 T_ACI_RETURN ret; | |
269 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
270 | |
271 /*returns current Memory setting*/ | |
272 ret = qAT_PlusCPMS ((T_ACI_CMD_SRC)srcId ); | |
273 | |
274 if ( ret EQ AT_CMPL ) | |
275 { | |
276 src_params->curAtCmd = AT_CMD_NONE; | |
277 return (ATI_CMPL); | |
278 } | |
279 else if ( ret EQ AT_EXCT ) | |
280 { | |
281 src_params->curAtCmd = AT_CMD_CPMS; | |
282 return (ATI_EXCT); | |
283 } | |
284 else | |
285 { | |
286 cmdCmsError ( CMS_ERR_NotPresent); /* use aciErrDesc */ | |
287 return (ATI_FAIL); | |
288 } | |
289 } | |
290 | |
291 /* | |
292 +--------------------------------------------------------------------+ | |
293 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
294 | STATE : code ROUTINE : atPlusCMGF | | |
295 +--------------------------------------------------------------------+ | |
296 | |
297 PURPOSE : +CMGF command (Select Message Format) | |
298 */ | |
299 | |
300 GLOBAL T_ATI_RSLT atPlusCMGF (char *cl, UBYTE srcId) | |
301 { | |
302 T_ACI_RETURN ret = AT_FAIL; | |
303 T_ACI_CMGF_MOD mode=CMGF_MOD_NotPresent; | |
304 | |
305 TRACE_FUNCTION("atPlusCMGF()"); | |
306 | |
307 /* | |
308 * input functionality | |
309 */ | |
310 cl = parse(cl,"d",&mode); | |
311 if ( cl) | |
312 { | |
313 switch (mode) | |
314 { | |
315 case CMGF_MOD_Pdu: /* PDU mode */ | |
316 #if !defined (SMS_PDU_SUPPORT) | |
317 cmdCmsError(CMS_ERR_OpNotAllowed); | |
318 return (ATI_FAIL); | |
319 #else | |
320 break; | |
321 #endif | |
322 case CMGF_MOD_Txt: /* Text Mode */ | |
323 default: | |
324 break; | |
325 } | |
326 } | |
327 else | |
328 { | |
329 /* | |
330 * parse problems | |
331 */ | |
332 cmdCmsError(CMS_ERR_OpNotAllowed); | |
333 return (ATI_FAIL); | |
334 } | |
335 /* | |
336 * Parameter is allowed then set | |
337 */ | |
338 ret = sAT_PlusCMGF ((T_ACI_CMD_SRC)srcId,mode); | |
339 if (ret EQ AT_FAIL) | |
340 { | |
341 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
342 return (ATI_FAIL); | |
343 } | |
344 return (map_aci_2_ati_rslt(ret)); | |
345 } | |
346 | |
347 GLOBAL T_ATI_RSLT queatPlusCMGF (char *cl, UBYTE srcId) | |
348 { | |
349 char *me="+CMGF: "; | |
350 T_ACI_RETURN ret = AT_FAIL; | |
351 T_ACI_CMGF_MOD mode=CMGF_MOD_NotPresent; | |
352 | |
353 TRACE_FUNCTION("queatPlusCMGF()"); | |
354 | |
355 /* | |
356 * returns current message format PDU/TEXT | |
357 */ | |
358 ret = qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
359 if (ret EQ AT_CMPL) | |
360 { | |
361 sprintf(g_sa,"%s%d",me,mode); | |
362 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
363 return (ATI_CMPL); | |
364 } | |
365 else | |
366 { | |
367 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
368 return (ATI_FAIL); | |
369 } | |
370 } | |
371 | |
372 /* | |
373 +--------------------------------------------------------------------+ | |
374 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
375 | STATE : code ROUTINE : atPlusCSCA | | |
376 +--------------------------------------------------------------------+ | |
377 | |
378 PURPOSE : +CSCA command (Select Message Service Centre) | |
379 */ | |
380 | |
381 GLOBAL T_ATI_RSLT atPlusCSCA (char *cl, UBYTE srcId) | |
382 { | |
383 T_ACI_RETURN ret = AT_FAIL; | |
384 T_ACI_TOA tosca; | |
385 T_ACI_TOA *p_tosca; | |
386 SHORT octet=0; | |
387 CHAR sca[MAX_SMS_NUM_LEN]; | |
388 | |
389 memset (sca, 0, sizeof(sca)); | |
390 p_tosca=&tosca; | |
391 | |
392 TRACE_FUNCTION("atPlusCSCA()"); | |
393 | |
394 /*input functionality*/ | |
395 cl = parse (cl,"sr",(LONG)MAX_SMS_NUM_LEN,sca,&octet); | |
396 if ( !cl OR octet > 0xC9 OR sca[0] EQ '\0') | |
397 { | |
398 cmdCmsError(CMS_ERR_OpNotAllowed); | |
399 return (ATI_FAIL); | |
400 } | |
401 if(octet EQ 0) | |
402 p_tosca=NULL; | |
403 else | |
404 { | |
405 tosca=toa_demerge(octet); | |
406 if (tosca.ton < 0 OR tosca.npi < 0) | |
407 { | |
408 cmdCmsError(CMS_ERR_OpNotAllowed); | |
409 return (ATI_FAIL); | |
410 } | |
411 } | |
412 #ifdef FF_ATI_BAT | |
413 { | |
414 T_BAT_cmd_send cmd; | |
415 T_BAT_cmd_set_plus_csca csca; | |
416 | |
417 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSCA; | |
418 cmd.params.ptr_set_plus_csca = &csca; | |
419 | |
420 csca.c_sca = strlen(sca); | |
421 memcpy(csca.sca, sca, csca.c_sca); | |
422 csca.tosca = octet; | |
423 | |
424 TRACE_FUNCTION("atPlusCSCA() calls bat_send() <=== as APPLICATION"); | |
425 bat_send(ati_bat_get_client(srcId), &cmd); | |
426 | |
427 return (AT_EXCT); | |
428 } | |
429 #else /* FF_ATI_BAT */ | |
430 | |
431 ret = sAT_PlusCSCA((T_ACI_CMD_SRC)srcId,sca,p_tosca); | |
432 if (ret EQ AT_FAIL) | |
433 { | |
434 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
435 return (ATI_FAIL); | |
436 } | |
437 return (map_aci_2_ati_rslt(ret)); | |
438 #endif /* FF_ATI_BAT */ | |
439 } | |
440 | |
441 GLOBAL T_ATI_RSLT queatPlusCSCA (char *cl, UBYTE srcId) | |
442 { | |
443 #ifdef FF_ATI_BAT | |
444 T_BAT_cmd_send cmd; | |
445 T_BAT_no_parameter dummy; | |
446 | |
447 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CSCA; | |
448 dummy.bat_dummy = 0xFF; | |
449 cmd.params.ptr_que_plus_csca = &dummy; | |
450 | |
451 TRACE_FUNCTION("queatPlusCSCA() calls bat_send() <=== as APPLICATION"); | |
452 bat_send(ati_bat_get_client(srcId), &cmd); | |
453 | |
454 return (AT_EXCT); | |
455 | |
456 #else /* FF_ATI_BAT */ | |
457 | |
458 T_ACI_RETURN ret = AT_FAIL; | |
459 T_ACI_TOA tosca; | |
460 SHORT octet=0; | |
461 CHAR sca[MAX_SMS_NUM_LEN]; | |
462 | |
463 ret = qAT_PlusCSCA ((T_ACI_CMD_SRC)srcId,sca,&tosca); | |
464 if (ret EQ AT_CMPL) | |
465 { | |
466 octet=toa_merge(tosca); | |
467 sprintf(g_sa, "+CSCA: \"%s%s\",%d", (tosca.ton EQ TON_International)?"+":"", sca, octet); | |
468 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
469 return (ATI_CMPL); | |
470 } | |
471 else | |
472 { | |
473 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
474 return (ATI_FAIL); | |
475 } | |
476 #endif /* FF_ATI_BAT */ | |
477 } | |
478 | |
479 /* | |
480 +--------------------------------------------------------------------+ | |
481 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
482 | STATE : code ROUTINE : aci_decodeVpabs | | |
483 +--------------------------------------------------------------------+ | |
484 | |
485 PURPOSE : This function decodes a given string to the T_ACI_VP_ABS | |
486 enumeration type. | |
487 */ | |
488 LOCAL BOOL aci_decodeVpabs ( CHAR* vpabs_str, | |
489 T_ACI_VP_ABS* vpabs_enum ) | |
490 { | |
491 if ( strlen( vpabs_str ) NEQ 20 OR | |
492 | |
493 vpabs_str[2] NEQ '/' OR vpabs_str[5] NEQ '/' OR | |
494 vpabs_str[8] NEQ ',' OR vpabs_str[11] NEQ ':' OR | |
495 vpabs_str[14] NEQ ':' OR | |
496 | |
497 ( vpabs_str[17] NEQ '+' AND vpabs_str[17] NEQ '-' ) OR | |
498 | |
499 vpabs_str[18] < '0' OR vpabs_str[18] > '9' OR | |
500 vpabs_str[19] < '0' OR vpabs_str[19] > '9' ) | |
501 | |
502 return FALSE; | |
503 | |
504 vpabs_enum->year [0] = vpabs_str[0] - 0x30; | |
505 vpabs_enum->year [1] = vpabs_str[1] - 0x30; | |
506 | |
507 vpabs_enum->month [0] = vpabs_str[3] - 0x30; | |
508 vpabs_enum->month [1] = vpabs_str[4] - 0x30; | |
509 | |
510 vpabs_enum->day [0] = vpabs_str[6] - 0x30; | |
511 vpabs_enum->day [1] = vpabs_str[7] - 0x30; | |
512 | |
513 vpabs_enum->hour [0] = vpabs_str[9] - 0x30; | |
514 vpabs_enum->hour [1] = vpabs_str[10] - 0x30; | |
515 | |
516 vpabs_enum->minute[0] = vpabs_str[12] - 0x30; | |
517 vpabs_enum->minute[1] = vpabs_str[13] - 0x30; | |
518 | |
519 vpabs_enum->second[0] = vpabs_str[15] - 0x30; | |
520 vpabs_enum->second[1] = vpabs_str[16] - 0x30; | |
521 | |
522 vpabs_enum->timezone = (SHORT) atoi( &vpabs_str[17] ); | |
523 | |
524 return TRUE; | |
525 } | |
526 | |
527 /* | |
528 +--------------------------------------------------------------------+ | |
529 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
530 | STATE : code ROUTINE : aci_decodeVpenh | | |
531 +--------------------------------------------------------------------+ | |
532 | |
533 PURPOSE : This function decodes a given string to the T_ACI_VP_ENH | |
534 type. | |
535 */ | |
536 LOCAL BOOL aci_decodeVpenh ( CHAR* vpenh_str, | |
537 T_ACI_VP_ENH* vpenh ) | |
538 { | |
539 UBYTE shift_byte = 0; | |
540 | |
541 if (vpenh_str[0] EQ '\0') | |
542 { | |
543 return FALSE; | |
544 } | |
545 | |
546 /* functionality indicator */ | |
547 vpenh->func_ind = (vpenh_str[0] - 0x30) << 4; | |
548 vpenh->func_ind += (vpenh_str[1] - 0x30); | |
549 | |
550 /* extension octet */ | |
551 if (vpenh->func_ind & TP_VPF_ENH_EXT_BIT_MASK) | |
552 { | |
553 shift_byte = 2; | |
554 vpenh->ext_oct = (vpenh_str[2] - 0x30) << 4; | |
555 vpenh->ext_oct += (vpenh_str[3] - 0x30); | |
556 } | |
557 | |
558 if ((vpenh->func_ind & TP_VPF_ENH_FORMAT_MASK) > TP_VPF_ENH_HRS) | |
559 { | |
560 return FALSE; | |
561 } | |
562 | |
563 /* process validity period values */ | |
564 if ((vpenh->func_ind & TP_VPF_ENH_FORMAT_MASK) EQ TP_VPF_ENH_REL) | |
565 { | |
566 utl_HexStrToBin ((UBYTE*)&vpenh_str[2+shift_byte], 2, &vpenh->val.vpenh_relative, 1); | |
567 } | |
568 else if ((vpenh->func_ind & TP_VPF_ENH_FORMAT_MASK) EQ TP_VPF_ENH_SEC) | |
569 { | |
570 utl_HexStrToBin ((UBYTE*)&vpenh_str[2+shift_byte], 2, &vpenh->val.vpenh_seconds, 1); | |
571 } | |
572 else if ((vpenh->func_ind & TP_VPF_ENH_FORMAT_MASK) EQ TP_VPF_ENH_HRS) | |
573 { | |
574 vpenh->val.vpenh_hours.hour [0] = vpenh_str[3+shift_byte] - 0x30; | |
575 vpenh->val.vpenh_hours.hour [1] = vpenh_str[2+shift_byte] - 0x30; | |
576 | |
577 vpenh->val.vpenh_hours.minute[0] = vpenh_str[5+shift_byte] - 0x30; | |
578 vpenh->val.vpenh_hours.minute[1] = vpenh_str[4+shift_byte] - 0x30; | |
579 | |
580 vpenh->val.vpenh_hours.second[0] = vpenh_str[7+shift_byte] - 0x30; | |
581 vpenh->val.vpenh_hours.second[1] = vpenh_str[6+shift_byte] - 0x30; | |
582 } | |
583 | |
584 return TRUE; | |
585 } | |
586 | |
587 | |
588 /* | |
589 +--------------------------------------------------------------------+ | |
590 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
591 | STATE : code ROUTINE : atPlusCSMP | | |
592 +--------------------------------------------------------------------+ | |
593 | |
594 PURPOSE : +CSMP command (Select Text Mode Parameters) | |
595 */ | |
596 | |
597 GLOBAL T_ATI_RSLT atPlusCSMP (char *cl, UBYTE srcId) | |
598 { | |
599 T_ACI_RETURN ret = AT_FAIL; | |
600 SHORT fo = ACI_NumParmNotPresent, | |
601 vprel = ACI_NumParmNotPresent, | |
602 pid = ACI_NumParmNotPresent, | |
603 dcs = ACI_NumParmNotPresent; | |
604 USHORT i = 0; | |
605 char vpabs_str[25] = {'\0'}, | |
606 vpenh_str[15] = {'\0'}, | |
607 fo_str[4]; | |
608 | |
609 T_ACI_VP_ABS vpabs; | |
610 T_ACI_VP_ABS* pVpabs = NULL; | |
611 T_ACI_VP_ENH vpenh; | |
612 | |
613 TRACE_FUNCTION("atPlusCSMP()"); | |
614 | |
615 /*input functionality*/ | |
616 while (*cl NEQ ',' AND *cl NEQ '\0' AND i < sizeof(fo_str) - 1) | |
617 { | |
618 fo_str[i]=*cl; | |
619 cl++; | |
620 i++; | |
621 } | |
622 if (*cl) | |
623 { | |
624 cl++; | |
625 } | |
626 fo_str[i]='\0'; | |
627 if (strlen (fo_str) > 0) | |
628 { | |
629 fo=atoi(fo_str); | |
630 } | |
631 if (fo > 255) | |
632 { | |
633 cmdCmsError(CMS_ERR_OpNotAllowed); | |
634 return ATI_FAIL; | |
635 } | |
636 if (fo NEQ ACI_NumParmNotPresent AND | |
637 (fo & TP_VPF_MASK) EQ TP_VPF_ABSOLUTE) | |
638 { | |
639 pVpabs = &vpabs; | |
640 | |
641 cl = parse(cl,"srr",(LONG)25,vpabs_str,&pid,&dcs); | |
642 | |
643 if (!cl OR strlen(vpabs_str) > 20 OR pid > 255 OR | |
644 dcs > 255 OR !aci_decodeVpabs (vpabs_str, &vpabs)) | |
645 { | |
646 cmdCmsError(CMS_ERR_OpNotAllowed); | |
647 return (ATI_FAIL); | |
648 } | |
649 } | |
650 else if (fo NEQ ACI_NumParmNotPresent AND | |
651 (fo & TP_VPF_MASK) EQ TP_VPF_ENHANCED) | |
652 { | |
653 cl = parse(cl,"srr",(LONG)19,vpenh_str,&pid,&dcs); | |
654 if (!cl OR strlen(vpenh_str) > 14 OR pid > 255 OR | |
655 dcs > 255 OR !aci_decodeVpenh (vpenh_str, &vpenh)) | |
656 { | |
657 cmdCmsError(CMS_ERR_OpNotAllowed); | |
658 return (ATI_FAIL); | |
659 } | |
660 } | |
661 else if (fo NEQ ACI_NumParmNotPresent AND | |
662 (fo & TP_VPF_MASK) EQ TP_VPF_RELATIVE) | |
663 { | |
664 cl = parse(cl,"rrr",&vprel,&pid,&dcs); | |
665 } | |
666 else | |
667 { | |
668 if (*cl EQ '\"') | |
669 { | |
670 pVpabs = &vpabs; | |
671 | |
672 cl = parse(cl,"srr",(LONG)25,vpabs_str,&pid,&dcs); | |
673 | |
674 if (!cl OR strlen(vpabs_str) > 20 OR pid > 255 OR | |
675 dcs > 255 OR !aci_decodeVpabs (vpabs_str, &vpabs)) | |
676 { | |
677 cmdCmsError(CMS_ERR_OpNotAllowed); | |
678 return (ATI_FAIL); | |
679 } | |
680 } | |
681 else | |
682 { | |
683 cl = parse(cl,"rrr",&vprel,&pid,&dcs); | |
684 | |
685 if ( !cl OR vprel > 255 OR pid > 255 OR dcs > 255) | |
686 { | |
687 cmdCmsError(CMS_ERR_OpNotAllowed); | |
688 return (ATI_FAIL); | |
689 } | |
690 } | |
691 } | |
692 ret = sAT_PlusCSMP((T_ACI_CMD_SRC)srcId,fo,vprel,pVpabs,&vpenh,pid,dcs); | |
693 if (ret EQ AT_FAIL) | |
694 { | |
695 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
696 return (ATI_FAIL); | |
697 } | |
698 return (map_aci_2_ati_rslt(ret)); | |
699 } | |
700 | |
701 GLOBAL T_ATI_RSLT queatPlusCSMP (char *cl, UBYTE srcId) | |
702 { | |
703 char* me = "+CSMP: "; | |
704 T_ACI_RETURN ret = AT_FAIL; | |
705 SHORT fo = ACI_NumParmNotPresent, | |
706 vprel = ACI_NumParmNotPresent, | |
707 pid = ACI_NumParmNotPresent, | |
708 dcs = ACI_NumParmNotPresent; | |
709 char vpabs_str[25] = {'\0'}; | |
710 char vpenh_str[15] = {'\0'}; | |
711 T_ACI_VP_ABS vpabs; | |
712 T_ACI_VP_ENH vpenh; | |
713 | |
714 TRACE_FUNCTION("queatPlusCSMP()"); | |
715 | |
716 ret = qAT_PlusCSMP((T_ACI_CMD_SRC)srcId,&fo,&vprel,&vpabs,&vpenh,&pid,&dcs); | |
717 if (ret EQ AT_CMPL) | |
718 { | |
719 if ((fo & TP_VPF_MASK) EQ TP_VPF_ABSOLUTE) /*Bits 4,3 -> 11*/ | |
720 { | |
721 sprintf(vpabs_str,"\"%d%d/%d%d/%d%d,%d%d:%d%d:%d%d%+03d\"", | |
722 vpabs.year [0], vpabs.year [1], | |
723 vpabs.month [0], vpabs.month [1], | |
724 vpabs.day [0], vpabs.day [1], | |
725 vpabs.hour [0], vpabs.hour [1], | |
726 vpabs.minute[0], vpabs.minute[1], | |
727 vpabs.second[0], vpabs.second[1], | |
728 vpabs.timezone); | |
729 sprintf(g_sa,"%s%d,%s,%d,%d",me,fo,vpabs_str,pid,dcs); | |
730 } | |
731 else if ((fo & TP_VPF_MASK) EQ TP_VPF_ENHANCED) | |
732 { | |
733 aci_encodeVpenh ( vpenh_str, &vpenh ); | |
734 sprintf(g_sa,"%s%d,\"%s\",%d,%d",me,fo,vpenh_str,pid,dcs); | |
735 } | |
736 else if ((fo & TP_VPF_MASK) EQ TP_VPF_RELATIVE) /*Bits 4,3 -> 10*/ | |
737 { | |
738 sprintf(g_sa,"%s%d,%d,%d,%d",me,fo,vprel,pid,dcs); | |
739 } | |
740 else | |
741 { | |
742 sprintf(g_sa,"%s%d,,%d,%d",me,fo,pid,dcs); | |
743 } | |
744 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
745 return (ATI_CMPL); | |
746 } | |
747 else | |
748 { | |
749 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
750 return (ATI_FAIL); | |
751 } | |
752 } | |
753 | |
754 /* | |
755 +--------------------------------------------------------------------+ | |
756 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
757 | STATE : code ROUTINE : atPlusCSDH | | |
758 +--------------------------------------------------------------------+ | |
759 | |
760 PURPOSE : +CSDH command (Show Text Mode Parameters) | |
761 */ | |
762 | |
763 GLOBAL T_ATI_RSLT atPlusCSDH (char *cl, UBYTE srcId) | |
764 { | |
765 | |
766 T_ACI_CSDH_SHOW ena = CSDH_SHOW_Disable; | |
767 | |
768 TRACE_FUNCTION("atPlusCSDH()"); | |
769 | |
770 /*input functionality*/ | |
771 cl = parse(cl,"d",&ena); | |
772 if ( !cl ) | |
773 { | |
774 cmdCmsError(CMS_ERR_OpNotAllowed); | |
775 return (ATI_FAIL); | |
776 } | |
777 ati_user_output_cfg[srcId].CSDH_stat=ena; | |
778 return (ATI_CMPL); | |
779 } | |
780 | |
781 GLOBAL T_ATI_RSLT tesatPlusCSDH (char *cl, UBYTE srcId) | |
782 { | |
783 return(atPlusCSDH (cl, srcId)); | |
784 } | |
785 | |
786 GLOBAL T_ATI_RSLT queatPlusCSDH (char *cl, UBYTE srcId) | |
787 { | |
788 sprintf(g_sa,"+CSDH: %d",ati_user_output_cfg[srcId].CSDH_stat); | |
789 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
790 return (ATI_CMPL); | |
791 } | |
792 | |
793 /* | |
794 +--------------------------------------------------------------------+ | |
795 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
796 | STATE : code ROUTINE : atPlusCSCB | | |
797 +--------------------------------------------------------------------+ | |
798 | |
799 PURPOSE : +CSCB command (select cell broadcast message type) | |
800 */ | |
801 | |
802 GLOBAL T_ATI_RSLT atPlusCSCB (char *cl, UBYTE srcId) | |
803 { | |
804 T_ACI_RETURN ret = AT_FAIL; | |
805 T_ACI_CSCB_MOD mode; | |
806 char mids_str[6*MAX_CBM_TYPES]={0}; /* CHECK IF LONG ENOUGH !!*/ | |
807 char dcss_str[4*MAX_CBM_TYPES]={0}; | |
808 CHAR buf[6]={0}; | |
809 USHORT mids[MAX_CBM_TYPES]; | |
810 UBYTE dcss[MAX_CBM_TYPES]; | |
811 SHORT pos=0,i=0,j=0; | |
812 | |
813 #ifdef FF_ATI_BAT | |
814 T_BAT_cmd_set_plus_cscb cscb; | |
815 #endif | |
816 | |
817 | |
818 TRACE_FUNCTION("atPlusCSCB()"); | |
819 | |
820 /*input functionality*/ | |
821 cl = parse(cl,"dss",&mode,(LONG)sizeof(mids_str),mids_str,(LONG)sizeof(dcss_str),dcss_str); | |
822 if ( !cl ) | |
823 { | |
824 cmdCmsError(CMS_ERR_OpNotAllowed); | |
825 return (ATI_FAIL); | |
826 } | |
827 i = j = 0; | |
828 memset (mids, NOT_PRESENT_8BIT, sizeof (mids)); | |
829 while (mids_str[i] NEQ '\0' AND j < MAX_CBM_TYPES - 1) | |
830 { | |
831 pos=0; | |
832 while (mids_str[i] >= '0' AND mids_str[i] <= '9') | |
833 { | |
834 if (pos >= 5) | |
835 { | |
836 cmdCmsError(CMS_ERR_OpNotAllowed); | |
837 return (ATI_FAIL); | |
838 } | |
839 buf[pos++]=mids_str[i]; | |
840 i++; | |
841 } | |
842 buf[pos]='\0'; | |
843 if (mids_str[i] NEQ ',' AND mids_str[i] NEQ '-' AND mids_str[i] NEQ '\0') | |
844 { | |
845 cmdCmsError(CMS_ERR_OpNotAllowed); | |
846 return (ATI_FAIL); | |
847 } | |
848 else | |
849 { | |
850 if (mids_str[i] EQ ',' OR mids_str[i] EQ '\0') | |
851 { | |
852 i++; | |
853 mids[j++]=atoi(buf); | |
854 mids[j++]=atoi(buf); | |
855 } | |
856 else | |
857 { | |
858 i++; | |
859 mids[j++]=atoi(buf); | |
860 pos=0; | |
861 while (mids_str[i] NEQ ',' AND mids_str[i] NEQ '\0') | |
862 { | |
863 if (pos >= 5) | |
864 { | |
865 cmdCmsError(CMS_ERR_OpNotAllowed); | |
866 return (ATI_FAIL); | |
867 } | |
868 buf[pos++]=mids_str[i]; | |
869 i++; | |
870 } | |
871 i++; | |
872 mids[j++]=atoi(buf); | |
873 } | |
874 } | |
875 } | |
876 | |
877 if (compact(&mids_str[i],(USHORT)strlen(&mids_str[i])) NEQ 0) | |
878 { | |
879 cmdCmsError(CMS_ERR_OpNotAllowed); | |
880 return (ATI_FAIL); | |
881 } | |
882 | |
883 #ifdef FF_ATI_BAT | |
884 memset(cscb.mids, NOT_PRESENT_8BIT, sizeof(cscb.mids)); | |
885 cscb.v_mids = j ? TRUE : FALSE; | |
886 cscb.c_mids = (U8)j; | |
887 memcpy(cscb.mids, mids, j*2); | |
888 #endif | |
889 | |
890 i = j = 0; | |
891 memset (dcss, NOT_PRESENT_8BIT, sizeof (dcss)); | |
892 while (dcss_str[i] NEQ '\0' AND j < MAX_CBM_TYPES - 1) | |
893 { | |
894 pos=0; | |
895 while (dcss_str[i] >= '0' AND dcss_str[i] <= '9') | |
896 { | |
897 if (pos >= 3) | |
898 { | |
899 cmdCmsError(CMS_ERR_OpNotAllowed); | |
900 return (ATI_FAIL); | |
901 } | |
902 buf[pos++]=dcss_str[i]; | |
903 i++; | |
904 } | |
905 buf[pos]='\0'; | |
906 if (dcss_str[i] NEQ ',' AND dcss_str[i] NEQ '-' AND dcss_str[i] NEQ '\0') | |
907 { | |
908 cmdCmsError(CMS_ERR_OpNotAllowed); | |
909 return (ATI_FAIL); | |
910 } | |
911 else | |
912 { | |
913 if (dcss_str[i] EQ ',' OR dcss_str[i] EQ '\0') | |
914 { | |
915 i++; | |
916 dcss[j++]=atoi(buf); | |
917 dcss[j++]=atoi(buf); | |
918 } | |
919 else | |
920 { | |
921 i++; | |
922 dcss[j++]=atoi(buf); | |
923 pos=0; | |
924 while (dcss_str[i] NEQ ',' AND dcss_str[i] NEQ '\0') | |
925 { | |
926 if (pos >= 3) | |
927 { | |
928 cmdCmsError(CMS_ERR_OpNotAllowed); | |
929 return (ATI_FAIL); | |
930 } | |
931 buf[pos++]=dcss_str[i]; | |
932 i++; | |
933 } | |
934 i++; | |
935 dcss[j++]=atoi(buf); | |
936 } | |
937 } | |
938 } | |
939 if (compact(&dcss_str[i],(USHORT)strlen(&dcss_str[i])) NEQ 0) | |
940 { | |
941 cmdCmsError(CMS_ERR_OpNotAllowed); | |
942 return (ATI_FAIL); | |
943 } | |
944 | |
945 #ifdef FF_ATI_BAT | |
946 { | |
947 T_BAT_cmd_send cmd; | |
948 | |
949 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSCB; | |
950 cmd.params.ptr_set_plus_cscb = &cscb; | |
951 | |
952 cscb.mode = (T_BAT_VAL_plus_cscb_mode)mode; | |
953 | |
954 memset(cscb.dcss, NOT_PRESENT_8BIT, sizeof(cscb.dcss)); | |
955 cscb.v_dcss = j ? TRUE : FALSE;; | |
956 cscb.c_dcss = (U8)j; | |
957 memcpy(cscb.dcss, dcss, cscb.c_dcss); | |
958 | |
959 | |
960 TRACE_FUNCTION("atPlusCSCB() calls bat_send() <=== as APPLICATION"); | |
961 bat_send(ati_bat_get_client(srcId), &cmd); | |
962 return (AT_EXCT); | |
963 } | |
964 #else /* FF_ATI_BAT */ | |
965 ret=sAT_PlusCSCB((T_ACI_CMD_SRC)srcId,mode,mids,dcss); | |
966 if (ret EQ AT_FAIL) | |
967 { | |
968 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
969 return (ATI_FAIL); | |
970 } | |
971 return (map_aci_2_ati_rslt(ret)); | |
972 #endif /* FF_ATI_BAT */ | |
973 } | |
974 | |
975 GLOBAL T_ATI_RSLT queatPlusCSCB (char *cl, UBYTE srcId) | |
976 { | |
977 #ifdef FF_ATI_BAT | |
978 T_BAT_cmd_send cmd; | |
979 T_BAT_no_parameter dummy; | |
980 | |
981 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CSCB; | |
982 dummy.bat_dummy = 0xFF; | |
983 cmd.params.ptr_que_plus_cscb = &dummy; | |
984 | |
985 TRACE_FUNCTION("queatPlusCSCB() calls bat_send() <=== as APPLICATION"); | |
986 bat_send(ati_bat_get_client(srcId), &cmd); | |
987 | |
988 return (AT_EXCT); | |
989 | |
990 #else /* FF_ATI_BAT */ | |
991 T_ACI_CSCB_MOD mode; | |
992 char mids_str[6*MAX_CBM_TYPES+1]={'\0'}; /* +1 for '\0' */ /* CHECK IF LONG ENOUGH !!*/ | |
993 char dcss_str[4*MAX_CBM_TYPES+1]={'\0'}; | |
994 USHORT mids[MAX_CBM_TYPES]; | |
995 UBYTE dcss[MAX_CBM_TYPES]; | |
996 SHORT pos=0,i=0; | |
997 T_ACI_RETURN ret = AT_FAIL; | |
998 | |
999 TRACE_FUNCTION("queatPlusCSCB()"); | |
1000 | |
1001 ret = qAT_PlusCSCB((T_ACI_CMD_SRC)srcId, &mode,mids,dcss); | |
1002 if (ret EQ AT_CMPL) | |
1003 { | |
1004 /* | |
1005 *----------------------------------------------------------- | |
1006 * assemble the string for message identifiers | |
1007 *----------------------------------------------------------- | |
1008 */ | |
1009 pos = i = 0; | |
1010 while( mids[i] NEQ 0xFFFF AND | |
1011 mids[i+1] NEQ 0xFFFF AND | |
1012 i < MAX_CBM_TYPES - 1 ) | |
1013 { | |
1014 if ( mids[i] EQ mids[i+1] ) | |
1015 pos += sprintf ( mids_str + pos, "%d,", mids[i] ); | |
1016 else | |
1017 pos += sprintf ( mids_str + pos, "%d-%d,", mids[i], mids[i+1] ); /* "65534-65535," max 12 chars */ | |
1018 | |
1019 i += 2; | |
1020 } | |
1021 | |
1022 /*lint -e(661) -e(662) */ /* lint 7.5 has here some problems ... */ | |
1023 if ( pos > 0 ) /* remove the last ',' */ | |
1024 { | |
1025 mids_str[pos-1] = '\0'; | |
1026 } | |
1027 | |
1028 /* | |
1029 *----------------------------------------------------------- | |
1030 * assemble the string for data coding schemes | |
1031 *----------------------------------------------------------- | |
1032 */ | |
1033 pos = i = 0; | |
1034 while( dcss[i] NEQ 0xFF AND | |
1035 dcss[i+1] NEQ 0xFF AND | |
1036 i < MAX_CBM_TYPES - 1 ) | |
1037 { | |
1038 if ( dcss[i] EQ dcss[i+1] ) | |
1039 pos += sprintf ( dcss_str + pos, "%d,", dcss[i] ); | |
1040 else | |
1041 pos += sprintf ( dcss_str + pos, "%d-%d,", dcss[i], dcss[i+1] ); | |
1042 | |
1043 i += 2; | |
1044 } | |
1045 | |
1046 /*lint -e(661) -e(662) */ | |
1047 if ( pos > 0 ) /* remove the last ',' */ | |
1048 { | |
1049 dcss_str[pos-1] = '\0'; | |
1050 } | |
1051 | |
1052 sprintf(g_sa,"+CSCB: %d,\"%s\",\"%s\"",mode,mids_str,dcss_str); | |
1053 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1054 return (ATI_CMPL); | |
1055 } | |
1056 else | |
1057 { | |
1058 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1059 return (ATI_FAIL); | |
1060 } | |
1061 #endif /* FF_ATI_BAT */ | |
1062 } | |
1063 | |
1064 #ifdef FF_HOMEZONE | |
1065 /* | |
1066 +--------------------------------------------------------------------+ | |
1067 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1068 | STATE : code ROUTINE : atPercentCBHZ | | |
1069 +--------------------------------------------------------------------+ | |
1070 | |
1071 PURPOSE : %CBHZ command (set homezone activity) | |
1072 */ | |
1073 | |
1074 GLOBAL T_ATI_RSLT setatPercentCBHZ (char *cl, UBYTE srcId) | |
1075 { | |
1076 T_ACI_CBHZ_MOD mode = CBHZ_MOD_NotPresent; | |
1077 T_ACI_CS dcs = CS_NotPresent; | |
1078 UBYTE timeout = NOT_PRESENT_8BIT; | |
1079 T_ACI_RETURN ret = AT_FAIL; | |
1080 | |
1081 TRACE_FUNCTION("setatPercentCBHZ()"); | |
1082 | |
1083 | |
1084 /*input functionality*/ | |
1085 | |
1086 /*check first parameter */ | |
1087 switch (*cl) | |
1088 { | |
1089 case '0': | |
1090 case '1': | |
1091 mode = (T_ACI_CBHZ_MOD)(*cl - 0x30); | |
1092 cl++; | |
1093 break; | |
1094 | |
1095 default: | |
1096 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1097 return (ATI_FAIL); | |
1098 } | |
1099 | |
1100 /* check second parameter */ | |
1101 if ( *cl NEQ '\0' ) | |
1102 { | |
1103 if ( *cl NEQ ',') | |
1104 { | |
1105 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1106 return (ATI_FAIL); | |
1107 } | |
1108 cl++; | |
1109 | |
1110 if ( (*cl >= '0') AND (*cl <= '9') ) | |
1111 { | |
1112 dcs = (T_ACI_CS)(*cl -0x30); | |
1113 cl++; | |
1114 } | |
1115 | |
1116 /* check third parameter */ | |
1117 if ( *cl NEQ '\0' ) | |
1118 { | |
1119 if ( *cl NEQ ',') | |
1120 { | |
1121 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1122 return (ATI_FAIL); | |
1123 } | |
1124 cl++; | |
1125 | |
1126 cl = parse(cl,"d",&timeout); | |
1127 if ( *cl NEQ '\0' ) | |
1128 { | |
1129 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1130 return (ATI_FAIL); | |
1131 } | |
1132 } | |
1133 } | |
1134 | |
1135 /* parameters ok... process homezone request */ | |
1136 ret = sAT_PercentCBHZ((T_ACI_CMD_SRC)srcId,mode,dcs,timeout); | |
1137 if (ret EQ AT_FAIL) | |
1138 { | |
1139 cmdCmeError(CME_ERR_Unknown); | |
1140 return (ATI_FAIL); | |
1141 } | |
1142 | |
1143 return (ATI_CMPL); | |
1144 } | |
1145 | |
1146 | |
1147 GLOBAL T_ATI_RSLT tesatPercentCBHZ (char *cl, UBYTE srcId) | |
1148 { | |
1149 TRACE_FUNCTION("tesatPercentCBHZ()"); | |
1150 | |
1151 sprintf( g_sa, "%s: (%d,%d),(%d-%d),(%d-%d)", | |
1152 "%CBHZ", CBHZ_MOD_NotActive, CBHZ_MOD_Active, | |
1153 CS_GsmDef, CS_Ascii, CBHZ_MIN_TIMEOUT, CBHZ_MAX_TIMEOUT); | |
1154 | |
1155 | |
1156 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1157 | |
1158 return (ATI_CMPL); | |
1159 } | |
1160 | |
1161 GLOBAL T_ATI_RSLT queatPercentCBHZ (char *cl, UBYTE srcId) | |
1162 { | |
1163 T_ACI_RETURN ret; | |
1164 T_ACI_CBHZ_MOD mode; | |
1165 T_ACI_CS dcs; | |
1166 UBYTE timeout; | |
1167 | |
1168 TRACE_FUNCTION("queatPercentCBSHZ()"); | |
1169 | |
1170 ret = qAT_PercentCBHZ((T_ACI_CMD_SRC)srcId, &mode, &dcs, &timeout); | |
1171 | |
1172 if (ret EQ AT_FAIL) | |
1173 { | |
1174 cmdCmeError(CME_ERR_Unknown); | |
1175 return (ATI_FAIL); | |
1176 } | |
1177 | |
1178 /* | |
1179 *----------------------------------------------------------- | |
1180 * assemble the string for output | |
1181 *----------------------------------------------------------- | |
1182 */ | |
1183 | |
1184 sprintf( g_sa, "%s: %d,%d,%d", "%CBHZ", mode, dcs, timeout); | |
1185 | |
1186 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1187 | |
1188 return (ATI_CMPL); | |
1189 } | |
1190 #endif /* FF_HOMEZONE */ | |
1191 | |
1192 /* | |
1193 +--------------------------------------------------------------------+ | |
1194 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1195 | STATE : code ROUTINE : atPlusCSAS | | |
1196 +--------------------------------------------------------------------+ | |
1197 | |
1198 PURPOSE : +CSAS command (Save SMS Profile) | |
1199 */ | |
1200 | |
1201 GLOBAL T_ATI_RSLT atPlusCSAS (char *cl, UBYTE srcId) | |
1202 { | |
1203 SHORT profile = -1; | |
1204 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1205 | |
1206 TRACE_FUNCTION("atPlusCSAS()"); | |
1207 | |
1208 if ( *cl EQ '\0' ) | |
1209 { | |
1210 profile = 1; | |
1211 } | |
1212 else | |
1213 { | |
1214 cl = parse ( cl, "r", &profile ); | |
1215 if ( !cl ) | |
1216 { | |
1217 cmdCmsError ( CMS_ERR_MemFail ); | |
1218 return (ATI_FAIL); | |
1219 } | |
1220 profile++; | |
1221 } | |
1222 #ifdef FF_ATI_BAT | |
1223 { | |
1224 T_BAT_cmd_send cmd; | |
1225 T_BAT_cmd_set_plus_csas csas; | |
1226 | |
1227 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSAS; | |
1228 cmd.params.ptr_set_plus_csas = &csas; | |
1229 | |
1230 csas.profile = profile; | |
1231 | |
1232 TRACE_FUNCTION("atPlusCSAS() calls bat_send() <=== as APPLICATION"); | |
1233 bat_send(ati_bat_get_client(srcId), &cmd); | |
1234 return (AT_EXCT); | |
1235 } | |
1236 #else /* FF_ATI_BAT */ | |
1237 switch (sAT_PlusCSAS ((T_ACI_CMD_SRC)srcId, profile)) | |
1238 { | |
1239 case AT_EXCT: | |
1240 src_params->curAtCmd = AT_CMD_CSAS; | |
1241 return (ATI_EXCT); | |
1242 | |
1243 case AT_BUSY: | |
1244 return (ATI_BUSY); | |
1245 | |
1246 case AT_CMPL: | |
1247 return (ATI_CMPL_NO_OUTPUT); | |
1248 | |
1249 case AT_FAIL: /* execution of command failed */ | |
1250 default: | |
1251 cmdCmsError ( CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1252 return (ATI_FAIL); | |
1253 } | |
1254 #endif /* FF_ATI_BAT */ | |
1255 } | |
1256 | |
1257 GLOBAL T_ATI_RSLT tesatPlusCSAS (char *cl, UBYTE srcId) | |
1258 { | |
1259 SHORT profile = -1; | |
1260 | |
1261 if ((profile = cmhSMS_getPrfRge ()) < 1) | |
1262 { | |
1263 cmdCmsError ( CMS_ERR_MemFail ); | |
1264 return (ATI_FAIL); | |
1265 } | |
1266 else | |
1267 { | |
1268 sprintf ( g_sa, "+CSAS: (0-%d)", profile - 1 ); | |
1269 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
1270 return (ATI_CMPL); | |
1271 } | |
1272 } | |
1273 | |
1274 /* | |
1275 +--------------------------------------------------------------------+ | |
1276 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1277 | STATE : code ROUTINE : atPlusCRES | | |
1278 +--------------------------------------------------------------------+ | |
1279 | |
1280 PURPOSE : +CRES command (Load SMS Profile) | |
1281 */ | |
1282 | |
1283 GLOBAL T_ATI_RSLT atPlusCRES (char *cl, UBYTE srcId) | |
1284 { | |
1285 SHORT profile = -1; | |
1286 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1287 | |
1288 TRACE_FUNCTION("atPlusCRES()"); | |
1289 | |
1290 if ( *cl EQ '\0' ) | |
1291 { | |
1292 profile = 1; | |
1293 } | |
1294 else | |
1295 { | |
1296 cl = parse ( cl, "r", &profile ); | |
1297 | |
1298 if ( !cl ) | |
1299 { | |
1300 cmdCmsError ( CMS_ERR_MemFail ); | |
1301 return (ATI_FAIL); | |
1302 } | |
1303 profile++; | |
1304 } | |
1305 | |
1306 switch (sAT_PlusCRES ((T_ACI_CMD_SRC)srcId, profile)) | |
1307 { | |
1308 case AT_EXCT: | |
1309 src_params->curAtCmd = AT_CMD_CRES; | |
1310 return (ATI_EXCT); | |
1311 | |
1312 case AT_BUSY: | |
1313 return (ATI_BUSY); | |
1314 | |
1315 case AT_CMPL: | |
1316 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
1317 return (ATI_CMPL_NO_OUTPUT); | |
1318 | |
1319 case AT_FAIL: | |
1320 default: | |
1321 cmdCmsError ( CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1322 return (ATI_FAIL); | |
1323 } | |
1324 } | |
1325 | |
1326 GLOBAL T_ATI_RSLT tesatPlusCRES (char *cl, UBYTE srcId) | |
1327 { | |
1328 T_ACI_CRES profile; | |
1329 T_ACI_RETURN result; | |
1330 | |
1331 result = tAT_PlusCRES ((T_ACI_CMD_SRC)srcId, &profile); | |
1332 switch (result) | |
1333 { | |
1334 case AT_FAIL: | |
1335 cmdCmsError ( CMS_ERR_MemFail ); | |
1336 return (ATI_FAIL); | |
1337 | |
1338 case AT_CMPL: | |
1339 break; | |
1340 | |
1341 default: | |
1342 cmdCmsError ( CMS_ERR_MemFail ); | |
1343 return (ATI_FAIL); | |
1344 } | |
1345 | |
1346 sprintf ( g_sa, "+CRES: (%d-%d)", profile.min, profile.max); | |
1347 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
1348 return (ATI_CMPL); | |
1349 } | |
1350 | |
1351 /* | |
1352 +--------------------------------------------------------------------+ | |
1353 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1354 | STATE : code ROUTINE : atPlusCMGR | | |
1355 +--------------------------------------------------------------------+ | |
1356 | |
1357 PURPOSE : +CMGR command (Read Message) | |
1358 */ | |
1359 | |
1360 GLOBAL T_ATI_RSLT atPlusCMGR (char *cl, UBYTE srcId) | |
1361 { | |
1362 T_ACI_RETURN ret = AT_FAIL; | |
1363 SHORT idx=-1; | |
1364 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1365 | |
1366 TRACE_FUNCTION("atPlusCMGR()"); | |
1367 | |
1368 #ifndef WIN32 | |
1369 cl = parse(cl,"r",&idx); | |
1370 #else | |
1371 cl = parse(cl,"rd",&idx, &smsReadMode ); | |
1372 #endif | |
1373 if ( !cl OR idx > 255 OR idx < 0) | |
1374 { | |
1375 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1376 return (ATI_FAIL); | |
1377 } | |
1378 | |
1379 #ifdef FF_ATI_BAT | |
1380 | |
1381 { | |
1382 T_BAT_cmd_send cmd; | |
1383 T_BAT_cmd_set_plus_cmgr cmgr; | |
1384 | |
1385 cmd.ctrl_params=BAT_CMD_SET_PLUS_CMGR; | |
1386 cmd.params.ptr_set_plus_cmgr=&cmgr; | |
1387 | |
1388 cmgr.sms_index=(U16)idx; | |
1389 | |
1390 bat_send(ati_bat_get_client(srcId), &cmd); | |
1391 | |
1392 src_params->curAtCmd=AT_CMD_CMGR; | |
1393 return(ATI_EXCT); | |
1394 } | |
1395 | |
1396 #else | |
1397 | |
1398 #ifndef _CONC_TESTING_ | |
1399 #ifndef _SIMULATION_ | |
1400 ret = sAT_PlusCMGR_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)idx, SMS_READ_Normal, NULL); | |
1401 #else | |
1402 ret = sAT_PlusCMGR_Gl(srcId, (UBYTE)idx, smsReadMode , NULL); | |
1403 #endif | |
1404 #else | |
1405 #ifndef _SIMULATION_ | |
1406 ret = sAT_PlusCMGR (srcId, (UBYTE)idx, SMS_READ_Normal); | |
1407 #else | |
1408 ret = sAT_PlusCMGR (srcId, (UBYTE)idx, smsReadMode ); | |
1409 #endif | |
1410 #endif | |
1411 if ( ret EQ AT_CMPL ) | |
1412 { | |
1413 return (ATI_CMPL); | |
1414 } | |
1415 else if (ret EQ AT_EXCT) | |
1416 { | |
1417 src_params->curAtCmd = AT_CMD_CMGR; | |
1418 return (ATI_EXCT); | |
1419 } | |
1420 else | |
1421 { | |
1422 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1423 return (ATI_FAIL); | |
1424 } | |
1425 | |
1426 #endif /*FF_ATI_BAT*/ | |
1427 } | |
1428 | |
1429 /* | |
1430 +--------------------------------------------------------------------+ | |
1431 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1432 | STATE : code ROUTINE : atPlusCMGS | | |
1433 +--------------------------------------------------------------------+ | |
1434 | |
1435 PURPOSE : +CMGS command (SEND Message) | |
1436 */ | |
1437 | |
1438 GLOBAL T_ATI_RSLT tesatPlusCMGS (char *cl, UBYTE srcId) | |
1439 { | |
1440 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
1441 return ATI_CMPL_NO_OUTPUT; | |
1442 } | |
1443 | |
1444 GLOBAL T_ATI_RSLT queatPlusCMGS (char *cl, UBYTE srcId) | |
1445 { | |
1446 cmdCmsError(CMS_ERR_OpNotAllowed); /* querying CMGS not specified in 07.05 */ | |
1447 return (ATI_FAIL); | |
1448 } | |
1449 | |
1450 | |
1451 GLOBAL T_ATI_RSLT atPlusCMGS (char *cl, UBYTE srcId) | |
1452 #if defined (SMS_PDU_SUPPORT) | |
1453 { | |
1454 T_ACI_CMGF_MOD mode; | |
1455 | |
1456 TRACE_FUNCTION("atPlusCMGS()"); | |
1457 /* | |
1458 * request current mode | |
1459 */ | |
1460 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
1461 if (mode EQ 0) | |
1462 { | |
1463 /* | |
1464 * handle PDU mode | |
1465 */ | |
1466 return (atPlusCMGSPdu (cl, srcId)); | |
1467 } | |
1468 else | |
1469 { | |
1470 /* | |
1471 * handle Text mode | |
1472 */ | |
1473 return (atPlusCMGSText (cl, srcId)); | |
1474 } | |
1475 } | |
1476 | |
1477 | |
1478 /* | |
1479 +--------------------------------------------------------------------+ | |
1480 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1481 | STATE : code ROUTINE : str_to_bcd | | |
1482 +--------------------------------------------------------------------+ | |
1483 | |
1484 PURPOSE : A very specialised routine for converting a 2-byte string | |
1485 into one byte of BCD, intended to be used by atPlusCMGSText() | |
1486 only. | |
1487 */ | |
1488 LOCAL T_ATI_RSLT atPlusCMGSText(char *cl, UBYTE srcId) | |
1489 #endif /* (SMS_PDU_SUPPORT) */ | |
1490 { | |
1491 T_ACI_VP_ABS vpabs; | |
1492 SHORT fo, | |
1493 vprel, | |
1494 pid, | |
1495 dcs; | |
1496 T_ACI_RETURN ret = AT_FAIL; | |
1497 T_ACI_TOA toda; | |
1498 T_ACI_TOA* p_toda; | |
1499 T_ACI_SM_DATA msg; | |
1500 USHORT lenMsg; | |
1501 CHAR* da = daBuf; | |
1502 USHORT dalen = 0; | |
1503 UBYTE dest_addr[MAX_SMS_NUM_LEN]; | |
1504 | |
1505 size_t strg_len; | |
1506 #ifdef WIN32 | |
1507 static T_ACI_TOA tosca; | |
1508 SHORT octet=0; | |
1509 #endif /* WIN32 */ | |
1510 #if defined WIN32 OR defined _SIMULATION_ | |
1511 static T_ACI_TOA *p_tosca; | |
1512 static SHORT isReply; | |
1513 #endif | |
1514 #ifdef _SIMULATION_ | |
1515 CHAR *sca =subBuf; | |
1516 #endif /* _SIMULATION_ */ | |
1517 | |
1518 #if defined _CONC_TESTING_ AND defined TI_PS_FF_CONC_SMS | |
1519 T_SM_DATA_EXT msg_conc; | |
1520 #endif | |
1521 | |
1522 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1523 | |
1524 if (src_params->text_mode EQ CMD_MODE) | |
1525 { | |
1526 TRACE_FUNCTION("atPlusCMGSText() CMD_MODE"); | |
1527 memset (da, 0, MAX_SMS_NUM_LEN); | |
1528 toda_val = 0; | |
1529 /* input functionality */ | |
1530 da[0]='\0'; | |
1531 #ifndef WIN32 | |
1532 switch(ati_user_output_cfg[srcId].cscsChset) | |
1533 { | |
1534 case CSCS_CHSET_Hex: | |
1535 cl = parse (cl,"sr",(LONG)MAX_SMS_NUM_LEN*2,da,&toda_val); | |
1536 break; | |
1537 case CSCS_CHSET_Ucs2: | |
1538 cl = parse (cl,"sr",(LONG)MAX_SMS_NUM_LEN*4,da,&toda_val); | |
1539 break; | |
1540 default: | |
1541 cl = parse (cl,"sr",(LONG)MAX_SMS_NUM_LEN,da,&toda_val); | |
1542 break; | |
1543 } | |
1544 | |
1545 if ( !cl OR da[0] EQ '\0') | |
1546 { | |
1547 cmdCmsError (CMS_ERR_OpNotAllowed); | |
1548 return (ATI_FAIL); | |
1549 } | |
1550 #else | |
1551 *sca ='\0'; | |
1552 isReply = -1; | |
1553 switch(ati_user_output_cfg[srcId].cscsChset) | |
1554 { | |
1555 case CSCS_CHSET_Hex: | |
1556 cl = parse (cl,"srsrb",(LONG)MAX_SMS_NUM_LEN*2,da,&toda_val, | |
1557 (LONG)MAX_SMS_NUM_LEN*2,sca,&octet,&isReply); | |
1558 break; | |
1559 case CSCS_CHSET_Ucs2: | |
1560 cl = parse (cl,"srsrb",(LONG)MAX_SMS_NUM_LEN*4,da,&toda_val, | |
1561 (LONG)MAX_SMS_NUM_LEN*4,sca,&octet,&isReply); | |
1562 break; | |
1563 default: | |
1564 cl = parse (cl,"srsrb",(LONG)MAX_SMS_NUM_LEN,da,&toda_val, | |
1565 (LONG)MAX_SMS_NUM_LEN,sca,&octet,&isReply); | |
1566 break; | |
1567 } | |
1568 | |
1569 if ( !cl OR da[0] EQ '\0') | |
1570 { | |
1571 cmdCmsError (CMS_ERR_OpNotAllowed); | |
1572 return (ATI_FAIL); | |
1573 } | |
1574 if (octet EQ 0) | |
1575 { | |
1576 p_tosca=NULL; | |
1577 } | |
1578 else | |
1579 { | |
1580 tosca=toa_demerge(octet); | |
1581 if (tosca.ton < 0 OR tosca.npi < 0) | |
1582 { | |
1583 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1584 return (ATI_FAIL); | |
1585 } | |
1586 } | |
1587 #endif | |
1588 if (toda_val) | |
1589 { | |
1590 toda=toa_sms_demerge(toda_val); | |
1591 if (toda.ton < 0 OR toda.npi < 0) | |
1592 { | |
1593 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1594 return (ATI_FAIL); | |
1595 } | |
1596 } | |
1597 | |
1598 src_params->text_mode = TXT_MODE; | |
1599 return (ATI_EXCT); | |
1600 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
1601 else | |
1602 { | |
1603 TRACE_FUNCTION("atPlusCMGSText() TXT_MODE"); | |
1604 | |
1605 src_params->text_mode = CMD_MODE; | |
1606 /* if the character sent is ESC, then abort command CLB 16.11.00 */ | |
1607 if (*cl EQ 0x1B) | |
1608 { | |
1609 TRACE_EVENT("Send message command cancelled by user"); | |
1610 | |
1611 return ATI_CMPL_NO_OUTPUT; | |
1612 } | |
1613 | |
1614 if ( toda_val EQ 0 ) | |
1615 { | |
1616 #ifndef _SIMULATION_ | |
1617 #endif /* ndef _SIMULATION_ */ | |
1618 p_toda = NULL; | |
1619 } | |
1620 else | |
1621 { | |
1622 toda = toa_sms_demerge ( toda_val ); | |
1623 p_toda = &toda; | |
1624 if( toda.ton EQ TON_Alphanumeric) | |
1625 { | |
1626 dalen = strlen(da); | |
1627 | |
1628 switch (ati_user_output_cfg[srcId].cscsChset) | |
1629 { | |
1630 case CSCS_CHSET_Ucs2: | |
1631 utl_chsetToGsm ( (UBYTE*)da, | |
1632 dalen, | |
1633 dest_addr, | |
1634 &dalen, | |
1635 #ifdef REL99 | |
1636 sizeof(dest_addr), | |
1637 #endif | |
1638 GSM_ALPHA_Def ); | |
1639 break; | |
1640 | |
1641 case CSCS_CHSET_Hex: | |
1642 utl_chsetToGsm ( (UBYTE*)da, | |
1643 dalen, | |
1644 dest_addr, | |
1645 &dalen, | |
1646 #ifdef REL99 | |
1647 sizeof(dest_addr), | |
1648 #endif | |
1649 GSM_ALPHA_Def ); | |
1650 break; | |
1651 | |
1652 default: | |
1653 utl_chsetToGsm ( (UBYTE*)da, | |
1654 dalen, | |
1655 dest_addr, | |
1656 &dalen, | |
1657 #ifdef REL99 | |
1658 sizeof(dest_addr), | |
1659 #endif | |
1660 GSM_ALPHA_Def ); | |
1661 break; | |
1662 } | |
1663 if( dalen > (((MAX_SMS_ADDR_DIG/2) * 8) / 7) ) | |
1664 { | |
1665 TRACE_EVENT("DA length is greater then the supported length"); | |
1666 return(ATI_FAIL); | |
1667 } | |
1668 da = (CHAR*)dest_addr; | |
1669 da[dalen] = '\0'; /* dest_addr is a non NULL terminated string, so it should be terminated by 0 for internal processing */ | |
1670 } | |
1671 } | |
1672 | |
1673 qAT_PlusCSMP ( (T_ACI_CMD_SRC)srcId, &fo, &vprel, &vpabs, NULL, &pid, &dcs ); | |
1674 | |
1675 srcId_cb = srcId; | |
1676 strg_len=strlen(cl); | |
1677 | |
1678 switch (ati_user_output_cfg[srcId].cscsChset) | |
1679 { | |
1680 case CSCS_CHSET_Ucs2: | |
1681 utl_smDtaFromTe ((UBYTE*)cl, | |
1682 (USHORT)MINIMUM(strg_len,sizeof(msg.data)*4), | |
1683 msg.data, | |
1684 &lenMsg, | |
1685 #ifdef REL99 | |
1686 sizeof(msg.data), | |
1687 #endif | |
1688 (UBYTE)fo, | |
1689 (UBYTE)dcs ); | |
1690 break; | |
1691 case CSCS_CHSET_Hex: | |
1692 utl_smDtaFromTe ((UBYTE*)cl, | |
1693 (USHORT)MINIMUM(strg_len,sizeof(msg.data)*2), | |
1694 msg.data, | |
1695 &lenMsg, | |
1696 #ifdef REL99 | |
1697 sizeof(msg.data), | |
1698 #endif | |
1699 (UBYTE)fo, | |
1700 (UBYTE)dcs ); | |
1701 break; | |
1702 default: | |
1703 utl_smDtaFromTe ((UBYTE*)cl, | |
1704 (USHORT)MINIMUM(strg_len,sizeof(msg.data)), | |
1705 msg.data, | |
1706 &lenMsg, | |
1707 #ifdef REL99 | |
1708 sizeof(msg.data), | |
1709 #endif | |
1710 (UBYTE)fo, | |
1711 (UBYTE)dcs ); | |
1712 break; | |
1713 } | |
1714 | |
1715 msg.len = (UBYTE)lenMsg; | |
1716 #if !defined _CONC_TESTING_ OR !defined TI_PS_FF_CONC_SMS | |
1717 #ifndef _SIMULATION_ | |
1718 ret = sAT_PlusCMGS_Gl((T_ACI_CMD_SRC)srcId, da, p_toda, &msg, NULL, NULL, NULL, -1, NULL, NULL); | |
1719 #else | |
1720 ret = sAT_PlusCMGS_Gl(srcId, da, p_toda, &msg, NULL, sca, p_tosca, isReply, NULL, NULL); | |
1721 #endif | |
1722 #else | |
1723 ACI_MALLOC(msg_conc.data, msg.len); | |
1724 memcpy ( msg_conc.data, msg.data, msg.len); | |
1725 msg_conc.len = msg.len; | |
1726 #ifndef _SIMULATION_ | |
1727 ret = sAT_PlusCMGS (srcId, da, p_toda, &msg_conc, NULL, NULL, -1); | |
1728 #else | |
1729 ret = sAT_PlusCMGS (srcId, da, p_toda, &msg_conc, sca, p_tosca, isReply); | |
1730 #endif | |
1731 #endif | |
1732 | |
1733 if ( ret NEQ AT_EXCT ) | |
1734 { | |
1735 cmdCmsError (CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1736 return (ATI_FAIL); | |
1737 } | |
1738 /* | |
1739 * rCI_OK will emitting +CMGS: <mr>[,<scts>] | |
1740 */ | |
1741 | |
1742 | |
1743 | |
1744 return (ATI_EXCT); | |
1745 } | |
1746 } | |
1747 | |
1748 | |
1749 /* | |
1750 +--------------------------------------------------------------------+ | |
1751 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1752 | STATE : code ROUTINE : atPlusCMSS | | |
1753 +--------------------------------------------------------------------+ | |
1754 | |
1755 PURPOSE : +CMSS command (send message from storage) | |
1756 */ | |
1757 | |
1758 GLOBAL T_ATI_RSLT atPlusCMSS (char *cl, UBYTE srcId) | |
1759 { | |
1760 CHAR *p_da; | |
1761 T_ACI_RETURN ret = AT_FAIL; | |
1762 T_ACI_TOA toda; | |
1763 T_ACI_TOA *p_toda; | |
1764 SHORT index=-1, | |
1765 toda_val=0; | |
1766 CHAR da[MAX_SMS_NUM_LEN*4]; /* 4 is for UCS2 chars */ | |
1767 USHORT dalen = 0; | |
1768 UBYTE dest_addr[MAX_SMS_NUM_LEN]; | |
1769 | |
1770 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1771 | |
1772 TRACE_FUNCTION("atPlusCMSS()"); | |
1773 | |
1774 p_toda=&toda; | |
1775 p_da=da; | |
1776 /*input functionality*/ | |
1777 da[0]='\0'; | |
1778 switch(ati_user_output_cfg[srcId].cscsChset) | |
1779 { | |
1780 case CSCS_CHSET_Hex: | |
1781 cl = parse(cl,"rsr",&index,(LONG)MAX_SMS_NUM_LEN*2,da,&toda_val); | |
1782 break; | |
1783 case CSCS_CHSET_Ucs2: | |
1784 cl = parse(cl,"rsr",&index,(LONG)MAX_SMS_NUM_LEN*4,da,&toda_val); | |
1785 break; | |
1786 default: | |
1787 cl = parse(cl,"rsr",&index,(LONG)MAX_SMS_NUM_LEN,da,&toda_val); | |
1788 break; | |
1789 } | |
1790 if ( !cl OR toda_val > 0xD9 OR index > 255 OR index < 0) | |
1791 { | |
1792 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1793 return (ATI_FAIL); | |
1794 } | |
1795 p_toda=&toda; | |
1796 if(toda_val EQ 0) | |
1797 { | |
1798 p_toda=NULL; | |
1799 } | |
1800 else | |
1801 { | |
1802 toda=toa_sms_demerge(toda_val); | |
1803 if (toda.ton < 0 OR toda.npi < 0) | |
1804 { | |
1805 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1806 return (ATI_FAIL); | |
1807 } | |
1808 } | |
1809 if(!da[0]) | |
1810 p_da=NULL; | |
1811 else | |
1812 { | |
1813 if( toda.ton EQ TON_Alphanumeric) | |
1814 { | |
1815 dalen = strlen(da); | |
1816 | |
1817 switch (ati_user_output_cfg[srcId].cscsChset) | |
1818 { | |
1819 case CSCS_CHSET_Ucs2: | |
1820 utl_chsetToGsm ( (UBYTE*)da, | |
1821 dalen, | |
1822 dest_addr, | |
1823 &dalen, | |
1824 #ifdef REL99 | |
1825 sizeof(dest_addr), | |
1826 #endif | |
1827 GSM_ALPHA_Def ); | |
1828 break; | |
1829 | |
1830 case CSCS_CHSET_Hex: | |
1831 utl_chsetToGsm ( (UBYTE*)da, | |
1832 dalen, | |
1833 dest_addr, | |
1834 &dalen, | |
1835 #ifdef REL99 | |
1836 sizeof(dest_addr), | |
1837 #endif | |
1838 GSM_ALPHA_Def ); | |
1839 break; | |
1840 | |
1841 default: | |
1842 utl_chsetToGsm ( (UBYTE*)da, | |
1843 dalen, | |
1844 dest_addr, | |
1845 &dalen, | |
1846 #ifdef REL99 | |
1847 sizeof(dest_addr), | |
1848 #endif | |
1849 GSM_ALPHA_Def ); | |
1850 break; | |
1851 } | |
1852 if( dalen > (((MAX_SMS_ADDR_DIG/2) * 8) / 7) ) | |
1853 { | |
1854 TRACE_EVENT("DA length is greater then the supported length"); | |
1855 return(ATI_FAIL); | |
1856 } | |
1857 p_da = (CHAR*)dest_addr; | |
1858 p_da[dalen] = '\0'; /* dest_addr is a non NULL terminated string, so it should be terminated by 0 for internal processing */ | |
1859 } | |
1860 } | |
1861 | |
1862 #ifdef _CONC_TESTING_ | |
1863 ret = sAT_PlusCMSS(srcId,(UBYTE)index,p_da,p_toda); | |
1864 #else | |
1865 ret = sAT_PlusCMSS_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)index, p_da, p_toda, NULL, NULL); | |
1866 #endif | |
1867 if (ret EQ AT_EXCT) | |
1868 { | |
1869 src_params->curAtCmd = AT_CMD_CMSS; | |
1870 return (ATI_EXCT); | |
1871 } | |
1872 else | |
1873 { | |
1874 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1875 return (ATI_FAIL); | |
1876 } | |
1877 } | |
1878 | |
1879 /* | |
1880 +--------------------------------------------------------------------+ | |
1881 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1882 | STATE : code ROUTINE : atPlusCNMA | | |
1883 +--------------------------------------------------------------------+ | |
1884 | |
1885 PURPOSE : +CNMA command (new message acknowledgement) | |
1886 */ | |
1887 GLOBAL T_ATI_RSLT queatPlusCNMA (char *cl, UBYTE srcId) | |
1888 { | |
1889 cmdCmsError(CMS_ERR_OpNotAllowed); /* querying CNMA not specified in 07.05 */ | |
1890 return (ATI_FAIL); | |
1891 } | |
1892 | |
1893 GLOBAL T_ATI_RSLT tesatPlusCNMA (char *cl, UBYTE srcId) | |
1894 { | |
1895 T_ACI_CMGF_MOD mode; | |
1896 | |
1897 /* | |
1898 * request current mode | |
1899 */ | |
1900 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
1901 if (mode EQ 0) | |
1902 { | |
1903 /* | |
1904 * handle PDU mode: response is +CNMA: (list of supported <n>s) | |
1905 */ | |
1906 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
1907 return ATI_CMPL_NO_OUTPUT; | |
1908 } | |
1909 else | |
1910 { | |
1911 /* | |
1912 * handle Text mode: there is no response | |
1913 */ | |
1914 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
1915 return ATI_CMPL_NO_OUTPUT; | |
1916 } | |
1917 } | |
1918 | |
1919 | |
1920 GLOBAL T_ATI_RSLT atPlusCNMA (char *cl, UBYTE srcId) | |
1921 #if defined (SMS_PDU_SUPPORT) | |
1922 { | |
1923 T_ACI_CMGF_MOD mode; | |
1924 | |
1925 if(srcId NEQ smsShrdPrm.smsSrcId) | |
1926 { | |
1927 cmdCmsError(CMS_ERR_NoCnmaAckExpect); | |
1928 return ( ATI_FAIL ); | |
1929 } | |
1930 | |
1931 if( waitForCnmaFromBuffer_SrcId NEQ CMD_SRC_NONE ) | |
1932 { /* incomming +CNMA acknowledges an +CMT from CNMI buffer | |
1933 -> acknowledge has been sent to SMS entity */ | |
1934 TIMERSTOP( ACI_CNMA_TIMER_HANDLE ); | |
1935 cmd_clearFirstCnmiMessage(); /* The first message in CNMI buffer is cleared */ | |
1936 waitForCnmaFromBuffer_SrcId = CMD_SRC_NONE; | |
1937 /* look for more messages in CNMI buffer for this srcId */ | |
1938 cmd_flushCnmiBufOneByOne(); | |
1939 return(ATI_CMPL); | |
1940 } | |
1941 /* | |
1942 * request current mode | |
1943 */ | |
1944 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
1945 if (mode EQ 0) | |
1946 /* | |
1947 * handle PDU mode | |
1948 */ | |
1949 return atPlusCNMAPdu (cl,srcId); | |
1950 else | |
1951 /* | |
1952 * handle Text mode | |
1953 */ | |
1954 return atPlusCNMAText (cl,srcId); | |
1955 } | |
1956 | |
1957 LOCAL T_ATI_RSLT atPlusCNMAText (char *cl, UBYTE srcId) | |
1958 #endif /* (SMS_PDU_SUPPORT) */ | |
1959 { | |
1960 TRACE_FUNCTION("atPlusCNMAText()"); | |
1961 | |
1962 switch (*cl) | |
1963 { | |
1964 case(0x0): | |
1965 switch (sAT_PlusCNMA((T_ACI_CMD_SRC)srcId)) | |
1966 { | |
1967 case( AT_CMPL ): | |
1968 cmdAtError ( atOk ); | |
1969 return (ATI_CMPL); | |
1970 | |
1971 default: | |
1972 cmdCmsError (CMS_ERR_NotPresent); /* use aciErrDesc */ | |
1973 return (ATI_FAIL); | |
1974 } | |
1975 default: | |
1976 cmdCmeError(CME_ERR_Unknown); | |
1977 return (ATI_FAIL); | |
1978 } | |
1979 } | |
1980 | |
1981 | |
1982 /* | |
1983 +--------------------------------------------------------------------+ | |
1984 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1985 | STATE : code ROUTINE : atPlusCMGW | | |
1986 +--------------------------------------------------------------------+ | |
1987 | |
1988 PURPOSE : +CMGW command (Write message to memory) | |
1989 */ | |
1990 | |
1991 GLOBAL T_ATI_RSLT tesatPlusCMGW (char *cl, UBYTE srcId) | |
1992 { | |
1993 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
1994 return ATI_CMPL_NO_OUTPUT; | |
1995 } | |
1996 | |
1997 GLOBAL T_ATI_RSLT queatPlusCMGW (char *cl, UBYTE srcId) | |
1998 { | |
1999 cmdCmsError(CMS_ERR_OpNotAllowed); /* querying CMGW not specified in 07.05 */ | |
2000 return (ATI_FAIL); | |
2001 } | |
2002 | |
2003 | |
2004 GLOBAL T_ATI_RSLT atPlusCMGW (char *cl, UBYTE srcId) | |
2005 #if defined (SMS_PDU_SUPPORT) | |
2006 { | |
2007 T_ACI_CMGF_MOD mode; | |
2008 | |
2009 /* | |
2010 * request current mode | |
2011 */ | |
2012 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
2013 if (mode EQ 0) | |
2014 /* | |
2015 * handle PDU mode | |
2016 */ | |
2017 return atPlusCMGWPdu (cl, srcId); | |
2018 else | |
2019 /* | |
2020 * handle Text mode | |
2021 */ | |
2022 return atPlusCMGWText (cl, srcId); | |
2023 } | |
2024 LOCAL T_ATI_RSLT atPlusCMGWText(char *cl, UBYTE srcId) | |
2025 #endif /* (SMS_PDU_SUPPORT) */ | |
2026 { | |
2027 T_ACI_VP_ABS vpabs; | |
2028 SHORT fo, | |
2029 vprel, | |
2030 pid, | |
2031 dcs; | |
2032 T_ACI_RETURN ret; | |
2033 T_ACI_TOA toa; | |
2034 T_ACI_TOA* p_toa; | |
2035 CHAR txtStat[15] = {0x00}; | |
2036 USHORT i; | |
2037 T_ACI_SM_DATA msg; | |
2038 USHORT lenMsg; | |
2039 static T_ACI_SMS_STAT stat; | |
2040 #if defined _SIMULATION_ OR defined WIN32 | |
2041 static T_ACI_TOA *p_tosca; | |
2042 static SHORT isReply; | |
2043 #endif | |
2044 #ifdef _SIMULATION_ | |
2045 CHAR *sca =subBuf; | |
2046 #endif /* ndef _SIMULATION_ */ | |
2047 #ifdef WIN32 | |
2048 SHORT octet=0; | |
2049 static T_ACI_TOA tosca; | |
2050 #endif /* WIN32 */ | |
2051 | |
2052 #if defined _CONC_TESTING_ AND defined TI_PS_FF_CONC_SMS | |
2053 T_SM_DATA_EXT msg_conc; | |
2054 #endif | |
2055 CHAR *da = daBuf; | |
2056 USHORT dalen = 0; | |
2057 UBYTE dest_addr[MAX_SMS_NUM_LEN]; | |
2058 | |
2059 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2060 | |
2061 TRACE_FUNCTION("atPlusCMGWText()"); | |
2062 | |
2063 p_toa=&toa; | |
2064 | |
2065 if (src_params->text_mode EQ CMD_MODE) | |
2066 { | |
2067 toda_val=0; | |
2068 memset(da, 0, MAX_SMS_NUM_LEN); | |
2069 stat = SMS_STAT_NotPresent; | |
2070 /*input functionality*/ | |
2071 *da='\0'; /*sets global destination address to empty string*/ | |
2072 #ifndef WIN32 | |
2073 switch(ati_user_output_cfg[srcId].cscsChset) | |
2074 { | |
2075 case CSCS_CHSET_Hex: | |
2076 cl = parse(cl,"srs",(LONG)MAX_SMS_NUM_LEN*2, | |
2077 da, | |
2078 &toda_val, | |
2079 (LONG)sizeof(txtStat), | |
2080 txtStat); | |
2081 break; | |
2082 case CSCS_CHSET_Ucs2: | |
2083 cl = parse(cl,"srs",(LONG)MAX_SMS_NUM_LEN*4, | |
2084 da, | |
2085 &toda_val, | |
2086 (LONG)sizeof(txtStat), | |
2087 txtStat); | |
2088 break; | |
2089 default: | |
2090 cl = parse(cl,"srs",(LONG)MAX_SMS_NUM_LEN, | |
2091 da, | |
2092 &toda_val, | |
2093 (LONG)sizeof(txtStat), | |
2094 txtStat); | |
2095 break; | |
2096 } | |
2097 | |
2098 if ( !cl ) | |
2099 { | |
2100 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2101 return (ATI_FAIL); | |
2102 } | |
2103 #else | |
2104 *sca='\0'; | |
2105 isReply = -1; | |
2106 switch(ati_user_output_cfg[srcId].cscsChset) | |
2107 { | |
2108 case CSCS_CHSET_Hex: | |
2109 cl = parse(cl,"srssrb",(LONG)MAX_SMS_NUM_LEN*2, | |
2110 da, | |
2111 &toda_val, | |
2112 (LONG)sizeof(txtStat), | |
2113 txtStat, | |
2114 (LONG)MAX_SMS_NUM_LEN*2,sca,&octet,&isReply); | |
2115 break; | |
2116 case CSCS_CHSET_Ucs2: | |
2117 cl = parse(cl,"srssrb",(LONG)MAX_SMS_NUM_LEN*4, | |
2118 da, | |
2119 &toda_val, | |
2120 (LONG)sizeof(txtStat), | |
2121 txtStat, | |
2122 (LONG)MAX_SMS_NUM_LEN*4,sca,&octet,&isReply); | |
2123 break; | |
2124 default: | |
2125 cl = parse(cl,"srssrb",(LONG)MAX_SMS_NUM_LEN, | |
2126 da, | |
2127 &toda_val, | |
2128 (LONG)sizeof(txtStat), | |
2129 txtStat, | |
2130 (LONG)MAX_SMS_NUM_LEN,sca,&octet,&isReply); | |
2131 break; | |
2132 } | |
2133 | |
2134 if ( !cl ) | |
2135 { | |
2136 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2137 return (ATI_FAIL); | |
2138 } | |
2139 if(octet EQ 0) | |
2140 p_tosca = NULL; | |
2141 else | |
2142 { | |
2143 tosca=toa_demerge(octet); | |
2144 if (tosca.ton < 0 OR tosca.npi < 0) | |
2145 { | |
2146 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2147 return 0; | |
2148 } | |
2149 p_tosca = &tosca; | |
2150 } | |
2151 #endif | |
2152 if (toda_val) | |
2153 { | |
2154 toa = toa_sms_demerge(toda_val); | |
2155 if (toa.ton < 0 OR toa.npi < 0) | |
2156 { | |
2157 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2158 return (ATI_FAIL); | |
2159 } | |
2160 } | |
2161 i = 0; | |
2162 while ( sms_stat[i].name NEQ NULL AND | |
2163 strcmp ( sms_stat[i].name, txtStat ) NEQ 0 ) | |
2164 { | |
2165 i++; | |
2166 } | |
2167 stat = sms_stat[i].stat; | |
2168 | |
2169 src_params->text_mode = TXT_MODE; | |
2170 return (ATI_EXCT); | |
2171 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
2172 else | |
2173 { | |
2174 src_params->text_mode = CMD_MODE; | |
2175 /* if the character sent is ESC, then abort command CLB 16.11.00 */ | |
2176 if (*cl EQ 0x1B) | |
2177 { | |
2178 TRACE_EVENT("Send message command cancelled by user"); | |
2179 | |
2180 return ATI_CMPL_NO_OUTPUT; | |
2181 } | |
2182 | |
2183 if ( toda_val EQ 0 ) | |
2184 p_toa = NULL; | |
2185 else | |
2186 { | |
2187 toa = toa_sms_demerge ( toda_val ); | |
2188 p_toa = &toa; | |
2189 } | |
2190 | |
2191 qAT_PlusCSMP ( (T_ACI_CMD_SRC)srcId, &fo, &vprel, &vpabs, NULL, &pid, &dcs ); | |
2192 | |
2193 srcId_cb = srcId; | |
2194 if( toa.ton EQ TON_Alphanumeric) | |
2195 { | |
2196 dalen = strlen(da); | |
2197 | |
2198 switch (ati_user_output_cfg[srcId].cscsChset) | |
2199 { | |
2200 case CSCS_CHSET_Ucs2: | |
2201 utl_chsetToGsm ( (UBYTE*)da, | |
2202 dalen, | |
2203 dest_addr, | |
2204 &dalen, | |
2205 #ifdef REL99 | |
2206 sizeof(dest_addr), | |
2207 #endif | |
2208 GSM_ALPHA_Def ); | |
2209 break; | |
2210 | |
2211 case CSCS_CHSET_Hex: | |
2212 utl_chsetToGsm ( (UBYTE*)da, | |
2213 dalen, | |
2214 dest_addr, | |
2215 &dalen, | |
2216 #ifdef REL99 | |
2217 sizeof(dest_addr), | |
2218 #endif | |
2219 GSM_ALPHA_Def ); | |
2220 break; | |
2221 default: | |
2222 utl_chsetToGsm ( (UBYTE*)da, | |
2223 dalen, | |
2224 dest_addr, | |
2225 &dalen, | |
2226 #ifdef REL99 | |
2227 sizeof(dest_addr), | |
2228 #endif | |
2229 GSM_ALPHA_Def ); | |
2230 break; | |
2231 } | |
2232 if( dalen > (((MAX_SMS_ADDR_DIG/2) * 8) / 7) ) | |
2233 { | |
2234 TRACE_EVENT("DA length is greater then the supported length"); | |
2235 return(ATI_FAIL); | |
2236 } | |
2237 da = (CHAR*)dest_addr; | |
2238 da[dalen] = '\0'; /* dest_addr is a non NULL terminated string, so it should be terminated by 0 for internal processing */ | |
2239 } | |
2240 | |
2241 utl_smDtaFromTe ( (UBYTE*)cl, | |
2242 (USHORT)strlen(cl), | |
2243 (UBYTE*)msg.data, | |
2244 &lenMsg, | |
2245 #ifdef REL99 | |
2246 sizeof(msg.data), | |
2247 #endif | |
2248 (UBYTE)fo, | |
2249 (UBYTE)dcs ); | |
2250 | |
2251 msg.len = (UBYTE)lenMsg; | |
2252 | |
2253 #if !defined _CONC_TESTING_ OR !defined TI_PS_FF_CONC_SMS | |
2254 #ifndef _SIMULATION_ | |
2255 ret = sAT_PlusCMGW_Gl((T_ACI_CMD_SRC)srcId, | |
2256 CMGW_IDX_FREE_ENTRY, | |
2257 da, p_toa, stat, NOT_PRESENT_8BIT, | |
2258 &msg, NULL, NULL, NULL, -1, | |
2259 NULL, NULL); | |
2260 #else | |
2261 ret = sAT_PlusCMGW_Gl( srcId, | |
2262 CMGW_IDX_FREE_ENTRY, | |
2263 da, p_toa, stat, NOT_PRESENT_8BIT, | |
2264 &msg, NULL, sca, p_tosca, isReply, | |
2265 NULL, NULL); | |
2266 #endif | |
2267 #else | |
2268 ACI_MALLOC(msg_conc.data, msg.len); | |
2269 memcpy ( msg_conc.data, msg.data, msg.len); | |
2270 msg_conc.len = msg.len; | |
2271 #ifndef _SIMULATION_ | |
2272 ret = sAT_PlusCMGW ( srcId, | |
2273 CMGW_IDX_FREE_ENTRY, | |
2274 da, p_toa, stat, NOT_PRESENT_8BIT, | |
2275 &msg_conc, NULL, NULL, -1 ); | |
2276 #else | |
2277 ret = sAT_PlusCMGW ( srcId, | |
2278 CMGW_IDX_FREE_ENTRY, | |
2279 da, p_toa, stat, NOT_PRESENT_8BIT, | |
2280 &msg_conc, sca, p_tosca, isReply ); | |
2281 #endif | |
2282 #endif | |
2283 | |
2284 if ( ret NEQ AT_EXCT ) | |
2285 { | |
2286 cmdCmsError (CMS_ERR_NotPresent); /* use aciErrDesc */ | |
2287 return (ATI_FAIL); | |
2288 } | |
2289 /* | |
2290 * rCI_OK will emitting +CMGW: <index> | |
2291 */ | |
2292 return (ATI_EXCT); | |
2293 } | |
2294 } | |
2295 | |
2296 | |
2297 /* | |
2298 +--------------------------------------------------------------------+ | |
2299 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2300 | STATE : code ROUTINE : atPlusCMGD | | |
2301 +--------------------------------------------------------------------+ | |
2302 | |
2303 PURPOSE : +CMGD command (delete message from storage) | |
2304 */ | |
2305 | |
2306 GLOBAL T_ATI_RSLT setatPlusCMGD (char *cl, UBYTE srcId) | |
2307 { | |
2308 T_ACI_RETURN ret = AT_FAIL; | |
2309 SHORT index=-1; | |
2310 SHORT status = CMGD_DEL_INDEX; | |
2311 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2312 | |
2313 src_params->curAtCmd = AT_CMD_CMGD; | |
2314 | |
2315 /*input functionality*/ | |
2316 if(!cl OR !*cl) | |
2317 { | |
2318 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2319 return ATI_FAIL; | |
2320 } | |
2321 | |
2322 cl=parse(cl,"rr",&index,&status); | |
2323 if ( !cl OR (index > 255) OR (index < 0) OR | |
2324 ((status < CMGD_DEL_INDEX) OR (status > CMGD_DEL_ALL))) | |
2325 { | |
2326 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2327 return ATI_FAIL; | |
2328 } | |
2329 | |
2330 #ifdef FF_ATI_BAT | |
2331 { | |
2332 T_BAT_cmd_send cmd; | |
2333 T_BAT_cmd_set_plus_cmgd my_bat_set_plus_cmgd; | |
2334 | |
2335 TRACE_FUNCTION("setatPlusCMGD() calls bat_send() <=== as APPLICATION"); | |
2336 | |
2337 memset(&my_bat_set_plus_cmgd, 0, sizeof(my_bat_set_plus_cmgd)); | |
2338 cmd.ctrl_params = BAT_CMD_SET_PLUS_CMGD; | |
2339 cmd.params.ptr_set_plus_cmgd = &my_bat_set_plus_cmgd; | |
2340 | |
2341 my_bat_set_plus_cmgd.index = (U8)index; | |
2342 my_bat_set_plus_cmgd.status = status; | |
2343 | |
2344 bat_send(ati_bat_get_client(srcId), &cmd); | |
2345 | |
2346 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
2347 } | |
2348 #else /* OLD FUNCTION BODY */ | |
2349 | |
2350 TRACE_FUNCTION("setatPlusCMGD()"); | |
2351 /*----------------------------------------------------------------------- | |
2352 * Del flag is greater than zero, set index as Zero so that SMS module | |
2353 * starts searching for records satisfying the status from first record | |
2354 *----------------------------------------------------------------------- | |
2355 */ | |
2356 if ( status > CMGD_DEL_INDEX ) | |
2357 { | |
2358 index = 0; | |
2359 } | |
2360 #ifdef _CONC_TESTING_ | |
2361 ret = sAT_PlusCMGD(srcId,(UBYTE)index, status); | |
2362 #else | |
2363 ret = sAT_PlusCMGD_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)index, status, NULL, NULL); | |
2364 #endif | |
2365 | |
2366 if (ret EQ AT_EXCT) | |
2367 { | |
2368 return (ATI_EXCT); | |
2369 } | |
2370 else | |
2371 { | |
2372 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
2373 return (ATI_FAIL); | |
2374 } | |
2375 | |
2376 #endif /* no FF_ATI_BAT*/ | |
2377 } | |
2378 | |
2379 /* | |
2380 +--------------------------------------------------------------------+ | |
2381 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2382 | STATE : code ROUTINE : atPlusCMGC | | |
2383 +--------------------------------------------------------------------+ | |
2384 | |
2385 PURPOSE : +CMGC command (Send SMS command) | |
2386 */ | |
2387 | |
2388 GLOBAL T_ATI_RSLT tesatPlusCMGC (char *cl, UBYTE srcId) | |
2389 { | |
2390 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
2391 return ATI_CMPL_NO_OUTPUT; | |
2392 } | |
2393 | |
2394 GLOBAL T_ATI_RSLT queatPlusCMGC (char *cl, UBYTE srcId) | |
2395 { | |
2396 cmdCmsError(CMS_ERR_OpNotAllowed); /* querying CMGC not specified in 07.05 */ | |
2397 return (ATI_FAIL); | |
2398 } | |
2399 | |
2400 GLOBAL T_ATI_RSLT atPlusCMGC (char *cl, UBYTE srcId) | |
2401 #if defined (SMS_PDU_SUPPORT) | |
2402 { | |
2403 T_ACI_CMGF_MOD mode; | |
2404 | |
2405 /* | |
2406 * request current mode | |
2407 */ | |
2408 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
2409 if (mode EQ 0) | |
2410 /* | |
2411 * handle PDU mode | |
2412 */ | |
2413 return atPlusCMGCPdu (cl, srcId); | |
2414 else | |
2415 /* | |
2416 * handle Text mode | |
2417 */ | |
2418 return atPlusCMGCText (cl, srcId); | |
2419 } | |
2420 | |
2421 LOCAL T_ATI_RSLT atPlusCMGCText(char *cl, UBYTE srcId) | |
2422 #endif /* (SMS_PDU_SUPPORT) */ | |
2423 { | |
2424 /* char buf[80]; */ | |
2425 T_ACI_RETURN ret = AT_FAIL; | |
2426 T_ACI_TOA toa; | |
2427 T_ACI_TOA* p_toa; | |
2428 T_ACI_CMD_DATA cmd; | |
2429 USHORT lenCmd; | |
2430 CHAR* da = daBuf; | |
2431 | |
2432 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2433 | |
2434 TRACE_FUNCTION("atPlusCMGCText()"); | |
2435 p_toa=&toa; | |
2436 if (src_params->text_mode EQ CMD_MODE) | |
2437 { | |
2438 memset(da, 0, MAX_SMS_NUM_LEN); | |
2439 fo=-1; | |
2440 ct=-1; | |
2441 pid=-1; | |
2442 mn=-1; | |
2443 toda_val=0; | |
2444 /*input functionality*/ | |
2445 da[0]='\0'; | |
2446 cl = parse(cl,"rrrrsr",&fo,&ct,&pid,&mn,(LONG)MAX_SMS_NUM_LEN,da,&toda_val); | |
2447 | |
2448 if ( !cl OR fo > 255 OR ct > 255 OR | |
2449 pid > 255 OR mn > 255 OR toda_val > 0xC9 OR da[0] EQ '\0') | |
2450 { | |
2451 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2452 return (ATI_FAIL); | |
2453 } | |
2454 if(toda_val) | |
2455 { | |
2456 toa = toa_demerge(toda_val); | |
2457 if (toa.ton < 0 OR toa.npi < 0) | |
2458 { | |
2459 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2460 return (ATI_FAIL); | |
2461 } | |
2462 } | |
2463 | |
2464 src_params->text_mode = TXT_MODE; | |
2465 return (ATI_EXCT); | |
2466 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
2467 else | |
2468 { | |
2469 src_params->text_mode = CMD_MODE; | |
2470 p_toa=&toa; | |
2471 if(toda_val EQ 0) | |
2472 { | |
2473 p_toa = NULL; | |
2474 } | |
2475 else | |
2476 { | |
2477 toa = toa_demerge(toda_val); | |
2478 } | |
2479 if (!(check_str(cl,"0123456789ABCDEF"))) | |
2480 { | |
2481 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2482 return (ATI_FAIL); | |
2483 } | |
2484 utl_hexToGsm ( (UBYTE*)cl, | |
2485 (USHORT)strlen(cl), | |
2486 (UBYTE*)cmd.data, | |
2487 &lenCmd, | |
2488 GSM_ALPHA_Def, | |
2489 CSCS_ALPHA_8_Bit); | |
2490 cmd.len = (UBYTE)lenCmd; | |
2491 | |
2492 #ifndef _CONC_TESTING_ | |
2493 ret = sAT_PlusCMGC_Gl ((T_ACI_CMD_SRC)srcId,fo,ct,pid,mn,da,p_toa,&cmd,NULL); | |
2494 #else | |
2495 ret= sAT_PlusCMGC(srcId,fo,ct,pid,mn,da,p_toa,&cmd); | |
2496 #endif | |
2497 | |
2498 if ( ret NEQ AT_EXCT ) | |
2499 { | |
2500 cmdCmsError (CMS_ERR_NotPresent); /* use aciErrDesc */ | |
2501 return (ATI_FAIL); | |
2502 } | |
2503 /* | |
2504 * rCI_OK will emitting +CMGC: <mr>[,<scts>] | |
2505 */ | |
2506 return (ATI_EXCT); | |
2507 } | |
2508 } | |
2509 | |
2510 /* | |
2511 +--------------------------------------------------------------------+ | |
2512 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2513 | STATE : code ROUTINE : atPlusCMGL | | |
2514 +--------------------------------------------------------------------+ | |
2515 | |
2516 PURPOSE : +CMGL command (List Messages) | |
2517 */ | |
2518 | |
2519 GLOBAL T_ATI_RSLT queatPlusCMGL (char *cl, UBYTE srcId) | |
2520 { | |
2521 TRACE_FUNCTION("queatPlusCMGL()"); | |
2522 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2523 return (ATI_FAIL); | |
2524 } | |
2525 | |
2526 GLOBAL T_ATI_RSLT tesatPlusCMGL (char *cl, UBYTE srcId) | |
2527 { | |
2528 #ifdef SMS_PDU_SUPPORT | |
2529 T_ACI_CMGF_MOD mode; | |
2530 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2531 | |
2532 TRACE_FUNCTION("tesatPlusCMGL()"); | |
2533 /* | |
2534 * request current mode | |
2535 */ | |
2536 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
2537 if (mode EQ 0) | |
2538 /* | |
2539 * handle PDU mode | |
2540 */ | |
2541 io_sendMessage(srcId, "+CMGL: (0,1,2,3,4)", ATI_NORMAL_OUTPUT); | |
2542 else | |
2543 /* | |
2544 * handle Text mode | |
2545 */ | |
2546 #endif | |
2547 io_sendMessage(srcId, "+CMGL: (\"REC UNREAD\",\"REC READ\",\"STO UNSENT\",\"STO SENT\",\"ALL\")", ATI_NORMAL_OUTPUT); | |
2548 | |
2549 return (ATI_CMPL); | |
2550 } | |
2551 | |
2552 GLOBAL T_ATI_RSLT atPlusCMGL (char *cl, UBYTE srcId) | |
2553 { | |
2554 #ifndef FF_ATI_BAT | |
2555 T_ACI_RETURN ret; | |
2556 #endif | |
2557 | |
2558 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2559 | |
2560 #ifdef SMS_PDU_SUPPORT | |
2561 T_ACI_CMGF_MOD mode; | |
2562 #endif | |
2563 CHAR txtStat[15]; | |
2564 USHORT i; | |
2565 | |
2566 TRACE_FUNCTION("atPlusCMGL()"); | |
2567 | |
2568 | |
2569 if (*cl EQ '\0') | |
2570 { | |
2571 cmglStat = SMS_STAT_NotPresent; | |
2572 #ifdef WIN32 | |
2573 smsReadMode = SMS_READ_Normal; | |
2574 #endif | |
2575 } | |
2576 else | |
2577 { | |
2578 /* | |
2579 * Request of a list of stored SMS messages | |
2580 * Parameter stat is optional | |
2581 */ | |
2582 #ifdef SMS_PDU_SUPPORT | |
2583 /* | |
2584 * request current mode | |
2585 */ | |
2586 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
2587 if (mode EQ 0) | |
2588 { | |
2589 #ifndef WIN32 | |
2590 /* | |
2591 * On the target is the definition according GSM 7.05 CMGL=[stat] | |
2592 */ | |
2593 cmglStat = SMS_STAT_All; | |
2594 cl = parse (cl, "d", &cmglStat); | |
2595 if ( !cl OR cmglStat < SMS_STAT_RecUnread OR cmglStat > SMS_STAT_All) | |
2596 { | |
2597 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2598 return (ATI_FAIL); | |
2599 } | |
2600 #else | |
2601 /* | |
2602 * Under Windows the definition is CMGL=[stat],[preview] | |
2603 * to test the capabilities of the functional interface | |
2604 */ | |
2605 cl = parse (cl, "dd", &cmglStat, &smsReadMode ); | |
2606 if ( !cl OR ((cmglStat < SMS_STAT_RecUnread OR cmglStat > SMS_STAT_All) | |
2607 AND smsReadMode EQ SMS_READ_NotPresent)) | |
2608 { | |
2609 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2610 return (ATI_FAIL); | |
2611 } | |
2612 #endif | |
2613 } | |
2614 else | |
2615 #endif | |
2616 { | |
2617 #ifndef WIN32 | |
2618 /* | |
2619 * On the target is the definition according GSM 7.05 CMGL=[stat] | |
2620 */ | |
2621 cl = parse (cl, "s", (LONG)sizeof(txtStat), txtStat); | |
2622 if ( !cl OR txtStat[0] EQ '\0') | |
2623 { | |
2624 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2625 return (ATI_FAIL); | |
2626 } | |
2627 #else | |
2628 /* | |
2629 * Under Windows the definition is CMGL=[stat],[preview] | |
2630 * to test the capabilities of the functional interface | |
2631 */ | |
2632 cl = parse (cl, "sd", (LONG)sizeof(txtStat), txtStat, &smsReadMode ); | |
2633 if ( !cl OR (txtStat[0] EQ '\0' AND smsReadMode EQ SMS_READ_NotPresent)) | |
2634 { | |
2635 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2636 return (ATI_FAIL); | |
2637 } | |
2638 if (txtStat[0] EQ '\0') | |
2639 strcpy (txtStat, sms_stat[4].name); /* ALL as default */ | |
2640 #endif | |
2641 i = 0; | |
2642 while ( sms_stat[i].name NEQ NULL AND | |
2643 strcmp ( sms_stat[i].name, txtStat ) NEQ 0 ) | |
2644 i++; | |
2645 | |
2646 if ( sms_stat[i].name EQ NULL ) | |
2647 { | |
2648 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
2649 return (ATI_FAIL); | |
2650 } | |
2651 | |
2652 cmglStat = sms_stat[i].stat; | |
2653 } | |
2654 } | |
2655 | |
2656 #ifdef FF_ATI_BAT | |
2657 | |
2658 { | |
2659 T_BAT_cmd_send cmd; | |
2660 T_BAT_cmd_set_plus_cmgl cmgl; | |
2661 | |
2662 cmd.ctrl_params=BAT_CMD_SET_PLUS_CMGL; | |
2663 cmd.params.ptr_set_plus_cmgl=&cmgl; | |
2664 | |
2665 /* | |
2666 * T_ACI_SMS_STAT and T_BAT_plus_cmgl_stat are not quite | |
2667 * identical - the ACI version has the extra value | |
2668 * SMS_STAT_Invalid. | |
2669 */ | |
2670 if (cmglStat EQ SMS_STAT_Invalid) | |
2671 cmgl.stat=BAT_CMGL_STAT_NOT_PRESENT; | |
2672 else | |
2673 cmgl.stat=(T_BAT_plus_cmgl_stat)cmglStat; | |
2674 | |
2675 bat_send(ati_bat_get_client(srcId),&cmd); | |
2676 | |
2677 src_params->curAtCmd=AT_CMD_CMGL; | |
2678 return(ATI_EXCT); | |
2679 } | |
2680 | |
2681 #else | |
2682 | |
2683 /* | |
2684 * Request the first five SMS messages | |
2685 */ | |
2686 #ifndef WIN32 | |
2687 ret = sAT_PlusCMGL ( (T_ACI_CMD_SRC)srcId, cmglStat, 0, SMS_READ_Normal ); | |
2688 #else | |
2689 ret = sAT_PlusCMGL ( srcId, cmglStat, 0, smsReadMode ); | |
2690 #endif | |
2691 | |
2692 if ( ret EQ AT_EXCT ) | |
2693 { | |
2694 src_params->curAtCmd = AT_CMD_CMGL; | |
2695 return (ATI_EXCT); | |
2696 } | |
2697 else | |
2698 { | |
2699 cmdCmsError ( CMS_ERR_NotPresent ); /* use aciErrDesc */ | |
2700 return (ATI_FAIL); | |
2701 } | |
2702 | |
2703 #endif /*FF_ATI_BAT*/ | |
2704 } | |
2705 | |
2706 /* | |
2707 +--------------------------------------------------------------------+ | |
2708 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2709 | STATE : code ROUTINE : atPlusCNMI | | |
2710 +--------------------------------------------------------------------+ | |
2711 | |
2712 PURPOSE : +CNMI command (new messgae indication settings ) | |
2713 */ | |
2714 | |
2715 GLOBAL T_ATI_RSLT atPlusCNMI (char *cl, UBYTE srcId) | |
2716 { | |
2717 T_ACI_CNMI_MT mt = CNMI_MT_NotPresent; | |
2718 T_ACI_CNMI_BM bm = CNMI_BM_NotPresent; | |
2719 T_ACI_CNMI_DS ds = CNMI_DS_NotPresent; | |
2720 T_ACI_CNMI_MOD mode = CNMI_MOD_NotPresent; | |
2721 T_ACI_CNMI_BFR bfr = CNMI_BFR_NotPresent; | |
2722 T_ACI_RETURN ret = AT_FAIL; | |
2723 | |
2724 TRACE_FUNCTION("atPlusCNMI()"); | |
2725 | |
2726 /* input functionality */ | |
2727 cl = parse ( cl, "ddddd", &mode, &mt, &bm, &ds, &bfr ); | |
2728 | |
2729 if ( !cl OR | |
2730 mode < CNMI_MOD_NotPresent OR | |
2731 mode > CNMI_MOD_BufferAndFlush OR | |
2732 bfr < CNMI_BFR_NotPresent OR | |
2733 bfr > CNMI_BFR_Clear OR /*lint !e685 (Warning: Relational operator '>' always evaluates to 'false')*/ | |
2734 ( bfr EQ CNMI_BFR_Flush AND | |
2735 strlen ( cl ) > 0 ) ) | |
2736 { | |
2737 io_sendConfirm ( srcId, cmdCmsError ( CMS_ERR_OpNotAllowed ), ATI_ERROR_OUTPUT ); | |
2738 cmdErrStr = NULL; | |
2739 return ATI_FAIL_NO_OUTPUT; | |
2740 } | |
2741 | |
2742 ret = sAT_PlusCNMI ((T_ACI_CMD_SRC) srcId, mt, bm, ds ); | |
2743 if ( (ret EQ AT_FAIL) OR (ret EQ AT_BUSY) ) | |
2744 { | |
2745 io_sendConfirm ( srcId, cmdCmsError ( CMS_ERR_NotPresent ), ATI_ERROR_OUTPUT ); | |
2746 cmdErrStr = NULL; | |
2747 return ATI_FAIL_NO_OUTPUT; | |
2748 } | |
2749 | |
2750 /* | |
2751 *----------------------Issue 25033-------------------------------- | |
2752 * The source ID issuing the CNMI command is stored and henceforth | |
2753 * all the unsolicited SMS indications are sent to this source | |
2754 *----------------------------------------------------------------- | |
2755 */ | |
2756 if(srcId NEQ CMD_SRC_LCL) | |
2757 smsShrdPrm.smsSrcId = (T_ACI_CMD_SRC)srcId; | |
2758 | |
2759 if ( bfr NEQ CNMI_BFR_NotPresent ) | |
2760 at.CNMI_bfr = ( UBYTE ) bfr; | |
2761 | |
2762 if ( mode NEQ CNMI_MOD_NotPresent ) | |
2763 at.CNMI_mode = ( UBYTE ) mode; | |
2764 | |
2765 if (mode EQ CNMI_MOD_DiscardOrForward OR /* 07.05:3.4.1: check for <mode> 1...3 */ | |
2766 mode EQ CNMI_MOD_BufferAndFlush) | |
2767 { | |
2768 if ( at.CNMI_bfr EQ CNMI_BFR_Flush ) | |
2769 { | |
2770 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
2771 cmdErrStr = NULL; | |
2772 | |
2773 if( smsShrdPrm.CSMSservice NEQ CSMS_SERV_GsmPh2Plus ) | |
2774 { | |
2775 cmd_flushCnmiBuf(); | |
2776 } | |
2777 else | |
2778 { | |
2779 cmd_flushCnmiBufOneByOne(); | |
2780 } | |
2781 return ATI_CMPL_NO_OUTPUT; | |
2782 } | |
2783 else | |
2784 { | |
2785 cmd_clearCnmiBuf (); | |
2786 } | |
2787 } | |
2788 | |
2789 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
2790 cmdErrStr = NULL; | |
2791 | |
2792 return ATI_CMPL_NO_OUTPUT; | |
2793 } | |
2794 | |
2795 GLOBAL T_ATI_RSLT tesatPlusCNMI (char *cl, UBYTE srcId) | |
2796 { | |
2797 /* query parameter ranges */ | |
2798 io_sendMessage ( srcId, "+CNMI: (0-2),(0-3),(0,2),(0,1),(0,1)", ATI_NORMAL_OUTPUT ); | |
2799 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
2800 cmdErrStr = NULL; | |
2801 | |
2802 return ATI_CMPL_NO_OUTPUT; | |
2803 } | |
2804 | |
2805 GLOBAL T_ATI_RSLT queatPlusCNMI (char *cl, UBYTE srcId) | |
2806 { | |
2807 char* me = "+CNMI: "; | |
2808 T_ACI_CNMI_MT mt = CNMI_MT_NotPresent; | |
2809 T_ACI_CNMI_BM bm = CNMI_BM_NotPresent; | |
2810 T_ACI_CNMI_DS ds = CNMI_DS_NotPresent; | |
2811 | |
2812 if ( qAT_PlusCNMI ( (T_ACI_CMD_SRC)srcId, &mt, &bm, &ds ) EQ AT_CMPL ) | |
2813 { | |
2814 sprintf ( g_sa,"%s%d,%d,%d,%d,%d", me, at.CNMI_mode, | |
2815 mt, bm, ds, at.CNMI_bfr ); | |
2816 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
2817 } | |
2818 else | |
2819 { | |
2820 io_sendConfirm ( srcId, cmdCmsError ( CMS_ERR_NotPresent ), ATI_ERROR_OUTPUT ); | |
2821 cmdErrStr = NULL; | |
2822 return ATI_FAIL_NO_OUTPUT; | |
2823 } | |
2824 | |
2825 io_sendConfirm ( srcId, cmdAtError ( atOk ), ATI_NORMAL_OUTPUT ); | |
2826 cmdErrStr = NULL; | |
2827 return ATI_CMPL_NO_OUTPUT; | |
2828 } | |
2829 | |
2830 #ifdef TI_PS_FF_AT_P_CMD_CPRSM | |
2831 /* | |
2832 +--------------------------------------------------------------------+ | |
2833 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2834 | STATE : code ROUTINE : setatPercentCPRSM | | |
2835 +--------------------------------------------------------------------+ | |
2836 | |
2837 PURPOSE : %CPRSM set command | |
2838 set the receiving of SMS to | |
2839 1 -- Pause or | |
2840 2 -- Resume | |
2841 | |
2842 */ | |
2843 | |
2844 GLOBAL T_ATI_RSLT setatPercentCPRSM (char *cl, UBYTE srcId) | |
2845 { | |
2846 T_ACI_RETURN ret = AT_FAIL; | |
2847 T_ACI_CPRSM_MOD mode = CPRSM_MOD_NotPresent; | |
2848 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2849 | |
2850 src_params->curAtCmd = AT_CMD_CPRSM; | |
2851 | |
2852 /* parse command */ | |
2853 cl = parse (cl, "d", &mode); | |
2854 | |
2855 /* check whether parsing has been successful */ | |
2856 if (!cl) | |
2857 { | |
2858 /* undefined value for mode */ | |
2859 TRACE_EVENT("+CPRSM ERROR: parse cmd failed!"); | |
2860 cmdCmsError(CMS_ERR_OpNotAllowed); | |
2861 return ATI_FAIL; | |
2862 } | |
2863 | |
2864 #ifdef FF_ATI_BAT | |
2865 { | |
2866 T_BAT_cmd_send cmd; | |
2867 T_BAT_cmd_set_percent_cprsm my_bat_set_percent_cprsm; | |
2868 | |
2869 TRACE_FUNCTION("setatPercentCPRSM() calls bat_send() <=== as APPLICATION"); | |
2870 | |
2871 memset(&my_bat_set_percent_cprsm, 0, sizeof(my_bat_set_percent_cprsm)); | |
2872 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPRSM; | |
2873 cmd.params.ptr_set_percent_cprsm = &my_bat_set_percent_cprsm; | |
2874 | |
2875 my_bat_set_percent_cprsm.mode = mode; | |
2876 | |
2877 bat_send(ati_bat_get_client(srcId), &cmd); | |
2878 | |
2879 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
2880 } | |
2881 #else /* OLD FUNCTION BODY */ | |
2882 | |
2883 TRACE_FUNCTION("setatPercentCPRSM()"); | |
2884 | |
2885 switch (mode) /* check which mode has to be set and set it */ | |
2886 { | |
2887 case(CPRSM_MOD_Resume): | |
2888 case(CPRSM_MOD_Pause): | |
2889 { | |
2890 /* AT interface function called */ | |
2891 ret = sAT_PercentCPRSM((T_ACI_CMD_SRC)srcId, mode); | |
2892 break; | |
2893 } | |
2894 default: | |
2895 /* undefined value for mode */ | |
2896 TRACE_EVENT_P1("+CPRSM ERROR: undefined value for mode: %d", mode); | |
2897 cmdCmsError(CMS_ERR_OpNotSup); | |
2898 return ATI_FAIL; | |
2899 } | |
2900 | |
2901 /* check result */ | |
2902 switch (ret) | |
2903 { | |
2904 case (AT_CMPL): | |
2905 /* operation successfully completed */ | |
2906 break; | |
2907 case (AT_EXCT): | |
2908 /* operation still executing */ | |
2909 src_params->curAtCmd = AT_CMD_COPS; | |
2910 break; | |
2911 default: | |
2912 /* unknown result type */ | |
2913 TRACE_EVENT_P1("+CPRSM ERROR: undefined result: %d", ret); | |
2914 cmdCmsError(CMS_ERR_UnknownErr); /*Command failed*/ | |
2915 return ATI_FAIL; | |
2916 } | |
2917 | |
2918 /* map error to ATI type and return */ | |
2919 return (map_aci_2_ati_rslt(ret)); | |
2920 | |
2921 #endif /* no FF_ATI_BAT*/ | |
2922 } | |
2923 | |
2924 /* | |
2925 +--------------------------------------------------------------------+ | |
2926 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2927 | STATE : code ROUTINE : queatPercentCPRSM | | |
2928 +--------------------------------------------------------------------+ | |
2929 | |
2930 PURPOSE : %CPRSM query command | |
2931 request the current state of the pause flag for receiving SMS | |
2932 */ | |
2933 | |
2934 GLOBAL T_ATI_RSLT queatPercentCPRSM (char *cl, UBYTE srcId) | |
2935 { | |
2936 T_ACI_RETURN ret = AT_FAIL; | |
2937 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
2938 | |
2939 TRACE_FUNCTION("queatPercentCPRSM()"); | |
2940 | |
2941 ret = qAT_PercentCPRSM( (T_ACI_CMD_SRC)srcId ); | |
2942 | |
2943 | |
2944 if (ret EQ AT_EXCT) | |
2945 { | |
2946 src_params->curAtCmd = AT_CMD_CPRSM; | |
2947 return (ATI_EXCT); | |
2948 } | |
2949 else | |
2950 { | |
2951 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
2952 return (ATI_FAIL); | |
2953 } | |
2954 } | |
2955 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */ | |
2956 | |
2957 /* | |
2958 +--------------------------------------------------------------------+ | |
2959 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2960 | STATE : code ROUTINE : cmd_clearCnmiBuf | | |
2961 +--------------------------------------------------------------------+ | |
2962 | |
2963 PURPOSE : This function clears the buffer for storing new message | |
2964 indications while the serial interface is reserved for | |
2965 data transmission. | |
2966 */ | |
2967 GLOBAL void cmd_clearCnmiBuf (void) | |
2968 { | |
2969 UBYTE i; | |
2970 | |
2971 for ( i = 0; i < CNMI_BUF_SIZE; i++ ) | |
2972 cnmiBuf.sCnmiElement[i].type = CNMI_NONE; | |
2973 | |
2974 cnmiBuf.next = 0; | |
2975 } | |
2976 | |
2977 /* | |
2978 +--------------------------------------------------------------------+ | |
2979 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
2980 | STATE : code ROUTINE : cmd_flushCnmiBuf | | |
2981 +--------------------------------------------------------------------+ | |
2982 | |
2983 PURPOSE : This function flushes the buffer for storing new message | |
2984 indications while the serial interface is released from | |
2985 data transmission. | |
2986 */ | |
2987 GLOBAL void cmd_flushCnmiBuf (void) | |
2988 { | |
2989 UBYTE i = cnmiBuf.next; | |
2990 UBYTE entries_read = 0; | |
2991 | |
2992 TRACE_FUNCTION("cmd_flushCnmiBuf"); | |
2993 | |
2994 if ( cnmiBuf.sCnmiElement[0].type EQ CNMI_NONE ) | |
2995 { | |
2996 entries_read = CNMI_BUF_SIZE; /* no need to read anything at all */ | |
2997 /*moreEntries = FALSE; */ | |
2998 } | |
2999 else if ( cnmiBuf.next EQ CNMI_BUF_SIZE OR | |
3000 cnmiBuf.sCnmiElement[cnmiBuf.next].type EQ CNMI_NONE ) | |
3001 { | |
3002 i = 0; | |
3003 } | |
3004 | |
3005 cnmiFlushInProgress = TRUE; | |
3006 | |
3007 while ( entries_read < CNMI_BUF_SIZE /*moreEntries*/ ) | |
3008 { | |
3009 if (smsShrdPrm.pDecMsg) | |
3010 { /* clear p_sm buffer */ | |
3011 ACI_MFREE(smsShrdPrm.pDecMsg); | |
3012 smsShrdPrm.pDecMsg = NULL; | |
3013 } | |
3014 | |
3015 switch ( cnmiBuf.sCnmiElement[i].type ) | |
3016 { | |
3017 | |
3018 case ( CNMI_CMT ): | |
3019 srcId_cb = smsShrdPrm.smsSrcId; | |
3020 rCI_PlusCMT ( &cnmiBuf.sCnmiElement[i].indct.cmt ); | |
3021 break; | |
3022 | |
3023 case ( CNMI_CMTI ): | |
3024 srcId_cb = smsShrdPrm.smsSrcId; | |
3025 rCI_PlusCMTI ( cnmiBuf.sCnmiElement[i].indct.cmti.mem, | |
3026 cnmiBuf.sCnmiElement[i].indct.cmti.index ); | |
3027 break; | |
3028 | |
3029 case ( CNMI_CBM ): | |
3030 srcId_cb = smsShrdPrm.smsSrcId; | |
3031 rCI_PlusCBM ( &cnmiBuf.sCnmiElement[i].indct.cbm ); | |
3032 break; | |
3033 | |
3034 case ( CNMI_CDS ): | |
3035 srcId_cb = smsShrdPrm.smsSrcId; | |
3036 rCI_PlusCDS ( &cnmiBuf.sCnmiElement[i].indct.cds ); | |
3037 break; | |
3038 | |
3039 default: | |
3040 /* moreEntries = FALSE; */ | |
3041 break; | |
3042 } | |
3043 | |
3044 cnmiBuf.sCnmiElement[i].type = CNMI_NONE; | |
3045 i++; | |
3046 entries_read++; | |
3047 | |
3048 if ( i EQ CNMI_BUF_SIZE ) | |
3049 i = 0; | |
3050 } | |
3051 | |
3052 cnmiFlushInProgress = FALSE; | |
3053 cnmiBuf.next = 0; | |
3054 } | |
3055 | |
3056 /* | |
3057 +--------------------------------------------------------------------------+ | |
3058 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3059 | STATE : code ROUTINE : cmd_flushCnmiBufOneByOne | | |
3060 +--------------------------------------------------------------------------+ | |
3061 | |
3062 PURPOSE : This function flushes the CNMI buffer in case of Phase2+ mode, | |
3063 while the serial interface is released from | |
3064 data transmission or an +CNMI <bfr>==Flush is requested. | |
3065 */ | |
3066 | |
3067 GLOBAL void cmd_flushCnmiBufOneByOne(void) | |
3068 { /* flushing +CMT one by one, because acknowledge is necessary */ | |
3069 T_CNMI_BUFFER_ELEMENT* psMsgInCnmiBuffer = NULL; | |
3070 UINT16 uiCnmiMsgCounter = 0; | |
3071 | |
3072 for( uiCnmiMsgCounter=0; | |
3073 (uiCnmiMsgCounter<cmd_getNumberOfCnmiEntrys()) AND | |
3074 (waitForCnmaFromBuffer_SrcId EQ CMD_SRC_NONE); | |
3075 uiCnmiMsgCounter++ ) | |
3076 { /* there are entrys in the CNMI buffer --> read it */ | |
3077 psMsgInCnmiBuffer = cmd_getCnmiMessage(uiCnmiMsgCounter); /* FIFO */ | |
3078 | |
3079 if( psMsgInCnmiBuffer EQ NULL ) | |
3080 { | |
3081 TRACE_EVENT("ati_switch_mode() : Error at CNMI-buffer handling: NULL-pointer access!!"); | |
3082 return; | |
3083 } | |
3084 | |
3085 cnmiFlushInProgress = TRUE; /* needed for the rCI_...commands */ | |
3086 | |
3087 if (smsShrdPrm.pDecMsg) | |
3088 { /* clear p_sm buffer */ | |
3089 ACI_MFREE(smsShrdPrm.pDecMsg); | |
3090 smsShrdPrm.pDecMsg = NULL; | |
3091 } | |
3092 | |
3093 switch ( psMsgInCnmiBuffer->type ) | |
3094 { | |
3095 case ( CNMI_CMTI ) : | |
3096 srcId_cb = smsShrdPrm.smsSrcId; | |
3097 rCI_PlusCMTI ( psMsgInCnmiBuffer->indct.cmti.mem, psMsgInCnmiBuffer->indct.cmti.index ); | |
3098 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3099 uiCnmiMsgCounter--; | |
3100 break; | |
3101 | |
3102 case ( CNMI_CBM ) : | |
3103 srcId_cb = smsShrdPrm.smsSrcId; | |
3104 rCI_PlusCBM ( &psMsgInCnmiBuffer->indct.cbm ); | |
3105 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3106 uiCnmiMsgCounter--; | |
3107 break; | |
3108 | |
3109 case ( CNMI_CDS ) : | |
3110 srcId_cb = smsShrdPrm.smsSrcId; | |
3111 rCI_PlusCDS ( &psMsgInCnmiBuffer->indct.cds ); | |
3112 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3113 uiCnmiMsgCounter--; | |
3114 break; | |
3115 | |
3116 /* special handling for +CMT --> acknowledge needed */ | |
3117 case ( CNMI_CMT ) : | |
3118 { | |
3119 srcId_cb = smsShrdPrm.smsSrcId; | |
3120 rCI_PlusCMT ( &psMsgInCnmiBuffer->indct.cmt ); | |
3121 TIMERSTART(ACI_CNMA_TIMER_VALUE, ACI_CNMA_TIMER_HANDLE); | |
3122 waitForCnmaFromBuffer_SrcId = smsShrdPrm.smsSrcId; | |
3123 break; | |
3124 } | |
3125 default: | |
3126 TRACE_EVENT("ati_switch_mode() : wrong CNMI-buffer handling: wrong Msg. type"); | |
3127 } | |
3128 } | |
3129 cnmiFlushInProgress = FALSE; | |
3130 } | |
3131 | |
3132 /* | |
3133 +--------------------------------------------------------------------+ | |
3134 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3135 | STATE : code ROUTINE : cmd_addCnmiNtry | | |
3136 +--------------------------------------------------------------------+ | |
3137 | |
3138 PURPOSE : This function add a new entry to the buffer for storing | |
3139 new message indications while the serial interface is | |
3140 reserved for data transmission. | |
3141 */ | |
3142 GLOBAL void cmd_addCnmiNtry ( UBYTE type, T_CNMI_IND* newInd ) | |
3143 { | |
3144 TRACE_FUNCTION("cmd_addCnmiNtry"); | |
3145 | |
3146 if ( type > CNMI_CDS OR type < CNMI_CMT ) | |
3147 return; | |
3148 | |
3149 if ( cnmiBuf.next EQ CNMI_BUF_SIZE ) | |
3150 { | |
3151 cnmiBuf.next = 0; | |
3152 } | |
3153 | |
3154 switch ( type ) | |
3155 { | |
3156 case ( CNMI_CMT ): | |
3157 cnmiBuf.sCnmiElement[cnmiBuf.next].indct.cmt = newInd -> cmt; | |
3158 break; | |
3159 | |
3160 case ( CNMI_CMTI ): | |
3161 cnmiBuf.sCnmiElement[cnmiBuf.next].indct.cmti = newInd -> cmti; | |
3162 break; | |
3163 | |
3164 | |
3165 case ( CNMI_CBM ): | |
3166 cnmiBuf.sCnmiElement[cnmiBuf.next].indct.cbm = newInd -> cbm; | |
3167 break; | |
3168 | |
3169 case ( CNMI_CDS ): | |
3170 cnmiBuf.sCnmiElement[cnmiBuf.next].indct.cds = newInd -> cds; | |
3171 break; | |
3172 } | |
3173 | |
3174 cnmiBuf.sCnmiElement[cnmiBuf.next].type = type; | |
3175 cnmiBuf.next++; | |
3176 } | |
3177 | |
3178 | |
3179 /* | |
3180 +-----------------------------------------------------------------------+ | |
3181 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3182 | STATE : code ROUTINE : getNumberOfCnmiEntrys | | |
3183 +-----------------------------------------------------------------------+ | |
3184 | |
3185 PURPOSE : This function is the responsible to get the count | |
3186 of CNMI entrys in the CNMI buffer. | |
3187 */ | |
3188 GLOBAL UINT16 cmd_getNumberOfCnmiEntrys(void) | |
3189 { | |
3190 return cnmiBuf.next; | |
3191 } | |
3192 | |
3193 | |
3194 /* | |
3195 +-----------------------------------------------------------------------+ | |
3196 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3197 | STATE : code ROUTINE : getCnmiMessage | | |
3198 +-----------------------------------------------------------------------+ | |
3199 | |
3200 PURPOSE : This function is the responsible to get an entire Msg. | |
3201 from the CNMI buffer. That means, this function only returns | |
3202 the pointer to the beginning of the CNMI buffer element. | |
3203 If the buffer is empty or if the uiIndex parameter is bigger | |
3204 than allowed, the return pointer will be NULL. | |
3205 */ | |
3206 GLOBAL T_CNMI_BUFFER_ELEMENT* cmd_getCnmiMessage(UINT16 uiIndex) | |
3207 { | |
3208 T_CNMI_BUFFER_ELEMENT* psCnmiBufferElement = NULL; | |
3209 | |
3210 if( (cnmiBuf.next EQ 0) OR | |
3211 (cnmiBuf.sCnmiElement[0].type EQ CNMI_NONE) OR | |
3212 (uiIndex >= CNMI_BUF_SIZE ) ) | |
3213 { | |
3214 return NULL; | |
3215 } | |
3216 | |
3217 psCnmiBufferElement = &cnmiBuf.sCnmiElement[uiIndex]; | |
3218 return psCnmiBufferElement; /* returns the pointer to the element */ | |
3219 } | |
3220 | |
3221 | |
3222 /* | |
3223 +-----------------------------------------------------------------------+ | |
3224 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3225 | STATE : code ROUTINE : clearFirstCnmiMessage | | |
3226 +-----------------------------------------------------------------------+ | |
3227 | |
3228 PURPOSE : This function is the responsible to clear an entire Msg. | |
3229 specified by uiIndex from the CNMI buffer. | |
3230 After succesful return, the message was delete from the CNMI | |
3231 buffer and the buffer has been resorted. | |
3232 */ | |
3233 GLOBAL BOOL cmd_clearCnmiMessage(UINT16 uiIndex) | |
3234 { | |
3235 UINT16 uiBufCount; | |
3236 | |
3237 if( (cnmiBuf.next EQ 0) OR | |
3238 (cnmiBuf.sCnmiElement[0].type EQ CNMI_NONE)) | |
3239 { | |
3240 return FALSE; /* CNMI buffer is empty or flushing is in progress */ | |
3241 } | |
3242 | |
3243 /* delete first entry while resorting the buffer */ | |
3244 for( uiBufCount = uiIndex; uiBufCount<(CNMI_BUF_SIZE-1); uiBufCount++ ) | |
3245 { | |
3246 memcpy( &cnmiBuf.sCnmiElement[uiBufCount], &cnmiBuf.sCnmiElement[uiBufCount+1], sizeof(T_CNMI_BUFFER_ELEMENT) ); | |
3247 } | |
3248 | |
3249 cnmiBuf.next--; | |
3250 | |
3251 return TRUE; | |
3252 } | |
3253 | |
3254 /* | |
3255 +-----------------------------------------------------------------------+ | |
3256 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3257 | STATE : code ROUTINE : getCnmiMessage | | |
3258 +-----------------------------------------------------------------------+ | |
3259 | |
3260 PURPOSE : This function is the responsible to get the first entire Msg. | |
3261 from the CNMI buffer. That means, this function only returns | |
3262 the pointer to the beginning of the CNMI buffer. | |
3263 If the buffer is empty, the return pointer will be NULL. | |
3264 */ | |
3265 GLOBAL T_CNMI_BUFFER_ELEMENT* cmd_getFirstCnmiMessage(void) | |
3266 { | |
3267 return cmd_getCnmiMessage(0); | |
3268 } | |
3269 | |
3270 | |
3271 /* | |
3272 +-----------------------------------------------------------------------+ | |
3273 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3274 | STATE : code ROUTINE : clearFirstCnmiMessage | | |
3275 +-----------------------------------------------------------------------+ | |
3276 | |
3277 PURPOSE : This function is the responsible to clear the first entire Msg. | |
3278 from the CNMI buffer. After succesful return, the | |
3279 message was delete from the CNMI buffer. | |
3280 */ | |
3281 GLOBAL BOOL cmd_clearFirstCnmiMessage(void) | |
3282 { | |
3283 return cmd_clearCnmiMessage(0); | |
3284 } | |
3285 | |
3286 | |
3287 /* | |
3288 +--------------------------------------------------------------------+ | |
3289 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3290 | STATE : code ROUTINE : rCI_IoMode | | |
3291 +--------------------------------------------------------------------+ | |
3292 | |
3293 PURPOSE : This function will be called when IO mode of serial | |
3294 interface has changed. | |
3295 */ | |
3296 GLOBAL void rCI_IoMode ( void ) | |
3297 { | |
3298 TRACE_FUNCTION ( "rCI_IoMode (): actually not awaited !!" ); | |
3299 | |
3300 /* if ( io_getIoMode () EQ IO_MODE_CMD AND | |
3301 at.CNMI_mode EQ CNMI_MOD_Buffer ) | |
3302 cmd_flushCnmiBuf (CMD_SRC_ATI);*/ | |
3303 } | |
3304 | |
3305 | |
3306 | |
3307 /* | |
3308 +--------------------------------------------------------------------+ | |
3309 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3310 | STATE : code ROUTINE : setatPercentCMGRS | | |
3311 +--------------------------------------------------------------------+ | |
3312 | |
3313 PURPOSE : %CMGRS command (Select auto retransmission mode/ | |
3314 request manual retransmission of last failed SMS) | |
3315 */ | |
3316 #ifdef REL99 | |
3317 | |
3318 GLOBAL T_ATI_RSLT setatPercentCMGRS (char *cl, UBYTE srcId) | |
3319 { | |
3320 T_ACI_RETURN ret = AT_FAIL; | |
3321 T_ACI_CMGRS_MODE mode; | |
3322 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3323 | |
3324 TRACE_FUNCTION("setatPercentCMGRS()"); | |
3325 | |
3326 cl = parse (cl,"d",&mode); | |
3327 if ( !cl OR mode > CMGRS_MODE_MANUAL_RETRANS) | |
3328 { | |
3329 cmdCmsError(CMS_ERR_OpNotAllowed); | |
3330 return (ATI_FAIL); | |
3331 } | |
3332 | |
3333 #ifdef FF_ATI_BAT | |
3334 { | |
3335 T_BAT_cmd_send cmd; | |
3336 T_BAT_cmd_set_percent_cmgrs cmgrs; | |
3337 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CMGRS; | |
3338 cmd.params.ptr_set_percent_cmgrs = &cmgrs; | |
3339 | |
3340 cmgrs.mode = (U8)mode; | |
3341 bat_send(ati_bat_get_client(srcId), &cmd); | |
3342 src_params->curAtCmd = AT_CMD_P_CMGRS; | |
3343 return(ATI_EXCT); | |
3344 } | |
3345 #else | |
3346 | |
3347 ret = sAT_PercentCMGRS((T_ACI_CMD_SRC)srcId,mode); | |
3348 | |
3349 if(ret EQ AT_EXCT) | |
3350 { | |
3351 src_params->curAtCmd = AT_CMD_P_CMGRS; | |
3352 return ATI_EXCT; | |
3353 } | |
3354 else if(ret EQ AT_CMPL) | |
3355 { | |
3356 return ATI_CMPL; | |
3357 } | |
3358 else | |
3359 { | |
3360 cmdCmeError( CME_ERR_Unknown ); // use aciErrDesc | |
3361 return (ATI_FAIL); | |
3362 } | |
3363 #endif | |
3364 } | |
3365 | |
3366 GLOBAL T_ATI_RSLT queatPercentCMGRS (char *cl, UBYTE srcId) | |
3367 { | |
3368 T_ACI_RETURN ret = AT_FAIL; | |
3369 | |
3370 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3371 | |
3372 #ifdef FF_ATI_BAT | |
3373 T_BAT_cmd_send cmd; | |
3374 T_BAT_no_parameter dummy; | |
3375 | |
3376 cmd.ctrl_params = BAT_RES_QUE_PERCENT_CMGRS; | |
3377 dummy.bat_dummy = 0xFF; | |
3378 cmd.params.ptr_que_percent_cmgrs = &dummy; | |
3379 | |
3380 bat_send(ati_bat_get_client(srcId),&cmd); | |
3381 | |
3382 return ATI_EXCT; | |
3383 #else | |
3384 UBYTE auto_rep_flag; | |
3385 | |
3386 ret = qAT_PercentCMGRS((T_ACI_CMD_SRC)srcId,&auto_rep_flag); | |
3387 if (ret EQ AT_CMPL) | |
3388 { | |
3389 sprintf(g_sa,"%s: %d","%CMGRS",auto_rep_flag); | |
3390 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3391 return (ATI_CMPL); | |
3392 } | |
3393 else | |
3394 { | |
3395 cmdCmsError(CMS_ERR_NotPresent); // use aciErrDesc | |
3396 return (ATI_FAIL); | |
3397 } | |
3398 #endif | |
3399 } | |
3400 | |
3401 #endif /* REL99 */ | |
3402 | |
3403 | |
3404 /* | |
3405 +-----------------------------------------------------------------------+ | |
3406 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3407 | STATE : code ROUTINE : cmd_handleCnmaTimeout | | |
3408 +-----------------------------------------------------------------------+ | |
3409 | |
3410 PURPOSE : This function will be called when the +CNMA Timer has expired. | |
3411 Now all to be acknowledged +CMT messages whithin the CNMI | |
3412 buffer must be stored in the non-volatile buffer e.g. SIM... | |
3413 Note: all other Msgs. different from +CMT will be deliver | |
3414 to the source and remove from buffer. */ | |
3415 | |
3416 GLOBAL void cmd_handleCnmaTimeout( void ) | |
3417 { | |
3418 UINT16 uiCnmiMsgCounter = 0; | |
3419 T_CNMI_BUFFER_ELEMENT *psMsgInCnmiBuffer = NULL; | |
3420 | |
3421 TRACE_FUNCTION ( "cmd_handleCnmaTimeout()" ); | |
3422 | |
3423 cmhSMS_resetMtDsCnmiParam(); | |
3424 | |
3425 if( waitForCnmaFromBuffer_SrcId EQ CMD_SRC_NONE OR | |
3426 waitForCnmaFromBuffer_SrcId NEQ smsShrdPrm.smsSrcId) | |
3427 { | |
3428 TRACE_EVENT("cmd_handleCnmaTimeout() : Error at CNMI-buffer handling: No +CNMA acknowledge expected!!"); | |
3429 waitForCnmaFromBuffer_SrcId = CMD_SRC_NONE; | |
3430 return; | |
3431 } | |
3432 | |
3433 for( uiCnmiMsgCounter=0; uiCnmiMsgCounter<cmd_getNumberOfCnmiEntrys(); uiCnmiMsgCounter++ ) | |
3434 { /* there are entrys in the CNMI buffer --> read it */ | |
3435 psMsgInCnmiBuffer = cmd_getCnmiMessage(uiCnmiMsgCounter); /* FIFO */ | |
3436 | |
3437 if( psMsgInCnmiBuffer EQ NULL ) | |
3438 { | |
3439 TRACE_EVENT("cmd_handleCnmaTimeout() : Error at CNMI-buffer handling: NULL-pointer access!!"); | |
3440 waitForCnmaFromBuffer_SrcId = CMD_SRC_NONE; | |
3441 return; | |
3442 } | |
3443 | |
3444 cnmiFlushInProgress = TRUE; | |
3445 | |
3446 switch ( psMsgInCnmiBuffer->type ) | |
3447 { | |
3448 case ( CNMI_CMTI ) : | |
3449 srcId_cb = smsShrdPrm.smsSrcId; | |
3450 rCI_PlusCMTI ( psMsgInCnmiBuffer->indct.cmti.mem, psMsgInCnmiBuffer->indct.cmti.index ); | |
3451 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3452 uiCnmiMsgCounter--; | |
3453 break; | |
3454 | |
3455 case ( CNMI_CBM ) : | |
3456 srcId_cb = smsShrdPrm.smsSrcId; | |
3457 rCI_PlusCBM ( &psMsgInCnmiBuffer->indct.cbm ); | |
3458 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3459 uiCnmiMsgCounter--; | |
3460 break; | |
3461 | |
3462 case ( CNMI_CDS ) : | |
3463 srcId_cb = smsShrdPrm.smsSrcId; | |
3464 rCI_PlusCDS ( &psMsgInCnmiBuffer->indct.cds ); | |
3465 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3466 uiCnmiMsgCounter--; | |
3467 break; | |
3468 | |
3469 /* special handling for +CMT --> acknowledge needed */ | |
3470 case ( CNMI_CMT ) : | |
3471 { | |
3472 T_ACI_SM_DATA sPduData; | |
3473 | |
3474 waitForCnmaFromBuffer_SrcId = CMD_SRC_NONE; /* clear CNMA waiting flag */ | |
3475 srcId_cb = smsShrdPrm.smsSrcId; | |
3476 sPduData.len = psMsgInCnmiBuffer->indct.cmt.sms_sdu.l_buf / 8; /* l_buf is in BIT !! */ | |
3477 memcpy( &sPduData.data, &psMsgInCnmiBuffer->indct.cmt.sms_sdu.buf, SIM_PDU_LEN ); | |
3478 cmhSMS_storePduToSim( smsShrdPrm.smsSrcId, SMS_RECORD_REC_UNREAD, &sPduData ); | |
3479 cnmiFlushInProgress = FALSE; | |
3480 return; /* only one SMS can be stored at the SIM here */ | |
3481 } | |
3482 | |
3483 default: | |
3484 TRACE_EVENT("cmd_handleCnmaTimeout() : wrong CNMI-buffer handling: wrong Msg. type"); | |
3485 } | |
3486 cnmiFlushInProgress = FALSE; | |
3487 } | |
3488 } | |
3489 | |
3490 /* | |
3491 +-----------------------------------------------------------------------+ | |
3492 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3493 | STATE : code ROUTINE : cmd_handleCnmaTimeout | | |
3494 +-----------------------------------------------------------------------+ | |
3495 | |
3496 PURPOSE : This function stores the next message - correxponding | |
3497 to a specified source - into the non volatile memory. | |
3498 Note: all other Msgs. different from +CMT will be deliver | |
3499 to the source and remove from buffer. | |
3500 */ | |
3501 GLOBAL BOOL cmd_storeNextCnmiBufMsgToSim( void ) | |
3502 { | |
3503 UINT16 uiCnmiMsgCounter = 0; | |
3504 T_CNMI_BUFFER_ELEMENT *psMsgInCnmiBuffer = NULL; | |
3505 | |
3506 TRACE_FUNCTION ( "cmd_storeNextCnmiBufMsgToSim()" ); | |
3507 | |
3508 if( smsShrdPrm.uiInternalSmsStorage EQ CMD_SRC_NONE OR | |
3509 smsShrdPrm.uiInternalSmsStorage NEQ smsShrdPrm.smsSrcId) | |
3510 { | |
3511 TRACE_EVENT("cmd_storeNextCnmiBufMsgToSim() : no valid source -> abort !!"); | |
3512 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
3513 return(FALSE); | |
3514 } | |
3515 | |
3516 for( uiCnmiMsgCounter=0; uiCnmiMsgCounter<cmd_getNumberOfCnmiEntrys(); uiCnmiMsgCounter++ ) | |
3517 { /* there are entrys in the CNMI buffer --> read it */ | |
3518 psMsgInCnmiBuffer = cmd_getCnmiMessage(uiCnmiMsgCounter); /* FIFO */ | |
3519 | |
3520 if( psMsgInCnmiBuffer EQ NULL ) | |
3521 { | |
3522 TRACE_EVENT("cmd_storeNextCnmiBufMsgToSim() : Error at CNMI-buffer handling: NULL-pointer access!!"); | |
3523 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
3524 return(FALSE); | |
3525 } | |
3526 | |
3527 cnmiFlushInProgress = TRUE; | |
3528 | |
3529 switch ( psMsgInCnmiBuffer->type ) | |
3530 { | |
3531 case ( CNMI_CMTI ) : | |
3532 srcId_cb = smsShrdPrm.smsSrcId; | |
3533 rCI_PlusCMTI ( psMsgInCnmiBuffer->indct.cmti.mem, psMsgInCnmiBuffer->indct.cmti.index ); | |
3534 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3535 uiCnmiMsgCounter--; | |
3536 break; | |
3537 | |
3538 case ( CNMI_CBM ) : | |
3539 srcId_cb = smsShrdPrm.smsSrcId; | |
3540 rCI_PlusCBM ( &psMsgInCnmiBuffer->indct.cbm ); | |
3541 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3542 uiCnmiMsgCounter--; | |
3543 break; | |
3544 | |
3545 case ( CNMI_CDS ) : | |
3546 srcId_cb = smsShrdPrm.smsSrcId; | |
3547 rCI_PlusCDS ( &psMsgInCnmiBuffer->indct.cds ); | |
3548 cmd_clearCnmiMessage(uiCnmiMsgCounter); | |
3549 uiCnmiMsgCounter--; | |
3550 break; | |
3551 | |
3552 /* special handling for +CMT --> acknowledge needed */ | |
3553 case ( CNMI_CMT ) : | |
3554 { | |
3555 T_ACI_SM_DATA sPduData; | |
3556 | |
3557 srcId_cb = smsShrdPrm.smsSrcId; | |
3558 sPduData.len = psMsgInCnmiBuffer->indct.cmt.sms_sdu.l_buf / 8; /* l_buf is in BIT !! */ | |
3559 memcpy( &sPduData.data, &psMsgInCnmiBuffer->indct.cmt.sms_sdu.buf, SIM_PDU_LEN ); | |
3560 cmhSMS_storePduToSim( smsShrdPrm.smsSrcId, SMS_RECORD_REC_UNREAD, &sPduData ); | |
3561 cnmiFlushInProgress = FALSE; | |
3562 return(TRUE); /* only one SMS can be stored at the SIM here */ | |
3563 } | |
3564 | |
3565 default: | |
3566 TRACE_EVENT("cmd_handleCnmaTimeout() : wrong CNMI-buffer handling: wrong Msg. type"); | |
3567 } | |
3568 cnmiFlushInProgress = FALSE; | |
3569 } | |
3570 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; /* no more +CMT has to be store */ | |
3571 return(FALSE); | |
3572 } | |
3573 | |
3574 /* | |
3575 +--------------------------------------------------------------------+ | |
3576 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3577 | STATE : code ROUTINE : setatPlusCMMS | | |
3578 +--------------------------------------------------------------------+ | |
3579 | |
3580 PURPOSE : +CMMS command (More Messages To Send) | |
3581 */ | |
3582 | |
3583 GLOBAL T_ATI_RSLT setatPlusCMMS (char *cl, UBYTE srcId) | |
3584 { | |
3585 T_ACI_RETURN ret = AT_FAIL; | |
3586 S8 mode = 0; | |
3587 | |
3588 TRACE_FUNCTION("setatPlusCMMS()"); | |
3589 | |
3590 cl = parse (cl,"r",&mode); | |
3591 | |
3592 /* | |
3593 * no mode values allowed other than 0-2 | |
3594 */ | |
3595 if ( !cl OR (mode < CMMS_MODE_DEF OR mode > CMMS_MODE_TWO)) | |
3596 { | |
3597 cmdCmsError(CMS_ERR_OpNotAllowed); | |
3598 return (ATI_FAIL); | |
3599 } | |
3600 ret = sAT_PlusCMMS((T_ACI_CMD_SRC)srcId,mode); | |
3601 if (ret NEQ AT_CMPL) | |
3602 { | |
3603 cmdCmsError(CMS_ERR_UnknownErr); | |
3604 return (ATI_FAIL); | |
3605 } | |
3606 return (map_aci_2_ati_rslt(ret)); | |
3607 } | |
3608 | |
3609 /* | |
3610 +--------------------------------------------------------------------+ | |
3611 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3612 | STATE : code ROUTINE : queatPlusCMMS | | |
3613 +--------------------------------------------------------------------+ | |
3614 | |
3615 PURPOSE : +CMMS query command | |
3616 */ | |
3617 GLOBAL T_ATI_RSLT queatPlusCMMS (char *cl, UBYTE srcId) | |
3618 { | |
3619 T_ACI_RETURN ret = AT_FAIL; | |
3620 UBYTE mode = CMMS_MODE_DEF; | |
3621 | |
3622 TRACE_FUNCTION("queatPlusCMMS()"); | |
3623 | |
3624 ret = qAT_PlusCMMS ((T_ACI_CMD_SRC)srcId,&mode); | |
3625 if (ret EQ AT_CMPL) | |
3626 { | |
3627 sprintf(g_sa, "+CMMS: %d", mode); | |
3628 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
3629 return (ATI_CMPL); | |
3630 } | |
3631 else | |
3632 { | |
3633 cmdCmsError(CMS_ERR_NotPresent); | |
3634 return (ATI_FAIL); | |
3635 } | |
3636 } | |
3637 | |
3638 /* | |
3639 +-------------------------------------------------------------------------+ | |
3640 | PROJECT : GSM-F&D MODULE : ATI_SMS | | |
3641 | STATE : finished ROUTINE : txt_rdmode_to_smsrdmode| | |
3642 +-------------------------------------------------------------------------+ | |
3643 | |
3644 PURPOSE : converts the text read mode to smsReadMode. | |
3645 | |
3646 */ | |
3647 GLOBAL T_ATI_RSLT txt_rdmode_to_smsrdmode(char *txt_rdmode) | |
3648 { | |
3649 UBYTE i = 0; | |
3650 | |
3651 if (txt_rdmode[0] EQ '\0') | |
3652 { | |
3653 strcpy (txt_rdmode, sms_rdmode[0].name); /* NORMAL as default */ | |
3654 } | |
3655 while ( sms_rdmode[i].name NEQ NULL AND | |
3656 strcmp ( sms_rdmode[i].name, txt_rdmode ) NEQ 0 ) | |
3657 { | |
3658 i++; | |
3659 } | |
3660 | |
3661 if ( sms_rdmode[i].name EQ NULL ) | |
3662 { | |
3663 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
3664 return (ATI_FAIL); | |
3665 } | |
3666 smsReadMode = sms_rdmode[i].rdmode; | |
3667 return ATI_CMPL; | |
3668 } | |
3669 | |
3670 | |
3671 /* | |
3672 +--------------------------------------------------------------------+ | |
3673 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3674 | STATE : code ROUTINE : atPercentCMGL | | |
3675 +--------------------------------------------------------------------+ | |
3676 | |
3677 PURPOSE : %CMGL command (List Message) | |
3678 */ | |
3679 | |
3680 GLOBAL T_ATI_RSLT atPercentCMGL (char *cl, UBYTE srcId) | |
3681 { | |
3682 T_ACI_RETURN ret; | |
3683 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3684 | |
3685 #ifdef SMS_PDU_SUPPORT | |
3686 T_ACI_CMGF_MOD mode; | |
3687 #endif | |
3688 CHAR txtStat[15]= {0}; | |
3689 CHAR txtRdMode[20] = {0}; | |
3690 USHORT i; | |
3691 | |
3692 TRACE_FUNCTION("atPercentCMGL()"); | |
3693 | |
3694 cmglStat = SMS_STAT_NotPresent; | |
3695 smsReadMode = SMS_READ_NotPresent; | |
3696 | |
3697 if (*cl EQ '\0') | |
3698 { | |
3699 smsReadMode = SMS_READ_Normal; | |
3700 } | |
3701 else | |
3702 { | |
3703 /* | |
3704 * Request of a list of stored SMS messages | |
3705 * Parameter stat is optional | |
3706 */ | |
3707 #ifdef SMS_PDU_SUPPORT | |
3708 /* | |
3709 * request current mode | |
3710 */ | |
3711 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
3712 if (mode EQ 0) | |
3713 { | |
3714 | |
3715 /* | |
3716 * %CMGL=[stat],[preview] | |
3717 */ | |
3718 cl = parse (cl, "dd", &cmglStat, &smsReadMode ); | |
3719 if ( !cl | |
3720 OR ((cmglStat < SMS_STAT_RecUnread OR cmglStat > SMS_STAT_All) | |
3721 AND smsReadMode EQ SMS_READ_NotPresent) | |
3722 OR (cmglStat < SMS_STAT_RecUnread AND smsReadMode > SMS_READ_NotPresent) | |
3723 OR (smsReadMode > SMS_READ_StatusChange)) | |
3724 { | |
3725 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
3726 return (ATI_FAIL); | |
3727 } | |
3728 } | |
3729 else | |
3730 #endif | |
3731 { | |
3732 | |
3733 /* | |
3734 * %CMGL=[stat],[preview] | |
3735 */ | |
3736 cl = parse (cl, "ss", (LONG)sizeof(txtStat), txtStat, | |
3737 (LONG)sizeof(txtRdMode), txtRdMode); | |
3738 if ( !cl OR (txtStat[0] EQ '\0' AND txtRdMode[0] NEQ '\0')) | |
3739 { | |
3740 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
3741 return (ATI_FAIL); | |
3742 } | |
3743 if (txtStat[0] EQ '\0') | |
3744 strcpy (txtStat, sms_stat[4].name); /* ALL as default */ | |
3745 | |
3746 i = 0; | |
3747 while ( sms_stat[i].name NEQ NULL AND | |
3748 strcmp ( sms_stat[i].name, txtStat ) NEQ 0 ) | |
3749 i++; | |
3750 | |
3751 if ( sms_stat[i].name EQ NULL ) | |
3752 { | |
3753 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
3754 return (ATI_FAIL); | |
3755 } | |
3756 cmglStat = sms_stat[i].stat; | |
3757 | |
3758 if (txt_rdmode_to_smsrdmode(txtRdMode) EQ ATI_FAIL) | |
3759 { | |
3760 return (ATI_FAIL); | |
3761 } | |
3762 } | |
3763 } | |
3764 | |
3765 #ifdef FF_ATI_BAT | |
3766 { | |
3767 T_BAT_cmd_send cmd; | |
3768 T_BAT_cmd_set_percent_cmgl cmgl; | |
3769 | |
3770 cmd.ctrl_params=BAT_CMD_SET_PERCENT_CMGL; | |
3771 cmd.params.ptr_set_percent_cmgl=&cmgl; | |
3772 | |
3773 /* | |
3774 * T_ACI_SMS_STAT and T_BAT_percent_cmgl_stat are not quite | |
3775 * identical - the ACI version has the extra value | |
3776 * SMS_STAT_Invalid. | |
3777 */ | |
3778 if (cmglStat EQ SMS_STAT_Invalid) | |
3779 cmgl.stat=BAT_CMGL_STAT_NOT_PRESENT; | |
3780 else | |
3781 cmgl.stat=(T_BAT_percent_cmgl_stat)cmglStat; | |
3782 | |
3783 cmgl.rdmode = smsReadMode ; | |
3784 | |
3785 bat_send(ati_bat_get_client(srcId),&cmd); | |
3786 | |
3787 src_params->curAtCmd=AT_CMD_P_CMGL; | |
3788 return(ATI_EXCT); | |
3789 } | |
3790 | |
3791 #else | |
3792 | |
3793 ret = sAT_PercentCMGL ( (T_ACI_CMD_SRC)srcId, cmglStat, smsReadMode ); | |
3794 | |
3795 if ( ret EQ AT_EXCT ) | |
3796 { | |
3797 src_params->curAtCmd = AT_CMD_P_CMGL; | |
3798 return (ATI_EXCT); | |
3799 } | |
3800 else | |
3801 { | |
3802 cmdCmsError ( CMS_ERR_NotPresent ); | |
3803 return (ATI_FAIL); | |
3804 } | |
3805 #endif | |
3806 } | |
3807 | |
3808 /* | |
3809 +--------------------------------------------------------------------+ | |
3810 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
3811 | STATE : code ROUTINE : atPercentCMGR | | |
3812 +--------------------------------------------------------------------+ | |
3813 | |
3814 PURPOSE : %CMGR command (Read Message) | |
3815 */ | |
3816 | |
3817 GLOBAL T_ATI_RSLT atPercentCMGR (char *cl, UBYTE srcId) | |
3818 { | |
3819 T_ACI_RETURN ret = AT_FAIL; | |
3820 SHORT idx=-1; | |
3821 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3822 #ifdef SMS_PDU_SUPPORT | |
3823 T_ACI_CMGF_MOD mode; | |
3824 #endif | |
3825 CHAR txtRdMode[20]={0}; | |
3826 | |
3827 | |
3828 TRACE_FUNCTION("atPercentCMGR()"); | |
3829 | |
3830 smsReadMode = SMS_READ_Normal; | |
3831 | |
3832 #ifdef SMS_PDU_SUPPORT | |
3833 /* | |
3834 * request current mode | |
3835 */ | |
3836 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
3837 if (mode EQ 0) | |
3838 { | |
3839 /* | |
3840 * %CMGR=[index],[preview] | |
3841 */ | |
3842 cl = parse (cl, "rd", &idx, &smsReadMode ); | |
3843 if ( !cl OR idx > 255 OR idx < 0 OR smsReadMode > SMS_READ_StatusChange) | |
3844 { | |
3845 cmdCmsError ( CMS_ERR_OpNotAllowed ); | |
3846 return (ATI_FAIL); | |
3847 } | |
3848 } | |
3849 else | |
3850 #endif | |
3851 { | |
3852 /* | |
3853 * %CMGR=[index],[preview] | |
3854 */ | |
3855 cl = parse (cl, "rs", &idx, | |
3856 (LONG)sizeof(txtRdMode), txtRdMode); | |
3857 | |
3858 if ( !cl OR idx > 255 OR idx < 0) | |
3859 { | |
3860 cmdCmsError(CMS_ERR_OpNotAllowed); | |
3861 return (ATI_FAIL); | |
3862 } | |
3863 if (txt_rdmode_to_smsrdmode(txtRdMode) EQ ATI_FAIL) | |
3864 { | |
3865 return (ATI_FAIL); | |
3866 } | |
3867 } | |
3868 | |
3869 #ifdef FF_ATI_BAT | |
3870 { | |
3871 T_BAT_cmd_send cmd; | |
3872 T_BAT_cmd_set_percent_cmgr cmgr; | |
3873 | |
3874 cmd.ctrl_params=BAT_CMD_SET_PERCENT_CMGR; | |
3875 cmd.params.ptr_set_percent_cmgr=&cmgr; | |
3876 | |
3877 cmgr.sms_index=(U16)idx; | |
3878 | |
3879 cmgr.rdmode = smsReadMode ; | |
3880 | |
3881 bat_send(ati_bat_get_client(srcId), &cmd); | |
3882 | |
3883 src_params->curAtCmd=AT_CMD_P_CMGR; | |
3884 return(ATI_EXCT); | |
3885 } | |
3886 | |
3887 #else | |
3888 | |
3889 #ifndef _CONC_TESTING_ | |
3890 ret = sAT_PercentCMGR_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)idx, smsReadMode , NULL); | |
3891 #else | |
3892 ret = sAT_PercentCMGR (srcId, (UBYTE)idx, smsReadMode ); | |
3893 #endif | |
3894 if ( ret EQ AT_CMPL ) | |
3895 { | |
3896 return (ATI_CMPL); | |
3897 } | |
3898 else if (ret EQ AT_EXCT) | |
3899 { | |
3900 src_params->curAtCmd = AT_CMD_P_CMGR; | |
3901 return (ATI_EXCT); | |
3902 } | |
3903 else | |
3904 { | |
3905 cmdCmsError(CMS_ERR_NotPresent); /* use aciErrDesc */ | |
3906 return (ATI_FAIL); | |
3907 } | |
3908 | |
3909 #endif /*FF_ATI_BAT*/ | |
3910 } | |
3911 | |
3912 GLOBAL T_ATI_RSLT tesatPercentCMGL (char *cl, UBYTE srcId) | |
3913 { | |
3914 #ifdef SMS_PDU_SUPPORT | |
3915 T_ACI_CMGF_MOD mode; | |
3916 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
3917 | |
3918 TRACE_FUNCTION("tesatPercentCMGL()"); | |
3919 /* | |
3920 * request current mode | |
3921 */ | |
3922 qAT_PlusCMGF((T_ACI_CMD_SRC)srcId, &mode); | |
3923 if (mode EQ 0) | |
3924 /* | |
3925 * handle PDU mode | |
3926 */ | |
3927 io_sendMessage(srcId, "+CMGL: (0,1,2,3,4), (0,1,2)", ATI_NORMAL_OUTPUT); | |
3928 else | |
3929 /* | |
3930 * handle Text mode | |
3931 */ | |
3932 #endif | |
3933 io_sendMessage(srcId, "+CMGL: (\"REC UNREAD\",\"REC READ\",\"STO UNSENT\",\"STO SENT\",\"ALL\"), \ | |
3934 (\"READ NORMAL\",\"READ PREVIEW\",\"STATUS CHANGE\")", ATI_NORMAL_OUTPUT); | |
3935 | |
3936 return (ATI_CMPL); | |
3937 } | |
3938 | |
3939 #endif /* ATI_SMS_C */ |