diff options
| -rw-r--r-- | index.html | 8 | ||||
| -rw-r--r-- | main.mjs | 9 |
2 files changed, 15 insertions, 2 deletions
@@ -4,7 +4,13 @@ <script defer src="main.mjs"></script> </head> <body> - <h1>Setup your AIRMX device</h1> + <h1>Setup AIRMX Pro</h1> + <div> + <input type="text" id="ssid" placeholder="SSID" /> + </div> + <div> + <input type="password" id="password" placeholder="Password" /> + </div> <div> <button id="connect" type="button"> Connect @@ -140,6 +140,13 @@ async function delay(ms) { } async function connectToDevice() { + const ssid = document.getElementById('ssid') + const password = document.getElementById('password') + + if (ssid.value === '' || password.value === '') { + return + } + const device = await navigator.bluetooth.requestDevice({ filters: [{ name: DEVICE_NAME }], optionalServices: [MAIN_SERVICE_UUID] @@ -156,7 +163,7 @@ async function connectToDevice() { const dispatcher = new Dispatcher(writeChar) await dispatcher.dispatch(new HandshakeCommand()) - await dispatcher.dispatch(new ConfigureWifiCommand('<ssid>', '<password>')) + await dispatcher.dispatch(new ConfigureWifiCommand(ssid.value, password.value)) await dispatcher.dispatch(new RequestIdentityCommand()) } |
