Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not include ArduinoBearSSL if ArduinoIoTCloud is included #13

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ArduinoCellular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ void ArduinoCellular::begin() {
modem.sendAT("+CNMI=2,1,0,0,0");
modem.waitResponse();


#if defined(ARDUINO_CELLULAR_BEARSSL)
ArduinoBearSSL.onGetTime(ArduinoCellular::getTime);
#endif

}

Expand Down Expand Up @@ -155,13 +156,15 @@ HttpClient ArduinoCellular::getHTTPClient(const char * server, const int port){
return HttpClient(* new TinyGsmClient(modem), server, port);
}

#if defined(ARDUINO_CELLULAR_BEARSSL)
HttpClient ArduinoCellular::getHTTPSClient(const char * server, const int port){
return HttpClient(* new BearSSLClient(* new TinyGsmClient(modem)), server, port);
}

BearSSLClient ArduinoCellular::getSecureNetworkClient(){
return BearSSLClient(* new TinyGsmClient(modem));
}
#endif

bool ArduinoCellular::isConnectedToOperator(){
return modem.isNetworkConnected();
Expand Down
16 changes: 14 additions & 2 deletions src/ArduinoCellular.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@

#include <Arduino.h>
#include <vector>
#include "ArduinoBearSSLConfig.h"
#include <ArduinoBearSSL.h>

#if defined __has_include
#if !__has_include (<ArduinoIoTCloud.h>)
#define ARDUINO_CELLULAR_BEARSSL
#endif
#endif

#if defined(ARDUINO_CELLULAR_BEARSSL)
#include "ArduinoBearSSLConfig.h"
#include <ArduinoBearSSL.h>
#endif

#include <ModemInterface.h>
#include <TimeUtils.h>

Expand Down Expand Up @@ -206,7 +216,9 @@ class ArduinoCellular {
* @brief Gets the Transport Layer Security (TLS) client. (OSI Layer 4)
* @return The GSM client.
*/
#if defined(ARDUINO_CELLULAR_BEARSSL)
BearSSLClient getSecureNetworkClient();
#endif

/**
* @brief Gets the HTTP client for the specified server and port.
Expand Down
Loading