mebeats
mebeats copied to clipboard
支持小米手环6吗?
我测试了小米手环6,Auth验证收到的返回码是100307
我用的是js测试
async authenticate() {
await this.startNotifications(this.chars.auth, async (e) => {
const value = e.target.value.buffer;
const cmd = buf2hex(value.slice(0, 3));
if (cmd === "100101") {
console.log("Set new key OK");
} else if (cmd === "100201") {
const number = value.slice(3);
console.log("Received authentication challenge: ", buf2hex(value.slice(3)));
const key = aesjs.utils.hex.toBytes(this.authKey);
const aesCbc = new aesjs.ModeOfOperation.cbc(key);
const out = aesCbc.encrypt(new Uint8Array(number));
const cmd2 = concatBuffers(new Uint8Array([3, 0]), out);
console.log("Sending authentication response");
await this.chars.auth.writeValue(cmd2);
} else if (cmd === "100301") {
await this.onAuthenticated();
} else if (cmd === "100308") {
console.log("Received authentication failure");
} else {
throw new Error(Unknown callback, cmd='${cmd}'
);
}
});
await this.chars.auth.writeValue(Uint8Array.from([2, 0]));
}
我是使用小米手环 6 NFC 版本测试的。
参考这个项目的返回码 https://github.com/satcar77/miband4/blob/master/miband.py#L29-L43 ,好像没有提到 100307,我也不太清楚这个返回码是什么。
@foenix66 我和你一样使用了这个思路进行测试,收到的验证码也是100307,之后我怀疑是固件问题,将小米手环降级为1.0.1.36后在进行测试通过了验证。。。。