From 917fe002b514dbc4089ef9edb88cf6b1d362e386 Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Wed, 11 Dec 2024 13:43:43 +0800 Subject: [PATCH] Update SIM7670G method --- src/TinyGsmClientA76xx.h | 1 - src/TinyGsmClientSIM7672.h | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/TinyGsmClientA76xx.h b/src/TinyGsmClientA76xx.h index 9a560927..2711bd11 100644 --- a/src/TinyGsmClientA76xx.h +++ b/src/TinyGsmClientA76xx.h @@ -257,7 +257,6 @@ class TinyGsmA76xx : public TinyGsmModem>, } bool getNetworkActive() { - // return thisModem().getNetworkActiveImpl(); thisModem().sendAT(GF("+NETOPEN?")); int res = thisModem().waitResponse(GF("+NETOPEN: 1")); if (res == 1) { return true; } diff --git a/src/TinyGsmClientSIM7672.h b/src/TinyGsmClientSIM7672.h index 281f37bd..0b21cfee 100644 --- a/src/TinyGsmClientSIM7672.h +++ b/src/TinyGsmClientSIM7672.h @@ -299,7 +299,7 @@ class TinyGsmSim7672 : public TinyGsmModem, return res; } - bool enableNetwork(){ + bool setNetworkActive(){ sendAT(GF("+NETOPEN")); int res = waitResponse(GF("+NETOPEN: 0"),GF("+IP ERROR: Network is already opened")); if (res != 1 && res != 2){ @@ -308,18 +308,25 @@ class TinyGsmSim7672 : public TinyGsmModem, return true; } - bool disableNetwork(){ + bool setNetworkDeactivate(){ sendAT(GF("+NETCLOSE")); if (waitResponse() != 1){ return false; } int res = waitResponse(GF("+NETCLOSE: 0"),GF("+NETCLOSE: 2")); - if (res != 1 || res != 2){ + if (res != 1 && res != 2){ return false; } return true; } + bool getNetworkActive() { + sendAT(GF("+NETOPEN?")); + int res = waitResponse(GF("+NETOPEN: 1")); + if (res == 1) { return true; } + return false; + } + /* * Return code: * -1 ping failed