From 49c2653dcaefdd9c41e74c8463080b74ea22975f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Cervera=20And=C3=A9s?= Date: Tue, 11 Feb 2020 10:12:59 +0100 Subject: [PATCH] Added support for IMSI information on SIM800 and SIM808 modules --- src/TinyGsmClientSIM800.h | 2 ++ src/TinyGsmCommon.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index be225d5..51347ab 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -321,6 +321,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID() TINY_GSM_MODEM_GET_IMEI_GSN() +TINY_GSM_MODEM_GET_IMSI_CIMI() + SimStatus getSimStatus(unsigned long timeout_ms = 10000L) { for (unsigned long start = millis(); millis() - start < timeout_ms; ) { sendAT(GF("+CPIN?")); diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index bb2e541..d176554 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -527,6 +527,20 @@ String TinyGsmDecodeHex16bit(String &instr) { } +// Asks for International Mobile Subscriber Identity IMSI via the AT+CIMI command +#define TINY_GSM_MODEM_GET_IMSI_CIMI() \ + String getIMSI() { \ + sendAT(GF("+CIMI")); \ + if (waitResponse(GF(GSM_NL)) != 1) { \ + return ""; \ + } \ + String res = stream.readStringUntil('\n'); \ + waitResponse(); \ + res.trim(); \ + return res; \ + } + + // Gets the modem's registration status via CREG/CGREG/CEREG // CREG = Generic network registration // CGREG = GPRS service registration