FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/ati_pdu.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ATI | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : AT Command Interpreter Extension for SMS PDU mode | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_PDU_C | |
22 #define ATI_PDU_C | |
23 | |
24 #include "config.h" | |
25 #include "fixedconf.h" | |
26 #include "condat-features.h" | |
27 #include "aci_conf.h" | |
28 | |
29 #undef DUMMY_ATI_STRINGS | |
30 | |
31 #include "aci_all.h" | |
32 | |
33 #include "aci_cmh.h" | |
34 #include "ati_cmd.h" | |
35 #include "aci_io.h" | |
36 #include "aci_cmd.h" | |
37 #include "aci.h" | |
38 #include "psa.h" | |
39 #include "psa_sms.h" | |
40 #include "aci_lst.h" | |
41 | |
42 #include "cmh.h" | |
43 #include "cmh_sms.h" | |
44 #include "gdi.h" | |
45 #include "audio.h" | |
46 #include "p_sim.h" | |
47 #include "p_aci.h" | |
48 #include "aoc.h" | |
49 #include "aci.h" | |
50 #include "pcm.h" | |
51 #include "rx.h" | |
52 #include "pwr.h" | |
53 | |
54 #include "aci_cmd.h" | |
55 #include "aci_mem.h" | |
56 #include "aci_prs.h" | |
57 | |
58 #include "ati_int.h" | |
59 | |
60 #ifdef FF_ATI_BAT | |
61 | |
62 #include "typedefs.h" | |
63 #include "gdd.h" | |
64 #include "bat.h" | |
65 | |
66 #include "ati_bat.h" | |
67 | |
68 #endif /*FF_ATI_BAT*/ | |
69 | |
70 GLOBAL USHORT GsmToHex (UBYTE in, char * buffer, USHORT pos); | |
71 // GLOBAL USHORT HexAdress (CHAR * adress, UBYTE ton, UBYTE npi, char * buffer, USHORT pos); | |
72 // GLOBAL USHORT HexAdressTP (CHAR * adress, UBYTE ton, UBYTE npi, char * buffer, USHORT pos); | |
73 // GLOBAL USHORT HexScts (T_ACI_VP_ABS * scts, char * buffer, USHORT pos); | |
74 // GLOBAL USHORT HexMessage (T_ACI_SM_DATA * data, UBYTE length, char * buffer, USHORT pos); | |
75 // GLOBAL char * GSMAddress (char * cl, char * address, T_ACI_TOA *tosca); | |
76 GLOBAL char * HexToGsm (char * cl, UBYTE * value); | |
77 | |
78 #ifdef WIN32 | |
79 EXTERN T_ACI_SMS_READ smsReadMode; | |
80 #endif | |
81 | |
82 LOCAL SHORT length_of_pdu_message = 0; | |
83 LOCAL UBYTE pdu_error_detected = FALSE; | |
84 | |
85 | |
86 /* | |
87 +--------------------------------------------------------------------+ | |
88 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
89 | STATE : code ROUTINE : atPlusCMGSPdu | | |
90 +--------------------------------------------------------------------+ | |
91 | |
92 PURPOSE : +CMGS command (SEND Message) in PDU mode. | |
93 */ | |
94 | |
95 #if defined (SMS_PDU_SUPPORT) | |
96 | |
97 GLOBAL T_ATI_RSLT atPlusCMGSPdu (char *cl, UBYTE srcId) | |
98 { | |
99 T_ACI_RETURN ret = AT_FAIL; | |
100 T_ACI_SM_DATA pdu; | |
101 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
102 | |
103 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
104 | |
105 pdu.len = 0; | |
106 | |
107 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
108 | |
109 TRACE_FUNCTION("atPlusCMGSPdu()"); | |
110 | |
111 if (src_params->text_mode EQ CMD_MODE) | |
112 { | |
113 /* | |
114 * Extract the length (excluding SCA octets) outto be parsed from | |
115 * the input pointer cl | |
116 */ | |
117 cl = parse (cl,"r",&length_of_pdu_message); | |
118 if ( !cl OR length_of_pdu_message EQ 0) | |
119 { | |
120 cmdCmsError(CMS_ERR_OpNotAllowed); | |
121 return (ATI_FAIL); | |
122 } | |
123 src_params->text_mode = TXT_MODE; | |
124 return (ATI_EXCT); | |
125 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
126 else | |
127 { | |
128 UBYTE i = 0; | |
129 UBYTE sca_len = 0; | |
130 UBYTE offset = 0; | |
131 UBYTE pdu_message_octets_lenth = 0; | |
132 | |
133 src_params->text_mode = CMD_MODE; | |
134 /* | |
135 * Input line with pdu is given | |
136 */ | |
137 pdu_error_detected = FALSE; | |
138 | |
139 HexToGsm (cl, &sca_len); | |
140 | |
141 TRACE_EVENT_P1("%d",sca_len); | |
142 | |
143 if (sca_len > ((MAX_SMS_ADDR_DIG+1)/2) + 1) | |
144 { | |
145 TRACE_ERROR("SCA too long !!!"); | |
146 cmdCmsError(CMS_ERR_OpNotAllowed); | |
147 return (ATI_FAIL); | |
148 } | |
149 | |
150 /* | |
151 calculation of the real length of PDU string | |
152 | |
153 The first octet in the input is an indicator of the length of the SMSC information supplied. | |
154 | |
155 And this Octet and the SMSC content do not count in the real length of PDU string. | |
156 | |
157 so here, the length of the input needs to minus 2 + sca_len*2 and then divide 2. | |
158 */ | |
159 pdu_message_octets_lenth = (strlen(cl)-2-sca_len*2)/2; | |
160 | |
161 TRACE_EVENT_P1("pdu_message_octets_lenth == %d",pdu_message_octets_lenth); | |
162 | |
163 if(pdu_message_octets_lenth NEQ length_of_pdu_message) | |
164 { | |
165 cmdCmsError (CMS_ERR_OpNotAllowed); | |
166 TRACE_EVENT("ERROR: input pdu message length do not match the real length!"); | |
167 return (ATI_FAIL); | |
168 } | |
169 | |
170 if (sca_len EQ 0) /* no SCA given */ | |
171 { | |
172 offset = CodeRPAddress(pdu.data, | |
173 pSMSSetPrm -> sca.c_num, | |
174 pSMSSetPrm -> sca.ton, | |
175 pSMSSetPrm -> sca.npi, | |
176 pSMSSetPrm -> sca.num); | |
177 | |
178 pdu.len = length_of_pdu_message + offset; | |
179 cl += 2; | |
180 } | |
181 else | |
182 { | |
183 pdu.len = length_of_pdu_message + sca_len + 1; | |
184 } | |
185 | |
186 for (i=offset; i<pdu.len AND *cl NEQ '\0' AND i<MAX_SM_LEN; i++) | |
187 { | |
188 cl = HexToGsm (cl, &pdu.data[i]); | |
189 } | |
190 | |
191 #ifdef FF_ATI_BAT | |
192 { | |
193 T_BAT_cmd_send cmd; | |
194 T_BAT_cmd_set_plus_cmgs cmgs; | |
195 | |
196 /* | |
197 * Check that BAT can handle this size of PDU. | |
198 */ | |
199 if (pdu.len>BAT_MAX_SM_LEN) | |
200 { | |
201 TRACE_EVENT("ERROR: PDU too big for BAT"); | |
202 cmdCmsError(CMS_ERR_UnknownErr); | |
203 return (ATI_FAIL); | |
204 } | |
205 | |
206 cmd.ctrl_params=BAT_CMD_SET_PLUS_CMGS; | |
207 cmd.params.ptr_set_plus_cmgs=&cmgs; | |
208 | |
209 /* | |
210 * Copy in the PDU data, secure in the knowledge that we have | |
211 * enough room for it. | |
212 */ | |
213 memcpy(&cmgs.pdu,pdu.data,BAT_MAX_SM_LEN); | |
214 | |
215 cmgs.length=(U8)pdu.len; | |
216 cmgs.c_pdu=(U8)pdu.len; | |
217 | |
218 bat_send(ati_bat_get_client(srcId), &cmd); | |
219 } | |
220 | |
221 #else /* no FF_ATI_BAT */ | |
222 | |
223 /* | |
224 * send the SMS message using extracted values | |
225 */ | |
226 ret = sAT_PlusCMGSPdu ( (T_ACI_CMD_SRC)srcId, &pdu ); | |
227 | |
228 if ( ret NEQ AT_EXCT ) | |
229 { | |
230 cmdCmsError (CMS_ERR_NotPresent); // use aciErrDesc | |
231 return (ATI_FAIL); | |
232 } | |
233 | |
234 #endif /* no FF_ATI_BAT */ | |
235 | |
236 /* | |
237 * rCI_OK will emitting +CMGS: <mr>[,<ackpdu>] | |
238 */ | |
239 src_params->curAtCmd = AT_CMD_CMGS; | |
240 return ATI_EXCT; | |
241 } | |
242 } | |
243 | |
244 | |
245 #endif | |
246 | |
247 /* | |
248 +--------------------------------------------------------------------+ | |
249 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
250 | STATE : code ROUTINE : atPlusCNMAPdu | | |
251 +--------------------------------------------------------------------+ | |
252 | |
253 PURPOSE : +CNMA command (new message acknowledgement) in PDU mode | |
254 */ | |
255 | |
256 #if defined (SMS_PDU_SUPPORT) | |
257 | |
258 GLOBAL T_ATI_RSLT atPlusCNMAPdu (char *cl, UBYTE srcId) | |
259 { | |
260 UBYTE msg_type; | |
261 static SHORT n = -1; | |
262 T_ACI_SM_DATA pdu = {0}; | |
263 T_ACI_RETURN ret = AT_FAIL; | |
264 UBYTE pdu_message_octets_lenth = 0; | |
265 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
266 | |
267 | |
268 | |
269 | |
270 TRACE_FUNCTION("atPlusCNMAPdu()"); | |
271 | |
272 | |
273 | |
274 if (src_params->text_mode EQ CMD_MODE) | |
275 { | |
276 /* | |
277 * normal command line | |
278 */ | |
279 if (*cl EQ '\0') | |
280 { | |
281 /* | |
282 * no parameters, like text mode | |
283 */ | |
284 n = 1; | |
285 } | |
286 else | |
287 { | |
288 /* | |
289 * Extract the acknowledge parameter n | |
290 */ | |
291 length_of_pdu_message = 0; | |
292 cl = parse(cl,"rr",&n, &length_of_pdu_message); | |
293 if ( !cl) | |
294 { | |
295 cmdCmsError(CMS_ERR_OpNotAllowed); | |
296 return (ATI_FAIL); | |
297 } | |
298 | |
299 | |
300 | |
301 switch (n) | |
302 { | |
303 case -1: | |
304 case 0: | |
305 case 1: | |
306 n = 1; | |
307 if (length_of_pdu_message) | |
308 { | |
309 src_params->text_mode = TXT_MODE; | |
310 return (ATI_EXCT); | |
311 } | |
312 break; | |
313 case 2: | |
314 if (length_of_pdu_message) | |
315 { | |
316 src_params->text_mode = TXT_MODE; | |
317 return (ATI_EXCT); | |
318 } | |
319 break; | |
320 default: | |
321 cmdCmsError(CMS_ERR_OpNotAllowed); | |
322 return (ATI_FAIL); | |
323 } | |
324 } | |
325 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
326 else | |
327 { | |
328 src_params->text_mode = CMD_MODE; | |
329 | |
330 /* | |
331 calculation of the real length of PDU string | |
332 | |
333 The entering of PDU is done similarly as specified in command Send Message +CMGS, | |
334 except that the format of <ackpdu> is used instead of <pdu> | |
335 (i.e. SMSC address field is not present). | |
336 | |
337 so here, the length of the input needs to divide 2. | |
338 */ | |
339 | |
340 | |
341 pdu_message_octets_lenth = strlen(cl)/2; | |
342 | |
343 TRACE_EVENT_P1("pdu_message_octets_lenth == %d",pdu_message_octets_lenth); | |
344 | |
345 if(pdu_message_octets_lenth NEQ length_of_pdu_message) | |
346 { | |
347 cmdCmsError (CMS_ERR_OpNotAllowed); | |
348 TRACE_EVENT("ERROR: input pdu message length do not match the real length!"); | |
349 return (ATI_FAIL); | |
350 } | |
351 | |
352 /* | |
353 * Input line with pdu is given | |
354 */ | |
355 pdu_error_detected = FALSE; | |
356 /* | |
357 * get the message type | |
358 */ | |
359 HexToGsm (cl, &msg_type); | |
360 | |
361 if ((msg_type & 3) EQ 0) // SMS_DELIVER_REPORT | |
362 { | |
363 int i; | |
364 pdu.len = (UBYTE)length_of_pdu_message; | |
365 for (i=0; i<length_of_pdu_message; i++) | |
366 { | |
367 cl = HexToGsm (cl, &pdu.data[i]); | |
368 } | |
369 } | |
370 else | |
371 pdu_error_detected = TRUE; | |
372 | |
373 if (pdu_error_detected) | |
374 { | |
375 cmdCmsError ( CMS_ERR_InValPduMod ); | |
376 return (ATI_FAIL); | |
377 } | |
378 } | |
379 | |
380 | |
381 | |
382 /* | |
383 * send the SMS command using extracted values | |
384 */ | |
385 ret = sAT_PlusCNMAPdu ((T_ACI_CMD_SRC)srcId, n, &pdu); | |
386 switch(ret) | |
387 { | |
388 case AT_FAIL: | |
389 cmdCmsError (CMS_ERR_NotPresent); // use aciErrDesc | |
390 /* | |
391 * no break | |
392 */ | |
393 /*lint -fallthrough */ | |
394 case AT_CMPL: | |
395 break; | |
396 default: | |
397 TRACE_EVENT("atPlusCNMAPdu() : Error !! Not AT_FAIL or AT_COMPL"); | |
398 break; | |
399 } | |
400 return (map_aci_2_ati_rslt(ret)); | |
401 } | |
402 #endif | |
403 | |
404 | |
405 /* | |
406 +--------------------------------------------------------------------+ | |
407 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
408 | STATE : code ROUTINE : atPlusCMGWPdu | | |
409 +--------------------------------------------------------------------+ | |
410 | |
411 PURPOSE : +CMGW command (Write message to memory) in PDU mode. | |
412 */ | |
413 | |
414 #if defined (SMS_PDU_SUPPORT) | |
415 | |
416 GLOBAL T_ATI_RSLT atPlusCMGWPdu (char *cl, UBYTE srcId) | |
417 { | |
418 T_ACI_SMS_STAT stat; | |
419 T_ACI_RETURN ret = AT_FAIL; | |
420 static UBYTE message_status = NOT_PRESENT_8BIT; | |
421 T_SMS_SET_PRM *pSMSSetPrm; /* points to SMS parameter set */ | |
422 T_ACI_SM_DATA pdu; | |
423 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
424 | |
425 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
426 | |
427 TRACE_FUNCTION("atPlusCMGWPdu()"); | |
428 | |
429 if (src_params->text_mode EQ CMD_MODE) | |
430 { | |
431 /* | |
432 * normal command line | |
433 */ | |
434 stat = SMS_STAT_StoUnsent; /* STO UNSENT as default */ | |
435 /* | |
436 * Extract the length and status to be parsed from the input pointer cl | |
437 */ | |
438 cl = parse(cl,"rd",&length_of_pdu_message,&stat); | |
439 if ( !cl OR length_of_pdu_message EQ 0) | |
440 { | |
441 cmdCmsError(CMS_ERR_OpNotAllowed); | |
442 return (ATI_FAIL); | |
443 } | |
444 | |
445 if (stat < SMS_STAT_RecUnread OR stat > SMS_STAT_All) | |
446 { | |
447 cmdCmsError(CMS_ERR_OpNotAllowed); | |
448 return (ATI_FAIL); | |
449 } | |
450 else | |
451 { | |
452 message_status = (UBYTE)stat; | |
453 } | |
454 /* | |
455 * wait for next input containing the PDU_is_given | |
456 */ | |
457 src_params->text_mode = TXT_MODE; | |
458 return (ATI_EXCT); | |
459 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
460 else | |
461 { | |
462 UBYTE offset = 0; | |
463 UBYTE sca_len; | |
464 UBYTE i; | |
465 UBYTE pdu_message_octets_lenth = 0; | |
466 | |
467 src_params->text_mode = CMD_MODE; | |
468 /* | |
469 * Input line with pdu is given | |
470 */ | |
471 | |
472 /* if the character sent is ESC, then abort command CLB 16.11.00 */ | |
473 if (*cl EQ 0x1B) | |
474 { | |
475 TRACE_EVENT("Send message command cancelled by user"); | |
476 | |
477 return ATI_CMPL_NO_OUTPUT; | |
478 } | |
479 | |
480 pdu_error_detected = FALSE; | |
481 | |
482 HexToGsm (cl, &sca_len); | |
483 | |
484 if (sca_len > ((MAX_SMS_ADDR_DIG+1)/2) + 1) | |
485 { | |
486 TRACE_ERROR("SCA too long !!!"); | |
487 cmdCmsError(CMS_ERR_OpNotAllowed); | |
488 return (ATI_FAIL); | |
489 } | |
490 | |
491 /* | |
492 calculation of the real length of PDU string | |
493 | |
494 The first octet in the input is an indicator of the length of the SMSC information supplied. | |
495 | |
496 And this Octet and the SMSC content do not count in the real length of PDU string. | |
497 | |
498 so here, the length of the input needs to minus 2 + sca_len*2 and then divide 2. | |
499 */ | |
500 pdu_message_octets_lenth = (strlen(cl)-2-sca_len*2)/2; | |
501 | |
502 TRACE_EVENT_P1("pdu_message_octets_lenth == %d",pdu_message_octets_lenth); | |
503 | |
504 if(pdu_message_octets_lenth NEQ length_of_pdu_message) | |
505 { | |
506 cmdCmsError (CMS_ERR_OpNotAllowed); | |
507 TRACE_EVENT("ERROR: input pdu message length do not match the real length!"); | |
508 return (ATI_FAIL); | |
509 } | |
510 | |
511 | |
512 if (sca_len EQ 0) /* no SCA given */ | |
513 { | |
514 offset = CodeRPAddress(pdu.data, | |
515 pSMSSetPrm -> sca.c_num, | |
516 pSMSSetPrm -> sca.ton, | |
517 pSMSSetPrm -> sca.npi, | |
518 pSMSSetPrm -> sca.num); | |
519 cl += 2; | |
520 pdu.len = length_of_pdu_message + offset; | |
521 } | |
522 else | |
523 { | |
524 pdu.len = length_of_pdu_message + sca_len + 1; | |
525 } | |
526 | |
527 for (i=offset; i<pdu.len AND *cl NEQ '\0' AND i<MAX_SM_LEN; i++) | |
528 { | |
529 cl = HexToGsm (cl, &pdu.data[i]); | |
530 } | |
531 | |
532 ret = sAT_PlusCMGWPdu ( (T_ACI_CMD_SRC)srcId, message_status, &pdu); | |
533 | |
534 if ( ret NEQ AT_EXCT ) | |
535 { | |
536 cmdCmsError (CMS_ERR_NotPresent); // use aciErrDesc | |
537 return (ATI_FAIL); | |
538 } | |
539 /* | |
540 * rCI_OK will emitting +CMGW: <index> | |
541 */ | |
542 src_params->curAtCmd = AT_CMD_CMGW; | |
543 return ATI_EXCT; | |
544 } | |
545 } | |
546 #endif | |
547 | |
548 /* | |
549 +--------------------------------------------------------------------+ | |
550 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
551 | STATE : code ROUTINE : atPlusCMGCPdu | | |
552 +--------------------------------------------------------------------+ | |
553 | |
554 PURPOSE : +CMGC command (Send SMS command) in PDU mode | |
555 */ | |
556 | |
557 #if defined (SMS_PDU_SUPPORT) | |
558 | |
559 GLOBAL T_ATI_RSLT atPlusCMGCPdu (char *cl, UBYTE srcId) | |
560 { | |
561 T_ACI_RETURN ret = AT_FAIL; | |
562 T_ACI_SM_DATA pdu; | |
563 T_SMS_SET_PRM *pSMSSetPrm; /* points to SMS parameter set */ | |
564 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
565 | |
566 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
567 | |
568 pdu.len = 0; | |
569 | |
570 TRACE_FUNCTION("atPlusCMGCPdu()"); | |
571 | |
572 if (src_params->text_mode EQ CMD_MODE) | |
573 { | |
574 /* | |
575 * normal command line | |
576 */ | |
577 /* | |
578 * Extract the length to be parsed from the input pointer cl | |
579 */ | |
580 cl = parse(cl,"r",&length_of_pdu_message); | |
581 if ( !cl OR length_of_pdu_message EQ 0) | |
582 { | |
583 cmdCmsError(CMS_ERR_OpNotAllowed); | |
584 return (ATI_FAIL); | |
585 } | |
586 /* | |
587 * wait for next input containing the PDU_is_given | |
588 */ | |
589 src_params->text_mode = TXT_MODE; | |
590 return (ATI_EXCT); | |
591 } /* end of if (src_params->text_mode EQ CMD_MODE) */ | |
592 else | |
593 { | |
594 UBYTE offset = 0; | |
595 UBYTE sca_len; | |
596 UBYTE i; | |
597 UBYTE pdu_message_octets_lenth = 0; | |
598 | |
599 src_params->text_mode = CMD_MODE; | |
600 /* | |
601 * Input line with pdu is given | |
602 */ | |
603 | |
604 pdu_error_detected = FALSE; | |
605 | |
606 HexToGsm (cl, &sca_len); | |
607 | |
608 if (sca_len > ((MAX_SMS_ADDR_DIG+1)/2) + 1) | |
609 { | |
610 TRACE_ERROR("SCA too long !!!"); | |
611 cmdCmsError(CMS_ERR_OpNotAllowed); | |
612 return (ATI_FAIL); | |
613 } | |
614 | |
615 /* | |
616 calculation of the real length of PDU string | |
617 | |
618 The first octet in the input is an indicator of the length of the SMSC information supplied. | |
619 | |
620 And this Octet and the SMSC content do not count in the real length of PDU string. | |
621 | |
622 so here, the length of the input needs to minus 2 + sca_len*2 and then divide 2. | |
623 */ | |
624 pdu_message_octets_lenth = (strlen(cl)-2-sca_len*2)/2; | |
625 | |
626 TRACE_EVENT_P1("pdu_message_octets_lenth == %d",pdu_message_octets_lenth); | |
627 | |
628 if(pdu_message_octets_lenth NEQ length_of_pdu_message) | |
629 { | |
630 cmdCmsError (CMS_ERR_OpNotAllowed); | |
631 TRACE_EVENT("ERROR: input pdu message length do not match the real length!"); | |
632 return (ATI_FAIL); | |
633 } | |
634 | |
635 if (sca_len EQ 0) /* no SCA given */ | |
636 { | |
637 offset = CodeRPAddress(pdu.data, | |
638 pSMSSetPrm -> sca.c_num, | |
639 pSMSSetPrm -> sca.ton, | |
640 pSMSSetPrm -> sca.npi, | |
641 pSMSSetPrm -> sca.num); | |
642 cl += 2; | |
643 pdu.len = length_of_pdu_message + offset; | |
644 } | |
645 else | |
646 { | |
647 pdu.len = length_of_pdu_message + sca_len + 1; | |
648 } | |
649 | |
650 for (i=offset; i<pdu.len AND *cl NEQ '\0' AND i<MAX_SM_LEN; i++) | |
651 { | |
652 cl = HexToGsm (cl, &pdu.data[i]); | |
653 } | |
654 | |
655 ret = sAT_PlusCMGCPdu ((T_ACI_CMD_SRC)srcId, &pdu); | |
656 | |
657 if ( ret NEQ AT_EXCT ) | |
658 { | |
659 cmdCmsError (CMS_ERR_NotPresent); // use aciErrDesc | |
660 return (ATI_FAIL); | |
661 } | |
662 /* | |
663 * rCI_OK will emitting +CMGC: <mr>[,<ackpdu>] | |
664 */ | |
665 src_params->curAtCmd = AT_CMD_CMGC; | |
666 return ATI_EXCT; | |
667 } | |
668 } | |
669 #endif | |
670 | |
671 /* | |
672 +--------------------------------------------------------------------+ | |
673 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
674 | STATE : code ROUTINE : rCI_PlusCMGLPdu | | |
675 +--------------------------------------------------------------------+ | |
676 | |
677 PURPOSE : handles AT_PlusCMGL call back in PDU mode | |
678 | |
679 */ | |
680 | |
681 #if defined (SMS_PDU_SUPPORT) | |
682 | |
683 GLOBAL void rCI_Plus_Percent_CMGLPdu ( T_MNSMS_READ_CNF *mnsms_read_cnf, | |
684 T_ACI_AT_CMD cmd ) | |
685 { | |
686 T_ACI_SMS_STAT stat; | |
687 | |
688 USHORT i = 0; | |
689 USHORT pos = 0; | |
690 UBYTE sca_len; | |
691 UBYTE length_sms, length=0; | |
692 UBYTE fo, addr_len, dcs, vp_format=TP_VPF_ABSOLUTE; | |
693 UBYTE *data_ptr; | |
694 | |
695 UBYTE srcId = srcId_cb; | |
696 | |
697 #ifndef FF_ATI_BAT | |
698 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
699 USHORT lenCvtdAlpha; | |
700 T_ACI_PB_TEXT alpha; | |
701 #endif | |
702 | |
703 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
704 | |
705 TRACE_FUNCTION("rCI_Plus_Percent_CMGLPdu()"); | |
706 | |
707 src_params->curAtCmd = AT_CMD_NONE; | |
708 | |
709 /* convert status from PSA type to CMH type */ | |
710 cmhSMS_getStatCmh ( mnsms_read_cnf->status, &stat ); | |
711 | |
712 /* | |
713 * print response and index, status of SMS message | |
714 */ | |
715 if (cmd EQ AT_CMD_CMGL ) | |
716 { | |
717 pos = sprintf ( g_sa, "+CMGL: "); | |
718 } | |
719 else | |
720 { | |
721 pos=sprintf (g_sa, " %s: ", "%CMGL"); | |
722 } | |
723 pos += sprintf ( g_sa + pos, "%d,%d,", mnsms_read_cnf->rec_num, stat); | |
724 | |
725 #ifdef FF_ATI_BAT | |
726 | |
727 /* | |
728 * Extracting the alphanumeric data from the phonebook at this point | |
729 * would defeat the object (testing the BAT message). Having this | |
730 * data stored globally represents an easier solution to the | |
731 * problem of conveying it here. | |
732 */ | |
733 if (smsShrdPrm.alpha_len) | |
734 { | |
735 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
736 } | |
737 | |
738 #else | |
739 | |
740 cmhSMS_getPhbEntry( mnsms_read_cnf->sms_sdu.buf, &alpha, stat); | |
741 | |
742 /* | |
743 * print alpha if available | |
744 */ | |
745 if ( alpha.len NEQ 0 ) | |
746 { | |
747 utl_chsetFromGsm ( (UBYTE*)alpha.data, | |
748 alpha.len, | |
749 (UBYTE*)cvtdAlpha, | |
750 sizeof(cvtdAlpha), | |
751 &lenCvtdAlpha, | |
752 GSM_ALPHA_Def ); | |
753 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
754 } | |
755 | |
756 #endif /*FF_ATI_BAT*/ | |
757 | |
758 /* length of SCA including length byte and TOA byte */ | |
759 sca_len = mnsms_read_cnf->sms_sdu.buf[0] + 1; | |
760 | |
761 data_ptr = &mnsms_read_cnf->sms_sdu.buf[sca_len]; | |
762 fo = *data_ptr++; | |
763 length++; | |
764 | |
765 if ((fo & TP_MTI_MASK) NEQ TP_MTI_SMS_STATUS_REP) | |
766 { | |
767 if ((fo & TP_MTI_MASK) EQ TP_MTI_SMS_SUBMIT) | |
768 { | |
769 /* SMS-SUBMIT */ | |
770 data_ptr++; | |
771 length++; | |
772 vp_format = fo & TP_VPF_MASK; | |
773 } | |
774 | |
775 addr_len = *data_ptr; | |
776 length += 4 + (addr_len+1)/2; | |
777 | |
778 /* data_ptr points to TP-DCS now */ | |
779 data_ptr += 3 + (addr_len+1)/2; | |
780 | |
781 dcs = *data_ptr++; | |
782 | |
783 switch (vp_format) | |
784 { | |
785 /* | |
786 * Check validity period format bit 4 and 3 | |
787 */ | |
788 case TP_VPF_NOT_PRESENT: // TP-VP not present | |
789 break; | |
790 case TP_VPF_RELATIVE: // TP-VP relative format | |
791 length++; | |
792 data_ptr++; | |
793 break; | |
794 case TP_VPF_ENHANCED: // TP-VP enhanced format | |
795 case TP_VPF_ABSOLUTE: // TP-VP absolute format | |
796 length += 7; | |
797 data_ptr += 7; | |
798 break; | |
799 } | |
800 | |
801 /* data_ptr points to TP-UDL now, | |
802 * calculate the length excluding SCA octets | |
803 */ | |
804 if (cmhSMS_getAlphabetPp (dcs) EQ 0) | |
805 length_sms = length + (*data_ptr * 7 + 7)/8 + 1; // 7 bit alphabet | |
806 else | |
807 length_sms = length + *data_ptr + 1; | |
808 | |
809 pos += sprintf ( g_sa + pos, ",%d", length_sms ); | |
810 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
811 pos = 0; | |
812 } | |
813 else | |
814 { | |
815 length_sms=((mnsms_read_cnf->sms_sdu.l_buf+7)/8); | |
816 pos += sprintf ( g_sa + pos, ",%d,", length_sms-sca_len ); | |
817 sca_len = 0; | |
818 } | |
819 | |
820 /* | |
821 * Print PDU + service centre address | |
822 */ | |
823 for (i=0;i<(USHORT)(sca_len+length_sms);i++) | |
824 pos = GsmToHex (mnsms_read_cnf->sms_sdu.buf[i], g_sa, pos); | |
825 | |
826 /* | |
827 * Send response | |
828 */ | |
829 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
830 } | |
831 | |
832 /* | |
833 +--------------------------------------------------------------------+ | |
834 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
835 | STATE : code ROUTINE : rCI_PlusCMGRPdu | | |
836 +--------------------------------------------------------------------+ | |
837 | |
838 PURPOSE : handles AT_PlusCMGR call back in PDU mode | |
839 | |
840 */ | |
841 | |
842 #if defined (SMS_PDU_SUPPORT) | |
843 | |
844 GLOBAL void rCI_Plus_Percent_CMGRPdu (T_MNSMS_READ_CNF * mnsms_read_cnf, | |
845 T_ACI_AT_CMD cmd) | |
846 { | |
847 USHORT pos = 0; | |
848 T_ACI_SMS_STAT stat; | |
849 USHORT i; | |
850 | |
851 UBYTE sca_len; | |
852 UBYTE length_sms, length=0; | |
853 UBYTE fo, addr_len, dcs, vp_format=TP_VPF_ABSOLUTE; | |
854 UBYTE *data_ptr; | |
855 | |
856 UBYTE srcId = srcId_cb; | |
857 | |
858 #ifndef FF_ATI_BAT | |
859 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
860 USHORT lenCvtdAlpha; | |
861 T_ACI_PB_TEXT alpha; | |
862 #endif | |
863 | |
864 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
865 | |
866 TRACE_FUNCTION("rCI_Plus_Percent_CMGRPdu()"); | |
867 | |
868 src_params->curAtCmd = AT_CMD_NONE; | |
869 | |
870 /* | |
871 * print response for SMS message | |
872 */ | |
873 if (cmd EQ AT_CMD_CMGR) | |
874 { | |
875 pos = sprintf ( g_sa, "+CMGR: "); | |
876 } | |
877 else | |
878 { | |
879 pos=sprintf (g_sa, " %s: ", "%CMGR"); | |
880 } | |
881 | |
882 /* convert status from PSA type to CMH type */ | |
883 cmhSMS_getStatCmh ( mnsms_read_cnf->status, &stat ); | |
884 | |
885 /* | |
886 * print status of the message | |
887 */ | |
888 pos += sprintf ( g_sa + pos, "%d,", stat ); | |
889 | |
890 #ifdef FF_ATI_BAT | |
891 | |
892 /* | |
893 * Extracting the alphanumeric data from the phonebook at this point | |
894 * would defeat the object (testing the BAT message). Having this | |
895 * data stored globally represents a quick and dirty solution to the | |
896 * problem of conveying it here. | |
897 */ | |
898 if (smsShrdPrm.alpha_len) | |
899 { | |
900 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
901 } | |
902 | |
903 #else | |
904 | |
905 cmhSMS_getPhbEntry( mnsms_read_cnf->sms_sdu.buf, &alpha, stat); | |
906 | |
907 /* | |
908 * print alpha if available | |
909 */ | |
910 if ( alpha.len NEQ 0 ) | |
911 { | |
912 utl_chsetFromGsm ( (UBYTE*)alpha.data, | |
913 alpha.len, | |
914 (UBYTE*)cvtdAlpha, | |
915 sizeof(cvtdAlpha), | |
916 &lenCvtdAlpha, | |
917 GSM_ALPHA_Def ); | |
918 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
919 } | |
920 | |
921 #endif | |
922 | |
923 /* length of SCA including length byte and TOA byte */ | |
924 sca_len = mnsms_read_cnf->sms_sdu.buf[0] + 1; | |
925 | |
926 data_ptr = &mnsms_read_cnf->sms_sdu.buf[sca_len]; | |
927 fo = *data_ptr++; | |
928 length++; | |
929 | |
930 if ((fo & TP_MTI_MASK) NEQ TP_MTI_SMS_STATUS_REP) | |
931 { | |
932 if ((fo & TP_MTI_MASK) EQ TP_MTI_SMS_SUBMIT) | |
933 { | |
934 /* SMS-SUBMIT */ | |
935 data_ptr++; | |
936 length++; | |
937 vp_format = fo & TP_VPF_MASK; | |
938 } | |
939 | |
940 addr_len = *data_ptr; | |
941 length += 4 + (addr_len+1)/2; | |
942 | |
943 /* data_ptr points to TP-DCS now */ | |
944 data_ptr += 3 + (addr_len+1)/2; | |
945 | |
946 dcs = *data_ptr++; | |
947 | |
948 switch (vp_format) | |
949 { | |
950 /* | |
951 * Check validity period format bit 4 and 3 | |
952 */ | |
953 case TP_VPF_NOT_PRESENT: // TP-VP not present | |
954 break; | |
955 case TP_VPF_RELATIVE: // TP-VP relative format | |
956 length++; | |
957 data_ptr++; | |
958 break; | |
959 case TP_VPF_ENHANCED: // TP-VP enhanced format | |
960 case TP_VPF_ABSOLUTE: // TP-VP absolute format | |
961 length += 7; | |
962 data_ptr += 7; | |
963 break; | |
964 } | |
965 | |
966 /* data_ptr points to TP-UDL now, | |
967 * calculate the length excluding SCA octets | |
968 */ | |
969 if (cmhSMS_getAlphabetPp (dcs) EQ 0) | |
970 length_sms = length + (*data_ptr * 7 + 7)/8 + 1; // 7 bit alphabet | |
971 else | |
972 length_sms = length + *data_ptr + 1; | |
973 | |
974 pos += sprintf ( g_sa + pos, ",%d", length_sms ); | |
975 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
976 pos = 0; | |
977 } | |
978 else | |
979 { | |
980 length_sms=((mnsms_read_cnf->sms_sdu.l_buf+7)/8); | |
981 pos += sprintf ( g_sa + pos, ",%d,", length_sms-sca_len ); | |
982 sca_len = 0; | |
983 } | |
984 | |
985 /* | |
986 * Print PDU + service centre address | |
987 */ | |
988 /*If the SMS length recevied incorrectly (length_sms > SIM_PDU_LEN) | |
989 then there is a chance of reading the buf[] beyond SIM_PDU_LEN. | |
990 By using the MINIMUM macro the max length limit | |
991 to SIM_PDU_LEN if the length of SMS is greater than SIM_PDU_LEN | |
992 */ | |
993 length_sms = MINIMUM (sca_len+length_sms, SIM_PDU_LEN); | |
994 for (i=0;i<(USHORT)length_sms;i++) | |
995 pos = GsmToHex (mnsms_read_cnf->sms_sdu.buf[i], g_sa, pos); | |
996 | |
997 /* | |
998 * Send response | |
999 */ | |
1000 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
1001 } | |
1002 #endif | |
1003 | |
1004 /* | |
1005 +--------------------------------------------------------------------+ | |
1006 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1007 | STATE : code ROUTINE : rCI_PlusCMSSPdu | | |
1008 +--------------------------------------------------------------------+ | |
1009 | |
1010 PURPOSE : handles AT_PlusCMSS call back in PDU mode | |
1011 | |
1012 */ | |
1013 | |
1014 GLOBAL void rCI_PlusCMSSPdu (T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf) | |
1015 { | |
1016 USHORT pos = 0; | |
1017 UBYTE length; | |
1018 USHORT i; | |
1019 UBYTE srcId = srcId_cb; | |
1020 UBYTE sca_len; | |
1021 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1022 | |
1023 TRACE_FUNCTION("rCI_PlusCMSSPdu()"); | |
1024 | |
1025 src_params->curAtCmd = AT_CMD_NONE; | |
1026 | |
1027 pos=sprintf(g_sa,"+CMSS: %d", mnsms_submit_cnf->tp_mr); | |
1028 | |
1029 | |
1030 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1031 { | |
1032 if (mnsms_submit_cnf->sms_sdu.l_buf) | |
1033 { | |
1034 pos+=sprintf(g_sa+pos, ",\""); /* parameter shall be bounded by double quote characters, see 07.07 <ackpdu> */ | |
1035 sca_len = mnsms_submit_cnf->sms_sdu.buf[0] + 1; | |
1036 length = ((mnsms_submit_cnf->sms_sdu.l_buf+7)/8); | |
1037 | |
1038 /* | |
1039 * Print ACK PDU (without SCA field) | |
1040 */ | |
1041 for (i=sca_len; i<length; i++) | |
1042 pos = GsmToHex (mnsms_submit_cnf->sms_sdu.buf[i], g_sa, pos); | |
1043 | |
1044 pos+=sprintf(g_sa+pos, "\""); | |
1045 } | |
1046 } | |
1047 | |
1048 /* | |
1049 * Send response | |
1050 */ | |
1051 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT ); | |
1052 } | |
1053 | |
1054 /* | |
1055 +--------------------------------------------------------------------+ | |
1056 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1057 | STATE : code ROUTINE : rCI_PlusCMGSPdu | | |
1058 +--------------------------------------------------------------------+ | |
1059 | |
1060 PURPOSE : handles AT_PlusCMGS call back in PDU mode | |
1061 | |
1062 */ | |
1063 | |
1064 GLOBAL void rCI_PlusCMGSPdu (T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf) | |
1065 { | |
1066 USHORT pos = 0; | |
1067 UBYTE length; | |
1068 UBYTE srcId = srcId_cb; | |
1069 USHORT i; | |
1070 UBYTE sca_len; | |
1071 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1072 | |
1073 TRACE_FUNCTION("rCI_PlusCMGSPdu()"); | |
1074 | |
1075 | |
1076 src_params->curAtCmd = AT_CMD_NONE; | |
1077 | |
1078 pos=sprintf(g_sa,"+CMGS: %d", mnsms_submit_cnf->tp_mr); | |
1079 | |
1080 | |
1081 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1082 { | |
1083 if (mnsms_submit_cnf->sms_sdu.l_buf) | |
1084 { | |
1085 pos+=sprintf(g_sa+pos, ",\""); /* parameter shall be bounded by double quote characters, see 07.07 <ackpdu> */ | |
1086 sca_len = mnsms_submit_cnf->sms_sdu.buf[0] + 1; | |
1087 length = ((mnsms_submit_cnf->sms_sdu.l_buf+7)/8); | |
1088 | |
1089 /* | |
1090 * Print ACK PDU (without SCA field) | |
1091 */ | |
1092 for (i=sca_len; i<length; i++) | |
1093 pos = GsmToHex (mnsms_submit_cnf->sms_sdu.buf[i], g_sa, pos); | |
1094 | |
1095 pos+=sprintf(g_sa+pos, "\""); | |
1096 } | |
1097 } | |
1098 | |
1099 /* | |
1100 * Send response | |
1101 */ | |
1102 io_sendMessageEx( srcId, g_sa, | |
1103 (T_ATI_OUTPUT_TYPE) (ATI_NORMAL_OUTPUT | | |
1104 ATI_BEGIN_CRLF_OUTPUT | | |
1105 ATI_END_CRLF_OUTPUT)); | |
1106 | |
1107 } | |
1108 | |
1109 #ifdef REL99 | |
1110 /* | |
1111 +--------------------------------------------------------------------+ | |
1112 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1113 | STATE : code ROUTINE : rCI_PercentCMGRSPdu| | |
1114 +--------------------------------------------------------------------+ | |
1115 | |
1116 PURPOSE : handles AT_PlusCMGRS call back in PDU mode | |
1117 | |
1118 */ | |
1119 | |
1120 GLOBAL void rCI_PercentCMGRSPdu ( UBYTE mode, | |
1121 T_MNSMS_RETRANS_CNF * mnsms_retrans_cnf, | |
1122 T_MNSMS_SEND_PROG_IND * mnsms_send_prog_ind ) | |
1123 { | |
1124 USHORT pos = 0; | |
1125 UBYTE length; | |
1126 UBYTE srcId = srcId_cb; | |
1127 USHORT i; | |
1128 UBYTE sca_len = mnsms_retrans_cnf->sms_sdu.buf[0] + 1; | |
1129 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1130 | |
1131 TRACE_FUNCTION("rCI_PercentCMGRSPdu()"); | |
1132 | |
1133 | |
1134 src_params->curAtCmd = AT_CMD_NONE; | |
1135 | |
1136 if (mode EQ CMGRS_MODE_MANUAL_RETRANS AND mnsms_retrans_cnf NEQ NULL) | |
1137 { | |
1138 pos=sprintf(g_sa,"%s: %d", "%CMGRS", mnsms_retrans_cnf->tp_mr); | |
1139 | |
1140 | |
1141 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1142 { | |
1143 pos+=sprintf(g_sa+pos, ","); | |
1144 length = ((mnsms_retrans_cnf->sms_sdu.l_buf+7)/8) - sca_len; | |
1145 | |
1146 /* | |
1147 * Print ACK PDU (without SCA field) | |
1148 */ | |
1149 for (i=sca_len;i<length;i++) | |
1150 pos = GsmToHex (mnsms_retrans_cnf->sms_sdu.buf[i], g_sa, pos); | |
1151 } | |
1152 } | |
1153 else if (mode EQ CMGRS_MODE_ENABLE_AUTO_RETRANS AND mnsms_send_prog_ind NEQ NULL) | |
1154 { | |
1155 pos=sprintf(g_sa,"%s: 1,%d,%d", "%CMGRS", | |
1156 mnsms_send_prog_ind->resend_count, | |
1157 mnsms_send_prog_ind->max_retrans); | |
1158 } | |
1159 else | |
1160 { | |
1161 TRACE_ERROR("%CMGRS: wrong combination of parameters"); | |
1162 return; | |
1163 } | |
1164 | |
1165 /* | |
1166 * Send response | |
1167 */ | |
1168 io_sendMessageEx( srcId, g_sa, | |
1169 (T_ATI_OUTPUT_TYPE)(ATI_NORMAL_OUTPUT | | |
1170 ATI_BEGIN_CRLF_OUTPUT | | |
1171 ATI_END_CRLF_OUTPUT)); | |
1172 | |
1173 } | |
1174 #endif | |
1175 /* | |
1176 +--------------------------------------------------------------------+ | |
1177 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1178 | STATE : code ROUTINE : rCI_PlusCMGCPdu | | |
1179 +--------------------------------------------------------------------+ | |
1180 | |
1181 PURPOSE : handles AT_PlusCMGC call back in PDU mode | |
1182 | |
1183 */ | |
1184 | |
1185 GLOBAL void rCI_PlusCMGCPdu (T_MNSMS_COMMAND_CNF * mnsms_command_cnf) | |
1186 { | |
1187 USHORT pos = 0; | |
1188 UBYTE length; | |
1189 UBYTE srcId = srcId_cb; | |
1190 USHORT i; | |
1191 UBYTE sca_len; | |
1192 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1193 | |
1194 TRACE_FUNCTION("rCI_PlusCMGCPdu()"); | |
1195 | |
1196 src_params->curAtCmd = AT_CMD_NONE; | |
1197 | |
1198 pos=sprintf(g_sa,"+CMGC: %d", mnsms_command_cnf->tp_mr); | |
1199 | |
1200 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1201 { | |
1202 if (mnsms_command_cnf->sms_sdu.l_buf) | |
1203 { | |
1204 pos+=sprintf(g_sa+pos, ",\""); /* parameter shall be bounded by double quote characters, see 07.07 <ackpdu> */ | |
1205 sca_len = mnsms_command_cnf->sms_sdu.buf[0] + 1; | |
1206 length = ((mnsms_command_cnf->sms_sdu.l_buf+7)/8); | |
1207 | |
1208 /* | |
1209 * Print ACK PDU (without SCA field) | |
1210 */ | |
1211 for (i=sca_len; i<length; i++) | |
1212 pos = GsmToHex (mnsms_command_cnf->sms_sdu.buf[i], g_sa, pos); | |
1213 | |
1214 pos+=sprintf(g_sa+pos, "\""); | |
1215 } | |
1216 } | |
1217 | |
1218 /* | |
1219 * Send response | |
1220 */ | |
1221 io_sendMessageEx( srcId, g_sa, | |
1222 (T_ATI_OUTPUT_TYPE) (ATI_NORMAL_OUTPUT | | |
1223 ATI_BEGIN_CRLF_OUTPUT | | |
1224 ATI_END_CRLF_OUTPUT)); | |
1225 } | |
1226 | |
1227 /* | |
1228 +--------------------------------------------------------------------+ | |
1229 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1230 | STATE : code ROUTINE : rCI_PlusCMTPdu | | |
1231 +--------------------------------------------------------------------+ | |
1232 | |
1233 PURPOSE : handles AT_PlusCMT unsolicited message in PDU mode | |
1234 | |
1235 */ | |
1236 | |
1237 #if defined (SMS_PDU_SUPPORT) | |
1238 | |
1239 GLOBAL void rCI_PlusCMTPdu (T_MNSMS_MESSAGE_IND * mnsms_message_ind) | |
1240 { | |
1241 USHORT pos = 0; | |
1242 UBYTE l_sms_with_sca; | |
1243 UBYTE l_sms_without_sca; | |
1244 UBYTE srcId = srcId_cb; | |
1245 | |
1246 #ifndef FF_ATI_BAT | |
1247 CHAR cvtdAlpha[2*MAX_ALPHA_LEN]; | |
1248 USHORT lenCvtdAlpha; | |
1249 T_ACI_PB_TEXT alpha; | |
1250 T_ACI_SMS_STAT stat; | |
1251 #endif | |
1252 | |
1253 USHORT i; | |
1254 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1255 | |
1256 UBYTE sca_len = mnsms_message_ind->sms_sdu.buf[0] + 1; | |
1257 | |
1258 TRACE_FUNCTION("rCI_PlusCMTPdu()"); | |
1259 | |
1260 src_params->curAtCmd = AT_CMD_NONE; | |
1261 | |
1262 /* | |
1263 * print response for SMS message | |
1264 */ | |
1265 pos = sprintf ( g_sa, "+CMT: "); | |
1266 | |
1267 /* | |
1268 * print alpha if available | |
1269 */ | |
1270 #ifdef FF_ATI_BAT | |
1271 | |
1272 /* | |
1273 * Extracting the alphanumeric data from the phonebook at this point | |
1274 * would defeat the object (testing the BAT message). Having this | |
1275 * data stored globally represents a quick and dirty solution to the | |
1276 * problem of conveying it here. | |
1277 */ | |
1278 if (smsShrdPrm.alpha_len) | |
1279 { | |
1280 pos+=sprints(g_sa+pos,smsShrdPrm.alpha,smsShrdPrm.alpha_len); | |
1281 } | |
1282 | |
1283 #else | |
1284 | |
1285 /* convert status from PSA type to CMH type */ | |
1286 cmhSMS_getStatCmh ( mnsms_message_ind->status, &stat ); | |
1287 | |
1288 cmhSMS_getPhbEntry( mnsms_message_ind->sms_sdu.buf, &alpha, stat); | |
1289 | |
1290 | |
1291 if ( alpha.len NEQ 0 ) | |
1292 { | |
1293 utl_chsetFromGsm ( (UBYTE*)alpha.data, | |
1294 alpha.len, | |
1295 (UBYTE*)cvtdAlpha, | |
1296 sizeof(cvtdAlpha), | |
1297 &lenCvtdAlpha, | |
1298 GSM_ALPHA_Def ); | |
1299 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha ); | |
1300 } | |
1301 | |
1302 #endif /*FF_ATI_BAT*/ | |
1303 | |
1304 l_sms_with_sca = ((mnsms_message_ind->sms_sdu.l_buf+7)/8); | |
1305 l_sms_without_sca = l_sms_with_sca - sca_len; | |
1306 | |
1307 pos += sprintf ( g_sa + pos, ",%d", l_sms_without_sca ); | |
1308 io_sendIndication ( srcId, g_sa, ATI_FORCED_OUTPUT ); | |
1309 | |
1310 pos = 0; | |
1311 | |
1312 /* | |
1313 * Print PDU + service centre address field | |
1314 */ | |
1315 for (i=0;i<(USHORT)l_sms_with_sca;i++) | |
1316 pos = GsmToHex (mnsms_message_ind->sms_sdu.buf[i], g_sa, pos); | |
1317 | |
1318 /* | |
1319 * Send response | |
1320 */ | |
1321 io_sendIndication ( srcId, g_sa, ATI_FORCED_OUTPUT ); | |
1322 | |
1323 } | |
1324 #endif | |
1325 | |
1326 /* | |
1327 +--------------------------------------------------------------------+ | |
1328 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1329 | STATE : code ROUTINE : rCI_PlusCBMPdu | | |
1330 +--------------------------------------------------------------------+ | |
1331 | |
1332 PURPOSE : handles Cell Broadcast unsolicited message in PDU mode | |
1333 | |
1334 */ | |
1335 | |
1336 #if defined (SMS_PDU_SUPPORT) | |
1337 | |
1338 GLOBAL void rCI_PlusCBMPdu (T_MMI_CBCH_IND * mmi_cbch_ind) | |
1339 { | |
1340 int i; | |
1341 USHORT pos = 0; | |
1342 UBYTE srcId = srcId_cb; | |
1343 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1344 | |
1345 TRACE_FUNCTION("rCI_PlusCBMPdu()"); | |
1346 | |
1347 src_params->curAtCmd = AT_CMD_NONE; | |
1348 | |
1349 /* | |
1350 * print response for CBM message | |
1351 */ | |
1352 pos = sprintf ( g_sa, "+CBM: "); | |
1353 pos += sprintf ( g_sa + pos, "%d", (int)mmi_cbch_ind->cbch_len ); | |
1354 | |
1355 io_sendIndication ( srcId, g_sa, ATI_FORCED_OUTPUT ); | |
1356 | |
1357 pos = 0; | |
1358 | |
1359 for (i = 0; i < (int)mmi_cbch_ind->cbch_len; i++) | |
1360 pos = GsmToHex (mmi_cbch_ind->cbch_msg[i], g_sa, pos); | |
1361 | |
1362 io_sendMessageEx ( srcId, g_sa, (T_ATI_OUTPUT_TYPE)(ATI_INDICATION_OUTPUT + | |
1363 ATI_FORCED_OUTPUT + | |
1364 ATI_END_CRLF_OUTPUT )); | |
1365 | |
1366 } | |
1367 #endif | |
1368 | |
1369 | |
1370 #if defined (SMS_PDU_SUPPORT) | |
1371 /* | |
1372 +--------------------------------------------------------------------+ | |
1373 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1374 | STATE : code ROUTINE : rCI_PlusCDSPdu | | |
1375 +--------------------------------------------------------------------+ | |
1376 | |
1377 PURPOSE : handles Status Indication unsolicited message in PDU mode | |
1378 | |
1379 */ | |
1380 GLOBAL void rCI_PlusCDSPdu (T_MNSMS_STATUS_IND * mnsms_status_ind) | |
1381 { | |
1382 USHORT pos = 0; | |
1383 UBYTE l_sms_with_sca; | |
1384 UBYTE l_sms_without_sca; | |
1385 UBYTE sca_len = mnsms_status_ind->sms_sdu.buf[0] + 1; | |
1386 USHORT i; | |
1387 UBYTE srcId = srcId_cb; | |
1388 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1389 | |
1390 | |
1391 TRACE_FUNCTION("rCI_PlusCDSPdu()"); | |
1392 | |
1393 src_params->curAtCmd = AT_CMD_NONE; | |
1394 | |
1395 /* | |
1396 * print response for SMS message | |
1397 */ | |
1398 pos = sprintf ( g_sa, "+CDS: "); | |
1399 | |
1400 l_sms_with_sca = ((mnsms_status_ind->sms_sdu.l_buf+7)/8); | |
1401 l_sms_without_sca = l_sms_with_sca - sca_len; | |
1402 | |
1403 pos += sprintf ( g_sa + pos, "%d", l_sms_without_sca ); | |
1404 | |
1405 io_sendIndication ( srcId, g_sa, ATI_FORCED_OUTPUT ); | |
1406 | |
1407 pos = 0; | |
1408 | |
1409 /* | |
1410 * Print PDU + service centre address field | |
1411 */ | |
1412 for (i=0;i<(USHORT)l_sms_with_sca;i++) | |
1413 pos = GsmToHex (mnsms_status_ind->sms_sdu.buf[i], g_sa, pos); | |
1414 | |
1415 /* | |
1416 * Send response | |
1417 */ | |
1418 io_sendMessageEx ( srcId, g_sa, (T_ATI_OUTPUT_TYPE)(ATI_INDICATION_OUTPUT + | |
1419 ATI_FORCED_OUTPUT + | |
1420 ATI_END_CRLF_OUTPUT) ); | |
1421 | |
1422 } | |
1423 #endif /* SMS_PDU_SUPPORT */ | |
1424 | |
1425 | |
1426 | |
1427 /* | |
1428 +--------------------------------------------------------------------+ | |
1429 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1430 | STATE : code ROUTINE : HexMessage | | |
1431 +--------------------------------------------------------------------+ | |
1432 | |
1433 PURPOSE : converts a sms message to HEX and fill it into a buffer. | |
1434 | |
1435 */ | |
1436 | |
1437 /* does not seem to be used */ | |
1438 /*GLOBAL USHORT HexMessage (T_ACI_SM_DATA * data, UBYTE length, char * buffer, USHORT pos) | |
1439 { | |
1440 int i; | |
1441 | |
1442 pos = GsmToHex (data->len, buffer, pos); | |
1443 | |
1444 for (i=0;i<(int)length;i++) | |
1445 pos = GsmToHex (data->data[i], buffer, pos); | |
1446 | |
1447 return pos; | |
1448 } */ | |
1449 | |
1450 | |
1451 /* | |
1452 +--------------------------------------------------------------------+ | |
1453 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1454 | STATE : code ROUTINE : HexScts | | |
1455 +--------------------------------------------------------------------+ | |
1456 | |
1457 PURPOSE : converts a service centre timestamp to HEX and fill it into a buffer. | |
1458 | |
1459 */ | |
1460 | |
1461 /* doesn't seem to be used... */ | |
1462 /*GLOBAL USHORT HexScts (T_ACI_VP_ABS * scts, char * buffer, USHORT pos) | |
1463 { | |
1464 UBYTE tz; | |
1465 | |
1466 TRACE_EVENT_P1("TZ =%x", scts->timezone); | |
1467 | |
1468 pos = GsmToHex ((UBYTE)((scts->year[1]<<4)+scts->year[0]), | |
1469 buffer, pos); | |
1470 pos = GsmToHex ((UBYTE)((scts->month[1]<<4)+scts->month[0]), | |
1471 buffer, pos); | |
1472 pos = GsmToHex ((UBYTE)((scts->day[1]<<4)+scts->day[0]), | |
1473 buffer, pos); | |
1474 pos = GsmToHex ((UBYTE)((scts->hour[1]<<4)+scts->hour[0]), | |
1475 buffer, pos); | |
1476 pos = GsmToHex ((UBYTE)((scts->minute[1]<<4)+scts->minute[0]), | |
1477 buffer, pos); | |
1478 pos = GsmToHex ((UBYTE)((scts->second[1]<<4)+scts->second[0]), | |
1479 buffer, pos); | |
1480 | |
1481 tz = cmhSMS_setTimezone(scts->timezone); | |
1482 pos = GsmToHex (tz, buffer, pos); | |
1483 | |
1484 return pos; | |
1485 }*/ | |
1486 | |
1487 | |
1488 /* | |
1489 +--------------------------------------------------------------------+ | |
1490 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1491 | STATE : code ROUTINE : GsmToHex | | |
1492 +--------------------------------------------------------------------+ | |
1493 | |
1494 PURPOSE : converts a GSM character to HEX and fill it into a buffer. | |
1495 | |
1496 */ | |
1497 | |
1498 GLOBAL USHORT GsmToHex (UBYTE in, char * buffer, USHORT pos) | |
1499 { | |
1500 const UBYTE hexVal[17] = {"0123456789ABCDEF"}; | |
1501 | |
1502 buffer[pos] = hexVal[ in >> 4 ]; | |
1503 buffer[pos+1] = hexVal[ in & 0x0F ]; | |
1504 buffer[pos+2] = '\0'; | |
1505 return pos+2; | |
1506 } | |
1507 | |
1508 /* | |
1509 +--------------------------------------------------------------------+ | |
1510 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1511 | STATE : code ROUTINE : HexAdress | | |
1512 +--------------------------------------------------------------------+ | |
1513 | |
1514 PURPOSE : converts a adress to HEX and fill it into a buffer. | |
1515 | |
1516 */ | |
1517 | |
1518 #if 0 | |
1519 GLOBAL USHORT HexAdress (CHAR * adress, UBYTE ton, UBYTE npi, char * buffer, USHORT pos) | |
1520 { | |
1521 int i; | |
1522 int len; | |
1523 | |
1524 len = (strlen (adress)+1)/2; | |
1525 | |
1526 pos = GsmToHex ((UBYTE)(len+1), buffer, pos); | |
1527 | |
1528 pos = GsmToHex ((UBYTE)(0x80 + (ton<<4) + npi), buffer, pos); | |
1529 | |
1530 for (i=0;i<len;i++) | |
1531 { | |
1532 if (i EQ len-1) | |
1533 { | |
1534 /* | |
1535 * last two digits | |
1536 */ | |
1537 if (strlen(adress) & 1) | |
1538 { | |
1539 pos = GsmToHex ((UBYTE)(0xF0 + (adress[2*i] - 0x30)), buffer, pos); | |
1540 continue; | |
1541 } | |
1542 } | |
1543 pos = GsmToHex ((UBYTE)(((adress [2*i+1]-0x30) << 4) + | |
1544 (adress [2*i] - 0x30)), buffer, pos); | |
1545 } | |
1546 return pos; | |
1547 } | |
1548 #endif /* 0 */ | |
1549 | |
1550 /* | |
1551 +--------------------------------------------------------------------+ | |
1552 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1553 | STATE : code ROUTINE : HexAdressTP | | |
1554 +--------------------------------------------------------------------+ | |
1555 | |
1556 PURPOSE : converts a adress to HEX and fill it into a buffer for TP-adresses. | |
1557 | |
1558 */ | |
1559 | |
1560 #if 0 | |
1561 GLOBAL USHORT HexAdressTP (CHAR * adress, UBYTE ton, UBYTE npi, char * buffer, USHORT pos) | |
1562 { | |
1563 int i; | |
1564 int len; | |
1565 | |
1566 len = (strlen (adress)+1)/2; | |
1567 | |
1568 if ( ton EQ 0x05 AND strlen (adress) NEQ 4 ) /* PATCH VO - if (patch) else ... */ | |
1569 pos = GsmToHex ((UBYTE)(strlen (adress) * 2), g_sa, pos); | |
1570 else | |
1571 pos = GsmToHex ((UBYTE)strlen(adress), g_sa, pos); | |
1572 | |
1573 pos = GsmToHex ((UBYTE)(0x80 + (ton<<4) + npi), g_sa, pos); | |
1574 | |
1575 if ( ton EQ 0x05 AND strlen (adress) NEQ 4 ) /* PATCH VO - if (patch) else ... */ | |
1576 { | |
1577 for (i=0;i<(int)strlen (adress);i++) | |
1578 pos = GsmToHex ((UBYTE)adress[i], g_sa, pos); | |
1579 } | |
1580 else | |
1581 { | |
1582 for (i=0;i<len;i++) | |
1583 { | |
1584 if (i EQ len-1) | |
1585 { | |
1586 /* | |
1587 * last two digits | |
1588 */ | |
1589 if (strlen(adress) & 1) | |
1590 { | |
1591 pos = GsmToHex ((UBYTE)(0xF0 + (adress[2*i] - 0x30)), g_sa, pos); | |
1592 continue; | |
1593 } | |
1594 } | |
1595 pos = GsmToHex ((UBYTE)(((adress [2*i+1]-0x30) << 4) + (adress [2*i] - 0x30)), | |
1596 g_sa, pos); | |
1597 } | |
1598 } | |
1599 return pos; | |
1600 } | |
1601 #endif /* 0 */ | |
1602 /* | |
1603 +--------------------------------------------------------------------+ | |
1604 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1605 | STATE : code ROUTINE : HexToGsm | | |
1606 +--------------------------------------------------------------------+ | |
1607 | |
1608 PURPOSE : converts a HEX value to the GSM character. | |
1609 | |
1610 */ | |
1611 | |
1612 GLOBAL char * HexToGsm (char * cl, UBYTE * value) | |
1613 { | |
1614 int i; | |
1615 UBYTE character; | |
1616 | |
1617 /* | |
1618 * initialise the output value | |
1619 */ | |
1620 *value = 0; | |
1621 | |
1622 /* | |
1623 * for both nibbles | |
1624 */ | |
1625 for (i=0;i<2;i++) | |
1626 { | |
1627 /* | |
1628 * shift the result of the last loop | |
1629 */ | |
1630 *value = (*value) << 4; | |
1631 | |
1632 /* | |
1633 * Isolate next nibble in ASCII | |
1634 */ | |
1635 character = toupper(*cl++); | |
1636 | |
1637 /* | |
1638 * convert Nibble character to value | |
1639 */ | |
1640 switch (character) | |
1641 { | |
1642 case 'A': | |
1643 case 'B': | |
1644 case 'C': | |
1645 case 'D': | |
1646 case 'E': | |
1647 case 'F': | |
1648 *value = *value + (character - 'A' + 10); | |
1649 break; | |
1650 default: | |
1651 /* | |
1652 * 0-9 | |
1653 */ | |
1654 *value = *value + (character - '0'); | |
1655 break; | |
1656 } | |
1657 } | |
1658 | |
1659 /* | |
1660 * return pointer to the rest of PDU | |
1661 */ | |
1662 return cl; | |
1663 } | |
1664 | |
1665 /* | |
1666 +--------------------------------------------------------------------+ | |
1667 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1668 | STATE : code ROUTINE : GSMAddress | | |
1669 +--------------------------------------------------------------------+ | |
1670 | |
1671 PURPOSE : converts a adress coded with HEX values to the internal | |
1672 data structures. | |
1673 | |
1674 */ | |
1675 | |
1676 /* does not seem to be used */ | |
1677 #if 0 | |
1678 GLOBAL char * GSMAddress (char * cl, char * address, T_ACI_TOA *tosca) | |
1679 { | |
1680 int i, j; | |
1681 UBYTE value; | |
1682 UBYTE len; | |
1683 UBYTE digit; | |
1684 | |
1685 /* | |
1686 * calculate the number of octets which are used for the address | |
1687 */ | |
1688 | |
1689 cl = HexToGsm (cl, &value); | |
1690 if (value EQ 0) /* SCA not given */ | |
1691 { | |
1692 address[0] = 0; | |
1693 return cl; | |
1694 } | |
1695 len = value - 1; | |
1696 | |
1697 /* | |
1698 * check against maximum value | |
1699 */ | |
1700 if (len > MAX_SMS_ADDR_DIG/2) | |
1701 { | |
1702 pdu_error_detected = TRUE; | |
1703 return cl; | |
1704 } | |
1705 | |
1706 /* | |
1707 * calculate the type of number and numbering plan identification | |
1708 */ | |
1709 cl = HexToGsm (cl, &value); | |
1710 | |
1711 tosca->ton = (value >> 4) & 7; | |
1712 tosca->npi = value & 0x0F; | |
1713 | |
1714 | |
1715 /* | |
1716 * convert the digits | |
1717 */ | |
1718 j = 0; | |
1719 for (i = 0; i < (int)len; i++) | |
1720 { | |
1721 cl = HexToGsm (cl, &value); | |
1722 | |
1723 /* | |
1724 * check digit n | |
1725 */ | |
1726 address[j++] = (value & 0x0F) + 0x30; | |
1727 /* | |
1728 * check digit n+1 | |
1729 */ | |
1730 digit = (value >> 4) & 0x0F; | |
1731 if (digit < 10) | |
1732 address[j++] = digit + 0x30; | |
1733 } | |
1734 /* | |
1735 * string termination | |
1736 */ | |
1737 address[j] = 0; | |
1738 | |
1739 /* | |
1740 * return pointer to the rest of the PDU | |
1741 */ | |
1742 return cl; | |
1743 } | |
1744 #endif /* 0 */ | |
1745 /* | |
1746 +--------------------------------------------------------------------+ | |
1747 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1748 | STATE : code ROUTINE : GSMAddressTP | | |
1749 +--------------------------------------------------------------------+ | |
1750 | |
1751 PURPOSE : converts a TP-adress coded with HEX values to the internal | |
1752 data structures. | |
1753 | |
1754 */ | |
1755 | |
1756 /* does not seem to be used */ | |
1757 #if 0 | |
1758 GLOBAL char * GSMAddressTP (char * cl, char * address, T_ACI_TOA *toda) | |
1759 { | |
1760 int i, j; | |
1761 UBYTE value; | |
1762 UBYTE len; | |
1763 UBYTE digit; | |
1764 | |
1765 /* | |
1766 * calculate the number of octets which are used for the address | |
1767 */ | |
1768 cl = HexToGsm (cl, &value); | |
1769 len = (value + 1)/2; | |
1770 | |
1771 /* | |
1772 * check against maximum value | |
1773 */ | |
1774 if (len > MAX_SMS_ADDR_DIG/2) | |
1775 { | |
1776 pdu_error_detected = TRUE; | |
1777 return cl; | |
1778 } | |
1779 /* | |
1780 * calculate the type of number and numbering plan identification | |
1781 */ | |
1782 cl = HexToGsm (cl, &value); | |
1783 | |
1784 toda->ton = (value >> 4) & 7; | |
1785 toda->npi = value & 0x0F; | |
1786 | |
1787 /* | |
1788 * convert the digits | |
1789 */ | |
1790 j = 0; | |
1791 for (i=0;i<(int)len;i++) | |
1792 { | |
1793 cl = HexToGsm (cl, &value); | |
1794 | |
1795 /* | |
1796 * check digit n | |
1797 */ | |
1798 address[j++] = (value & 0x0F) + 0x30; | |
1799 /* | |
1800 * check digit n+1 | |
1801 */ | |
1802 digit = (value >> 4) & 0x0F; | |
1803 if (digit < 10) | |
1804 address[j++] = digit + 0x30; | |
1805 } | |
1806 /* | |
1807 * string termination | |
1808 */ | |
1809 address[j] = 0; | |
1810 | |
1811 /* | |
1812 * return pointer to the rest of the PDU | |
1813 */ | |
1814 return cl; | |
1815 } | |
1816 #endif /* 0 */ | |
1817 | |
1818 /* | |
1819 +--------------------------------------------------------------------+ | |
1820 | PROJECT : GSM-F&D (8411) MODULE : ACI_PDU | | |
1821 | STATE : code ROUTINE : GSMMessage | | |
1822 +--------------------------------------------------------------------+ | |
1823 | |
1824 PURPOSE : converts a sms message from HEX and fill it into a buffer. | |
1825 | |
1826 */ | |
1827 | |
1828 #if 0 | |
1829 GLOBAL char *GSMMessage (char *cl, UBYTE *data, SHORT oct_length, SHORT max_length) | |
1830 { | |
1831 SHORT i; | |
1832 | |
1833 /* | |
1834 * check against maximum value | |
1835 */ | |
1836 if (oct_length > max_length) | |
1837 { | |
1838 pdu_error_detected = TRUE; | |
1839 return cl; | |
1840 } | |
1841 memset (data, 0, max_length); | |
1842 | |
1843 /* | |
1844 * copy message | |
1845 */ | |
1846 for (i = 0; i < oct_length; i++) | |
1847 cl = HexToGsm (cl, &data[i]); | |
1848 | |
1849 return cl; | |
1850 } | |
1851 #endif /* 0 */ | |
1852 | |
1853 #endif | |
1854 | |
1855 #endif /* ATI_PDU_C */ |