@frangoteam/fuxa-min 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/_images/Pipes/P1.svg +39 -0
- package/_images/Tanks/Fl.svg +7 -0
- package/api/alarms/index.js +132 -0
- package/api/auth/index.js +71 -0
- package/api/command/index.js +187 -0
- package/api/daq/index.js +79 -0
- package/api/diagnose/index.js +163 -0
- package/api/index.js +181 -0
- package/api/jwt-helper.js +106 -0
- package/api/plugins/index.js +109 -0
- package/api/projects/index.js +229 -0
- package/api/resources/index.js +118 -0
- package/api/scripts/index.js +82 -0
- package/api/users/index.js +109 -0
- package/dist/3rdpartylicenses.txt +1477 -0
- package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
- package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
- package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
- package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
- package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
- package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
- package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
- package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
- package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
- package/dist/assets/fonts/icomoon.eot +0 -0
- package/dist/assets/fonts/icomoon.svg +19 -0
- package/dist/assets/fonts/icomoon.ttf +0 -0
- package/dist/assets/fonts/icomoon.woff +0 -0
- package/dist/assets/fonts/myicons.eot +0 -0
- package/dist/assets/fonts/myicons.svg +19 -0
- package/dist/assets/fonts/myicons.ttf +0 -0
- package/dist/assets/fonts/myicons.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
- package/dist/assets/i18n/de.json +1308 -0
- package/dist/assets/i18n/en.json +1438 -0
- package/dist/assets/i18n/es.json +777 -0
- package/dist/assets/i18n/fr.json +1129 -0
- package/dist/assets/i18n/ko.json +774 -0
- package/dist/assets/i18n/pt.json +657 -0
- package/dist/assets/i18n/ru.json +1228 -0
- package/dist/assets/i18n/tr.json +673 -0
- package/dist/assets/i18n/ua.json +614 -0
- package/dist/assets/i18n/zh-cn.json +1252 -0
- package/dist/assets/images/align-bottom.svg +88 -0
- package/dist/assets/images/align-center.svg +86 -0
- package/dist/assets/images/align-left.svg +86 -0
- package/dist/assets/images/align-middle.svg +88 -0
- package/dist/assets/images/align-right.svg +88 -0
- package/dist/assets/images/align-top.svg +88 -0
- package/dist/assets/images/bag.svg +115 -0
- package/dist/assets/images/button.svg +22 -0
- package/dist/assets/images/chart.svg +17 -0
- package/dist/assets/images/circle.svg +84 -0
- package/dist/assets/images/compressor-a.svg +2 -0
- package/dist/assets/images/editvalue.svg +14 -0
- package/dist/assets/images/ellipse.svg +84 -0
- package/dist/assets/images/flip-orizontal.svg +86 -0
- package/dist/assets/images/flip-vertical.svg +82 -0
- package/dist/assets/images/gauge-donut.png +0 -0
- package/dist/assets/images/gauge-mat.png +0 -0
- package/dist/assets/images/gauge-zone.png +0 -0
- package/dist/assets/images/graphbar.svg +18 -0
- package/dist/assets/images/group.svg +91 -0
- package/dist/assets/images/iframe.svg +54 -0
- package/dist/assets/images/image.svg +95 -0
- package/dist/assets/images/led-circle.svg +77 -0
- package/dist/assets/images/line.svg +86 -0
- package/dist/assets/images/linecap-butt.svg +77 -0
- package/dist/assets/images/linecap-round.svg +77 -0
- package/dist/assets/images/linecap-square.svg +82 -0
- package/dist/assets/images/linejoin-bevel.svg +77 -0
- package/dist/assets/images/linejoin-miter.svg +77 -0
- package/dist/assets/images/linejoin-round.svg +77 -0
- package/dist/assets/images/logo.svg +18 -0
- package/dist/assets/images/path.svg +100 -0
- package/dist/assets/images/pencil.svg +98 -0
- package/dist/assets/images/pipe.svg +15 -0
- package/dist/assets/images/progress-v.svg +79 -0
- package/dist/assets/images/rect.svg +84 -0
- package/dist/assets/images/select-pointer.svg +93 -0
- package/dist/assets/images/selectvalue.svg +14 -0
- package/dist/assets/images/semaphore.svg +19 -0
- package/dist/assets/images/slider.svg +17 -0
- package/dist/assets/images/switch.svg +15 -0
- package/dist/assets/images/table.svg +55 -0
- package/dist/assets/images/text.svg +294 -0
- package/dist/assets/images/to-bottom.svg +163 -0
- package/dist/assets/images/to-path.svg +94 -0
- package/dist/assets/images/to-top.svg +163 -0
- package/dist/assets/images/to_top.svg +88 -0
- package/dist/assets/images/todelete.svg +13 -0
- package/dist/assets/images/ungroup.svg +108 -0
- package/dist/assets/images/value.svg +81 -0
- package/dist/assets/images/valve-a.svg +2 -0
- package/dist/assets/images/webcam.svg +16 -0
- package/dist/assets/lib/ext-styles.css +28 -0
- package/dist/assets/lib/gauge/gauge.js +988 -0
- package/dist/assets/lib/gauge/gauge.min.js +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
- package/dist/assets/lib/numeral/locales.min.js +7 -0
- package/dist/assets/lib/numeral/numeral.min.js +8 -0
- package/dist/assets/lib/pdfkit-table/index.js +967 -0
- package/dist/assets/lib/svg/raphael.min.js +1 -0
- package/dist/assets/lib/svg/svg.js +5573 -0
- package/dist/assets/lib/svg/svg.min.js +13 -0
- package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
- package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
- package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
- package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
- package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
- package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
- package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
- package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
- package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
- package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
- package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
- package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
- package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
- package/dist/assets/lib/uplot/placement.min.js +2 -0
- package/dist/assets/project.demo.fuxap +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/icomoon.86abfb46e057ade8.eot +0 -0
- package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
- package/dist/icomoon.ce427f75e21963af.ttf +0 -0
- package/dist/icomoon.dfb0a89feb346906.svg +19 -0
- package/dist/index.html +50 -0
- package/dist/logo.0e8e64e69250a450.svg +18 -0
- package/dist/main.a356f552d9838b9e.js +1 -0
- package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
- package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
- package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
- package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
- package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
- package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
- package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
- package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
- package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
- package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
- package/dist/polyfills.2696a6f9dc75535e.js +1 -0
- package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
- package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
- package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
- package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
- package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
- package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
- package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
- package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
- package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
- package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
- package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
- package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
- package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
- package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
- package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
- package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
- package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
- package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
- package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
- package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
- package/dist/runtime.8ef63094e52a66ba.js +1 -0
- package/dist/scripts.1c3385254ff4c93c.js +1 -0
- package/dist/styles.cf8e3cf50d039a5c.css +1 -0
- package/fuxa.js +39 -0
- package/main.js +381 -0
- package/package.json +68 -0
- package/paths.js +44 -0
- package/project.default.json +11 -0
- package/project.demo.fuxap +1 -0
- package/runtime/alarms/alarmstorage.js +205 -0
- package/runtime/alarms/index.js +678 -0
- package/runtime/devices/bacnet/index.js +730 -0
- package/runtime/devices/device-utils.js +95 -0
- package/runtime/devices/device.js +551 -0
- package/runtime/devices/ethernetip/index.js +381 -0
- package/runtime/devices/fuxaserver/index.js +310 -0
- package/runtime/devices/httprequest/index.js +495 -0
- package/runtime/devices/index.js +489 -0
- package/runtime/devices/modbus/datatypes.js +122 -0
- package/runtime/devices/modbus/index.js +730 -0
- package/runtime/devices/mqtt/index.js +618 -0
- package/runtime/devices/odbc/index.js +408 -0
- package/runtime/devices/opcua/index.js +817 -0
- package/runtime/devices/s7/datatypes.js +88 -0
- package/runtime/devices/s7/index.js +702 -0
- package/runtime/devices/template/index.js +141 -0
- package/runtime/events.js +33 -0
- package/runtime/index.js +559 -0
- package/runtime/jobs/cleaner.js +74 -0
- package/runtime/jobs/fonts/LICENSE.txt +202 -0
- package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
- package/runtime/jobs/helper/image-generator.js +82 -0
- package/runtime/jobs/index.js +214 -0
- package/runtime/jobs/report.js +353 -0
- package/runtime/logger.js +113 -0
- package/runtime/notificator/index.js +383 -0
- package/runtime/notificator/notifystorage.js +179 -0
- package/runtime/plugins/index.js +255 -0
- package/runtime/project/index.js +959 -0
- package/runtime/project/prjstorage.js +222 -0
- package/runtime/scripts/index.js +313 -0
- package/runtime/scripts/msm.js +146 -0
- package/runtime/storage/calculator.js +227 -0
- package/runtime/storage/daqstorage.js +188 -0
- package/runtime/storage/influxdb/index.js +240 -0
- package/runtime/storage/sqlite/currentstorage.js +144 -0
- package/runtime/storage/sqlite/index.js +695 -0
- package/runtime/storage/tdengine/index.js +106 -0
- package/runtime/users/index.js +123 -0
- package/runtime/users/usrstorage.js +201 -0
- package/runtime/utils.js +284 -0
- package/screenshot/feature-action-move.gif +0 -0
- package/screenshot/fuxa-ani.gif +0 -0
- package/screenshot/fuxa-device.gif +0 -0
- package/screenshot/fuxa-editor.png +0 -0
- package/screenshot/fuxa-hmi.gif +0 -0
- package/screenshot/fuxa-home.png +0 -0
- package/screenshot/fuxa-test.gif +0 -0
- package/settings.default.js +65 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'mqtt': mqtt client to manage subscription and publish
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
const mqtt = require('mqtt');
|
|
6
|
+
const utils = require('../../utils');
|
|
7
|
+
const deviceUtils = require('../device-utils');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
|
|
11
|
+
function MQTTclient(_data, _logger, _events) {
|
|
12
|
+
var data = _data; // Current data
|
|
13
|
+
var logger = _logger; // Logger var working = false;
|
|
14
|
+
var working = false; // Working flag to manage overloading polling and connection
|
|
15
|
+
var events = _events; // Events to commit change to runtime
|
|
16
|
+
var lastStatus = ''; // Last connections status
|
|
17
|
+
var varsValue = {}; // Tags to send to frontend { id, type, value }
|
|
18
|
+
var overloading = 0; // Overloading counter to mange the break connection
|
|
19
|
+
var lastTimestampValue; // Last Timestamp of asked values
|
|
20
|
+
var getProperty = null; // Function to ask property (security)
|
|
21
|
+
var options = {}; // MQTT client Connection options
|
|
22
|
+
var client = null; // MQTT client head
|
|
23
|
+
var browser = null; // MQTT client for browser subscription topics
|
|
24
|
+
var timeoutBrowser; // Timeout to manage break the browsing
|
|
25
|
+
var topicsMap = {}; // Map the topic subscribed, to check by on.message
|
|
26
|
+
var memoryTagToPublish = new Map(); // Map tag to publish, content in topics as 'tag'
|
|
27
|
+
var refTagToTopics = {}; // Map of Tag to Topic (with ref to other device tag)
|
|
28
|
+
|
|
29
|
+
const certificatesDir = _data.certificatesDir;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Tag with options 'pubs' for publish and 'subs' for subscription
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Connect the mqtt client to broker
|
|
37
|
+
* Emit connection status, Clear the memory Topics value
|
|
38
|
+
*/
|
|
39
|
+
this.connect = function () {
|
|
40
|
+
return new Promise(async function (resolve, reject) {
|
|
41
|
+
if (data.property && data.property.address) {
|
|
42
|
+
try {
|
|
43
|
+
if (_checkWorking(true)) {
|
|
44
|
+
logger.info(`'${data.name}' try to connect ${data.property.address}`, true);
|
|
45
|
+
options = getConnectionOptions(data.property)
|
|
46
|
+
options.connectTimeout = 10 * 1000;
|
|
47
|
+
if (getProperty) {
|
|
48
|
+
var result = await getProperty({ query: 'security', name: data.id });
|
|
49
|
+
if (result && result.value && result.value !== 'null') {
|
|
50
|
+
// property security mode
|
|
51
|
+
var property = JSON.parse(result.value);
|
|
52
|
+
options.clientId = property.clientId;
|
|
53
|
+
options.username = property.uid;
|
|
54
|
+
options.password = property.pwd;
|
|
55
|
+
if (property.cert) {
|
|
56
|
+
options.cert = fs.readFileSync(path.join(certificatesDir, property.cert));
|
|
57
|
+
}
|
|
58
|
+
if (property.pkey) {
|
|
59
|
+
options.key = fs.readFileSync(path.join(certificatesDir, property.pkey));
|
|
60
|
+
}
|
|
61
|
+
if (property.caCert) {
|
|
62
|
+
options.ca = fs.readFileSync(path.join(certificatesDir, property.caCert));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
client = mqtt.connect(options.url, options);
|
|
67
|
+
_clearVarsValue();
|
|
68
|
+
client.on('connect', function () {
|
|
69
|
+
logger.info(`'${data.name}' connected!`);
|
|
70
|
+
_emitStatus('connect-ok');
|
|
71
|
+
_createSubscription().then(() => {
|
|
72
|
+
resolve();
|
|
73
|
+
_checkWorking(false);
|
|
74
|
+
}).catch(function (err) {
|
|
75
|
+
reject(err);
|
|
76
|
+
_checkWorking(false);
|
|
77
|
+
});
|
|
78
|
+
_createRefPublishReceiver();
|
|
79
|
+
});
|
|
80
|
+
client.on("offline", function () {
|
|
81
|
+
logger.warn(`'${data.name}' client offline ${data.property.address}`, true);
|
|
82
|
+
});
|
|
83
|
+
client.on("disconnect", function () {
|
|
84
|
+
logger.warn(`'${data.name}' client disconnect ${data.property.address}`, true);
|
|
85
|
+
});
|
|
86
|
+
client.on("reconnect", function (err) {
|
|
87
|
+
logger.warn(`'${data.name}' client reconnecting ... ${data.property.address}`, true);
|
|
88
|
+
});
|
|
89
|
+
client.on("close", function (err) {
|
|
90
|
+
logger.warn(`'${data.name}' client close ${data.property.address}`, true);
|
|
91
|
+
});
|
|
92
|
+
client.on("error", function (err) {
|
|
93
|
+
logger.error(`'${data.name}' try to connect error! ${err}`);
|
|
94
|
+
_checkWorking(false);
|
|
95
|
+
if (client && !client.connected) {
|
|
96
|
+
client.end(true);
|
|
97
|
+
}
|
|
98
|
+
reject(err);
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
reject();
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
logger.error(`'${data.name}' try to connect error! ${err}`);
|
|
105
|
+
_checkWorking(false);
|
|
106
|
+
_emitStatus('connect-error');
|
|
107
|
+
_clearVarsValue();
|
|
108
|
+
reject();
|
|
109
|
+
if (client) {
|
|
110
|
+
client.end(true);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
logger.error(`'${data.name}' missing connection data!`);
|
|
115
|
+
_emitStatus('connect-failed');
|
|
116
|
+
_clearVarsValue();
|
|
117
|
+
reject();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Disconnect the mqtt client
|
|
124
|
+
* Emit connection status, Clear the memory Topics value
|
|
125
|
+
*/
|
|
126
|
+
this.disconnect = function () {
|
|
127
|
+
return new Promise(function (resolve, reject) {
|
|
128
|
+
if (client) {
|
|
129
|
+
client.end(true, function (err) {
|
|
130
|
+
if (err) {
|
|
131
|
+
logger.error(`'${data.name}' disconnect failure! ${err}`);
|
|
132
|
+
}
|
|
133
|
+
_checkWorking(false);
|
|
134
|
+
_emitStatus('connect-off');
|
|
135
|
+
_clearVarsValue();
|
|
136
|
+
resolve(true);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
resolve(true);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Take the current Topics value (only changed), emit Topics value
|
|
147
|
+
* Save DAQ value
|
|
148
|
+
*/
|
|
149
|
+
this.polling = function () {
|
|
150
|
+
if (_checkWorking(true)) {
|
|
151
|
+
if (client) {
|
|
152
|
+
try {
|
|
153
|
+
var varsValueChanged = _checkVarsChanged();
|
|
154
|
+
lastTimestampValue = new Date().getTime();
|
|
155
|
+
_emitValues(varsValue);
|
|
156
|
+
|
|
157
|
+
if (this.addDaq && !utils.isEmptyObject(varsValueChanged)) {
|
|
158
|
+
this.addDaq(varsValueChanged, data.name, data.id);
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
logger.error(`'${data.name}' polling error: ${err}`);
|
|
162
|
+
}
|
|
163
|
+
_checkWorking(false);
|
|
164
|
+
} else {
|
|
165
|
+
_checkWorking(false);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Return the result of mqtt browsing by configure it
|
|
172
|
+
*/
|
|
173
|
+
this.browse = function (topic, callback) {
|
|
174
|
+
return new Promise(async function (resolve, reject) {
|
|
175
|
+
try {
|
|
176
|
+
_resetBrowserTimeout();
|
|
177
|
+
if (!browser || !browser.connected) {
|
|
178
|
+
let options = getConnectionOptions(data.property);
|
|
179
|
+
if (getProperty) {
|
|
180
|
+
var result = await getProperty({ query: 'security', name: data.id });
|
|
181
|
+
if (result && result.value && result.value !== 'null') {
|
|
182
|
+
// property security mode
|
|
183
|
+
var property = JSON.parse(result.value);
|
|
184
|
+
options.clientId = property.clientId;
|
|
185
|
+
options.username = property.uid;
|
|
186
|
+
options.password = property.pwd;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
browser = mqtt.connect(options.url, options);
|
|
190
|
+
browser.on('connect', function () {
|
|
191
|
+
resolve('ok');
|
|
192
|
+
});
|
|
193
|
+
browser.on('message', function (topic, msg, pkt) {
|
|
194
|
+
if (callback) {
|
|
195
|
+
callback({ topic: topic, msg: msg.toString() });
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
browser.on("error", function (err) {
|
|
199
|
+
reject(err);
|
|
200
|
+
});
|
|
201
|
+
client.on("close", function (err) {
|
|
202
|
+
// console.info('mqtt browser closed');
|
|
203
|
+
});
|
|
204
|
+
} else {
|
|
205
|
+
resolve('ok');
|
|
206
|
+
}
|
|
207
|
+
browser.subscribe(topic, function () {
|
|
208
|
+
});
|
|
209
|
+
} catch (err) {
|
|
210
|
+
reject('browse-error: ' + err);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Return if mqtt client is connected
|
|
217
|
+
*/
|
|
218
|
+
this.isConnected = function () {
|
|
219
|
+
return (client) ? client.connected : false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Bind the DAQ store function
|
|
224
|
+
*/
|
|
225
|
+
this.bindAddDaq = function (fnc) {
|
|
226
|
+
this.addDaq = fnc; // Add the DAQ value to db history
|
|
227
|
+
}
|
|
228
|
+
this.addDaq = null;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Return the timestamp of last read tag operation on polling
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
this.lastReadTimestamp = () => {
|
|
235
|
+
return lastTimestampValue;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Set function to ask property (security)
|
|
240
|
+
*/
|
|
241
|
+
this.bindGetProperty = function (fnc) {
|
|
242
|
+
getProperty = fnc;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Load Topics attribute and map tags to publish
|
|
247
|
+
*/
|
|
248
|
+
this.load = function (_data) {
|
|
249
|
+
varsValue = {};
|
|
250
|
+
refTagToTopics = {};
|
|
251
|
+
data = JSON.parse(JSON.stringify(_data));
|
|
252
|
+
try {
|
|
253
|
+
var count = Object.keys(data.tags).length;
|
|
254
|
+
// map depending tag ids
|
|
255
|
+
for (var key in data.tags) {
|
|
256
|
+
if (data.tags[key].options && data.tags[key].options.pubs) {
|
|
257
|
+
data.tags[key].options.pubs.forEach(item => {
|
|
258
|
+
if (item.type === 'tag' && item.value) {
|
|
259
|
+
// topic with json data with value from other device tags
|
|
260
|
+
if (!memoryTagToPublish.has(item.value)) {
|
|
261
|
+
memoryTagToPublish.set(item.value, null);
|
|
262
|
+
events.emit('tag-change:subscription', item.value);
|
|
263
|
+
}
|
|
264
|
+
if (!refTagToTopics[item.value]) {
|
|
265
|
+
refTagToTopics[item.value] = { value: null, topics: [] };
|
|
266
|
+
}
|
|
267
|
+
refTagToTopics[item.value].topics.push(data.tags[key]);
|
|
268
|
+
} else if (item.type === 'value') {
|
|
269
|
+
// raw data (not depending from other tag)
|
|
270
|
+
item.value = '';
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
logger.info(`'${data.name}' data loaded (${count})`, true);
|
|
276
|
+
} catch (err) {
|
|
277
|
+
logger.error(`'${data.name}' load error! ${err}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Return Topic value { id: <name>, value: <value>, ts: <timestamp> }
|
|
283
|
+
*/
|
|
284
|
+
this.getValue = function (id) {
|
|
285
|
+
if (varsValue[id]) {
|
|
286
|
+
return { id: id, value: varsValue[id].value, ts: lastTimestampValue };
|
|
287
|
+
}
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Return Topics values array { id: <name>, value: <value>, type: <type> }
|
|
293
|
+
*/
|
|
294
|
+
this.getValues = function () {
|
|
295
|
+
return data.tags;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Set the Topic value, publish to broker (coming from frontend)
|
|
300
|
+
*/
|
|
301
|
+
this.setValue = function (tagId, value) {
|
|
302
|
+
if (client && client.connected) {
|
|
303
|
+
var tag = data.tags[tagId];
|
|
304
|
+
if (tag) {
|
|
305
|
+
if (tag.options) {
|
|
306
|
+
if (tag.options.pubs) {
|
|
307
|
+
tag.options.pubs.forEach(item => {
|
|
308
|
+
if (item.type === 'value') {
|
|
309
|
+
item.value = deviceUtils.tagRawCalculator(value, tag);
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
} else if (tag.options.subs && tag.options.subs.indexOf(tag.memaddress) !== -1) {
|
|
313
|
+
tag.value = deviceUtils.tagRawCalculator(value, tag);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (tag.type === 'raw') {
|
|
317
|
+
tag['value'] = deviceUtils.tagRawCalculator(value, tag);
|
|
318
|
+
}
|
|
319
|
+
tag.changed = true;
|
|
320
|
+
_publishValues([tag]);
|
|
321
|
+
// logger.info(`'${data.name}' setValue(${tagId}, ${value})`, true, true);
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Return Device status Connected/Disconnected 'connect-off', 'connect-ok', 'connect-error'
|
|
330
|
+
*/
|
|
331
|
+
this.getStatus = function () {
|
|
332
|
+
return lastStatus;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Return Topic property, not used (Topics don't have property)
|
|
337
|
+
*/
|
|
338
|
+
this.getTagProperty = function (topic) {
|
|
339
|
+
if (data.tags[topic]) {
|
|
340
|
+
return { id: topic, name: data.tags[topic].name, type: data.tags[topic].type, format: data.tags[topic].format };
|
|
341
|
+
} else {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Return the Daq settings of Tag
|
|
348
|
+
* @returns
|
|
349
|
+
*/
|
|
350
|
+
this.getTagDaqSettings = (tagId) => {
|
|
351
|
+
return data.tags[tagId] ? data.tags[tagId].daq : null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Set Daq settings of Tag
|
|
356
|
+
* @returns
|
|
357
|
+
*/
|
|
358
|
+
this.setTagDaqSettings = (tagId, settings) => {
|
|
359
|
+
if (data.tags[tagId]) {
|
|
360
|
+
utils.mergeObjectsValues(data.tags[tagId].daq, settings);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Create a subscription to receive Topics value
|
|
366
|
+
*/
|
|
367
|
+
var _createSubscription = function () {
|
|
368
|
+
return new Promise(function (resolve, reject) {
|
|
369
|
+
var topics = Object.values(data.tags).map(t => t.address);
|
|
370
|
+
_mapTopicsAddress(Object.values(data.tags));
|
|
371
|
+
if (topics && topics.length) {
|
|
372
|
+
client.subscribe(topics, function (err) {
|
|
373
|
+
if (err) {
|
|
374
|
+
reject(err);
|
|
375
|
+
} else {
|
|
376
|
+
client.on('message', function (topicAddr, msg, pkt) {
|
|
377
|
+
if (topicsMap[topicAddr]) {
|
|
378
|
+
for (var i = 0; i < topicsMap[topicAddr].length; i++) {
|
|
379
|
+
var id = topicsMap[topicAddr][i].id;
|
|
380
|
+
var oldvalue = data.tags[id].rawValue;
|
|
381
|
+
data.tags[id].rawValue = msg.toString();
|
|
382
|
+
data.tags[id].timestamp = new Date().getTime();
|
|
383
|
+
data.tags[id].changed = oldvalue !== data.tags[id].rawValue;
|
|
384
|
+
if (data.tags[id].type === 'json' && data.tags[id].options && data.tags[id].options.subs && data.tags[id].memaddress) {
|
|
385
|
+
try {
|
|
386
|
+
var subitems = JSON.parse(data.tags[id].rawValue);
|
|
387
|
+
if (!utils.isNullOrUndefined(subitems[data.tags[id].memaddress])) {
|
|
388
|
+
data.tags[id].rawValue = subitems[data.tags[id].memaddress];
|
|
389
|
+
} else {
|
|
390
|
+
data.tags[id].rawValue = oldvalue;
|
|
391
|
+
}
|
|
392
|
+
} catch (err) {
|
|
393
|
+
console.error(err);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
resolve();
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
} else {
|
|
403
|
+
resolve();
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Create the receiver of change tag value for the dependency in payload
|
|
410
|
+
*/
|
|
411
|
+
var _createRefPublishReceiver = function () {
|
|
412
|
+
events.on('tag-value:changed', function (event) {
|
|
413
|
+
try {
|
|
414
|
+
if (memoryTagToPublish.has(event.id)) {
|
|
415
|
+
// for topic with raw data (not depending from other tag)
|
|
416
|
+
var oldValue = memoryTagToPublish.get(event.id);
|
|
417
|
+
memoryTagToPublish.set(event.id, event.value);
|
|
418
|
+
if (oldValue !== event.value && refTagToTopics[event.id]) {
|
|
419
|
+
if (refTagToTopics[event.id].topics.length) {
|
|
420
|
+
// for topic with json data with value from other device tags
|
|
421
|
+
// set the tag value in memory and publish the topic
|
|
422
|
+
for (var i = 0; i < refTagToTopics[event.id].topics.length; i++) {
|
|
423
|
+
_publishValues([refTagToTopics[event.id].topics[i]]);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
} catch (err) {
|
|
429
|
+
console.error(err);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Map the topics to address (path)
|
|
435
|
+
* @param {*} topics
|
|
436
|
+
*/
|
|
437
|
+
var _mapTopicsAddress = function (topics) {
|
|
438
|
+
var tmap = {};
|
|
439
|
+
for (var i = 0; i < topics.length; i++) {
|
|
440
|
+
if (tmap[topics[i].address]) {
|
|
441
|
+
tmap[topics[i].address].push(topics[i]);
|
|
442
|
+
} else {
|
|
443
|
+
tmap[topics[i].address] = [topics[i]];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
topicsMap = tmap;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Clear local Topics value by set all to null
|
|
451
|
+
*/
|
|
452
|
+
var _clearVarsValue = function () {
|
|
453
|
+
for (var id in varsValue) {
|
|
454
|
+
varsValue[id].value = null;
|
|
455
|
+
}
|
|
456
|
+
_emitValues(varsValue);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Return the Topics to publish that have value changed and clear value changed flag of all Topics
|
|
462
|
+
*/
|
|
463
|
+
var _checkVarsChanged = () => {
|
|
464
|
+
const timestamp = new Date().getTime();
|
|
465
|
+
var result = {};
|
|
466
|
+
for (var id in data.tags) {
|
|
467
|
+
if (!utils.isNullOrUndefined(data.tags[id].rawValue)) {
|
|
468
|
+
data.tags[id].value = deviceUtils.tagValueCompose(data.tags[id].rawValue, data.tags[id]);
|
|
469
|
+
if (this.addDaq && deviceUtils.tagDaqToSave(data.tags[id], timestamp)) {
|
|
470
|
+
result[id] = data.tags[id];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
data.tags[id].changed = false;
|
|
474
|
+
varsValue[id] = data.tags[id];
|
|
475
|
+
}
|
|
476
|
+
return result;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Emit the mqtt client connection status
|
|
481
|
+
* @param {*} status
|
|
482
|
+
*/
|
|
483
|
+
var _emitStatus = function (status) {
|
|
484
|
+
lastStatus = status;
|
|
485
|
+
events.emit('device-status:changed', { id: data.name, status: status });
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Emit the mqtt Topics values array { id: <name>, value: <value>, type: <type> }
|
|
490
|
+
* @param {*} values
|
|
491
|
+
*/
|
|
492
|
+
var _emitValues = function (values) {
|
|
493
|
+
events.emit('device-value:changed', { id: data.name, values: values });
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Used to manage the async connection and polling automation (that not overloading)
|
|
498
|
+
* @param {*} check
|
|
499
|
+
*/
|
|
500
|
+
var _checkWorking = function (check) {
|
|
501
|
+
if (check && working) {
|
|
502
|
+
overloading++;
|
|
503
|
+
logger.warn(`'${data.name}' working (connection || polling) overload! ${overloading}`);
|
|
504
|
+
// !The driver don't give the break connection
|
|
505
|
+
if (overloading >= 3) {
|
|
506
|
+
try {
|
|
507
|
+
if (client) client.end(true);
|
|
508
|
+
} catch (e) {
|
|
509
|
+
console.error(e);
|
|
510
|
+
}
|
|
511
|
+
} else {
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
working = check;
|
|
516
|
+
overloading = 0;
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Reset the timeout by browse the Topics, 10 seconds to receive published Topics
|
|
522
|
+
*/
|
|
523
|
+
var _resetBrowserTimeout = function () {
|
|
524
|
+
if (timeoutBrowser) {
|
|
525
|
+
clearTimeout(timeoutBrowser);
|
|
526
|
+
}
|
|
527
|
+
timeoutBrowser = setTimeout(() => {
|
|
528
|
+
if (browser && browser.connected) {
|
|
529
|
+
browser.end(true);
|
|
530
|
+
}
|
|
531
|
+
}, 15000);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Publish the tags, called from polling and setValues (input in frontend)
|
|
536
|
+
* to publish are only tags from other devices or topics created in mqtt device (by publish section)
|
|
537
|
+
* @param {*} tags
|
|
538
|
+
*/
|
|
539
|
+
var _publishValues = function (tags) {
|
|
540
|
+
Object.keys(tags).forEach(key => {
|
|
541
|
+
try {
|
|
542
|
+
const topicOptions = { retain: true };
|
|
543
|
+
// publish only tags with pubs and value changed
|
|
544
|
+
if (tags[key].options && tags[key].options.pubs && tags[key].options.pubs.length) {
|
|
545
|
+
var topicTopuplish = {};
|
|
546
|
+
tags[key].options.pubs.forEach(item => {
|
|
547
|
+
var value = '';
|
|
548
|
+
if (item.type === 'tag' && item.value) { // tag from other devices
|
|
549
|
+
if (memoryTagToPublish.has(item.value)) {
|
|
550
|
+
value = memoryTagToPublish.get(item.value);
|
|
551
|
+
}
|
|
552
|
+
} else if (item.type === 'timestamp') { // timestamp to add in tag with value
|
|
553
|
+
value = new Date().toISOString();
|
|
554
|
+
} else if (item.type === 'value') { // tag created in mqtt device as value
|
|
555
|
+
value = item.value;
|
|
556
|
+
} else { // item.type === 'static'
|
|
557
|
+
value = item.value;
|
|
558
|
+
}
|
|
559
|
+
if (tags[key].type === 'json') {
|
|
560
|
+
topicTopuplish[item.key] = value;
|
|
561
|
+
} else { // payloand with row data, item.key is ''
|
|
562
|
+
if (topicTopuplish[0]) {
|
|
563
|
+
value = topicTopuplish[0] + ';' + value;
|
|
564
|
+
}
|
|
565
|
+
topicTopuplish[0] = value;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
// payloand
|
|
569
|
+
if (tags[key].type === 'json') {
|
|
570
|
+
client.publish(tags[key].address, JSON.stringify(topicTopuplish), topicOptions);
|
|
571
|
+
} else if (topicTopuplish[0] !== undefined) { // payloand with row data
|
|
572
|
+
client.publish(tags[key].address, Object.values(topicTopuplish)[0].toString(), topicOptions);
|
|
573
|
+
}
|
|
574
|
+
} else if (tags[key].type === 'json' && tags[key].options && tags[key].options.subs && tags[key].options.subs.length) {
|
|
575
|
+
let obj = {};
|
|
576
|
+
obj[tags[key].memaddress] = tags[key].value;
|
|
577
|
+
client.publish(tags[key].address, JSON.stringify(obj), topicOptions);
|
|
578
|
+
} else if (tags[key].value !== undefined) { // whitout payload
|
|
579
|
+
client.publish(tags[key].address, tags[key].value.toString(), topicOptions);
|
|
580
|
+
tags[key].value = null;
|
|
581
|
+
}
|
|
582
|
+
} catch (err) {
|
|
583
|
+
console.error(err);
|
|
584
|
+
}
|
|
585
|
+
})
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Return connection option from device property
|
|
591
|
+
* @param {*} property
|
|
592
|
+
*/
|
|
593
|
+
function getConnectionOptions(property) {
|
|
594
|
+
return {
|
|
595
|
+
url: property.address,
|
|
596
|
+
username: property.username,
|
|
597
|
+
password: property.password,
|
|
598
|
+
keepalive: 60,
|
|
599
|
+
connectTimeout: 1 * 1000,
|
|
600
|
+
reconnectPeriod: 0
|
|
601
|
+
// tls: options.encryption,
|
|
602
|
+
// clientId: options.clientId,
|
|
603
|
+
// certValidation: options.certValidation,
|
|
604
|
+
// subscriptions: options.subscriptions,
|
|
605
|
+
// certificateAuthority: options.selfSignedCertificate ? options.selfSignedCertificate.data : undefined,
|
|
606
|
+
// clientCertificate: options.clientCertificate ? options.clientCertificate.data : undefined,
|
|
607
|
+
// clientKey: options.clientKey ? options.clientKey.data : undefined,
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
module.exports = {
|
|
612
|
+
init: function (settings) {
|
|
613
|
+
// deviceCloseTimeout = settings.deviceCloseTimeout || 15000;
|
|
614
|
+
},
|
|
615
|
+
create: function (data, logger, events) {
|
|
616
|
+
return new MQTTclient(data, logger, events);
|
|
617
|
+
}
|
|
618
|
+
}
|