Check GPRS status on SIM7000
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/ISSUE_TEMPLATE.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/ISSUE_TEMPLATE.md
									
									
									
									
										vendored
									
									
								
							| @@ -22,7 +22,7 @@ with your board before submitting any issues. | ||||
|  | ||||
| Main processor board: <!-- Uno, Zero, ESP32, Particle, etc --> | ||||
| Modem: <!-- Brand, model, variant, firmware version --> | ||||
| TinyGSM version: <!-- always try to use the latest (0.10.1) --> | ||||
| TinyGSM version: <!-- always try to use the latest (0.10.2) --> | ||||
| Code: <!-- Example name or paste in your code --> | ||||
|  | ||||
| ### Scenario, steps to reproduce | ||||
|   | ||||
| @@ -115,7 +115,7 @@ Watch this repo for new updates! And of course, contributions are welcome ;) | ||||
| **Location** | ||||
| - GPS/GNSS | ||||
|     - SIM808, SIM7000, SIM7500/7600/7800, BG96, u-blox | ||||
|     - NOTE:  u-blox chips do NOT have embedded GPS - this function only works if a secondary GPS is connected to primary cellular chip over I2C | ||||
|     - NOTE:  u-blox chips do _NOT_ have embedded GPS - this function only works if a secondary GPS is connected to primary cellular chip over I2C | ||||
| - GSM location service | ||||
|     - SIM800, SIM7000, Quectel, u-blox | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "TinyGSM", | ||||
|   "version": "0.10.1", | ||||
|   "version": "0.10.2", | ||||
|   "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": | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| name=TinyGSM | ||||
| version=0.10.1 | ||||
| version=0.10.2 | ||||
| author=Volodymyr Shymanskyy | ||||
| maintainer=Volodymyr Shymanskyy | ||||
| sentence=A small Arduino library for GPRS modules, that just works. | ||||
|   | ||||
| @@ -239,7 +239,15 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|    */ | ||||
|  public: | ||||
|   RegStatus getRegistrationStatus() { | ||||
|     return (RegStatus)getRegistrationStatusXREG("CEREG"); | ||||
|     RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG"); | ||||
|     // If we're connected on EPS, great! | ||||
|     if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) { | ||||
|       return epsStatus; | ||||
|     } else { | ||||
|       // Otherwise, check GPRS network status | ||||
|       // We could be using GPRS fall-back or the board could be being moody | ||||
|       return (RegStatus)getRegistrationStatusXREG("CGREG"); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|  protected: | ||||
|   | ||||
| @@ -317,24 +317,14 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>, | ||||
|  public: | ||||
|   RegStatus getRegistrationStatus() { | ||||
|     // Check first for EPS registration | ||||
|     sendAT(GF("+CEREG?")); | ||||
|     if (waitResponse(GF(GSM_NL "+CEREG:")) != 1) { return REG_UNKNOWN; } | ||||
|     streamSkipUntil(','); /* Skip format (0) */ | ||||
|     int status = streamGetIntBefore('\n'); | ||||
|     waitResponse(); | ||||
|     RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG"); | ||||
|  | ||||
|     // If we're connected on EPS, great! | ||||
|     if ((RegStatus)status == REG_OK_HOME || | ||||
|         (RegStatus)status == REG_OK_ROAMING) { | ||||
|       return (RegStatus)status; | ||||
|     if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) { | ||||
|       return epsStatus; | ||||
|     } else { | ||||
|       // Otherwise, check generic network status | ||||
|       sendAT(GF("+CREG?")); | ||||
|       if (waitResponse(GF(GSM_NL "+CREG:")) != 1) { return REG_UNKNOWN; } | ||||
|       streamSkipUntil(','); /* Skip format (0) */ | ||||
|       status = streamGetIntBefore('\n'); | ||||
|       waitResponse(); | ||||
|       return (RegStatus)status; | ||||
|       return (RegStatus)getRegistrationStatusXREG("CREG"); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #define SRC_TINYGSMCOMMON_H_ | ||||
|  | ||||
| // The current library version number | ||||
| #define TINYGSM_VERSION "0.10.1" | ||||
| #define TINYGSM_VERSION "0.10.2" | ||||
|  | ||||
| #if defined(SPARK) || defined(PARTICLE) | ||||
| #include "Particle.h" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user