summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.html8
-rw-r--r--main.mjs9
2 files changed, 15 insertions, 2 deletions
diff --git a/index.html b/index.html
index e9b2647..eb9a563 100644
--- a/index.html
+++ b/index.html
@@ -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
diff --git a/main.mjs b/main.mjs
index 5f962c4..411f099 100644
--- a/main.mjs
+++ b/main.mjs
@@ -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())
}