summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/cell_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/esp32/components/eos/cell_data.c')
-rw-r--r--fw/esp32/components/eos/cell_data.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/fw/esp32/components/eos/cell_data.c b/fw/esp32/components/eos/cell_data.c
index 6732346..f9a755f 100644
--- a/fw/esp32/components/eos/cell_data.c
+++ b/fw/esp32/components/eos/cell_data.c
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <string.h>
#include <esp_log.h>
@@ -6,15 +7,25 @@
#include "cell.h"
void eos_cell_data_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) {
- int rv;
-
- rv = eos_modem_take(1000);
- if (rv) return;
+ char *apn, *user, *pass;
buffer += 1;
size -= 1;
switch (mtype) {
- }
+ case EOS_CELL_MTYPE_DATA_CONFIGURE:
+ 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;
- eos_modem_give();
+ case EOS_CELL_MTYPE_DATA_CONNECT:
+ eos_ppp_connect();
+ break;
+
+ case EOS_CELL_MTYPE_DATA_DISCONNECT:
+ eos_ppp_disconnect();
+ break;
+ }
}