summaryrefslogtreecommitdiffhomepage
path: root/index.html
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-06-10 22:43:23 +0800
committerLi Zhineng <[email protected]>2025-06-10 22:43:23 +0800
commitc142ffd468ece097e0f9e7ef2d33d74e468589b7 (patch)
tree25ea688788b4c70afd0c69f4c44ca2d7d9fb3d55 /index.html
parent1c7de8b855072070a1ae932ec86f8f1ac52493da (diff)
downloadsetup-c142ffd468ece097e0f9e7ef2d33d74e468589b7.tar.gz
setup-c142ffd468ece097e0f9e7ef2d33d74e468589b7.zip
send request device identity command
Diffstat (limited to 'index.html')
-rw-r--r--index.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/index.html b/index.html
index 7090f31..13e4557 100644
--- a/index.html
+++ b/index.html
@@ -48,6 +48,9 @@
const password = '<yourpassword>'
await sendWifiCredentialsCommand(writeChar, ssid, password)
await delay(500)
+
+ // 4. Retrieve device ID
+ await sendRequestDeviceIdentityCommand(writeChar)
}
function handleDeviceResponse(event) {
@@ -127,6 +130,18 @@
await sendRawData(writeChar, packet2)
}
+ async function sendRequestDeviceIdentityCommand(writeChar) {
+ const packet = new Uint8Array([
+ // Header (4 bytes)
+ 0x04, // Sequence Number: 4
+ 0x11, // Packet Info: (Packet 1 of 1)
+ 0x00, // Command ID: 22, Enc-Flag: 0 (Big Endian)
+ 0x16
+ ])
+
+ await sendRawData(writeChar, packet)
+ }
+
async function sendRawData(characteristic, data) {
const chunkSize = 20
for (let i = 0; i < data.length; i += chunkSize) {