Commit 3c07948c authored by Tuzhiqiang1996's avatar Tuzhiqiang1996

进入 更新界面 测试界面等

parent cd1c7018
{"color":0,"touch":0,"beep":0,"serial":0,"serialNG":0,"screen":0,"beepLT":0,"encoder":0,"rtc":0,"rtcTimes":0}
\ No newline at end of file
#!/bin/sh
if grep -qs '/mnt/SDCARD' /proc/mounts; then
echo "It's mounted."
echo 1 > /usr/local/quicknode/update.txt
else
echo "It's not mounted."
echo 2 > /usr/local/quicknode/update.txt
fi
{"color":0,"touch":0,"beep":0,"serial":0,"serialNG":0,"screen":0,"beepLT":0,"encoder":0,"rtc":0,"rtcTimes":0}
\ No newline at end of file
{"color":0,"touch":0,"beep":0,"serial":0,"serialNG":0,"screen":0,"beepLT":0,"encoder":0,"rtc":0,"rtcTimes":0}
\ No newline at end of file
/*console.log=function(){
}
console.trace=function(){
}*/
function initEventLister() {
var EventEmitter = require('@system.events');
globalThis.eventEmitter = new EventEmitter();
}
function onCreate(uri) {
initEventLister();
var evue = require("router.js");
var router = evue.router;
var times = [];
if (startUrl() == undefined) {
times.push(clock());
gc();
console.log(showMemInfo());
router.push({ 'path': uri });
times.push(clock());
console.log(times)
gc();
console.log(showMemInfo());
} else {
times.push(clock());
var uriObj = JSON.parse(globalThat.$uri);
console.log(uriObj);
router.push(uriObj);
times.push(clock());
console.log(times)
gc();
console.log(showMemInfo());
}
}
function onKeyEvent(code) {
var router = require("@system.router");
if (code == 62) {
router.pageDebug(!router.debugOn);
}
}
function onDestroy() {
// 应用退出时会被触发
var router = require("@system.router");
router.quit();
}
EvueApp({
"font": "update.ttf",
'onCreate': onCreate,
'onDestroy': onDestroy,
'onKeyEvent': onKeyEvent,
'paths': ["../update/", "../../enode_modules", "../../lib"],
'uri': 'main'
});
<!--结构描述-->
<html>
<!--背景块区域 样式container 点击事件 bgclick-->
<div class="screen">
<text id="date">{{crtUpdateMsg}}</text>
</div>
</html>
<!--功能描述-->
<script>
//接口声明 使用路由功能模块
var router = require("@system.router");
var fs = require("@system.fs")
//写入内容与操作
export default {
//数据写入 变量pagetitle 类型字符串 内容“页0”
data: {
crtUpdateMsg: ""
},
toUint8Arr: function (str) {
const buffer = [];
for (let i of str) {
const _code = i.charCodeAt(0);
buffer.push(_code);
}
return Uint8Array.from(buffer);
},
normal1s: function () {
var dotString = ""
for (var cnt = 0; cnt < this.index; cnt++) {
dotString += "."
}
var ret = fs.readFile("../../update.txt"); //返回二进制数据
// var ret = fs.readFile("./update.txt"); //返回二进制数据
var u8array = this.toUint8Arr(ret)
// console.log("u8array=" + u8array)
// console.log("u8array type=" + typeof u8array)
var str = ""
if (u8array[0] == 0x31) {
// str = "Update finished!Please reset."
str = "升级成功!请拔出升级卡后重启设备。"
globalThis.eventEmitter.emit("onUpdateMessageEvent", str);
} else if (u8array[0] == 0x32) {
// str = "Card not found!"
str = "未找到卡!"
globalThis.eventEmitter.emit("onUpdateMessageEvent", str);
} else {
// str = "Downloading!Please wait" + dotString
str = "升级中!请等待" + dotString
globalThis.eventEmitter.emit("onUpdateMessageEvent", str);
}
if (this.index < 3) {
this.index++
} else {
this.index = 1
}
},
timerset: function () {
this.timer2 = this.$setInterval(this.normal1s, 1000, [], this);
},
onUpdateMessageEvent: function (str) {
// console.log(str)
this.crtUpdateMsg = str
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.index = 1
this.timerset();
globalThis.eventEmitter.on("onUpdateMessageEvent", this.onUpdateMessageEvent, this);
},
clearTimer: function () {
this.$clearInterval(this.timer1);
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
}
</script>
<!--样式描述-->
<style>
/*背景块的样式*/
.screen {
width: 1280;
height: 720;
background-color: white;
}
#color {
width: 1280;
height: 720;
background-color: black;
}
#date {
top: 120;
width: 480;
height: 50;
font-size: 25;
text-align: center;
text-overflow: ellipsis;
color: black;
}
</style>
1
\ No newline at end of file
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