Commit 32ad41f9 authored by martin hou's avatar martin hou

feat: 调整测试页面

parent 5d3ca68c
......@@ -2,8 +2,80 @@
margin: 0;
padding: 0;
}
html, body { width: 100%; height: 100%; padding: 0px; margin: 0px; }
button {
height: 50px;
font-size: 14px;
padding: 0px 30px;
border-radius: 5px;
outline: none;
border: 1px solid #ccc;
}
#root
{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
button:hover
{
cursor: pointer;
border: solid 1px #999;
}
.btn-container {
display: flex;
flex-direction: row;
gap: 16px;
padding: 16px;
align-items: center;
flex-wrap: wrap;
/* 移除高度限制,保持自适应 */
}
/* 让#root成为flex容器,纵向排列,撑满body */
#root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
/* result-container占据剩余空间 */
.result-container {
display: flex;
flex-direction: row;
flex: 1 1 0%; /* 占据剩余空间 */
width: 100%;
min-height: 0; /* 防止溢出 */
padding: 20px;
box-sizing: border-box;
}
.list-container, .log-container {
height: 100%;
}
.list-container {
width: 50%;
overflow: scroll;
}
.log-container {
width: 50%;
display: flex;
flex-direction: column;
}
.log-container textarea {
width: 100%;
height: 100%;
min-height: 0;
border: solid 1px #ccc;
border-radius: 5px;
outline: none;
padding: 5px;
box-sizing: border-box;
}
\ No newline at end of file
......@@ -124,17 +124,6 @@ export function Home() {
setDevices(devices);
}
const writeBluetoothDeviceList = async () => {
let jensen = getJensen();
if (jensen == null) return;
let macs = prompt('Please Input the MACs (Separated by ","):', '00:00:00:00:00:00');
if (macs === undefined || macs === null) return;
let macsList = macs.split(',').map((item) => item.trim());
let rst = await jensen.writeBluetoothDeviceList(macsList, 5);
if (rst == null || rst.result != 'success') return alert('write bluetooth device list failed.');
setGreeting('write bluetooth device list success');
}
const connect = async () => {
// await jensen.connect();
// alert(jensen.getModel() + ' connected')
......@@ -439,6 +428,13 @@ export function Home() {
Logger.info('jensen', 'settings', 'Get Settings: ' + JSON.stringify(rst));
}
const getPairedDevices = async () => {
let jensen = getJensen();
if (jensen == null) return;
let devices = await jensen.getPairedDevices(5);
alert(JSON.stringify(devices));
}
return (
<>
<div className="btn-container" style={{ display: 'flex', flexDirection: 'row', gap: '16px', padding: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
......@@ -452,7 +448,12 @@ export function Home() {
<button onClick={bluetoothScan}>Start Scan</button>
<button onClick={stopBluetoothScan}>Stop Scan</button>
<button onClick={getScanResults}>Scan Results</button>
<button onClick={writeBluetoothDeviceList}>Write MACs</button>
{
/*
<button onClick={getPairedDevices}>Paired Devices</button>
<button onClick={reconnectDevice}>Connect Device</button>
*/
}
<button onClick={disconnectBTDevice}>Disconnect</button>
<button onClick={updateDeviceTone}>Update Tone</button>
<button onClick={updateUAC}>Update UAC</button>
......
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