Commit d16340ea authored by martin hou's avatar martin hou

feat: 增加错误日志输出/增加对reconnect的兼容处理

parent 314ed70e
......@@ -2,3 +2,8 @@
margin: 0;
padding: 0;
}
button {
height: 50px;
font-size: 14px;
padding: 0px 30px;
}
\ No newline at end of file
......@@ -10,7 +10,6 @@ export function Home() {
const [devices, setDevices] = useState<Jensen.BluetoothDevice[]>([]);
const [greeting, setGreeting] = useState<string|null>(null);
/*
useEffect(() => {
jensen.connect();
jensen.onconnect = () => {
......@@ -20,7 +19,6 @@ export function Home() {
});
};
}, []);
*/
const getFilePart = () => {
const file = files[4];
......@@ -192,7 +190,6 @@ export function Home() {
usb.onconnect = (evt: any) => {
console.log(evt);
}
/*
usb.getDevices().then(async (devices: any[]) => {
for (let i = 0; i < devices.length; i++)
{
......@@ -204,24 +201,31 @@ export function Home() {
console.log(rst);
}
});
*/
}
const test = async () => {
await jensen.reconnect();
let rst = await jensen.getDeviceInfo();
if (rst) alert(rst.sn + ' reconnected...');
else alert('what the fuck????');
}
return (
<>
<div style={{ display: 'flex', flexDirection: 'row', gap: '16px', padding: '16px', alignItems: 'center' }}>
<button style={{ width: '200px', height: '50px' }} onClick={connectx}>连接</button>
<button style={{ width: '200px', height: '50px' }} onClick={getFilePart}>获取文件</button>
<button style={{ width: '200px', height: '50px' }} onClick={writeSN}>SN写号</button>
<button style={{ width: '200px', height: '50px' }} onClick={getTime}>获取时间</button>
<button style={{ width: '200px', height: '50px' }} onClick={listFiles}>文件列表</button>
<button style={{ width: '200px', height: '50px' }} onClick={transferFile}>传输文件</button>
<button style={{ width: '200px', height: '50px' }} onClick={getBluetoothStatus}>蓝牙连接状态</button>
<button style={{ width : '200px', height : '50px' }} onClick={bluetoothScan}>蓝牙扫描</button>
<button style={{ width : '200px', height : '50px' }} onClick={disconnectBTDevice}>蓝牙断开</button>
<button style={{ width : '200px', height : '50px' }} onClick={readFilePartial}>Read File Partial</button>
<button style={{ width : '200px', height : '50px' }} onClick={updateDeviceTone}>更新提示音</button>
<button style={{ width : '200px', height : '50px' }} onClick={updateUAC}>更新UAC</button>
<div style={{ display: 'flex', flexDirection: 'row', gap: '16px', padding: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<button onClick={connectx}>连接</button>
<button onClick={getFilePart}>获取文件</button>
<button onClick={writeSN}>SN写号</button>
<button onClick={getTime}>获取时间</button>
<button onClick={listFiles}>文件列表</button>
<button onClick={transferFile}>传输文件</button>
<button onClick={getBluetoothStatus}>蓝牙连接状态</button>
<button onClick={bluetoothScan}>蓝牙扫描</button>
<button onClick={disconnectBTDevice}>蓝牙断开</button>
<button onClick={readFilePartial}>Read File Partial</button>
<button onClick={updateDeviceTone}>更新提示音</button>
<button onClick={updateUAC}>更新UAC</button>
<button onClick={test}>测试重连</button>
</div>
<div id="files" style={{ padding: '0px 0px 0px 30px', marginBottom: '20px' }}>
<h3>Files: </h3>
......
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