FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_pduout.c @ 372:1e7c6fcb9abe
uptools/atcmd: smsend_pdu.c renamed to smsend_pduout.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Mar 2018 18:13:38 +0000 |
parents | uptools/atcmd/smsend_pdu.c@46cf847781bd |
children | d1fa771abeb8 |
comparison
equal
deleted
inserted
replaced
371:0bd06f481223 | 372:1e7c6fcb9abe |
---|---|
1 /* | |
2 * This module implements SMS sending/writing in PDU mode. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 | |
8 extern void cmgw_callback(); | |
9 | |
10 extern int sms_write_mode; | |
11 | |
12 prep_for_pdu_mode() | |
13 { | |
14 atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0); | |
15 } | |
16 | |
17 send_in_pdu_mode(da, textsrc, textlen, udh, udhl) | |
18 u_char *da, *textsrc, *udh; | |
19 unsigned textlen, udhl; | |
20 { | |
21 char *cmdname; | |
22 void (*callback)(); | |
23 u_char pdu[158]; | |
24 unsigned pdulen; | |
25 char pduhex[317]; | |
26 char send_cmd[32]; | |
27 | |
28 pdu[0] = 0; | |
29 pdulen = make_sms_submit_pdu(da, textsrc, textlen, udh, udhl, pdu + 1); | |
30 make_hex_string(pdu, pdulen + 1, pduhex); | |
31 if (sms_write_mode) { | |
32 cmdname = "CMGW"; | |
33 callback = cmgw_callback; | |
34 } else { | |
35 cmdname = "CMGS"; | |
36 callback = 0; | |
37 } | |
38 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); | |
39 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); | |
40 } |