From fc973f691e6a14b2f37d00f7bfd4ded90f28af17 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 20 Feb 2020 13:56:39 -0500 Subject: [PATCH] Fix Sequans name and factory reset Signed-off-by: Sara Damiano --- src/TinyGsmClientSequansMonarch.h | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index 87221e0..c49b5d9 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -235,6 +235,39 @@ class TinyGsmSequansMonarch } } + String getModemNameImpl() { + sendAT(GF("+CGMI")); + String res1; + if (waitResponse(1000L, res1) != 1) { + return "unknown"; + } + res1.replace("\r\nOK\r\n", ""); + res1.replace("\rOK\r", ""); + res1.trim(); + + sendAT(GF("+CGMM")); + String res2; + if (waitResponse(1000L, res2) != 1) { + return "unknown"; + } + res2.replace("\r\nOK\r\n", ""); + res2.replace("\rOK\r", ""); + res2.trim(); + + String name = res1 + String(' ') + res2; + DBG("### Modem:", name); + return name; + } + + bool factoryDefaultImpl() { + sendAT(GF("&F0")); // Factory + waitResponse(); + sendAT(GF("Z")); // default configuration + waitResponse(); + sendAT(GF("+IPR=0")); // Auto-baud + return waitResponse() == 1; + } + void maintainImpl() { for (int mux = 1; mux <= TINY_GSM_MUX_COUNT; mux++) { GsmClientSequansMonarch* sock = sockets[mux % TINY_GSM_MUX_COUNT];