Commit 2989ee45 authored by martin hou's avatar martin hou

feat: 增加错误日志输出/增加对reconnect的兼容处理

parent d16340ea
......@@ -162,8 +162,9 @@ function Jensen(log, conn) {
this.reconnect = async function () {
try
{
if (device && device.opened) device.close();
device.open();
await device.close();
await device.open();
ready = false;
await setup();
return true;
}
......@@ -386,6 +387,7 @@ function Jensen(log, conn) {
};
const tryDecode = function () {
if (!current) return;
// 一个容器,比单独任意一个小包要大一点儿,好像还差一点儿
let stime = new Date();
let buff = new ArrayBuffer(RECV_BUFF_SIZE * 2);
......@@ -407,6 +409,7 @@ function Jensen(log, conn) {
try {
rst = decodeMessage(bview, startIndex, buffLength);
} catch (e) {
Logger.error('jensen', 'decode', String(e));
crash = true;
break;
}
......@@ -964,6 +967,10 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
this.send(new Command(TRANSFER_FILE).body(fname));
};
Jensen.prototype.getAndDecode = async function () {
// 版本兼容
}
Jensen.prototype.requestFirmwareUpgrade = async function (versionNumber, fileSize, seconds) {
let data = [];
data[0] = (versionNumber >> 24) & 0xff;
......
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