From cad69a449dce246ab419bc45eb02967d128ef4d4 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 30 May 2019 13:09:56 -0400 Subject: [PATCH] Listed for UUPSDA on ublox --- src/TinyGsmClientUBLOX.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index 1817700..9e240da 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -399,7 +399,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() // action = 3: activate; it activates a PDP context with the specified profile, // using the current parameters sendAT(GF("+UPSDA=0,3")); // Activate the PDP context associated with profile 0 - if (waitResponse(360000L) != 1) { + if (waitResponse(360000L) != 1) { // Should return ok return false; } @@ -409,11 +409,19 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() // AT+UPSND=, // profile_id = 0: PSD profile identifier, in range 0-6 (NOT PDP context) // param_tag = 8: PSD profile status: if the profile is active the return value is 1, 0 otherwise - sendAT(GF("+UPSND=0,8")); // Activate PSD profile 0 - if (waitResponse(GF(",8,1")) != 1) { + sendAT(GF("+UPSND=0,8")); // Check if PSD profile 0 is now active + int res = waitResponse(GF(",8,1"), GF(",8,0")); + waitResponse(); // Should return another OK + if (res == 1) { + return true; // It's now active + } else if (res == 2) { // If it's not active yet, wait for the +UUPSDA URC + if (waitResponse(180000L, GF("+UUPSDA: 0")) != 1) { // 0=successful + return false; + } + streamSkipUntil('\n'); // Ignore the IP address, if returned + } else { return false; } - waitResponse(); return true; }