diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-08-09 02:03:25 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-08-09 02:03:25 +0200 |
commit | 587729b76869eb56decbf72d3a1e7f2bc2041a24 (patch) | |
tree | 8e17f8304831c684e273196816dfa5862ed0f3b3 /fw/esp32/components/eos/cell_ussd.c | |
parent | 6c0542f5aaafc0d463876ade4427ccbec0ee5eda (diff) |
sms service added/tested
Diffstat (limited to 'fw/esp32/components/eos/cell_ussd.c')
-rw-r--r-- | fw/esp32/components/eos/cell_ussd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fw/esp32/components/eos/cell_ussd.c b/fw/esp32/components/eos/cell_ussd.c index 3f5ea3b..3113886 100644 --- a/fw/esp32/components/eos/cell_ussd.c +++ b/fw/esp32/components/eos/cell_ussd.c @@ -8,12 +8,10 @@ #include "cell.h" static char cmd[256]; +static int cmd_len; void eos_cell_ussd_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) { - int cmd_len, rv; - - rv = eos_modem_take(1000); - if (rv) return; + int rv; buffer += 1; size -= 1; @@ -24,13 +22,18 @@ void eos_cell_ussd_handler(unsigned char mtype, unsigned char *buffer, uint16_t buffer[size] = '\0'; cmd_len = snprintf(cmd, sizeof(cmd), "AT+CUSD=1,\"%s\",15\r", buffer); if ((cmd_len < 0) || (cmd_len >= sizeof(cmd))) return; + + rv = eos_modem_take(1000); + if (rv) return; + at_cmd(cmd); rv = at_expect("^OK", "^ERROR", 1000); + eos_modem_give(); + break; } - eos_modem_give(); } void eos_cell_ussd_init(void) {}
\ No newline at end of file |