diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-08-09 16:52:05 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-08-09 16:52:05 +0200 |
commit | 82832a1d3e30f27bd88733b11ed8fe06a73b80ce (patch) | |
tree | cc0f9863b82752473379c95538e100fb98cddacd /fw/esp32/components | |
parent | 42ec688338634c9ba3f7fab95fbd230d17e4da1e (diff) |
sms send wait for prompt
Diffstat (limited to 'fw/esp32/components')
-rw-r--r-- | fw/esp32/components/eos/cell_sms.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fw/esp32/components/eos/cell_sms.c b/fw/esp32/components/eos/cell_sms.c index eeb80a5..1333973 100644 --- a/fw/esp32/components/eos/cell_sms.c +++ b/fw/esp32/components/eos/cell_sms.c @@ -182,6 +182,7 @@ static int sms_encode(unsigned char *buffer, uint16_t size) { void eos_cell_sms_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) { int rv; + char b[4]; buffer += 1; size -= 1; @@ -227,8 +228,11 @@ void eos_cell_sms_handler(unsigned char mtype, unsigned char *buffer, uint16_t s rv = eos_modem_take(1000); if (rv) return; at_cmd(cmd); + // wait for: '> ' (0d 0a 3e 20) + eos_modem_read(b, 4, 1000); at_cmd(pdu); - rv = at_expect("^OK", "^ERROR", 1000); + rv = at_expect("^\\+CMGS: [0-9]+", "^ERROR", 5000); + if (rv == 1) rv = at_expect("^OK", "^ERROR", 1000); eos_modem_give(); break; |