This commit is contained in:
Exequiel Aramburu 2025-11-16 19:35:43 -03:00
parent ed11169f36
commit 2d4c7b5f36
41 changed files with 40812 additions and 23927 deletions

6
.gitignore vendored
View File

@ -1 +1,5 @@
node_modules node_modules/
cache/
build/tmp/emalibre_nogui/
build/debs/*
!build/debs/readme.md

View File

@ -1,28 +1,18 @@
(async () => { import nwbuild from 'nw-builder';
try {
// 📦 Cargar la función principal desde nw-builder
const nwbuild = (await import('nw-builder')).default;
// 🚀 Configuración del build
// 3. Configurar nw-builder para usar el directorio temporal como appDir
await nwbuild({ await nwbuild({
mode: 'build', // COMPILADOR: Modo 'build' (empaquetar) o 'run' (ejecutar sin empaquetar) srcDir: './src', // Usamos el directorio temporal como fuente
srcDir: [ file: './src/package.json',
'./src/**', // COMPILADOR: Directorio fuente platforms: ['linux64'],
'!./src/node_module/mocha/**', // EXCEPCIÓN: Excluir pruebas glob: false,
'!./src/node_module/chai/**', version: '0.94.0',
'!./src/package-lock.json' flavor: 'normal',
], buildDir: './build/emalibre',
platform: 'linux', // COMPILADOR: Plataforma de destino outDir: './build/emalibre',
arch: 'x64', // COMPILADOR: Arquitectura de destino zip: false,
version: '0.94.0', // COMPILADOR: Versión de NW.js a usar appName: 'emalibre'
flavor: 'normal', // COMPILADOR: Variante NW.js ('normal' o 'sdk')
outDir: 'build/emalibre', // COMPILADOR: Carpeta de salida
appName: 'emalibre', // APLICACIÓN: Nombre de la app compilada
zip: false, // COMPILADOR: No comprimir
}); });
console.log('Correcto!'); console.log('Correcto!');
} catch (error) {
console.error('❌ Error durante la compilación:', error);
}
})();

View File

@ -41,9 +41,10 @@ printf "\033[1;4m--->Version de EmaL: $VERSION \033[0m\n"
printf "\033[1;4m--->Version de NWJs: $NWJS_VERSION \033[0m\n" printf "\033[1;4m--->Version de NWJs: $NWJS_VERSION \033[0m\n"
echo "" echo ""
printf "\033[1;10m1) Limpiando compilacion anterior. \033[0m" printf "\033[1;10m1) Limpiando compilacion anterior. \033[0m"
sudo mkdir build/Deb64/usnerando node_modules con NPM del proyr/bin 2> /dev/null sudo mkdir build/Deb64/usr/bin 2> /dev/null
sudo mkdir build/Deb64/usr/share/emalibre 2> /dev/null sudo mkdir build/Deb64/usr/share/emalibre 2> /dev/null
sudo rm -fr build/emalibre/package.nw/src sudo rm -fr build/emalibre/*
sudo rm -fr build/tmp/emalibre_nogui
sudo rm -fr build/Deb64/usr/bin/* sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/* sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
@ -61,7 +62,7 @@ then
printf "\033[1;32m --> Se sale, por favor instale manualmente. \033[0m\n" printf "\033[1;32m --> Se sale, por favor instale manualmente. \033[0m\n"
exit 0 exit 0
fi fi
printf "\033[1;10m 3.2) Comprobando si esta npm global. \033[0m" printf "\033[1;10m 3.2) Comprobando si esta /npm global. \033[0m"
if [ $npm -eq 1 ] if [ $npm -eq 1 ]
then then
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
@ -92,13 +93,13 @@ printf "\033[1;10m4) Empaquetando el proyecto emalibre. \033[0m"
CHECK_EMPAQUETADO=`node empaquetarLinux.js | grep "Correcto!" | wc -l` CHECK_EMPAQUETADO=`node empaquetarLinux.js | grep "Correcto!" | wc -l`
if [ "${CHECK_EMPAQUETADO}" -eq "1" ]; then printf "\033[1;32m --> OK. \033[0m\n"; else printf "\033[5;91m --> ERROR. Problema empaquetando con nw-builder. \033[0m\n";exit 1; fi if [ "${CHECK_EMPAQUETADO}" -eq "1" ]; then printf "\033[1;32m --> OK. \033[0m\n"; else printf "\033[5;91m --> ERROR. Problema empaquetando con nw-builder. \033[0m\n";exit 1; fi
printf "\033[1;10m5) Aplicando Permisos al proyecto. \033[0m" printf "\033[1;10m5) Aplicando Permisos al proyecto. \033[0m"
sudo chmod -R 777 build/emalibre/package.nw/src & spinner "Procesando..." sudo chmod -R 777 build/emalibre/package.nw & spinner "Procesando..."
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m6) Eliminando node_modules del proyecto. \033[0m" printf "\033[1;10m6) Eliminando node_modules del proyecto. \033[0m"
sudo rm -fr build/emalibre/package.nw/src/node_modules & spinner "Procesando..." sudo rm -fr build/emalibre/package.nw/node_modules & spinner "Procesando..."
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m7) Generando node_modules con NPM del proyecto. \033[0m" printf "\033[1;10m7) Generando node_modules con NPM del proyecto. \033[0m"
cd build/emalibre/package.nw/src cd build/emalibre/package.nw
npm install ---production -no-audit -silent 2> /tmp/ema.log 1> /dev/null npm install ---production -no-audit -silent 2> /tmp/ema.log 1> /dev/null
printf "\033[1;32m --> OK. \033[0m\n"; printf "\033[1;32m --> OK. \033[0m\n";
printf "\033[1;10m8) Se purgan los tanques y logs. \033[0m" printf "\033[1;10m8) Se purgan los tanques y logs. \033[0m"
@ -107,16 +108,16 @@ sudo echo "[]" > logs/TanquePendientes.log
sudo echo "[]" > logs/registro_diario.log sudo echo "[]" > logs/registro_diario.log
printf "\033[1;32m --> OK. \033[0m\n"; printf "\033[1;32m --> OK. \033[0m\n";
printf "\033[1;10m9) Se blanquea el archivo de Configuracion General. \033[0m" printf "\033[1;10m9) Se blanquea el archivo de Configuracion General. \033[0m"
sudo cp ../../../conf/ConfiguracionGeneral.js conf/ConfiguracionGeneral.js sudo cp ../../conf/ConfiguracionGeneral.js conf/ConfiguracionGeneral.js
printf "\033[1;32m --> OK. \033[0m\n"; printf "\033[1;32m --> OK. \033[0m\n";
cd .. cd ../..
sudo cp -R src src_nogui # Se copia antes del postLINUX (que implementa NWJS) para el modo consola y web sudo cp -R emalibre tmp/emalibre_nogui # Se copia antes del postLINUX (que implementa NWJS) para el modo consola y web
sudo chmod -R 777 src_nogui sudo chmod -R 777 tmp/emalibre_nogui
cd src cd emalibre/package.nw
npm run postLINUX -no-audit -silent 2> /tmp/ema.log 1> /dev/null & spinner "Procesando..." npm run postLINUX -no-audit -silent 2> /tmp/ema.log 1> /dev/null & spinner "Procesando..."
CHECK_NW_NODE_BUILD=`cat /tmp/ema.log | grep "gyp info ok" | wc -l` CHECK_NW_NODE_BUILD=`cat /tmp/ema.log | grep "gyp info ok" | wc -l`
if [ "${CHECK_NW_NODE_BUILD}" -eq "1" ]; then printf "\033[1;32m --> OK. \033[0m\n"; else printf "\033[5;91m --> ERROR. Verifique el modulo NW con node-hid. \033[0m\n";exit 1; fi if [ "${CHECK_NW_NODE_BUILD}" -eq "1" ]; then printf "\033[1;32m --> OK. \033[0m\n"; else printf "\033[5;91m --> ERROR. Verifique el modulo NW con node-hid. \033[0m\n";exit 1; fi
cd ../../../.. cd ../../..
# ************************************************************** # **************************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo GRAFICO Desktop # Compilar EMA Libre Cliente (Carpincho) en modo GRAFICO Desktop
@ -176,6 +177,60 @@ sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/* sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
# ***********************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA/WEB
# ***********************************************************
echo ""
echo ""
echo "*************************************************"
echo "* Build EMA Libre Cliente Web - GNU/Linux *"
echo "*************************************************"
echo ""
printf "\033[1;10m1) Limpiando archivos temporales. \033[0m"
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m2) Copiando los fuentes de EMA Libre para 64bit. \033[0m"
sudo cp -R build/tmp/emalibre_nogui/package.nw/core build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/logs build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/conf build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/gui_web build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/gui_common build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/node_modules build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/CHANGELOG build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/COPYING build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/AUTHORS build/Deb64/usr/share/emalibre/
sudo cp -R build/tmp/emalibre_nogui/package.nw/package.json build/Deb64/usr/share/emalibre/
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m3) Remplazando el archivo de control DEB. \033[0m"
sudo cp -f build/controlDeb/control_linux_web build/Deb64/DEBIAN/control & spinner "Procesando..."
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m4) Aplicando permisos necesarios. \033[0m"
sudo echo "web" > build/Deb64/etc/emalibre_modo
sudo chmod 0755 build/Deb64/DEBIAN
sudo chmod 0755 build/Deb64/DEBIAN/postrm
sudo chmod 0755 build/Deb64/DEBIAN/postinst
sudo chmod 0755 build/Deb64/DEBIAN/preinst
sudo chown -R root:root build/Deb64
printf "\033[1;32m --> OK. \033[0m\n"
cd build
printf "\033[1;10m7) Generando Paquete Deb para Web 64bit Linux. \033[0m\n"
sudo dpkg -b Deb64 debs/"emalibre-web-linux_$VERSION.deb"
printf "\033[5;10m Finalizo con exito, build/debs/emalibre-console-linux_$VERSION.deb. \033[0m"
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m8) Limpiando archivos temporales. \033[0m"
cd ..
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
sudo rm -fr build/emalibre
printf "\033[1;32m --> OK. \033[0m\n"
echo ""
exit 0
# *********************************************************** # ***********************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA # Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA
# *********************************************************** # ***********************************************************
@ -191,15 +246,15 @@ sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/* sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m2) Copiando los fuentes de EMA Libre para 64bit. \033[0m" printf "\033[1;10m2) Copiando los fuentes de EMA Libre para 64bit. \033[0m"
sudo cp -R build/emalibre/package.nw/src_nogui/core build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/core build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/logs build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/logs build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/conf build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/conf build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/tmp build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/tmp build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/node_modules build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/node_modules build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/CHANGELOG build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/CHANGELOG build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/COPYING build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/COPYING build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/AUTHORS build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/AUTHORS build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/package.json build/Deb64/usr/share/emalibre/ sudo cp -R build/tmp/emalibre_nogui/package.json build/Deb64/usr/share/emalibre/
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m3) Remplazando el archivo de control DEB. \033[0m" printf "\033[1;10m3) Remplazando el archivo de control DEB. \033[0m"
sudo cp -f build/controlDeb/control_linux_console build/Deb64/DEBIAN/control & spinner "Procesando..." sudo cp -f build/controlDeb/control_linux_console build/Deb64/DEBIAN/control & spinner "Procesando..."
@ -223,56 +278,3 @@ sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/* sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
echo "" echo ""
# ***********************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA/WEB
# ***********************************************************
echo ""
echo ""
echo "*************************************************"
echo "* Build EMA Libre Cliente Web - GNU/Linux *"
echo "*************************************************"
echo ""
printf "\033[1;10m1) Limpiando archivos temporales. \033[0m"
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m2) Copiando los fuentes de EMA Libre para 64bit. \033[0m"
sudo cp -R build/emalibre/package.nw/src_nogui/core build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/logs build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/conf build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/gui_web build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/gui_common build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/tmp build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/node_modules build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/CHANGELOG build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/COPYING build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/AUTHORS build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/package.nw/src_nogui/package.json build/Deb64/usr/share/emalibre/
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m3) Remplazando el archivo de control DEB. \033[0m"
sudo cp -f build/controlDeb/control_linux_web build/Deb64/DEBIAN/control & spinner "Procesando..."
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m4) Aplicando permisos necesarios. \033[0m"
sudo echo "web" > build/Deb64/etc/emalibre_modo
sudo chmod 0755 build/Deb64/DEBIAN
sudo chmod 0755 build/Deb64/DEBIAN/postrm
sudo chmod 0755 build/Deb64/DEBIAN/postinst
sudo chmod 0755 build/Deb64/DEBIAN/preinst
sudo chown -R root:root build/Deb64
printf "\033[1;32m --> OK. \033[0m\n"
cd build
printf "\033[1;10m7) Generando Paquete Deb para Web 64bit Linux. \033[0m\n"
sudo dpkg -b Deb64 demalibreebs/"emalibre-web-linux_$VERSION.deb"
printf "\033[5;10m Finalizo con exito, build/debs/emalibre-console-linux_$VERSION.deb. \033[0m"
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m8) Limpiando archivos temporales. \033[0m"
cd ..
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
sudo rm -fr build/emalibre
printf "\033[1;32m --> OK. \033[0m\n"
echo ""

View File

@ -204,55 +204,6 @@ sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/* sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n" printf "\033[1;32m --> OK. \033[0m\n"
# ***********************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA
# ***********************************************************
echo ""
echo ""
echo "*************************************************"
echo "* Build EMA Libre Cliente Consola - ARM *"
echo "*************************************************"
echo ""
printf "\033[1;10m1) Limpiando archivos temporales. \033[0m"
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m2) Copiando los fuentes de EMA Libre para ARM. \033[0m"
sudo cp -R build/emalibre/arm/core build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/logs build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/conf build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/tmp build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/node_modules build/Deb64/usr/share/emalibre/
sudo rm -fr build/Deb64/usr/share/emalibre/node_modules/node-hid
sudo cp -R build/emalibre/node-hid build/Deb64/usr/share/emalibre/node_modules
sudo cp -R build/emalibre/arm/CHANGELOG build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/COPYING build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/AUTHORS build/Deb64/usr/share/emalibre/
sudo cp -R build/emalibre/arm/package.json build/Deb64/usr/share/emalibre/
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m3) Remplazando el archivo de control DEB. \033[0m"
sudo cp -f build/controlDeb/control_arm_console build/Deb64/DEBIAN/control & spinner "Procesando..."
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m4) Aplicando permisos necesarios. \033[0m"
sudo chmod 0755 build/Deb64/DEBIAN
sudo chmod 0755 build/Deb64/DEBIAN/postrm
sudo chmod 0755 build/Deb64/DEBIAN/postinst
sudo chmod 0755 build/Deb64/DEBIAN/preinst
sudo chown -R root:root build/Deb64
printf "\033[1;32m --> OK. \033[0m\n"
cd build
printf "\033[1;10m7) Generando Paquete Deb para Consola ARM. \033[0m\n"
sudo dpkg -b Deb64 debs/"emalibre-consola-arm_$VERSION.deb"
printf "\033[5;10m Finalizo con exito, build/debs/emalibre-console-arm_$VERSION.deb. \033[0m"
printf "\033[1;32m --> OK. \033[0m\n"
printf "\033[1;10m8) Limpiando archivos temporales. \033[0m"
cd ..
sudo rm -f build/Deb64/DEBIAN/control
sudo rm -fr build/Deb64/usr/bin/*
sudo rm -fr build/Deb64/usr/share/emalibre/*
printf "\033[1;32m --> OK. \033[0m\n"
echo ""
# *********************************************************** # ***********************************************************
# Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA/WEB # Compilar EMA Libre Cliente (Carpincho) en modo CONSOLA/WEB

579
package-lock.json generated
View File

@ -13,15 +13,6 @@
"nw-builder": "^4.13.16" "nw-builder": "^4.13.16"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.27.6",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz",
"integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@emnapi/core": { "node_modules/@emnapi/core": {
"version": "1.4.4", "version": "1.4.4",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.4.tgz", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.4.tgz",
@ -550,12 +541,12 @@
} }
}, },
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=4"
} }
}, },
"node_modules/ansi-styles": { "node_modules/ansi-styles": {
@ -896,18 +887,6 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/chai": { "node_modules/chai": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz",
@ -1007,6 +986,50 @@
"wrap-ansi": "^7.0.0" "wrap-ansi": "^7.0.0"
} }
}, },
"node_modules/cliui/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@ -1069,9 +1092,9 @@
"dev": true "dev": true
}, },
"node_modules/core-util-is": { "node_modules/core-util-is": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true "dev": true
}, },
"node_modules/crc-32": { "node_modules/crc-32": {
@ -1545,21 +1568,23 @@
} }
}, },
"node_modules/glob": { "node_modules/glob": {
"version": "7.1.6", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"fs.realpath": "^1.0.0", "foreground-child": "^3.3.1",
"inflight": "^1.0.4", "jackspeak": "^4.1.1",
"inherits": "2", "minimatch": "^10.0.3",
"minimatch": "^3.0.4", "minipass": "^7.1.2",
"once": "^1.3.0", "package-json-from-dist": "^1.0.0",
"path-is-absolute": "^1.0.0" "path-scurry": "^2.0.0"
},
"bin": {
"glob": "dist/esm/bin.mjs"
}, },
"engines": { "engines": {
"node": "*" "node": "20 || >=22"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
@ -1577,6 +1602,61 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/glob/node_modules/jackspeak": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz",
"integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==",
"dev": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob/node_modules/lru-cache": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz",
"integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==",
"dev": true,
"engines": {
"node": "20 || >=22"
}
},
"node_modules/glob/node_modules/minimatch": {
"version": "10.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz",
"integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==",
"dev": true,
"dependencies": {
"@isaacs/brace-expansion": "^5.0.0"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob/node_modules/path-scurry": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
"integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
"dev": true,
"dependencies": {
"lru-cache": "^11.0.0",
"minipass": "^7.1.2"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/globalthis": { "node_modules/globalthis": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
@ -1832,12 +1912,12 @@
} }
}, },
"node_modules/is-fullwidth-code-point": { "node_modules/is-fullwidth-code-point": {
"version": "3.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=4"
} }
}, },
"node_modules/is-glob": { "node_modules/is-glob": {
@ -1853,12 +1933,11 @@
} }
}, },
"node_modules/is-it-type": { "node_modules/is-it-type": {
"version": "5.1.2", "version": "5.1.3",
"resolved": "https://registry.npmjs.org/is-it-type/-/is-it-type-5.1.2.tgz", "resolved": "https://registry.npmjs.org/is-it-type/-/is-it-type-5.1.3.tgz",
"integrity": "sha512-q/gOZQTNYABAxaXWnBKZjTFH4yACvWEFtgVOj+LbgxYIgAJG1xVmUZOsECSrZPIemYUQvaQWVilSFVbh4Eyt8A==", "integrity": "sha512-AX2uU0HW+TxagTgQXOJY7+2fbFHemC7YFBwN1XqD8qQMKdtfbOC8OC3fUb4s5NU59a3662Dzwto8tWDdZYRXxg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.7",
"globalthis": "^1.0.2" "globalthis": "^1.0.2"
}, },
"engines": { "engines": {
@ -1895,6 +1974,12 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
},
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -1946,12 +2031,6 @@
"node": ">= 0.6.3" "node": ">= 0.6.3"
} }
}, },
"node_modules/lazystream/node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
},
"node_modules/lazystream/node_modules/readable-stream": { "node_modules/lazystream/node_modules/readable-stream": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
@ -1967,12 +2046,6 @@
"util-deprecate": "~1.0.1" "util-deprecate": "~1.0.1"
} }
}, },
"node_modules/lazystream/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/lazystream/node_modules/string_decoder": { "node_modules/lazystream/node_modules/string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@ -2293,6 +2366,27 @@
"url": "https://opencollective.com/mochajs" "url": "https://opencollective.com/mochajs"
} }
}, },
"node_modules/mocha/node_modules/glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@ -2414,84 +2508,6 @@
"nwbuild": "src/cli.js" "nwbuild": "src/cli.js"
} }
}, },
"node_modules/nw-builder/node_modules/glob": {
"version": "11.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
"integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
"dev": true,
"dependencies": {
"foreground-child": "^3.3.1",
"jackspeak": "^4.1.1",
"minimatch": "^10.0.3",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^2.0.0"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/nw-builder/node_modules/jackspeak": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz",
"integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==",
"dev": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/nw-builder/node_modules/lru-cache": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz",
"integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==",
"dev": true,
"engines": {
"node": "20 || >=22"
}
},
"node_modules/nw-builder/node_modules/minimatch": {
"version": "10.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz",
"integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==",
"dev": true,
"dependencies": {
"@isaacs/brace-expansion": "^5.0.0"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/nw-builder/node_modules/path-scurry": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
"integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
"dev": true,
"dependencies": {
"lru-cache": "^11.0.0",
"minipass": "^7.1.2"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/object-keys": { "node_modules/object-keys": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
@ -2796,24 +2812,10 @@
} }
}, },
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.2.1", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true, "dev": true
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
}, },
"node_modules/safer-buffer": { "node_modules/safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -2980,18 +2982,37 @@
"safe-buffer": "~5.2.0" "safe-buffer": "~5.2.0"
} }
}, },
"node_modules/string_decoder/node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/string-width": { "node_modules/string-width": {
"version": "4.2.3", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^4.0.0"
"strip-ansi": "^6.0.1"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=4"
} }
}, },
"node_modules/string-width-cjs": { "node_modules/string-width-cjs": {
@ -3009,7 +3030,25 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/strip-ansi": { "node_modules/string-width-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/string-width-cjs/node_modules/strip-ansi": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
@ -3021,6 +3060,18 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==",
"dev": true,
"dependencies": {
"ansi-regex": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/strip-ansi-cjs": { "node_modules/strip-ansi-cjs": {
"name": "strip-ansi", "name": "strip-ansi",
"version": "6.0.1", "version": "6.0.1",
@ -3034,6 +3085,15 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/strip-json-comments": { "node_modules/strip-json-comments": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@ -3129,9 +3189,9 @@
} }
}, },
"node_modules/tinyglobby/node_modules/picomatch": { "node_modules/tinyglobby/node_modules/picomatch": {
"version": "4.0.2", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=12" "node": ">=12"
@ -3222,49 +3282,6 @@
"string-width": "^1.0.2 || 2" "string-width": "^1.0.2 || 2"
} }
}, },
"node_modules/wide-align/node_modules/ansi-regex": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/wide-align/node_modules/is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/wide-align/node_modules/string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true,
"dependencies": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/wide-align/node_modules/strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==",
"dev": true,
"dependencies": {
"ansi-regex": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/workerpool": { "node_modules/workerpool": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz",
@ -3306,6 +3323,94 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1" "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
} }
}, },
"node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi-cjs/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@ -3381,6 +3486,62 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/yargs-unparser/node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yargs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/yargs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/yargs/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yargs/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yauzl-promise": { "node_modules/yauzl-promise": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/yauzl-promise/-/yauzl-promise-4.0.0.tgz", "resolved": "https://registry.npmjs.org/yauzl-promise/-/yauzl-promise-4.0.0.tgz",

View File

@ -4,8 +4,9 @@
+ Se actualizó la funcion de registrar logs para que solo + Se actualizó la funcion de registrar logs para que solo
registre en el nivel parametrizado (1-9), los 0 se registran siempre. registre en el nivel parametrizado (1-9), los 0 se registran siempre.
+ Se mantiene la versión de nwjs por compatibilidad con node-hid. + Se mantiene la versión de nwjs por compatibilidad con node-hid.
+ Se incorporó la opcion para ir al sitio oficial de la red, en el menu de redes.
+ Se actualizó la versión de : + Se actualizó la versión de :
RGraph 6.20 → 6.22 RGraph 6.20 → 7.01
bootstrap 4.5.3 → 4.6.2 bootstrap 4.5.3 → 4.6.2
express 4.21.2 → 5.1.0 express 4.21.2 → 5.1.0
forever 3.0.4 → 4.0.3 forever 3.0.4 → 4.0.3
@ -13,6 +14,9 @@
node-hid 1.3.1 → 2.2.0 node-hid 1.3.1 → 2.2.0
nodemailer 6.10.1 → 7.0.5 nodemailer 6.10.1 → 7.0.5
terminal-kit 2.11.7 → 3.1.2 terminal-kit 2.11.7 → 3.1.2
+ Se realizo un fix a la red WINDY(https://stations.windy.com/) para su publicación.
-Usuario/ID: es la API KEY del usuario.
-Password: Es numero de estaciones dada de alta en windy(ej: la primera->0, la segunda->1, la X->X).
** Versión 1.35: (Diciembre 10 , 2024) ** Versión 1.35: (Diciembre 10 , 2024)
+ Se actualizó la versión de nwjs → 0.94.0 + Se actualizó la versión de nwjs → 0.94.0

View File

@ -2,25 +2,26 @@
module.exports = { module.exports = {
"ConfGeneral": { "ConfGeneral": {
"Tiempo_de_Recoleccion": 10, "Tiempo_de_Recoleccion": 40,
"UTC": -3, "UTC": -3,
"SistemaMetrico": "SI", "SistemaMetrico": "SI",
"debug": 6, "debug": 3,
"debugTamanio": 10, "debugTamanio": 10,
"NombreEstacion": "pepe", "NombreEstacion": "-",
"Modo": "Recolector_IP", "Modo": "Recolector",
"Llave_R": "e5303ab3-2a8b-4d42-90ab-1c8367d8521d", "Llave_R": "e5303ab3-2a8b-4d42-90ab-1c8367d8521d",
"inicio_automatico": false, "inicio_automatico": false,
"Audio": false, "Audio": true,
"notificar_cambios": true, "notificar_cambios": true,
"audioVoces": "Sin Voces", "audioVoces": "Spanish_(Latin_America) espeak-ng",
"IP": "192.168.1.220", "IP": "192.168.1.220",
"Puerto": "5000", "Puerto": "5000",
"Ruta": "/datos" "Ruta": "/datos"
}, },
"ConfEmail": { "ConfEmail": {
"ActivarCorreos": false, "ActivarCorreos": false,
"ReceptorEmail": "exe", "ReceptorEmail": "-",
"Servicio": "Deshabilitado", "Servicio": "Deshabilitado",
"Usuario": "", "Usuario": "",
"Password": "", "Password": "",

View File

@ -142,14 +142,15 @@ APP = module.exports = {
}, },
Salir: function () { Salir: function () {
APP.RegistrarLog('0|CORE|SALIR: Se cerro el core de EMA LIBRE. Hasta luego!!!.'); APP.RegistrarLog('0|CORE|🔚 SALIR: Se cerro el core de EMA LIBRE. Hasta luego!!!.');
if (configGeneralEMA.ConfEmail.ActivarCorreos === true) Correo.EnviarEmail(configGeneralEMA,'EMA - OFFLINE', '<b>Estimado</b>,<br><br> Le informamos que la estación <b>' + configGeneralEMA.ConfGeneral.NombreEstacion + '</b> se detuvo y se cerro el software EMA LIBRE.<br><br>Saludos Cordiales.'); if (configGeneralEMA.ConfEmail.ActivarCorreos === true) Correo.EnviarEmail(configGeneralEMA,'EMA - OFFLINE', '<b>Estimado</b>,<br><br> Le informamos que la estación <b>' + configGeneralEMA.ConfGeneral.NombreEstacion + '</b> se detuvo y se cerro el software EMA LIBRE.<br><br>Saludos Cordiales.');
APP.Configuracion.Errores = 'Se Salio del Recolector'; APP.Configuracion.Errores = 'Se Salio del Recolector';
}, },
Detener: function () { Detener: function () {
APP.RegistrarLog('0|CORE|DETENER: Se detiene el recolector de EMA LIBRE.'); APP.RegistrarLog('0|CORE|🔴 Se detiene el recolector de EMA LIBRE.');
APP.Configuracion.RunTime = 0; APP.Configuracion.RunTime = 0;
APP.Configuracion.Errores = 'Se detuvo manualmente el Recolector'; APP.Configuracion.Errores = 'Se detuvo manualmente el Recolector';
APP.Configuracion.RepeticionesConError = 0;
APP.LimpiarM(); APP.LimpiarM();
if(APP.Configuracion.Modo === 'Recolector_IP') if(APP.Configuracion.Modo === 'Recolector_IP')
{ {
@ -159,7 +160,7 @@ APP = module.exports = {
res.on('data', (chunk) => { res.on('data', (chunk) => {
}); });
res.on('end', () => { res.on('end', () => {
APP.RegistrarLog('0|CORE| Petición de apagado enviada correctamente.'); APP.RegistrarLog('0|CORE|🔴 Petición de apagado enviada correctamente.');
}); });
}).on('error', (err) => { }).on('error', (err) => {
APP.RegistrarLog('0|CORE|❌ Error al enviar petición'); APP.RegistrarLog('0|CORE|❌ Error al enviar petición');
@ -167,21 +168,23 @@ APP = module.exports = {
} }
}, },
Reconfigurar: function () { Reconfigurar: function () {
APP.RegistrarLog('0|CORE|RECONFIGURANDO: Se reconfigura el recolectorde EMA LIBRE.'); APP.RegistrarLog('0|CORE|⚙️ RECONFIGURANDO: Se reconfigura el recolectorde EMA LIBRE.');
if (configGeneralEMA.ConfEmail.ActivarCorreos === true) Correo.EnviarEmail(configGeneralEMA,'EMA - CONFIG', '<b>Estimado</b>,<br><br> Le informamos que se modificó la configuración de la estación <b>' + configGeneralEMA.ConfGeneral.NombreEstacion + '</b>.<br><br>Saludos Cordiales.'); if (configGeneralEMA.ConfEmail.ActivarCorreos === true) Correo.EnviarEmail(configGeneralEMA,'EMA - CONFIG', '<b>Estimado</b>,<br><br> Le informamos que se modificó la configuración de la estación <b>' + configGeneralEMA.ConfGeneral.NombreEstacion + '</b>.<br><br>Saludos Cordiales.');
APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion; APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion;
APP.Configuracion.debug = configGeneralEMA.ConfGeneral.debug; APP.Configuracion.debug = configGeneralEMA.ConfGeneral.debug;
recolector.conf.debug = configGeneralEMA.ConfGeneral.debug; recolector.conf.debug = configGeneralEMA.ConfGeneral.debug;
APP.Configuracion.Puerto = configGeneralEMA.ConfGeneral.Puerto;
APP.Configuracion.IP = configGeneralEMA.ConfGeneral.IP;
APP.Configuracion.Patch = configGeneralEMA.ConfGeneral.Ruta;
}, },
Iniciar: function () { Iniciar: function () {
APP.RegistrarLog('0|CORE|INICIAR:Iniciando.');
if (APP.Configuracion.Run === 1 && APP.Configuracion.RunTime === 0) { if (APP.Configuracion.Run === 1 && APP.Configuracion.RunTime === 0) {
APP.RegistrarLog('0|CORE|INICIAR: Se inicio el recolector de EMA LIBRE.'); APP.RegistrarLog('0|CORE|🟢 INICIAR: Se inicio el recolector.');
APP.RegistrarLog('0|CORE|DEBUG: ' + APP.Configuracion.debug); APP.RegistrarLog('0|CORE|🛠️ DEBUG: ' + APP.Configuracion.debug);
APP.Configuracion.RunTime = 1; APP.Configuracion.RunTime = 1;
if(APP.Configuracion.Modo != 'Recolector_IP') APP.Continuo(); if(APP.Configuracion.Modo != 'Recolector_IP') APP.Continuo();
} else { } else {
APP.RegistrarLog('0|CORE|Hay un proceso corriendo, se elimina.'); APP.RegistrarLog('0|CORE|🔄 Hay un proceso corriendo, se elimina.');
APP.LimpiarM(); APP.LimpiarM();
if(APP.Configuracion.Modo != 'Recolector_IP') APP.Continuo(); if(APP.Configuracion.Modo != 'Recolector_IP') APP.Continuo();
} }
@ -204,12 +207,13 @@ APP = module.exports = {
autoClose: true autoClose: true
}, (err) => { }, (err) => {
if (err) { if (err) {
APP.RegistrarLog('1|ERROR: 🔴 Guardando registro diario en archivo :' + err); APP.RegistrarLog('1|ERROR|🔴 Guardando registro diario en archivo :' + err);
} }
}); });
}, },
TiempoActualRecolector: function () { TiempoActualRecolector: function (ahora = false) {
if(ahora) {return [100,100]; }
// APP.RegistrarLog(APP.Configuracion.IdsSetTimeouts); // APP.RegistrarLog(APP.Configuracion.IdsSetTimeouts);
var fechaTiempo = APP.Configuracion.FechaLanzadoTimeout; var fechaTiempo = APP.Configuracion.FechaLanzadoTimeout;
var tiempoC = APP.Configuracion.TiempoContinuo; var tiempoC = APP.Configuracion.TiempoContinuo;
@ -260,24 +264,18 @@ APP = module.exports = {
try { try {
if(APP.Configuracion.Modo === 'Recolector_IP'){ if(APP.Configuracion.Modo === 'Recolector_IP'){
APP.RegistrarLog('0|CORE|Estableciendo Time Zone UTC ' + configGeneralEMA.ConfGeneral.UTC); APP.RegistrarLog('0|CORE|🔧 Estableciendo Time Zone UTC ' + configGeneralEMA.ConfGeneral.UTC);
APP.RegistrarLog('0|CORE|Verificando Estado de la EMA...'); APP.RegistrarLog('0|CORE|🔧 Verificando Estado de la EMA...');
APP.RegistrarLog('0|CORE|🟢 Iniciando el Modo Recolector por IP/WIFI.'); APP.RegistrarLog('0|CORE|🟢 Iniciando el Modo Recolector por IP/WIFI.');
APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion; APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion;
APP.Configuracion.debug = configGeneralEMA.ConfGeneral.debug; APP.Configuracion.debug = configGeneralEMA.ConfGeneral.debug;
// se levanta el puerto para escuchar las peticiones al puerto indicado. // se levanta el puerto para escuchar las peticiones al puerto indicado.
// const url = require('url'); // para parsear req.url
const PORT = APP.Configuracion.Puerto; const PORT = APP.Configuracion.Puerto;
const HOST = APP.Configuracion.IP; const HOST = APP.Configuracion.IP;
const RUTA = APP.Configuracion.Patch; // e.g., "/datos" const RUTA = APP.Configuracion.Patch; // e.g., "/datos"
const server = http.createServer((req, res) => { const server = http.createServer((req, res) => {
//const parsedUrl = url.parse(req.url, true);
//const pathname = parsedUrl.pathname.toLowerCase();
//const method = req.method.toUpperCase();
//const ip = req.socket.remoteAddress.replace('::ffff:', '');
const base = `http://${HOST}:${PORT}`; const base = `http://${HOST}:${PORT}`;
let urlRaw = req.url; let urlRaw = req.url;
// Si la ruta empieza con "/xxxx" y no tiene "?" pero sí "&", agregamos "?" // Si la ruta empieza con "/xxxx" y no tiene "?" pero sí "&", agregamos "?"
@ -288,9 +286,8 @@ APP = module.exports = {
const pathname = myURL.pathname.toLowerCase(); const pathname = myURL.pathname.toLowerCase();
const method = req.method.toUpperCase(); const method = req.method.toUpperCase();
const ip = req.socket.remoteAddress.replace('::ffff:', ''); const ip = req.socket.remoteAddress.replace('::ffff:', '');
APP.RegistrarLog('6|REGISTRO|📥 Recepcion IP: ' + ip + ' por ' + method + ' ruta ' + pathname);
APP.RegistrarLog('0|CORE| 📥 Recepcion de datos origen ' + ip + ' metodo ' + method + ' ruta ' + pathname);
//Para detener el servidor //Para detener el servidor
if (pathname === '/detener_servidor') { if (pathname === '/detener_servidor') {
res.writeHead(200, { 'Content-Type': 'text/plain' }); res.writeHead(200, { 'Content-Type': 'text/plain' });
@ -298,11 +295,14 @@ APP = module.exports = {
APP.RegistrarLog('0|CORE| 🔴 Servidor detenido por botón'); APP.RegistrarLog('0|CORE| 🔴 Servidor detenido por botón');
server.close(() => { server.close(() => {
}); });
return false;
} }
//Para recibir la información de la estacion WIFI/IP //Para recibir la información de la estacion WIFI/IP
if (pathname === RUTA) { if (pathname === RUTA) {
if (method === 'GET') {
let Vector = Object.fromEntries(myURL.searchParams.entries()); // Comunes para ambos metodos
// se convierte la fecha a la UTC parametrizada // se convierte la fecha a la UTC parametrizada
var d = new Date(); var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * 60000); var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
@ -347,13 +347,41 @@ APP = module.exports = {
minutost = null; minutost = null;
segundot = null; segundot = null;
dbutc = null; dbutc = null;
const Etiquetas = [
'Fecha local',
'Fecha ISO',
'Temperatura exterior (°C)',
'Temperatura interior (°C)',
'Humedad exterior (%)',
'Humedad interior (%)',
'Luz (kLux)',
'Radiación UV',
'Viento (km/h)',
'Ráfaga (km/h)',
'Dirección viento (°)',
'Dirección viento (nombre)',
'Presión absoluta (hpa)',
'Presión relativa (hpa)',
'Lluvia total (mm)',
'Punto de rocío (°C)',
'Fecha UTC',
'Batería Baja (0-No/1-Si)'
];
if (method === 'GET') {
let Vector = Object.fromEntries(myURL.searchParams.entries());
//APP.RegistrarLog(`5|VECTOR|${JSON.stringify(Vector)}`);
let TemperaturaExternaC = ((parseFloat(Vector['tempf']) - 32) * 5 / 9).toFixed(2); let TemperaturaExternaC = ((parseFloat(Vector['tempf']) - 32) * 5 / 9).toFixed(2);
let TemperaturaInternaC = ((parseFloat(Vector['indoortempf']) - 32) * 5 / 9).toFixed(2); let TemperaturaInternaC = ((parseFloat(Vector['indoortempf']) - 32) * 5 / 9).toFixed(2);
let vientoEnKm = (parseFloat(Vector['windspeedmph']) * 1.60934); let vientoEnKm = (parseFloat(Vector['windspeedmph']) * 1.60934).toFixed(2);
let rafagaEnKm = (parseFloat(Vector['windgustmph']) * 1.60934); let rafagaEnKm = (parseFloat(Vector['windgustmph']) * 1.60934).toFixed(2);
let luxerIntencidad = Vector['solarradiation'] * 683; // luxerIntencidad en Luxer let luxerIntencidad = Vector['solarradiation'] * 683; // luxerIntencidad en Luxer
let PresionR = (parseFloat(Vector['baromin']) * 33.8639).toFixed(2); let PresionR = (parseFloat(Vector['baromin']) * 33.8639).toFixed(2);
let PresionA = (parseFloat(Vector['absbaromin']) * 33.8639).toFixed(2); let PresionA = (parseFloat(Vector['absbaromin']) * 33.8639).toFixed(2);
// calculo del punto de rocio
let punto_de_rocio = ((parseFloat(Vector['dewptf']) - 32) * 5 / 9).toFixed(2);
punto_de_rocio = (Math.round(punto_de_rocio * 100)) / 100;
let x = Vector['winddir']; let x = Vector['winddir'];
// direccion del viento por nombre // direccion del viento por nombre
switch (true) { switch (true) {
@ -385,7 +413,7 @@ APP = module.exports = {
VientoDireccion = 'N/A'; VientoDireccion = 'N/A';
} }
x = null; x = null;
let lluviaTotalmm = (parseFloat(Vector['totalrainin']) * 25.4).toFixed(2);; // conversion a mm
let DatosRecolectados = [ let DatosRecolectados = [
fecha, // *0: Fecha local fecha, // *0: Fecha local
fechaISO, // *1: Fecha ISO fechaISO, // *1: Fecha ISO
@ -395,47 +423,25 @@ APP = module.exports = {
parseFloat(Vector['indoorhumidity']), // *5: Humedad interior parseFloat(Vector['indoorhumidity']), // *5: Humedad interior
luxerIntencidad, // *6: Luz Intencidad en Klux luxerIntencidad, // *6: Luz Intencidad en Klux
parseFloat(Vector['UV']), // *7: Radiación UV parseFloat(Vector['UV']), // *7: Radiación UV
vientoEnKm, // *8: Velocidad viento parseFloat(vientoEnKm), // *8: Velocidad viento
rafagaEnKm, // *9: Ráfaga parseFloat(rafagaEnKm), // *9: Ráfaga
parseFloat(Vector['winddir']), // *10: Dirección viento (grados) parseFloat(Vector['winddir']), // *10: Dirección viento (grados)
VientoDireccion, // *11: Dirección viento (nombre) VientoDireccion, // *11: Dirección viento (nombre)
parseFloat(PresionA), // *12: Presión absoluta hpa parseFloat(PresionA), // *12: Presión absoluta hpa
parseFloat(PresionR), // *13: Presión relativa hpa parseFloat(PresionR), // *13: Presión relativa hpa
parseFloat(Vector['totalrainin']), // *14: Lluvia acumulada parseFloat(lluviaTotalmm), // *14: Lluvia acumulada mm
parseFloat(Vector['dewptf']), // *15: Punto de rocío punto_de_rocio, // *15: Punto de rocío
fechaUTC, // *16: UTC desde 'dateutc' fechaUTC, // *16: UTC desde 'dateutc'
Vector['lowbatt'] // *17: Estado batería Vector['lowbatt'] // *17: Estado batería
]; ];
const Etiquetas = [
'Fecha local',
'Fecha ISO',
'Temperatura exterior (°C)',
'Temperatura interior (°C)',
'Humedad exterior (%)',
'Humedad interior (%)',
'Luz (kLux)',
'Radiación UV',
'Viento (km/h)',
'Ráfaga (km/h)',
'Dirección viento (°)',
'Dirección viento (nombre)',
'Presión absoluta (hpa)',
'Presión relativa (hpa)',
'Lluvia total (in)',
'Punto de rocío (°F)',
'Fecha UTC',
'Batería Baja (0-No/1-Si)'
];
// Se verifican cambios // Se verifican cambios
if (DatosRecolectadosAnterior.length < 1) { DatosRecolectadosAnterior = DatosRecolectados;} if (DatosRecolectadosAnterior.length < 1) { DatosRecolectadosAnterior = DatosRecolectados;}
let cambios = {}; let cambios = {};
let bandera_cambios = false; let bandera_cambios = false;
for (let i = 0; i < DatosRecolectados.length; i++) { for (let i = 0; i < DatosRecolectados.length; i++) {
if ( i === 0 || i === 1 || i === 16) continue; // ignorar índices 0, 1 y 16 que son fechas if ( i === 0 || i === 1 || i === 16) continue; // ignorar índices 0, 1 y 16 que son fechas
if (DatosRecolectados[i] !== DatosRecolectadosAnterior[i]) { if (DatosRecolectados[i] !== DatosRecolectadosAnterior[i]) {
bandera_cambios = true; bandera_cambios = true;
cambios[Etiquetas[i]] = { cambios[Etiquetas[i]] = {
valorAnterior: DatosRecolectadosAnterior[i], valorAnterior: DatosRecolectadosAnterior[i],
valorNuevo: DatosRecolectados[i] valorNuevo: DatosRecolectados[i]
@ -444,7 +450,7 @@ APP = module.exports = {
} }
//cambios = JSON.stringify(cambios, null, 2); //cambios = JSON.stringify(cambios, null, 2);
DatosRecolectados.forEach((dato, i) => { DatosRecolectados.forEach((dato, i) => {
APP.RegistrarLog(`5|REGISTRO|${i} - ${Etiquetas[i]}: ${dato}`); APP.RegistrarLog(`5|REGISTRO|🗃️ ${i} - ${Etiquetas[i]}: ${dato}`);
}); });
// ACA SE ENVIA AL VALIDADOR Y A LAS REDES CONFIGURADAS // ACA SE ENVIA AL VALIDADOR Y A LAS REDES CONFIGURADAS
var Datos = []; var Datos = [];
@ -463,29 +469,135 @@ APP = module.exports = {
} else { } else {
APP.Configuracion.Repeticiones = 0; APP.Configuracion.Repeticiones = 0;
APP.Configuracion.Estado_Val_Ant = errorvalidador[0]; APP.Configuracion.Estado_Val_Ant = errorvalidador[0];
APP.RegistrarLog('0|VALIDADOR|Datos recolectados incorrectos: ' + errorvalidador[1]); APP.RegistrarLog('0|VALIDADOR|⚠️ Datos recolectados incorrectos: ' + errorvalidador[1]);
Datos = null; Datos = null;
} }); } });
APP.Configuracion.EstadoSensores = DatosRecolectados[17]; APP.Configuracion.EstadoSensores = DatosRecolectados[17];
DatosRecolectadosAnterior = DatosRecolectados; // Guardar los datos recolectados para la proxima vez. DatosRecolectadosAnterior = DatosRecolectados; // Guardar los datos recolectados para la proxima vez.
TiempoActualRecolector(true); // para reiniciar el tiempo y sincronizar.
res.writeHead(200, { 'Content-Type': 'text/plain' }); res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Datos GET recibidos'); res.end('Datos GET recibidos');
//TERMINA EL METODO GET
} else if (method === 'POST' || method === 'PATCH') { } else if (method === 'POST' || method === 'PATCH') {
// COMIENZA EL MOTODO POST
let body = ''; let body = '';
req.on('data', chunk => { body += chunk.toString(); }); req.on('data', chunk => { body += chunk.toString(); });
req.on('end', () => { req.on('end', () => {
const formData = querystring.parse(body); // APP.RegistrarLog('5|REGISTRO|Datos formulario:'+body);
APP.RegistrarLog('Datos formulario:', formData); const params = new URLSearchParams(body);
const data = Object.fromEntries(params.entries());
// Se convierten las unidades necesarias
let TemperaturaExternaC = ((parseFloat(data['tempf']) - 32) * 5 / 9).toFixed(2);
let TemperaturaInternaC = ((parseFloat(data['tempinf']) - 32) * 5 / 9).toFixed(2);
let luxerIntencidad = params.get("solarradiation") * 683; // luxerIntencidad en Luxer
let vientoEnKm = (params.get('windspeedmph') * 1.60934).toFixed(2);;
let rafagaEnKm = (params.get('windgustmph') * 1.60934).toFixed(2);;
let PresionR = (parseFloat(params.get('baromabsin')) * 33.8639).toFixed(2);
let PresionA = (parseFloat(params.get('baromrelin')) * 33.8639).toFixed(2);
// calculo del punto de rocio
var punto_de_rocio = (Math.pow((params.get("humidity") / 100), 0.125)) * (112 - (-(0.9 * TemperaturaExternaC))) - (-(0.1 * TemperaturaExternaC)) - 112;
punto_de_rocio = (Math.round(punto_de_rocio * 100)) / 100;
let x = params.get("winddir");
// direccion del viento por nombre
switch (true) {
case x === 0:
VientoDireccion = 'Norte';
break;
case x > 0 && x < 90:
VientoDireccion = 'Nordeste';
break;
case x === 90:
VientoDireccion = 'Este';
break;
case x > 90 && x < 180:
VientoDireccion = 'Sudeste';
break;
case x === 180:
VientoDireccion = 'Sur';
break;
case x > 180 && x < 270:
VientoDireccion = 'Sudoeste';
break;
case x === 270:
VientoDireccion = 'Oeste';
break;
case x > 270 && x < 360:
VientoDireccion = 'Noroeste';
break;
default:
VientoDireccion = 'N/A';
}
x = null;
let lluviaTotalmm = (parseFloat(params.get('totalrainin')) * 25.4).toFixed(2); // conversion a mm
let DatosRecolectados = [
fecha, // *0: Fecha local
fechaISO, // *1: Fecha ISO
parseFloat(TemperaturaExternaC), // *2: Temperatura exterior
parseFloat(TemperaturaInternaC), // *3: Temperatura interior
parseFloat(params.get("humidity")), // *4: Humedad exterior
parseFloat(params.get("humidityin")), // *5: Humedad interior
luxerIntencidad, // *6: Luz Intencidad en Klux
parseFloat(params.get("uv")), // *7: Radiación UV
parseFloat(vientoEnKm), // *8: Velocidad viento
parseFloat(rafagaEnKm), // *9: Ráfaga
parseFloat(params.get("winddir")), // *10: Dirección viento (grados)
VientoDireccion, // *11: Dirección viento (nombre)
parseFloat(PresionA), // *12: Presión absoluta hpa
parseFloat(PresionR), // *13: Presión relativa hpa
parseFloat(lluviaTotalmm), // *14: Lluvia acumulada
punto_de_rocio, // *15: Punto de rocío
fechaUTC, // *16: UTC desde 'dateutc'
params.get('wh65batt') // *17: Estado batería
];
// Se verifican cambios
if (DatosRecolectadosAnterior.length < 1) { DatosRecolectadosAnterior = DatosRecolectados;}
let cambios = {};
let bandera_cambios = false;
for (let i = 0; i < DatosRecolectados.length; i++) {
if ( i === 0 || i === 1 || i === 16) continue; // ignorar índices 0, 1 y 16 que son fechas
if (DatosRecolectados[i] !== DatosRecolectadosAnterior[i]) {
bandera_cambios = true;
cambios[Etiquetas[i]] = {
valorAnterior: DatosRecolectadosAnterior[i],
valorNuevo: DatosRecolectados[i]
};
}
}
//cambios = JSON.stringify(cambios, null, 2);
DatosRecolectados.forEach((dato, i) => {
APP.RegistrarLog(`5|REGISTRO|🗃️ ${i} - ${Etiquetas[i]}: ${dato}`);
});
// ACA SE ENVIA AL VALIDADOR Y A LAS REDES CONFIGURADAS
var Datos = [];
Datos = ['validar', DatosRecolectados,cambios,bandera_cambios];
Validador.Registros(Datos, function (errorvalidador, estadovalidador)
{
if (estadovalidador === true) {
APP.Configuracion.Repeticiones += 1;
APP.Configuracion.RepeticionesConError = 0;
APP.Configuracion.TiempoMaximo = 0;
APP.Configuracion.TiempoFueraDeLinea = 0;
APP.Configuracion.FechaLanzadoTimeout = Date.now();
APP.Registro_Diario(Datos[1],cambios,bandera_cambios);
APP.Publicar_en_Redes();
Datos = null;
} else {
APP.Configuracion.Repeticiones = 0;
APP.Configuracion.Estado_Val_Ant = errorvalidador[0];
APP.RegistrarLog('0|VALIDADOR|⚠️ Datos recolectados incorrectos: ' + errorvalidador[1]);
Datos = null;
} });
APP.Configuracion.EstadoSensores = DatosRecolectados[17];
DatosRecolectadosAnterior = DatosRecolectados; // Guardar los datos recolectados para la proxima vez.
APP.TiempoActualRecolector(true); // para reiniciar el tiempo y sincronizar.
res.writeHead(200, { 'Content-Type': 'text/plain' }); res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Datos POST/PATCH recibidos'); res.end('Datos POST/PATCH recibidos');
}); });
} else { } else {
res.writeHead(405, { 'Content-Type': 'text/plain' }); APP.RegistrarLog('0|RECOLETOR_IP|⚠️ Dato Recibido pero metodo no encontrada: ' + method);
res.end('Método no permitido');
} }
} else { } else {
res.writeHead(404, { 'Content-Type': 'text/plain' }); APP.RegistrarLog('0|RECOLETOR_IP|⚠️ Dato Recibido pero ruta no encontrada: ' + pathname);
res.end('Ruta no encontrada');
} }
}); });
@ -511,7 +623,8 @@ APP = module.exports = {
} }
}); });
}else{ }else{ // RECOLECTOR USB
APP.RegistrarLog('0|CORE|Estableciendo Time Zone UTC ' + configGeneralEMA.ConfGeneral.UTC); APP.RegistrarLog('0|CORE|Estableciendo Time Zone UTC ' + configGeneralEMA.ConfGeneral.UTC);
APP.RegistrarLog('0|CORE|Verificando Estado de la EMA...'); APP.RegistrarLog('0|CORE|Verificando Estado de la EMA...');
APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion; APP.Configuracion.TiempoContinuo = configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion;
@ -597,7 +710,7 @@ APP = module.exports = {
if (APP.Configuracion.BanderaPendientes === 0) { // Pregunto si no esta destanqueando if (APP.Configuracion.BanderaPendientes === 0) { // Pregunto si no esta destanqueando
APP.Configuracion.TanquePendiente = []; APP.Configuracion.TanquePendiente = [];
APP.Configuracion.BanderaPendientes = 1; APP.Configuracion.BanderaPendientes = 1;
APP.RegistrarLog('3|PENDIENTE|Verificando el Tanque de Pendientes.'); APP.RegistrarLog('3|PENDIENTE|🛢️ Verificando el tanque.');
try { try {
fs.readFile('./logs/TanquePendientes.log', { fs.readFile('./logs/TanquePendientes.log', {
encoding: 'utf8', encoding: 'utf8',
@ -605,13 +718,13 @@ APP = module.exports = {
}, function (err, data) { }, function (err, data) {
try { try {
if (err) { if (err) {
APP.RegistrarLog('1|ERROR: Intentando destanquear los registros prendientes:'); APP.RegistrarLog('1|ERROR|🛢️🔴 Intentando destanquear los registros.');
APP.Configuracion.BanderaPendientes = 0; APP.Configuracion.BanderaPendientes = 0;
} }
if (data.length < 10) { if (data.length < 10) {
APP.Configuracion.CantidadPendientes = 0; APP.Configuracion.CantidadPendientes = 0;
APP.Configuracion.BanderaPendientes = 0; APP.Configuracion.BanderaPendientes = 0;
APP.RegistrarLog('3|PENDIENTE|Tanque PENDIENTES vacio.'); APP.RegistrarLog('3|PENDIENTE|🛢️ Tanque vacio.');
} else { } else {
Guardar = []; Guardar = [];
var EnviarPendientes = []; var EnviarPendientes = [];
@ -619,7 +732,7 @@ APP = module.exports = {
var CantRegistros = Pendientes.length; var CantRegistros = Pendientes.length;
var intentos = 0; var intentos = 0;
APP.Configuracion.CantidadPendientes = CantRegistros; APP.Configuracion.CantidadPendientes = CantRegistros;
APP.RegistrarLog('3|PENDIENTE|Cantidad Registros en Pendientes: ' + CantRegistros); APP.RegistrarLog('3|PENDIENTE|🛢️ Cantidad Registros en Pendientes: ' + CantRegistros);
for (var i = 0, t = CantRegistros; i < t; ++i) { for (var i = 0, t = CantRegistros; i < t; ++i) {
EnviarPendientes[0] = [Pendientes[i].TipoRed, Pendientes[i].Usuario, Pendientes[i].Password, Pendientes[i].Server, Pendientes[i].Puerto, Pendientes[i].Ruta, Pendientes[i].Llave_W, Pendientes[i].Nombre, 'PENDIENTE']; EnviarPendientes[0] = [Pendientes[i].TipoRed, Pendientes[i].Usuario, Pendientes[i].Password, Pendientes[i].Server, Pendientes[i].Puerto, Pendientes[i].Ruta, Pendientes[i].Llave_W, Pendientes[i].Nombre, 'PENDIENTE'];
EnviarPendientes[1] = Pendientes[i].registro; EnviarPendientes[1] = Pendientes[i].registro;
@ -629,7 +742,7 @@ APP = module.exports = {
Redes.EviarRedesMeteorologicas(versionEMA, EnviarPendientes, function (red, estadored, errorRedes, idRed, registro) { Redes.EviarRedesMeteorologicas(versionEMA, EnviarPendientes, function (red, estadored, errorRedes, idRed, registro) {
var RegistroEnviado = JSON.parse(registro); var RegistroEnviado = JSON.parse(registro);
if (estadored === 'ERROR') { // si falla el destanqueo if (estadored === 'ERROR') { // si falla el destanqueo
APP.RegistrarLog('3|PENDIENTE|Error no se pudo publicar la Red : ' + red + ' - Estado:' + estadored); APP.RegistrarLog('3|PENDIENTE|🛢️🔴 Error no se pudo publicar la Red : ' + red + ' - Estado:' + estadored);
var Pendiente = { var Pendiente = {
idRed: RegistroEnviado[2], idRed: RegistroEnviado[2],
TipoRed: RegistroEnviado[0][0], TipoRed: RegistroEnviado[0][0],
@ -649,7 +762,7 @@ APP = module.exports = {
if (APP.Configuracion.CantidadPendientes < 0) { if (APP.Configuracion.CantidadPendientes < 0) {
APP.Configuracion.CantidadPendientes = 0; APP.Configuracion.CantidadPendientes = 0;
} }
APP.RegistrarLog('0|PENDIENTE_PUB|Fecha Registro:' + RegistroEnviado[1].fecha + ' - Red Publicada: ' + red + ' - Estado:' + estadored); APP.RegistrarLog('0|RED|🌐🛢️ Red Publicada Tanque:' + red + '- Fecha Registro:' + RegistroEnviado[1].fecha + ' - Estado:' + estadored);
} }
}); // CALLBACK ENVIAR RED }); // CALLBACK ENVIAR RED
} else { } else {
@ -704,7 +817,7 @@ APP = module.exports = {
autoClose: true autoClose: true
}, function (err) { }, function (err) {
if (err) { if (err) {
APP.RegistrarLog('1|ERROR: Guardando registro de prendientes de Ema Center en archivo :' + err); APP.RegistrarLog('1|ERROR|🔴 Guardando registro de prendientes de Ema Center en archivo :' + err);
} }
}); });
} else { } else {
@ -713,7 +826,7 @@ APP = module.exports = {
autoClose: true autoClose: true
}, function (err) { }, function (err) {
if (err) { if (err) {
APP.RegistrarLog('1|ERROR: Guardando registro de prendientes de Ema Center en archivo :' + err); APP.RegistrarLog('1|ERROR|🔴 Guardando registro de prendientes de Ema Center en archivo :' + err);
} }
}); });
} }
@ -756,9 +869,9 @@ APP = module.exports = {
"error": errorRedes "error": errorRedes
}; };
APP.Configuracion.UltimoPublicado[idRed] = RegistroPublicado; APP.Configuracion.UltimoPublicado[idRed] = RegistroPublicado;
APP.RegistrarLog('3|RED|Red No Publicada: ' + red + ' - Estado:' + estadored + ' ' + errorRedes); APP.RegistrarLog('3|RED|🌐🔴 Red No Publicada: ' + red + ' - Estado:' + estadored + ' ' + errorRedes);
if ((red === 'emacenter') || (red === 'emacentergugler')) { if ((red === 'emacenter') || (red === 'emacentergugler')) {
APP.RegistrarLog('0|PENDIENTE_ALM|Se almaceno en el tanque de pendientes red EmaCenter: ' + RegistroEnviado[0][7]); APP.RegistrarLog('0|PENDIENTE|🛢️ Se almaceno registro en el tanque de pendientes: ' + RegistroEnviado[0][7]);
RegistroEnviado[1].tanque = true; RegistroEnviado[1].tanque = true;
var PendienteTemp = { var PendienteTemp = {
idRed: RegistroEnviado[2], idRed: RegistroEnviado[2],
@ -807,7 +920,7 @@ APP = module.exports = {
} }
} }
APP.Configuracion.UltimoPublicado[idRed] = RegistroPublicado; APP.Configuracion.UltimoPublicado[idRed] = RegistroPublicado;
APP.RegistrarLog('3|RED|Red Publicada: ' + red + ' - Estado:' + estadored); APP.RegistrarLog('3|RED|🌐 Red Publicada: ' + red + ' - Estado:' + estadored);
} }
}); // CALLBACK ENVIAR RED }); // CALLBACK ENVIAR RED
} else { } else {
@ -923,12 +1036,12 @@ APP = module.exports = {
} else { } else {
var DepurarLog = false; var DepurarLog = false;
if (data.length < 10) { if (data.length < 10) {
APP.RegistrarLog('3|ARCHIVO|Tanque diario vacio.'); APP.RegistrarLog('8|ARCHIVO|🗄️ Tanque diario vacio.');
} else { } else {
try { try {
var RegistroDiario = JSON.parse(data); var RegistroDiario = JSON.parse(data);
var CantRegistros = RegistroDiario.length; var CantRegistros = RegistroDiario.length;
APP.RegistrarLog('8|ARCHIVO|Cantidad registros diarios: ' + CantRegistros); APP.RegistrarLog('8|ARCHIVO|🗄️ Cantidad registros diarios: ' + CantRegistros);
var RegistroNuevoDia = Datos[0].substring(0, 2); var RegistroNuevoDia = Datos[0].substring(0, 2);
var RegistroNuevoHora = Datos[0].substring(11, 13); var RegistroNuevoHora = Datos[0].substring(11, 13);
var RegistroNuevoMinuto = Datos[0].substring(14, 15); var RegistroNuevoMinuto = Datos[0].substring(14, 15);
@ -1052,9 +1165,9 @@ APP = module.exports = {
if (LLuviaAcumuladaMinutos > 0) { LluviaActual = LLuviaAcumuladaMinutos; } else { LLuviaAcumuladaMinutos = 0; LluviaActual = 0; } if (LLuviaAcumuladaMinutos > 0) { LluviaActual = LLuviaAcumuladaMinutos; } else { LLuviaAcumuladaMinutos = 0; LluviaActual = 0; }
if (LLuviaAcumuladaHora < 0) { LLuviaAcumuladaHora = 0; } if (LLuviaAcumuladaHora < 0) { LLuviaAcumuladaHora = 0; }
if (LLuviaAcumuladaDia < 0) { LLuviaAcumuladaDia = 0; } if (LLuviaAcumuladaDia < 0) { LLuviaAcumuladaDia = 0; }
APP.RegistrarLog('5|REGISTRO|Calculado - Lluvia Hora: ' + LLuviaAcumuladaHora.toFixed(2)); APP.RegistrarLog('5|REGISTRO|🌧️ Calculado - Lluvia Hora: ' + LLuviaAcumuladaHora.toFixed(2));
APP.RegistrarLog('5|REGISTRO|Calculado - Lluvia Actual: ' + LLuviaAcumuladaMinutos.toFixed(2)); APP.RegistrarLog('5|REGISTRO|🌧️ Calculado - Lluvia Actual: ' + LLuviaAcumuladaMinutos.toFixed(2));
APP.RegistrarLog('5|REGISTRO|Calculado - Lluvia Dia: ' + LLuviaAcumuladaDia.toFixed(2)); APP.RegistrarLog('5|REGISTRO|🌧️ Calculado - Lluvia Dia: ' + LLuviaAcumuladaDia.toFixed(2));
var RegistroJSON = { var RegistroJSON = {
fecha: Datos[0], fecha: Datos[0],
fechaISO: Datos[1], fechaISO: Datos[1],
@ -1170,18 +1283,18 @@ APP = module.exports = {
d = null; d = null;
if (recolector.status() === true) { if (recolector.status() === true) {
if (APP.Configuracion.Repeticiones > 1) APP.RegistrarLog('8|LECTURA|Inicio Lectura'); if (APP.Configuracion.Repeticiones > 1) APP.RegistrarLog('8|LECTURA|Inicio Lectura');
APP.RegistrarLog('8|REGISTRO|Estado: online (' + APP.Configuracion.RepeticionesConError + ')'); APP.RegistrarLog('8|REGISTRO|🎛️ Estado: online (' + APP.Configuracion.RepeticionesConError + ')');
APP.RegistrarLog('8|REGISTRO|Fecha: ' + fechac); APP.RegistrarLog('8|REGISTRO|🎛️ Fecha: ' + fechac);
APP.RegistrarLog('8|REGISTRO|Tiempo Recolección: ' + APP.Configuracion.TiempoContinuo); APP.RegistrarLog('8|REGISTRO|🎛️ Tiempo Recolección: ' + APP.Configuracion.TiempoContinuo);
APP.RegistrarLog('8|REGISTRO|Cant. Lect. sin corte: ' + APP.Configuracion.Repeticiones); APP.RegistrarLog('8|REGISTRO|🎛️ Cant. Lect. sin corte: ' + APP.Configuracion.Repeticiones);
//Se busca un registro usb (PROMESA - resultado(registro,cambios, true o false(si hay cambios)) //Se busca un registro usb (PROMESA - resultado(registro,cambios, true o false(si hay cambios))
recolector.Recolectar().then((resultado)=> recolector.Recolectar().then((resultado)=>
{ {
//APP.RegistrarLog(resultado[1]); //APP.RegistrarLog(resultado[1]);
var datosRecolectados = resultado[0]; var datosRecolectados = resultado[0];
if ((APP.Configuracion.RepeticionesConError) > APP.Configuracion.Cantidad_No_Lectura) { if ((APP.Configuracion.RepeticionesConError) > APP.Configuracion.Cantidad_No_Lectura) {
APP.RegistrarLog('0|CORE|IMPORTANTE: No se puede leer la EMA por USB. Supero la Cantidad Máxima de No Lectura definida.'); APP.RegistrarLog('0|CORE|⚠️ IMPORTANTE: No se puede leer la EMA por USB. Supero la Cantidad Máxima de No Lectura definida.');
APP.RegistrarLog('0|CORE|IMPORTANTE: Supero la Cantidad Máxima de No Lectura definida.'); APP.RegistrarLog('0|CORE|⚠️ IMPORTANTE: Supero la Cantidad Máxima de No Lectura definida.');
throw new Error('NolecturaUSB'); throw new Error('NolecturaUSB');
} }
if (typeof datosRecolectados !== 'undefined') if (typeof datosRecolectados !== 'undefined')
@ -1206,7 +1319,7 @@ APP = module.exports = {
} else { } else {
APP.Configuracion.Repeticiones = 0; APP.Configuracion.Repeticiones = 0;
APP.Configuracion.Estado_Val_Ant = errorvalidador[0]; APP.Configuracion.Estado_Val_Ant = errorvalidador[0];
APP.RegistrarLog('0|VALIDADOR|Datos recolectados incorrectos: ' + errorvalidador[1]); APP.RegistrarLog('0|VALIDADOR|⚠️ Datos recolectados incorrectos: ' + errorvalidador[1]);
APP.Configuracion.FechaLanzadoTimeout = Date.now(); APP.Configuracion.FechaLanzadoTimeout = Date.now();
APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, APP.Configuracion.TiempoContinuo * 1000)); APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, APP.Configuracion.TiempoContinuo * 1000));
Datos = null; Datos = null;
@ -1214,7 +1327,7 @@ APP = module.exports = {
}); });
Datos = null; Datos = null;
} else { } else {
APP.RegistrarLog('0|CORE|Sincronizando.'); APP.RegistrarLog('0|CORE|⏳ Sincronizando.');
APP.Configuracion.Repeticiones = 0; APP.Configuracion.Repeticiones = 0;
APP.Configuracion.RepeticionesConError = 0; APP.Configuracion.RepeticionesConError = 0;
APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, 1000)); APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, 1000));
@ -1226,15 +1339,15 @@ APP = module.exports = {
APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, 5000)); APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Continuo, 5000));
} }
} else { } else {
APP.RegistrarLog('0|CORE|Recolector detenido.'); APP.RegistrarLog('0|CORE|⏹️ Recolector detenido.');
APP.Configuracion.RunTime = 0; APP.Configuracion.RunTime = 0;
} }
} catch (ex) { } catch (ex) {
APP.RegistrarLog('0|EXCEP|Información de la excepción: -> ' + ex + ''); APP.RegistrarLog('0|EXCEP|💥 Información de la excepción: -> ' + ex + '');
APP.Configuracion.Errores = 'EXCEP: Información de la excepción: -> ' + ex; APP.Configuracion.Errores = 'EXCEP: Información de la excepción: -> ' + ex;
var tiempo = (APP.Configuracion.TiempoMaximo + APP.Configuracion.TiempoContinuo) * 1000; var tiempo = (APP.Configuracion.TiempoMaximo + APP.Configuracion.TiempoContinuo) * 1000;
APP.Configuracion.TiempoFueraDeLinea += tiempo; APP.Configuracion.TiempoFueraDeLinea += tiempo;
APP.RegistrarLog('0|EXCEP|Se espera ' + (tiempo / 1000) + ' segundos y se prueba conectar nuevamente ....'); APP.RegistrarLog('0|EXCEP|💥 Se espera ' + (tiempo / 1000) + ' segundos y se prueba conectar nuevamente ....');
APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Conectar, tiempo)); APP.Configuracion.IdsSetTimeouts.push(setTimeout(APP.Conectar, tiempo));
tiempo = null; tiempo = null;
} }
@ -1246,9 +1359,9 @@ APP = module.exports = {
var parametros = process.argv; // Se lee el parametro var parametros = process.argv; // Se lee el parametro
if (parametros.indexOf('console') === -1) { if (parametros.indexOf('console') === -1) {
// No se realiza nada ya que se tiene que iniciar desde el aplicativo // No se realiza nada ya que se tiene que iniciar desde el aplicativo
APP.RegistrarLog('0|CORE|Se inició el aplicativo EmaLibre gráfico o Web.'); APP.RegistrarLog('0|CORE|⏳ Iniciando Ema Libre en Modo gráfico o Web.');
} else { } else {
APP.Conectar(); APP.Conectar();
APP.RegistrarLog('0|CORE|Iniciando Ema Libre en Modo Consola!!!.'); APP.RegistrarLog('0|CORE|⏳ Iniciando Ema Libre en Modo Consola!!!.');
} }

View File

@ -82,11 +82,11 @@ function RegistrarLog (reg, depurar) {
try { try {
RegistrarLog('0|CORE|Buscando Modulo USB para el S.O - ' + PlataformaFinal); RegistrarLog('0|CORE|🕵️. Buscando Modulo USB para el S.O - ' + PlataformaFinal);
var HID = require('node-hid'); var HID = require('node-hid');
RegistrarLog("0|CORE|Modulo node-hid cargado correctamente."); RegistrarLog("0|CORE|✅ Modulo node-hid cargado correctamente.");
} catch (e) { } catch (e) {
RegistrarLog('0|ERROR|No se pudo levantar el modulo node hid para su plataforma. ' + PlataformaFinal); RegistrarLog('0|ERROR|⚠️ No se pudo levantar el modulo node hid para su plataforma. ' + PlataformaFinal);
} }
// CODIGO DEL RECOLECTOR DE DATOS // CODIGO DEL RECOLECTOR DE DATOS

View File

@ -73,7 +73,7 @@ var FechaUltimoPublicadoWindy = "S/D";
if (!(this instanceof WINDY)) return new WINDY(ID, PASSWORD); if (!(this instanceof WINDY)) return new WINDY(ID, PASSWORD);
var payload = { var payload = {
station: PASSWORD || '' station: PASSWORD || 0
}; };
this.setObservations = function () { this.setObservations = function () {
@ -191,6 +191,7 @@ var FechaUltimoPublicadoWindy = "S/D";
}); });
server.path = server.fijo; server.path = server.fijo;
server.path += '?' + queryString.join('&'); server.path += '?' + queryString.join('&');
//APP.RegistrarLog('5|WINDY| GET:'+server.path);
var request = http.request(server, function (response) { var request = http.request(server, function (response) {
var message = ''; var message = '';
response.on('data', function (chunk) { response.on('data', function (chunk) {
@ -198,25 +199,40 @@ var FechaUltimoPublicadoWindy = "S/D";
}); });
response.on('end', function () { response.on('end', function () {
var result = message.trim(); var result = message.trim(); // cuerpo de respuesta (texto)
if (result === 'SUCCESS') { var status = response.statusCode; // código HTTP real
// Registro publicado correctamente //APP.RegistrarLog(`5|WINDY| RESPUESTA [${status}]: ${result}`);
// ✅ Caso 200: todo OK
if (status === 200) {
FechaUltimoPublicadoWindy = fecha; FechaUltimoPublicadoWindy = fecha;
that.resetObservations(); that.resetObservations();
callback(null, result); callback(null, result);
} else { return;
}
if (result.substr(result, 8) == 'SUCCESS ' ) // ⚠️ Caso 400: congestión (Windy busy)
{ // Esta Congestionada if (status === 400) {
// Verificamos si la respuesta incluye "error" o algo similar
let detalle = "";
try {
const parsed = JSON.parse(result);
detalle = parsed.error || parsed.message || result;
} catch (e) {
detalle = result;
}
// APP.RegistrarLog(`5|WINDY| CONGESTION: ${detalle}`);
that.resetObservations(); that.resetObservations();
callback(null, [429, FechaUltimoPublicadoWindy]); callback(null, [429, FechaUltimoPublicadoWindy]);
} else { return;
// Otro error. }
var detalle_error = result.substr(result, 100); // ❌ Otros errores
var detalle_error = result.substring(0, 200);
//APP.RegistrarLog(`5|WINDY| ERROR (${status}): ${detalle_error}`);
callback(new Error(detalle_error), null); callback(new Error(detalle_error), null);
}
}
}); });
}); });
request.on('socket', function (socket) { request.on('socket', function (socket) {

View File

@ -106,11 +106,8 @@ async function EstadoMenuInicio()
$('#inombre').html(configGeneralEMA.ConfGeneral.NombreEstacion); $('#inombre').html(configGeneralEMA.ConfGeneral.NombreEstacion);
$('#botoniniciar').attr("disabled",true); $('#botoniniciar').attr("disabled",true);
$('#botondetener').attr("disabled",true) $('#botondetener').attr("disabled",true)
if(configGeneralEMA.ConfGeneral.NombreEstacion != ''){$("#img_nombre").attr("src",icono_control_true);}else{$("#img_nombre").attr("src",icono_control_neutro);}
$('#iso').html(plataforma + " (" + arquitectura + ")"); $('#iso').html(plataforma + " (" + arquitectura + ")");
if(plataforma != ''){$("#img_so").attr("src",icono_control_true);}else{$("#img_so").attr("src",icono_control_false);}
$('#imodo').html(configGeneralEMA.ConfGeneral.Modo); $('#imodo').html(configGeneralEMA.ConfGeneral.Modo);
if(configGeneralEMA.ConfGeneral.Modo != ''){$("#img_modo").attr("src",icono_control_true);}else{$("#img_modo").attr("src",icono_control_false);}
if(configGeneralEMA.ConfGeneral.Modo != 'Visor') // Se consulta el modo (Recolector o Visor) if(configGeneralEMA.ConfGeneral.Modo != 'Visor') // Se consulta el modo (Recolector o Visor)
{ {
if(configGeneralEMA.ConfGeneral.Modo === 'Recolector_USB') // Modo Recolector USB if(configGeneralEMA.ConfGeneral.Modo === 'Recolector_USB') // Modo Recolector USB
@ -348,7 +345,8 @@ async function ClimaActual()
{ {
// Se obtiene el estado actual del clima // Se obtiene el estado actual del clima
var SALIDA_ENTRADA = "";var LLUEVE = 0; var NOCHE_DIA = 1; var SALIDA_ENTRADA = "";var LLUEVE = 0; var NOCHE_DIA = 1;
if( UltimoReg.lloviendo > 0){LLUEVE = '1'; }else{LLUEVE = '0';} // LLUEVE? //if( UltimoReg.lloviendo > 0){LLUEVE = '1'; }else{LLUEVE = '0';} // LLUEVE?
LLUEVE = (UltimoReg?.lloviendo ?? 0) > 0 ? '1' : '0';
if( UltimoReg.luxer_intencidad > 0){ NOCHE_DIA = '1'; }else{NOCHE_DIA = '0';} // DIA o NOCHE? if( UltimoReg.luxer_intencidad > 0){ NOCHE_DIA = '1'; }else{NOCHE_DIA = '0';} // DIA o NOCHE?
if( (UltimoReg.luxer_intencidad > UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_1.gif';} // ALBA? if( (UltimoReg.luxer_intencidad > UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_1.gif';} // ALBA?
if( (UltimoReg.luxer_intencidad < UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_0.gif';} // OCASO? if( (UltimoReg.luxer_intencidad < UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_0.gif';} // OCASO?
@ -602,12 +600,12 @@ function ListarRedes()
{ {
TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-success'>SI</span></td><td><span class='badge badge-danger'>NO</span></td><td><span class='badge badge-default'>N/A</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>"; TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-success'>SI</span></td><td><span class='badge badge-danger'>NO</span></td><td><span class='badge badge-default'>N/A</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>";
if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"}; if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"};
TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option></select></td></tr>"; TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option><option value='SitioOficial'>Sitio Oficial</option></select></td></tr>";
}else{ }else{
if(Publicar[i].Llave_W != ''){var tienellave = "SI";}else{var tienellave ="NO";} if(Publicar[i].Llave_W != ''){var tienellave = "SI";}else{var tienellave ="NO";}
TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-default'>N/A</span></td><td><span class='badge badge-success'>"+tienellave+"</span></td><td><span class='badge badge-default'>"+(Publicar[i].Puerto || "N/A")+"</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>"; TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-default'>N/A</span></td><td><span class='badge badge-success'>"+tienellave+"</span></td><td><span class='badge badge-default'>"+(Publicar[i].Puerto || "N/A")+"</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>";
if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"}; if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"};
TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option></select></td></tr>"; TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option><option value='SitioOficial'>Sitio Oficial</option></select></td></tr>";
} }
} }
TablaHTML += "</table>"; TablaHTML += "</table>";
@ -657,28 +655,32 @@ function MenuRedes(red)
switch ($('#Red_activa_'+red).val()) { switch ($('#Red_activa_'+red).val()) {
case 'Eliminar': case 'Eliminar':
// SE PREGUNTA SI ESTA SEGURO // SE PREGUNTA SI ESTA SEGURO
HABLA(0,'¿Esta seguro de eliminar<br> la red <b>'+ configGeneralEMA.ConfPublicador[red].Nombre +'</b>?',"success");
$(document).off('click', '.notifyjs-foo-base .no'); // Se elimina el evento si existe $(document).off('click', '.notifyjs-foo-base .no'); // Se elimina el evento si existe
$(document).off('click', '.notifyjs-foo-base .yes'); // Se elimina el evento si existe $(document).off('click', '.notifyjs-foo-base .yes'); // Se elimina el evento si existe
HABLA(0,'¿Esta seguro de eliminar<br> la red <b>'+ configGeneralEMA.ConfPublicador[red].Nombre +'</b>?',"success");
$.notify.addStyle('foo', { $.notify.addStyle('foo', {
html: html:
"<div style='background:#ff00003b;'>" +
"<div class='clearfix'>" + "<div class='clearfix'>" +
"<div class='title' data-notify-html='title'/>" + "<div class='title' data-notify-html='title'></div>" +
"<div class='buttons'>" + "<div class='buttons' style='margin-top:10px; text-align:center;width:100%;'>" +
"<button class='no'>NO</button><button class='yes' data-notify-text='button'></button>" + "<button class='btn btn-secondary btn-sm no'>Cancelar</button> " +
"<button class='btn btn-danger btn-sm yes'>Confirmar</button>" +
"</div>" +
"</div>" + "</div>" +
"</div>" "</div>"
}); });
//PREGUNTA
// --- Mostrar notificación ---
$("#carpincho_img").notify({ $("#carpincho_img").notify({
title: '¿Esta seguro de eliminar la red '+ configGeneralEMA.ConfPublicador[red].Nombre +'?', title: '¿Está seguro de eliminar la red <b>' + configGeneralEMA.ConfPublicador[red].Nombre + '</b>?'
button: 'SI'
}, { }, {
position: "right middle", position: "right middle",
style: 'foo', style: 'foo',
autoHide: false, autoHide: false,
clickToHide: false clickToHide: false
}); });
$(document).on('click', '.notifyjs-foo-base .no', function() { $(document).on('click', '.notifyjs-foo-base .no', function() {
//RESPONDE NO //RESPONDE NO
ListarRedes(); ListarRedes();
@ -706,6 +708,51 @@ function MenuRedes(red)
break; break;
case 'Modificar': FormModificar(red); case 'Modificar': FormModificar(red);
break; break;
case 'SitioOficial':
let tipored = configGeneralEMA.ConfPublicador[red].TipoRed;
tipored = tipored.toLowerCase();
let url = '';
switch (tipored) {
case 'openweathermap':
url = 'https://openweathermap.org/';
break;
case 'wow':
url = 'https://wow.metoffice.gov.uk/';
break;
case 'windguru':
url = 'https://www.windguru.cz/';
break;
case 'windy':
url = 'https://www.windy.com/';
break;
case 'awekas':
url = 'https://www.awekas.at/';
break;
case 'wunderground':
url = 'https://www.wunderground.com/';
break;
case 'pws':
url = 'https://www.pwsweather.com/';
break;
case 'emacenter':
url = 'https://emacenter.gugler.com.ar/';
break;
case 'emacentergugler':
url = 'https://emacenter.gugler.com.ar/';
break;
default:
HABLA(0, "No se encontró el sitio oficial para la red '" + tipored + "'", "warn");
return;
}
if (url !== '') {
const openExternal = require('nw.gui').Shell.openExternal;
openExternal(url);
HABLA(0, "Abriendo sitio oficial de '" + tipored + "'.", "info");
}
ListarRedes();
break;
} }
} }
@ -1299,11 +1346,11 @@ async function MostrarTabla(DATOS,DIV,TABLA)
async function graficoEstadisticas() async function graficoEstadisticas()
{ {
// GRAFICO DEL TIEMPO CHARTJS // GRAFICO DEL TIEMPO CHARTJS
document.getElementById("grafico").style.display = "none"; document.getElementById("grafico").style.display = "none";
document.getElementById("actualizando").style.display = "block"; document.getElementById("actualizando").style.display = "block";
//Se genera el grafico
//Se genera el grafico normal
if(['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Modo)) // se comprueba el modo se encuentra en Recolector if(['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Modo)) // se comprueba el modo se encuentra en Recolector
{ {
@ -1376,266 +1423,60 @@ async function graficoEstadisticas()
var presionRel = RegistroDiarioConCambios.map(function(e) { return e.presion_relativa || 0;}); var presionRel = RegistroDiarioConCambios.map(function(e) { return e.presion_relativa || 0;});
var validacion = RegistroDiarioConCambios.map(function(e) { return (e.estado_validacion_ant) || 0;}); var validacion = RegistroDiarioConCambios.map(function(e) { return (e.estado_validacion_ant) || 0;});
var puntorocio = RegistroDiarioConCambios.map(function(e) { return e.punto_de_rocio || 0;}); var puntorocio = RegistroDiarioConCambios.map(function(e) { return e.punto_de_rocio || 0;});
// GRAFICO RESUMEN CON RGRAPH
var resumenLabels = [
'Temp.Ext', 'Hum.Ext', 'Temp.Int', 'Hum.Int', 'Viento', 'Lluvia', 'Pres.Rel', 'UV', 'Luxer', 'Pto.Rocío', 'Valid.'
];
var resumenData = [
tmp_Ext[tmp_Ext.length-1] || 0,
hum_Ext[hum_Ext.length-1] || 0,
tmp_Int[tmp_Int.length-1] || 0,
hum_Int[hum_Int.length-1] || 0,
vientos[vientos.length-1] || 0,
Lluvia[Lluvia.length-1] || 0,
presionRel[presionRel.length-1] || 0,
UV[UV.length-1] || 0,
Luxer[Luxer.length-1] || 0,
puntorocio[puntorocio.length-1] || 0,
validacion[validacion.length-1] || 0
];
//console.log(validacion); window._GraphInicioChart = new RGraph.Bar({
var totalErrores = 0; id: 'graph_inicio',
for(var i=0;i<validacion.length;i++) data: resumenData,
{ if(!isNaN(parseInt(validacion[i]),10)) totalErrores += parseInt(validacion[i],10);};
// Se genera grafico de resumen
new Chart(document.getElementById("graph_inicio"), {
type: 'bar',
data: {
labels: ["Registros Totales \n "+ CantRegistros, "Registros Distintos", "Pendientes Almacenado","Pendientes Publicados","Errores Detectados"],
datasets: [
{
label: "Resumen de Estadisticas",
backgroundColor: ["#3e95cd", "#28a745","#c45850","#48a745","#c42850"],
data: [CantRegistros,RegistroDiarioConCambios.length,CantiddPendientesAlmacenados, CantiddPendientesPublicados, totalErrores]
}
]
},
options: { options: {
showAllTooltips: true, colors: ['#1e90ff','#00b894','#fdcb6e','#e17055','#636e72','#00bfff','#6c5ce7','#fd79a8','#ffeaa7','#fab1a0','#636e72'],
hover: { backgroundGrid: true,
animationDuration: 0 xaxisLabels: resumenLabels,
}, yaxis: true,
animation: { yaxisLabelsCount: 5,
duration: 1, marginLeft: 50,
onComplete: function () { marginBottom: 60,
var chartInstance = this.chart, marginTop: 40,
ctx = chartInstance.ctx; marginRight: 20,
ctx.font = Chart.helpers.fontString('14', 'normal', Chart.defaults.global.defaultFontFamily); title: 'Resumen Últimos Valores',
ctx.fillStyle = 'white'; titleBold: true
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
ctx.fontColor = 'white';
this.data.datasets.forEach(function (dataset, i) {
var meta = chartInstance.controller.getDatasetMeta(i);
meta.data.forEach(function (bar, index) {
var data = dataset.data[index];
ctx.fillText(data, bar._model.x, bar._model.y - 5);
});
});
} }
}, }).draw();
legend: { // document.getElementById("actualizando").style.display = "none";
display: false, //console.log("Grafico resumen generado con RGraph.");
labels: { //console.table(resumenLabels);
display: false // console.table(resumenData);
}
},
title: {
display: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true,
fontColor: 'white'
},
}],
xAxes: [{
ticks: {
fontColor: 'white'
},
}]
}
}
});
RegistroDiarioTmp = null;CantRegistros=null;CantiddPendientesAlmacenados=null; CantiddPendientesPublicados = null;RegistroDiarioConCambios = null;
//Se genera el grafico
Grafico = new Chart(document.getElementById("graph"), {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Temp.Ext',
data: tmp_Ext,
pointRadius:1,
// backgroundColor: ['rgba(200, 0, 0, 0.8)'],
borderColor: ['rgba(200,0,0,1)'],
borderWidth: 3
},
{
label: 'Hum.Ext',
data: hum_Ext,
pointRadius:0.2,
// backgroundColor: ['rgba(100,0,0, 0.8)'],
borderColor: ['rgba(100,0,100,1)'],
borderWidth: 3,
hidden: true,
},
{
label: 'Pto.Rocio',
data: puntorocio,
pointRadius:0.2,
// backgroundColor: ['rgba(100,100,0, 0.8)'],
borderColor: ['rgba(100,100,0,1)'],
borderWidth: 3,
hidden: true,
},
{
label: 'Temp.Int',
data: tmp_Int,
pointRadius:0.2,
//backgroundColor: ['rgba(100,100,100, 0.8)'],
borderColor: ['rgba(100,100,255,1)'],
borderWidth: 3,
hidden: true,
},
{
label: 'Hum.Int',
data: hum_Int,
pointRadius:0.2,
backgroundColor: ['rgba(100,180,0, 0.8)'],
borderColor: ['rgba(100,190,0,1)'],
borderWidth: 2,
hidden: true,
},
{
label: 'V.Raf',
data: vinetosRaf,
pointRadius:0.2,
// backgroundColor: ['rgba(255,80,220, 0.8)'],
borderColor: ['rgba(100,90,0,1)'],
borderWidth: 3,
hidden: true,
},
{
label: 'V.Vel',
data: vientos,
pointRadius:0.2,
backgroundColor: ['rgba(100,80,0, 1)'],
borderColor: ['rgba(100,90,0,1)'],
borderWidth: 0.2,
hidden: true,
},
{
label: 'UV',
data: UV,
pointRadius:0.2,
backgroundColor: ['rgba(97, 42, 154, 0.9)'],
borderColor: ['rgba(97, 42, 154,1)'],
borderWidth: 2,
hidden: true,
},
{
label: 'L.Intec',
data: Luxer,
pointRadius:0.2,
backgroundColor: ['rgba(255,255,0, 0.9)'],
borderColor: ['rgba(255,255,0,1)'],
borderWidth: 2,
hidden: true,
},
{
label: 'Lluvia',
data: Lluvia,
pointRadius:0.2,
backgroundColor: ['rgba(100,80,100, 0.9)'],
borderColor: ['rgba(100,90,0,1)'],
borderWidth: 2,
hidden: true,
},
{
label: 'Valid.',
data: validacion,
pointRadius:0.2,
backgroundColor: ['rgba(220,53,69, 1)'],
borderColor: ['rgba(220,60,69,1)'],
borderWidth: 2,
},
{
label: 'Pre.R',
data: presionRel,
pointRadius:0.2,
//backgroundColor: ['rgba(100,80,100, 0.8)'],
borderColor: ['rgba(255,255,255,1)'],
borderWidth: 2,
hidden: true,
}
]
},
options: {
showAllTooltips: true,
//elements: { point: { hitRadius: 5, hoverRadius: 5 }},
tooltips: {
backgroundColor: 'white',
titleFontColor: 'black',
callbacks: {
labelColor: function(tooltipItem, chart) {
var datos = chart.config.data.datasets[tooltipItem.datasetIndex];
if(typeof datos.backgroundColor === 'undefined') { var colorfondo = 'white';}else{var colorfondo= datos.backgroundColor[0];}
return {
backgroundColor : colorfondo,
borderColor : datos.borderColor[0],
borderWidth: 5,
labelTextColor: 'black'
};
},
labelTextColor: function(tooltipItem, chart) {
return 'black';
}
}
},
legend: {
labels: {
fontColor: 'white'
}
},
scales: {
yAxes: [{
ticks: {
autoSkip: true,
maxTicksLimit: 30,
showXLabels: 10,
beginAtZero:true,
fontColor: 'white'
},
gridLines: {
display: false,
drawBorder: true,
color: "white",
}
}],
xAxes: [{
ticks: {
beginAtZero:true,
fontColor: 'white'
},
gridLines: {
display: false,
drawBorder: true,
color: "white",
}
}]
},
title: {
display: true,
fontColor: 'white',
text: 'Estadísticas del dia hasta '+fecha_maxima
}
}
});
document.getElementById("actualizando").style.display = "none";
}else{ }else{
document.getElementById("inicio_estadisticas").innerHTML = "<h2> No hay registros para procesar .. </h2>"; return false
document.getElementById("grafico").innerHTML = "<h2> No hay registros para procesar .. </h2>"; //document.getElementById("inicio_estadisticas").innerHTML = "<h2> No hay registros para procesar .. </h2>";
document.getElementById("actualizando").style.display = "none"; //document.getElementById("grafico").innerHTML = "<h2> No hay registros para procesar .. </h2>";
//document.getElementById("actualizando").style.display = "none";
} }
} }
}); });
}else{ //MODO Visor }else{ //MODO Visor
document.getElementById("inicio_estadisticas").innerHTML = "<h2> Las estadisticas solo en modo recolector. </h2>"; return false;
document.getElementById("grafico").innerHTML = "<h2> Gráficos de estadisticas solo en modo recolector. </h2>"; //document.getElementById("inicio_estadisticas").innerHTML = "<h2> Las estadisticas solo en modo recolector. </h2>";
document.getElementById("actualizando").style.display = "none"; //document.getElementById("grafico").innerHTML = "<h2> Gráficos de estadisticas solo en modo recolector. </h2>";
//document.getElementById("actualizando").style.display = "none";
} }
} }

View File

@ -62,16 +62,13 @@ if (actualizar) {
win.moveTo(x, y); win.moveTo(x, y);
}); });
} else { } else {
// Si no, abrir la ventana principal de la aplicación con un tamaño reducido // Si no, abrir la ventana principal de la aplicación con un tamaño reducido
gui.Window.open('./gui/index.html', { gui.Window.open('./gui/index.html', {
frame: false, frame: false,
show: false, // Oculta la ventana al crearla show: false, // Oculta la ventana al crearla
width: 450, width: 350,
height: 200, height: 200
min_width: 450,
min_height: 200,
max_width: 450,
max_height: 200
}, function(win) { }, function(win) {
gui.Screen.Init(); gui.Screen.Init();
setTimeout(function() { setTimeout(function() {

View File

@ -32,29 +32,30 @@
<script src="../gui_common/libs/RGraph/RGraph.thermometer.js"></script> <script src="../gui_common/libs/RGraph/RGraph.thermometer.js"></script>
<script src="../gui_common/libs/RGraph/RGraph.gauge.js"></script> <script src="../gui_common/libs/RGraph/RGraph.gauge.js"></script>
<script src="../gui_common/libs/RGraph/RGraph.odo.js"></script> <script src="../gui_common/libs/RGraph/RGraph.odo.js"></script>
<script src="../gui_common/libs/RGraph/RGraph.bar.js"></script>
<script src="../gui_common/libs/RGraph/RGraph.drawing.image.js"></script> <script src="../gui_common/libs/RGraph/RGraph.drawing.image.js"></script>
<<script src="../node_modules/chart.js/dist/Chart.min.js"></script>
<!-- Barra de progreso --> <!-- Barra de progreso -->
<script src="../node_modules/nprogress/nprogress.js"></script> <script src="../node_modules/nprogress/nprogress.js"></script>
<!-- Libreria Notificaciones emergentes --> <!-- Libreria Notificaciones emergentes -->
<script src="../node_modules/notify-js-lib/dist/notify.js"></script> <script src="../node_modules/notify-js-lib/dist/notify.js"></script>
<!-- Libreria del Controlador --> <!-- Libreria del Controlador -->
<script src="controlador/funcionesgenerales.js"></script> <script src="./controlador/funcionesgenerales.js"></script>
<script src="controlador/admingui.js"></script> <script src="../gui_common/controlador/admingui.js"></script>
<style> <style>
.text-center { text-align: center !important; } .text-center { text-align: center !important; }
.text-right { text-align: right !important; } .text-right { text-align: right !important; }
.text-left { text-align: left !important; } .text-left { text-align: left !important; }
.vertical-align-top { vertical-align: top !important; } .vertical-align-top { vertical-align: top !important; }
</style> </style>
</head> </head>
<body class="dia"> <body class="dia">
<!-- Pantalla de Carga --> <!-- Pantalla de Carga -->
<div id="cargador" class="d-flex justify-content-center align-items-center" style="background-color: #567d3d;"> <div id="cargador" class="d-flex justify-content-center align-items-center" style="background-color: #042507;">
<div class="progressinicio"> <div class="progressinicio">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="background-color: #567d3d; width: 100%"> <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="background-color: #30511b; width: 100%">
<img id="loadinicio" class="mx-auto d-block" src="../gui_common/iconos/icono_app.webp" height="120px" width="140px"> <img id="loadinicio" class="mx-auto d-block" src="../gui_common/iconos/icono_app.webp" height="120px" width="140px">
<p class="text-center text-white">EMA Libre Cliente <br> (Carpincho) <br> Licencia GPLv3</p> <p class="text-center text-white">EMA Libre Cliente <br> (Carpincho) <br> Licencia GPLv3</p>
</div> </div>
@ -121,9 +122,9 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="exterior-tab" data-toggle="tab" data-target="#exterior" role="tab" aria-controls="exterior" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/exterior.webp" aria-controls="exterior"> EXTERIOR</a> <a class="nav-link" id="exterior-tab" data-toggle="tab" data-target="#exterior" role="tab" aria-controls="exterior" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/exterior.webp" aria-controls="exterior"> EXTERIOR</a>
</li> </li>
<li class="nav-item"> <!-- <li class="nav-item">
<a class="nav-link" id="estadisticas-tab" data-toggle="tab" data-target="#estadisticas" role="tab" aria-controls="estadisticas" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/estadistica.png" aria-controls="estadisticas"> ESTADISTICAS</a> <a class="nav-link" id="estadisticas-tab" data-toggle="tab" data-target="#estadisticas" role="tab" aria-controls="estadisticas" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/estadistica.png" aria-controls="estadisticas"> ESTADISTICAS</a>
</li> </li> -->
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="redes-tab" data-toggle="tab" data-target="#redes" role="tab" aria-controls="redes" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/redes.webp" aria-controls="redes"> REDES</a> <a class="nav-link" id="redes-tab" data-toggle="tab" data-target="#redes" role="tab" aria-controls="redes" aria-selected="false"><img height="24px" width="24px" src="../gui_common/img/redes.webp" aria-controls="redes"> REDES</a>
</li> </li>
@ -139,7 +140,7 @@
<div class="tab-pane fade show active" id="inicio" role="tabpanel" aria-badgeledby="inicio-tab"></div> <div class="tab-pane fade show active" id="inicio" role="tabpanel" aria-badgeledby="inicio-tab"></div>
<div class="tab-pane fade text-center" id="interior" role="tabpanel" aria-badgeledby="interior-tab"></div> <div class="tab-pane fade text-center" id="interior" role="tabpanel" aria-badgeledby="interior-tab"></div>
<div class="tab-pane fade text-center" id="exterior" role="tabpanel" aria-badgeledby="exterior-tab"></div> <div class="tab-pane fade text-center" id="exterior" role="tabpanel" aria-badgeledby="exterior-tab"></div>
<div class="tab-pane fade text-center" id="estadisticas" role="tabpanel" aria-badgeledby="estadisticas-tab"></div> <!-- <div class="tab-pane fade text-center" id="estadisticas" role="tabpanel" aria-badgeledby="estadisticas-tab"></div>-->
<div class="tab-pane fade text-center" id="configuracion" role="tabpanel" aria-badgeledby="configuracion-tab"></div> <div class="tab-pane fade text-center" id="configuracion" role="tabpanel" aria-badgeledby="configuracion-tab"></div>
<div class="tab-pane fade text-center" id="redes" role="tabpanel" aria-badgeledby="redes-tab"></div> <div class="tab-pane fade text-center" id="redes" role="tabpanel" aria-badgeledby="redes-tab"></div>
<div class="tab-pane fade" id="contacto" role="tabpanel" aria-badgeledby="contacto-tab"></div> <div class="tab-pane fade" id="contacto" role="tabpanel" aria-badgeledby="contacto-tab"></div>
@ -158,6 +159,22 @@
$('.menu').on('click', function(evnt) { $('.menu').on('click', function(evnt) {
var obj = $(evnt.target); var obj = $(evnt.target);
$('#' + obj.attr('aria-controls')).empty(); $('#' + obj.attr('aria-controls')).empty();
let screens = gui.Screen.screens;
let winX = win.x;
let winY = win.y;
let currentScreen = screens[0];
for (let screen of screens) {
if (
winX >= screen.bounds.x &&
winX < screen.bounds.x + screen.bounds.width &&
winY >= screen.bounds.y &&
winY < screen.bounds.y + screen.bounds.height
) {
currentScreen = screen;
break;
}
}
//nw.Window.get().moveTo(0);
switch (obj.attr('id')) { switch (obj.attr('id')) {
case 'Wzoomin': case 'Wzoomin':
win.zoomLevel += 0.3; win.zoomLevel += 0.3;
@ -166,16 +183,21 @@
win.zoomLevel -= 0.3; win.zoomLevel -= 0.3;
break; break;
case 'Wfull': case 'Wfull':
win.toggleFullscreen(); nw.Window.get().moveTo(currentScreen.bounds.x, currentScreen.bounds.y);
nw.Window.get().resizeTo(currentScreen.bounds.width, currentScreen.bounds.height);
break; break;
case 'Wmin': case 'Wmin':
win.minimize(); nw.Window.get().minimize();
//win.hide(); // Oculta completamente la ventana
//win.setShowInTaskbar(false); // Quita el icono del taskbar
break; break;
case 'Wmax': case 'Wmax':
win.maximize(); nw.Window.get().moveTo(currentScreen.bounds.x, currentScreen.bounds.y);
nw.Window.get().resizeTo(currentScreen.bounds.width, currentScreen.bounds.height);
break; break;
case 'Wmaxun': case 'Wmaxun':
win.unmaximize() nw.Window.get().moveTo(currentScreen.bounds.x, currentScreen.bounds.y);
nw.Window.get().resizeTo(currentScreen.bounds.width/2, currentScreen.bounds.height/2);
break; break;
case 'Wclo': case 'Wclo':
EMA.Salir(); EMA.Salir();

View File

@ -26,7 +26,7 @@
<div class="col-8"> <div class="col-8">
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Software:</strong> EMA Libre Cliente (Carpincho)</h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Software:</strong> EMA Libre Cliente (Carpincho)</h4>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Versión:</strong> <span id="versioncontacto">-</span></h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Versión:</strong> <span id="versioncontacto">-</span></h4>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Sitio Oficial:</strong> <a href="https://ema.gugler.com.ar" class="text-primary">ema.gugler.com.ar</a></h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Sitio Oficial:</strong> <a href="https://ema.gugler.com.ar" class="text-success">https://ema.gugler.com.ar</a></h4>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Licencia:</strong> GPLv3</h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Licencia:</strong> GPLv3</h4>
</div> </div>
@ -53,9 +53,8 @@
Si deseas realizar consultas, sugerencias o tienes alguna duda sobre nuestros productos/servicios, puedes comunicarte con nosotros a través de los siguientes medios: Si deseas realizar consultas, sugerencias o tienes alguna duda sobre nuestros productos/servicios, puedes comunicarte con nosotros a través de los siguientes medios:
</p> </p>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Teléfono:</strong> (0054 - 0343) 4975044 - Interno 119</h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Teléfono:</strong> (0054 - 0343) 4975044 - Interno 119</h4>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Correo Electrónico:</strong> <a href="mailto:gugler_contacto@uader.edu.ar" class="text-primary">gugler_contacto@uader.edu.ar</a></h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Correo Electrónico:</strong> <a href="mailto:gugler_contacto@uader.edu.ar" class="text-success">gugler_contacto@uader.edu.ar</a></h4>
<h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Sitio Oficial:</strong> <a href="https://www.gugler.com.ar" class="text-primary">gugler.com.ar</a></h4> <h4><img src="../gui_common/img/ok.webp" height="25" width="25" alt="Check"> <strong>Sitio Oficial:</strong> <a href="https://www.gugler.com.ar" class="text-success">https://www.gugler.com.ar</a></h4>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,19 +7,18 @@
<br><br> <img src='../gui_common/img/animadas/cargando2.gif' width='40' height='40' /> <br> <small>Cargando Gráfico...</small> <br><br> <img src='../gui_common/img/animadas/cargando2.gif' width='40' height='40' /> <br> <small>Cargando Gráfico...</small>
</div> </div>
<div id="inicio_estadisticas"> <div id="inicio_estadisticas">
<canvas id="graph_inicio" style="height:50vh; width:80vw" ></canvas> <canvas id="graph_inicio" width="800" height="400" style="width:100%; height:400px; max-width:80vw; max-height:50vh;"></canvas>
</div> </div>
<div id="grafico" style="background-color:#182c3e00; display:none" > <div id="grafico" style="background-color:#182c3e00; " >
<canvas id="graph" style="height:50vh; width:80vw" ></canvas> <canvas id="graph" style="height:50vh; width:80vw" ></canvas>
</div> </div>
<div> <div>
<script> <script>
function Mostrar() function Mostrar()
{ {
document.getElementById("grafico").style.display = "block"; document.getElementById("grafico").style.display = "block";
document.getElementById("inicio_estadisticas").style.display = "hidden"; document.getElementById("inicio_estadisticas").style.display = "none";
document.getElementById("inicio_estadisticas").hidden = true; document.getElementById("inicio_estadisticas").hidden = true;
document.getElementById("boton_grafico").hidden = true; document.getElementById("boton_grafico").hidden = true;
document.getElementById("boton_volver").hidden = false; document.getElementById("boton_volver").hidden = false;

View File

@ -10,10 +10,10 @@
<!-- Información General --> <!-- Información General -->
<td> <td>
<h5><b>Información General</b></h5> <h5><b>Información General</b></h5>
<p><img id="img_nombre" height="25" width="25" alt="Nombre"> Nombre: <span class="badge bg-info text-dark" id="inombre">-</span></p> <p><img src="../gui_common/img/informacion.png" id="img_nombre" height="25" width="25" alt="Nombre"> Nombre: <span class="badge bg-info text-dark" id="inombre">-</span></p>
<p><img id="img_so" height="25" width="25" alt="S.O"> S.O: <span class="badge bg-info text-dark" id="iso">-</span></p> <p><img src="../gui_common/img/informacion.png" id="img_so" height="25" width="25" alt="S.O"> S.O: <span class="badge bg-info text-dark" id="iso">-</span></p>
<p><img id="img_modo" height="25" width="25" alt="Modo"> Modo: <span class="badge bg-info text-dark" id="imodo">-</span></p> <p><img src="../gui_common/img/informacion.png" id="img_modo" height="25" width="25" alt="Modo"> Modo: <span class="badge bg-info text-dark" id="imodo">-</span></p>
<p><img src="../gui_common/img/ok.webp" height="25" width="25" alt="NW.js"> NW.js: <p><img src="../gui_common/img/informacion.png" height="25" width="25" alt="NW.js"> NW.js:
<span class="badge bg-info text-dark" id="nwjs_v" data-bs-toggle="tooltip" data-bs-placement="right" title="-">-</span> <span class="badge bg-info text-dark" id="nwjs_v" data-bs-toggle="tooltip" data-bs-placement="right" title="-">-</span>
</p> </p>
</td> </td>

View File

@ -27,51 +27,114 @@
* @since File available since Release 3.0 * @since File available since Release 3.0
*/ */
// **********************Dependencias ************************** // **********************Dependencias (unificadas) **************************
const configGeneralEMA = require('./../conf/ConfiguracionGeneral.js'); // Configuracion General // Este bloque detecta si estamos en NW.js (desktop) o en un navegador (web)
const configGlobalEMA = require('./../conf/ConfiguracionGlobal.js'); // Configuracion Global // y exporta las variables necesarias para el resto del archivo.
const funcionesActualizar = require('./../core/actualizar.js'); // Se incluye el core de EMA. var configGeneralEMA, configGlobalEMA, funcionesActualizar, EMA, gui, os, win;
const EMA = require('./../core/ema.js'); // Se incluye el core de EMA. var _IS_NW = false;
const gui = require('nw.gui'); // Libreria Grafica
const os = require('os'); // Libreria del sistema operativo
// **********************Vairales Generales*********************
const iconoEncendido = './gui_common/iconos/icono_enc.png'; // Imagen del Icono Encendido const iconoEncendido = './gui_common/iconos/icono_enc.png'; // Imagen del Icono Encendido
const iconoApagado = './gui_common/iconos/icono_off.png'; // Imagen del Icono Apagado const iconoApagado = './gui_common/iconos/icono_off.png'; // Imagen del Icono Apagado
const iconoPublicado = './gui_common/iconos/icono_pub.png'; // Imagen del Icono Prublicado --> no utilizada const iconoPublicado = './gui_common/iconos/icono_pub.png'; // Imagen del Icono Prublicado --> no utilizada
const iconoNeutro = '../gui_common/img/neutro.webp'; // Imagen del Icono Neutro const iconoNeutro = '../gui_common/img/neutro.webp'; // Imagen del Icono Neutro
const iconoControlTrue = '../gui_common/img/ok.webp'; // Imagen de Control TRUE const iconoControlTrue = '../gui_common/img/ok.webp'; // Imagen de Control TRUE
const iconoControlFalse = '../gui_common/img/no.webp'; // Imagen de Control FALSE const iconoControlFalse = '../gui_common/img/no.webp'; // Imagen de Control FALSE
//var tray = null;
var UltimoReg;
var Ant_UltimoReg; try {
var ModeloVisor; // Variables Generales - Registros recolectados _IS_NW = (typeof process !== 'undefined' && process.versions && process.versions['nw']);
var destanqueo = 0; } catch (e) { _IS_NW = false; }
var intervaloBarra = 0;
var cant = 0;
var tiempovisor=99; // Si estamos en NW.js, cargamos los módulos locales
if (_IS_NW) {
configGeneralEMA = require('./../conf/ConfiguracionGeneral.js'); // Configuracion General
configGlobalEMA = require('./../conf/ConfiguracionGlobal.js'); // Configuracion Global
funcionesActualizar = require('./../core/actualizar.js'); // Se incluye el core de EMA.
EMA = require('./../core/ema.js'); // Se incluye el core de EMA.
gui = require('nw.gui'); // Libreria Grafica
os = require('os'); // Libreria del sistema operativo
win = gui.Window.get(); // ventana actual
// **********************Iconizado / Menu Superior ********************************************************* // **********************Iconizado / Menu Superior *********************************************************
gui.App.clearCache(); // Se limpia cache gui.App.clearCache(); // Se limpia cache
win = gui.Window.get(); // Se obtiene la ventana actual win = gui.Window.get(); // Se obtiene la ventana actual
menuItems = new gui.Menu(); // Crear el icono en el tray
menuItems.append(new gui.MenuItem({ label: 'Iniciar', click: function () { INICIAR(); } })); function createTray() {
menuItems.append(new gui.MenuItem({ label: 'Detener', click: function () { DETENER(); } })); if (tray) return; // Evitar duplicados
menu = new gui.Menu({ type: 'menubar' });
menu.append(new gui.MenuItem({ label: 'EMA CONTROL', submenu: menuItems }));
menu.append(new gui.MenuItem({ label: 'Mostrar', click: function () { win.setShowInTaskbar(true); } }));
menu.append(new gui.MenuItem({ label: 'Ocultar', click: function () { win.setShowInTaskbar(false); } }));
menu.append(new gui.MenuItem({ label: 'Salir', click: function () { EMA.Salir(); gui.App.closeAllWindows();win.close(true); } }));
// se crea el tray icon
tray = new gui.Tray ({title : ' EmaLibre Carpincho ' , icon : iconoApagado });
// Crear menú contextual (sin 'menubar')
const menu = new nw.Menu();
menu.append(new nw.MenuItem({ type: 'checkbox', label: 'box1' }));
menu.append(new nw.MenuItem({
label: 'Iniciar',
click: () => { if (typeof INICIAR === 'function') INICIAR(); }
}));
menu.append(new nw.MenuItem({
label: 'Detener',
click: () => { if (typeof DETENER === 'function') DETENER(); }
}));
menu.append(new nw.MenuItem({ type: 'separator' }));
menu.append(new nw.MenuItem({
label: 'Mostrar ventana',
click: () => {
win.show();
win.restore();
win.focus();
win.setShowInTaskbar(true);
removeTray();
}
}));
menu.append(new nw.MenuItem({
label: 'Ocultar ventana',
click: () => {
win.hide();
win.setShowInTaskbar(false);
}
}));
menu.append(new nw.MenuItem({ type: 'separator' }));
menu.append(new nw.MenuItem({
label: 'Salir',
click: () => {
if (typeof EMA !== 'undefined' && typeof EMA.Salir === 'function') EMA.Salir();
nw.App.closeAllWindows();
nw.App.quit();
}
}));
tray.tooltip = 'Ema Libre Carpincho'; // Crear tray icon
tray = new nw.Tray({
title: 'EmaLibre Carpincho',
icon: iconoApagado,
});
tray.menu = menu; tray.menu = menu;
tray.on('click', function () { win.show(true); MuestraRegistroActual(false); Graficos(); ClimaActual(); });
//new gui.Shortcut({ key: 'F11', active: function () { win.toggleFullscreen(); } })
// **********************Funciones Principales de la GUI ***************************************************** // Click izquierdo: mostrar ventana
tray.on('click', () => {
console.log('Tray icon clicked');
win.show();
win.restore();
win.focus();
win.setShowInTaskbar(true);
removeTray();
if (typeof MuestraRegistroActual === 'function') MuestraRegistroActual(false);
if (typeof Graficos === 'function') Graficos();
if (typeof ClimaActual === 'function') ClimaActual();
});
const esperar = ms => new Promise(function(resolve){setTimeout(resolve, ms);}); // Click derecho: abrir menú manualmente si el entorno no lo hace
tray.on('right-click', () => {
console.log('Tray icon right-clicked');
tray.menu.popup();
});
// Doble click: también mostrar
tray.on('double-click', () => {
win.show();
win.focus();
win.setShowInTaskbar(true);
removeTray();
});
}
nw.Window.get().on('loaded', createTray);
// Captura el redimencionamiento de la ventana // Captura el redimencionamiento de la ventana
win.on('resize', (width, height) => { win.on('resize', (width, height) => {
@ -85,6 +148,61 @@ win.on('resize', (width, height) => {
if (width > 1400 && height > 1000) { win.zoomLevel = 1.2; } if (width > 1400 && height > 1000) { win.zoomLevel = 1.2; }
}); });
} else {
// Entorno Web: cargamos la configuración vía HTTP y exponemos wrappers mínimos
configGeneralEMA = undefined;
configGlobalEMA = undefined;
funcionesActualizar = undefined;
EMA = undefined;
gui = undefined;
os = undefined;
win = undefined;
// Obtener configs desde endpoints del servidor
if (typeof $ !== 'undefined') {
$.get('/configGeneralEMA', function (data) { configGeneralEMA = data; });
$.get('/configGlobalEMA', function (data) { configGlobalEMA = data; });
}
// Definir wrappers ligeros para funciones que el código usa (compatibilidad)
EMA = {
Conectar: function () { if (typeof $ !== 'undefined') { $.get('/iniciar'); } },
Detener: function () { if (typeof $ !== 'undefined') { $.get('/detener'); } },
IncrementarRepeticionesConError: function () { if (typeof $ !== 'undefined') { $.get('/IncrementarRepeticionesConError'); } },
RepeticionesConError: function () { if (typeof $ !== 'undefined') { return $.get('/RepeticionesConError'); } },
HayPendientes: function () { if (typeof $ !== 'undefined') { return $.get('/HayPendientes'); } }
};
funcionesActualizar = {
Control: function (cb) { if (cb) cb(false, null, null); },
Descargar: function () {},
Descomprimir: function () {},
Desplegar: function () {},
LanzarAplicativoIndependiente: function () {}
};
}
// **********************Vairales Generales*********************
let tray = null;
var UltimoReg;
var Ant_UltimoReg;
var ModeloVisor; // Variables Generales - Registros recolectados
var destanqueo = 0;
var intervaloBarra = 0;
var cant = 0;
var tiempovisor=99;
const esperar = ms => new Promise(function(resolve){setTimeout(resolve, ms);});
//new gui.Shortcut({ key: 'F11', active: function () { win.toggleFullscreen(); } })
// **********************Funciones Principales de la GUI *****************************************************
async function cargarInterfaces() {
let interfaces;
if (_IS_NW) {
interfaces = os.networkInterfaces();
} else {
interfaces = await $.get('/interfaces');
}
return interfaces;
}
function INICIAR () { function INICIAR () {
if (configGeneralEMA.ConfGeneral.Modo === 'Visor') { // se comprueba el modo if (configGeneralEMA.ConfGeneral.Modo === 'Visor') { // se comprueba el modo
HABLA(0, 'Se inicio en modo Visor', 'success'); HABLA(0, 'Se inicio en modo Visor', 'success');
@ -94,16 +212,29 @@ function INICIAR () {
HABLA(0, 'Se inicio en modo Recolector', 'success'); HABLA(0, 'Se inicio en modo Recolector', 'success');
$('#signal').addClass('parpadea'); $('#signal').addClass('parpadea');
} }
tray.icon = iconoEncendido; if (_IS_NW) tray.icon = iconoEncendido;
$('td#barralateral').css('background-color', '#11881161'); $('td#barralateral').css('background-color', '#11881161');
$('#estado').html('En Linea'); $('#estado').html('En Linea');
$('#mensaje').html('Encendido'); $('#mensaje').html('Encendido');
$('#botoniniciar').attr('disabled', true); $('#botoniniciar').attr('disabled', true);
$('#botondetener').attr('disabled', false); $('#botondetener').attr('disabled', false);
RegistroActual(); if (_IS_NW) { RegistroActual();}else{RegistroActualW();}
// Asegurar que no haya intervalos duplicados
if (intervaloBarra) {
clearInterval(intervaloBarra);
}
// Iniciar nuevo intervalo y guardarlo
intervaloBarra = window.setInterval(function () {
try {
BarradeProgreso();
} catch (e) {
console.error('Error en BarradeProgreso:', e);
// Reintentar iniciar el intervalo si falla
clearInterval(intervaloBarra); clearInterval(intervaloBarra);
intervaloBarra = window.setInterval(function () { BarradeProgreso(); }, 200); intervaloBarra = window.setInterval(function () { BarradeProgreso(); }, 200);
//console.log('Nuevo IntervaloId: '+ intervaloBarra); }
}, 200);
} }
async function iniciarAutomaticamente () { async function iniciarAutomaticamente () {
@ -120,9 +251,32 @@ async function iniciarAutomaticamente () {
} }
} }
function killAllTimers() {
// Preservar el intervalo de la barra de progreso si existe
const barraInterval = intervaloBarra;
// Limpiar intervalos conocidos primero
if (intervaloBarra) {
clearInterval(intervaloBarra);
}
// Limpiar timeouts y otros intervalos de manera más selectiva
const timeouts = [];
const intervals = [];
// Crear y detectar últimos IDs usados
timeouts.push(setTimeout(() => {}, 0));
intervals.push(setInterval(() => {}, 9999999));
// Limpiar los detectores
timeouts.forEach(t => clearTimeout(t));
intervals.forEach(i => clearInterval(i));
}
function DETENER () { function DETENER () {
clearInterval(intervaloBarra); clearInterval(intervaloBarra);
tray.icon = iconoApagado; killAllTimers();
if (_IS_NW) tray.icon = iconoApagado;
$('td#barralateral').css('background-color', '#ff000030'); $('td#barralateral').css('background-color', '#ff000030');
$('#estado').html('Fuera de Linea'); $('#estado').html('Fuera de Linea');
$('#img_estado').attr('src', iconoNeutro); $('#img_estado').attr('src', iconoNeutro);
@ -150,9 +304,11 @@ async function redimensionarInicio ()
$('#cargador').empty(); $('#cargador').empty();
$('#cargador').remove(); $('#cargador').remove();
$('#principal').show(); $('#principal').show();
if (_IS_NW) {
win.setMinimumSize(700, 500); win.setMinimumSize(700, 500);
win.setMaximumSize(4000, 2000); win.setMaximumSize(4000, 2000);
win.maximize(); win.maximize();
}
HABLA(0, '...', 'info'); HABLA(0, '...', 'info');
await esperar(1000); await esperar(1000);
HABLA(0, 'Bienvenido a Ema Libre Cliente, me llaman Carpincho.', 'info'); HABLA(0, 'Bienvenido a Ema Libre Cliente, me llaman Carpincho.', 'info');
@ -278,7 +434,7 @@ async function GUIÑA (num)
async function controlPendientes () { async function controlPendientes () {
var pendientes = EMA.HayPendientes(); var pendientes = await EMA.HayPendientes();
var DIVPENDIENTE = document.getElementById('DIVPendientes'); var DIVPENDIENTE = document.getElementById('DIVPendientes');
var SPANTANQUE = document.getElementById('Destanqueo'); var SPANTANQUE = document.getElementById('Destanqueo');
var DIVModo = document.getElementById('DIVModo'); var DIVModo = document.getElementById('DIVModo');
@ -309,12 +465,10 @@ if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP")
$('#signal').attr('src', '../gui_common/img/signal.webp'); $('#signal').attr('src', '../gui_common/img/signal.webp');
$('#signal').attr('title', 'Estacion IP/WIFI Conectada'); $('#signal').attr('title', 'Estacion IP/WIFI Conectada');
}else{ }else{
$('#signal').attr('src', '../gui_common/img/no_signal.webp'); $('#signal').attr('src', '../gui_common/img/no_signal.webp');
if(_IS_NW){
if(EMA.UltimoRegistro()){ if(EMA.UltimoRegistro()){$('#signal').attr('title', 'Bateria Baja Controlar'); HABLA(0, 'Bateria baja de la estacion IP/WIFI externa', 'warn');}
$('#signal').attr('title', 'Bateria Baja Controlar'); }
HABLA(0, 'Bateria baja de la estacion IP/WIFI externa', 'warn');}
} }
$('#signal').addClass('parpadea'); $('#signal').addClass('parpadea');
$('#signal').tooltip('dispose'); $('#signal').tooltip('dispose');
@ -340,6 +494,170 @@ if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP")
} }
} }
async function RegistroActualW (barratermino)
{
if (['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Modo))
{ // se comprueba el modo se encuentra en Recolector
if(barratermino == true){
//BARRA TERMINO
//console.log('ENTRO AL BARRA TERMINO RECOLECTOR');
await esperar(100);
EstadoMenuInicio();
await esperar(100);
MuestraRegistroActual(true);
await esperar(100);
Graficos();
await esperar(100);
ClimaActual();
await esperar(1500);
RegistroPublicado();
cant=0;
}
$.get("/EMA_estado", async function(data, status){
var EstadoEMA = data;
if (EstadoEMA[0] === true)
{
$('#img_detalle').attr('src', iconoControlTrue);
$('#img_mensaje').attr('src', iconoControlTrue);
if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP")
{
$('#mensaje').html('Recolectado por IP.');
}else{
$('#mensaje').html('Recolectando.');
$('#mensajedetalle').html('Operando.');
}
controlPendientes();
$.get("/EstadoSensores", function(data, status){
var EstadoSensores = data;
if(EstadoSensores !== false)
{
mostrarEstados(EstadoSensores);
}else{EstadoSensores=null;}
});
await esperar(1000);
//console.log('Consultando por el ultimo registro...');
var cantidad_E = await EMA.RepeticionesConError();
$.get("/UltimoRegistro", function(data, status){
UltimoReg = data;
if (UltimoReg == false) {
// Se consulta por la cantidad de errores
if (cantidad_E > 3) {
if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP")
{
$('#mensaje').html('Recolectado por IP.');
$('#img_mensaje').attr('src', iconoNeutro);
$('#mensajedetalle').html('(' +cantidad_E + ') Sincronizando ...');
// HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Revise por favor su configuración IP/WIFI de la estación.', 'error');
EMA.IncrementarRepeticionesConError();
} else{
$('#img_mensaje').attr('src', iconoNeutro);
$('#img_detalle').attr('src', iconoNeutro);
// HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Desconecte y vuelva a conectar el USB. Se prueba reiniciar el servicio.', 'error');
// esperar(15000);
// DETENER();
// esperar(5000);
// INICIAR();
}
RegistroActualW();
return false;
} else {
$('#mensajedetalle').html('(' + cantidad_E + ') Sincronizando ...');
if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP") EMA.IncrementarRepeticionesConError();
$('#img_detalle').attr('src', iconoNeutro);
esperar(2000);
RegistroActualW();
return false;
}
}
});
} else {
$('#mensaje').html('EmaLibre detenida.');
$('#img_mensaje').attr('src', iconoControlFalse);
$('#mensajedetalle').html(EstadoEMA[1]);
$('#img_detalle').attr('src', iconoControlFalse);
await esperar(5000);
RegistroActualW();
return false;
}
});
} else { // Modo visor
if(barratermino == true){
//BARRA TERMINO
await esperar(100);
EstadoMenuInicio();
await esperar(100);
MuestraRegistroActual(true);
await esperar(100);
Graficos();
await esperar(100);
ClimaActual();
cant=0;
}
$('#signal').attr('src', 'img/visor.webp');
$.get("/Visor", function(data, status){
if (data[0] != null) {
HABLA(0, 'No se pueden obtener datos del servidor. ' + data[0], 'info');
$('#signal').removeClass('parpadea');
setTimeout(function(){RegistroActualW();}, 10000);
} else {
$('#signal').addClass('parpadea');
var DIVModo = document.getElementById('DIVModo');
DIVModo.style.visibility = 'visible';
document.getElementById('DIVModo').innerHTML = "<span class='badge badge-primary' title='Modo Visor'> Modo Visor </span><br><span class='badge badge-primary' >" + data[1].pais + ', ' + data[1].ciudad + "</span><br><span class='badge badge-primary' >" + data[1].modelo + '</span>';
UltimoReg = data[1].registros[0];
ModeloVisor = data[1].nombre;
// se convierte la fecha
var db = new Date(data[1].registros[0].fecha);
var minutos = db.getMinutes();
if (minutos <= 9) { minutos = '0' + minutos; }
var hora = db.getHours();
if (hora <= 9) { hora = '0' + hora; }
var mes = db.getMonth() + 1;
if (mes <= 9) { mes = '0' + mes; }
var dia = db.getDate();
if (dia <= 9) { dia = '0' + dia; }
var segundo = db.getSeconds();
if (segundo <= 9) { segundo = '0' + segundo; }
var fecha = dia + '/' + mes + '/' + db.getFullYear() + ' ' + hora + ':' + minutos + ':' + segundo;
UltimoReg.fecha = fecha;
fecha=null;dia=null;mes=null;segundo=null;minutos=null;hora=null;db=null;
// ver acumulados de lluvia
UltimoReg.lloviendo = data[1].registros[0].lluvia_actual;
UltimoReg.lluvia_acu_hora = data[1].registros[0].lluvia_acumulado_hora;
UltimoReg.lluvia_acu_diaria = data[1].registros[0].lluvia_acumulado_diario;
UltimoReg.lluvia_acumulado_total = data[1].registros[0].lluvia_acumulado_total;
// Maximas y minimas, no llegan de EMACENTER, por el momento se setean en 0.
UltimoReg.temperatura_externa_max_dia = 0;
UltimoReg.temperatura_externa_min_dia = 0;
UltimoReg.temperatura_interna_max_dia = 0;
UltimoReg.temperatura_interna_min_dia = 0;
UltimoReg.punto_de_rocio_max_dia = 0;
UltimoReg.punto_de_rocio_min_dia = 0;
UltimoReg.humedad_externa_max_dia = 0;
UltimoReg.humedad_externa_min_dia = 0;
UltimoReg.humedad_interna_max_dia = 0;
UltimoReg.humedad_interna_min_dia = 0;
UltimoReg.luxer_intencidad_max_dia = 0;
UltimoReg.luxer_intencidad_min_dia = 0;
UltimoReg.luxer_uv_max_dia = 0;
UltimoReg.luxer_uv_min_dia = 0;
UltimoReg.presion_relativa_max_dia = 0;
UltimoReg.presion_relativa_min_dia = 0;
tiempovisor = tiempovisor - 0.2;
}
});
}
EstadoEMA = null;
}
async function RegistroActual (barratermino) async function RegistroActual (barratermino)
{ {
//console.log('ENTRO REGISTRO ACTUAL'); //console.log('ENTRO REGISTRO ACTUAL');
@ -359,7 +677,6 @@ if (['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Mo
if (win.x > -10000) RegistroPublicado(); if (win.x > -10000) RegistroPublicado();
cant=0; cant=0;
} }
var EstadoEMA = EMA.Estado(); var EstadoEMA = EMA.Estado();
if (EstadoEMA[0] === true) if (EstadoEMA[0] === true)
{ {
@ -376,35 +693,38 @@ if (['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Mo
controlPendientes(); controlPendientes();
UltimoReg = EMA.UltimoRegistro(); UltimoReg = EMA.UltimoRegistro();
var EstadoSensores = EMA.EstadoSensores(); var EstadoSensores = EMA.EstadoSensores();
if(EstadoSensores !== false) if(EstadoSensores !== false) { mostrarEstados(EstadoSensores);}else{EstadoSensores=null;}
{
mostrarEstados(EstadoSensores);
}else{EstadoSensores=null;}
if (UltimoReg == false) if (UltimoReg == false)
{ {
// Se consulta por la cantidad de errores // Se consulta por la cantidad de errores
if (EMA.RepeticionesConError() > 3) { if (EMA.RepeticionesConError() > 3) {
await esperar(10000);
if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP") if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP")
{$('#img_mensaje').attr('src', iconoNeutro);$('#img_detalle').attr('src', iconoNeutro); {
HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Revise por favor su configuración IP/WIFI de la estación. Se prueba reiniciar el servicio.', 'error');} $('#mensaje').html('Recolectado por IP.');
else{ $('#img_mensaje').attr('src', iconoNeutro);
HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Desconecte y vuelva a conectar el USB. Se prueba reiniciar el servicio.', 'error') $('#mensajedetalle').html('(' + EMA.RepeticionesConError() + ') Sincronizando ...');
} // HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Revise por favor su configuración IP/WIFI de la estación.', 'error');
EMA.Configuracion.RepeticionesConError += 1;
await esperar(5000);
} else{
$('#img_mensaje').attr('src', iconoNeutro);
$('#img_detalle').attr('src', iconoNeutro);
HABLA(0, 'No se pueden obtener registros (Intentos ' + EMA.RepeticionesConError() + '). Desconecte y vuelva a conectar el USB. Se prueba reiniciar el servicio.', 'error');
await esperar(15000); await esperar(15000);
DETENER(); DETENER();
await esperar(5000); await esperar(5000);
INICIAR(); INICIAR();
}
RegistroActual();
return false; return false;
} else { } else {
$('#mensajedetalle').html('(' + EMA.RepeticionesConError() + ') Sincronizando ...'); $('#mensajedetalle').html('(' + EMA.RepeticionesConError() + ') Sincronizando ...');
if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP") EMA.Configuracion.RepeticionesConError += 1; if(configGeneralEMA.ConfGeneral.Modo === "Recolector_IP") EMA.Configuracion.RepeticionesConError += 1;
$('#img_detalle').attr('src', iconoNeutro); $('#img_detalle').attr('src', iconoNeutro);
await esperar(2000); await esperar(2000);
RegistroActual(); RegistroActual();
return false; return false;
} }
} }
} else { } else {
@ -488,13 +808,42 @@ if (['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Mo
EstadoEMA = null; EstadoEMA = null;
} }
async function BarradeProgreso () { async function BarradeProgreso () {
// const startTime = performance.now(); // const startTime = performance.now();
// Se consulta el tiempo actual del recolector // Se consulta el tiempo actual del recolector
if (configGeneralEMA.ConfGeneral.Modo != 'Visor') if (configGeneralEMA.ConfGeneral.Modo != 'Visor')
{ // EN MODO RECOLECTOR { // EN MODO RECOLECTOR IP o USB
// Se pregunta si esta nativo o web
var tiempoActualRecolector; var tiempoActualRecolector;
if (!_IS_NW) {
$.get("/TiempoActualRecolector", function(data, status){
tiempoActualRecolector = data;
if(tiempoActualRecolector[0] !== false || tiempoActualRecolector[1] > 0)
{
if ((tiempoActualRecolector[0] < 98 && tiempoActualRecolector[1] > 0.39) )
{
// CONTINUA ADENTRO
NProgress.set(tiempoActualRecolector[0]/100);
return false;
} else {
// Cuando termine cada barra, publica y luego vuelve al leer el registro actual
cant++;
if(cant == 1){ RegistroActualW(true);} else{return true;};
// solo si esta en modo visor
if (configGeneralEMA.ConfGeneral.Modo === 'Visor') {document.getElementById('RedesMet').innerHTML = "<span class='badge badge-success' title='Obtenido Correctamente'>" + ModeloVisor + ': ' + UltimoReg.fecha.substring(10, 20) + '</span><br>';}
NProgress.done();
}
}else{ if(cant > 0){enEjecucion = false;return false;}
NProgress.done();
}
});
} else {
tiempoActualRecolector = EMA.TiempoActualRecolector(); tiempoActualRecolector = EMA.TiempoActualRecolector();
// console.log(tiempoActualRecolector);
if(tiempoActualRecolector[0] !== false || tiempoActualRecolector[1] > 0) if(tiempoActualRecolector[0] !== false || tiempoActualRecolector[1] > 0)
{ {
@ -523,13 +872,16 @@ async function BarradeProgreso () {
NProgress.done(); NProgress.done();
} }
} }
}
} else { // MODO VISOR } else { // MODO VISOR
if( tiempovisor != 99) if( tiempovisor != 99)
{ {
if( tiempovisor >= configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion) if( tiempovisor >= configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion)
{ {
tiempovisor = 0; tiempovisor = 0;
RegistroActual(true); if (_IS_NW) { RegistroActual(true);}else{RegistroActualW(true);}
if (win.x > -10000) NProgress.done(); if (win.x > -10000) NProgress.done();
}else{ }else{
tiempovisor = tiempovisor + 0.2; // se le suma el tiempo del intervalo tiempovisor = tiempovisor + 0.2; // se le suma el tiempo del intervalo
@ -643,7 +995,7 @@ async function MenuGUI (elemento) {
else {seleccion = document.getElementById(elemento);} else {seleccion = document.getElementById(elemento);}
$(seleccion).empty(); $(seleccion).empty();
$(seleccion).hide(); $(seleccion).hide();
$(seleccion).load('./view/modelo_' + elemento + '.html', function (datosArchivo) { $(seleccion).load('./view/modelo_' + elemento + '.html', async function (datosArchivo) {
switch (elemento) { switch (elemento) {
case 'logs': case 'logs':
VerRegistrosLog(); VerRegistrosLog();
@ -657,10 +1009,16 @@ async function MenuGUI (elemento) {
MenuSelectRed(); MenuSelectRed();
break; break;
case 'inicio': case 'inicio':
if (_IS_NW) {
$('#node_pid').html(process.pid); $('#node_pid').html(process.pid);
$('#node_ppid').html(process.ppid); $('#node_ppid').html(process.ppid);
$('#versiones').attr('title', versiones); $('#versiones').attr('title', versiones);
$('#nwjs_v').html(version_nwjs); $('#nwjs_v').html(version_nwjs);
} else {
$('#node_pid').html(pid);
$('#node_ppid').html(ppid);
$('#nwjs_v').html(version_node);
}
EstadoMenuInicio(); EstadoMenuInicio();
$('#interior').empty();$('#exterior').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty(); $('#interior').empty();$('#exterior').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break; break;
@ -675,8 +1033,8 @@ async function MenuGUI (elemento) {
$('#interior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty(); $('#interior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break; break;
case 'estadisticas': case 'estadisticas':
graficoEstadisticas();
$('#interior').empty();$('#exterior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty(); $('#interior').empty();$('#exterior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();
graficoEstadisticas();
break; break;
case 'contacto': case 'contacto':
var NombreVersion = ' v' + configGlobalEMA.ConfGlobal.Version; var NombreVersion = ' v' + configGlobalEMA.ConfGlobal.Version;
@ -706,7 +1064,7 @@ async function MenuGUI (elemento) {
voiceSelect.appendChild(option); voiceSelect.appendChild(option);
voiceSelect.selectedIndex = "0"; voiceSelect.selectedIndex = "0";
} }
const interfaces = os.networkInterfaces(); let interfaces = await cargarInterfaces();
// Limpiar las opciones previas (excepto la de "Seleccionar IP") // Limpiar las opciones previas (excepto la de "Seleccionar IP")
const $ipGroup = $('#ipGroup'); const $ipGroup = $('#ipGroup');
$ipGroup.find('option:not([value=""])').remove(); $ipGroup.find('option:not([value=""])').remove();
@ -815,10 +1173,10 @@ async function MenuGUI (elemento) {
default: default:
console.log('No existe el menu seleccionado: ' + elemento); console.log('No existe el menu seleccionado: ' + elemento);
} }
setTimeout(function(){ document.getElementById("actualizando_inicio").style.display = "none"; document.getElementById("actualizando_inicio").hidden = true;
document.getElementById("actualizando_inicio").hidden = false; document.getElementById("actualizando_inicio").style.display = "none";
$(seleccion).show(); $(seleccion).fadeIn('fast');
}, 200); seleccion = null;datosArchivo = null;
}); });
@ -830,8 +1188,9 @@ async function MenuGUI (elemento) {
async function autoLoad () async function autoLoad ()
{ {
await esperar(6000); await esperar(6000);
var plataforma = process.platform; if (_IS_NW) { var plataforma = process.platform;
var SO_WIN = plataforma.indexOf('win'); var SO_WIN = plataforma.indexOf('win');
if (SO_WIN === 0) { funcionesActualizar.Control(function (resultado, VersionActual, nueva) { if (resultado) { HABLA(0, 'Hay una nueva version de Carpincho. Versión ' + nueva, 'error'); } }); } if (SO_WIN === 0) { funcionesActualizar.Control(function (resultado, VersionActual, nueva) { if (resultado) { HABLA(0, 'Hay una nueva version de Carpincho. Versión ' + nueva, 'error'); } }); }
} }
}
autoLoad(); autoLoad();

View File

@ -150,28 +150,28 @@
body.dia { body.dia {
font-family: monospace !important; font-family: monospace !important;
background-image: url('../img/fondo/dia.webp'); background-image: url('/gui_common/img/fondo/dia.webp');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
body.dia_lluvia { body.dia_lluvia {
font-family: monospace !important; font-family: monospace !important;
background-image: url('../img/fondo/lluvia_dia.webp'); background-image: url('/gui_common/img/fondo/lluvia_dia.webp');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
body.noche { body.noche {
font-family: monospace !important; font-family: monospace !important;
background-image: url('../img/fondo/noche.webp'); background-image: url('/gui_common/img/fondo/noche.webp');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
body.noche_lluvia { body.noche_lluvia {
font-family: monospace !important; font-family: monospace !important;
background-image: url('../img/fondo/lluvia_noche.webp'); background-image: url('/gui_common/img/fondo/lluvia_noche.webp');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
@ -254,15 +254,14 @@ h6,
width: 150px; width: 150px;
float: center; float: center;
text-align: center; text-align: center;
margin: 20px 0 0 40px; margin: 20px 0 0 0px;
font-size: 8px; font-size: 10px;
} }
.notifyjs-foo-base button { .notifyjs-foo-base button {
font-size: 10px; font-size: 12px;
padding: 1px; padding: 1px;
margin: 2px; margin: 2px;
width: 40px;
} }
.texttanque { .texttanque {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
'version:2025-06-24 (6.22)'; 'version:2025-10-08 (7.01)';
// //
// o---------------------------------------------------------------------------------o // o---------------------------------------------------------------------------------o
// | This file is part of the RGraph package - you can learn more at: | // | This file is part of the RGraph package - you can learn more at: |
@ -80,7 +80,7 @@
// //
// Some example background properties // Some example properties
// //
this.properties = this.properties =
{ {
@ -140,8 +140,49 @@
clip: null, clip: null,
events: {} events: {},
}
scale: true,
scaleFactor: 2,
antialiasTranslate: false
};
//
// These are the properties that get scaled up if the
// scale option is enabled.
//
this.properties_scale = [
'width',
'height',
'marginLeft',
'marginRight',
'marginBottom',
'marginTop',
'marginInner',
'textSize',
'shadowOffsetx',
'shadowOffsety',
'shadowBlur',
'linewidth',
'borderLinewidth',
'borderRadius'
];
// //
// Add the reverse look-up table for property names // Add the reverse look-up table for property names
@ -265,11 +306,26 @@
// //
this.draw = function () this.draw = function ()
{ {
// MUST be the first thing that's done - but only
// once!!
RGraph.runOnce(`scale-up-the-canvas-once-in-the-draw-function-${this.id}-${this.uid}`, () =>
{
// Note that we're in an arrow function so the
// 'this' variable is OK to be used and refers
// to the RGraph Line chart object.
RGraph.scale(this);
});
// //
// Fire the onbeforedraw event // Fire the onbeforedraw event
// //
RGraph.fireCustomEvent(this, 'onbeforedraw'); RGraph.fireCustomEvent(this, 'onbeforedraw');
var scaleFactor = RGraph.getScaleFactor(this);
@ -289,12 +345,15 @@
// Translate half a pixel for antialiasing purposes - but only if it hasn't been // Translate half a pixel for antialiasing purposes - but
// done already // only if it hasn't been done already
// //
// MUST be the first thing done! // The old style antialias fix
// //
if (!this.canvas.__rgraph_aa_translated__) { if ( !this.properties.scale
&& this.properties.antialiasTranslate
&& !this.canvas.__rgraph_aa_translated__) {
this.context.translate(0.5,0.5); this.context.translate(0.5,0.5);
this.canvas.__rgraph_aa_translated__ = true; this.canvas.__rgraph_aa_translated__ = true;
@ -326,22 +385,23 @@
if (!obj.alignmentProcessed) { if (!obj.alignmentProcessed) {
var customWidthHeight = (typeof obj.properties.width == 'number' && typeof obj.properties.width == 'number'); var customWidthHeight = (RGraph.isNumber(obj.properties.width) && RGraph.isNumber(obj.properties.width));
// Horizontal alignment // Horizontal alignment
if (obj.properties.halign === 'center') { if (obj.properties.halign === 'center') {
obj.x -= customWidthHeight ? (obj.properties.width / 2) : (this.width / 2); obj.x = obj.x - (customWidthHeight ? (obj.properties.width / 2) : (this.width / 2));
} else if (obj.properties.halign == 'right') { } else if (obj.properties.halign == 'right') {
obj.x -= customWidthHeight ? obj.properties.width : this.width; obj.x = obj.x - (customWidthHeight ? obj.properties.width : this.width);
} }
// Vertical alignment // Vertical alignment
if (obj.properties.valign === 'center') { if (obj.properties.valign === 'center') {
obj.y -= customWidthHeight ? (obj.properties.height / 2) : (this.height / 2); obj.y = obj.y - (customWidthHeight ? (obj.properties.height / 2) : (this.height / 2));
} else if (obj.properties.valign == 'bottom') { } else if (obj.properties.valign === 'bottom') {
obj.y -= customWidthHeight ? obj.properties.height : this.height; obj.y = obj.y - (customWidthHeight ? obj.properties.height : this.height);
} }
// Don't do this again // Don't do this again
obj.alignmentProcessed = true; obj.alignmentProcessed = true;
} }
@ -384,6 +444,7 @@
// //
// Draw a border around the image // Draw a border around the image
// //
/// !!!!!!
if (properties.border) { if (properties.border) {
this.context.strokeStyle = properties.borderColor; this.context.strokeStyle = properties.borderColor;
@ -411,12 +472,12 @@
this.roundedRect( this.roundedRect(
Math.round(this.x) - Math.round(this.context.lineWidth / 2), Math.round(this.x) - Math.round(this.context.lineWidth / 2),
Math.round(this.y) - Math.round(this.context.lineWidth / 2), Math.round(this.y) - Math.round(this.context.lineWidth / 2),
(properties.width || this.img.width) + this.context.lineWidth, (((properties.width)|| this.img.width)) + this.context.lineWidth,
(properties.height || this.img.height) + this.context.lineWidth, (((properties.height)|| this.img.height)) + this.context.lineWidth,
borderRadius borderRadius
); );
} }
this.context.stroke();
if (borderRadius) { if (borderRadius) {
@ -434,8 +495,8 @@
this.roundedRect( this.roundedRect(
Math.round(this.x) - Math.round(this.context.lineWidth / 2), Math.round(this.x) - Math.round(this.context.lineWidth / 2),
Math.round(this.y) - Math.round(this.context.lineWidth / 2), Math.round(this.y) - Math.round(this.context.lineWidth / 2),
(properties.width || this.img.width) + this.context.lineWidth, (((properties.width) || this.img.width)) + this.context.lineWidth,
(properties.height || this.img.height) + this.context.lineWidth, (((properties.height) || this.img.height)) + this.context.lineWidth,
borderRadius borderRadius
); );
this.context.clip(); this.context.clip();
@ -448,25 +509,37 @@
if (typeof properties.height === 'number' || typeof properties.width === 'number') { if (typeof properties.height === 'number' || typeof properties.width === 'number') {
this.context.drawImage( this.context.drawImage(
this.img, this.img,
Math.round(this.x), Math.round(this.x),
Math.round(this.y), Math.round(this.y),
properties.width || this.width, (properties.width || this.width),
properties.height || this.height (properties.height || this.height)
); );
} else { } else {
// Add the image to the document so that the
// width/height can be ascertained
document.body.appendChild(this.img);
this.img.style.position = 'absolute';
this.img.style.top = '-1000px';
this.img.style.left = '-1000px';
this.context.drawImage( this.context.drawImage(
this.img, this.img,
Math.round(this.x), Math.round(this.x),
Math.round(this.y) Math.round(this.y),
this.img.offsetWidth,
this.img.offsetHeight
); );
} }
// If borderRadius is enabled restore the canvas to it's pre-clipped state // If borderRadius is enabled restore the canvas to it's
// pre-clipped state
if (borderRadius) { if (borderRadius) {
this.context.restore(); this.context.restore();
} }
@ -659,10 +732,20 @@
if (typeof properties.highlightStyle === 'function') { if (typeof properties.highlightStyle === 'function') {
(properties.highlightStyle)(shape); (properties.highlightStyle)(shape);
} else { } else {
this.path('b');
this.roundedRect(
this.coords[0][0],
this.coords[0][1],
this.coords[0][2],
this.coords[0][3],
this.properties.borderRadius
);
this.path( this.path(
'b r % % % % f % s %', 'f % s %',
this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3], properties.highlightFill,
properties.highlightFill, properties.highlightStroke properties.highlightStroke
); );
} }
} }
@ -840,13 +923,17 @@
// //
this.drawBackgroundColor = function (borderRadius) this.drawBackgroundColor = function (borderRadius)
{ {
var scaleFactor = RGraph.getScaleFactor(this);
this.context.beginPath(); this.context.beginPath();
this.context.strokeStyle = 'transparent';
this.context.fillStyle = properties.backgroundColor; this.context.fillStyle = properties.backgroundColor;
this.roundedRect( this.roundedRect(
Math.round(this.x) - Math.round(this.context.lineWidth / 2), Math.round(this.x) - Math.round(this.context.lineWidth / 2),
Math.round(this.y) - Math.round(this.context.lineWidth / 2), Math.round(this.y) - Math.round(this.context.lineWidth / 2),
(properties.width || this.img.width) + this.context.lineWidth, (((properties.width) || this.img.width)) + this.context.lineWidth,
(properties.height || this.img.height) + this.context.lineWidth, (((properties.height) || this.img.height)) + this.context.lineWidth,
borderRadius borderRadius
); );
this.context.fill(); this.context.fill();
@ -888,9 +975,11 @@
e = args.event, e = args.event,
tooltip = args.tooltip, tooltip = args.tooltip,
index = args.index, index = args.index,
canvasXY = RGraph.getCanvasXY(obj.canvas); canvasXY = RGraph.getCanvasXY(obj.canvas),
scaleFactor = RGraph.getScaleFactor(obj);
// Position the tooltip in the X direction // Position the tooltip in the X direction
if (scaleFactor === 1) {
args.tooltip.style.left = ( args.tooltip.style.left = (
canvasXY[0] // The X coordinate of the canvas canvasXY[0] // The X coordinate of the canvas
+ this.x // The X coordinate of the image + this.x // The X coordinate of the image
@ -898,14 +987,34 @@
- (tooltip.offsetWidth / 2) // Subtract half of the tooltip width - (tooltip.offsetWidth / 2) // Subtract half of the tooltip width
+ obj.properties.tooltipsOffsetx // Add any user defined offset + obj.properties.tooltipsOffsetx // Add any user defined offset
) + 'px'; ) + 'px';
} else {
args.tooltip.style.left = (
canvasXY[0] // The X coordinate of the canvas
+ (this.x / scaleFactor) // The X coordinate of the image
+ ((properties.width || this.img.width) / 4) // Add half of the image width
- (tooltip.offsetWidth / 2) // Subtract half of the tooltip width
+ obj.properties.tooltipsOffsetx // Add any user defined offset
) + 'px';
}
// Positon the tooltip in the vertical direction
if (scaleFactor === 1) {
args.tooltip.style.top = ( args.tooltip.style.top = (
canvasXY[1] // The Y coordinate of the canvas canvasXY[1] // The Y coordinate of the canvas
- tooltip.offsetHeight // The height of the tooltip - tooltip.offsetHeight // The height of the tooltip
+ obj.properties.tooltipsOffsety // Add any user defined offset + obj.properties.tooltipsOffsety // Add any user defined offset
+ this.y // Add the Y coordinate + this.y // Add the Y coordinate
- 10 // An arbitrary amount - (12 - properties.borderLinewidth) // An arbitrary amount
) + 'px'; ) + 'px';
} else {
args.tooltip.style.top = (
canvasXY[1] // The Y coordinate of the canvas
- tooltip.offsetHeight // The height of the tooltip
+ obj.properties.tooltipsOffsety // Add any user defined offset
+ (this.y / scaleFactor) // Add the Y coordinate
- ((7 * scaleFactor) - properties.borderLinewidth) // An arbitrary amount
) + 'px';
}
}; };

View File

@ -1,4 +1,4 @@
'version:2025-06-24 (6.22)'; 'version:2025-10-08 (7.01)';
// //
// o---------------------------------------------------------------------------------o // o---------------------------------------------------------------------------------o
// | This file is part of the RGraph package - you can learn more at: | // | This file is part of the RGraph package - you can learn more at: |
@ -168,12 +168,12 @@
colorsRedStart: 0.9 * this.max, colorsRedStart: 0.9 * this.max,
colorsRedColor: '#DC3912', colorsRedColor: '#DC3912',
colorsRedWidth: 10, colorsRedWidth: 5,
colorsYellowColor: '#FF9900', colorsYellowColor: '#FF9900',
colorsYellowWidth: 10, colorsYellowWidth: 5,
colorsGreenEnd: 0.7 * this.max, colorsGreenEnd: 0.7 * this.max,
colorsGreenColor: 'rgba(0,0,0,0)', colorsGreenColor: 'rgba(0,0,0,0)',
colorsGreenWidth: 10, colorsGreenWidth: 5,
colorsRanges: null, colorsRanges: null,
needleSize: null, needleSize: null,
@ -211,8 +211,78 @@
clearto: 'rgba(0,0,0,0)', clearto: 'rgba(0,0,0,0)',
events: {} events: {},
}
scale: true,
scaleFactor: 2,
antialiasTranslate: false
};
//
// These are the properties that get scaled up if the
// scale option is enabled.
//
this.properties_scale = [
'centerx',
'centery',
'radius',
'marginLeft',
'marginRight',
'marginTop',
'marginBottom',
'borderWidth',
'textSize',
'titleTopSize',
'titleTopOffsetx',
'titleTopOffsety',
'titleTopSubtitleSize',
'titleTopSubtitleOffsetx',
'titleTopSubtitleOffsety',
'titleBottomSize',
'titleBottomOffsetx',
'titleBottomOffsety',
'labelsOffsetRadius',
'labelsOffsetx',
'labelsOffsety',
'labelsSize',
'labelsValueSize',
'colorsRedWidth',
'colorsYellowWidth',
'colorsGreenWidth',
'needleSize',
'needleWidth',
'centerpinRadius',
'annotatableLinewidth',
'shadowOffsetx',
'shadowOffsety',
'shadowBlur'
];
// //
@ -334,6 +404,23 @@
// //
this.draw = function () this.draw = function ()
{ {
// MUST be the first thing that's done - but only
// once!!
RGraph.runOnce(`scale-up-the-canvas-once-in-the-draw-function-${this.id}-${this.uid}`, () =>
{
// Note that we're in an arrow function so the
// 'this' variable is OK to be used and refers
// to the RGraph Line chart object.
RGraph.scale(this);
});
// //
// Fire the onbeforedraw event // Fire the onbeforedraw event
// //
@ -344,12 +431,15 @@
// Translate half a pixel for antialiasing purposes - but only if it hasn't been // Translate half a pixel for antialiasing purposes - but
// done already // only if it hasn't been done already
// //
// MUST be the first thing done! // The old style antialias fix
// //
if (!this.canvas.__rgraph_aa_translated__) { if ( !this.properties.scale
&& this.properties.antialiasTranslate
&& !this.canvas.__rgraph_aa_translated__) {
this.context.translate(0.5,0.5); this.context.translate(0.5,0.5);
this.canvas.__rgraph_aa_translated__ = true; this.canvas.__rgraph_aa_translated__ = true;
@ -397,9 +487,11 @@
// //
// Allow the centerx/centery/radius to be a plus/minus // Allow the centerx/centery/radius to be a plus/minus
// //
if (typeof properties.radius === 'string' && properties.radius.match(/^\+|-\d+$/) ) this.radius += parseFloat(properties.radius); var scaleFactor = RGraph.getScaleFactor(this);
if (typeof properties.centerx === 'string' && properties.centerx.match(/^\+|-\d+$/) ) this.centerx += parseFloat(properties.centerx);
if (typeof properties.centery === 'string' && properties.centery.match(/^\+|-\d+$/) ) this.centery += parseFloat(properties.centery); if (typeof properties.radius === 'string' && properties.radius.match(/^\+|-\d+$/) ) this.radius += parseFloat(properties.radius) * scaleFactor;
if (typeof properties.centerx === 'string' && properties.centerx.match(/^\+|-\d+$/) ) this.centerx += parseFloat(properties.centerx) * scaleFactor;
if (typeof properties.centery === 'string' && properties.centery.match(/^\+|-\d+$/) ) this.centery += parseFloat(properties.centery) * scaleFactor;
// //
// Parse the colors. This allows for simple gradient syntax // Parse the colors. This allows for simple gradient syntax
@ -582,6 +674,8 @@
// //
this.drawBackGround = function () this.drawBackGround = function ()
{ {
var scaleFactor = RGraph.getScaleFactor(this);
// Shadow ////////////////////////////////////////////// // Shadow //////////////////////////////////////////////
if (properties.shadow) { if (properties.shadow) {
RGraph.setShadow( RGraph.setShadow(
@ -628,7 +722,14 @@
// //
this.context.beginPath(); this.context.beginPath();
this.context.fillStyle = properties.borderInner; this.context.fillStyle = properties.borderInner;
this.context.arc(this.centerx, this.centery, this.radius - borderWidth, 0, RGraph.TWOPI, 0); this.context.arc(
this.centerx,
this.centery,
this.radius - borderWidth,
0,
RGraph.TWOPI,
0
);
this.context.fill(); this.context.fill();
@ -673,7 +774,15 @@
// Draw a black border around the chart // Draw a black border around the chart
this.context.beginPath(); this.context.beginPath();
this.context.strokeStyle = properties.borderOutline; this.context.strokeStyle = properties.borderOutline;
this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.TWOPI, 0); this.context.lineWidth = 1 * scaleFactor;
this.context.arc(
this.centerx,
this.centery,
this.radius,
0,
RGraph.TWOPI,
0
);
this.context.stroke(); this.context.stroke();
}; };
@ -690,14 +799,30 @@
this.drawSmallTickmarks = function () this.drawSmallTickmarks = function ()
{ {
var numTicks = properties.tickmarksSmall; var numTicks = properties.tickmarksSmall;
var scaleFactor = RGraph.getScaleFactor(this);
this.context.lineWidth = 1; this.context.lineWidth = 1;
for (var i=0; i<=numTicks; ++i) { for (var i=0; i<=numTicks; ++i) {
this.context.beginPath(); this.context.beginPath();
this.context.strokeStyle = properties.tickmarksSmallColor; this.context.strokeStyle = properties.tickmarksSmallColor;
var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle; var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle;
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10, a, a + 0.00001, 0); this.context.arc(
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10 - 5, a, a + 0.00001, 0); this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor),
a,
a + 0.00001,
0
);
this.context.arc(
this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor) - (5 * scaleFactor),
a,
a + 0.00001,
0
);
this.context.stroke(); this.context.stroke();
} }
}; };
@ -717,6 +842,8 @@
if (properties.tickmarksMedium) { if (properties.tickmarksMedium) {
var numTicks = properties.tickmarksMedium; var numTicks = properties.tickmarksMedium;
var scaleFactor = RGraph.getScaleFactor(this);
this.context.lineWidth = 3; this.context.lineWidth = 3;
this.context.lineCap = 'round'; this.context.lineCap = 'round';
this.context.strokeStyle = properties.tickmarksMediumColor; this.context.strokeStyle = properties.tickmarksMediumColor;
@ -726,8 +853,22 @@
var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle + (((this.endAngle - this.startAngle) / (2 * numTicks))); var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle + (((this.endAngle - this.startAngle) / (2 * numTicks)));
if (a > this.startAngle && a< this.endAngle) { if (a > this.startAngle && a< this.endAngle) {
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10, a, a + 0.00001, 0); this.context.arc(
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10 - 6, a, a + 0.00001, 0); this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor),
a,
a + 0.00001,
0
);
this.context.arc(
this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor) - (6 * scaleFactor),
a,
a + 0.00001,
0
);
} }
this.context.stroke(); this.context.stroke();
} }
@ -747,16 +888,31 @@
this.drawLargeTickmarks = function () this.drawLargeTickmarks = function ()
{ {
var numTicks = properties.tickmarksLarge; var numTicks = properties.tickmarksLarge;
var scaleFactor = RGraph.getScaleFactor(this);
this.context.lineWidth = 3; this.context.lineWidth = 3 * scaleFactor;
this.context.lineCap = 'round'; this.context.lineCap = 'round';
for (var i=0; i<=numTicks; ++i) { for (var i=0; i<=numTicks; ++i) {
this.context.beginPath(); this.context.beginPath();
this.context.strokeStyle = properties.tickmarksLargeColor; this.context.strokeStyle = properties.tickmarksLargeColor;
var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle; var a = (((this.endAngle - this.startAngle) / numTicks) * i) + this.startAngle;
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10, a, a + 0.00001, 0); this.context.arc(
this.context.arc(this.centerx, this.centery, this.radius - properties.borderWidth - 10 - 10, a, a + 0.00001, 0); this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor),
a,
a + 0.00001,
0
);
this.context.arc(
this.centerx,
this.centery,
this.radius - properties.borderWidth - (10 * scaleFactor) - (10 * scaleFactor),
a,
a + 0.00001,
0
);
this.context.stroke(); this.context.stroke();
} }
}; };
@ -773,15 +929,31 @@
// //
this.drawCenterpin = function () this.drawCenterpin = function ()
{ {
var offset = 6; var scaleFactor = RGraph.getScaleFactor(this);
var grad = this.context.createRadialGradient(this.centerx + offset, this.centery - offset, 0, this.centerx + offset, this.centery - offset, 25); var offset = (6 * scaleFactor);
var grad = this.context.createRadialGradient(
this.centerx + offset,
this.centery - offset,
0,
this.centerx + offset,
this.centery - offset,
(25 * scaleFactor)
);
grad.addColorStop(0, '#ddf'); grad.addColorStop(0, '#ddf');
grad.addColorStop(1, properties.centerpinColor); grad.addColorStop(1, properties.centerpinColor);
this.context.beginPath(); this.context.beginPath();
this.context.fillStyle = grad; this.context.fillStyle = grad;
this.context.arc(this.centerx, this.centery, this.centerpinRadius, 0, RGraph.TWOPI, 0); this.context.arc(
this.centerx,
this.centery,
this.centerpinRadius,
0,
RGraph.TWOPI,
0
);
this.context.fill(); this.context.fill();
}; };
@ -855,10 +1027,13 @@
var scaleFactor = RGraph.getScaleFactor(this);
this.context.beginPath(); this.context.beginPath();
if (num) { if (num) {
for (var i=0; i<=num; ++i) { for (var i=0; i<=num; ++i) {
var hyp = (this.radius - 25 - properties.borderWidth) - properties.labelsOffsetRadius; var hyp = (this.radius - (25 * scaleFactor) - properties.borderWidth) - properties.labelsOffsetRadius;
var a = (this.endAngle - this.startAngle) / num var a = (this.endAngle - this.startAngle) / num
a = this.startAngle + (i * a); a = this.startAngle + (i * a);
a -= RGraph.HALFPI; a -= RGraph.HALFPI;
@ -1018,8 +1193,10 @@
// //
this.drawTopTitle = function () this.drawTopTitle = function ()
{ {
var scaleFactor = RGraph.getScaleFactor(this);
var x = this.centerx; var x = this.centerx;
var y = this.centery - 25; var y = this.centery - (25 * scaleFactor);
if (typeof properties.titleTopSubtitle === 'string') { if (typeof properties.titleTopSubtitle === 'string') {
y -= 20. y -= 20.
@ -1122,8 +1299,10 @@
// //
this.drawBottomTitle = function () this.drawBottomTitle = function ()
{ {
var scaleFactor = RGraph.getScaleFactor(this);
var x = this.centerx; var x = this.centerx;
var y = this.centery + this.centerpinRadius + 10; var y = this.centery + this.centerpinRadius + (10 * scaleFactor);
// Totally override the calculated positioning // Totally override the calculated positioning
if (typeof properties.titleBottomPos == 'number') { if (typeof properties.titleBottomPos == 'number') {
@ -1261,6 +1440,8 @@
// //
this.drawColorBands = function () this.drawColorBands = function ()
{ {
var scaleFactor = RGraph.getScaleFactor(this);
if (RGraph.isArray(properties.colorsRanges)) { if (RGraph.isArray(properties.colorsRanges)) {
var ranges = properties.colorsRanges; var ranges = properties.colorsRanges;
@ -1274,7 +1455,7 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
this.radius - 10 - properties.borderWidth, this.radius - (10 * scaleFactor) - properties.borderWidth,
(((ranges[i][0] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle, (((ranges[i][0] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle,
(((ranges[i][1] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle, (((ranges[i][1] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle,
false false
@ -1283,7 +1464,7 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
this.radius - 10 - properties.borderWidth - (typeof ranges[i][3] === 'number' ? ranges[i][3] : 10), this.radius - (10 * scaleFactor) - properties.borderWidth - (typeof ranges[i][3] === 'number' ? ranges[i][3] : (10 * scaleFactor)),
(((ranges[i][1] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle, (((ranges[i][1] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle,
(((ranges[i][0] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle, (((ranges[i][0] - this.min) / (this.max - this.min)) * (this.endAngle - this.startAngle)) + this.startAngle,
true true
@ -1303,10 +1484,25 @@
var greenStart = this.startAngle; var greenStart = this.startAngle;
var greenEnd = this.startAngle + (this.endAngle - this.startAngle) * ((properties.colorsGreenEnd - this.min) / (this.max - this.min)) var greenEnd = this.startAngle + (this.endAngle - this.startAngle) * ((properties.colorsGreenEnd - this.min) / (this.max - this.min))
var greenOuterRadius = this.radius - (10 * scaleFactor) - properties.borderWidth;
this.context.beginPath(); this.context.beginPath();
this.context.arc(this.centerx, this.centery, this.radius - 10 - properties.borderWidth, greenStart, greenEnd, false); this.context.arc(
this.context.arc(this.centerx, this.centery, this.radius - (10 + properties.colorsGreenWidth) - properties.borderWidth, greenEnd, greenStart, true); this.centerx,
this.centery,
greenOuterRadius,
greenStart,
greenEnd,
false
);
this.context.arc(
this.centerx,
this.centery,
greenOuterRadius - (this.properties.colorsGreenWidth * 2),
greenEnd,
greenStart,
true
);
this.context.fill(); this.context.fill();
@ -1321,10 +1517,18 @@
var yellowStart = greenEnd; var yellowStart = greenEnd;
var yellowEnd = this.startAngle + (this.endAngle - this.startAngle) * ((properties.colorsRedStart - this.min) / (this.max - this.min)) var yellowEnd = this.startAngle + (this.endAngle - this.startAngle) * ((properties.colorsRedStart - this.min) / (this.max - this.min))
var yellowOuterRadius = this.radius - (10 * scaleFactor) - properties.borderWidth;
this.context.beginPath(); this.context.beginPath();
this.context.arc(this.centerx, this.centery, this.radius - 10 - properties.borderWidth, yellowStart, yellowEnd, false); this.context.arc(this.centerx, this.centery, yellowOuterRadius, yellowStart, yellowEnd, false);
this.context.arc(this.centerx, this.centery, this.radius - (10 + properties.colorsYellowWidth) - properties.borderWidth, yellowEnd, yellowStart, true); this.context.arc(
this.centerx,
this.centery,
yellowOuterRadius - (this.properties.colorsYellowWidth * 2),
yellowEnd,
yellowStart,
true
);
this.context.fill(); this.context.fill();
@ -1339,10 +1543,18 @@
var redStart = yellowEnd; var redStart = yellowEnd;
var redEnd = this.startAngle + (this.endAngle - this.startAngle) * ((this.max - this.min) / (this.max - this.min)) var redEnd = this.startAngle + (this.endAngle - this.startAngle) * ((this.max - this.min) / (this.max - this.min))
var redOuterRadius = this.radius - (10 * scaleFactor) - properties.borderWidth;
this.context.beginPath(); this.context.beginPath();
this.context.arc(this.centerx, this.centery, this.radius - 10 - properties.borderWidth, redStart, redEnd, false); this.context.arc(this.centerx, this.centery, redOuterRadius, redStart, redEnd, false);
this.context.arc(this.centerx, this.centery, this.radius - (10 + properties.colorsRedWidth) - properties.borderWidth, redEnd, redStart, true); this.context.arc(
this.centerx,
this.centery,
yellowOuterRadius - (this.properties.colorsRedWidth * 2),
redEnd,
redStart,
true
);
this.context.fill(); this.context.fill();
}; };
@ -1882,6 +2094,35 @@
//
// Scale worker function that increases the size of
// properties as required. Called by the RGraph.scale()
// function.
//
// @param string name The name of the property
// @param mixed value The value of the property
//
this.scalePropertiesWorker = function (name, value)
{
var scaleFactor = RGraph.getScaleFactor(this);
if (name === 'titleY') {
value = String(parseFloat(value) * scaleFactor);
} else if (name === 'titleX') {
value = String(parseFloat(value) * scaleFactor);
}
return value;
};
// //
// Register the object // Register the object
// //

View File

@ -1,4 +1,4 @@
'version:2025-06-24 (6.22)'; 'version:2025-10-08 (7.01)';
// //
// o---------------------------------------------------------------------------------o // o---------------------------------------------------------------------------------o
// | This file is part of the RGraph package - you can learn more at: | // | This file is part of the RGraph package - you can learn more at: |
@ -76,6 +76,7 @@
labelsValueOffsetx: 0, labelsValueOffsetx: 0,
labelsValueOffsety: 0, labelsValueOffsety: 0,
needleExtra: [],
needleColor: 'black', needleColor: 'black',
needleLength: null, needleLength: null,
needleWidth: 2, needleWidth: 2,
@ -95,10 +96,10 @@
text: null, text: null,
colorsGreenMax: max * 0.75, colorsGreenMax: max * 0.75,
colorsGreenColor: 'Gradient(white:#0c0)', colorsGreenColor: '#0c0',
colorsYellowColor: 'Gradient(white:#ff0)', colorsYellowColor: '#cc0',
colorsRedMin: max * 0.9, colorsRedMin: max * 0.9,
colorsRedColor: 'Gradient(white:#f00)', colorsRedColor: '#c00',
marginLeft: 35, marginLeft: 35,
marginRight: 35, marginRight: 35,
@ -107,7 +108,7 @@
title: '', title: '',
titleFont: null, titleFont: null,
titleBold: null, titleBold: true,
titleItalic: null, titleItalic: null,
titleSize: null, titleSize: null,
titleColor: null, titleColor: null,
@ -151,10 +152,6 @@
scaleUnitsPost: '', scaleUnitsPost: '',
scaleZerostart: false, scaleZerostart: false,
resizable: false,
resizableHandleAdjust: [0,0],
resizableHandleBackground: null,
border: true, border: true,
borderColor1: '#BEBCB0', borderColor1: '#BEBCB0',
borderColor2: '#F0EFEA', borderColor2: '#F0EFEA',
@ -201,8 +198,67 @@
clearto: 'rgba(0,0,0,0)', clearto: 'rgba(0,0,0,0)',
events: {} events: {},
}
scale: true,
scaleFactor: 2,
antialiasTranslate: false
};
this.properties_scale = [
'centerx',
'centery',
'radius',
'labelsMargin',
'labelsSize',
'labelsValueSize',
'labelsValueOffsetx',
'labelsValueOffsety',
'needleWidth',
'needleLength',
'textSize',
'marginLeft',
'marginRight',
'marginTop',
'marginBottom',
'titleSize',
'titleX',
'titleY',
'titleOffsetx',
'titleOffsety',
'titleSubtitleSize',
'titleSubtitleOffsetx',
'titleSubtitleOffsety',
'linewidth',
'shadowInnerOffsetx',
'shadowInnerOffsety',
'shadowInnerBlur',
'shadowOuterOffsetx',
'shadowOuterOffsety',
'shadowOuterBlur',
'keyShadowBlur',
'keyShadowOffsetx',
'keyShadowOffsety',
'keyPositionMarginHSpace',
'keyPositionX',
'keyPositionY',
'keyLabelsSize',
'keyLabelsOffsetx',
'keyLabelsOffsety',
'annotatableLinewidth'
];
// //
@ -309,6 +365,19 @@
// //
this.draw = function () this.draw = function ()
{ {
// MUST be the first thing that's done - but only
// once!!
RGraph.runOnce(`scale-up-the-canvas-once-in-the-draw-function-${this.id}-${this.uid}`, () =>
{
// Note that we're in an arrow function so the
// 'this' variable is OK to be used and refers
// to the RGraph Line chart object.
RGraph.scale(this);
});
var scaleFactor = RGraph.getScaleFactor(this);
// //
// Fire the onbeforedraw event // Fire the onbeforedraw event
// //
@ -316,12 +385,15 @@
// Translate half a pixel for antialiasing purposes - but only if it hasn't been // Translate half a pixel for antialiasing purposes - but
// done already // only if it hasn't been done already
// //
// MUST be the first thing done! // The old style antialias fix
// //
if (!this.canvas.__rgraph_aa_translated__) { if ( !this.properties.scale
&& this.properties.antialiasTranslate
&& !this.canvas.__rgraph_aa_translated__) {
this.context.translate(0.5,0.5); this.context.translate(0.5,0.5);
this.canvas.__rgraph_aa_translated__ = true; this.canvas.__rgraph_aa_translated__ = true;
@ -376,9 +448,11 @@
// //
// Allow the centerx/centery/radius to be a plus/minus // Allow the centerx/centery/radius to be a plus/minus
// //
if (typeof properties.radius === 'string' && properties.radius.match(/^\+|-\d+$/) ) this.radius += parseFloat(properties.radius); var scaleFactor = RGraph.getScaleFactor(this);
if (typeof properties.centerx === 'string' && properties.centerx.match(/^\+|-\d+$/) ) this.centerx += parseFloat(properties.centerx);
if (typeof properties.centery === 'string' && properties.centery.match(/^\+|-\d+$/) ) this.centery += parseFloat(properties.centery); if (typeof properties.radius === 'string' && properties.radius.match(/^\+|-\d+$/) ) this.radius += parseFloat(properties.radius) * scaleFactor;
if (typeof properties.centerx === 'string' && properties.centerx.match(/^\+|-\d+$/) ) this.centerx += parseFloat(properties.centerx) * scaleFactor;
if (typeof properties.centery === 'string' && properties.centery.match(/^\+|-\d+$/) ) this.centery += parseFloat(properties.centery) * scaleFactor;
// //
// Allow custom setting of the radius // Allow custom setting of the radius
@ -590,6 +664,8 @@
// //
this.drawBackground = function () this.drawBackground = function ()
{ {
var scaleFactor = RGraph.getScaleFactor(this);
this.context.beginPath(); this.context.beginPath();
// //
@ -612,7 +688,7 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
this.radius + (properties.border ? 20 : 0), this.radius + (properties.border ? (20 * scaleFactor) : 0),
0.0001, 0.0001,
RGraph.TWOPI, RGraph.TWOPI,
false false
@ -627,10 +703,17 @@
// Draw a circle // Draw a circle
this.context.strokeStyle = '#666'; this.context.strokeStyle = '#666';
this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.TWOPI, false); this.context.arc(
this.centerx,
this.centery,
this.radius,
0,
RGraph.TWOPI,
false
);
// Now draw a big white circle to make the lines appear as tick marks // Now draw a big white circle to make the lines appear
// This is solely for Chrome // as tick marks. This is solely for Chrome.
this.context.fillStyle = backgroundColor; this.context.fillStyle = backgroundColor;
this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.TWOPI, false); this.context.arc(this.centerx, this.centery, this.radius, 0, RGraph.TWOPI, false);
this.context.fill(); this.context.fill();
@ -705,7 +788,7 @@
// Draw the "tick highlight" // Draw the "tick highlight"
if (properties.tickmarksHighlighted) { if (properties.tickmarksHighlighted) {
this.context.beginPath(); this.context.beginPath();
this.context.lineWidth = 5; this.context.lineWidth = 5 * scaleFactor;
this.context.strokeStyle = greengrad; this.context.strokeStyle = greengrad;
this.context.arc(this.centerx, this.centery, this.radius - 2.5, this.context.arc(this.centerx, this.centery, this.radius - 2.5,
@ -741,7 +824,7 @@
// Draw the "tick highlight" // Draw the "tick highlight"
if (properties.tickmarksHighlighted) { if (properties.tickmarksHighlighted) {
this.context.beginPath(); this.context.beginPath();
this.context.lineWidth = 5; this.context.lineWidth = 5 * scaleFactor;
this.context.strokeStyle = yellowgrad; this.context.strokeStyle = yellowgrad;
this.context.arc(this.centerx, this.centery, this.radius - 2.5, ( this.context.arc(this.centerx, this.centery, this.radius - 2.5, (
@ -776,7 +859,7 @@
// Draw the "tick highlight" // Draw the "tick highlight"
if (properties.tickmarksHighlighted) { if (properties.tickmarksHighlighted) {
this.context.beginPath(); this.context.beginPath();
this.context.lineWidth = 5; this.context.lineWidth = 5 * scaleFactor;
this.context.strokeStyle = redgrad; this.context.strokeStyle = redgrad;
this.context.arc(this.centerx, this.centery, this.radius - 2.5,(((properties.colorsRedMin - this.min) / (this.max - this.min)) * RGraph.TWOPI) - RGraph.HALFPI,RGraph.TWOPI - RGraph.HALFPI,0); this.context.arc(this.centerx, this.centery, this.radius - 2.5,(((properties.colorsRedMin - this.min) / (this.max - this.min)) * RGraph.TWOPI) - RGraph.HALFPI,RGraph.TWOPI - RGraph.HALFPI,0);
this.context.stroke(); this.context.stroke();
@ -805,18 +888,38 @@
// //
if (properties.border) { if (properties.border) {
var grad = this.context.createRadialGradient(this.centerx, this.centery, this.radius, this.centerx, this.centery, this.radius + 20); var grad = this.context.createRadialGradient(
this.centerx,
this.centery,
this.radius,
this.centerx,
this.centery,
this.radius + (20 * scaleFactor)
);
grad.addColorStop(0, properties.borderColor1); grad.addColorStop(0, properties.borderColor1);
grad.addColorStop(0.5, properties.borderColor2); grad.addColorStop(0.5, properties.borderColor2);
grad.addColorStop(1, properties.borderColor3); grad.addColorStop(1, properties.borderColor3);
this.context.beginPath(); this.context.beginPath();
this.context.fillStyle = grad; this.context.fillStyle = grad;
this.context.strokeStyle = 'rgba(0,0,0,0)' this.context.strokeStyle = 'rgba(0,0,0,0)'
this.context.lineWidth = 0.001; this.context.lineWidth = 0.001;
this.context.arc(this.centerx, this.centery, this.radius + 20, 0, RGraph.TWOPI, 0); this.context.arc(
this.context.arc(this.centerx, this.centery, this.radius - 2, RGraph.TWOPI, 0, 1); this.centerx,
this.centery,
this.radius + (20 * scaleFactor),
0,
RGraph.TWOPI,
0
);
this.context.arc(
this.centerx,
this.centery,
this.radius - 2,
RGraph.TWOPI,
0,
1
);
this.context.fill(); this.context.fill();
} }
@ -867,6 +970,8 @@
// //
this.drawNeedle = function (opt) this.drawNeedle = function (opt)
{ {
var scaleFactor = RGraph.getScaleFactor(this);
// The optional length of the needle // The optional length of the needle
opt.length = opt.length ? opt.length : this.radius - properties.labelsMargin - 10; opt.length = opt.length ? opt.length : this.radius - properties.labelsMargin - 10;
@ -878,7 +983,7 @@
this.context.moveTo(this.centerx, this.centery); this.context.moveTo(this.centerx, this.centery);
this.context.arc( this.context.arc(
this.centerx, this.centery, this.centerx, this.centery,
10, 10 * scaleFactor,
0, RGraph.TWOPI, 0, RGraph.TWOPI,
false false
); );
@ -894,10 +999,19 @@
this.context.fillStyle = opt.color this.context.fillStyle = opt.color
this.context.strokeStyle = '#666'; this.context.strokeStyle = '#666';
// Draw the centre bit //
// Draw the black centrepin bit
//
this.context.beginPath(); this.context.beginPath();
this.context.moveTo(this.centerx, this.centery); this.context.moveTo(this.centerx, this.centery);
this.context.arc(this.centerx, this.centery, 8, 0, RGraph.TWOPI, false); this.context.arc(
this.centerx,
this.centery,
8 * scaleFactor,
0,
RGraph.TWOPI,
false
);
this.context.fill(); this.context.fill();
this.context.closePath(); this.context.closePath();
@ -914,7 +1028,8 @@
// Draw the needle // Draw the needle
this.context.beginPath(); this.context.beginPath();
// The trailing bit on the opposite side of the dial // The trailing bit on the opposite side of
// the dial.
this.context.beginPath(); this.context.beginPath();
this.context.moveTo( this.context.moveTo(
this.centerx, this.centerx,
@ -926,18 +1041,19 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
20, 20 * scaleFactor,
(opt.value / this.range) * RGraph.TWOPI + RGraph.HALFPI, (opt.value / this.range) * RGraph.TWOPI + RGraph.HALFPI,
(opt.value / this.range) * RGraph.TWOPI + RGraph.HALFPI, (opt.value / this.range) * RGraph.TWOPI + RGraph.HALFPI,
false false
); );
} }
// Draw the long bit on the opposite side // Draw the long bit on the opposite
// side
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
opt.length - 20, opt.length - ((0.1 * opt.length) * scaleFactor),
(((opt.value / this.range) * 360) - 90) / (180 / RGraph.PI), (((opt.value / this.range) * 360) - 90) / (180 / RGraph.PI),
(((opt.value / this.range) * 360) - 90 + 0.1 ) / (180 / RGraph.PI), (((opt.value / this.range) * 360) - 90 + 0.1 ) / (180 / RGraph.PI),
false false
@ -955,12 +1071,13 @@
this.context.lineJoin = 'miter'; this.context.lineJoin = 'miter';
// //
// This draws the version of the pointer that becomes the border // This draws the version of the pointer that
// becomes the border.
// //
this.context.beginPath(); this.context.beginPath();
this.context.fillStyle = opt.triangleBorder; this.context.fillStyle = opt.triangleBorder;
this.context.arc(this.centerx, this.centery, 11, (((opt.value / this.range) * 360)) / 57.3, ((((opt.value / this.range) * 360)) + 0.01) / 57.3, 0); this.context.arc(this.centerx, this.centery, 11 * scaleFactor, (((opt.value / this.range) * 360)) / 57.3, ((((opt.value / this.range) * 360)) + 0.01) / 57.3, 0);
this.context.arc(this.centerx, this.centery, 11, (((opt.value / this.range) * 360) + 180) / 57.3, ((((opt.value / this.range) * 360) + 180) + 0.01)/ 57.3, 0); this.context.arc(this.centerx, this.centery, 11 * scaleFactor, (((opt.value / this.range) * 360) + 180) / 57.3, ((((opt.value / this.range) * 360) + 180) + 0.01)/ 57.3, 0);
this.context.arc(this.centerx, this.centery, opt.length - 5, (((opt.value / this.range) * 360) - 90) / 57.3, ((((opt.value / this.range) * 360) - 90) / 57.3) + 0.01, 0); this.context.arc(this.centerx, this.centery, opt.length - 5, (((opt.value / this.range) * 360) - 90) / 57.3, ((((opt.value / this.range) * 360) - 90) / 57.3) + 0.01, 0);
this.context.closePath(); this.context.closePath();
this.context.fill(); this.context.fill();
@ -983,14 +1100,14 @@
this.centerx, this.centerx,
this.centery, this.centery,
7, 7 * scaleFactor,
(((opt.value / this.range) * 360)) / 57.3, (((opt.value / this.range) * 360)) / 57.3,
((((opt.value / this.range) * 360)) + 0.01) / 57.3, ((((opt.value / this.range) * 360)) + 0.01) / 57.3,
this.centerx, this.centerx,
this.centery, this.centery,
7, 7 * scaleFactor,
(((opt.value / this.range) * 360) + 180) / 57.3, (((opt.value / this.range) * 360) + 180) / 57.3,
((((opt.value / this.range) * 360) + 180) + 0.01)/ 57.3 ((((opt.value / this.range) * 360) + 180) + 0.01)/ 57.3
); );
@ -1015,7 +1132,7 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
opt.type === 'pointer' ? 7 : 12, (opt.type === 'pointer' ? 7 : 12) * scaleFactor,
0.01, 0.01,
RGraph.TWOPI, RGraph.TWOPI,
false false
@ -1044,9 +1161,9 @@
this.context.arc( this.context.arc(
this.centerx, this.centerx,
this.centery, this.centery,
opt.length - 20, opt.length - ((opt.length * 0.1) * scaleFactor),
RGraph.toRadians( ((opt.value / this.range) * 360) - (opt.length < 60 ? 80 : 85) ), RGraph.toRadians( ((opt.value / this.range) * 360) - (this.radius > 300 ? (this.radius > 450 ? 87 : 85) : 82) ),
RGraph.toRadians( ((opt.value / this.range) * 360) - (opt.length < 60 ? 100 : 95) ), RGraph.toRadians( ((opt.value / this.range) * 360) - (this.radius > 300 ? (this.radius > 450 ? 93 : 95) : 97) ),
true true
); );
this.context.closePath(); this.context.closePath();
@ -1556,7 +1673,7 @@
} else { } else {
if (index === 0) { if (index === 0) {
return this.value; return this.value;
} else { } else if (RGraph.isArray(this.properties.needleExtra) && this.properties.needleExtra[index - 1]) {
return this.properties.needleExtra[index - 1][0]; return this.properties.needleExtra[index - 1][0];
} }
} }
@ -1658,6 +1775,43 @@
//
// Scale worker function that increases the size of
// properties as required. Called by the RGraph.scale()
// function.
//
// @param string name The name of the property
// @param mixed value The value of the property
//
this.scalePropertiesWorker = function (name, value)
{
var scaleFactor = RGraph.getScaleFactor(this);
if (name === 'titleY') {
value = String(parseFloat(value) * scaleFactor);
} else if (name === 'titleX') {
value = String(parseFloat(value) * scaleFactor);
} else if (name === 'needleLength' || name === 'needleWidth') {
for (var i=0; i<value.length; ++i) {
if (RGraph.isNumeric(value[i])) {
value[i] *= scaleFactor;
}
}
}
return value;
};
// //
// Register the object // Register the object
// //

View File

@ -1,4 +1,4 @@
'version:2025-06-24 (6.22)'; 'version:2025-10-08 (7.01)';
// //
// o---------------------------------------------------------------------------------o // o---------------------------------------------------------------------------------o
// | This file is part of the RGraph package - you can learn more at: | // | This file is part of the RGraph package - you can learn more at: |
@ -79,7 +79,7 @@
titleFont: null, titleFont: null,
titleSize: null, titleSize: null,
titleColor: null, titleColor: null,
titleBold: null, titleBold: true,
titleItalic: null, titleItalic: null,
titleHalign: null, titleHalign: null,
titleValign: null, titleValign: null,
@ -178,8 +178,95 @@
clearto: 'rgba(0,0,0,0)', clearto: 'rgba(0,0,0,0)',
bulbBottomRadiusAdjust: 0, bulbBottomRadiusAdjust: 0,
bulbBottomRadius: null bulbBottomRadius: null,
}
events: {},
scale: true,
scaleFactor: 2,
antialiasTranslate: false
};
//
// These are the properties that get scaled up if the
// scale option is enabled.
//
this.properties_scale = [
'linewidth',
'marginLeft',
'marginRight',
'marginTop',
'marginBottom',
'marginInner',
'shadowBlur',
'shadowOffsetx',
'shadowOffsety',
'titleSize',
'titleOffsetx',
'titleOffsety',
'titleSubtitleSize',
'titleSubtitleOffsetx',
'titleSubtitleOffsety',
'titleSideSize',
'titleSideOffsetx',
'titleSideOffsety',
'textSize',
'highlightLinewidth',
'labelsInnerSize',
'labelsInnerBorderLinewidth',
'labelsInnerOffsetx',
'labelsInnerOffsety',
'labelsOffsetx',
'labelsOffsety',
'labelsSize',
'labelsValueSize',
'labelsValueOffsetx',
'labelsValueOffsety',
'keyShadowBlur',
'keyShadowOffsetx',
'keyShadowOffsety',
'keyPositionX',
'keyPositionY',
'keyLinewidth',
'keyInteractiveHighlightChartLinewidth',
'keyLabelsSize',
'keyLabelsOffsetx',
'keyLabelsOffsety'
];
// //
@ -293,17 +380,42 @@
// //
this.draw = function () this.draw = function ()
{ {
// MUST be the first thing that's done - but only
// once!!
RGraph.runOnce(`scale-up-the-canvas-once-in-the-draw-function-${this.id}-${this.uid}`, () =>
{
// Note that we're in an arrow function so the
// 'this' variable is OK to be used and refers
// to the RGraph Line chart object.
RGraph.scale(this);
});
// Fire the custom RGraph onbeforedraw event (which should be fired before the chart is drawn) // Fire the custom RGraph onbeforedraw event (which should be fired before the chart is drawn)
RGraph.fireCustomEvent(this, 'onbeforedraw'); RGraph.fireCustomEvent(this, 'onbeforedraw');
// Translate half a pixel for antialiasing purposes - but only if it hasn't been // Translate half a pixel for antialiasing purposes - but
// done already // only if it hasn't been done already
// //
// MUST be the first thing done! // The old style antialias fix
// //
if (!this.canvas.__rgraph_aa_translated__) { if ( !this.properties.scale
&& this.properties.antialiasTranslate
&& !this.canvas.__rgraph_aa_translated__) {
this.context.translate(0.5,0.5); this.context.translate(0.5,0.5);
this.canvas.__rgraph_aa_translated__ = true; this.canvas.__rgraph_aa_translated__ = true;
@ -1439,22 +1551,23 @@
tooltip = args.tooltip, tooltip = args.tooltip,
index = args.index, index = args.index,
canvasXY = RGraph.getCanvasXY(obj.canvas) canvasXY = RGraph.getCanvasXY(obj.canvas)
coords = this.coords[args.index]; coords = this.coords[args.index],
scaleFactor = RGraph.getScaleFactor(this);
// Position the tooltip in the X direction // Position the tooltip in the X direction
args.tooltip.style.left = ( args.tooltip.style.left = (
canvasXY[0] // The X coordinate of the canvas canvasXY[0] // The X coordinate of the canvas
+ coords[0] // The X coordinate of the point on the chart + (coords[0]/ scaleFactor) // The X coordinate of the point on the chart
+ (coords[2] / 2) // Add half of the width of the bar + (coords[2] / 2 / scaleFactor) // Add half of the width of the bar
- (tooltip.offsetWidth / 2) // Subtract half of the tooltip width - (tooltip.offsetWidth / 2) // Subtract half of the tooltip width
+ obj.properties.tooltipsOffsetx // Add any user defined offset + obj.properties.tooltipsOffsetx // Add any user defined offset
) + 'px'; ) + 'px';
args.tooltip.style.top = ( args.tooltip.style.top = (
canvasXY[1] // The Y coordinate of the canvas canvasXY[1] // The Y coordinate of the canvas
+ coords[1] // The Y coordinate of the bar on the chart + (coords[1] / scaleFactor) // The Y coordinate of the bar on the chart
- tooltip.offsetHeight // The height of the tooltip - tooltip.offsetHeight // The height of the tooltip
- 10 // An arbitrary amount - (10 * scaleFactor) // An arbitrary amount
+ obj.properties.tooltipsOffsety // Add any user defined offset + obj.properties.tooltipsOffsety // Add any user defined offset
) + 'px'; ) + 'px';
@ -1558,6 +1671,35 @@
//
// Scale worker function that increases the size of
// properties as required. Called by the RGraph.scale()
// function.
//
// @param string name The name of the property
// @param mixed value The value of the property
//
this.scalePropertiesWorker = function (name, value)
{
var scaleFactor = this.properties.scaleFactor;
if (name === 'titleY') {
value = String(parseFloat(value) * scaleFactor);
} else if (name === 'titleX') {
value = String(parseFloat(value) * scaleFactor);
}
return value;
};
// //
// Now, because canvases can support multiple charts, canvases must always be registered // Now, because canvases can support multiple charts, canvases must always be registered
// //

View File

@ -1,743 +0,0 @@
/**
* Archivo principal de la administracion grafica de la aplicacion EMA Libre.
*
* Archivo de inicio el entorno grafico GUI del sistema EMA Libre que nos
* brinda una pantalla con las opciones: Configuracion general del sistema,
* ABM de Redes Meteorologicas,Visualizacion del sensores e informacion enviadas a la redes y
* reportes de log, como historicos registrados.
*
* LICENSE: This file is part of EMA Libre.
* EMA Libre is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EMA Libre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EMA Libre. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright (c) 2019 GUGLER (http://www.gugler.com.ar)
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL License
* @version 3.0
* @link http://www.gugler.com.ar
* @since File available since Release 3.0
*/
// **********************Dependencias **************************
//const configGeneralEMA = require('./../conf/ConfiguracionGeneral.js'); // Configuracion General
//const configGlobalEMA = require('./../conf/ConfiguracionGlobal.js'); // Configuracion Global
//const funcionesActualizar = require('./../core/actualizar.js'); // Se incluye el core de EMA.
//const EMA = require('./../core/ema.js'); // Se incluye el core de EMA.
//const gui = require('nw.gui'); // Libreria Grafica
//gui.App.clearCache(); // Se limpia cache
//win = gui.Window.get(); // Se obtiene la ventana actual
var configGeneralEMA;
var configGlobalEMA;
$.get("/configGeneralEMA", function(data, status){configGeneralEMA = data;});
$.get("/configGlobalEMA", function(data, status){configGlobalEMA = data; });
// **********************Vairales Generales*********************
const iconoEncendido = '/iconos/icono_enc.png'; // Imagen del Icono Encendido
const iconoApagado = '/iconos/icono_off.png'; // Imagen del Icono Apagado
const iconoPublicado = '/iconos/icono_pub.png'; // Imagen del Icono Apagado
const iconoNeutro = '/img/neutro.webp'; // Imagen del Icono Neutro
const iconoControlTrue = '/img/ok.webp'; // Imagen de Control TRUE
const iconoControlFalse = '/img/no.webp'; // Imagen de Control FALSE
var UltimoReg;
var Ant_UltimoReg;
var ModeloVisor; // Variables Generales - Registros recolectados
var destanqueo = 0;
var intervaloBarra = 0;
var cant = 0;
var tiempovisor=99;
// **********************Funciones Principales de la GUI *****************************************************
const esperar = ms => new Promise(function(resolve){setTimeout(resolve, ms);});
// Captura el redimencionamiento de la ventana
$(window).on('resize', function () {
var zoomLevel=0;
var width = $(window).width();
var height = $(window).height();
if (width < 300 && height < 300) { zoomLevel = 0.6; }
if (width > 300 && height > 300) { zoomLevel = 0.5; }
if (width > 350 && height > 350) { zoomLevel = 0.4; }
if (width > 800 && height > 600) { zoomLevel = 0; }
if (width > 850 && height > 690) { zoomLevel = 0; }
if (width > 1000 && height > 800) { zoomLevel = 0; }
if (width > 1200 && height > 820) { zoomLevel = 1.2; }
if (width > 1200 && height > 900) { zoomLevel = 1.3; }
if (width > 1400 && height > 1000) { zoomLevel = 1.4; }
// console.log(zoomLevel);
$('html').css({zoom: zoomLevel});
});
function ComprobarEstado () {
$.get("/EMA_estado", function(data, status){
var EstadoEMA_Control = data;
if(EstadoEMA_Control[0])
{
HABLA(0, 'Ya me encuentro recolectando ..', 'success');
$('#signal').addClass('parpadea');
$('td#barralateral').css('background-color', '#11881161');
$('#estado').html('En Linea');
$('#mensaje').html('Encendido');
$('#botoniniciar').attr('disabled', true);
$('#botondetener').attr('disabled', false);
RegistroActual();
clearInterval(intervaloBarra);
intervaloBarra = window.setInterval(function () { BarradeProgreso();}, 200);
}
});
}
function INICIAR () {
if (configGeneralEMA.ConfGeneral.Modo === 'Visor') { // se comprueba el modo
HABLA(0, 'Se inicio en modo Visor', 'success');
$('#signal').addClass('parpadea');
} else {
$.get("/iniciar", function(data, status){console.log('inicio');});
HABLA(0, 'Se inicio en modo Recolector', 'success');
$('#signal').addClass('parpadea');
}
$('td#barralateral').css('background-color', '#11881161');
$('#estado').html('En Linea');
$('#mensaje').html('Encendido');
$('#botoniniciar').attr('disabled', true);
$('#botondetener').attr('disabled', false);
RegistroActual();
clearInterval(intervaloBarra);
intervaloBarra = window.setInterval(function () { BarradeProgreso();}, 200);
}
async function iniciarAutomaticamente () {
EstadoMenuInicio();
if (configGeneralEMA.ConfGeneral.inicio_automatico) {
await esperar(4000);
HABLA(0, 'Iniciando Automaticamente..', 'info');
if ($('#mensaje').html() === 'Encienda EMA Libre') {
await esperar(5000);
INICIAR();
} else {
HABLA(0, 'No se pudo iniciar automaticamente, verifique el error', 'info');
}
}
}
function DETENER () {
clearInterval(intervaloBarra);
$('td#barralateral').css('background-color', '#ff000030');
$('#estado').html('Fuera de Linea');
$('#img_estado').attr('src', iconoNeutro);
$('#mensaje').html('EMA Libre se encuentra detenida');
$('#mensajedetalle').html('Se detuvo manualmente.');
$('#img_detalle').attr('src', iconoNeutro);
$('#img_mensaje').attr('src', iconoNeutro);
$('#botoniniciar').attr('disabled', false);
$('#botondetener').attr('disabled', true);
if (configGeneralEMA.ConfGeneral.Modo === 'Visor') { // se comprueba el modo
HABLA(0, 'Modo visor detenido', 'error');
$('#signal').removeClass('parpadea');
} else {
$.get("/detener", function(data, status){console.log('detener');});
HABLA(0, 'Modo Recolector detenido', 'error');
$('#signal').removeClass('parpadea');
}
}
async function redimensionarInicio ()
{
$('#loadinicio').attr('src', 'iconos/icono_app_guina.webp');
await esperar(500);
$('#loadinicio').attr('src', 'iconos/icono_app.webp');
await esperar(600);
$('#cargador').empty();
$('#cargador').remove();
$('#principal').show();
//win.setMinimumSize(700, 500);
// win.setMaximumSize(4000, 2000);
// win.maximize();
HABLA(0, '...', 'info');
await esperar(1000);
HABLA(0, 'Bienvenido a Ema Libre Cliente, me llaman Carpincho Web.', 'info');
iniciarAutomaticamente();
}
async function Actualizar () {
var SO_WIN = plataforma.indexOf('win');
if (SO_WIN === 0) {
funcionesActualizar.Control(function (resultado, VersionActual, nueva) {
$('#botonactualizar').attr('disabled', true);
if (resultado && VersionActual) {
DETENER();
HABLA(0, 'Descargando nueva versión de Carpincho: ' + nueva, 'info');
NProgress.set(0);
$('#mensajebarra').html('Descargando nueva versión, espere ....');
funcionesActualizar.Descargar(nueva, function (resultadoact, avance, porcentaje) {
NProgress.set(porcentaje/100);
$('#mensajebarra').html(avance);
if (resultadoact && avance) {
NProgress.set(1);
$('#mensajebarra').html('Descomprimiendo la nueva versión, espere ....');
HABLA(0, 'Descomprimiendo la nueva versión, espere ....', 'info');
funcionesActualizar.Descomprimir(function (resultadoact) {
if (resultadoact) {
$('#mensajebarra').html('Borrado del archivo descargado, espere ....');
funcionesActualizar.Desplegar(function (resultado) {
if (resultado) {
HABLA(0, 'Ejecutando App de Actualizacion, espere...', 'info');
setTimeout(funcionesActualizar.LanzarAplicativoIndependiente, 9000);
} else {
HABLA(0, 'Ocurrio un problema en el despliege, intente mas tarde', 'error');
}
});
} else {
HABLA(0, 'Ocurrio un problema descomprimiendo, intente mas tarde', 'error');
}
});
}
if (!resultadoact && !avance) {
HABLA(0, 'Ocurrio un problema en la descarga, intente mas tarde', 'error');
}
});
}
if (!resultado && VersionActual) {
HABLA(0, 'No hay versiones nuevas disponibles', 'success');
}
if (!resultado && !VersionActual) {
HABLA(0, 'No se pudo conectar al servidor de versiones,pruebe mas tarde...', 'error');
}
});
} else {
HABLA(0, 'Esta opción solo es válida para sistemas operativos Windows.', 'warn');
await esperar(4000);
HABLA(0, 'Pero usted puede actualizar EMA Libre con su sistema de paquetes nativo.', 'info');
await esperar(4000);
HABLA(0, 'O puede ingresar a https://ema.gugler.com.ar para más información. ', 'info');
}
$('#botonactualizar').attr('disabled', false);
}
async function HABLA (num, mesg, tipo) {
var tamañomsg = mesg.length;
if (num === 0) {
$('#carpincho_img').notify(mesg, {
className: tipo,
position: 'right middle',
autoHideDelay: (tamañomsg * 90)
});
if (configGeneralEMA.ConfGeneral.Audio) {
window.speechSynthesis.cancel();
var voices = window.speechSynthesis.getVoices();
var cantidadVoces = voices.length;
//console.log(cantidadVoces);
if( cantidadVoces > 0){
var seleccionada = voices.filter(function (voice) { return voice.name === configGeneralEMA.ConfGeneral.audioVoces; })[0];
//console.log(seleccionada);
var msg = new SpeechSynthesisUtterance (mesg);
msg.voice = seleccionada;
msg.rate = 1.2;
msg.pitch = 1;
window.speechSynthesis.speak(msg);
msg=null;seleccionada=null;voices=null;cantidadVoces=null;
}
}
}
if ($('#carpincho_img').attr('src') === 'iconos/icono_app.webp') {
$('#carpincho_img').attr('src', 'iconos/icono_app_habla.webp');
} else {
$('#carpincho_img').attr('src', 'iconos/icono_app.webp');
}
num++;
if (num < tamañomsg) {
await esperar(90);
HABLA(num ,mesg ,0);
} else {
$('#carpincho_img').attr('src', 'iconos/icono_app.webp');
//LimpiarMemoria(true);
}
num=null;tamañomsg = null;
}
async function GUIÑA (num)
{
if ($('#carpincho_img').attr('src') === 'iconos/icono_app.webp') {
$('#carpincho_img').attr('src', 'iconos/icono_app_guina.webp');
} else {
$('#carpincho_img').attr('src', 'iconos/icono_app.webp');
}
num++;
if (num < 2) {
await esperar(400);
GUIÑA(num);
} else {
$('#carpincho_img').attr('src', 'iconos/icono_app.webp');
}
num =null;
}
async function controlPendientes () {
//var pendientes = EMA.HayPendientes();
$.get("/HayPendientes", function(data, status)
{
var pendientes = data;
var DIVPENDIENTE = document.getElementById('DIVPendientes');
var SPANTANQUE = document.getElementById('Destanqueo');
var DIVModo = document.getElementById('DIVModo');
if (pendientes !== false)
{
DIVPENDIENTE.style.visibility = 'visible';
if ((pendientes < destanqueo)) {SPANTANQUE.style.visibility = 'visible'; } else {SPANTANQUE.style.visibility = 'hidden'; }
destanqueo = pendientes;
$('#Pendientes').html("<span class='label label-warning' title='Pendientes'> Cantidad: " + pendientes + '</span><br>');
} else {
destanqueo = 0;
DIVPENDIENTE.style.visibility = 'hidden';
SPANTANQUE.style.visibility = 'hidden';
DIVModo.style.visibility = 'hidden';
}
pendientes = null;
DIVPENDIENTE = null;
SPANTANQUE = null;
DIVModo = null;
});
return true;
}
async function mostrarEstados (EstadoSensores) {
// Se consulta por los sensores
var Resultado = !((EstadoSensores.lost_sensor_contact) || (EstadoSensores.rain_overflow));
if (Resultado && (configGeneralEMA.ConfGeneral.Modo !== 'Visor')) {
$('#signal').attr('src', 'img/signal.webp');
$('#signal').addClass('parpadea');
} else {
if (!EstadoSensores.lost_sensor_contact) {
HABLA(0, 'Perdida de la señal de Radio Frecuencia', 'warn');
}
if (!EstadoSensores.rain_overflow) {
HABLA(0, 'Sensor de lluvia externo sobrecargado', 'warn');
}
$('#signal').attr('src', 'img/no_signal.webp');
$('#signal').addClass('parpadea');
// win.requestAttention(3);
}
EstadoSensores = null;
Resultado = null;
}
async function RegistroActual (barratermino)
{
if (configGeneralEMA.ConfGeneral.Modo === 'Recolector')
{ // se comprueba el modo se encuentra en Recolector
if(barratermino == true){
//BARRA TERMINO
//console.log('ENTRO AL BARRA TERMINO RECOLECTOR');
await esperar(100);
EstadoMenuInicio();
await esperar(100);
MuestraRegistroActual(true);
await esperar(100);
Graficos();
await esperar(100);
ClimaActual();
await esperar(1500);
RegistroPublicado();
cant=0;
}
$.get("/EMA_estado", async function(data, status){
var EstadoEMA = data;
if (EstadoEMA[0] === true)
{
$('#mensaje').html('Recolectando.');
$('#img_mensaje').attr('src', iconoControlTrue);
$('#mensajedetalle').html('Operando.');
$('#img_detalle').attr('src', iconoControlTrue);
controlPendientes();
$.get("/EstadoSensores", function(data, status){
var EstadoSensores = data;
if(EstadoSensores !== false)
{
mostrarEstados(EstadoSensores);
}else{EstadoSensores=null;}
});
$.get("/UltimoRegistro", function(data, status){
UltimoReg = data;
if (UltimoReg == false) {
// Se consulta por la cantidad de errores
//await esperar(10000);
HABLA(0, 'No se pueden obtener registros. Desconecte y vuelva a conectar el USB. Se prueba reiniciar el servicio.', 'error');
} else {
// $('#mensaje').html(' Sincronizando ...');
// $('#img_mensaje').attr('src', iconoNeutro);
//await esperar(200);
// RegistroActual();
return false;
}
});
} else {
$('#mensaje').html('EmaLibre detenida.');
$('#img_mensaje').attr('src', iconoControlFalse);
$('#mensajedetalle').html(EstadoEMA[1]);
$('#img_detalle').attr('src', iconoControlFalse);
await esperar(5000);
RegistroActual();
return false;
}
});
} else { // Modo visor
if(barratermino == true){
//BARRA TERMINO
await esperar(100);
EstadoMenuInicio();
await esperar(100);
MuestraRegistroActual(true);
await esperar(100);
Graficos();
await esperar(100);
ClimaActual();
cant=0;
}
$('#signal').attr('src', 'img/visor.webp');
$.get("/Visor", function(data, status){
if (data[0] != null) {
HABLA(0, 'No se pueden obtener datos del servidor. ' + data[0], 'info');
$('#signal').removeClass('parpadea');
setTimeout(function(){RegistroActual();}, 10000);
} else {
$('#signal').addClass('parpadea');
var DIVModo = document.getElementById('DIVModo');
DIVModo.style.visibility = 'visible';
document.getElementById('DIVModo').innerHTML = "<span class='badge badge-primary' title='Modo Visor'> Modo Visor </span><br><span class='badge badge-primary' >" + data[1].pais + ', ' + data[1].ciudad + "</span><br><span class='badge badge-primary' >" + data[1].modelo + '</span>';
UltimoReg = data[1].registros[0];
ModeloVisor = data[1].nombre;
// se convierte la fecha
var db = new Date(data[1].registros[0].fecha);
var minutos = db.getMinutes();
if (minutos <= 9) { minutos = '0' + minutos; }
var hora = db.getHours();
if (hora <= 9) { hora = '0' + hora; }
var mes = db.getMonth() + 1;
if (mes <= 9) { mes = '0' + mes; }
var dia = db.getDate();
if (dia <= 9) { dia = '0' + dia; }
var segundo = db.getSeconds();
if (segundo <= 9) { segundo = '0' + segundo; }
var fecha = dia + '/' + mes + '/' + db.getFullYear() + ' ' + hora + ':' + minutos + ':' + segundo;
UltimoReg.fecha = fecha;
fecha=null;dia=null;mes=null;segundo=null;minutos=null;hora=null;db=null;
// ver acumulados de lluvia
UltimoReg.lloviendo = data[1].registros[0].lluvia_actual;
UltimoReg.lluvia_acu_hora = data[1].registros[0].lluvia_acumulado_hora;
UltimoReg.lluvia_acu_diaria = data[1].registros[0].lluvia_acumulado_diario;
UltimoReg.lluvia_acumulado_total = data[1].registros[0].lluvia_acumulado_total;
// Maximas y minimas, no llegan de EMACENTER, por el momento se setean en 0.
UltimoReg.temperatura_externa_max_dia = 0;
UltimoReg.temperatura_externa_min_dia = 0;
UltimoReg.temperatura_interna_max_dia = 0;
UltimoReg.temperatura_interna_min_dia = 0;
UltimoReg.punto_de_rocio_max_dia = 0;
UltimoReg.punto_de_rocio_min_dia = 0;
UltimoReg.humedad_externa_max_dia = 0;
UltimoReg.humedad_externa_min_dia = 0;
UltimoReg.humedad_interna_max_dia = 0;
UltimoReg.humedad_interna_min_dia = 0;
UltimoReg.luxer_intencidad_max_dia = 0;
UltimoReg.luxer_intencidad_min_dia = 0;
UltimoReg.luxer_uv_max_dia = 0;
UltimoReg.luxer_uv_min_dia = 0;
UltimoReg.presion_relativa_max_dia = 0;
UltimoReg.presion_relativa_min_dia = 0;
tiempovisor = tiempovisor - 0.2;
}
});
}
EstadoEMA = null;
}
async function BarradeProgreso () {
if (configGeneralEMA.ConfGeneral.Modo === 'Recolector')
{ // EN MODO RECOLECTOR
$.get("/TiempoActualRecolector", function(data, status){
tiempoActualRecolector = data;
if(tiempoActualRecolector[0] !== false || tiempoActualRecolector[1] > 0)
{
if ((tiempoActualRecolector[0] < 98 && tiempoActualRecolector[1] > 0.39) )
{
// CONTINUA ADENTRO
NProgress.set(tiempoActualRecolector[0]/100);
return false;
} else {
// Cuando termine cada barra, publica y luego vuelve al leer el registro actual
cant++;
if(cant == 1){ RegistroActual(true);} else{return true;};
// solo si esta en modo visor
if (configGeneralEMA.ConfGeneral.Modo !== 'Recolector') {document.getElementById('RedesMet').innerHTML = "<span class='badge badge-success' title='Obtenido Correctamente'>" + ModeloVisor + ': ' + UltimoReg.fecha.substring(10, 20) + '</span><br>';}
NProgress.done();
}
}else{ if(cant > 0){return false;}
NProgress.done();
}
});
} else { // MODO VISOR
if( tiempovisor != 99)
{
if( tiempovisor >= configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion)
{
tiempovisor = 0;
RegistroActual(true);
NProgress.done();
}else{
tiempovisor = tiempovisor + 0.2; // se le suma el tiempo del intervalo
var tiempo_barra = ((tiempovisor * 100) / configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion)/100;
NProgress.set(tiempo_barra);
}
}
}
UltimoPub = null;aux=null;tiempoActualRecolector = null; tiempo_barra = null;
}
// ********************** Menu Acciones *******************************************************************
function MenuConfig () {
if ($('#Modo').val() === 'Recolector') {
$('#LlaveR').attr('disabled', true);
$('#LlaveR').val('');
$('#LlaveR').hide();
} else {
$('#LlaveR').attr('disabled', false);
$('#LlaveR').show();
$('#Llave_R').val(configGeneralEMA.ConfGeneral.Llave_R);
}
if ($('#Tipo_SMTP').val() === 'Deshabilitado') {
$('#Usuario_SMTP').attr('disabled', true);
$('#Contrasenia_SMTP').attr('disabled', true);
$('#Puerto_SMTP').attr('disabled', true);
$('#Server_SMTP').attr('disabled', true);
$('#Puerto_SMTP').val('');
$('#puerto').hide();
$('#Server_SMTP').val('');
$('#Server').hide();
} else {
$('#Usuario_SMTP').attr('disabled', false);
$('#Contrasenia_SMTP').attr('disabled', false);
if ($('#Tipo_SMTP').val() === 'Manual') {
$('#Puerto_SMTP').attr('disabled', false);
$('#puerto').show();
$('#Server_SMTP').attr('disabled', false);
$('#Server').show();
} else {
$('#Puerto_SMTP').attr('disabled', true);
$('#puerto').hide();
$('#Server_SMTP').attr('disabled', true);
$('#Server').hide();
}
$('#Usuario_SMTP').val(configGeneralEMA.ConfEmail.Usuario);
$('#Contrasenia_SMTP').val(configGeneralEMA.ConfEmail.Password);
$('#Server_SMTP').val(configGeneralEMA.ConfEmail.Server);
$('#Puerto_SMTP').val(configGeneralEMA.ConfEmail.Puerto);
}
if ($('#audio').val() === 'Desactivado') {
$('#vocesAudioDiv').attr('disabled', true);
$('#vocesAudioDiv').val('');
$('#vocesAudioDiv').hide();
} else {
$('#vocesAudioDiv').attr('disabled', false);
$('#vocesAudioDiv').show();
$('#vocesAudio').val(configGeneralEMA.ConfGeneral.audioVoces);
$('#vocesAudio').selectpicker('render');
}
}
async function MenuGUI (elemento) {
try {
document.getElementById("actualizando_inicio").hidden = false;
document.getElementById("actualizando_inicio").style.display = "block";
var seleccion;
if (elemento === 'logs') {seleccion = document.getElementById('configuracion');}
else {seleccion = document.getElementById(elemento);}
$(seleccion).empty();
$(seleccion).hide();
$(seleccion).load('./view/modelo_' + elemento + '.html', function (datosArchivo) {
switch (elemento) {
case 'logs':
VerRegistrosLog();
$('#interior').empty();$('#exterior').empty();$('#inicio').empty();$('#contacto').empty();$('#inicio').empty();$('#estadisticas').empty();
break;
case 'redes':
ListarRedes();
$('#interior').empty();$('#exterior').empty();$('#contacto').empty();$('#configuracion').empty();$('#inicio').empty();$('#estadisticas').empty();
break;
case 'redes_alta':
MenuSelectRed();
break;
case 'inicio':
$('#node_pid').html(pid);
$('#node_ppid').html(ppid);
$('#nwjs_v').html(version_node);
EstadoMenuInicio();
$('#interior').empty();$('#exterior').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break;
case 'interior':
MuestraRegistroActual(false,'interior');
Graficos('interior');
$('#inicio').empty();$('#exterior').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break;
case 'exterior':
MuestraRegistroActual(false,'exterior');
Graficos('exterior');
$('#interior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break;
case 'estadisticas':
graficoEstadisticas();
$('#interior').empty();$('#exterior').empty();$('#inicio').empty();$('#contacto').empty();$('#configuracion').empty();$('#redes').empty();
break;
case 'contacto':
var NombreVersion = ' v' + configGlobalEMA.ConfGlobal.Version;
$('#versioncontacto').html(NombreVersion);
$('#interior').empty();$('#exterior').empty();$('#inicio').empty();$('#configuracion').empty();$('#redes').empty();$('#estadisticas').empty();
break;
case 'configuracion':
$('#interior').empty();$('#exterior').empty();$('#contacto').empty();$('#inicio').empty();$('#redes').empty();$('#estadisticas').empty();
// Se obtienen las voces del sistema
var synth = window.speechSynthesis;
const voice = synth.getVoices();
var voiceSelect = document.getElementById('vocesAudio');
var cantidadVoces = voice.length;
if( cantidadVoces > 0){
for (var i = 0; i < cantidadVoces; i++)
{
var option = document.createElement('option');
option.textContent = voice[i].name;
option.setAttribute('value', voice[i].name);
voiceSelect.appendChild(option);
}
}else{
var option = document.createElement('option');
voice[0] = 'Sin Voces';
option.textContent = 'Sin voces, verifique el SO';
option.setAttribute('value', 'Sin Voces');
voiceSelect.appendChild(option);
voiceSelect.selectedIndex = "0";
}
$('#NombreEstacion').val(configGeneralEMA.ConfGeneral.NombreEstacion);
$('#Modo').val(configGeneralEMA.ConfGeneral.Modo);
$('#Modo').selectpicker('render');
$('#SistemaMetrico').val(configGeneralEMA.ConfGeneral.SistemaMetrico);
$('#SistemaMetrico').selectpicker('render');
$('#Llave_R').val(configGeneralEMA.ConfGeneral.Llave_R);
$('#Tiempo_de_Recoleccion').val(configGeneralEMA.ConfGeneral.Tiempo_de_Recoleccion);
$('#Email_receptor').val(configGeneralEMA.ConfEmail.ReceptorEmail);
$('#Tipo_SMTP').val(configGeneralEMA.ConfEmail.Servicio);
$('#Tipo_SMTP').selectpicker('render');
$('#Tiempo_de_Recoleccion').selectpicker('render');
$('#Debug').val(configGeneralEMA.ConfGeneral.debug);
$('#debugMB').val(configGeneralEMA.ConfGeneral.debugTamanio);
$('#Debug').selectpicker('render');
var automatico;
if (configGeneralEMA.ConfGeneral.inicio_automatico) { automatico = 'Activado'; } else { automatico = 'Desactivado'; }
$('#inicio_auto').val(automatico);
$('#inicio_auto').selectpicker('render');
var cambios;
if (configGeneralEMA.ConfGeneral.notificar_cambios) { cambios = 'Activado'; } else { cambios = 'Desactivado'; }
$('#notificar_cambios').val(cambios);
$('#notificar_cambios').selectpicker('render');
var Audio;
if (configGeneralEMA.ConfGeneral.Audio) { Audio = 'Activado'; } else { Audio = 'Desactivado'; }
$('#audio').val(Audio);
$('#audio').selectpicker('render');
$('#utc').val(configGeneralEMA.ConfGeneral.UTC);
$('#utc').selectpicker('render');
// Control para el audio
if (configGeneralEMA.ConfGeneral.Audio === false) {
$('#vocesAudioDiv').attr('disabled', true);
$('#vocesAudioDiv').val('');
$('#vocesAudioDiv').hide();
} else {
$('#vocesAudioDiv').attr('disabled', false);
$('#vocesAudioDiv').show();
if (configGeneralEMA.ConfGeneral.audioVoces === null || typeof configGeneralEMA.ConfGeneral.audioVoces === 'undefined') { $('#vocesAudio').val(voice[0].name); } else { $('#vocesAudio').val(configGeneralEMA.ConfGeneral.audioVoces); }
}
$('#vocesAudio').selectpicker('render');
// Control para el modo
if ($('#Modo').val() === 'Recolector') {
$('#LlaveR').attr('disabled', true);
$('#LlaveR').val('');
$('#LlaveR').hide();
} else {
$('#LlaveR').attr('disabled', false);
$('#LlaveR').show();
$('#Llave_R').val(configGeneralEMA.ConfGeneral.Llave_R);
}
// Control para el SMTP
if ($('#Tipo_SMTP').val() === 'Deshabilitado') {
$('#Usuario_SMTP').attr('disabled', true);
$('#Contrasenia_SMTP').attr('disabled', true);
$('#Puerto_SMTP').attr('disabled', true);
$('#Server_SMTP').attr('disabled', true);
$('#Server').hide();
$('#puerto').hide();
} else {
$('#Usuario_SMTP').attr('disabled', false);
$('#Contrasenia_SMTP').attr('disabled', false);
$('#Server_SMTP').attr('disabled', false);
$('#Puerto_SMTP').attr('disabled', false);
$('#Usuario_SMTP').val(configGeneralEMA.ConfEmail.Usuario);
$('#Contrasenia_SMTP').val(configGeneralEMA.ConfEmail.Password);
$('#Server_SMTP').val(configGeneralEMA.ConfEmail.Server);
$('#Puerto_SMTP').val(configGeneralEMA.ConfEmail.Puerto);
if ($('#Tipo_SMTP').val() === 'Manual') {
$('#Server_SMTP').attr('disabled', false);
$('#Puerto_SMTP').attr('disabled', false);
$('#puerto').show();
$('#Server').show();
} else {
$('#puerto').hide();
$('#Server').hide();
}
}
break;
default:
console.log('No existe el menu seleccionado: ' + elemento);
}
setTimeout(function(){ document.getElementById("actualizando_inicio").style.display = "none";
document.getElementById("actualizando_inicio").hidden = false;
$(seleccion).show();
}, 200);
});
} catch (e) { // Si falla se informa y se vuelve a cargar el modelo interior
HABLA(0, 'Se realizó un reload de la libreria grafica interior', 'info');
}
}
async function autoLoad ()
{
await esperar(6000);
ComprobarEstado();
//var plataforma = process.platform;
//var SO_WIN = plataforma.indexOf('win');
//if (SO_WIN === 0) { funcionesActualizar.Control(function (resultado, VersionActual, nueva) { if (resultado) { HABLA(0, 'Hay una nueva version de Carpincho. Versión ' + nueva, 'error'); } }); }
}
autoLoad();

View File

@ -26,12 +26,12 @@
// VARIABLES GENERALES // VARIABLES GENERALES
var Sube = "<img src='img/clima/sube.webp' title='"; // Imagen cuando sube una lectura, la misma se completa con la tendencia. var Sube = "<img src='gui_common/img/clima/sube.webp' title='"; // Imagen cuando sube una lectura, la misma se completa con la tendencia.
var Baja = "<img src='img/clima/baja.webp' title='"; // Imagen cuando baja una lectura, la misma se completa con la tendencia. var Baja = "<img src='gui_common/img/clima/baja.webp' title='"; // Imagen cuando baja una lectura, la misma se completa con la tendencia.
var Igual = "<img src='img/clima/igual.webp'>"; // Imagen cuando no hay cambios. var Igual = "<img src='gui_common/img/clima/igual.webp'>"; // Imagen cuando no hay cambios.
var icono_control_true = 'img/ok.webp'; // Imagen de Control TRUE var icono_control_true = 'gui_common/img/ok.webp'; // Imagen de Control TRUE
var icono_control_false = 'img/no.webp'; // Imagen de Control FALSE var icono_control_false = 'gui_common/img/no.webp'; // Imagen de Control FALSE
var icono_control_neutro = 'img/neutro.webp'; // Imagen de Control NEUTRO - ALERT var icono_control_neutro = 'gui_common/img/neutro.webp'; // Imagen de Control NEUTRO - ALERT
var pid,ppid,plataforma,arquitectura,version_node='-'; var pid,ppid,plataforma,arquitectura,version_node='-';
// Se obtienen los datos de la plataforma // Se obtienen los datos de la plataforma
$.get("/plataforma", function(data, status) $.get("/plataforma", function(data, status)
@ -93,15 +93,15 @@ async function EstadoMenuInicio()
$('#inombre').html(configGeneralEMA.ConfGeneral.NombreEstacion); $('#inombre').html(configGeneralEMA.ConfGeneral.NombreEstacion);
$('#botoniniciar').attr("disabled",true); $('#botoniniciar').attr("disabled",true);
$('#botondetener').attr("disabled",true) $('#botondetener').attr("disabled",true)
if(configGeneralEMA.ConfGeneral.NombreEstacion != ''){$("#img_nombre").attr("src",icono_control_true);}else{$("#img_nombre").attr("src",icono_control_neutro);}
$('#iso').html(plataforma + " (" + arquitectura + ")"); $('#iso').html(plataforma + " (" + arquitectura + ")");
if(plataforma != ''){$("#img_so").attr("src",icono_control_true);}else{$("#img_so").attr("src",icono_control_false);}
$('#imodo').html(configGeneralEMA.ConfGeneral.Modo); $('#imodo').html(configGeneralEMA.ConfGeneral.Modo);
if(configGeneralEMA.ConfGeneral.Modo != ''){$("#img_modo").attr("src",icono_control_true);}else{$("#img_modo").attr("src",icono_control_false);}
if(configGeneralEMA.ConfGeneral.Modo != 'Visor') // Se consulta el modo (Recolector o Visor) if(configGeneralEMA.ConfGeneral.Modo != 'Visor') // Se consulta el modo (Recolector o Visor)
{ {
$.get("/EMA_estado", function(data, status){ $.get("/EMA_estado", function(data, status){
var EstadoEMA_Control = data; var EstadoEMA_Control = data;
if(configGeneralEMA.ConfGeneral.Modo === 'Recolector_USB') // Modo Recolector USB
{
if(EstadoEMA_Control[0]) if(EstadoEMA_Control[0])
{ {
$("#img_estado").attr("src",icono_control_true);$('#estado').html("En Linea"); $("#img_estado").attr("src",icono_control_true);$('#estado').html("En Linea");
@ -135,6 +135,29 @@ async function EstadoMenuInicio()
} }
}); });
} }
}else{ // Modo Recolector por IP/WIFI
if(EstadoEMA_Control[0])
{
$("#img_estado").attr("src",icono_control_true);$('#estado').html("En Linea");
$('#botoniniciar').attr("disabled",true);
$('#botondetener').attr("disabled",false);
$('#iusb').html("Recolectado por IP");$("#img_estacion").attr("src",icono_control_true);
$('#mensaje').html("Recolectado por IP");$("#img_mensaje").attr("src",icono_control_true);
$("#img_detalle").attr("src",icono_control_true);
MensajeR = "Recolectando de " + configGeneralEMA.ConfGeneral.IP + ":" + configGeneralEMA.ConfGeneral.Puerto + configGeneralEMA.ConfGeneral.Ruta;
;$('#mensajedetalle').html(MensajeR);
}else{
MensajeR = "Al iniciar comenzara a recoletar en " + configGeneralEMA.ConfGeneral.IP + ":" + configGeneralEMA.ConfGeneral.Puerto + configGeneralEMA.ConfGeneral.Ruta;
$('#mensaje').html("Encienda EMA Libre");
$('#botoniniciar').attr("disabled",false);
$('#botondetener').attr("disabled",true);
$("#img_estacion").attr("src",icono_control_neutro);$('#iusb').html("Estación Wifi/IP sin recepción");
$("#img_mensaje").attr("src",icono_control_neutro);$('#mensaje').html("Encienda EMA Libre.");
$("#img_estado").attr("src",icono_control_neutro);$('#estado').html("Fuera de Linea");
$("#img_detalle").attr("src",icono_control_neutro);$('#mensajedetalle').html(MensajeR);
}
}
}); });
}else{ // Modo Visor Control }else{ // Modo Visor Control
$('#iusb').html("Por Llave Lectura"); $('#iusb').html("Por Llave Lectura");
@ -321,8 +344,8 @@ async function ClimaActual()
if( (UltimoReg.luxer_intencidad < UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_0.gif';} // OCASO? if( (UltimoReg.luxer_intencidad < UltimoReg.luxer_intencidad_1hs) && (UltimoReg.luxer_intencidad > 0 && UltimoReg.luxer_intencidad < 800)){ SALIDA_ENTRADA = '_0.gif';} // OCASO?
//Icono central //Icono central
var image = document.createElement("IMG");image.alt = "Clima Actual";image.setAttribute("height", "96px");image.setAttribute("width", "96px");image.setAttribute('class', 'photo'); var image = document.createElement("IMG");image.alt = "Clima Actual";image.setAttribute("height", "96px");image.setAttribute("width", "96px");image.setAttribute('class', 'photo');
if(SALIDA_ENTRADA != ""){image.src="img/clima/1_0_clima" + SALIDA_ENTRADA; //ver de agregar ALBA Y OCASO con lluvia if(SALIDA_ENTRADA != ""){image.src="gui_common/img/clima/1_0_clima" + SALIDA_ENTRADA; //ver de agregar ALBA Y OCASO con lluvia
}else{image.src="img/clima/" + NOCHE_DIA +"_" + LLUEVE + "_clima" + SALIDA_ENTRADA +".webp";} }else{image.src="gui_common/img/clima/" + NOCHE_DIA +"_" + LLUEVE + "_clima" + SALIDA_ENTRADA +".webp";}
$('#clima').html(image); $('#clima').html(image);
//Fondo de la aplicacion //Fondo de la aplicacion
if( LLUEVE == 1){HABLA(0,"Se registra lluvia","info"); if( LLUEVE == 1){HABLA(0,"Se registra lluvia","info");
@ -332,12 +355,14 @@ async function ClimaActual()
if(UltimoReg.cambio === true && configGeneralEMA.ConfGeneral.notificar_cambios === true){ if(UltimoReg.cambio === true && configGeneralEMA.ConfGeneral.notificar_cambios === true){
var cambiosCarpincho = ''; var cambiosCarpincho = '';
// Obteniendo todas las claves del JSON // Obteniendo todas las claves del JSON
let contador = 0;
for (var clave in UltimoReg.diferencia){ for (var clave in UltimoReg.diferencia){
// Controlando que json realmente tenga esa propiedad if(configGeneralEMA.ConfGeneral.Modo != 'Recolector_IP') // Modo Recolector USB
if (UltimoReg.diferencia.hasOwnProperty(clave)) { { if (UltimoReg.diferencia.hasOwnProperty(clave)) {cambiosCarpincho += ' ' + mapaDatos.get(clave) + '.'; }
// Mostrando en pantalla la clave junto a su valor }else{ // Modo Recolector por IP/WIFI
cambiosCarpincho += ' ' + mapaDatos.get(clave) + '.'; //" (" + UltimoReg.diferencia[clave]+"), "; if (contador === 0) {cambiosCarpincho += clave;}else{cambiosCarpincho += ', ' + clave;}
} }
contador++;
} }
if(cambiosCarpincho != '') HABLA(0, 'Hay cambios de ' + cambiosCarpincho ,"info"); if(cambiosCarpincho != '') HABLA(0, 'Hay cambios de ' + cambiosCarpincho ,"info");
} }
@ -474,7 +499,7 @@ async function Graficos(click)
id: 'gviento_dir', id: 'gviento_dir',
x: 15, x: 15,
y: 15, y: 15,
src: './img/brujula.webp', src: './gui_common/img/brujula.webp',
options: { options: {
width: 200, width: 200,
height: 200 height: 200
@ -565,12 +590,12 @@ function ListarRedes()
{ {
TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-success'>SI</span></td><td><span class='badge badge-danger'>NO</span></td><td><span class='badge badge-default'>N/A</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>"; TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-success'>SI</span></td><td><span class='badge badge-danger'>NO</span></td><td><span class='badge badge-default'>N/A</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>";
if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"}; if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"};
TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option></select></td></tr>"; TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option><option value='SitioOficial'>Sitio Oficial</option></select></td></tr>";
}else{ }else{
if(Publicar[i].Llave_W != ''){var tienellave = "SI";}else{var tienellave ="NO";} if(Publicar[i].Llave_W != ''){var tienellave = "SI";}else{var tienellave ="NO";}
TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-default'>N/A</span></td><td><span class='badge badge-success'>"+tienellave+"</span></td><td><span class='badge badge-default'>"+(Publicar[i].Puerto || "N/A")+"</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>"; TablaHTML += "<tr><td><b>"+Publicar[i].Nombre+"</b></td><td>"+Publicar[i].TipoRed+"</td><td><span class='badge badge-default'>N/A</span></td><td><span class='badge badge-success'>"+tienellave+"</span></td><td><span class='badge badge-default'>"+(Publicar[i].Puerto || "N/A")+"</span></td><td>"+publicar+"</td><td><select onchange='MenuRedes("+i+")' title='Accion' id='Red_activa_"+i+"' name='Red_activa' class='selectpicker show-tick' data-width='fit' data-style='btn-primary'>";
if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"}; if(Publicar[i].Publicar == true) {TablaHTML += "<option value='NoPublicar'>No Publicar</option>"}else{TablaHTML += "<option value='Publicar'>Publicar</option>"};
TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option></select></td></tr>"; TablaHTML += "<option value='Modificar'>Modificar</option><option value='Eliminar'>Eliminar</option><option value='SitioOficial'>Sitio Oficial</option></select></td></tr>";
} }
} }
TablaHTML += "</table>"; TablaHTML += "</table>";
@ -620,28 +645,32 @@ function MenuRedes(red)
switch ($('#Red_activa_'+red).val()) { switch ($('#Red_activa_'+red).val()) {
case 'Eliminar': case 'Eliminar':
// SE PREGUNTA SI ESTA SEGURO // SE PREGUNTA SI ESTA SEGURO
HABLA(0,'¿Esta seguro de eliminar<br> la red <b>'+ configGeneralEMA.ConfPublicador[red].Nombre +'</b>?',"success");
$(document).off('click', '.notifyjs-foo-base .no'); // Se elimina el evento si existe $(document).off('click', '.notifyjs-foo-base .no'); // Se elimina el evento si existe
$(document).off('click', '.notifyjs-foo-base .yes'); // Se elimina el evento si existe $(document).off('click', '.notifyjs-foo-base .yes'); // Se elimina el evento si existe
HABLA(0,'¿Esta seguro de eliminar<br> la red <b>'+ configGeneralEMA.ConfPublicador[red].Nombre +'</b>?',"success");
$.notify.addStyle('foo', { $.notify.addStyle('foo', {
html: html:
"<div style='background:#ff00003b;'>" +
"<div class='clearfix'>" + "<div class='clearfix'>" +
"<div class='title' data-notify-html='title'/>" + "<div class='title' data-notify-html='title'></div>" +
"<div class='buttons'>" + "<div class='buttons' style='margin-top:10px; text-align:center;width:100%;'>" +
"<button class='no'>NO</button><button class='yes' data-notify-text='button'></button>" + "<button class='btn btn-secondary btn-sm no'>Cancelar</button> " +
"<button class='btn btn-danger btn-sm yes'>Confirmar</button>" +
"</div>" +
"</div>" + "</div>" +
"</div>" "</div>"
}); });
//PREGUNTA
// --- Mostrar notificación ---
$("#carpincho_img").notify({ $("#carpincho_img").notify({
title: '¿Esta seguro de eliminar la red '+ configGeneralEMA.ConfPublicador[red].Nombre +'?', title: '¿Está seguro de eliminar la red <b>' + configGeneralEMA.ConfPublicador[red].Nombre + '</b>?'
button: 'SI'
}, { }, {
position: "right middle", position: "right middle",
style: 'foo', style: 'foo',
autoHide: false, autoHide: false,
clickToHide: false clickToHide: false
}); });
$(document).on('click', '.notifyjs-foo-base .no', function() { $(document).on('click', '.notifyjs-foo-base .no', function() {
//RESPONDE NO //RESPONDE NO
ListarRedes(); ListarRedes();
@ -669,6 +698,50 @@ function MenuRedes(red)
break; break;
case 'Modificar': FormModificar(red); case 'Modificar': FormModificar(red);
break; break;
case 'SitioOficial':
let tipored = configGeneralEMA.ConfPublicador[red].TipoRed;
tipored = tipored.toLowerCase();
let url = '';
switch (tipored) {
case 'openweathermap':
url = 'https://openweathermap.org/';
break;
case 'wow':
url = 'https://wow.metoffice.gov.uk/';
break;
case 'windguru':
url = 'https://www.windguru.cz/';
break;
case 'windy':
url = 'https://www.windy.com/';
break;
case 'awekas':
url = 'https://www.awekas.at/';
break;
case 'wunderground':
url = 'https://www.wunderground.com/';
break;
case 'pws':
url = 'https://www.pwsweather.com/';
break;
case 'emacenter':
url = 'https://emacenter.gugler.com.ar/';
break;
case 'emacentergugler':
url = 'https://emacenter.gugler.com.ar/';
break;
default:
HABLA(0, "No se encontró el sitio oficial para la red '" + tipored + "'", "warn");
return;
}
if (url !== '') {
window.open(url, '_blank');
HABLA(0, "Abriendo sitio oficial de '" + tipored + "'.", "info");
}
ListarRedes();
break;
} }
} }
@ -865,6 +938,9 @@ function GuardarConf(origen)
configGeneralEMA.ConfGeneral.UTC = parseInt($('#utc').val()); configGeneralEMA.ConfGeneral.UTC = parseInt($('#utc').val());
configGeneralEMA.ConfGeneral.SistemaMetrico = $('#SistemaMetrico').val(); configGeneralEMA.ConfGeneral.SistemaMetrico = $('#SistemaMetrico').val();
configGeneralEMA.ConfGeneral.Modo = $('#Modo').val(); configGeneralEMA.ConfGeneral.Modo = $('#Modo').val();
configGeneralEMA.ConfGeneral.IP = $('#r_ip').val();
configGeneralEMA.ConfGeneral.Puerto = $('#r_puerto').val();
configGeneralEMA.ConfGeneral.Ruta = $('#r_path').val();
configGeneralEMA.ConfGeneral.Llave_R = $('#Llave_R').val(); configGeneralEMA.ConfGeneral.Llave_R = $('#Llave_R').val();
configGeneralEMA.ConfGeneral.debugTamanio = parseInt($('#debugMB').val()); configGeneralEMA.ConfGeneral.debugTamanio = parseInt($('#debugMB').val());
if($('#inicio_auto').val() == "Activado"){configGeneralEMA.ConfGeneral.inicio_automatico = true;}else{configGeneralEMA.ConfGeneral.inicio_automatico = false;} if($('#inicio_auto').val() == "Activado"){configGeneralEMA.ConfGeneral.inicio_automatico = true;}else{configGeneralEMA.ConfGeneral.inicio_automatico = false;}
@ -904,7 +980,7 @@ function VerHistorico(lugar)
document.getElementById("mostrarregistrosH").style.display = "none"; document.getElementById("mostrarregistrosH").style.display = "none";
document.getElementById("actualizando").style.display = "block"; document.getElementById("actualizando").style.display = "block";
$('#botonresfrescar').attr("disabled",true); $('#botonresfrescar').attr("disabled",true);
if(configGeneralEMA.ConfGeneral.Modo == 'Recolector') // se comprueba el modo se encuentra en Recolector if(['Recolector_USB', 'Recolector_IP'].includes(configGeneralEMA.ConfGeneral.Modo)) // se comprueba el modo se encuentra en Recolector
{ {
$.get("/verHistorico", function(data, status){ $.get("/verHistorico", function(data, status){
var TablaHTML = ''; var TablaHTML = '';

View File

@ -34,6 +34,7 @@ const express = require('express');
const fsconf = require('fs'); const fsconf = require('fs');
const EMA = require('../core/ema.js'); // Core de EMA. const EMA = require('../core/ema.js'); // Core de EMA.
const PORT = process.env.PORT || 8080; // Puerto por defecto. const PORT = process.env.PORT || 8080; // Puerto por defecto.
const os = require('os');
var app = express(); var app = express();
var server; var server;
@ -91,6 +92,7 @@ app.get('/tamanioArchivos', function (req, res)
res.json([TamanioenMegaTD.toFixed(2),TamanioenMegaTP.toFixed(2),TamanioenMegaD.toFixed(2)]) res.json([TamanioenMegaTD.toFixed(2),TamanioenMegaTP.toFixed(2),TamanioenMegaD.toFixed(2)])
}); });
// EMA_ESTADO si es [true,''] esta encendida, si no [false,'Motivo del error']
app.get('/EMA_Estado', (req, res) => res.json(EMA.Estado())); app.get('/EMA_Estado', (req, res) => res.json(EMA.Estado()));
app.get('/EMA_EstadoUSB', function (req, res) { app.get('/EMA_EstadoUSB', function (req, res) {
EMA.EstadoUSB(function(EstadoUSB) EMA.EstadoUSB(function(EstadoUSB)
@ -99,6 +101,9 @@ app.get('/EMA_EstadoUSB', function (req, res) {
}); });
}); });
app.get('/RepeticionesConError', function (req, res) {res.json(EMA.RepeticionesConError());});
app.get('/TiempoActualRecolector', function (req, res) {res.json(EMA.TiempoActualRecolector());}); app.get('/TiempoActualRecolector', function (req, res) {res.json(EMA.TiempoActualRecolector());});
app.get('/Visor', function (req, res) { app.get('/Visor', function (req, res) {
@ -112,12 +117,23 @@ app.get('/Visor', function (req, res) {
}); });
}); });
app.get('/IncrementarRepeticionesConError', function (req, res) {
EMA.Configuracion.RepeticionesConError += 1; // Reinicio el contador de errores al iniciar el servidor web
res.json('');
});
app.get('/UltimoPublicado', function (req, res) {res.json(EMA.UltimoPublicado());}); app.get('/UltimoPublicado', function (req, res) {res.json(EMA.UltimoPublicado());});
app.get('/UltimoRegistro', function (req, res) {res.json(EMA.UltimoRegistro());}); app.get('/UltimoRegistro', function (req, res) {res.json(EMA.UltimoRegistro());});
app.get('/HayPendientes', function (req, res) {res.json(EMA.HayPendientes());}); app.get('/HayPendientes', function (req, res) {res.json(EMA.HayPendientes());});
app.get('/EstadoSensores', function (req, res) {res.json(EMA.EstadoSensores());}); app.get('/EstadoSensores', function (req, res) {res.json(EMA.EstadoSensores());});
app.get('/iniciar', function (req, res) {EMA.Conectar();res.json('ok'); }); app.get('/iniciar', function (req, res) {EMA.Conectar();res.json('ok'); });
app.get('/detener', function (req, res) {EMA.Detener();res.json('ok'); }); app.get('/detener', function (req, res) {EMA.Detener(); ;res.json('ok'); });
app.get('/purgarDebug', function (req, res) app.get('/purgarDebug', function (req, res)
{ {
fsconf.writeFile('logs/debug.log', '',{encoding: 'utf8', autoClose: true}, function(err) fsconf.writeFile('logs/debug.log', '',{encoding: 'utf8', autoClose: true}, function(err)
@ -166,6 +182,11 @@ app.get('/verLogs', function (req, res)
res.json(Archivo); res.json(Archivo);
}) })
app.get('/interfaces', (req, res) => {
const interfaces = os.networkInterfaces();
res.json(interfaces);
});
app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); next();}); app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); next();});
app.use(express.static('gui_web')); app.use(express.static('gui_web'));
@ -179,21 +200,19 @@ app.use('/css', express.static(__dirname + '/../gui_common/css'));
// IMG // IMG
app.use('/images', express.static(__dirname + '/../node_modules/datatables/media/images')); app.use('/images', express.static(__dirname + '/../node_modules/datatables/media/images'));
app.use('/iconos', express.static(__dirname + '/../gui_common/iconos')); app.use('/gui_common/iconos', express.static(__dirname + '/../gui_common/iconos'));
app.use('/img', express.static(__dirname + '/../gui_common/img')); app.use('/gui_common/img', express.static(__dirname + '/../gui_common/img'));
// JS // JS
app.use('/js', express.static(__dirname + '/../node_modules/jquery/dist')); app.use('/js', express.static(__dirname + '/../node_modules/jquery/dist'));
app.use('/js', express.static(__dirname + '/../node_modules/popper.js/dist/umd')); app.use('/js', express.static(__dirname + '/../node_modules/popper.js/dist/umd'));
app.use('/js', express.static(__dirname + '/../node_modules/bootstrap/dist/js')); app.use('/js', express.static(__dirname + '/../node_modules/bootstrap/dist/js'));
app.use('/js', express.static(__dirname + '/../node_modules/bootstrap-select/dist/js')); app.use('/js', express.static(__dirname + '/../node_modules/bootstrap-select/dist/js'));
app.use('/js', express.static(__dirname + '/../node_modules/datatables/media/js')); app.use('/js', express.static(__dirname + '/../node_modules/datatables/media/js'));
app.use('/js', express.static(__dirname + '/../node_modules/chart.js/dist'));
app.use('/js', express.static(__dirname + '/../node_modules/notify-js-lib/dist')); app.use('/js', express.static(__dirname + '/../node_modules/notify-js-lib/dist'));
app.use('/js', express.static(__dirname + '/../node_modules/nprogress')); app.use('/js', express.static(__dirname + '/../node_modules/nprogress'));
app.use('/js', express.static(__dirname + '/../node_modules/datatables-buttons/js')); app.use('/js', express.static(__dirname + '/../node_modules/datatables-buttons/js'));
app.use('/js', express.static(__dirname + '/../gui_common/libs/RGraph')); app.use('/js', express.static(__dirname + '/../gui_common/libs/RGraph'));
app.use('/controlador', express.static(__dirname + '/../gui_common/controlador'));
app.get('/', function (req, res) {res.sendFile(__dirname + "/index.html");}); app.get('/', function (req, res) {res.sendFile(__dirname + "/index.html");});
@ -202,25 +221,54 @@ app.get('/', function (req, res) {res.sendFile(__dirname + "/index.html");});
function EncenderServidoreIniciar() { function EncenderServidoreIniciar() {
// Se espera 5 segundo y se inicia el recolector en modo web // Se espera 5 segundo y se inicia el recolector en modo web
server = app.listen(PORT); server = app.listen(PORT, () => {
console.log('Ingrese al sistema por su navegador 127.0.0.1:'+PORT+' o IP:'+PORT); // Obtener todas las interfaces de red
const interfaces = os.networkInterfaces();
console.log("\nServidor disponible en las siguientes direcciones:");
// Recorrer todas las interfaces e IPs
for (const interfaceName in interfaces) {
interfaces[interfaceName].forEach((interface) => {
// Mostrar solo IPv4 y omitir direcciones internas
if (interface.family === 'IPv4') {
console.log(`http://${interface.address}:${PORT}`);
}
});
}
});
setTimeout(function(){console.log("Se inicio el recolector automaticamente.");EMA.Conectar();}, 5000); setTimeout(function(){console.log("Se inicio el recolector automaticamente.");EMA.Conectar();}, 5000);
} }
function EncenderServidor() { function EncenderServidor() {
// Se inicia el servidor solamente // Se inicia el servidor solamente
server = app.listen(PORT); server = app.listen(PORT, () => {
// Obtener todas las interfaces de red
const interfaces = os.networkInterfaces();
console.log("\nServidor disponible en las siguientes direcciones:");
// Recorrer todas las interfaces e IPs
for (const interfaceName in interfaces) {
interfaces[interfaceName].forEach((interface) => {
// Mostrar solo IPv4 y omitir direcciones internas
if (interface.family === 'IPv4') {
console.log(`http://${interface.address}:${PORT}`);
}
});
}
});
// Se consulta si esta activado el iniciar automaticamente y si es asi, se prende el recolector // Se consulta si esta activado el iniciar automaticamente y si es asi, se prende el recolector
var configGeneralEMA = null; var configGeneralEMA = null;
configGeneralEMA = eval(fsconf.readFileSync('conf/ConfiguracionGeneral.js')+''); configGeneralEMA = eval(fsconf.readFileSync('conf/ConfiguracionGeneral.js')+'');
IniciarAutomaticamente = configGeneralEMA.ConfGeneral.inicio_automatico; IniciarAutomaticamente = configGeneralEMA.ConfGeneral.inicio_automatico;
console.log(""); console.log("");
if(IniciarAutomaticamente) if(IniciarAutomaticamente) {
{console.log("Configuración de Inicio: "+ IniciarAutomaticamente + " --> Se esta iniciando el recolector automaticamente en 5 segundos...");setTimeout(function(){EMA.Conectar();}, 5000) console.log("Configuración de Inicio: "+ IniciarAutomaticamente + " --> Se esta iniciando el recolector automaticamente en 5 segundos...");
}else{ console.log("Configuración de Inicio: "+ IniciarAutomaticamente);} setTimeout(function(){EMA.Conectar();}, 5000);
console.log(""); } else {
console.log('Ingrese al sistema por su navegador 127.0.0.1:'+PORT+' o IP:'+PORT); console.log("Configuración de Inicio: "+ IniciarAutomaticamente);
}
} }
function DetenerServidor() {server.close();} function DetenerServidor() {server.close();}

View File

@ -5,7 +5,7 @@
<meta CHARSET="UTF-8"> <meta CHARSET="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EMA Libre Cliente (Carpincho)</title> <title>EMA Libre Cliente (Carpincho)</title>
<link rel="icon" type="image/png" href="iconos/icono_app.png" sizes="16x16"> <link rel="icon" type="image/png" href="gui_common/iconos/icono_app.png" sizes="16x16">
<!-- Estilos varios css --> <!-- Estilos varios css -->
<link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.min.css" /> <link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.min.css" />
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
@ -36,7 +36,6 @@
<script type="text/javascript" src="js/RGraph.gauge.js"></script> <script type="text/javascript" src="js/RGraph.gauge.js"></script>
<script type="text/javascript" src="js/RGraph.odo.js"></script> <script type="text/javascript" src="js/RGraph.odo.js"></script>
<script type="text/javascript" src="js/RGraph.drawing.image.js"></script> <script type="text/javascript" src="js/RGraph.drawing.image.js"></script>
<script type="text/javascript" src="js/Chart.min.js"></script>
<!-- Barra de progreso --> <!-- Barra de progreso -->
<script type="text/javascript" src="js/nprogress.js"></script> <script type="text/javascript" src="js/nprogress.js"></script>
<!-- Libreria Notificaciones emergentes --> <!-- Libreria Notificaciones emergentes -->
@ -51,7 +50,7 @@
<div class="progressinicio"> <div class="progressinicio">
<div style="width:100%"> <div style="width:100%">
</br> </br> </br> </br> </br> </br> </br> </br> </br> </br>
<img id="loadinicio" align="center" src="iconos/icono_app.webp" height="120px" width="140px"> <img id="loadinicio" align="center" src="gui_common/iconos/icono_app.webp" height="120px" width="140px">
</br></br> <h1><b> EMA Libre Cliente</b> </br> (Carpincho)</br>Licencia GPLv3</h1> </br></br> <h1><b> EMA Libre Cliente</b> </br> (Carpincho)</br>Licencia GPLv3</h1>
</div> </div>
</div> </div>
@ -59,12 +58,12 @@
<div id="principal" style="display: none;"> <div id="principal" style="display: none;">
<nav style="-webkit-app-region: drag;cursor: all-scroll" class="navbar stylish-color fixed-top scrolling-navbar "> <nav style="-webkit-app-region: drag;cursor: all-scroll" class="navbar stylish-color fixed-top scrolling-navbar ">
<span style="-webkit-app-region: no-drag;color: #ffffff;" data-toggle="tooltip" data-placement="bottom" style="font-size: 15px;"><img id="signal" class="" src="img/signal.webp" height="16px" width="16px" data-toggle="tooltip" <span style="-webkit-app-region: no-drag;color: #ffffff;" data-toggle="tooltip" data-placement="bottom" style="font-size: 15px;"><img id="signal" class="" src="gui_common/img/signal.webp" height="16px" width="16px" data-toggle="tooltip"
data-placement="right" data-html="true" title="Señal RF de la estación"> EMA Libre Cliente </span> data-placement="right" data-html="true" title="Señal RF de la estación"> EMA Libre Cliente </span>
<spam id="mensajebarra" class="float-center" style="color:white"></spam> <spam id="mensajebarra" class="float-center" style="color:white"></spam>
<span style="-webkit-app-region: no-drag" class="float-right"> <span style="-webkit-app-region: no-drag" class="float-right">
<i class="custom-controls menu" data-toggle="tooltip" data-placement="bottom" role="menusup" aria-controls="Wzoomout" style="font-size: 15px;" title="Disminuir"><img id="Wzoomout" height="16px" width="16px" src="iconos/zoomout.webp"></i> <i class="custom-controls menu" data-toggle="tooltip" data-placement="bottom" role="menusup" aria-controls="Wzoomout" style="font-size: 15px;" title="Disminuir"><img id="Wzoomout" height="16px" width="16px" src="gui_common/iconos/zoomout.webp"></i>
<i class="custom-controls menu" data-toggle="tooltip" data-placement="bottom" role="menusup" aria-controls="Wzoomin" style="font-size: 15px;" title="Aumentar" ><img id="Wzoomin" height="16px" width="16px" src="iconos/zoomin.webp"></i> <i class="custom-controls menu" data-toggle="tooltip" data-placement="bottom" role="menusup" aria-controls="Wzoomin" style="font-size: 15px;" title="Aumentar" ><img id="Wzoomin" height="16px" width="16px" src="gui_common/iconos/zoomin.webp"></i>
</span> </span>
</nav> </nav>
<br><br> <br><br>
@ -75,7 +74,7 @@
<div class="row"> <div class="row">
<div class="col-12 col-right align-self-center "> <div class="col-12 col-right align-self-center ">
<br> <br>
<span class="text-muted text-align-center"><img id="carpincho_img" align="center" src="iconos/icono_app.webp" height="48px" width="48px" onclick="HABLA(0,'Hola, soy Carpincho, ¿qué deseas?.','info');" onmouseover="GUIÑA(0);"></span> <span class="text-muted text-align-center"><img id="carpincho_img" align="center" src="gui_common/iconos/icono_app.webp" height="48px" width="48px" onclick="HABLA(0,'Hola, soy Carpincho, ¿qué deseas?.','info');" onmouseover="GUIÑA(0);"></span>
</div> </div>
<div class="col-12 col-left align-self-center "> <div class="col-12 col-left align-self-center ">
<span class='badge badge-ultimalectura' style="font-size:small">Última Lectura<br> <span id='fecha' class='badge badge-primary'>-</span></span> <span class='badge badge-ultimalectura' style="font-size:small">Última Lectura<br> <span id='fecha' class='badge badge-primary'>-</span></span>
@ -99,33 +98,33 @@
<div class="container container-fluid"> <div class="container container-fluid">
<ul class="nav nav-tabs nav-inverse nav-pills nav-fill" id="list-tab" role="tablist"> <ul class="nav nav-tabs nav-inverse nav-pills nav-fill" id="list-tab" role="tablist">
<li class="nav-item active "> <li class="nav-item active ">
<a class="nav-link active show" id="inicio-tab" data-toggle="tab" data-target="#inicio" role="tab" aria-controls="inicio" aria-selected="true"><img height="24px" width="24px" src="img/home.webp" aria-controls="inicio"> INICIO</a> <a class="nav-link active show" id="inicio-tab" data-toggle="tab" data-target="#inicio" role="tab" aria-controls="inicio" aria-selected="true"><img height="24px" width="24px" src="gui_common/img/home.webp" aria-controls="inicio"> INICIO</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="interior-tab" data-toggle="tab" data-target="#interior" role="tab" aria-controls="interior" aria-selected="false"><img height="24px" width="24px" src="img/interior.webp" aria-controls="interior"> INTERIOR</a> <a class="nav-link" id="interior-tab" data-toggle="tab" data-target="#interior" role="tab" aria-controls="interior" aria-selected="false"><img height="24px" width="24px" src="gui_common/img/interior.webp" aria-controls="interior"> INTERIOR</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="exterior-tab" data-toggle="tab" data-target="#exterior" role="tab" aria-controls="exterior" aria-selected="false"><img height="24px" width="24px" src="img/exterior.webp" aria-controls="exterior"> EXTERIOR</a> <a class="nav-link" id="exterior-tab" data-toggle="tab" data-target="#exterior" role="tab" aria-controls="exterior" aria-selected="false"><img height="24px" width="24px" src="gui_common/img/exterior.webp" aria-controls="exterior"> EXTERIOR</a>
</li> </li>
<li class="nav-item"> <!-- <li class="nav-item">
<a class="nav-link" id="estadisticas-tab" data-toggle="tab" data-target="#estadisticas" role="tab" aria-controls="estadisticas" aria-selected="false"><img height="24px" width="24px" src="img/estadistica.png" aria-controls="estadisticas"> ESTADISTICAS</a> <a class="nav-link" id="estadisticas-tab" data-toggle="tab" data-target="#estadisticas" role="tab" aria-controls="estadisticas" aria-selected="false"><img height="24px" width="24px" src="img/estadistica.png" aria-controls="estadisticas"> ESTADISTICAS</a>
</li> -->
<li class="nav-item">
<a class="nav-link" id="redes-tab" data-toggle="tab" data-target="#redes" role="tab" aria-controls="redes" aria-selected="false"><img height="24px" width="24px" src="gui_common/img/redes.webp" aria-controls="redes"> REDES</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="redes-tab" data-toggle="tab" data-target="#redes" role="tab" aria-controls="redes" aria-selected="false"><img height="24px" width="24px" src="img/redes.webp" aria-controls="redes"> REDES</a> <a class="nav-link" id="configuracion-tab" data-toggle="tab" data-target="#configuracion" role="tab" aria-controls="configuracion" aria-selected="false"><img height="24px" width="24px" src="gui_common/img/config.webp" aria-controls="configuracion"> CONFIGURACIÓN</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="configuracion-tab" data-toggle="tab" data-target="#configuracion" role="tab" aria-controls="configuracion" aria-selected="false"><img height="24px" width="24px" src="img/config.webp" aria-controls="configuracion"> CONFIGURACIÓN</a> <a class="nav-link" id="contacto-tab" data-toggle="tab" data-target="#contacto" target="_self" role="tab" aria-controls="contacto" aria-selected="false"><img height="24px" width="24px" src="gui_common/img/about.webp" aria-controls="contacto"> CONTACTO</a>
</li>
<li class="nav-item">
<a class="nav-link" id="contacto-tab" data-toggle="tab" data-target="#contacto" target="_self" role="tab" aria-controls="contacto" aria-selected="false"><img height="24px" width="24px" src="img/about.webp" aria-controls="contacto"> CONTACTO</a>
</li> </li>
</ul> </ul>
<div class="tab-content jumbotron" id="" style="padding: 15px;padding-bottom:15px;margin-bottom:15px"> <div class="tab-content jumbotron" id="" style="padding: 15px;padding-bottom:15px;margin-bottom:15px">
<div id="actualizando_inicio" style="display:none" align="center"><br><br><br><br><img src='./img/animadas/cargando2.gif' width='100' height='100' /> <br><br><br><br> </div> <div id="actualizando_inicio" style="display:none" align="center"><br><br><br><br><img src='gui_common/img/animadas/cargando2.gif' width='100' height='100' /> <br><br><br><br> </div>
<div class="tab-pane fade show active" id="inicio" role="tabpanel" aria-badgeledby="inicio-tab"></div> <div class="tab-pane fade show active" id="inicio" role="tabpanel" aria-badgeledby="inicio-tab"></div>
<div class="tab-pane fade text-center" id="interior" role="tabpanel" aria-badgeledby="interior-tab"></div> <div class="tab-pane fade text-center" id="interior" role="tabpanel" aria-badgeledby="interior-tab"></div>
<div class="tab-pane fade text-center" id="exterior" role="tabpanel" aria-badgeledby="exterior-tab"></div> <div class="tab-pane fade text-center" id="exterior" role="tabpanel" aria-badgeledby="exterior-tab"></div>
<div class="tab-pane fade text-center" id="estadisticas" role="tabpanel" aria-badgeledby="estadisticas-tab"></div> <!-- <div class="tab-pane fade text-center" id="estadisticas" role="tabpanel" aria-badgeledby="estadisticas-tab"></div>-->
<div class="tab-pane fade text-center" id="configuracion" role="tabpanel" aria-badgeledby="configuracion-tab"></div> <div class="tab-pane fade text-center" id="configuracion" role="tabpanel" aria-badgeledby="configuracion-tab"></div>
<div class="tab-pane fade text-center" id="redes" role="tabpanel" aria-badgeledby="redes-tab"></div> <div class="tab-pane fade text-center" id="redes" role="tabpanel" aria-badgeledby="redes-tab"></div>
<div class="tab-pane fade" id="contacto" role="tabpanel" aria-badgeledby="contacto-tab"></div> <div class="tab-pane fade" id="contacto" role="tabpanel" aria-badgeledby="contacto-tab"></div>
@ -179,6 +178,19 @@
MenuGUI('inicio'); MenuGUI('inicio');
}); });
window.onload = function() {redimensionarInicio(); NProgress.configure({ showSpinner: false });NProgress.done(); }; window.onload = function() {
$.get("/EMA_estado", async function(data, status){
if(data[0]===true){
console.log("EMA Libre Cliente ya esta recolectando...");
INICIAR();
} else {
//console.error("EMA Libre no esta recolectado ");
}
});
redimensionarInicio();
NProgress.configure({ showSpinner: false });
NProgress.done();
};
</script> </script>

View File

@ -1,30 +1,33 @@
<div class="col-centered"> <div class="col-centered">
<h1>Configuración General</h1> <h1>Configuración General</h1>
<div class="row"> <div class="row">
<div class="col-12" align="right" style="vertical-align:top;"><button class="btn btn-sm btn-success" onclick="MenuGUI('logs');" role="button">Ver Logs</button> </div> <div class="col-12 text-right" style="vertical-align:top;"><button class="btn btn-sm btn-success" onclick="MenuGUI('logs');" role="button">Ver Logs</button> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-3" align="left" style="vertical-align:top;"></div> <div class="col-4 col-centered">
<div class="col-6" align="center" style="vertical-align:top;">
<div class="col-12 col-centered">
<label class="control-label">Nombre de tu estación</label><br>
<input type="text" class="btn btn-primary" id="NombreEstacion" autocomplete='name' placeholder="Ingrese el nombre" maxlength="20" size="25"></br></br>
</div>
</div>
</div>
<div class="row">
<div class="col-3 col-centered">
<label class="control-label">Ema Modo</label><br> <label class="control-label">Ema Modo</label><br>
<select id='Modo' name="Modo" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary"> <select id='Modo' name="Modo" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="Recolector USB"> <optgroup label="Recolector">
<option value="Recolector">Recolector</option> <option value="Recolector_USB">Recolector USB</option>
<option value="Recolector_IP">Recolector IP/WIFI</option>
</optgroup> </optgroup>
<optgroup label="Visor por Llave"> <optgroup label="Visor">
<option value="Visor">Visor</option> <option value="Visor">Visor Llave</option>
</optgroup> </optgroup>
</select> </select>
</div> </div>
<div class="col-3 col-centered"> <div class="col-4 col-centered">
<label class="control-label">Nombre de tu estación</label><br>
<input type="text" class="btn btn-primary" id="NombreEstacion" autocomplete='name' placeholder="Ingrese el nombre" maxlength="20" size="30"></br></br>
</div>
<div class="col-4 col-centered">
<label for="inputEmail" class="control-label">Correo del Administrador</label><br>
<input type="email" class="btn btn-primary" id="Email_receptor" autocomplete='email' placeholder="Email" maxlength="50" size="35">
</div>
</div>
<hr class="hr-suave">
<div class="row">
<div class="col-2 col-centered">
<label class="control-label">Inicio Automático</label><br> <label class="control-label">Inicio Automático</label><br>
<select id='inicio_auto' name="inicio_auto" class="selectpicker show-tick" data-width="fit" data-style="btn-primary"> <select id='inicio_auto' name="inicio_auto" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="Iniciar el recolector/visor con el aplicativo"> <optgroup label="Iniciar el recolector/visor con el aplicativo">
@ -33,16 +36,7 @@
</optgroup> </optgroup>
</select> </select>
</div> </div>
<div class="col-3 col-centered"> <div class="col-2 col-centered">
<label class="control-label">Audio</label><br>
<select id='audio' name="audio" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="Audio de carpincho">
<option value="Activado">Activado</option>
<option value="Desactivado">Desactivado</option>
</optgroup>
</select>
</div>
<div class="col-3 col-centered">
<label class="control-label">Notificar Cambios</label><br> <label class="control-label">Notificar Cambios</label><br>
<select id='notificar_cambios' name="notificar_cambios" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary"> <select id='notificar_cambios' name="notificar_cambios" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="Notificar de carpincho"> <optgroup label="Notificar de carpincho">
@ -51,22 +45,24 @@
</optgroup> </optgroup>
</select> </select>
</div> </div>
<div class="col-2 col-centered">
<label class="control-label">Audio</label><br>
<select id='audio' name="audio" onchange="MenuConfig();" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="Audio de carpincho">
<option value="Activado">Activado</option>
<option value="Desactivado">Desactivado</option>
</optgroup>
</select>
</div> </div>
<hr> <div class="col-3 col-centered" id="vocesAudioDiv">
<div class="row"> <label class="control-label">Voz del Audio</label></br>
<div class="col-6 col-centered" id="LlaveR">
<label class="control-label">Llave de Lectura</label></br>
<input type="text" class="btn btn-primary" id="Llave_R" placeholder="Ingrese LLave" maxlength="40" size="44"></br></br>
</div>
<div class="col-6 col-centered" id="vocesAudioDiv">
<label class="control-label">Seleccione la Voz para el Audio</label></br>
<select id='vocesAudio' name="vocesAudio" class="selectpicker show-tick" data-width="fit" data-style="btn-primary" size="100"> <select id='vocesAudio' name="vocesAudio" class="selectpicker show-tick" data-width="fit" data-style="btn-primary" size="100">
<optgroup label="Lista de Voces"> <optgroup label="Lista de Voces">
</optgroup> </optgroup>
</select> </select>
</div> </div>
</div> </div>
<hr> <hr class="hr-suave">
<div class="row"> <div class="row">
<div class="col-2 col-centered"> <div class="col-2 col-centered">
<label class="control-label">Recolección</label><br> <label class="control-label">Recolección</label><br>
@ -164,12 +160,8 @@
</optgroup> </optgroup>
</select> </select>
</div> </div>
<div class="col-4 col-centered">
<label for="inputEmail" class="control-label">Correo del Administrador</label><br>
<input type="email" class="btn btn-primary" id="Email_receptor" autocomplete='email' placeholder="Email" maxlength="30" size="15">
</div> </div>
</div> <hr class="hr-suave">
<hr>
<div class="row"> <div class="row">
<div class="col-3 col-centered"> <div class="col-3 col-centered">
<label class="control-label">SMTP TIPO</label><br> <label class="control-label">SMTP TIPO</label><br>
@ -192,7 +184,7 @@
</div> </div>
<div class="col-3 col-centered"> <div class="col-3 col-centered">
<label class="control-label">Contraseña</label><br> <label class="control-label">Contraseña</label><br>
<input type="password" class="btn btn-primary" id="Contrasenia_SMTP" placeholder="Contraseña" maxlength="40" size="16" value="-"> <input type="password" class="btn btn-primary" id="Contrasenia_SMTP" placeholder="Contraseña" maxlength="40" size="16">
</div> </div>
<div class="col-2 col-centered" id="Server"> <div class="col-2 col-centered" id="Server">
<label class="control-label">Server</label><br> <label class="control-label">Server</label><br>
@ -202,10 +194,46 @@
<label class="control-label">Puerto</label><br> <label class="control-label">Puerto</label><br>
<input type="text" class="btn btn-primary" id="Puerto_SMTP" placeholder="Puerto" maxlength="4" size="5"> <input type="text" class="btn btn-primary" id="Puerto_SMTP" placeholder="Puerto" maxlength="4" size="5">
</div> </div>
</div><br> </div>
</div>
<!-- Segun seleccion cambia debajo el bloque secundario -->
<div id="bloque_secundario">
<hr>
<label class="control-label">Configuración específica para el Modo</label>
<div class="col-centered">
<div class="row">
<div class="col-6 col-centered" id="LlaveR">
<label class="control-label">Llave de Lectura</label></br>
<input type="text" class="btn btn-primary" id="Llave_R" placeholder="Ingrese LLave" maxlength="40" size="44"></br></br>
</div>
</div>
<div id="bloque_por_IP_WIFI" class="row">
<div class="col-4 col-centered">
<label class="control-label">IP</label><br>
<select id='r_ip' name="IP" class="selectpicker show-tick" data-width="fit" data-style="btn-primary">
<optgroup label="IP's" id="ipGroup">
</select>
</div>
<div class="col-2 col-centered">
<label class="control-label">Puerto</label></br>
<input type="text" class="btn btn-primary" id="r_puerto" placeholder="Puerto" maxlength="4" size="5" value="5000">
</div>
<div class="col-4 col-centered">
<label class="control-label">Path</label></br>
<input type="text" class="btn btn-primary" id="r_path" placeholder="Puerto" maxlength="15" size="25" value="/datos">
</div>
</div>
</div>
</div>
<hr class="hr-suave">
<div class="row"> <div class="row">
<div class="col-12 col-centered"> <div class="col-12 col-centered">
<button type="button" id="botonguardar" class="btn btn-sm btn-success" onclick="GuardarConf('conf')" role="button">Guardar</button> <button type="button" id="botonguardar" class="btn btn-sm btn-success" onclick="GuardarConf('conf')" role="button">Guardar</button>
</div> </div>
</div> </div>
</div>

View File

@ -2,8 +2,8 @@
<div class="row"> <div class="row">
<div class="col-3 col-centered "> <div class="col-3 col-centered ">
<br> <br><br> <br> <br><br>
<img src="img/icono_inicio.webp" onclick="HABLA(0,'Porque me estas tocando?','info');" onmouseover="GUIÑA(0);"></br></br></br> <img src="gui_common/img/icono_inicio.webp" onclick="HABLA(0,'Porque me estas tocando?','info');" onmouseover="GUIÑA(0);"></br></br></br>
<img src="img/LogoLGPLv3.webp"> <img src="gui_common/img/LogoLGPLv3.webp">
</div> </div>
<div class="col-9"> <div class="col-9">
<div class="row"> <div class="row">
@ -17,10 +17,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-8"> <div class="col-8">
<h4><img src="img/ok.webp" height="25" width="25"><strong>Software: </strong>EMA Libre Cliente (Carpincho)</h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Software: </strong>EMA Libre Cliente (Carpincho)</h4>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Versión: </strong><span id="versioncontacto">-</span></h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Versión: </strong><span id="versioncontacto">-</span></h4>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Sitio Oficial: </strong> <a style="color: #1155cc;">https://ema.gugler.com.ar</a> </h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Sitio Oficial: </strong> <a style="color: #1155cc;">https://ema.gugler.com.ar</a> </h4>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Licencia: </strong>GPLv3</h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Licencia: </strong>GPLv3</h4>
</div> </div>
<div class="col-4 col-centered"><br><br><br> <div class="col-4 col-centered"><br><br><br>
<button id="botonactualizar" class="btn btn-sm btn-success" onclick="Actualizar()" role="button">Actualizar</button> <button id="botonactualizar" class="btn btn-sm btn-success" onclick="Actualizar()" role="button">Actualizar</button>
@ -31,12 +31,12 @@
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">
<div class="d-block d-md-none d-lg-block col-3 col-centered"><img src="img/logo_gugler_lab.webp"> </div> <div class="d-block d-md-none d-lg-block col-3 col-centered"><img src="gui_common/img/logo_gugler_lab.webp"> </div>
<div class="d-block d-md-none d-lg-block col-9" style="height:10"> <div class="d-block d-md-none d-lg-block col-9" style="height:10">
<h1><b>Contáctenos</b></h1> <h1><b>Contáctenos</b></h1>
<p style="text-align: justify">Si deseas realizar consultas, sugerencias o simplemente tenes alguna duda sobre nuestros productos/servicios, podes comunicarte con nosotros a través de los siguientes medios:</p> <p style="text-align: justify">Si deseas realizar consultas, sugerencias o simplemente tenes alguna duda sobre nuestros productos/servicios, podes comunicarte con nosotros a través de los siguientes medios:</p>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Telefono: </strong>(0054 -0343) - 4975044 - Interno 119</h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Telefono: </strong>(0054 -0343) - 4975044 - Interno 119</h4>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Correo Electronico: </strong>gugler_contacto@uader.edu.ar</h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Correo Electronico: </strong>gugler_contacto@uader.edu.ar</h4>
<h4><img src="img/ok.webp" height="25" width="25"><strong>Sitio Oficial: </strong> <a style="color: #1155cc;">https://www.gugler.com.ar</a></h4> <h4><img src="gui_common/img/ok.webp" height="25" width="25"><strong>Sitio Oficial: </strong> <a style="color: #1155cc;">https://www.gugler.com.ar</a></h4>
</div> </div>
</div> </div>

View File

@ -7,8 +7,11 @@
<br><br> <img src='./img/animadas/cargando2.gif' width='40' height='40' /> <br> <small>Cargando Gráfico...</small> <br><br> <img src='./img/animadas/cargando2.gif' width='40' height='40' /> <br> <small>Cargando Gráfico...</small>
</div> </div>
<div id="inicio_estadisticas"> <div id="inicio_estadisticas">
<canvas id="graph_inicio" style="height:50vh; width:80vw" ></canvas> <canvas id="graph_inicio" style="width:100%; height:400px; max-width:80vw; max-height:50vh;"></canvas>
</div> </div>
<button id="diag_toggle_canvas" class="btn btn-sm btn-warning" onclick="(function(){var c=document.getElementById('graph_inicio'); if(c.style.display==='none'){c.style.display='block';} else {c.style.display='none';}})()">Toggle Canvas</button>
<button id="diag_enable_graphs" class="btn btn-sm btn-success" onclick="(function(){ try { window._ENABLE_GRAPHICS = true; console.log('Graphics enabled'); graficoEstadisticas(); } catch(e){console.error(e);} })()">Enable Graphs</button>
<button id="diag_paint_test" class="btn btn-sm btn-info" onclick="(function(){ try { if(window._testCanvasPaint){ window._testCanvasPaint(); } else { console.warn('_testCanvasPaint no disponible'); } } catch(e){console.error(e);} })()">Canvas Paint Test</button>
<div id="grafico" style="background-color:#182c3e00; display:none" > <div id="grafico" style="background-color:#182c3e00; display:none" >
<canvas id="graph" style="height:50vh; width:80vw" ></canvas> <canvas id="graph" style="height:50vh; width:80vw" ></canvas>
@ -19,7 +22,7 @@
function Mostrar() function Mostrar()
{ {
document.getElementById("grafico").style.display = "block"; document.getElementById("grafico").style.display = "block";
document.getElementById("inicio_estadisticas").style.display = "hidden"; document.getElementById("inicio_estadisticas").style.display = "none";
document.getElementById("inicio_estadisticas").hidden = true; document.getElementById("inicio_estadisticas").hidden = true;
document.getElementById("boton_grafico").hidden = true; document.getElementById("boton_grafico").hidden = true;
document.getElementById("boton_volver").hidden = false; document.getElementById("boton_volver").hidden = false;

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="col-6 col-centered align-self-center "> <div class="col-6 col-centered align-self-center ">
<div class="short-div col-centered "> <div class="short-div col-centered ">
<h3 align="center"><img src="img/clima/temperatura.webp" width="13" height="13"> Temperatura</h3> <h3 align="center"><img src="gui_common/img/clima/temperatura.webp" width="13" height="13"> Temperatura</h3>
<div class="zoom"> <div class="zoom">
<h1><span id='temp_ext' class="badge badge-success">- </span></h1> <h1><span id='temp_ext' class="badge badge-success">- </span></h1>
<h4><span id='temp_ext_max' class="badge badge-danger" title="Maxíma Diaria">-</span> <h4><span id='temp_ext_max' class="badge badge-danger" title="Maxíma Diaria">-</span>
@ -25,7 +25,7 @@
</div> </div>
</div> </div>
<div class="short-div col-centered "><br> <div class="short-div col-centered "><br>
<h4 align="center"><img src="img/clima/luxer.webp" width="13" height="13"> Iluminancia </h4> <h4 align="center"><img src="gui_common/img/clima/luxer.webp" width="13" height="13"> Iluminancia </h4>
<div class="zoom"> <div class="zoom">
<h1><span id='luxer_ext' class="badge badge-primary">-</span></h1> <h1><span id='luxer_ext' class="badge badge-primary">-</span></h1>
<h4><span id='luxer_ext_max' class="badge badge-danger" title="Maxíma Diaria">-</span> <h4><span id='luxer_ext_max' class="badge badge-danger" title="Maxíma Diaria">-</span>
@ -35,7 +35,7 @@
</div> </div>
<div class="col-6 col-centered align-self-center "> <div class="col-6 col-centered align-self-center ">
<div class="short-div col-centered"> <div class="short-div col-centered">
<h3 align="center"><img src="img/clima/humedad.webp" width="13" height="13">Humedad</h3> <h3 align="center"><img src="gui_common/img/clima/humedad.webp" width="13" height="13">Humedad</h3>
<div class="zoom"> <div class="zoom">
<h1><span id='hum_ext' class="badge badge-success">-</span></h1> <h1><span id='hum_ext' class="badge badge-success">-</span></h1>
<h4> <h4>
@ -46,7 +46,7 @@
</div> </div>
<div class="short-div col-centered"> <div class="short-div col-centered">
<br> <br>
<h4 align="center"><img src="img/clima/rocio.webp" width="13" height="13">Pto. de Rocio</h4> <h4 align="center"><img src="gui_common/img/clima/rocio.webp" width="13" height="13">Pto. de Rocio</h4>
<div class="zoom"> <div class="zoom">
<h1><span id='punto_ext' class="badge badge-primary">-</span></h1> <h1><span id='punto_ext' class="badge badge-primary">-</span></h1>
<h4> <h4>
@ -81,7 +81,7 @@
</div> </div>
</div> </div>
<div class="col-2 col-centered"> <div class="col-2 col-centered">
<h4 align="center"><img src="img/clima/uv2.webp" width="13" height="13"> Rayos UV </h4> <h4 align="center"><img src="gui_common/img/clima/uv2.webp" width="13" height="13"> Rayos UV </h4>
<div class="zoom"> <div class="zoom">
<h1><span id='rayos_ext' class="badge badge-primary">-</span></h1> <h1><span id='rayos_ext' class="badge badge-primary">-</span></h1>
<h4> <h4>
@ -91,7 +91,7 @@
</div> </div>
</div> </div>
<div class="col-2 col-centered"> <div class="col-2 col-centered">
<h4 align="center"><img src="img/clima/presion.webp" width="13" height="13"> Presión R. </h4> <h4 align="center"><img src="gui_common/img/clima/presion.webp" width="13" height="13"> Presión R. </h4>
<div class="zoom"> <div class="zoom">
<h1><span id='presionr_ext' class="badge badge-primary">-</span></h1> <h1><span id='presionr_ext' class="badge badge-primary">-</span></h1>
<h4> <h4>
@ -116,25 +116,25 @@
<div class="col-3 col-centered" title="Lluvia acumulada en 10 minutos"> <div class="col-3 col-centered" title="Lluvia acumulada en 10 minutos">
<h4 align="center">Lluvia Actual</h4> <h4 align="center">Lluvia Actual</h4>
<div class="zoom"> <div class="zoom">
<h1><img src="img/clima/lluvia.webp"> <span id='lloviendo_ext' class="badge badge-info">-</span><br><span id="lloviendo_ext_img" class="small"></span></h1> <h1><img src="gui_common/img/clima/lluvia.webp"> <span id='lloviendo_ext' class="badge badge-info">-</span><br><span id="lloviendo_ext_img" class="small"></span></h1>
</div> </div>
</div> </div>
<div class="col-3 col-centered" title="Lluvia acumulada en la hora actual"> <div class="col-3 col-centered" title="Lluvia acumulada en la hora actual">
<h4 align="center">Lluvia Hora</h4> <h4 align="center">Lluvia Hora</h4>
<div class="zoom"> <div class="zoom">
<h1><img src="img/clima/lluvia.webp"> <span id='totalacuhora_ext' class="badge badge-info">-</span><br><span id="totalacuhora_ext_img" class="small"></span></h1> <h1><img src="gui_common/img/clima/lluvia.webp"> <span id='totalacuhora_ext' class="badge badge-info">-</span><br><span id="totalacuhora_ext_img" class="small"></span></h1>
</div> </div>
</div> </div>
<div class="col-3 col-centered" title="Lluvia acumulada en el día actual"> <div class="col-3 col-centered" title="Lluvia acumulada en el día actual">
<h4 align="center">Lluvia Día</h4> <h4 align="center">Lluvia Día</h4>
<div class="zoom"> <div class="zoom">
<h1><img src="img/clima/lluvia.webp"> <span id='totalacudia_ext' class="badge badge-info">-</span><br><span id="totalacudia_ext_img" class="small"></span></h1> <h1><img src="gui_common/img/clima/lluvia.webp"> <span id='totalacudia_ext' class="badge badge-info">-</span><br><span id="totalacudia_ext_img" class="small"></span></h1>
</div> </div>
</div> </div>
<div class="col-3 col-centered" title="Lluvia acumulada total"> <div class="col-3 col-centered" title="Lluvia acumulada total">
<h4 align="center">Lluvia Total</h4> <h4 align="center">Lluvia Total</h4>
<div class="zoom"> <div class="zoom">
<h1><img src="img/clima/lluvia.webp"><span id='totalL_ext' class="badge badge-info">-</span><br><span id="totalacudia_ext_img" class="small"></span></h1> <h1><img src="gui_common/img/clima/lluvia.webp"><span id='totalL_ext' class="badge badge-info">-</span><br><span id="totalacudia_ext_img" class="small"></span></h1>
</div> </div>
</div> </div>
</div> </div>

View File

@ -25,7 +25,7 @@
</div> </div>
</div> </div>
<div align="right"> <div align="right">
<label id="actualizando" style="display:none" align="center"> <br><br><br><br><img src="./img/animadas/cargando2.gif" width='60' height='60'></label> <label id="actualizando" style="display:none" align="center"> <br><br><br><br><img src="./gui_common/img/animadas/cargando2.gif" width='60' height='60'></label>
</div> </div>
<div id="mostrarregistrosH" style="color:white;text-align:left;" width="100%"> </div> <div id="mostrarregistrosH" style="color:white;text-align:left;" width="100%"> </div>
</div> </div>

View File

@ -6,18 +6,18 @@
<td rowspan="2" id="barralateral" style="background-color: rgba(251, 251, 251, 0.15)"></td> <td rowspan="2" id="barralateral" style="background-color: rgba(251, 251, 251, 0.15)"></td>
<td> <td>
<h5><b>Información General<b><h5> <h5><b>Información General<b><h5>
<h5><img id="img_nombre" height="25" width="25"> Nombre: <span class="badge badge-info" style="font-size:small" id="inombre">-</span></h5> <h5><img src="gui_common/img/informacion.png" id="img_nombre" height="25" width="25"> Nombre: <span class="badge badge-info" style="font-size:small" id="inombre">-</span></h5>
<h5><img id="img_so" height="25" width="25"> S.O: <span class="badge badge-info" style="font-size:small" id="iso">-</span></h5> <h5><img src="gui_common/img/informacion.png" id="img_so" height="25" width="25"> S.O: <span class="badge badge-info" style="font-size:small" id="iso">-</span></h5>
<h5><img id="img_modo" height="25" width="25"> Modo: <span class="badge badge-info" style="font-size:small" id="imodo">-</span></h5> <h5><img src="gui_common/img/informacion.png" id="img_modo" height="25" width="25"> Modo: <span class="badge badge-info" style="font-size:small" id="imodo">-</span></h5>
<h5><img src="img/ok.webp" height="25" width="25"> Node.js: <span id='versiones' class="badge badge-info" style="font-size:small" data-toggle="tooltip" data-placement="right" data-html="true" title="-"><span id="nwjs_v">-</span></h5> <h5><img src="gui_common/img/informacion.png" height="25" width="25"> Node.js: <span id='versiones' class="badge badge-info" style="font-size:small" data-toggle="tooltip" data-placement="right" data-html="true" title="-"><span id="nwjs_v">-</span></h5>
</td> </td>
<td WIDTH = "1%" rowspan="2"></td> <td WIDTH = "1%" rowspan="2"></td>
<td> <td>
<h5><b>Tanques del Sistema</b></h5> <h5><b>Tanques del Sistema</b></h5>
<h5><img src="img/archive.webp" height="25" width="25"><b>Diario: </b> <span class="badge badge-info" style="font-size:small" id="tamanio_diario">-</span> </h5> <h5><img src="gui_common/img/archive.webp" height="25" width="25"><b>Diario: </b> <span class="badge badge-info" style="font-size:small" id="tamanio_diario">-</span> </h5>
<h5><img src="img/archive.webp" height="25" width="25"><b>Pendiente:</b> <span class="badge badge-info" style="font-size:small" id="tamanio_pendiente">-</span> <button type="button" class="w3-tiny" onclick="PurgarP()" data-toggle="tooltip" data-placement="right" title="Si presiona este botón de purgar, usted vaciará el archivo que almacena los registros pendientes de enviar, esto solo aplica para registros pendientes de enviar de redes de tipo 'emacenter'.">Purgar</button ></h5> <h5><img src="gui_common/img/archive.webp" height="25" width="25"><b>Pendiente:</b> <span class="badge badge-info" style="font-size:small" id="tamanio_pendiente">-</span> <button type="button" class="btn btn-sm btn-warning" onclick="PurgarP()" data-toggle="tooltip" data-placement="right" title="Si presiona este botón de purgar, usted vaciará el archivo que almacena los registros pendientes de enviar, esto solo aplica para registros pendientes de enviar de redes de tipo 'emacenter'.">Purgar</button ></h5>
<h5><img src="img/archive.webp" height="25" width="25"><b>Debug: </b> <span class="badge badge-info" style="font-size:small" id="tamanio_debug">-</span> <button type="button" class="w3-tiny" onclick="PurgarD()" data-toggle="tooltip" data-placement="right" title="Si presiona este botón de purgar, usted vaciará el archivo que almacena los registros de logs del sistema." >Purgar</button > </h5> <h5><img src="gui_common/img/archive.webp" height="25" width="25"><b>Debug: </b> <span class="badge badge-info" style="font-size:small" id="tamanio_debug">-</span> <button type="button" class="btn btn-sm btn-warning" onclick="PurgarD()" data-toggle="tooltip" data-placement="right" title="Si presiona este botón de purgar, usted vaciará el archivo que almacena los registros de logs del sistema." >Purgar</button > </h5>
</td> </td>
@ -36,10 +36,10 @@
</td> </td>
<td> <td>
<h5><b>Información de Ejecución</b> </h5> <h5><b>Información de Ejecución</b> </h5>
<h5><img src="img/sistema.webp" height="25" width="25"><b>Audio: </b> <span class="badge badge-info" id="audiomenu" data-toggle="tooltip" data-placement="right" title="Indica si esta activado el audio" style="font-size:small">-</span> </h5> <h5><img src="gui_common/img/sistema.webp" height="25" width="25"><b>Audio: </b> <span class="badge badge-info" id="audiomenu" data-toggle="tooltip" data-placement="right" title="Indica si esta activado el audio" style="font-size:small">-</span> </h5>
<h5><img src="img/sistema.webp" height="25" width="25"><b>AutoInicio: </b> <span class="badge badge-info" id="autoactivado" data-toggle="tooltip" data-placement="right" title="Indica si el inicio automatico esta activado." style="font-size:small">-</span> </h5> <h5><img src="gui_common/img/sistema.webp" height="25" width="25"><b>AutoInicio: </b> <span class="badge badge-info" id="autoactivado" data-toggle="tooltip" data-placement="right" title="Indica si el inicio automatico esta activado." style="font-size:small">-</span> </h5>
<h5><img src="img/sistema.webp" height="25" width="25"><b>PID: </b> <span class="badge badge-info" id="node_pid" data-toggle="tooltip" data-placement="right" title="Numero del Identificado de Proceso (PID) de la aplicación Ema Libre." style="font-size:small">-</span> </h5> <h5><img src="gui_common/img/sistema.webp" height="25" width="25"><b>PID: </b> <span class="badge badge-info" id="node_pid" data-toggle="tooltip" data-placement="right" title="Numero del Identificado de Proceso (PID) de la aplicación Ema Libre." style="font-size:small">-</span> </h5>
<h5><img src="img/sistema.webp" height="25" width="25"><b>PPID: </b> <span class="badge badge-info" id="node_ppid" data-toggle="tooltip" data-placement="right" title="Numero del Identificado de Proceso Padre (PPID) de la aplicación Ema Libre." style="font-size:small">-</span> </h5> <h5><img src="gui_common/img/sistema.webp" height="25" width="25"><b>PPID: </b> <span class="badge badge-info" id="node_ppid" data-toggle="tooltip" data-placement="right" title="Numero del Identificado de Proceso Padre (PPID) de la aplicación Ema Libre." style="font-size:small">-</span> </h5>
</td> </td>
<td style="display:table-cell; vertical-align:middle; text-align:center"> <td style="display:table-cell; vertical-align:middle; text-align:center">
<button id="botondetener" class="btn btn-lg btn-danger" onclick="DETENER()" role="button">Detener</button > <button id="botondetener" class="btn btn-lg btn-danger" onclick="DETENER()" role="button">Detener</button >

View File

@ -11,7 +11,7 @@
</div> </div>
</div> </div>
<div align="right"> <div align="right">
<label id="actualizando" style="display:none" align="center"> <br><br><br><br><img src="./img/animadas/cargando2.gif" width='60' height='60'></label> <label id="actualizando" style="display:none" align="center"> <br><br><br><br><img src="./gui_common/img/animadas/cargando2.gif" width='60' height='60'></label>
</div> </div>
<div id="mostrarregistrosLogs" style="color:white;text-align:left;"></div> <div id="mostrarregistrosLogs" style="color:white;text-align:left;"></div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

43
src/package-lock.json generated
View File

@ -11,13 +11,12 @@
"dependencies": { "dependencies": {
"bootstrap": "4.6.2", "bootstrap": "4.6.2",
"bootstrap-select": "1.13.18", "bootstrap-select": "1.13.18",
"chart.js": "^2.9.4",
"datatables": "1.10.18", "datatables": "1.10.18",
"datatables-buttons": "1.0.3", "datatables-buttons": "1.0.3",
"express": "5.1.0", "express": "5.1.0",
"forever": "^4.0.3", "forever": "^4.0.3",
"jquery": "3.7.1", "jquery": "3.7.1",
"node": "24.4.0", "node": "^24.11.0",
"node-hid": "^2.2.0", "node-hid": "^2.2.0",
"nodemailer": "7.0.5", "nodemailer": "7.0.5",
"notify-js-lib": "1.0.0", "notify-js-lib": "1.0.0",
@ -524,32 +523,6 @@
"resolved": "https://registry.npmjs.org/caller/-/caller-1.1.0.tgz", "resolved": "https://registry.npmjs.org/caller/-/caller-1.1.0.tgz",
"integrity": "sha512-n+21IZC3j06YpCWaxmUy5AnVqhmCIM2bQtqQyy00HJlmStRt6kwDX5F9Z97pqwAB+G/tgSz6q/kUBbNyQzIubw==" "integrity": "sha512-n+21IZC3j06YpCWaxmUy5AnVqhmCIM2bQtqQyy00HJlmStRt6kwDX5F9Z97pqwAB+G/tgSz6q/kUBbNyQzIubw=="
}, },
"node_modules/chart.js": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz",
"integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==",
"dependencies": {
"chartjs-color": "^2.1.0",
"moment": "^2.10.2"
}
},
"node_modules/chartjs-color": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz",
"integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==",
"dependencies": {
"chartjs-color-string": "^0.6.0",
"color-convert": "^1.9.3"
}
},
"node_modules/chartjs-color-string": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz",
"integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==",
"dependencies": {
"color-name": "^1.0.0"
}
},
"node_modules/chokidar": { "node_modules/chokidar": {
"version": "2.1.8", "version": "2.1.8",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
@ -2457,14 +2430,6 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
}, },
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@ -2599,9 +2564,9 @@
} }
}, },
"node_modules/node": { "node_modules/node": {
"version": "24.4.0", "version": "24.11.0",
"resolved": "https://registry.npmjs.org/node/-/node-24.4.0.tgz", "resolved": "https://registry.npmjs.org/node/-/node-24.11.0.tgz",
"integrity": "sha512-IPMGt3XUfM12saFz9D3cFx9T7d8rvx8sIf/v2K3Jwgjrp8LyzO7bIrHZDR6XpiNRHX3hKvI7KzXti8zKRyr7Jg==", "integrity": "sha512-pGLc7hd4xh0doDpnHC5+PL09WLUDKFoBFsC28341AYhHjzTDbNSwY+2615tYY6YFO2WQUKit4yqTwzIHaaityg==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"node-bin-setup": "^1.0.0" "node-bin-setup": "^1.0.0"

View File

@ -5,7 +5,7 @@
"version": "1.36.0", "version": "1.36.0",
"author": "Laboratorio de Investigacion Gugler", "author": "Laboratorio de Investigacion Gugler",
"homepage": "https://www.gugler.com.ar", "homepage": "https://www.gugler.com.ar",
"chromium-args": "--enable-speech-dispatcher", "chromium-args": "--enable-speech-dispatcher --disable-logging --disable-gpu --disable-gpu-compositing --no-sandbox --ignore-gpu-blacklist --disable-dev-shm-usage --disable-accelerated-2d-canvas --disable-accelerated-compositing --disable-gpu-rasterization",
"keywords": [ "keywords": [
"ema", "ema",
"estacion", "estacion",
@ -32,7 +32,7 @@
"url": "https://ema.gugler.com.ar" "url": "https://ema.gugler.com.ar"
}, },
"scripts": { "scripts": {
"desktop": "nw .", "desktop": "nw . --disable-logging",
"web": "node gui_web/express.js iniciar", "web": "node gui_web/express.js iniciar",
"consola": "node core/ema.js console", "consola": "node core/ema.js console",
"reporte": "node core/reporte.js", "reporte": "node core/reporte.js",
@ -44,13 +44,12 @@
"dependencies": { "dependencies": {
"bootstrap": "4.6.2", "bootstrap": "4.6.2",
"bootstrap-select": "1.13.18", "bootstrap-select": "1.13.18",
"chart.js": "^2.9.4",
"datatables": "1.10.18", "datatables": "1.10.18",
"datatables-buttons": "1.0.3", "datatables-buttons": "1.0.3",
"express": "5.1.0", "express": "5.1.0",
"forever": "^4.0.3", "forever": "^4.0.3",
"jquery": "3.7.1", "jquery": "3.7.1",
"node": "24.4.0", "node": "^24.11.0",
"node-hid": "^2.2.0", "node-hid": "^2.2.0",
"nodemailer": "7.0.5", "nodemailer": "7.0.5",
"notify-js-lib": "1.0.0", "notify-js-lib": "1.0.0",

View File

@ -1,6 +1,6 @@
import requests import requests
import time import time
# Requiere instalar requests: pip install requests
# Configuración: IP y puerto del servidor # Configuración: IP y puerto del servidor
ip_destino = '192.168.1.220' ip_destino = '192.168.1.220'
puerto = 5000 # Cambialo por el puerto que necesites puerto = 5000 # Cambialo por el puerto que necesites
@ -45,8 +45,12 @@ params = {
# Bucle infinito que envía el GET cada X segundos # Bucle infinito que envía el GET cada X segundos
while True: while True:
try: try:
response = requests.get(url_base, params=params) response = requests.get(url_base, params=params, timeout=5)
print(f"[{time.strftime('%H:%M:%S')}] Status {response.status_code} - {response.url}") print(f"✅ [{time.strftime('%H:%M:%S')}] Status {response.status_code} - {response.url}")
except requests.exceptions.Timeout:
print(f"⏰ Timeout: el servidor no respondió en 5 segundos.")
except requests.exceptions.ConnectionError:
print(f"🔌 Error de conexión: el puerto {puerto} no está abierto o el servidor no responde.")
except Exception as e: except Exception as e:
print(f"❌ Error enviando request: {e}") print(f"❌ Error enviando request: {e}")