@@ -282,11 +282,15 @@ void ArduinoIoTCloudClass::handleMessage(int length)
282
282
}
283
283
284
284
void ArduinoIoTCloudClass::connectionCheck () {
285
- if (connection != NULL ) {
285
+ if (connection != NULL ){
286
286
connection->check ();
287
+
287
288
if (connection->getStatus () != CONNECTION_STATE_CONNECTED) {
288
- if (iotStatus == IOT_STATUS_CLOUD_CONNECTED)
289
- setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING);
289
+ if (iotStatus == IOT_STATUS_CLOUD_CONNECTED){
290
+ setIoTConnectionState (IOT_STATUS_CLOUD_DISCONNECTED);
291
+ }else {
292
+ // setIoTConnectionState(IOT_STATUS_CLOUD_CONNECTING);
293
+ }
290
294
return ;
291
295
}
292
296
}
@@ -295,7 +299,7 @@ void ArduinoIoTCloudClass::connectionCheck() {
295
299
296
300
297
301
switch (iotStatus) {
298
- case IOT_STATUS_CLOUD_IDLE :
302
+ case IOT_STATUS_IDLE :
299
303
{
300
304
int connectionAttempt;
301
305
if (connection == NULL ){
@@ -310,15 +314,17 @@ void ArduinoIoTCloudClass::connectionCheck() {
310
314
}
311
315
setIoTConnectionState (IOT_STATUS_CLOUD_CONNECTING);
312
316
break ;
313
- }
317
+ }
318
+
314
319
case IOT_STATUS_CLOUD_ERROR:
315
320
debugMessage (" Cloud Error. Retrying..." , 0 );
316
321
setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING);
317
322
break ;
318
323
case IOT_STATUS_CLOUD_CONNECTED:
319
324
debugMessage (" ." , 4 , false , true );
320
- if (!_mqttClient->connected ())
321
- setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING);
325
+ break ;
326
+ case IOT_STATUS_CLOUD_DISCONNECTED:
327
+ setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING);
322
328
break ;
323
329
case IOT_STATUS_CLOUD_RECONNECTING:
324
330
int arduinoIoTReconnectionAttempt;
0 commit comments