diff --git a/library.json b/library.json index 6d859aa..2aaf99c 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TinyGSM", - "version": "0.7.7", + "version": "0.7.8", "description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.", "keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M", "authors": diff --git a/library.properties b/library.properties index 14c6576..423a068 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TinyGSM -version=0.7.7 +version=0.7.8 author=Volodymyr Shymanskyy maintainer=Volodymyr Shymanskyy sentence=A small Arduino library for GPRS modules, that just works. diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index 458a05b..7726a3b 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -181,7 +181,27 @@ public: } String getModemName() { - return "SIMCom SIM7000"; + String name = "SIMCom SIM7000"; + + sendAT(GF("+CGMI")); + String res1; + if (waitResponse(1000L, res1) != 1) { + return name; + } + res1.replace(GSM_NL "OK" GSM_NL, ""); + res1.trim(); + + sendAT(GF("+GMM")); + String res2; + if (waitResponse(1000L, res2) != 1) { + return name; + } + res2.replace(GSM_NL "OK" GSM_NL, ""); + res2.trim(); + + name = res1 + String(' ') + res2; + DBG("### Modem:", name); + return name; } TINY_GSM_MODEM_SET_BAUD_IPR() diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 4391850..0e1d569 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -184,16 +184,36 @@ public: } String getModemName() { + String name = ""; #if defined(TINY_GSM_MODEM_SIM800) - return "SIMCom SIM800"; + name = "SIMCom SIM800"; #elif defined(TINY_GSM_MODEM_SIM808) - return "SIMCom SIM808"; + name = "SIMCom SIM808"; #elif defined(TINY_GSM_MODEM_SIM868) - return "SIMCom SIM868"; + name = "SIMCom SIM868"; #elif defined(TINY_GSM_MODEM_SIM900) - return "SIMCom SIM900"; + name = "SIMCom SIM900"; #endif - return "SIMCom SIM800"; + + sendAT(GF("+CGMI")); + String res1; + if (waitResponse(1000L, res1) != 1) { + return name; + } + res1.replace(GSM_NL "OK" GSM_NL, ""); + res1.trim(); + + sendAT(GF("+GMM")); + String res2; + if (waitResponse(1000L, res2) != 1) { + return name; + } + res2.replace(GSM_NL "OK" GSM_NL, ""); + res2.trim(); + + name = res1 + String(' ') + res2; + DBG("### Modem:", name); + return name; } TINY_GSM_MODEM_SET_BAUD_IPR() diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index 3c66d9c..0b0a347 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -10,7 +10,7 @@ #define TinyGsmCommon_h // The current library version number -#define TINYGSM_VERSION "0.7.7" +#define TINYGSM_VERSION "0.7.8" #if defined(SPARK) || defined(PARTICLE) #include "Particle.h"