@@ -235,7 +235,7 @@ void ArduinoIoTCloudClass::update(int const reconnectionMaxRetries, int const re
235
235
if (timestamp != 0 ) Thing.updateTimestampOnChangedProperties (timestamp);
236
236
237
237
connectionCheck ();
238
- if (iotStatus != IOT_STATUS_CLOUD_CONNECTED ){
238
+ if (iotStatus != ArduinoIoTConnectionStatus::CONNECTED ){
239
239
return ;
240
240
}
241
241
@@ -378,50 +378,50 @@ void ArduinoIoTCloudClass::connectionCheck()
378
378
if (connection != NULL ){
379
379
connection->check ();
380
380
381
- if (connection->getStatus () != CONNECTION_STATE_CONNECTED ) {
382
- if (iotStatus == IOT_STATUS_CLOUD_CONNECTED ){
383
- setIoTConnectionState (IOT_STATUS_CLOUD_DISCONNECTED );
381
+ if (connection->getStatus () != ArduinoIoTConnectionStatus::CONNECTED ) {
382
+ if (iotStatus == ArduinoIoTConnectionStatus::CONNECTED ){
383
+ setIoTConnectionState (ArduinoIoTConnectionStatus::DISCONNECTED );
384
384
}
385
385
return ;
386
386
}
387
387
}
388
388
389
389
switch (iotStatus) {
390
- case IOT_STATUS_CLOUD_IDLE : {
391
- setIoTConnectionState (IOT_STATUS_CLOUD_CONNECTING );
390
+ case ArduinoIoTConnectionStatus::IDLE : {
391
+ setIoTConnectionState (ArduinoIoTConnectionStatus::CONNECTING );
392
392
}
393
393
break ;
394
- case IOT_STATUS_CLOUD_ERROR : {
394
+ case ArduinoIoTConnectionStatus::ERROR : {
395
395
debugMessage (DebugLevel::Error, " Cloud Error. Retrying..." );
396
- setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING );
396
+ setIoTConnectionState (ArduinoIoTConnectionStatus::RECONNECTING );
397
397
}
398
398
break ;
399
- case IOT_STATUS_CLOUD_CONNECTED : {
399
+ case ArduinoIoTConnectionStatus::CONNECTED : {
400
400
debugMessageNoTimestamp (DebugLevel::Verbose, " ." );
401
401
if (!_mqttClient->connected ()){
402
- setIoTConnectionState (IOT_STATUS_CLOUD_DISCONNECTED );
402
+ setIoTConnectionState (ArduinoIoTConnectionStatus::DISCONNECTED );
403
403
}
404
404
}
405
405
break ;
406
- case IOT_STATUS_CLOUD_DISCONNECTED : {
407
- setIoTConnectionState (IOT_STATUS_CLOUD_RECONNECTING );
406
+ case ArduinoIoTConnectionStatus::DISCONNECTED : {
407
+ setIoTConnectionState (ArduinoIoTConnectionStatus::RECONNECTING );
408
408
}
409
409
break ;
410
- case IOT_STATUS_CLOUD_RECONNECTING : {
410
+ case ArduinoIoTConnectionStatus::RECONNECTING : {
411
411
int const ret_code_reconnect = reconnect (*_net);
412
412
debugMessage (DebugLevel::Info, " ArduinoCloud.reconnect(): %d" , ret_code_reconnect);
413
413
if (ret_code_reconnect == CONNECT_SUCCESS) {
414
- setIoTConnectionState (IOT_STATUS_CLOUD_CONNECTED );
414
+ setIoTConnectionState (ArduinoIoTConnectionStatus::CONNECTED );
415
415
CloudSerial.begin (9600 );
416
416
CloudSerial.println (" Hello from Cloud Serial!" );
417
417
}
418
418
}
419
419
break ;
420
- case IOT_STATUS_CLOUD_CONNECTING : {
420
+ case ArduinoIoTConnectionStatus::CONNECTING : {
421
421
int const ret_code_connect = connect ();
422
422
debugMessage (DebugLevel::Verbose, " ArduinoCloud.connect(): %d" , ret_code_connect);
423
423
if (ret_code_connect == CONNECT_SUCCESS) {
424
- setIoTConnectionState (IOT_STATUS_CLOUD_CONNECTED );
424
+ setIoTConnectionState (ArduinoIoTConnectionStatus::CONNECTED );
425
425
CloudSerial.begin (9600 );
426
426
CloudSerial.println (" Hello from Cloud Serial!" );
427
427
}
@@ -436,11 +436,11 @@ void ArduinoIoTCloudClass::connectionCheck()
436
436
void ArduinoIoTCloudClass::setIoTConnectionState (ArduinoIoTConnectionStatus _newState)
437
437
{
438
438
switch (_newState){
439
- case IOT_STATUS_CLOUD_ERROR : debugMessage (DebugLevel::Error, " Arduino, we have a problem." ); break ;
440
- case IOT_STATUS_CLOUD_CONNECTING : debugMessage (DebugLevel::Error, " Connecting to Arduino IoT Cloud..." ); break ;
441
- case IOT_STATUS_CLOUD_RECONNECTING : debugMessage (DebugLevel::Error, " Reconnecting to Arduino IoT Cloud..." ); break ;
442
- case IOT_STATUS_CLOUD_CONNECTED : debugMessage (DebugLevel::Error, " Connected to Arduino IoT Cloud" ); break ;
443
- case IOT_STATUS_CLOUD_DISCONNECTED : debugMessage (DebugLevel::Error, " Disconnected from Arduino IoT Cloud" ); break ;
439
+ case ArduinoIoTConnectionStatus::ERROR : debugMessage (DebugLevel::Error, " Arduino, we have a problem." ); break ;
440
+ case ArduinoIoTConnectionStatus::CONNECTING : debugMessage (DebugLevel::Error, " Connecting to Arduino IoT Cloud..." ); break ;
441
+ case ArduinoIoTConnectionStatus::RECONNECTING : debugMessage (DebugLevel::Error, " Reconnecting to Arduino IoT Cloud..." ); break ;
442
+ case ArduinoIoTConnectionStatus::CONNECTED : debugMessage (DebugLevel::Error, " Connected to Arduino IoT Cloud" ); break ;
443
+ case ArduinoIoTConnectionStatus::DISCONNECTED : debugMessage (DebugLevel::Error, " Disconnected from Arduino IoT Cloud" ); break ;
444
444
}
445
445
iotStatus = _newState;
446
446
}
0 commit comments