diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 71c0cef9d..645f35f96 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -72,6 +72,7 @@ jobs: - name: ArduinoGraphics - name: Arduino_GigaDisplayTouch - name: emWin + - name: Arduino_DebugUtils additional-sketch-paths: | - libraries/PDM - libraries/doom @@ -177,6 +178,7 @@ jobs: fqbn: arduino:mbed:edge_control additional-libraries: | - name: MicroNMEA + - name: Arduino_DebugUtils additional-sketch-paths: | - libraries/GSM - libraries/USBHID diff --git a/libraries/GSM/examples/GSMClient/GSMClient.ino b/libraries/GSM/examples/GSMClient/GSMClient.ino index 14b031b0b..287cac24c 100644 --- a/libraries/GSM/examples/GSMClient/GSMClient.ino +++ b/libraries/GSM/examples/GSMClient/GSMClient.ino @@ -1,6 +1,16 @@ +/* + GSMClient + + This sketch connects to a website (https://example.com) + using the Portenta CAT.M1/NB IoT GNSS Shield. + + */ + #include +#include +#include +#include "arduino_secrets.h" -#include "arduino_secrets.h" char pin[] = SECRET_PIN; char apn[] = SECRET_APN; char username[] = SECRET_USERNAME; @@ -13,19 +23,22 @@ GSMClient client; void setup() { + Serial.begin(9600); + while(!Serial) {} + #if defined(ARDUINO_EDGE_CONTROL) // Power ON MKR2 pinMode(ON_MKR2, OUTPUT); digitalWrite(ON_MKR2, HIGH); #endif - Serial.begin(115200); - while(!Serial) {} - // To enable AT Trace debug uncomment the following lines //GSM.trace(Serial); //GSM.setTraceLevel(4); + Debug.setDebugOutputStream(&Serial); + Debug.setDebugLevel(4); + Serial.println("Starting Carrier Network registration"); if(!GSM.begin(pin, apn, username, pass, CATNB, BAND_20 | BAND_19)){ Serial.println("The board was not able to register to the network..."); diff --git a/libraries/GSM/examples/GSMSSLClient/GSMSSLClient.ino b/libraries/GSM/examples/GSMSSLClient/GSMSSLClient.ino index 0aa85f669..721b8ea12 100644 --- a/libraries/GSM/examples/GSMSSLClient/GSMSSLClient.ino +++ b/libraries/GSM/examples/GSMSSLClient/GSMSSLClient.ino @@ -1,5 +1,5 @@ /* - GSMSSLlient + GSMSSLClient This sketch connects to a website (https://example.com) using the Portenta CAT.M1/NB IoT GNSS Shield and TLS. @@ -7,6 +7,8 @@ */ #include +#include +#include #include "arduino_secrets.h" #if defined(ARDUINO_EDGE_CONTROL) @@ -25,6 +27,9 @@ GSMSSLClient client; void setup() { + Serial.begin(9600); + while(!Serial) {} + #if defined(ARDUINO_EDGE_CONTROL) // Power ON MKR2 pinMode(ON_MKR2, OUTPUT); @@ -34,13 +39,14 @@ void setup() { client.appendCustomCACert(root_ca); #endif - Serial.begin(115200); - while(!Serial) {} - // To enable AT Trace debug uncomment the following lines //GSM.trace(Serial); //GSM.setTraceLevel(4); + // Enable GSM library debug + Debug.setDebugOutputStream(&Serial); + Debug.setDebugLevel(4); + Serial.println("Starting Carrier Network registration"); if(!GSM.begin(pin, apn, username, pass, CATM1, BAND_3 | BAND_20 | BAND_19)){ Serial.println("The board was not able to register to the network..."); diff --git a/libraries/GSM/examples/GSMSSLClient/root_ca.h b/libraries/GSM/examples/GSMSSLClient/root_ca.h index c314f4cc2..581338be2 100644 --- a/libraries/GSM/examples/GSMSSLClient/root_ca.h +++ b/libraries/GSM/examples/GSMSSLClient/root_ca.h @@ -1,23 +1,29 @@ static const char root_ca[] = "-----BEGIN CERTIFICATE-----\n" -"MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh\n" +"MIIEyDCCA7CgAwIBAgIQDPW9BitWAvR6uFAsI8zwZjANBgkqhkiG9w0BAQsFADBh\n" "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" -"d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD\n" -"QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAY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H\n" +"Mi5jcnQwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQuY29t\n" +"L0RpZ2lDZXJ0R2xvYmFsUm9vdEcyLmNybDA9BgNVHSAENjA0MAsGCWCGSAGG/WwC\n" +"ATAHBgVngQwBATAIBgZngQwBAgEwCAYGZ4EMAQICMAgGBmeBDAECAzANBgkqhkiG\n" +"9w0BAQsFAAOCAQEAkPFwyyiXaZd8dP3A+iZ7U6utzWX9upwGnIrXWkOH7U1MVl+t\n" +"wcW1BSAuWdH/SvWgKtiwla3JLko716f2b4gp/DA/JIS7w7d7kwcsr4drdjPtAFVS\n" +"slme5LnQ89/nD/7d+MS5EHKBCQRfz5eeLjJ1js+aWNJXMX43AYGyZm0pGrFmCW3R\n" +"bpD0ufovARTFXFZkAdl9h6g4U5+LXUZtXMYnhIHUfoyMo5tS58aI7Dd8KvvwVVo4\n" +"chDYABPPTHPbqjc1qCmBaZx2vN4Ye5DUys/vZwP9BFohFrH/6j/f3IL16/RZkiMN\n" +"JCqVJUzKoZHm1Lesh3Sz8W2jmdv51b2EQJ8HmA==\n" "-----END CERTIFICATE-----\n"; diff --git a/libraries/GSM/src/GSM.cpp b/libraries/GSM/src/GSM.cpp index f45d7b35c..cf5f5b975 100644 --- a/libraries/GSM/src/GSM.cpp +++ b/libraries/GSM/src/GSM.cpp @@ -50,7 +50,9 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern reset(); } - _context = mbed::CellularContext::get_default_instance(); + if (!_context) { + _context = mbed::CellularContext::get_default_instance(); + } if (_context == nullptr) { DEBUG_ERROR("Invalid mbed::CellularContext"); @@ -117,7 +119,10 @@ void arduino::GSMClass::end() { } int arduino::GSMClass::disconnect() { - return _context->disconnect(); + if (_context) { + return _context->disconnect(); + } + return 0; } unsigned long arduino::GSMClass::getTime() @@ -144,9 +149,12 @@ bool arduino::GSMClass::isConnected() } } - - NetworkInterface* arduino::GSMClass::getNetwork() { + /* Can happen this is called before GSM.begin( .. ) when configuring GSMSSLClient + * from sketch calling client.appendCustomCACert( .. ) */ + if (!_context) { + _context = mbed::CellularContext::get_default_instance(); + } return _context; } diff --git a/libraries/GSM/src/GSMClient.cpp b/libraries/GSM/src/GSMClient.cpp deleted file mode 100644 index 2db67df7d..000000000 --- a/libraries/GSM/src/GSMClient.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - GSMClient.cpp - Copyright (c) 2023 Arduino SA. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "GSMClient.h" - -arduino::GSMClient::GSMClient(): AClient(100) { - -} diff --git a/libraries/GSM/src/GSMClient.h b/libraries/GSM/src/GSMClient.h index 52c794a75..f29292fb9 100644 --- a/libraries/GSM/src/GSMClient.h +++ b/libraries/GSM/src/GSMClient.h @@ -26,10 +26,6 @@ namespace arduino { class GSMClient : public AClient { -public: - GSMClient(); - -private: NetworkInterface *getNetwork() { return GSM.getNetwork(); } diff --git a/libraries/GSM/src/GSMSSLClient.cpp b/libraries/GSM/src/GSMSSLClient.cpp deleted file mode 100644 index 0070f210e..000000000 --- a/libraries/GSM/src/GSMSSLClient.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - GSMSSLClient.cpp - Copyright (c) 2023 Arduino SA. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "GSMSSLClient.h" - -arduino::GSMSSLClient::GSMSSLClient(): ASslClient(100) { - -} diff --git a/libraries/GSM/src/GSMSSLClient.h b/libraries/GSM/src/GSMSSLClient.h index ab07d1f79..cc7d3c194 100644 --- a/libraries/GSM/src/GSMSSLClient.h +++ b/libraries/GSM/src/GSMSSLClient.h @@ -28,9 +28,6 @@ extern const char CA_CERTIFICATES[]; namespace arduino { class GSMSSLClient : public arduino::ASslClient { -public: - GSMSSLClient(); - private: NetworkInterface *getNetwork() { return GSM.getNetwork(); diff --git a/libraries/SocketWrapper/src/AClient.cpp b/libraries/SocketWrapper/src/AClient.cpp index 013868d7c..272b18946 100644 --- a/libraries/SocketWrapper/src/AClient.cpp +++ b/libraries/SocketWrapper/src/AClient.cpp @@ -2,10 +2,6 @@ #include "AClient.h" #include "MbedSSLClient.h" -AClient::AClient(unsigned long timeout) { - setSocketTimeout(timeout); -} - void arduino::AClient::newMbedClient() { client.reset(new MbedClient()); client->setNetwork(getNetwork()); diff --git a/libraries/SocketWrapper/src/AClient.h b/libraries/SocketWrapper/src/AClient.h index c93bea0f3..195f7a1f2 100644 --- a/libraries/SocketWrapper/src/AClient.h +++ b/libraries/SocketWrapper/src/AClient.h @@ -28,7 +28,6 @@ class AClient : public Client { public: AClient() {} - AClient(unsigned long timeout); virtual int connect(IPAddress ip, uint16_t port); virtual int connect(const char *host, uint16_t port); @@ -71,7 +70,6 @@ class ASslClient : public AClient { public: ASslClient() {} - ASslClient(unsigned long timeout) : AClient(timeout) {} void disableSNI(bool statusSNI); diff --git a/libraries/SocketWrapper/src/MbedSSLClient.cpp b/libraries/SocketWrapper/src/MbedSSLClient.cpp index 3233c8dba..e0aa1d2dd 100644 --- a/libraries/SocketWrapper/src/MbedSSLClient.cpp +++ b/libraries/SocketWrapper/src/MbedSSLClient.cpp @@ -1,9 +1,5 @@ #include "MbedSSLClient.h" -arduino::MbedSSLClient::MbedSSLClient(unsigned long timeout): MbedClient(timeout), _disableSNI{false} { - onBeforeConnect(mbed::callback(this, &MbedSSLClient::setRootCA)); -} - arduino::MbedSSLClient::MbedSSLClient(): _disableSNI{false} { onBeforeConnect(mbed::callback(this, &MbedSSLClient::setRootCA)); }; diff --git a/libraries/SocketWrapper/src/MbedSSLClient.h b/libraries/SocketWrapper/src/MbedSSLClient.h index ddedcb563..34f4d583d 100644 --- a/libraries/SocketWrapper/src/MbedSSLClient.h +++ b/libraries/SocketWrapper/src/MbedSSLClient.h @@ -33,8 +33,6 @@ class MbedSSLClient : public arduino::MbedClient { public: MbedSSLClient(); - MbedSSLClient(unsigned long timeout); - virtual ~MbedSSLClient() { stop(); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy