Commit 1bc6b6dc authored by martin hou's avatar martin hou

feat: 为已配对的设备列表增加序号字段解析

parent b5c784ef
......@@ -57,6 +57,7 @@ export type BluetoothDevice = {
mac: string; // 设备MAC地址
rssi?: number; // 设备信号强度
cod?: number; // 设备类型编码
sequence?: number; // 设备序号
};
// 操作系统枚举
......
......@@ -431,7 +431,8 @@ export function Home() {
let jensen = getJensen();
if (jensen == null) return;
let devices = await jensen.getPairedDevices(5);
alert(JSON.stringify(devices));
// alert(JSON.stringify(devices));
Logger.info('jensen', 'bluetooth', 'Paired Devices: ' + JSON.stringify(devices));
}
return (
......@@ -447,9 +448,9 @@ export function Home() {
<button onClick={bluetoothScan}>Start Scan</button>
<button onClick={stopBluetoothScan}>Stop Scan</button>
<button onClick={getScanResults}>Scan Results</button>
<button onClick={getPairedDevices}>Paired Devices</button>
{
/*
<button onClick={getPairedDevices}>Paired Devices</button>
<button onClick={reconnectDevice}>Connect Device</button>
*/
}
......
......@@ -1534,9 +1534,11 @@ Jensen.registerHandler(BT_GET_PAIRED_DEV_LIST, (msg) => {
let m = (msg.body[k++] & 0xff).toString(16).toUpperCase();
mac.push(m.length == 1 ? '0' + m : m);
}
let seq = msg.body[k++] & 0xff;
devices.push({
name: decoder.decode(sname),
mac: mac.join('-')
mac: mac.join('-'),
sequence: seq
});
}
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