Commit 7ec1611e authored by martin hou's avatar martin hou

feat: 在接收数据前完成一次回调,来完成前端闭环

parent 5151fee8
......@@ -101,7 +101,7 @@ function Jensen(log, conn) {
this.onreceive = null;
this.onerror = null;
const RECV_BUFF_SIZE = 51200;
const RECV_BUFF_SIZE = 8192;
const _check_conn_status = () => {
if (device?.opened === false) {
......@@ -451,6 +451,7 @@ function Jensen(log, conn) {
startIndex += rst.length;
let msg = rst.message;
console.log('seq = ' + msg.sequence);
// WARN: 接下来怎么整
let cname = msg.id === FACTORY_RESET ? 'factory-reset' : COMMAND_NAMES[msg.id];
let heading = [];
......@@ -1044,6 +1045,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
};
// this.onreceive = onprogress;
this._progress_report = {};
try { onprogress(0); } catch(e) {}
this.onreceive = function(recvBytes)
{
let percent = Math.floor(recvBytes / length * 100);
......
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