diff options
| author | Li Zhineng <[email protected]> | 2025-06-12 22:26:20 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2025-06-12 22:26:20 +0800 |
| commit | 77d86e8b70e7dc1a11132f17eac9cca2795a1f89 (patch) | |
| tree | cab0fd54411556ab66ddaa710d48215bbd542596 | |
| parent | 29c8378dca07b3731b150362a36f71a7e5c35337 (diff) | |
| download | setup-77d86e8b70e7dc1a11132f17eac9cca2795a1f89.tar.gz setup-77d86e8b70e7dc1a11132f17eac9cca2795a1f89.zip | |
wifi credentials
| -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()) } |
