Commit 852b7933 authored by martin hou's avatar martin hou

feat: 更新UAC固件

parent 7a1aaa43
......@@ -8,9 +8,8 @@ const firmwareVersions = [
{ model: 'hidock-p1:mini', version: '2.1.0', url: 'https://jensen.test.hidock.com/firmwares/mini-2.1.0.bin' },
{ model: 'hidock-h1', version: '5.2.9', url: 'https://jensen.test.hidock.com/firmwares/hidock-h1-5.2.9.bin' },
{ model: 'hidock-h1e', version: '6.2.9', url: 'https://jensen.test.hidock.com/firmwares/hidock-h1e-6.2.9.bin' },
{ model: 'hidock-p1', version: '1.3.4', url: 'https://jensen.test.hidock.com/firmwares/hidock-p1-1.3.4.bin' },
{ model: 'hidock-p1', version: '1.2.18', url: 'https://jensen.test.hidock.com/firmwares/eason-1.2.18.bin' },
{ model: 'hidock-p1', version: '1.2.14', url: 'https://jensen.test.hidock.com/firmwares/eason-v1.2.14.bin' }
{ model: 'hidock-p1', version: '1.3.6', url: 'https://jensen.test.hidock.com/firmwares/p1-1.3.6.bin' },
{ model: 'hidock-p1', version: '1.2.25', url: 'https://jensen.test.hidock.com/firmwares/hidock-p1-1.2.25.bin' },
];
......@@ -224,12 +223,19 @@ export function Home() {
const updateUAC = async () => {
let jensen = getJensen();
if (jensen == null) return;
let resp = await jensen.requestUACUpdate('92e66fd8cfd36f09c83fc61491899307', 1024);
const uac_firmwares = {
'hidock-h1' : { url : '/firmwares/jensen-1-uac.bin', md5 : '92e66fd8cfd36f09c83fc61491899307' },
'hidock-h1e' : { url : '/firmwares/jensen-3-uac.bin', md5 : 'c355c5bf8cc8a8da8bea6b6315ad7649' }
};
let uac = uac_firmwares[jensen.getModel() as keyof typeof uac_firmwares];
if (!uac) return alert('No UAC firmware for your device');
let resp = await jensen.requestUACUpdate(uac.md5, 1024);
if (resp.code != 0x00) return alert(resp.result);
// 下载文件并完成更新处理
let xhr = new XMLHttpRequest();
xhr.open('GET', '/UAC.bin');
xhr.open('GET', uac.url);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.responseType = 'arraybuffer';
xhr.onload = function(e)
......@@ -380,12 +386,23 @@ export function Home() {
let jensen = getJensen();
if (jensen == null) return;
// await jensen.();
let rst = await jensen.setNotification(true, 5);
Logger.info('jensen', 'popup', 'Turn Popup On: ' + JSON.stringify(rst));
}
const turnPopupOff = async () => {
let jensen = getJensen();
if (jensen == null) return;
// await jensen.turnPopupOff();
let rst = await jensen.setNotification(false, 5);
Logger.info('jensen', 'popup', 'Turn Popup On: ' + JSON.stringify(rst));
}
const getSettings = async () => {
let jensen = getJensen();
if (jensen == null) return;
let rst = await jensen.getSettings(5);
Logger.info('jensen', 'settings', 'Get Settings: ' + JSON.stringify(rst));
}
return (
......@@ -407,6 +424,7 @@ export function Home() {
<button onClick={listFirmwares}>Firmewares</button>
<button onClick={turnPopupOn}>Turn Popup On</button>
<button onClick={turnPopupOff}>Turn Popup Off</button>
<button onClick={getSettings}>Get Settings</button>
</div>
<div className="result-container">
<div className="list-container">
......
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