feat: add user deactivation and vendor BLE protocol

这个提交包含在:
Guoguo
2026-05-11 21:14:41 +08:00
父节点 c95d47e0c1
当前提交 583fcb7e3d
修改 16 个文件,包含 698 行新增52 行删除
+16
查看文件
@@ -1,3 +1,7 @@
global.wx = global.wx || {
onBLEConnectionStateChange: function () {}
}
const ble = require('../services/ble')
function assert(condition, message) {
@@ -40,8 +44,20 @@ function testBindPayloadLength() {
assert(tokenBytes.length === 8, 'bind token must be 8 bytes')
}
function testVendorCommand33() {
const command = ble.buildVendorCommand33({
region_mask: 0x1F,
wavelength: ble.WAVELENGTH.R,
brightness: 200,
duration_ms: 600000
})
assert(command.length === 33, 'vendor command must be 33 bytes')
assert(command[32] === xor(command.slice(0, 32)), 'vendor command checksum mismatch')
}
testBuildFrameChecksum()
testParseStatusFrame()
testBindPayloadLength()
testVendorCommand33()
console.log('BLE frame tests passed')