Commit 37de19cb authored by martin hou's avatar martin hou

fix: 调整Live模式的识别

parent 2ddf0a52
......@@ -103,6 +103,7 @@ function Jensen(log, conn) {
let recvable = false;
let lastCommand = null;
let fileListing = false;
let liveMode = false;
let self = this;
this.data = {};
......@@ -278,7 +279,11 @@ function Jensen(log, conn) {
}
this.isLiveMode = function() {
return lastCommand == REALTIME_TRANSFER;
return liveMode;
}
this.setLiveMode = function (value) {
liveMode = value;
}
this.setUSBDevice = function (dev) {
......@@ -1379,15 +1384,19 @@ Jensen.prototype.getRealtimeSettings = async function () {
Jensen.prototype.startRealtime = async function (channels, seconds) {
if (this.isFileListing()) return null;
if (this.busy()) return null;
this.setLiveMode(true);
return this.send(new Command(REALTIME_CONTROL).body([0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, channels & 0x03]), seconds);
};
Jensen.prototype.pauseRealtime = async function (seconds) {
this.setLiveMode(false);
return this.send(new Command(REALTIME_CONTROL).body([0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00]), seconds);
};
Jensen.prototype.stopRealtime = async function (seconds) {
this.setLiveMode(false);
return this.send(new Command(REALTIME_CONTROL).body([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), seconds);
};
Jensen.prototype.getRealtime = async function (seconds) {
this.setLiveMode(true);
return this.send(new Command(REALTIME_TRANSFER), seconds);
};
Jensen.prototype.requestToneUpdate = async function(signature, size, 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