From e429bf0ad9d88588b6ddc3b5e34ee8fbdaacb08f Mon Sep 17 00:00:00 2001 From: EUtrilla2002 <100451242@alumnos.uc3m.es> Date: Tue, 18 Nov 2025 11:00:46 +0100 Subject: [PATCH] Added gateway error message --- .../simulator/creator_uielto_target_flash.js | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/components/simulator/creator_uielto_target_flash.js b/components/simulator/creator_uielto_target_flash.js index ddf27d706..9ef066427 100644 --- a/components/simulator/creator_uielto_target_flash.js +++ b/components/simulator/creator_uielto_target_flash.js @@ -278,7 +278,10 @@ this_env = this; gateway_remote_flash(this.flash_url + "/flash", farg).then( function(data) { this_env.flashing = false; - console.log(JSON.stringify(data, null, 2)); + console.log("Message:"+ JSON.stringify(data, null, 2)); + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } if (JSON.stringify(data, null, 2).includes('Flash completed successfully')) { show_notification('Flashing program success.', 'success'); } @@ -308,6 +311,9 @@ this_env.stoprunning = false; //show_notification(data, 'danger') ; console.log(JSON.stringify(data, null, 2)); + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } if (JSON.stringify(data, null, 2).includes('Process stopped')) { show_notification('Process stopped.', 'success'); } @@ -336,6 +342,9 @@ gateway_remote_monitor(this.flash_url + "/monitor", farg).then( function(data) { this_env.running = false; console.log(JSON.stringify(data, null, 2)); + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } if (JSON.stringify(data, null, 2).includes('No UART port found')) { show_notification('Error: Not found UART port', 'danger'); } @@ -362,7 +371,10 @@ this_env = this; gateway_remote_monitor(this.flash_url + "/debug", farg).then( function(data) { - this_env.debugging = false; + this_env.debugging = false; + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } if (JSON.stringify(data, null, 2).includes('No ELF file found in build directory')) { show_notification('Error: Not found proyect to debug', 'danger'); } @@ -378,6 +390,8 @@ creator_ga('simulator', 'simulator.debug', 'simulator.debug'); }, + + showConfirmPopup(action) { this.pendingAction = action; this.showPopup = true; @@ -408,6 +422,9 @@ this_env = this; gateway_remote_monitor(this.flash_url + "/fullclean", farg).then( function(data) { this_env.fullclean = false; + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } console.log(JSON.stringify(data, null, 2)); if (JSON.stringify(data, null, 2).includes('Full clean done.')) { show_notification('Full clean done.', 'success'); @@ -438,6 +455,9 @@ this_env.eraseflash = false; //show_notification(data, 'danger') ; console.log(JSON.stringify(data, null, 2)); + if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) { + show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger'); + } if (JSON.stringify(data, null, 2).includes('Erase flash done')) { show_notification('Erase flash done. Please, unplug and plug the cable(s) again', 'success'); }