|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <script> |
| 5 | + let update = () => {}; |
| 6 | + let vfoSetting = ""; |
| 7 | + let antennaSetting = ""; |
| 8 | + let optionSetting = ""; |
| 9 | + |
| 10 | + function connectOpenActionSocket( |
| 11 | + inPort, |
| 12 | + inPropertyInspectorUUID, |
| 13 | + inRegisterEvent, |
| 14 | + inInfo, |
| 15 | + inActionInfo, |
| 16 | + ) { |
| 17 | + const websocket = new WebSocket("ws://localhost:" + inPort); |
| 18 | + inActionInfo = JSON.parse(inActionInfo); |
| 19 | + websocket.onopen = () => { |
| 20 | + websocket.send( |
| 21 | + JSON.stringify({ |
| 22 | + event: inRegisterEvent, |
| 23 | + uuid: inPropertyInspectorUUID, |
| 24 | + }), |
| 25 | + ); |
| 26 | + }; |
| 27 | + |
| 28 | + vfoSetting = inActionInfo.payload.settings.vfo ?? ""; |
| 29 | + antennaSetting = inActionInfo.payload.settings.antenna ?? ""; |
| 30 | + optionSetting = inActionInfo.payload.settings.option ?? ""; |
| 31 | + |
| 32 | + websocket.onmessage = (event) => { |
| 33 | + const data = JSON.parse(event.data); |
| 34 | + if (data.event == "didReceiveSettings") { |
| 35 | + vfoSetting = data.payload.settings.vfo ?? ""; |
| 36 | + antennaSetting = data.payload.settings.antenna ?? ""; |
| 37 | + optionSetting = data.payload.settings.option ?? ""; |
| 38 | + } |
| 39 | + if (data.event == "sendToPropertyInspector") { |
| 40 | + // TODO: receive available vfos from the plugin |
| 41 | + } |
| 42 | + }; |
| 43 | + |
| 44 | + const vfoElement = document.getElementById("vfo"); |
| 45 | + vfoElement.value = inActionInfo.payload.settings.vfo ?? ""; |
| 46 | + |
| 47 | + const antennaElement = document.getElementById("antenna"); |
| 48 | + antennaElement.value = inActionInfo.payload.settings.antenna ?? ""; |
| 49 | + |
| 50 | + const optionElement = document.getElementById("option"); |
| 51 | + optionElement.value = inActionInfo.payload.settings.option ?? ""; |
| 52 | + |
| 53 | + update = () => { |
| 54 | + websocket.send( |
| 55 | + JSON.stringify({ |
| 56 | + event: "setSettings", |
| 57 | + context: inActionInfo.context, |
| 58 | + payload: { |
| 59 | + vfo: vfoElement.value || "", |
| 60 | + antenna: antennaElement.value || "", |
| 61 | + option: optionElement.value || "", |
| 62 | + }, |
| 63 | + }), |
| 64 | + ); |
| 65 | + }; |
| 66 | + } |
| 67 | + |
| 68 | + const connectElgatoStreamDeckSocket = connectOpenActionSocket; |
| 69 | + </script> |
| 70 | + |
| 71 | + <style> |
| 72 | + * { |
| 73 | + font-family: system-ui, sans-serif; |
| 74 | + font-size: 16px; |
| 75 | + color: oklch(92.2% 0 0); |
| 76 | + } |
| 77 | + body { |
| 78 | + margin: 16px; |
| 79 | + background-color: oklch(26.9% 0 0); |
| 80 | + } |
| 81 | + label { |
| 82 | + margin-right: 4px; |
| 83 | + } |
| 84 | + input { |
| 85 | + margin: 4px; |
| 86 | + padding: 4px; |
| 87 | + background-color: oklch(37.1% 0 0); |
| 88 | + border: 1px solid oklch(43.9% 0 0); |
| 89 | + border-radius: 8px; |
| 90 | + } |
| 91 | + </style> |
| 92 | + </head> |
| 93 | + |
| 94 | + <body> |
| 95 | + <div> |
| 96 | + <label for="vfo">VFO:</label> |
| 97 | + <!-- should be a combo box with all VFOs --> |
| 98 | + <input id="vfo" oninput="update()" type="text" /> |
| 99 | + <br /> |
| 100 | + <label for="antenna">Antenna:</label> |
| 101 | + <input id="antenna" oninput="update()" type="text" /> |
| 102 | + <br /> |
| 103 | + <label for="option">Option:</label> |
| 104 | + <input id="option" oninput="update()" type="text" /> |
| 105 | + </div> |
| 106 | + </body> |
| 107 | +</html> |
0 commit comments