feat: add user deactivation and vendor BLE protocol
这个提交包含在:
@@ -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')
|
||||
|
||||
在新工单中引用
屏蔽一个用户