Commit 2e5fb0a4 authored by martin hou's avatar martin hou

fix: 忙时取消对电池电量查询和录音中文件的查询,避免通道堵塞

parent 3645f4cf
...@@ -383,6 +383,10 @@ function Jensen(log, conn) { ...@@ -383,6 +383,10 @@ function Jensen(log, conn) {
console.log('device', device); console.log('device', device);
}; };
this.busy = function() {
return Boolean(current);
}
const tryReceive = function () { const tryReceive = function () {
if (device) if (device)
// console.log('trace', device); // console.log('trace', device);
...@@ -1104,6 +1108,11 @@ Jensen.prototype.formatCard = function (seconds) { ...@@ -1104,6 +1108,11 @@ Jensen.prototype.formatCard = function (seconds) {
Jensen.prototype.getRecordingFile = function (seconds) { Jensen.prototype.getRecordingFile = function (seconds) {
if ((this.model == 'hidock-h1' || this.model == 'hidock-h1e') && this.versionNumber < 327733) return null; if ((this.model == 'hidock-h1' || this.model == 'hidock-h1e') && this.versionNumber < 327733) return null;
if (this.busy())
{
Logger.debug('jensen', 'dispatcher', 'cancel recording file query...');
return null;
}
return this.send(new Command(GET_RECORDING_FILE), seconds); return this.send(new Command(GET_RECORDING_FILE), seconds);
}; };
...@@ -1139,6 +1148,12 @@ Jensen.prototype.getFileBlock = async function (filename, length, ondata) { ...@@ -1139,6 +1148,12 @@ Jensen.prototype.getFileBlock = async function (filename, length, ondata) {
Jensen.prototype.getBatteryStatus = function(seconds) Jensen.prototype.getBatteryStatus = function(seconds)
{ {
if (this.model != 'hidock-p1') return null; if (this.model != 'hidock-p1') return null;
// 如果正在处理其它消息任务,则直接取消电池电量查询消息
if (this.busy())
{
Logger.info('jensen', 'dispatcher', 'cancel battery status query...');
return null;
}
return this.send(new Command(GET_BATTERY_STATUS), seconds); return this.send(new Command(GET_BATTERY_STATUS), seconds);
} }
Jensen.prototype.writeSerialNumber = async function (sn) { Jensen.prototype.writeSerialNumber = async function (sn) {
......
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