Commit 3112dd38 authored by martin hou's avatar martin hou

Merge branch 'v20250816' into device-mgr

parents 64bc50a5 8f1869ac
......@@ -196,15 +196,15 @@ export function Home() {
let filename = '';
let filelength = 0;
const transferFile = async () => {
// if (files == null || files.length == 0) return alert('请先点击List Files');
// let idx = prompt('请输入需要获取的文件序号(从0开始):', '0');
// if (idx === undefined || idx === null) return;
// let num = parseInt(idx);
// if (isNaN(num) || num < 0 || num >= files.length) return alert('请输入正确的序号');
// let file = files[num];
if (files == null || files.length == 0) return alert('请先点击List Files');
let idx = prompt('请输入需要获取的文件序号(从0开始):', '0');
if (idx === undefined || idx === null) return;
let num = parseInt(idx);
if (isNaN(num) || num < 0 || num >= files.length) return alert('请输入正确的序号');
let file = files[num];
// 2025Jun24-165914-Wip00.hda, 232704 @ 19392
filename = '2025Jun24-165914-Wip00.hda';
filelength = 232704;
filename = file.name;
filelength = file.length;
get_file();
}
......
......@@ -335,6 +335,7 @@ function Jensen(log, conn) {
Logger.debug('jensen', 'sendNext', pid + '-command: ' + current + ', data bytes: ' + data.byteLength);
self.timewait = cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK ? 1000 : 10;
// self.timewait = 10000;
console.log(pid + '-send', data);
if (self.onprogress && cmd.command == TRANSFER_FILE)
{
......@@ -487,15 +488,16 @@ function Jensen(log, conn) {
totalBuffLen += blocks[i].byteLength;
}
Logger.info('jensen', 'transfer', `try to decode buffer with ${totalBuffLen} bytes`);
// console.log('blocks', blocks);
let stime = new Date();
let buff = new ArrayBuffer(RECV_BUFF_SIZE * 2);
// bview的大小,必须是要大于固件端给出的最大包大小,已知的最大大小为8192字节,但是后面可能会提供整文件大小传输的情况,那个时候大小会变得巨大
let bview = new Uint8Array(10240);
let bview = new Uint8Array(RECV_BUFF_SIZE * 2);
// buff中实际使用的字节数,有效字节数
let buffLength = 0;
let crash = false;
let decodeBytes = 0;
// let decodeBytes = 0;
for (let i = 0, l = blocks.length; i < l; i++) {
let block = blocks.shift();
Logger.info('jensen', 'decode-block', `${i}/${l}@${block.byteLength}`);
......@@ -526,7 +528,7 @@ function Jensen(log, conn) {
startIndex += rst.length;
let msg = rst.message;
decodeBytes += msg.body.length;
// decodeBytes += msg.body.length;
// Logger.info('jensen', 'decode', `total decoded: ${decodeBytes}`);
// console.log('seq = ' + msg.sequence);
// WARN: 接下来怎么整
......@@ -580,6 +582,7 @@ function Jensen(log, conn) {
};
const decodeMessage = function (dataView, startIndex, buffLength) {
// console.log('decodeMessage', startIndex, buffLength, dataView);
let dataLen = buffLength - startIndex;
if (dataLen < 12) return null;
if (dataView[startIndex + 0] !== 0x12 || dataView[startIndex + 1] !== 0x34) throw new Error('invalid header');
......@@ -898,6 +901,8 @@ Jensen.prototype.listFiles = async function () {
}
});
console.log('files', files);
if ((fc && files.length >= fc.count) || (fcount > -1 && files.length >= fcount)) {
// delete jensen[tag];
jensen[tag] = null;
......
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