Commit 77655e7f authored by martin hou's avatar martin hou

Merge branch 'v20250816' into device-mgr

parents 7befde52 afe92752
......@@ -226,7 +226,7 @@ declare class Jensen {
setNotification: (state: boolean, time?: number) => Promise<ReturnStruct['common']>;
// 获取录音中的文件信息,当它从null -> non-null -> null转变时就表示已经有一个新的录音产生了
getRecordingFile: () => Promise<{ recording: null | string; createTime: string; createDate: string }>;
getRecordingFile: (time?: number) => Promise<{ recording: null | string; createTime: string; createDate: string }>;
// 获取内部存储卡信息
// used:已使用,capacity:总容量(单位为M),status:900表示正常,其它表示异常
......
......@@ -87,6 +87,8 @@ function Jensen(log, conn) {
let totalBytes = 0;
let handlers = {};
let pid = 0;
// 表示通道通信是否正常,只要能够接收一次应答消息即可
let channelHealthy = false;
let self = this;
this.data = {};
......@@ -357,6 +359,7 @@ function Jensen(log, conn) {
const trigger = function (resp, msgid) {
if (current == null) return;
channelHealthy = true;
Logger.debug('jensen', 'trigger', pid + ':trigger - ' + current + ' <---> cmd-' + (msgid || 'err'));
if (current.substring(0, current.lastIndexOf('-')) != 'cmd-' + msgid) {
// current = null;
......@@ -405,7 +408,7 @@ function Jensen(log, conn) {
receive(r);
}).catch((e) => {
console.log('tryReceive error', e)
self.onerror?.(e);
if (!channelHealthy) self.onerror?.(e);
});
};
......@@ -764,11 +767,18 @@ Jensen.prototype.listFiles = async function () {
}
let ftime = fname.join('');
let duration = 0;
if (ftime.match(/^\d{14}REC\d+\.wav$/gi)) {
ftime = ftime.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})REC.*$/gi, '$1-$2-$3 $4:$5:$6');
let mode = 'room';
if (ftime.match(/^\d{14}(REC|WHSP|ROOM|CALL|WIP)\d+\.wav$/gi)) {
mode = ftime.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(REC|WHIP|ROOM|CALL|WIP).*$/gi, '$7').toLowerCase();
if (mode == 'REC') mode = 'room';
else if (mode == 'WHSP' || mode == 'WIP') mode = 'whisper';
else if (mode == 'ROOM') mode = 'room';
else if (mode == 'CALL') mode = 'call';
ftime = ftime.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(REC|WHIP|ROOM|CALL|WIP).*$/gi, '$1-$2-$3 $4:$5:$6');
ftime = new Date(ftime);
duration = flen / 32;
} else if (ftime.match(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.(hda|wav)$/gi)) {
}
else if (ftime.match(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.(hda|wav)$/gi)) {
// 2024Mar19-110932-Rec00.hda
ftime = ftime.replace(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.(hda|wav)$/gi, '20$2 $3 $4 $5:$6:$7');
ftime = new Date(ftime);
......@@ -794,6 +804,10 @@ Jensen.prototype.listFiles = async function () {
{
duration = flen / 12;
}
else if (ver == 6)
{
duration = flen / 16;
}
let createDate = '';
let createTime = '';
if (ftime) {
......@@ -808,6 +822,7 @@ Jensen.prototype.listFiles = async function () {
duration: duration,
version: ver,
length: flen,
mode: mode,
signature: sign.join('')
});
}
......@@ -1116,7 +1131,7 @@ Jensen.prototype.formatCard = function (seconds) {
Jensen.prototype.getRecordingFile = function (seconds) {
if ((this.model == 'hidock-h1' || this.model == 'hidock-h1e') && this.versionNumber < 327733) return null;
return this.send(new Command(GET_RECORDING_FILE), seconds);
return this.send(new Command(GET_RECORDING_FILE), seconds || 0.5);
};
Jensen.prototype.recordTestStart = async function (type, seconds) {
......
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