annotate uptools/atcmd/smdump.c @ 352:02d6c8469535

fcup-smdump implemented, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 05 Feb 2018 08:47:45 +0000
parents
children 3bcc56883b17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
352
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This utility retrieves a dump of all stored SMS records in PDU mode.
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <string.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <strings.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <unistd.h>
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "../../rvinterf/include/exitcodes.h"
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "resp_parse.h"
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern char at_response[];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 int pdu_state;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 char *msgtype;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 u_char pbname_gsm[40];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 unsigned pbname_len, header_len;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 u_char pdu_bin[176];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 validate_pbname_7bit()
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 unsigned n;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 for (n = 0; n < pbname_len; n++)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (pbname_gsm[n] & 0x80)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 return(-1);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 return(0);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 cmgl_header()
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 struct resp_field fields[4];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 int cc;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /* skip empty lines */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 if (!at_response[1])
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 return;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 /* if not empty, it MUST be +CMGL */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 if (strncmp(at_response+1, "+CMGL: ", 7)) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 fprintf(stderr, "error: response from target is not +CMGL\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 if (parse_structured_response(at_response+8, fields, 4) != 4) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 malformed: fprintf(stderr, "error: malformed +CMGL response\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 if (fields[0].type != RESP_FIELD_NUMBER ||
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 fields[1].type != RESP_FIELD_NUMBER ||
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 fields[3].type != RESP_FIELD_NUMBER)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 goto malformed;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 if (fields[2].type != RESP_FIELD_STRING &&
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 fields[2].type != RESP_FIELD_EMPTY)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 goto malformed;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 /* we'll handle the message number when we add delete after dump */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 switch (fields[1].num) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 case 0:
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 case 1:
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 msgtype = "Received";
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 break;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 case 2:
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 msgtype = "Stored unsent";
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 break;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 case 3:
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 msgtype = "Sent";
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 break;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 default:
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 fprintf(stderr,
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 "error: invalid message status code in +CMGL response\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 if (fields[2].type == RESP_FIELD_STRING) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 cc = decode_hex_line(fields[2].str, pbname_gsm,
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 sizeof pbname_gsm);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 if (cc >= 1) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 pbname_len = cc;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 if (validate_pbname_7bit() < 0)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 pbname_len = 0;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 } else
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 pbname_len = 0;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 } else
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 pbname_len = 0;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 header_len = fields[3].num;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 pdu_state = 1;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 emit_pb_name()
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 u_char decoded_name[81];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 gsm7_to_ascii_or_ext(pbname_gsm, pbname_len, decoded_name, 0, 0, 0, 0);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 printf("Phonebook-Name: %s\n", decoded_name);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 cmgl_pdu()
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 int cc;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 unsigned sca_len;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 cc = decode_hex_line(at_response+1, pdu_bin, sizeof pdu_bin);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 if (cc < 1) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 fprintf(stderr, "error: expected PDU not received\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 sca_len = pdu_bin[0];
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 if (1 + sca_len + header_len != cc) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 fprintf(stderr, "error: PDU length mismatch\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 printf("%s message:\n", msgtype);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 if (pbname_len)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 emit_pb_name();
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 puts(at_response+1);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 putchar('\n');
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 pdu_state = 0;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 cmgl_callback()
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 if (pdu_state)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 cmgl_pdu();
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 else
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 cmgl_header();
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 main(argc, argv)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 char **argv;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 int c;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 extern int optind;
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 while ((c = getopt(argc, argv, "B:np:RX:")) != EOF)
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 if (!atinterf_cmdline_opt(c)) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 /* error msg already printed */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 exit(ERROR_USAGE);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 if (argc != optind) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 fprintf(stderr, "usage: %s [options]\n", argv[0]);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 exit(ERROR_USAGE);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 atinterf_init();
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 /* put the 07.05 modem in PDU mode */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /* HEX charset for phonebook names */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 atinterf_exec_cmd_needok("AT+CSCS=\"HEX\"", 0, 0);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 /* main command */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 atinterf_exec_cmd_needok("AT+CMGL=4", 0, cmgl_callback);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (pdu_state) {
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 fprintf(stderr, "error: wrong state at the end of +CMGL\n");
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 exit(ERROR_TARGET);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 }
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 /* delete-after-dump will go here */
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 exit(0);
02d6c8469535 fcup-smdump implemented, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 }