diff --git a/App/JS/Resources/settings.json b/App/JS/Resources/settings.json index 25cac79..d58ccb7 100644 --- a/App/JS/Resources/settings.json +++ b/App/JS/Resources/settings.json @@ -9,8 +9,8 @@ "port": "5000" }, "Camera": { - "Width": 1280, - "Height": 720, + "Width": 960, + "Height": 540, "Time": 0, "Extra Commands": "-o - -hf", "Network": { @@ -33,8 +33,8 @@ "port": "5000" }, "Camera": { - "Width": 1280, - "Height": 720, + "Width": 960, + "Height": 540, "Time": 0, "Extra Commands": "-o - -hf", "Network": { diff --git a/App/JS/camera.js b/App/JS/camera.js index 2850163..40abe59 100644 --- a/App/JS/camera.js +++ b/App/JS/camera.js @@ -1,24 +1,27 @@ -var settings = require("./JS/Resources/settings.json") -var width = settings.User.Camera["Width"] -var height = settings.User.Camera["Height"] -var time = settings.User.Camera["Time"] -var extraCommands = settings.User.Camera["Extra Commands"] -var port = settings.User.Camera.Network["Port"] -var ip = settings.User.Camera.Network["IP"] -var command = `raspivid -w ${width} -h ${height} -t ${time} ${extraCommands} | nc ${ip} ${port}` +var settings = require("./JS/Resources/settings.json"); +var width = settings.User.Camera["Width"]; +var height = settings.User.Camera["Height"]; +var time = settings.User.Camera["Time"]; +var extraCommands = settings.User.Camera["Extra Commands"]; +var port = settings.User.Camera.Network["Port"]; +var ip = settings.User.Camera.Network["IP"]; +var command = `raspivid -w ${width} -h ${height} -t ${time} ${extraCommands} | nc ${ip} ${port}`; //Put in default text function loaded() { - console.log("Loaded!") - document.forms[0].elements[0].value = command - document.forms[0].elements[2].placeholder = height - document.forms[0].elements[3].placeholder = width - document.forms[0].elements[4].placeholder = time - document.forms[0].elements[5].placeholder = port - document.getElementById('settingsIP').innerHTMl = ip - console.log(document.getElementById('settingsIP')) - console.log(document.forms) + console.log("Loaded!"); + document.forms[0].elements[1].value = height; + document.forms[0].elements[2].value = width; + document.forms[0].elements[3].value = time; + document.forms[0].elements[4].value = port; + document.getElementById('settingsIP').innerHTMl = ip; } + function startCamera() { - console.log("placeholder") + height = document.forms[0].elements[1].value + width = document.forms[0].elements[2].value + time = document.forms[0].elements[3].value + port = document.forms[0].elements[4].value + command = `raspivid -w ${width} -h ${height} -t ${time} ${extraCommands} | nc ${ip} ${port}`; + execute(`sshpass -p \"raspberry\" ssh pi@192.168.100.1 '${command}'`) } diff --git a/App/JS/main.js b/App/JS/main.js index f171892..2f01789 100644 --- a/App/JS/main.js +++ b/App/JS/main.js @@ -1,4 +1,5 @@ const execute = require('./JS/executeShellCommand.js').execute; + function controlServerCode(terminate) { if (terminate == true) { console.log(terminate) diff --git a/App/camera.html b/App/camera.html index 339f03f..691c241 100644 --- a/App/camera.html +++ b/App/camera.html @@ -10,7 +10,6 @@