Skip to content

Commit c999f7a

Browse files
aentingermattiabertorello
authored andcommitted
Return type of begin method changed back to 'int' from 'bool' in order to stay compatible with core libraries
1 parent a5287da commit c999f7a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/ArduinoIoTCloud.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ ArduinoIoTCloudClass::~ArduinoIoTCloudClass()
2222
}
2323
}
2424

25-
bool ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
25+
int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
2626
{
2727
// store the broker address as class member
2828
_brokerAddress = brokerAddress;
2929

3030
byte thingIdBytes[72];
3131

3232
if (!ECCX08.begin()) {
33-
return false;
33+
return 0;
3434
}
3535

3636
if (!ECCX08.readSlot(thingIdSlot, thingIdBytes, sizeof(thingIdBytes))) {
37-
return false;
37+
return 0;
3838
}
3939
_id = (char*)thingIdBytes;
4040

4141
if (!ECCX08Cert.beginReconstruction(keySlot, compressedCertSlot, serialNumberAndAuthorityKeyIdentifierSlot)) {
42-
return false;
42+
return 0;
4343
}
4444

4545
ECCX08Cert.setSubjectCommonName(_id);
@@ -49,7 +49,7 @@ bool ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
4949
ECCX08Cert.setIssuerCommonName("Arduino");
5050

5151
if (!ECCX08Cert.endReconstruction()) {
52-
return false;
52+
return 0;
5353
}
5454

5555
if (_bearSslClient) {
@@ -63,7 +63,7 @@ bool ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
6363

6464
Thing.begin();
6565

66-
return true;
66+
return 1;
6767
}
6868

6969
// private class method used to initialize mqttClient class member. (called in the begin class method)

src/ArduinoIoTCloud.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ArduinoIoTCloudClass {
2020
ArduinoIoTCloudClass();
2121
~ArduinoIoTCloudClass();
2222

23-
bool begin(Client& net, String brokerAddress = "mqtts-sa.iot.arduino.cc");
23+
int begin(Client& net, String brokerAddress = "mqtts-sa.iot.arduino.cc");
2424

2525
// Class constant declaration
2626
static const int MQTT_BUFFER_SIZE = 256;

0 commit comments

Comments
 (0)