From fc98d3809e0db36d634f290417b9152f87f83e3e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:37:42 +0200 Subject: new phone firmware --- fw/fe310/phone/cell.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 fw/fe310/phone/cell.c (limited to 'fw/fe310/phone/cell.c') diff --git a/fw/fe310/phone/cell.c b/fw/fe310/phone/cell.c new file mode 100644 index 0000000..47ce8e5 --- /dev/null +++ b/fw/fe310/phone/cell.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include "app/log.h" +#include "cell.h" + +void cell_init(void) { + eos_cell_set_handler(EOS_CELL_MTYPE_DEV, cell_msg_handler); +} + +void cell_msg_handler(unsigned char type, unsigned char *buffer, uint16_t len) { + switch (type) { + case EOS_CELL_MTYPE_STATUS: { + uint8_t status, connected; + int rv; + + rv = eos_cell_status_parse(buffer, len, &status, &connected); + if (rv) { + APP_LOG(APP_LOG_ERR, "BAD STATUS ERR:%d\n", rv); + return; + } + APP_LOG(APP_LOG_DEBUG, "MODEM STATUS: "); + switch (status) { + case EOS_CELL_STATUS_RESET: { + APP_LOG(APP_LOG_DEBUG, "RESET\n"); + break; + } + + case EOS_CELL_STATUS_IDLE: { + APP_LOG(APP_LOG_DEBUG, "IDLE\n"); + break; + } + + case EOS_CELL_STATUS_RELAY: { + APP_LOG(APP_LOG_DEBUG, "RELAY\n"); + break; + } + + case EOS_CELL_STATUS_PPP: { + APP_LOG(APP_LOG_DEBUG, "PPP, "); + if (connected) { + APP_LOG(APP_LOG_DEBUG, "CONNECTED\n"); + } else { + APP_LOG(APP_LOG_DEBUG, "NOT CONNECTED\n"); + } + break; + } + + default: { + APP_LOG(APP_LOG_DEBUG, "BAD STATUS\n"); + break; + } + } + break; + } + } + eos_net_free(buffer, 0); +} -- cgit v1.2.3