Commit d53d61f8 authored by martin hou's avatar martin hou

feat: 增加进入U盘模式的测试指令

parent 703c7560
......@@ -242,6 +242,9 @@ declare class Jensen {
// 恢复出厂设置,MTT阶段添加,不建议使用
factoryReset: (seconds?: number) => Promise<ReturnStruct['common']>;
// 进入MassStorage模式
enterMassStorageMode: (seconds?: number) => Promise<ReturnStruct['common']>;
// 恢复出厂设置,内部存储格式化,设置项恢复默认值,蓝牙配对信息清空等
restoreFactorySettings: (seconds?: number) => Promise<ReturnStruct['common']>;
......
......@@ -724,6 +724,13 @@ export function Home() {
Logger.info('jensen', 'live', 'Send Key: ' + JSON.stringify(rst));
}
const enterMassStorageMode = async () => {
let jensen = getJensen();
if (jensen == null) return;
let rst = await jensen.enterMassStorageMode(5);
Logger.info('jensen', 'live', 'Enter MassStorage Mode: ' + JSON.stringify(rst));
}
return (
<>
<div className="btn-container" style={{ display: 'flex', flexDirection: 'row', gap: '16px', padding: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
......@@ -760,6 +767,7 @@ export function Home() {
<button onClick={() => sendKey(0x01, 0x04)}>Mute (Click)</button>
<button onClick={() => sendKey(0x02, 0x03)}>Record (Long Click)</button>
<button onClick={() => sendKey(0x03, 0x05)}>Playback (Dbl Press)</button>
<button onClick={enterMassStorageMode}>MassStorage Mode</button>
<span style={{ marginLeft: '8px' }}>Interval(ms): </span>
<input
type="number"
......
......@@ -1344,6 +1344,10 @@ Jensen.prototype.sendScheduleInfo = function (infos) {
}
};
Jensen.prototype.enterMassStorageMode = async function (seconds) {
return this.send(new Command(0xf00f).body([0x01]), seconds);
};
Jensen.prototype.getRealtimeSettings = async function () {
return this.send(new Command(REALTIME_READ_SETTING));
};
......@@ -1688,7 +1692,7 @@ Jensen.registerHandler(READ_WEBUSB_TIMEOUT, (msg) => {
let timeout = ((msg.body[0] & 0xff) << 24) | ((msg.body[1] & 0xff) << 16) | ((msg.body[2] & 0xff) << 8) | (msg.body[3] & 0xff);
return { timeout: timeout };
});
Jensen.registerHandler(0xf00f, commonMessageParser);
Jensen.registerHandler(BT_SCAN, commonMessageParser);
Jensen.registerHandler(BT_REMOVE_PAIRED_DEV, commonMessageParser);
Jensen.registerHandler(BT_DEV_LIST, (msg, jensen) => {
......
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