Commit ad38a3a4 authored by martin hou's avatar martin hou

feat: added compatibility with eason file list

parent 15ce97f3
......@@ -78,6 +78,11 @@ export function Home() {
alert(JSON.stringify(time));
}
const listFiles = async () => {
let files = await jensen.listFiles();
console.log(files);
}
return (
<>
<div style={{ display: 'flex', flexDirection: 'row', gap: '16px', padding: '16px', alignItems: 'center' }}>
......@@ -90,6 +95,7 @@ export function Home() {
<button style={{ width: '200px', height: '50px' }} onClick={getTime}>
Get Time
</button>
<button style={{ width: '200px', height: '50px' }} onClick={listFiles}>List Files</button>
<button style={{ width : '200px', height : '50px' }} onClick={bluetoothScan}>Bluetooth Scan</button>
<button style={{ width : '200px', height : '50px' }} onClick={disconnectBTDevice}>Bluetooth Disconnect</button>
</div>
......
......@@ -648,17 +648,26 @@ Jensen.prototype.listFiles = async function () {
ftime = ftime.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})REC.*$/gi, '$1-$2-$3 $4:$5:$6');
ftime = new Date(ftime);
duration = flen / 32;
} else if (ftime.match(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.hda$/gi)) {
} else if (ftime.match(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.(hda|wav)$/gi)) {
// 2024Mar19-110932-Rec00.hda
ftime = ftime.replace(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.hda$/gi, '20$2 $3 $4 $5:$6:$7');
ftime = ftime.replace(/^(\d{2})?(\d{2})(\w{3})(\d{2})-(\d{2})(\d{2})(\d{2})-.*\.(hda|wav)$/gi, '20$2 $3 $4 $5:$6:$7');
ftime = new Date(ftime);
duration = (flen / 32) * 4;
} else {
}
else {
ftime = null;
}
if (ver == 1) {
duration = duration * 2;
}
else if (ver == 2)
{
duration = (flen - 44) / 48 / 2;
}
else if (ver == 3)
{
duration = (flen - 44) / 48 / 2 / 2;
}
let createDate = '';
let createTime = '';
if (ftime) {
......@@ -671,6 +680,7 @@ Jensen.prototype.listFiles = async function () {
createTime: createTime,
time: ftime,
duration: duration,
version: ver,
length: flen,
signature: sign.join('')
});
......
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