diff --git a/src/server/nodered/data/current_image.ppm b/src/server/nodered/data/current_image.ppm index 7a5d7fe2accad0cf7e488800d0bbc7afcd4fa427..70a9a722b4008a10bb16b70f7e596c5fc55fbd7e 100644 Binary files a/src/server/nodered/data/current_image.ppm and b/src/server/nodered/data/current_image.ppm differ diff --git a/src/server/nodered/data/flows.json b/src/server/nodered/data/flows.json index 63f0dd429b4b108240cb32598df2b9bf33624d94..227d1e8894338b938bd76781f5cfd67d7eb50542 100644 --- a/src/server/nodered/data/flows.json +++ b/src/server/nodered/data/flows.json @@ -102,27 +102,6 @@ "w": 1572, "h": 242 }, - { - "id": "b37cc1f0a54b395f", - "type": "group", - "z": "3bceb6b167ec8f8a", - "name": "Image choice", - "style": { - "label": true, - "label-position": "n", - "color": "#000000" - }, - "nodes": [ - "c5268070.c55a3", - "5e18b80e617a3db8", - "c084ef02cb008e01", - "961a4eb72567178d" - ], - "x": 1134, - "y": 579, - "w": 592, - "h": 162 - }, { "id": "3f31d3a22e2ed424", "type": "group", @@ -148,6 +127,34 @@ "w": 832, "h": 202 }, + { + "id": "a7b2673f15fef9c2", + "type": "group", + "z": "3bceb6b167ec8f8a", + "name": "List the image files", + "style": { + "label": true, + "label-position": "n", + "color": "#000000", + "fill": "#d1d1d1", + "fill-opacity": "0.41" + }, + "nodes": [ + "529312a0e6ddba15", + "1da3f67390b4a1cf", + "22575f2a0e9ee60a", + "5fd55e44d1850fcd", + "969f542bde63a30f", + "62153201919f3eae", + "a27cb289d3bcf301", + "abfac8e27add49fb", + "36396f39b06a7104" + ], + "x": 274, + "y": 1019, + "w": 1112, + "h": 202 + }, { "id": "7c97b0098dfaf791", "type": "mqtt-broker", @@ -288,7 +295,7 @@ "tab": "d2a2041e4b1000cb", "order": 2, "disp": true, - "width": "10", + "width": "15", "collapse": false }, { @@ -298,9 +305,309 @@ "tab": "d2a2041e4b1000cb", "order": 1, "disp": true, - "width": "10", + "width": "15", "collapse": false }, + { + "id": "e6c647287cfa7b9b", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 1, + "width": 15, + "height": 1 + }, + { + "id": "bd0f5a853943c098", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 2, + "width": 3, + "height": 1 + }, + { + "id": "14ebcb4779b484c1", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 4, + "width": 3, + "height": 1 + }, + { + "id": "858fe577b2ea4dee", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 5, + "width": 3, + "height": 1 + }, + { + "id": "691544daa09ba33f", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 6, + "width": 3, + "height": 1 + }, + { + "id": "3ebe9555313657f5", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 7, + "width": 15, + "height": 1 + }, + { + "id": "bb2a63e4e3683519", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 8, + "width": 15, + "height": 1 + }, + { + "id": "bffe66e0dd126c1a", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 9, + "width": 3, + "height": 1 + }, + { + "id": "5ff83fea1564b6b5", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 11, + "width": 3, + "height": 1 + }, + { + "id": "e05ad9af5a581938", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 12, + "width": 3, + "height": 1 + }, + { + "id": "3a90542bd0f71f37", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 13, + "width": 3, + "height": 1 + }, + { + "id": "320ca6c8e42aa794", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 14, + "width": 15, + "height": 1 + }, + { + "id": "4fcfba2dd9fdec0c", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 15, + "width": 15, + "height": 1 + }, + { + "id": "1ed2ab15fc067dda", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 16, + "width": 3, + "height": 1 + }, + { + "id": "790988646562c728", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "c33a1024a72aa169", + "order": 18, + "width": 3, + "height": 1 + }, + { + "id": "a01ce6ff416f2fac", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 1, + "width": 15, + "height": 1 + }, + { + "id": "d68265c668bf81e9", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 2, + "width": 4, + "height": 1 + }, + { + "id": "dde8df42f379768b", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 5, + "width": 3, + "height": 1 + }, + { + "id": "ee0291c017225fcd", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 6, + "width": 4, + "height": 1 + }, + { + "id": "4b7a3bf226bf54a5", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 7, + "width": 3, + "height": 1 + }, + { + "id": "2c2a26632a4b3b99", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 8, + "width": 15, + "height": 1 + }, + { + "id": "0119142cf3a208c4", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 9, + "width": 15, + "height": 1 + }, + { + "id": "429d8dd25b031e77", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 10, + "width": 4, + "height": 1 + }, + { + "id": "0af80ef0b6705716", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 13, + "width": 3, + "height": 1 + }, + { + "id": "b4773c0e1db54bb6", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 14, + "width": 4, + "height": 1 + }, + { + "id": "37874da812ed94bf", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 15, + "width": 3, + "height": 1 + }, + { + "id": "47ddf92b21efdc47", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 16, + "width": 15, + "height": 1 + }, + { + "id": "39b55f8bca4b9867", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 17, + "width": 15, + "height": 1 + }, + { + "id": "0a80e0c0a27a92c9", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 18, + "width": 4, + "height": 1 + }, + { + "id": "5c5474246bd0d777", + "type": "ui_spacer", + "z": "3bceb6b167ec8f8a", + "name": "spacer", + "group": "e342ae49e88427ae", + "order": 20, + "width": 3, + "height": 1 + }, { "id": "6733248e98f29d82", "type": "mqtt out", @@ -450,9 +757,9 @@ "g": "cef277eaea93cf97", "name": "Send image cluster 1", "group": "e342ae49e88427ae", - "order": 1, - "width": 10, - "height": 1, + "order": 3, + "width": 4, + "height": 2, "passthru": false, "label": "Send image to cluster 1", "tooltip": "", @@ -471,49 +778,6 @@ ] ] }, - { - "id": "c5268070.c55a3", - "type": "ui_template", - "z": "3bceb6b167ec8f8a", - "g": "b37cc1f0a54b395f", - "group": "e342ae49e88427ae", - "name": "Upload Btn", - "order": 2, - "width": "10", - "height": "1", - "format": "\n<body>\n<button class=\"md-raised md-button md-ink-ripple\" onclick=\"importData()\">Upload</button> \n\n<script>\nlet restoreScope = scope;\n\nfunction importData() {\n let input = document.createElement('input');\n input.type = 'file';\n input.id = 'restoreBtn';\n input.onchange = _ => {\n let file = input.files[0];\n\n // you can use this method to get file and perform respective operations\n let fReader = new FileReader();\n fReader.readAsText(input.files[0]);\n fReader.onloadend = function(event)\n {\n let filename = file.name;\n let payload = event.target.result;\n restoreScope.send({payload: payload, filename: filename});}\n };\n input.click();\n}\n</script>\n</body>\n", - "storeOutMessages": true, - "fwdInMessages": true, - "resendOnRefresh": false, - "templateScope": "local", - "x": 1230, - "y": 660, - "wires": [ - [ - "5e18b80e617a3db8", - "c084ef02cb008e01", - "961a4eb72567178d" - ] - ] - }, - { - "id": "5e18b80e617a3db8", - "type": "debug", - "z": "3bceb6b167ec8f8a", - "g": "b37cc1f0a54b395f", - "name": "Uploaded Image filename", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "filename", - "targetType": "msg", - "statusVal": "", - "statusType": "auto", - "x": 1480, - "y": 700, - "wires": [] - }, { "id": "36f36de07403b7d6", "type": "ui_text_input", @@ -523,9 +787,9 @@ "label": "Message", "tooltip": "", "group": "c33a1024a72aa169", - "order": 1, - "width": 10, - "height": 3, + "order": 3, + "width": 9, + "height": 2, "passthru": true, "mode": "text", "delay": "0", @@ -546,8 +810,8 @@ "g": "ab311349d4b5cc9f", "name": "", "group": "c33a1024a72aa169", - "order": 2, - "width": 10, + "order": 17, + "width": 9, "height": 1, "passthru": false, "label": "Send ", @@ -650,9 +914,9 @@ "label": "Topic", "tooltip": "", "group": "c33a1024a72aa169", - "order": 1, - "width": 10, - "height": 3, + "order": 10, + "width": 9, + "height": 2, "passthru": true, "mode": "text", "delay": "0", @@ -869,9 +1133,9 @@ "z": "3bceb6b167ec8f8a", "g": "3f31d3a22e2ed424", "group": "e342ae49e88427ae", - "order": 3, - "width": 0, - "height": 0, + "order": 11, + "width": 4, + "height": 2, "name": "SIze cluster 2", "label": "Size cluster 2 : ", "format": "{{msg.payload}}", @@ -886,9 +1150,9 @@ "z": "3bceb6b167ec8f8a", "g": "3f31d3a22e2ed424", "group": "e342ae49e88427ae", - "order": 3, - "width": 0, - "height": 0, + "order": 12, + "width": 4, + "height": 2, "name": "Size cluster 1", "label": "Size cluster 1 : ", "format": "{{msg.payload}}", @@ -897,23 +1161,6 @@ "y": 620, "wires": [] }, - { - "id": "c084ef02cb008e01", - "type": "ui_text", - "z": "3bceb6b167ec8f8a", - "g": "b37cc1f0a54b395f", - "group": "e342ae49e88427ae", - "order": 3, - "width": 0, - "height": 0, - "name": "Loaded image", - "label": "Loaded image : ", - "format": "{{msg.filename}}", - "layout": "row-center", - "x": 1440, - "y": 620, - "wires": [] - }, { "id": "cc59fd7b9c9b3506", "type": "change", @@ -951,33 +1198,6 @@ ] ] }, - { - "id": "961a4eb72567178d", - "type": "change", - "z": "3bceb6b167ec8f8a", - "g": "b37cc1f0a54b395f", - "name": "save msg.filename into flow.image_filename", - "rules": [ - { - "t": "set", - "p": "image_filename", - "pt": "flow", - "to": "filename", - "tot": "msg", - "dc": true - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1530, - "y": 660, - "wires": [ - [] - ] - }, { "id": "c8a3cea728dcb733", "type": "function", @@ -1132,9 +1352,9 @@ "g": "33e927adfa7339c6", "name": "Send image cluster 2", "group": "e342ae49e88427ae", - "order": 1, - "width": 10, - "height": 1, + "order": 4, + "width": 4, + "height": 2, "passthru": false, "label": "Send image to cluster 2", "tooltip": "", @@ -1377,5 +1597,206 @@ "x": 1720, "y": 520, "wires": [] + }, + { + "id": "529312a0e6ddba15", + "type": "exec", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "command": "ls", + "addpay": "", + "append": "/data/", + "useSpawn": "false", + "timer": "3", + "winHide": false, + "oldrc": false, + "name": "List files", + "x": 540, + "y": 1140, + "wires": [ + [ + "1da3f67390b4a1cf", + "62153201919f3eae" + ], + [ + "22575f2a0e9ee60a" + ], + [ + "5fd55e44d1850fcd" + ] + ] + }, + { + "id": "1da3f67390b4a1cf", + "type": "debug", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "stdout", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 1060, + "wires": [] + }, + { + "id": "22575f2a0e9ee60a", + "type": "debug", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "stderr", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 1140, + "wires": [] + }, + { + "id": "5fd55e44d1850fcd", + "type": "debug", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "return", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 1180, + "wires": [] + }, + { + "id": "969f542bde63a30f", + "type": "inject", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "", + "props": [], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": "0", + "topic": "", + "x": 370, + "y": 1140, + "wires": [ + [ + "529312a0e6ddba15" + ] + ] + }, + { + "id": "62153201919f3eae", + "type": "function", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "function 1", + "func": "function filter_filenames(filenames) \n{\n const fileArray = filenames.split('\\n');\n const filteredFiles = fileArray.filter(filename => {\n const extension = filename.split('.').pop().toLowerCase();\n return extension === 'png' || extension === 'ppm' || extension === 'jpg';\n });\n return filteredFiles;\n}\n\nlet names = msg.payload;\nmsg.options = filter_filenames(names);\nreturn msg;\n\n\n\n// Example usage", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 720, + "y": 1100, + "wires": [ + [ + "a27cb289d3bcf301", + "abfac8e27add49fb" + ] + ] + }, + { + "id": "a27cb289d3bcf301", + "type": "debug", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "Images names", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 920, + "y": 1060, + "wires": [] + }, + { + "id": "abfac8e27add49fb", + "type": "ui_dropdown", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "", + "label": "", + "tooltip": "", + "place": "Select option", + "group": "e342ae49e88427ae", + "order": 19, + "width": 8, + "height": 1, + "passthru": true, + "multiple": false, + "options": [ + { + "label": "", + "value": "", + "type": "str" + } + ], + "payload": "", + "topic": "topic", + "topicType": "msg", + "x": 900, + "y": 1100, + "wires": [ + [ + "36396f39b06a7104" + ] + ] + }, + { + "id": "36396f39b06a7104", + "type": "change", + "z": "3bceb6b167ec8f8a", + "g": "a7b2673f15fef9c2", + "name": "save msg.filename into flow.image_filename", + "rules": [ + { + "t": "set", + "p": "image_filename", + "pt": "flow", + "to": "payload", + "tot": "msg", + "dc": true + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1190, + "y": 1100, + "wires": [ + [] + ] } ] \ No newline at end of file