mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-01-31 11:16:26 +00:00
Make regstatus enum names unique
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,3 +49,4 @@ platformio_extra_envs.ini
|
||||
*.tar.gz
|
||||
pioScripts/generate_compile_commands.py
|
||||
compile_commands.json
|
||||
src/TinyGsmATDefines.h
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum A6RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -194,13 +194,13 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
A6RegStatus getRegistrationStatus() {
|
||||
return (A6RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
A6RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum BG96RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -233,22 +233,22 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
BG96RegStatus getRegistrationStatus() {
|
||||
// Check first for EPS registration
|
||||
RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG");
|
||||
BG96RegStatus epsStatus = (BG96RegStatus)getRegistrationStatusXREG("CEREG");
|
||||
|
||||
// If we're connected on EPS, great!
|
||||
if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) {
|
||||
return epsStatus;
|
||||
} else {
|
||||
// Otherwise, check generic network status
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
return (BG96RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
BG96RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static uint8_t TINY_GSM_TCP_KEEP_ALIVE = 120;
|
||||
// 3 : ESP8266 station created a TCP or UDP transmission
|
||||
// 4 : the TCP or UDP transmission of ESP8266 station disconnected
|
||||
// 5 : ESP8266 station did NOT connect to an AP
|
||||
enum RegStatus {
|
||||
enum ESP8266RegStatus {
|
||||
REG_UNINITIALIZED = 0,
|
||||
REG_UNREGISTERED = 1,
|
||||
REG_OK_IP = 2,
|
||||
@@ -225,7 +225,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
ESP8266RegStatus getRegistrationStatus() {
|
||||
sendAT(GF("+CIPSTATUS"));
|
||||
if (waitResponse(3000, GF("STATUS:")) != 1) return REG_UNKNOWN;
|
||||
// after "STATUS:" it should return the status number (0,1,2,3,4,5),
|
||||
@@ -236,7 +236,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
if (waitResponse(3000L, res) != 1) { return REG_UNKNOWN; }
|
||||
res.trim();
|
||||
int8_t status = res.toInt();
|
||||
return (RegStatus)status;
|
||||
return (ESP8266RegStatus)status;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -262,7 +262,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
}
|
||||
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
ESP8266RegStatus s = getRegistrationStatus();
|
||||
if (s == REG_OK_IP || s == REG_OK_TCP) {
|
||||
// with these, we're definitely connected
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum M590RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 3,
|
||||
@@ -194,13 +194,13 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
M590RegStatus getRegistrationStatus() {
|
||||
return (M590RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
M590RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "TinyGsmTemperature.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum M95RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -230,13 +230,13 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
M95RegStatus getRegistrationStatus() {
|
||||
return (M95RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
M95RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum MC60RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -225,13 +225,13 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
MC60RegStatus getRegistrationStatus() {
|
||||
return (MC60RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
MC60RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum SIM5360RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -250,13 +250,13 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CGREG");
|
||||
SIM5360RegStatus getRegistrationStatus() {
|
||||
return (SIM5360RegStatus)getRegistrationStatusXREG("CGREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
SIM5360RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "TinyGsmNTP.tpp"
|
||||
#include "TinyGsmGSMLocation.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum SIM70xxRegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -143,22 +143,22 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
RegStatus epsStatus =
|
||||
(RegStatus)thisModem().getRegistrationStatusXREG("CEREG");
|
||||
SIM70xxRegStatus getRegistrationStatus() {
|
||||
SIM70xxRegStatus epsStatus =
|
||||
(SIM70xxRegStatus)thisModem().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)thisModem().getRegistrationStatusXREG("CGREG");
|
||||
return (SIM70xxRegStatus)thisModem().getRegistrationStatusXREG("CGREG");
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
SIM70xxRegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "TinyGsmNTP.tpp"
|
||||
|
||||
|
||||
enum RegStatus {
|
||||
enum SIM7600RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -255,13 +255,13 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CGREG");
|
||||
SIM7600RegStatus getRegistrationStatus() {
|
||||
return (SIM7600RegStatus)getRegistrationStatusXREG("CGREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
SIM7600RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "TinyGsmTime.tpp"
|
||||
#include "TinyGsmNTP.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum SIM800RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -286,13 +286,13 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
SIM800RegStatus getRegistrationStatus() {
|
||||
return (SIM800RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
SIM800RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "TinyGsmTemperature.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum SaraR4RegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -316,22 +316,23 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
SaraR4RegStatus getRegistrationStatus() {
|
||||
// Check first for EPS registration
|
||||
RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG");
|
||||
SaraR4RegStatus epsStatus =
|
||||
(SaraR4RegStatus)getRegistrationStatusXREG("CEREG");
|
||||
|
||||
// If we're connected on EPS, great!
|
||||
if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) {
|
||||
return epsStatus;
|
||||
} else {
|
||||
// Otherwise, check generic network status
|
||||
return (RegStatus)getRegistrationStatusXREG("CREG");
|
||||
return (SaraR4RegStatus)getRegistrationStatusXREG("CREG");
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
SaraR4RegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "TinyGsmTemperature.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum MonarchRegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -319,13 +319,13 @@ class TinyGsmSequansMonarch
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CEREG");
|
||||
MonarchRegStatus getRegistrationStatus() {
|
||||
return (MonarchRegStatus)getRegistrationStatusXREG("CEREG");
|
||||
}
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
MonarchRegStatus s = getRegistrationStatus();
|
||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||
}
|
||||
String getLocalIPImpl() {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "TinyGsmTCP.tpp"
|
||||
#include "TinyGsmTime.tpp"
|
||||
|
||||
enum RegStatus {
|
||||
enum UBLOXRegStatus {
|
||||
REG_NO_RESULT = -1,
|
||||
REG_UNREGISTERED = 0,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -263,8 +263,8 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
return (RegStatus)getRegistrationStatusXREG("CGREG");
|
||||
UBLOXRegStatus getRegistrationStatus() {
|
||||
return (UBLOXRegStatus)getRegistrationStatusXREG("CGREG");
|
||||
}
|
||||
|
||||
bool setRadioAccessTecnology(int selected, int preferred) {
|
||||
@@ -292,7 +292,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
|
||||
protected:
|
||||
bool isNetworkConnectedImpl() {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
UBLOXRegStatus s = getRegistrationStatus();
|
||||
if (s == REG_OK_HOME || s == REG_OK_ROAMING)
|
||||
return true;
|
||||
else if (s == REG_UNKNOWN) // for some reason, it can hang at unknown..
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
exitCommand(); \
|
||||
}
|
||||
|
||||
enum RegStatus {
|
||||
enum XBeeRegStatus {
|
||||
REG_OK = 0,
|
||||
REG_UNREGISTERED = 1,
|
||||
REG_SEARCHING = 2,
|
||||
@@ -611,7 +611,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
* Generic network functions
|
||||
*/
|
||||
public:
|
||||
RegStatus getRegistrationStatus() {
|
||||
XBeeRegStatus getRegistrationStatus() {
|
||||
XBEE_COMMAND_START_DECORATOR(5, REG_UNKNOWN)
|
||||
|
||||
if (!inCommandMode) return REG_UNKNOWN; // Return immediately
|
||||
@@ -620,8 +620,8 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
getSeries(); // Need to know the bee type to interpret response
|
||||
|
||||
sendAT(GF("AI"));
|
||||
int16_t intRes = readResponseInt(10000L);
|
||||
RegStatus stat = REG_UNKNOWN;
|
||||
int16_t intRes = readResponseInt(10000L);
|
||||
XBeeRegStatus stat = REG_UNKNOWN;
|
||||
|
||||
switch (beeType) {
|
||||
case XBEE_S6B_WIFI: {
|
||||
@@ -731,7 +731,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
|
||||
bool isNetworkConnectedImpl() {
|
||||
// first check for association indicator
|
||||
RegStatus s = getRegistrationStatus();
|
||||
XBeeRegStatus s = getRegistrationStatus();
|
||||
if (s == REG_OK) {
|
||||
if (beeType == XBEE_S6B_WIFI) {
|
||||
// For wifi bees, if the association indicator is ok, check that a both
|
||||
@@ -1263,7 +1263,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
switch (beeType) {
|
||||
// The wifi be can only say if it's connected to the netowrk
|
||||
case XBEE_S6B_WIFI: {
|
||||
RegStatus s = getRegistrationStatus();
|
||||
XBeeRegStatus s = getRegistrationStatus();
|
||||
XBEE_COMMAND_END_DECORATOR
|
||||
if (s != REG_OK) {
|
||||
sockets[0]->sock_connected = false; // no multiplex
|
||||
|
||||
Reference in New Issue
Block a user