mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
Fix all Wextra warnings
This commit is contained in:
@@ -142,16 +142,29 @@ public:
|
||||
|
||||
bool init(const char* pin = NULL) {
|
||||
DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION);
|
||||
|
||||
if (!testAT()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sendAT(GF("E0")); // Echo Off
|
||||
if (waitResponse() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DBG(GF("### Modem:"), getModemName());
|
||||
getSimStatus();
|
||||
return true;
|
||||
|
||||
int 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) {
|
||||
simUnlock(pin);
|
||||
return (getSimStatus() == SIM_READY);
|
||||
}
|
||||
// if the sim is ready, or it's locked but no pin has been provided, return
|
||||
// true
|
||||
else {
|
||||
return (ret == SIM_READY || ret == SIM_LOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
String getModemName() {
|
||||
@@ -640,17 +653,20 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
|
||||
protected:
|
||||
|
||||
bool modemConnect(const char* host, uint16_t port, uint8_t mux,
|
||||
bool ssl = false, int timeout_s = 75) {
|
||||
bool ssl = false, int timeout_s = 15) {
|
||||
// Make sure we'll be getting data manually on this connection
|
||||
sendAT(GF("+CIPRXGET=1"));
|
||||
if (waitResponse() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ssl) DBG("SSL not yet supported on this module!");
|
||||
|
||||
// Establish a connection in multi-socket mode
|
||||
uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000;
|
||||
sendAT(GF("+CIPOPEN="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
|
||||
// The reply is +CIPOPEN: ## of socket created
|
||||
if (waitResponse(15000L, GF(GSM_NL "+CIPOPEN:")) != 1) {
|
||||
if (waitResponse(timeout_ms, GF(GSM_NL "+CIPOPEN:")) != 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user