Commit 86838102 authored by martin hou's avatar martin hou

feat: 增加对rssi/cod字段的解析

parent 79a69479
......@@ -55,6 +55,8 @@ export type BluetoothStatus = {
export type BluetoothDevice = {
name: string; // 设备名称
mac: string; // 设备MAC地址
rssi: number; // 设备信号强度
cod: number; // 设备类型编码
};
// 操作系统枚举
......
......@@ -1596,9 +1596,13 @@ Jensen.registerHandler(BT_DEV_LIST, (msg) => {
let m = (msg.body[k++] & 0xff).toString(16).toUpperCase();
mac.push(m.length == 1 ? '0' + m : m);
}
let rssi = msg.body[k++] & 0xff;
let cod = ((msg.body[k++] & 0xff) << 16) | ((msg.body[k++] & 0xff) << 8) | (msg.body[k++] & 0xff);
devices.push({
name: decoder.decode(sname),
mac: mac.join('-')
mac: mac.join('-'),
rssi: rssi,
cod: cod
});
}
return devices;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment