From d0b5cdf1351cb02dc001aab5bd44ff6c5f681abc Mon Sep 17 00:00:00 2001 From: James Maki Date: Wed, 25 Aug 2010 08:12:23 -0500 Subject: add ATQ0 and set version to 0.0.4 --- src/atcmd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/atcmd.c') 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; -- cgit v1.2.3