diff options
author | James Maki <jmaki@multitech.com> | 2010-08-25 08:12:23 -0500 |
---|---|---|
committer | James Maki <jmaki@multitech.com> | 2010-08-25 08:12:23 -0500 |
commit | d0b5cdf1351cb02dc001aab5bd44ff6c5f681abc (patch) | |
tree | 7117504a77f5b7b110e1150a949fea3982b1d410 /src | |
parent | 51763cb7ea19ab1fa7f5f6f0a87777437834a934 (diff) | |
download | sms-utils-0.0.4.tar.gz sms-utils-0.0.4.tar.bz2 sms-utils-0.0.4.zip |
add ATQ0 and set version to 0.0.40.0.4
Diffstat (limited to 'src')
-rw-r--r-- | src/atcmd.c | 20 | ||||
-rw-r--r-- | src/atcmd.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/atcmd.c b/src/atcmd.c index 76372d2..aad15e9 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -611,6 +611,21 @@ int atcmd_v_write(int fd, int mode) return 0; } +int atcmd_q_write(int fd, int mode) +{ + char buf[ATCMD_LINE_SIZE]; + int tmp; + + atcmd_writeline(fd, "ATQ%d", mode); + tmp = atcmd_expect_line(fd, buf, sizeof(buf), "OK"); + if (tmp <= 0) { + log_debug("expected OK but it was not received"); + return -1; + } + + return 0; +} + int atcmd_plus_cmgf_write(int fd, int mode) { char buf[ATCMD_LINE_SIZE]; @@ -1099,6 +1114,11 @@ int atcmd_init(int fd, int read_timeout) { int tmp; + tmp = atcmd_q_write(fd, 0); + if (tmp < 0) { + return tmp; + } + tmp = atcmd_v_write(fd, 1); if (tmp < 0) { return tmp; diff --git a/src/atcmd.h b/src/atcmd.h index d9a53a0..de6eeee 100644 --- a/src/atcmd.h +++ b/src/atcmd.h @@ -59,6 +59,7 @@ int atcmd_response_foreach_line(int fd, atcmd_response_callback_t call, void *pr int atcmd_e_write(int fd, int mode); int atcmd_v_write(int fd, int mode); +int atcmd_q_write(int fd, int mode); int atcmd_plus_cmgf_write(int fd, int mode); int atcmd_plus_cmgw_write(int fd, const char *msg, size_t msg_len); int atcmd_plus_cmgs_write(int fd, const char *msg, size_t msg_len); |