mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
Replace NULL with nullptr
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -125,7 +125,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientA6"));
|
||||
|
||||
@@ -151,7 +151,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -172,7 +172,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+RST=1"));
|
||||
delay(3000);
|
||||
@@ -218,8 +218,8 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
sendAT(GF("+CGATT=1"));
|
||||
@@ -438,7 +438,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
if (waitResponse(2000L, GF(AT_NL ">")) != 1) { return 0; }
|
||||
stream.write(reinterpret_cast<const uint8_t*>(buff), len);
|
||||
stream.flush();
|
||||
if (waitResponse(10000L, GFP(GSM_OK), GF(AT_NL "FAIL")) != 1) { return 0; }
|
||||
if (waitResponse(10000L, GFP(AT_OK), GF(AT_NL "FAIL")) != 1) { return 0; }
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientBG96"));
|
||||
|
||||
@@ -187,7 +187,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -201,7 +201,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
waitResponse(10000L, GF("APP RDY"));
|
||||
@@ -256,8 +256,8 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Configure the TCPIP Context
|
||||
@@ -392,20 +392,20 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
// 0, it is the type of error.
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = 0;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr) *vsat = 0;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
waitResponse(); // Final OK
|
||||
return true;
|
||||
@@ -463,13 +463,13 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
|
||||
// Set pointers
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = isec;
|
||||
if (timezone != NULL) *timezone = static_cast<float>(itimezone) / 4.0;
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = isec;
|
||||
if (timezone != nullptr) *timezone = static_cast<float>(itimezone) / 4.0;
|
||||
|
||||
// Final OK
|
||||
waitResponse(); // Ends with OK
|
||||
|
||||
@@ -142,7 +142,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientESP8266"));
|
||||
|
||||
@@ -200,7 +200,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+RST"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
|
||||
@@ -114,7 +114,7 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientM590"));
|
||||
|
||||
@@ -134,7 +134,7 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
if (!setPhoneFunctionality(15)) { return false; }
|
||||
// MODEM:STARTUP
|
||||
@@ -218,8 +218,8 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
sendAT(GF("+XISP=0"));
|
||||
|
||||
@@ -153,7 +153,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientM95"));
|
||||
|
||||
@@ -180,7 +180,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -194,7 +194,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=0"));
|
||||
if (waitResponse(10000L, GF("NORMAL POWER DOWN"), GF("OK"), GF("FAIL")) ==
|
||||
@@ -261,8 +261,8 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// select foreground context 0 = VIRTUAL_UART_1
|
||||
|
||||
@@ -152,7 +152,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientMC60"));
|
||||
|
||||
@@ -179,7 +179,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -193,7 +193,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
if (!setPhoneFunctionality(0)) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
@@ -247,8 +247,8 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// select foreground context 0 = VIRTUAL_UART_1
|
||||
|
||||
@@ -153,7 +153,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM5360"));
|
||||
|
||||
@@ -181,7 +181,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -214,7 +214,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+REBOOT"));
|
||||
// Should return an 'OK' after reboot command is sent
|
||||
@@ -297,8 +297,8 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect(); // Make sure we're not connected first
|
||||
|
||||
// Define the PDP context
|
||||
@@ -555,7 +555,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
};
|
||||
buf[0] = stream.read();
|
||||
buf[1] = stream.read();
|
||||
char c = strtol(buf, NULL, 16);
|
||||
char c = strtol(buf, nullptr, 16);
|
||||
#else
|
||||
while (!stream.available() &&
|
||||
(millis() - startMillis < sockets[mux]->_timeout)) {
|
||||
|
||||
@@ -100,7 +100,7 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM7000"));
|
||||
|
||||
@@ -128,7 +128,7 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -162,8 +162,8 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Bearer settings for applications based on IP
|
||||
@@ -342,7 +342,7 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
|
||||
};
|
||||
buf[0] = stream.read();
|
||||
buf[1] = stream.read();
|
||||
char c = strtol(buf, NULL, 16);
|
||||
char c = strtol(buf, nullptr, 16);
|
||||
#else
|
||||
while (!stream.available() &&
|
||||
(millis() - startMillis < sockets[mux]->_timeout)) {
|
||||
|
||||
@@ -127,7 +127,7 @@ class TinyGsmSim7000SSL
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM7000SSL"));
|
||||
|
||||
@@ -155,7 +155,7 @@ class TinyGsmSim7000SSL
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -179,7 +179,7 @@ class TinyGsmSim7000SSL
|
||||
// modemGetAvailable checks all socks, so we only want to do it once
|
||||
// modemGetAvailable calls modemGetConnected(), which also checks allf
|
||||
if (check_socks) { modemGetAvailable(0); }
|
||||
while (stream.available()) { waitResponse(15, NULL, NULL); }
|
||||
while (stream.available()) { waitResponse(15, nullptr, nullptr); }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -215,8 +215,8 @@ class TinyGsmSim7000SSL
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Define the PDP context
|
||||
|
||||
@@ -125,7 +125,7 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM7080"));
|
||||
|
||||
@@ -153,7 +153,7 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -177,7 +177,7 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
// modemGetAvailable checks all socks, so we only want to do it once
|
||||
// modemGetAvailable calls modemGetConnected(), which also checks allf
|
||||
if (check_socks) { modemGetAvailable(0); }
|
||||
while (stream.available()) { waitResponse(15, NULL, NULL); }
|
||||
while (stream.available()) { waitResponse(15, nullptr, nullptr); }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -213,8 +213,8 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Define the PDP context
|
||||
|
||||
@@ -74,7 +74,7 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
return thisModem().initImpl(pin);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
thisModem().sendAT(GF("E0")); // Echo Off
|
||||
thisModem().waitResponse();
|
||||
if (!thisModem().setPhoneFunctionality(0)) { return false; }
|
||||
@@ -240,8 +240,8 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
*/
|
||||
protected:
|
||||
// should implement in sub-classes
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
return thisModem().gprsConnectImpl(apn, user, pwd);
|
||||
}
|
||||
|
||||
@@ -357,20 +357,20 @@ class TinyGsmSim70xx : public TinyGsmModem<TinyGsmSim70xx<modemType>>,
|
||||
thisModem().streamSkipUntil('\n'); // VPA
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = ivsat;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr) *vsat = ivsat;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
thisModem().waitResponse();
|
||||
return true;
|
||||
|
||||
@@ -161,7 +161,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM7600"));
|
||||
|
||||
@@ -189,7 +189,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -222,7 +222,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CRESET"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
@@ -302,8 +302,8 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect(); // Make sure we're not connected first
|
||||
|
||||
// Define the PDP context
|
||||
@@ -509,24 +509,24 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
streamSkipUntil('\n'); // TODO(?) is one more field reported??
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL)
|
||||
if (lat != nullptr)
|
||||
*lat = (floor(ilat / 100) + fmod(ilat, 100.) / 60) *
|
||||
(north == 'N' ? 1 : -1);
|
||||
if (lon != NULL)
|
||||
if (lon != nullptr)
|
||||
*lon = (floor(ilon / 100) + fmod(ilon, 100.) / 60) *
|
||||
(east == 'E' ? 1 : -1);
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = ivsat;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr) *vsat = ivsat;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
waitResponse();
|
||||
return true;
|
||||
@@ -678,7 +678,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
};
|
||||
buf[0] = stream.read();
|
||||
buf[1] = stream.read();
|
||||
char c = strtol(buf, NULL, 16);
|
||||
char c = strtol(buf, nullptr, 16);
|
||||
#else
|
||||
while (!stream.available() &&
|
||||
(millis() - startMillis < sockets[mux]->_timeout)) {
|
||||
|
||||
@@ -153,7 +153,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSIM800"));
|
||||
|
||||
@@ -184,7 +184,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -249,7 +249,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("&W"));
|
||||
waitResponse();
|
||||
@@ -310,8 +310,8 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Bearer settings for applications based on IP
|
||||
@@ -577,7 +577,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
};
|
||||
buf[0] = stream.read();
|
||||
buf[1] = stream.read();
|
||||
char c = strtol(buf, NULL, 16);
|
||||
char c = strtol(buf, nullptr, 16);
|
||||
#else
|
||||
while (!stream.available() &&
|
||||
(millis() - startMillis < sockets[mux]->_timeout)) {
|
||||
|
||||
@@ -108,20 +108,20 @@ class TinyGsmSim808 : public TinyGsmSim800,
|
||||
streamSkipUntil('\n'); // VPA
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = ivsat;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr) *vsat = ivsat;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
waitResponse();
|
||||
return true;
|
||||
|
||||
@@ -102,7 +102,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
sock_connected = at->modemConnect(host, port, &mux, false, timeout_s);
|
||||
if (mux != oldMux) {
|
||||
DBG("WARNING: Mux number changed from", oldMux, "to", mux);
|
||||
at->sockets[oldMux] = NULL;
|
||||
at->sockets[oldMux] = nullptr;
|
||||
}
|
||||
at->sockets[mux] = this;
|
||||
at->maintain();
|
||||
@@ -181,7 +181,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
sock_connected = at->modemConnect(host, port, &mux, true, timeout_s);
|
||||
if (mux != oldMux) {
|
||||
DBG("WARNING: Mux number changed from", oldMux, "to", mux);
|
||||
at->sockets[oldMux] = NULL;
|
||||
at->sockets[oldMux] = nullptr;
|
||||
}
|
||||
at->sockets[mux] = this;
|
||||
at->maintain();
|
||||
@@ -213,7 +213,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSaraR4"));
|
||||
|
||||
@@ -249,7 +249,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -293,7 +293,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
*/
|
||||
protected:
|
||||
// using +CFUN=15 instead of the more common CFUN=1,1
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
if (!setPhoneFunctionality(15)) { return false; }
|
||||
delay(3000); // TODO(?): Verify delay timing here
|
||||
@@ -352,8 +352,8 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
// gprsDisconnect();
|
||||
|
||||
sendAT(GF("+CGATT=1")); // attach to GPRS
|
||||
@@ -545,20 +545,21 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
}
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = 0; // Number of satellites viewed not reported;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr)
|
||||
*vsat = 0; // Number of satellites viewed not reported;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
// final ok
|
||||
waitResponse();
|
||||
|
||||
@@ -187,7 +187,7 @@ class TinyGsmSequansMonarch
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientSequansMonarch"));
|
||||
|
||||
@@ -223,7 +223,7 @@ class TinyGsmSequansMonarch
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -272,14 +272,14 @@ class TinyGsmSequansMonarch
|
||||
modemGetConnected();
|
||||
}
|
||||
}
|
||||
while (stream.available()) { waitResponse(15, NULL, NULL); }
|
||||
while (stream.available()) { waitResponse(15, nullptr, nullptr); }
|
||||
}
|
||||
|
||||
/*
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
|
||||
sendAT(GF("+CFUN=0"));
|
||||
@@ -340,8 +340,8 @@ class TinyGsmSequansMonarch
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
gprsDisconnect();
|
||||
|
||||
// Define the PDP context (This uses context #3!)
|
||||
|
||||
@@ -102,7 +102,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
sock_connected = at->modemConnect(host, port, &mux, false, timeout_s);
|
||||
if (mux != oldMux) {
|
||||
DBG("WARNING: Mux number changed from", oldMux, "to", mux);
|
||||
at->sockets[oldMux] = NULL;
|
||||
at->sockets[oldMux] = nullptr;
|
||||
}
|
||||
at->sockets[mux] = this;
|
||||
at->maintain();
|
||||
@@ -148,7 +148,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
sock_connected = at->modemConnect(host, port, &mux, true, timeout_s);
|
||||
if (mux != oldMux) {
|
||||
DBG("WARNING: Mux number changed from", oldMux, "to", mux);
|
||||
at->sockets[oldMux] = NULL;
|
||||
at->sockets[oldMux] = nullptr;
|
||||
}
|
||||
at->sockets[mux] = this;
|
||||
at->maintain();
|
||||
@@ -169,7 +169,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
* Basic functions
|
||||
*/
|
||||
protected:
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientUBLOX"));
|
||||
|
||||
@@ -195,7 +195,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
|
||||
SimStatus ret = getSimStatus();
|
||||
// if the sim isn't ready and a pin has been provided, try to unlock the sim
|
||||
if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) {
|
||||
if (ret != SIM_READY && pin != nullptr && strlen(pin) > 0) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
} else {
|
||||
@@ -240,7 +240,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
* Power functions
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!testAT()) { return false; }
|
||||
if (!setPhoneFunctionality(16)) { return false; }
|
||||
delay(3000); // TODO(?): Verify delay timing here
|
||||
@@ -315,8 +315,8 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
// gprsDisconnect();
|
||||
|
||||
sendAT(GF("+CGATT=1")); // attach to GPRS
|
||||
@@ -545,20 +545,21 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
}
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (speed != NULL) *speed = ispeed;
|
||||
if (alt != NULL) *alt = ialt;
|
||||
if (vsat != NULL) *vsat = 0; // Number of satellites viewed not reported;
|
||||
if (usat != NULL) *usat = iusat;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (speed != nullptr) *speed = ispeed;
|
||||
if (alt != nullptr) *alt = ialt;
|
||||
if (vsat != nullptr)
|
||||
*vsat = 0; // Number of satellites viewed not reported;
|
||||
if (usat != nullptr) *usat = iusat;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = static_cast<int>(secondWithSS);
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = static_cast<int>(secondWithSS);
|
||||
|
||||
// final ok
|
||||
waitResponse();
|
||||
|
||||
@@ -164,7 +164,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
}
|
||||
|
||||
size_t write(const char* str) {
|
||||
if (str == NULL) return 0;
|
||||
if (str == nullptr) return 0;
|
||||
return write((const uint8_t*)str, strlen(str));
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
* Basic functions
|
||||
*/
|
||||
|
||||
bool initImpl(const char* pin = NULL) {
|
||||
bool initImpl(const char* pin = nullptr) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
DBG(GF("### TinyGSM Compiled Module: TinyGsmClientXBee"));
|
||||
|
||||
@@ -512,7 +512,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
}
|
||||
}
|
||||
|
||||
bool restartImpl(const char* pin = NULL) {
|
||||
bool restartImpl(const char* pin = nullptr) {
|
||||
if (!commandMode()) {
|
||||
DBG("### XBee not in command mode for restart; Exit");
|
||||
return false;
|
||||
@@ -649,7 +649,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
case 0x23: // 0x23 SSID not configured.
|
||||
stat = REG_UNREGISTERED;
|
||||
break;
|
||||
case 0x24: // 0x24 Encryption key invalid (either NULL or invalid
|
||||
case 0x24: // 0x24 Encryption key invalid (either nullptr or invalid
|
||||
// length for WEP).
|
||||
case 0x27: // 0x27 SSID was found, but join failed.
|
||||
stat = REG_DENIED;
|
||||
@@ -813,7 +813,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
|
||||
XBEE_COMMAND_START_DECORATOR(5, false)
|
||||
|
||||
if (ssid == NULL) retVal = false;
|
||||
if (ssid == nullptr) retVal = false;
|
||||
|
||||
changesMade |= changeSettingIfNeeded(GF("ID"), ssid);
|
||||
|
||||
@@ -857,8 +857,8 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
||||
* GPRS functions
|
||||
*/
|
||||
protected:
|
||||
bool gprsConnectImpl(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnectImpl(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
bool success = true;
|
||||
bool changesMade = false;
|
||||
XBEE_COMMAND_START_DECORATOR(5, false)
|
||||
|
||||
@@ -49,8 +49,8 @@ class TinyGsmGPRS {
|
||||
/*
|
||||
* GPRS functions
|
||||
*/
|
||||
bool gprsConnect(const char* apn, const char* user = NULL,
|
||||
const char* pwd = NULL) {
|
||||
bool gprsConnect(const char* apn, const char* user = nullptr,
|
||||
const char* pwd = nullptr) {
|
||||
return thisModem().gprsConnectImpl(apn, user, pwd);
|
||||
}
|
||||
bool gprsDisconnect() {
|
||||
|
||||
@@ -129,16 +129,16 @@ class TinyGsmGSMLocation {
|
||||
isec = thisModem().streamGetIntBefore('\n');
|
||||
|
||||
// Set pointers
|
||||
if (lat != NULL) *lat = ilat;
|
||||
if (lon != NULL) *lon = ilon;
|
||||
if (accuracy != NULL) *accuracy = iaccuracy;
|
||||
if (lat != nullptr) *lat = ilat;
|
||||
if (lon != nullptr) *lon = ilon;
|
||||
if (accuracy != nullptr) *accuracy = iaccuracy;
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = isec;
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = isec;
|
||||
|
||||
// Final OK
|
||||
thisModem().waitResponse();
|
||||
|
||||
@@ -47,10 +47,10 @@ class TinyGsmModem {
|
||||
/*
|
||||
* Basic functions
|
||||
*/
|
||||
bool begin(const char* pin = NULL) {
|
||||
bool begin(const char* pin = nullptr) {
|
||||
return thisModem().initImpl(pin);
|
||||
}
|
||||
bool init(const char* pin = NULL) {
|
||||
bool init(const char* pin = nullptr) {
|
||||
return thisModem().initImpl(pin);
|
||||
}
|
||||
template <typename... Args>
|
||||
@@ -69,25 +69,25 @@ class TinyGsmModem {
|
||||
// Listen for responses to commands and handle URCs
|
||||
int8_t waitResponse(uint32_t timeout_ms, String& data,
|
||||
GsmConstStr r1 = GFP(GSM_OK),
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
|
||||
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
|
||||
GsmConstStr r6 = NULL, GsmConstStr r7 = NULL) {
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = nullptr,
|
||||
GsmConstStr r4 = nullptr, GsmConstStr r5 = nullptr,
|
||||
GsmConstStr r6 = nullptr, GsmConstStr r7 = nullptr) {
|
||||
return thisModem().waitResponseImpl(timeout_ms, data, r1, r2, r3, r4, r5,
|
||||
r6, r7);
|
||||
}
|
||||
|
||||
int8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK),
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
|
||||
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
|
||||
GsmConstStr r6 = NULL, GsmConstStr r7 = NULL) {
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = nullptr,
|
||||
GsmConstStr r4 = nullptr, GsmConstStr r5 = nullptr,
|
||||
GsmConstStr r6 = nullptr, GsmConstStr r7 = nullptr) {
|
||||
String data;
|
||||
return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5, r6, r7);
|
||||
}
|
||||
|
||||
int8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK),
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL,
|
||||
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL,
|
||||
GsmConstStr r6 = NULL, GsmConstStr r7 = NULL) {
|
||||
GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = nullptr,
|
||||
GsmConstStr r4 = nullptr, GsmConstStr r5 = nullptr,
|
||||
GsmConstStr r6 = nullptr, GsmConstStr r7 = nullptr) {
|
||||
return waitResponse(1000L, r1, r2, r3, r4, r5, r6, r7);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ class TinyGsmModem {
|
||||
/*
|
||||
* Power functions
|
||||
*/
|
||||
bool restart(const char* pin = NULL) {
|
||||
bool restart(const char* pin = nullptr) {
|
||||
return thisModem().restartImpl(pin);
|
||||
}
|
||||
bool poweroff() {
|
||||
@@ -179,9 +179,9 @@ class TinyGsmModem {
|
||||
int8_t waitResponseImpl(uint32_t timeout_ms, String& data,
|
||||
GsmConstStr r1 = GFP(GSM_OK),
|
||||
GsmConstStr r2 = GFP(GSM_ERROR),
|
||||
GsmConstStr r3 = NULL, GsmConstStr r4 = NULL,
|
||||
GsmConstStr r5 = NULL, GsmConstStr r6 = NULL,
|
||||
GsmConstStr r7 = NULL) {
|
||||
GsmConstStr r3 = nullptr, GsmConstStr r4 = nullptr,
|
||||
GsmConstStr r5 = nullptr, GsmConstStr r6 = nullptr,
|
||||
GsmConstStr r7 = nullptr) {
|
||||
data.reserve(64);
|
||||
// DBG(GF("r1 <"), r1 ? r1 : GF("NULL"), GF("> r2 <"), r2 ? r2 : GF("NULL"),
|
||||
// GF("> r3 <"), r3 ? r3 : GF("NULL"), GF("> r4 <"), r4 ? r4 :
|
||||
@@ -393,7 +393,7 @@ class TinyGsmModem {
|
||||
|
||||
inline void streamClear() {
|
||||
while (thisModem().stream.available()) {
|
||||
thisModem().waitResponse(50, NULL, NULL);
|
||||
thisModem().waitResponse(50, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class TinyGsmSMS {
|
||||
};
|
||||
buf[0] = instr[i];
|
||||
buf[1] = instr[i + 1];
|
||||
byte b = strtol(buf, NULL, 16);
|
||||
byte b = strtol(buf, nullptr, 16);
|
||||
|
||||
byte bb = b << (7 - bitstate);
|
||||
char c = (bb + reminder) & 0x7F;
|
||||
@@ -79,7 +79,7 @@ class TinyGsmSMS {
|
||||
};
|
||||
buf[0] = instr[i];
|
||||
buf[1] = instr[i + 1];
|
||||
char b = strtol(buf, NULL, 16);
|
||||
char b = strtol(buf, nullptr, 16);
|
||||
result += b;
|
||||
}
|
||||
return result;
|
||||
@@ -93,7 +93,7 @@ class TinyGsmSMS {
|
||||
};
|
||||
buf[0] = instr[i];
|
||||
buf[1] = instr[i + 1];
|
||||
char b = strtol(buf, NULL, 16);
|
||||
char b = strtol(buf, nullptr, 16);
|
||||
if (b) { // If high byte is non-zero, we can't handle it ;(
|
||||
#if defined(TINY_GSM_UNICODE_TO_HEX)
|
||||
result += "\\x";
|
||||
@@ -104,7 +104,7 @@ class TinyGsmSMS {
|
||||
} else {
|
||||
buf[0] = instr[i + 2];
|
||||
buf[1] = instr[i + 3];
|
||||
b = strtol(buf, NULL, 16);
|
||||
b = strtol(buf, nullptr, 16);
|
||||
result += b;
|
||||
}
|
||||
}
|
||||
@@ -173,11 +173,11 @@ class TinyGsmSMS {
|
||||
Print& p;
|
||||
uint8_t prv = 0;
|
||||
void printHex(const uint16_t v) {
|
||||
uint8_t c = v >> 8;
|
||||
if (c < 0x10) p.print('0');
|
||||
uint8_t c = v >> 8;
|
||||
if (c < 0x10) p.print('0');
|
||||
p.print(c, HEX);
|
||||
c = v & 0xFF;
|
||||
if (c < 0x10) p.print('0');
|
||||
c = v & 0xFF;
|
||||
if (c < 0x10) p.print('0');
|
||||
p.print(c, HEX);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ class TinyGsmTCP {
|
||||
}
|
||||
|
||||
size_t write(const char* str) {
|
||||
if (str == NULL) return 0;
|
||||
if (str == nullptr) return 0;
|
||||
return write((const uint8_t*)str, strlen(str));
|
||||
}
|
||||
|
||||
@@ -331,12 +331,12 @@ class TinyGsmTCP {
|
||||
}
|
||||
}
|
||||
while (thisModem().stream.available()) {
|
||||
thisModem().waitResponse(15, NULL, NULL);
|
||||
thisModem().waitResponse(15, nullptr, nullptr);
|
||||
}
|
||||
|
||||
#elif defined TINY_GSM_NO_MODEM_BUFFER || defined TINY_GSM_BUFFER_READ_NO_CHECK
|
||||
// Just listen for any URC's
|
||||
thisModem().waitResponse(100, NULL, NULL);
|
||||
thisModem().waitResponse(100, nullptr, nullptr);
|
||||
|
||||
#else
|
||||
#error Modem client has been incorrectly created
|
||||
|
||||
@@ -89,13 +89,13 @@ class TinyGsmTime {
|
||||
|
||||
// Set pointers
|
||||
if (iyear < 2000) iyear += 2000;
|
||||
if (year != NULL) *year = iyear;
|
||||
if (month != NULL) *month = imonth;
|
||||
if (day != NULL) *day = iday;
|
||||
if (hour != NULL) *hour = ihour;
|
||||
if (minute != NULL) *minute = imin;
|
||||
if (second != NULL) *second = isec;
|
||||
if (timezone != NULL) *timezone = static_cast<float>(itimezone) / 4.0;
|
||||
if (year != nullptr) *year = iyear;
|
||||
if (month != nullptr) *month = imonth;
|
||||
if (day != nullptr) *day = iday;
|
||||
if (hour != nullptr) *hour = ihour;
|
||||
if (minute != nullptr) *minute = imin;
|
||||
if (second != nullptr) *second = isec;
|
||||
if (timezone != nullptr) *timezone = static_cast<float>(itimezone) / 4.0;
|
||||
|
||||
// Final OK
|
||||
thisModem().waitResponse();
|
||||
|
||||
Reference in New Issue
Block a user