Skip to content

Commit a5287da

Browse files
aentingermattiabertorello
authored andcommitted
Adding attribute 'deprecated' to poll function and changing back return type of connect function from bool to int after an internal discussion in order to keep consistency with other core libraries
1 parent 0dfcfb0 commit a5287da

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/ArduinoIoTCloud.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ void ArduinoIoTCloudClass::mqttClientBegin(Client& net)
8383
_mqttClient.setOptions(mqttOpt.keepAlive, mqttOpt.cleanSession, mqttOpt.timeout);
8484
}
8585

86-
bool ArduinoIoTCloudClass::connect()
86+
int ArduinoIoTCloudClass::connect()
8787
{
8888
// Username: device id
8989
// Password: empty
9090
if (!_mqttClient.connect(_id.c_str())) {
91-
return false;
91+
return 0;
9292
}
9393
_mqttClient.subscribe(_stdinTopic);
9494
_mqttClient.subscribe(_dataTopicIn);
9595

96-
return true;
96+
return 1;
9797
}
9898

9999
bool ArduinoIoTCloudClass::disconnect()
@@ -169,7 +169,7 @@ int ArduinoIoTCloudClass::reconnect(Client& net)
169169
}
170170
_bearSslClient = new BearSSLClient(net);
171171
_bearSslClient->setEccSlot(keySlot, ECCX08Cert.bytes(), ECCX08Cert.length());
172-
172+
173173
// Initialize again the MQTTClient, otherwise it would not be able to receive messages through its callback
174174
mqttClientBegin(*_bearSslClient);
175175
// Connect to the broker

src/ArduinoIoTCloud.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class ArduinoIoTCloudClass {
2828
static const int RECONNECTION_TIMEOUT = 2000;
2929
const mqttConnectionOptions mqttOpt = {30, false, 1500};
3030

31-
bool connect();
31+
int connect ();
3232
bool disconnect();
3333

34-
void poll(); /* Attention: Function is deprecated - use 'update' instead */
34+
void poll() __attribute__((deprecated)); /* Attention: Function is deprecated - use 'update' instead */
3535
void update();
3636

3737
// defined for users who want to specify max reconnections reties and timeout between them

0 commit comments

Comments
 (0)