FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_pdu.c @ 362:89fe66cb60f6
fcup-smsend program put together, compiles
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Mon, 05 Mar 2018 01:47:18 +0000 |
| parents | |
| children | 46cf847781bd |
comparison
equal
deleted
inserted
replaced
| 361:ae2556e256a4 | 362:89fe66cb60f6 |
|---|---|
| 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 + 1); | |
| 39 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); | |
| 40 } |
