FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_main.c @ 369:06cf82710cca
fcup-smsend: implemented -q option to suppress concat summary output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Mar 2018 16:41:57 +0000 |
parents | 3cc79e260066 |
children | 076d533f840d |
comparison
equal
deleted
inserted
replaced
368:3cc79e260066 | 369:06cf82710cca |
---|---|
10 #include <unistd.h> | 10 #include <unistd.h> |
11 #include "../../rvinterf/include/exitcodes.h" | 11 #include "../../rvinterf/include/exitcodes.h" |
12 | 12 |
13 #define MAX_MSG_CHARS (153*255) | 13 #define MAX_MSG_CHARS (153*255) |
14 | 14 |
15 int sms_write_mode, text_mode, utf8_input, concat_enable; | 15 int sms_write_mode, text_mode, utf8_input, concat_enable, quiet; |
16 u_char dest_addr[12]; | 16 u_char dest_addr[12]; |
17 char msgtext[MAX_MSG_CHARS*2+2]; | 17 char msgtext[MAX_MSG_CHARS*2+2]; |
18 u_char msgtext_gsm7[MAX_MSG_CHARS]; | 18 u_char msgtext_gsm7[MAX_MSG_CHARS]; |
19 unsigned msgtext_gsmlen; | 19 unsigned msgtext_gsmlen; |
20 u_char concat_refno; | 20 u_char concat_refno; |
24 { | 24 { |
25 int c; | 25 int c; |
26 extern int optind; | 26 extern int optind; |
27 extern char *optarg; | 27 extern char *optarg; |
28 | 28 |
29 while ((c = getopt(argc, argv, "B:C:np:RtuwWX:")) != EOF) { | 29 while ((c = getopt(argc, argv, "B:C:np:qRtuwWX:")) != EOF) { |
30 if (atinterf_cmdline_opt(c)) | 30 if (atinterf_cmdline_opt(c)) |
31 continue; | 31 continue; |
32 switch (c) { | 32 switch (c) { |
33 case 'C': | 33 case 'C': |
34 concat_enable = 1; | 34 concat_enable = 1; |
35 concat_refno = strtoul(optarg, 0, 0); | 35 concat_refno = strtoul(optarg, 0, 0); |
36 continue; | |
37 case 'q': | |
38 quiet = 1; | |
36 continue; | 39 continue; |
37 case 't': | 40 case 't': |
38 text_mode = 1; | 41 text_mode = 1; |
39 continue; | 42 continue; |
40 case 'u': | 43 case 'u': |
175 common_init(); | 178 common_init(); |
176 prep_for_pdu_mode(); | 179 prep_for_pdu_mode(); |
177 send_in_pdu_mode(dest_addr, msgtext_gsm7, msgtext_gsmlen, 0, 0); | 180 send_in_pdu_mode(dest_addr, msgtext_gsm7, msgtext_gsmlen, 0, 0); |
178 if (sms_write_mode == 1) | 181 if (sms_write_mode == 1) |
179 sendafterwr_process(); | 182 sendafterwr_process(); |
180 if (concat_enable) | 183 if (concat_enable && !quiet) |
181 printf("Message sent as single SMS\n"); | 184 printf("Message sent as single SMS\n"); |
182 exit(0); | 185 exit(0); |
183 } | 186 } |
184 if (!concat_enable) | 187 if (!concat_enable) |
185 goto too_long_for_one_sms; | 188 goto too_long_for_one_sms; |
205 } | 208 } |
206 if (sms_write_mode == 0) | 209 if (sms_write_mode == 0) |
207 atinterf_exec_cmd_needok("AT+CMMS=0", 0, 0); | 210 atinterf_exec_cmd_needok("AT+CMMS=0", 0, 0); |
208 if (sms_write_mode == 1) | 211 if (sms_write_mode == 1) |
209 sendafterwr_process(); | 212 sendafterwr_process(); |
210 printf("Message sent as %u SMS segments\n", nparts); | 213 if (!quiet) |
214 printf("Message sent as %u SMS segments\n", nparts); | |
211 exit(0); | 215 exit(0); |
212 } | 216 } |