From 9ce2ce35d5f94c5d0b83ca8d9ceb21c8c1cf3cd4 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 27 Feb 2021 03:17:28 +0100 Subject: cell/wifi refactoring --- fw/esp32/components/eos/cell_pdp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 fw/esp32/components/eos/cell_pdp.c (limited to 'fw/esp32/components/eos/cell_pdp.c') diff --git a/fw/esp32/components/eos/cell_pdp.c b/fw/esp32/components/eos/cell_pdp.c new file mode 100644 index 0000000..1aa0575 --- /dev/null +++ b/fw/esp32/components/eos/cell_pdp.c @@ -0,0 +1,31 @@ +#include +#include + +#include + +#include "eos.h" +#include "cell.h" + +void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) { + char *apn, *user, *pass; + + buffer += 1; + size -= 1; + switch (mtype) { + case EOS_CELL_MTYPE_PDP_CONFIG: + apn = (char *)buffer; + user = apn + strlen(apn) + 1; + pass = user + strlen(user) + 1; + eos_ppp_set_apn(apn); + eos_ppp_set_auth(user, pass); + break; + + case EOS_CELL_MTYPE_PDP_CONNECT: + eos_ppp_connect(); + break; + + case EOS_CELL_MTYPE_PDP_DISCONNECT: + eos_ppp_disconnect(); + break; + } +} -- cgit v1.2.3