Get name from modem

This commit is contained in:
Sara Damiano
2019-05-24 22:35:29 -04:00
parent 69cbab842d
commit 9ce1a2d998
5 changed files with 49 additions and 9 deletions

View File

@@ -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()

View File

@@ -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()

View File

@@ -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"