From 4e54fd359f2920e015a59af2265688dc557376d5 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 10 Apr 2024 10:47:22 +0200 Subject: implement cctv commands --- ui/css/style.css | 5 +++++ ui/index.html | 46 +++++++++++++++++++++++----------------------- ui/js/api.js | 32 ++++++++++++++++++++------------ 3 files changed, 48 insertions(+), 35 deletions(-) diff --git a/ui/css/style.css b/ui/css/style.css index ca35786..a3c1f38 100644 --- a/ui/css/style.css +++ b/ui/css/style.css @@ -201,3 +201,8 @@ button:not([disabled]):active { background-color: #0004; } +.inputlabel { + display: flex; + gap: 8px; + align-items: stretch; +} diff --git a/ui/index.html b/ui/index.html index 088985e..a3f61ed 100644 --- a/ui/index.html +++ b/ui/index.html @@ -62,8 +62,8 @@
Verlichting
-
Felheid: ??%
+
@@ -77,31 +77,31 @@
- CCTV Presets -
- Huidige preset: ?? -
+ CCTV Controls
- - - - - - - - - + + + + + + + + +
- Controls: ?? -
-
- - - - - - +
+ + +
+
+ + +
+
+ + +
diff --git a/ui/js/api.js b/ui/js/api.js index 647cbd6..00349be 100644 --- a/ui/js/api.js +++ b/ui/js/api.js @@ -27,9 +27,6 @@ const api = { }, matrix: state => document.getElementById("matrixValue").value = state, photocell: on => setPolkaDot(document.getElementById("photocellValue"), on), - cctv: preset => { - document.getElementById("cctvPresetValue").innerText = preset; - }, carSpeed: speed => { for (let i = 0; i < 4; i++) document.getElementById(`zone${i+1}SpeedValue`).innerText = speed[i]; @@ -66,7 +63,12 @@ const api = { }, start: () => { document.getElementById("setupDialog").close(); - } + }, + cctvCtl: (pan, tilt, zoom) => { + document.getElementById("cctvPanInput").value = pan; + document.getElementById("cctvTiltInput").value = tilt; + document.getElementById("cctvZoomInput").value = zoom; + }, }, msg: { send: { @@ -97,20 +99,26 @@ const api = { send({ type: 'photocell', on }); api.update.photocell(on); }, - cctv: el => { - var preset = el.value; - send({ type: 'cctv', preset }); - api.update.cctv(preset); - }, sos: el => { var statusSOS = el.value == "true"; send({ type: 'sosBericht', statusSOS }); api.update.sos(statusSOS); }, - start: el => { + start: () => { send({ type: 'start' }); api.update.start(); - } + }, + cctvPreset: el => { + var preset = el.value; + send({ type: 'cctvPreset', preset }); + }, + cctvCtl: () => { + var pan = document.getElementById("cctvPanInput").value; + var tilt = document.getElementById("cctvTiltInput").value; + var zoom = document.getElementById("cctvZoomInput").value; + send({ type: 'cctvControl', pan, tilt, zoom }); + api.update.cctvCtl(pan, tilt, zoom); + }, }, handle: { helloWorld: msg => console.log(msg), @@ -119,10 +127,10 @@ const api = { lights: msg => api.update.lights(msg.value), matrix: msg => api.update.matrix(msg.state), photocell: msg => api.update.photocell(msg.on), - cctv: msg => api.update.cctv(msg.preset), autoPerZone: msg => api.update.carCount(msg.autos), sosBericht: msg => api.update.notifications(msg), lfvReady: msg => api.update.lfvReady(msg), + cctvControl: msg => api.update.cctvCtl(msg.pan, msg.tilt, msg.zoom), }, }, }; -- cgit v1.2.3