summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-08-09 16:52:05 +0200
committerUros Majstorovic <majstor@majstor.org>2020-08-09 16:52:05 +0200
commit82832a1d3e30f27bd88733b11ed8fe06a73b80ce (patch)
treecc0f9863b82752473379c95538e100fb98cddacd
parent42ec688338634c9ba3f7fab95fbd230d17e4da1e (diff)
sms send wait for prompt
-rw-r--r--fw/esp32/components/eos/cell_sms.c6
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;