Skip to content

Commit 3e64a27

Browse files
committed
Since TimeService is now a member variable available via ArduinoIoTCloud base class adjust the usage within ArduinoIoTCloudTCP
1 parent 9121759 commit 3e64a27

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

src/ArduinoIoTCloud.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ArduinoIoTCloudClass
9393

9494
inline ConnectionHandler * getConnection() { return _connection; }
9595

96-
inline unsigned long getTime() { return _time_service.getTime(); }
96+
inline unsigned long getInternalTime() { return _time_service.getTime(); }
9797

9898
void addCallback(ArduinoIoTCloudEvent const event, OnCloudEventCallback callback);
9999

src/ArduinoIoTCloudTCP.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#ifdef HAS_TCP
2525
#include <ArduinoIoTCloudTCP.h>
26-
#include "utility/time/TimeService.h"
2726
#ifdef BOARD_HAS_ECCX08
2827
#include "tls/BearSSLTrustAnchors.h"
2928
#include "tls/utility/CryptoUtil.h"
@@ -40,8 +39,6 @@
4039
GLOBAL VARIABLES
4140
******************************************************************************/
4241

43-
TimeService time_service;
44-
4542
#if OTA_STORAGE_SSU
4643
static OTAStorage_SSU ota_storage_ssu;
4744
#elif OTA_STORAGE_SFU
@@ -62,7 +59,7 @@ static const int TIMEOUT_FOR_LASTVALUES_SYNC = 10000;
6259

6360
extern "C" unsigned long getTime()
6461
{
65-
return time_service.getTime();
62+
return ArduinoCloud.getInternalTime();
6663
}
6764

6865
/******************************************************************************
@@ -106,7 +103,7 @@ int ArduinoIoTCloudTCP::begin(ConnectionHandler & connection, String brokerAddre
106103
_connection = &connection;
107104
_brokerAddress = brokerAddress;
108105
_brokerPort = brokerPort;
109-
time_service.begin(&connection);
106+
_time_service.begin(&connection);
110107
return begin(_brokerAddress, _brokerPort);
111108
}
112109

@@ -223,7 +220,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectPhy()
223220

224221
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime()
225222
{
226-
unsigned long const internal_posix_time = time_service.getTime();
223+
unsigned long const internal_posix_time = _time_service.getTime();
227224
DBG_VERBOSE("ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d", __FUNCTION__, internal_posix_time);
228225
return State::ConnectMqttBroker;
229226
}

src/ArduinoIoTCloudTCP.h

-8
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
8484
void setOTAStorage(OTAStorage & ota_storage);
8585
#endif /* OTA_ENABLED */
8686

87-
// Clean up existing Mqtt connection, create a new one and initialize it
88-
int reconnect();
89-
90-
protected:
91-
92-
virtual int connect () override { }
93-
virtual void disconnect () override { }
94-
9587

9688
private:
9789
static const int MQTT_TRANSMIT_BUFFER_SIZE = 256;

0 commit comments

Comments
 (0)