@@ -247,14 +247,14 @@ boolean BytebeamArduino::publishActionStatus(char* actionId, int progressPercent
247247}
248248
249249#ifdef BYTEBEAM_ARDUINO_ARCH_SUPPORTS_FS
250- boolean BytebeamArduino::readDeviceConfigFile (const deviceConfigFileSystem fileSystem, const char * fileName ) {
250+ boolean BytebeamArduino::readDeviceConfigFile () {
251251
252252 /* This file system pointer will store the address of the selected file system, So after begin and end operations
253253 * we can utilize this file system pointer to do the file operations.
254254 */
255255 fs::FS* ptrToFS = NULL ;
256256
257- switch (fileSystem) {
257+ switch (this -> fileSystem ) {
258258
259259 /* We need to do conditional compilation here beacuse different architecture supports different file systems
260260 * So based on the architecture we should define the flags for the supported file system.
@@ -312,7 +312,7 @@ boolean BytebeamArduino::publishActionStatus(char* actionId, int progressPercent
312312 BytebeamLogger::Info (__FILE__, __func__, " SD file system detected !" );
313313
314314 // Just print the log and return :)
315- BytebeamLogger::Info (__FILE__, __func__, " SD is not supported by the library yet" );
315+ BytebeamLogger::Info (__FILE__, __func__, " SD file system is not supported by the SDK yet" );
316316 return false ;
317317
318318 break ;
@@ -322,13 +322,13 @@ boolean BytebeamArduino::publishActionStatus(char* actionId, int progressPercent
322322 BytebeamLogger::Info (__FILE__, __func__, " Unknown file system detected !" );
323323
324324 // Just print the log and return :)
325- BytebeamLogger::Info (__FILE__, __func__, " Make sure the architecture supports the selcted file system" );
325+ BytebeamLogger::Info (__FILE__, __func__, " Make sure the architecture supports the selected file system" );
326326 return false ;
327327
328328 break ;
329329 }
330330
331- const char * path = fileName;
331+ const char * path = this -> fileName ;
332332 BytebeamLogger::Info (__FILE__, __func__, " Reading file : %s" , path);
333333
334334 File file = ptrToFS->open (path, FILE_READ);
@@ -364,7 +364,7 @@ boolean BytebeamArduino::publishActionStatus(char* actionId, int progressPercent
364364
365365 file.close ();
366366
367- switch (DEVICE_CONFIG_FILE_SYSTEM ) {
367+ switch (this -> fileSystem ) {
368368
369369 /* We need to do conditional compilation here beacuse different architecture supports different file systems
370370 * So based on the architecture we should define the flags for the supported file system.
@@ -402,11 +402,7 @@ boolean BytebeamArduino::publishActionStatus(char* actionId, int progressPercent
402402 #endif
403403
404404 default :
405- BytebeamLogger::Info (__FILE__, __func__, " Unknown file system detected !" );
406-
407- // Just print the log and return :)
408- BytebeamLogger::Info (__FILE__, __func__, " Make sure the architecture supports the selcted file system" );
409- return false ;
405+ // nothing to do here yet
410406
411407 break ;
412408 }
@@ -569,12 +565,12 @@ void BytebeamArduino::clearBytebeamClient() {
569565 BytebeamLogger::Info (__FILE__, __func__, " DISCONNECTED" );
570566}
571567
572- boolean BytebeamArduino::init ( const deviceConfigFileSystem fileSystem, const char * fileName ) {
568+ boolean BytebeamArduino::initSDK ( ) {
573569 // It's much better to pump up architecture inforamtion in the very beginning
574570 printArchitectureInfo ();
575571
576572#ifdef BYTEBEAM_ARDUINO_ARCH_SUPPORTS_FS
577- if (!readDeviceConfigFile (fileSystem, fileName )) {
573+ if (!readDeviceConfigFile ()) {
578574 BytebeamLogger::Error (__FILE__, __func__, " Initialization failed, error while reading the device config file.\n " );
579575 return false ;
580576 }
@@ -655,8 +651,8 @@ BytebeamArduino::BytebeamArduino()
655651
656652 initActionHandlerArray ();
657653
658- this ->isOTAEnable = false ;
659654 this ->isClientActive = false ;
655+ this ->isOTAEnable = false ;
660656}
661657
662658BytebeamArduino::~BytebeamArduino () {
@@ -671,7 +667,13 @@ BytebeamArduino::~BytebeamArduino() {
671667 boolean BytebeamArduino::begin ( const deviceConfigFileSystem fileSystem,
672668 const char * fileName,
673669 BytebeamLogger::DebugLevel level) {
674- // start with setting the bytbeam logger log level
670+ // set the device config file system
671+ this ->fileSystem = fileSystem;
672+
673+ // set the device config file name
674+ this ->fileName = fileName;
675+
676+ // set the bytbeam logger log level
675677 BytebeamLogger::setLogLevel (level);
676678
677679 // fix : ensure wifi status before using ntp methods o/w they will give hard fault
@@ -691,7 +693,7 @@ BytebeamArduino::~BytebeamArduino() {
691693 BytebeamLog::setTimeInstance (&BytebeamTime);
692694
693695 // initialize the core sdk and give back the status to the user
694- bool result = init (fileSystem, fileName );
696+ bool result = initSDK ( );
695697
696698 return result;
697699 }
@@ -702,7 +704,13 @@ BytebeamArduino::~BytebeamArduino() {
702704 const deviceConfigFileSystem fileSystem,
703705 const char * fileName,
704706 BytebeamLogger::DebugLevel level) {
705- // start with setting the bytbeam logger log level
707+ // set the device config file system
708+ this ->fileSystem = fileSystem;
709+
710+ // set the device config file name
711+ this ->fileName = fileName;
712+
713+ // set the bytbeam logger log level
706714 BytebeamLogger::setLogLevel (level);
707715
708716 // fix : ensure modem instance before using modem class methods o/w they will give hard fault
@@ -731,7 +739,7 @@ BytebeamArduino::~BytebeamArduino() {
731739 BytebeamLog::setTimeInstance (&BytebeamTime);
732740
733741 // initialize the core sdk and give back the status to the user
734- bool result = init (fileSystem, fileName );
742+ bool result = initSDK ( );
735743
736744 return result;
737745 }
@@ -1194,11 +1202,11 @@ boolean BytebeamArduino::end() {
11941202 this ->deviceConfigStr = NULL ;
11951203
11961204 // disable the OTA if it was enabled
1197- if (this ->isOTAEnable ) {
1198- #if BYTEBEAM_OTA_ENABLE
1199- disableOTA ();
1200- #endif
1205+ #if BYTEBEAM_OTA_ENABLE
1206+ if (isOTAEnabled ()) {
1207+ disableOTA ();
12011208 }
1209+ #endif
12021210
12031211 initActionHandlerArray ();
12041212
@@ -1295,7 +1303,7 @@ boolean BytebeamArduino::end() {
12951303 }
12961304
12971305 // before going ahead make sure OTA is enabled
1298- if (!this -> isOTAEnable ) {
1306+ if (!isOTAEnabled () ) {
12991307 BytebeamLogger::Error (__FILE__, __func__, " Bytebeam OTA is not enabled." );
13001308 return false ;
13011309 }
0 commit comments