diff options
| author | Li Zhineng <[email protected]> | 2025-06-10 22:43:23 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2025-06-10 22:43:23 +0800 |
| commit | c142ffd468ece097e0f9e7ef2d33d74e468589b7 (patch) | |
| tree | 25ea688788b4c70afd0c69f4c44ca2d7d9fb3d55 | |
| parent | 1c7de8b855072070a1ae932ec86f8f1ac52493da (diff) | |
| download | setup-c142ffd468ece097e0f9e7ef2d33d74e468589b7.tar.gz setup-c142ffd468ece097e0f9e7ef2d33d74e468589b7.zip | |
send request device identity command
| -rw-r--r-- | index.html | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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) { |
