FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_pduout.c @ 378:e61525f082bd
uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 09 Mar 2018 00:17:13 +0000 |
parents | d1fa771abeb8 |
children | a38805b5b6d4 |
comparison
equal
deleted
inserted
replaced
377:f7228c18463a | 378:e61525f082bd |
---|---|
12 prep_for_pdu_mode() | 12 prep_for_pdu_mode() |
13 { | 13 { |
14 atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0); | 14 atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0); |
15 } | 15 } |
16 | 16 |
17 send_in_pdu_mode(da, textsrc, textlen, udh, udhl) | 17 send_pdu_out(pduhex, pdulen) |
18 u_char *da, *textsrc, *udh; | 18 char *pduhex; |
19 unsigned textlen, udhl; | 19 unsigned pdulen; |
20 { | 20 { |
21 char *cmdname; | 21 char *cmdname; |
22 void (*callback)(); | 22 void (*callback)(); |
23 u_char pdu[158]; | |
24 unsigned pdulen; | |
25 char pduhex[317]; | |
26 char send_cmd[32]; | 23 char send_cmd[32]; |
27 | 24 |
28 pdu[0] = 0; | |
29 pdulen = make_sms_submit_pdu(da, 0, 0, textsrc, textlen, udh, udhl, | |
30 pdu + 1); | |
31 make_hex_string(pdu, pdulen + 1, pduhex); | |
32 if (sms_write_mode) { | 25 if (sms_write_mode) { |
33 cmdname = "CMGW"; | 26 cmdname = "CMGW"; |
34 callback = cmgw_callback; | 27 callback = cmgw_callback; |
35 } else { | 28 } else { |
36 cmdname = "CMGS"; | 29 cmdname = "CMGS"; |
37 callback = 0; | 30 callback = 0; |
38 } | 31 } |
39 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); | 32 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); |
40 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); | 33 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); |
41 } | 34 } |
35 | |
36 send_in_pdu_mode(da, textsrc, textlen, udh, udhl) | |
37 u_char *da, *textsrc, *udh; | |
38 unsigned textlen, udhl; | |
39 { | |
40 u_char pdu[158]; | |
41 unsigned pdulen; | |
42 char pduhex[317]; | |
43 | |
44 pdu[0] = 0; | |
45 pdulen = make_sms_submit_pdu(da, 0, 0, textsrc, textlen, udh, udhl, | |
46 pdu + 1); | |
47 make_hex_string(pdu, pdulen + 1, pduhex); | |
48 send_pdu_out(pduhex, pdulen); | |
49 } | |
50 | |
51 send_pdu_ucs2(da, textsrc, textlen, udh, udhl) | |
52 u_char *da, *udh; | |
53 u_short *textsrc; | |
54 unsigned textlen, udhl; | |
55 { | |
56 u_char ucs2_be[140], pdu[158]; | |
57 unsigned pdulen; | |
58 char pduhex[317]; | |
59 | |
60 ucs2_out_bigend(textsrc, ucs2_be, textlen); | |
61 pdu[0] = 0; | |
62 pdulen = make_sms_submit_pdu_8bit(da, 0, 0x08, ucs2_be, textlen * 2, | |
63 udh, udhl, pdu + 1); | |
64 make_hex_string(pdu, pdulen + 1, pduhex); | |
65 send_pdu_out(pduhex, pdulen); | |
66 } |