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