Skip to content

Commit 2ed9788

Browse files
committed
- cleanup and checks for connection member when required
1 parent 94a7937 commit 2ed9788

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/ArduinoIoTCloud.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
7777
if (_bearSslClient) {
7878
delete _bearSslClient;
7979
}
80-
_bearSslClient = new BearSSLClient(connection->getClient());
80+
if(connection != NULL){
81+
_bearSslClient = new BearSSLClient(connection->getClient());
82+
}else{
83+
_bearSslClient = new BearSSLClient(net);
84+
}
85+
8186
_bearSslClient->setEccSlot(keySlot, ECCX08Cert.bytes(), ECCX08Cert.length());
8287
_mqttClient = new MqttClient(*_bearSslClient);
8388

src/ConnectionManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ConnectionManager {
4444
// ms to wait between each retry
4545
#define NETWORK_LAYER_RECONNECTION_TIMEOUT 2000
4646

47+
// TODO: remove references to ArduinoIoTCloud
4748
// ********** CLOUD LAYER ***********
4849
// max arduino cloud connection retries
4950
#define ARDUINO_IOT_CLOUD_CONNECTION_RETRIES 30
@@ -82,6 +83,7 @@ class ConnectionManager {
8283
#define NETWORK_CONNECTED GSM3_NetworkStatus_t::GPRS_READY
8384
#endif
8485

86+
// TODO: remove references to ArduinoIoTCloud
8587
#include <ArduinoIoTCloud.h>
8688

8789
inline void debugMessage(char *_msg, uint8_t _debugLevel) {

src/WiFiConnectionManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ class WiFiConnectionManager : public ConnectionManager {
99
virtual void init();
1010
virtual void check();
1111
virtual Client &getClient() { return wifiClient; };
12+
// TODO: remove references to ArduinoIoTCloud
1213
virtual ArduinoIoTConnectionStatus status() { return IOT_STATUS_IDLE; };
1314

1415
private:
16+
// TODO: remove references to ArduinoIoTCloud
1517
void iotConnectionCheck();
1618
void changeConnectionState(NetworkConnectionState _newState);
1719

0 commit comments

Comments
 (0)