comparison uptools/atcmd/smsend_text.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 dc2fd8e6f42c
comparison
equal deleted inserted replaced
361:ae2556e256a4 362:89fe66cb60f6
1 /*
2 * This module implements SMS sending/writing in text 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_text_mode()
13 {
14 atinterf_exec_cmd_needok("AT+CMGF=1", 0, 0);
15 atinterf_exec_cmd_needok("AT+CSCS=\"8859-1\"", 0, 0);
16 atinterf_exec_cmd_needok("AT+CSMP=1,,0,0", 0, 0);
17 }
18
19 send_in_text_mode(binda, textstr)
20 u_char *binda;
21 char *textstr;
22 {
23 char *cmdname;
24 void (*callback)();
25 char send_cmd[64], digits[21];
26
27 if (sms_write_mode) {
28 cmdname = "CMGW";
29 callback = cmgw_callback;
30 } else {
31 cmdname = "CMGS";
32 callback = 0;
33 }
34 if (binda[0]) {
35 decode_address_digits(binda + 2, digits, binda[0]);
36 sprintf(send_cmd, "AT+%s=\"%s\",%u", cmdname, digits, binda[1]);
37 } else
38 sprintf(send_cmd, "AT+%s", cmdname);
39 atinterf_exec_cmd_needok(send_cmd, textstr, callback);
40 }