Commit 660d5803 authored by Skye Yu's avatar Skye Yu

添åŠå½ 添加录音测试api

parent 5a815eb6
Pipeline #1882 canceled with stages
...@@ -18,6 +18,10 @@ const FORMAT_CARD = 0x11; ...@@ -18,6 +18,10 @@ const FORMAT_CARD = 0x11;
const GET_RECORDING_FILE = 0x12; const GET_RECORDING_FILE = 0x12;
const FACTORY_RESET = 0xf00b; const FACTORY_RESET = 0xf00b;
const RECORD_TEST_START = 0xf008; // 录音测试开始
const RECORD_TEST_END = 0xf009; // 录音测试结束
const COMMAND_NAMES = [ const COMMAND_NAMES = [
'invalid-0', 'invalid-0',
'get-device-info', 'get-device-info',
...@@ -782,6 +786,16 @@ Jensen.prototype.getRecordingFile = function (seconds) { ...@@ -782,6 +786,16 @@ Jensen.prototype.getRecordingFile = function (seconds) {
return this.send(new Command(GET_RECORDING_FILE), seconds); return this.send(new Command(GET_RECORDING_FILE), seconds);
}; };
let type = 'x';
Jensen.prototype.recordTestStart = async function (seconds) {
type = parseInt(prompt('请输入测试类型编号,1表示频响,2表示AEC,6表示耳机测试', '6'));
if (isNaN(type)) return;
return this.send(new Command(0xf008).body([type]));
};
Jensen.prototype.recordTestEnd = async function (seconds) {
return this.send(new Command(0xf009).body([type]));
};
const commonMessageParser = (msg) => { const commonMessageParser = (msg) => {
return { result: msg.body[0] == 0x00 ? 'success' : 'failed' }; return { result: msg.body[0] == 0x00 ? 'success' : 'failed' };
}; };
...@@ -915,5 +929,7 @@ Jensen.registerHandler(GET_RECORDING_FILE, (msg) => { ...@@ -915,5 +929,7 @@ Jensen.registerHandler(GET_RECORDING_FILE, (msg) => {
}; };
} }
}); });
Jensen.registerHandler(RECORD_TEST_START, commonMessageParser);
Jensen.registerHandler(RECORD_TEST_END, commonMessageParser);
export { Jensen }; export { 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