Commit d46432b5 authored by lyong's avatar lyong

"refactor(factoryTest): 调整UART通信间隔并新增WiFi连接脚本"

parent 0e340286
......@@ -96,7 +96,7 @@
onShow: function () {
this.uartComm();
this.testTimer = this.$setInterval(this.InterValTime, 1000, [], this);
this.testTimer = this.$setInterval(this.InterValTime, 2000, [], this);
},
onHide: function () {
......
<html>
<!--屏幕只有一个id-->
<div class="fullScreen" id="root">
<div class="point" id="point1"></div>
<div class="point" id="point2"></div>
<div class="point" id="point3"></div>
<div class="point" id="point4"></div>
<div class="point" id="point5"></div>
<div class="point" id="point6"></div>
<div class="point" id="point7"></div>
<div class="point" id="point8"></div>
<div class="point" id="point9"></div>
<div class="point" id="point10"></div>
<div class="point" id="point11"></div>
<div class="point" id="point12"></div>
<div class="point" id="point13"></div>
<div class="point" id="point14"></div>
<div class="point" id="point15"></div>
<div class="point" id="point16"></div>
<div class="point" id="point17"></div>
<div class="point" id="point18"></div>
<div class="point" id="point19"></div>
<div class="point" id="point20"></div>
<div class="point" id="point21"></div>
<div class="point" id="point22"></div>
<div class="point" id="point23"></div>
<div class="point" id="point24"></div>
<div class="point" id="point25"></div>
<div class="point" id="point26"></div>
<div class="point" id="point27"></div>
<div class="point" id="point28"></div>
<div class="point" id="point29"></div>
<div class="point" id="point30"></div>
<text class="infoText" id="infoText">{{ crtTestInfoText }}</text>
</div>
</html>
<script>
var router = require("@system.router");
export default {
data: {
crtTestInfoText: "",
},
onInit: function () {
console.log(this.$uri + "===========onInit=============");
},
onShow: function () {
console.log(this.$uri + "===========onShow=============");
console.log(showMemInfo());
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
console.log(showMemInfo());
},
onReady: function () {
console.log(this.$uri + "===========onReady=============");
this.$enableMouseMoveEvent(true);
this.pointIndex = 1;
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
},
refPointGroup: function (x, y) {
var no = this.pointIndex;
var id = "point" + no;
this.$setPos(id, x, y);
no++;
if (no > 30) {
no = 1;
}
this.pointIndex = no;
},
onmousemove: function (gx, gy, topNode, x, y) {
console.log("onmousemove:x-" + x + " y-" + y);
this.refPointGroup(x + 0, y);
this.crtTestInfoText = "x:" + x + " y:" + y;
},
};
</script>
<style>
.fullScreen {
left: 0;
width: 720;
height: 1280;
background-color: black;
}
.point {
width: 2;
height: 2;
background-color: red;
}
.infoText {
width: 720;
height: 30;
top: 770;
text-align: center;
font-size: 13;
background-color: transparent;
color: greenyellow;
}
</style>
\ No newline at end of file
<html>
<div class="screen">
<text class="functionBlock" id="id_ok" onclick="touchedOK">yes</text>
<text class="functionBlock" id="id_ng" onclick="touchedNG">no</text>
<text class="functionBlock" id="id_reset">2.731KHz 50%</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
index: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.index = 0
this.timerSet();
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
rd190_factory.pwmInit()
this.timerBeep = this.$setInterval(this.normalTimerOut, 1000, [], this);
},
normalTimerOut: function () {
this.index++
if (this.index % 2 == 0) {
rd190_factory.pwm(1)
} else {
rd190_factory.pwm(0)
}
},
clearTimer: function () {
this.$clearInterval(this.timerBeep);
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedOK: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
globalThis.factoryTest.beep = 1
this.returnResult()
},
touchedNG: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
globalThis.factoryTest.beep = 2
this.returnResult()
},
touchedReset: function (node, topnode, x, y) {
this.index = 0
},
returnResult: function () {
rd190_factory.pwm(0)
router.push({
path: "factory_testList"
});
}
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
.chooseBlock {
width: 240;
height: 160;
border-radius: 5;
border-width: 2;
border-color: white;
background-color: gainsboro;
}
.cbName {
top: 65;
width: 240;
height: 50;
color: black;
text-align: center;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
#id_cb1 {
left: 20;
top: 20;
}
#id_cb2 {
left: 280;
top: 20;
}
#id_cb3 {
left: 540;
top: 20;
}
#id_cb4 {
left: 20;
top: 200;
}
#id_cb5 {
left: 280;
top: 200;
}
#id_cb6 {
left: 540;
top: 200;
}
.functionBlock {
width: 320;
height: 100;
color: red;
border-radius: 5;
border-width: 2;
border-color: black;
background-color: gainsboro;
text-align: center;
text-overflow: ellipsis;
font-size: 45;
}
#id_ok {
left: 40;
top: 300;
}
#id_ng {
left: 440;
top: 300;
}
#id_reset {
left: 240;
top: 80;
}
</style>
\ No newline at end of file
<html>
<div class="screen">
<text id="id_time">{{textTimer}}</text>
<text class="functionBlock" id="id_ok" onclick="touchedOK">yes</text>
<text class="functionBlock" id="id_ng" onclick="touchedNG">no</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
// var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
index: 0,
textTimer: "00:00:00",
crtSec: 0,
crtMinu: 0,
crtHour: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.index = 0
this.timerSet();
this.crtSec = 0
this.crtMinu = 0
this.crtHour = 0
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.timerBeep = this.$setInterval(this.normalTimerOut, 1000, [], this);
// rd190_factory.pwmInit()
},
refTime: function () {
if (this.crtSec >= 60) {
this.crtMinu++
this.crtSec = 0
}
if (this.crtMinu >= 60) {
this.crtHour++
this.crtMinu = 0
}
var depText = ""
var tempText = ""
if (this.crtHour < 10) {
depText = "0" + this.crtHour
} else {
depText = "" + this.crtHour
}
tempText = "" + depText + ":"
if (this.crtMinu < 10) {
depText = "0" + this.crtMinu
} else {
depText = "" + this.crtMinu
}
tempText += depText + ":"
if (this.crtSec < 10) {
depText = "0" + this.crtSec
} else {
depText = "" + this.crtSec
}
tempText += depText
this.textTimer = tempText
},
normalTimerOut: function () {
this.crtSec++
this.refTime()
if (this.index <= 5) {
this.index++
} else {
this.index = 1
}
// rd190_factory.pwm(this.index)
if (this.crtHour >= 96) {
globalThis.factoryTest.beepLT = 1
// rd190_factory.pwm(0)
router.push({
path: "testLongTimeList"
});
}
},
clearTimer: function () {
this.$clearInterval(this.timerBeep);
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedOK: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
globalThis.factoryTest.beepLT = 1
this.returnResult()
},
touchedNG: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
globalThis.factoryTest.beepLT = 2
this.returnResult()
},
returnResult: function () {
// rd190_factory.pwm(0)
router.push({
path: "factory_testList"
});
}
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
.chooseBlock {
width: 240;
height: 160;
border-radius: 5;
border-width: 2;
border-color: white;
background-color: gainsboro;
}
.cbName {
top: 65;
width: 240;
height: 50;
color: black;
text-align: center;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
#id_cb1 {
left: 20;
top: 20;
}
#id_cb2 {
left: 280;
top: 20;
}
#id_cb3 {
left: 540;
top: 20;
}
#id_cb4 {
left: 20;
top: 200;
}
#id_cb5 {
left: 280;
top: 200;
}
#id_cb6 {
left: 540;
top: 200;
}
.functionBlock {
width: 320;
height: 100;
color: red;
border-radius: 5;
border-width: 2;
border-color: black;
background-color: gainsboro;
text-align: center;
text-overflow: ellipsis;
font-size: 35;
}
#id_ok {
left: 40;
top: 380;
}
#id_ng {
left: 440;
top: 380;
}
#id_reset {
left: 240;
top: 200;
}
#id_time {
top: 100;
width: 800;
height: 100;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: black;
background-color: transparent;
}
</style>
<html>
<div class="screen" onclick="touchedScreen">
<div id="id_color"></div>
<!-- <text id="reminderText">123456789123456789123456789</text> -->
<text class="class_Bginfo">{{crtBgLight}}</text>
<text class="class_msg" id="id_add" onclick="touchedAdd"></text>
<text class="class_msg" id="id_sub" onclick="touchedSub"></text>
<text class="class_msg" id="id_ok" onclick="touchedOk">yes</text>
<text class="class_msg" id="id_ng" onclick="touchedNg">no</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var bglight = require("factory_bglight.js");
export default {
data: {
colorBash: [
{
"val": 0xffffff,//纯白
"text": "纯白:#ffffff"//纯白
},
{
"val": 0xff0000,//纯红
"text": "纯红:#ff0000",//纯红
},
{
"val": 0x00ff00,//纯绿
"text": "纯绿:#00ff00",//纯绿
},
{
"val": 0x0000ff,//纯蓝
"text": "纯蓝:#0000ff",//纯蓝
},
{
"val": 0x000000,//纯黑
"text": "纯黑:#000000",//纯黑
},
],
imgCnt: 0,
crtBgLight: "亮度:100%",
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
this.lightLevel = 20
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
// this.$hide("id_ok")
// this.$hide("id_ng")
this.timerSet()
this.imgCnt = 0
this.checkFlagBash(this.imgCnt)
this.imgCnt++
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
// bglight.changeBgLight(255)
this.clearTimer()
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer()
},
/*************** timer ***************/
timerSet: function () {
// this.timerColor = this.$setInterval(this.normalTimerOut, 1000, [], this);
},
normalTimerOut: function () {
},
clearTimer: function () {
},
/*************** connect ***************/
/*************** event ***************/
shortDelay: function () {
this.$setX("id_ng", 800);
this.$setY("id_ng", 340);
console.log("=====show id_ng successful!")
this.$clearTimeout(this.shortDelayId);
},
touchedScreen: function (node, topNode, x, y) {
if (this.imgCnt < this.colorBash.length) {
this.checkFlagBash(this.imgCnt)
this.imgCnt++
} else {
// this.$foreground("id_ok")
this.$show("id_ok")
console.log("=====show id_ok successful!")
// this.$foreground("id_ng")
this.$show("id_ng")
// this.shortDelayId = this.$setTimeout(this.shortDelay, 3000, [], this);
// this.$clearInterval(this.timerColor);
}
},
touchedAdd: function (node, topNode, x, y) {
if (this.lightLevel < 20) {
this.lightLevel++
}
else {
this.lightLevel = 20
}
var temp = 0;
temp = this.lightLevel * 5
this.crtBgLight = "亮度:" + temp + "%"
var tempLight = Math.floor(255 * (temp / 100))
// bglight.changeBgLight(tempLight)
},
touchedSub: function (node, topNode, x, y) {
if (this.lightLevel > 0) {
this.lightLevel--
}
else {
this.lightLevel = 0
}
var temp = 0;
temp = this.lightLevel * 5
this.crtBgLight = "亮度:" + temp + "%"
var tempLight = Math.floor(255 * (temp / 100))
// bglight.changeBgLight(tempLight)
},
touchedOk: function (node, topNode, x, y) {
globalThis.factoryTest.bgLight = 1
router.push({
path: "factory_testList"
});
},
touchedNg: function (node, topNode, x, y) {
globalThis.factoryTest.bgLight = 2
router.push({
path: "factory_testList"
});
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
checkFlagBash: function (val) {
var temp = this.colorBash[val].val
console.log("tempType = " + typeof temp)
console.log("tempValue = " + temp)
this.$setBackgroundColor("id_color", temp)
},
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
#id_color {
width: 800;
height: 480;
background-color: black;
}
#reminderText {
top: 40;
width: 500;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: left;
/* text-overflow: ellipsis; */
font-size: 60;
color: white;
background-color: transparent;
}
.class_Bginfo {
top: 80;
left: 150;
width: 500;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
.class_msg {
top: 220;
width: 200;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
#id_add {
left: 100;
}
#id_sub {
left: 500;
}
#id_ok {
top: 360;
left: 100;
}
#id_ng {
top: 360;
left: 500;
}
</style>
\ No newline at end of file
<html>
<div class="screen" id="id_screen">
<div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;">
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
</div>
<text class="fontsize60" id="title_TEXT"
style="left:50;top: 155;width: 305;height: 1280;text-align: center; background-color: transparent;color: white;">{{
title_TEXT }}</text>
<text class="fontsize60" id="title2_TEXT"
style="left:50;top: 300;width: 305;height: 1280;text-align: center; background-color: transparent;color: white;">{{
title2_TEXT }}</text>
<text class="fontsize60" id="qos_TEXT"
style="left:200;top: 155;width: 305;height: 1280;text-align: center; background-color: transparent;color: white;">{{
qos_TEXT }}</text>
<text class="fontsize60" id="signal_TEXT"
style="left:200;top: 300;width: 305;height: 1280;text-align: center; background-color: transparent;color: white;">{{
signal_TEXT }}</text>
<div id="exit" style="width: 300;height: 80;left:200;top:700;background-color: blue; border-radius: 10px;"
onclick="exit">
<text class="fontsize60" id="exit_TEXT"
style="left:0;top: 0;width: 300;height: 80;text-align: center; background-color: transparent;color: white;">{{
exit_TEXT }}</text>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var macGetId = null;
var qosGetId = null;
// var pageInterval = null;
export default {
data: {
title_TEXT: "QOS:",
title2_TEXT: "MAC:",
qos_TEXT: "NC",
signal_TEXT: "NC",
exit_TEXT: "退出",
},
onInit() {
},
onShow: function () {
if (macGetId != null) {
clearInterval(macGetId);
macGetId = null;
}
macGetId = setInterval(() => {
}, 200);
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
qosGetId = setInterval(() => {
}, 200);
},
exit: function (node, topNode, x, y) {
this.exitEvent();
},
exitEvent: function () {
if (macGetId != null) {
clearTimeout(macGetId);
macGetId = null;
}
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
router.push({
path: 'factory_testList'
})
},
};
</script>
<style>
.screen {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.trueActiveDiv {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.gifIcon {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.fontsize60 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" id="id_screen">
<div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;">
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
</div>
<!-- <text class="fontsize60" id="title_TEXT"
style="left:50;top: 155;width: 800;height: 1280;text-align: left; background-color: transparent;color: white;">{{
title_TEXT }}</text>
<text class="fontsize60" id="title2_TEXT"
style="left:50;top: 300;width: 305;height: 1280;text-align: left; background-color: transparent;color: white;">{{
title2_TEXT }}</text> -->
<text class="fontsize120" id="title_TEXT"
style="left:0;top: 10;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title_TEXT }}</text>
<text class="fontsize60" id="mac_TEXT"
style="left:0;top: 400;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
mac_TEXT }}</text>
<!-- <text class="fontsize60" id="mac_TEXT"
style="left:200;top: 300;width: 305;height: 1280;text-align: left; background-color: transparent;color: white;">{{
mac_TEXT }}</text> -->
<div id="exit" style="width: 300;height: 80;left:200;top:1100;background-color: blue; border-radius: 10px;"
onclick="exit">
<text class="fontsize60" id="exit_TEXT"
style="left:0;top: 0;width: 300;height: 80;text-align: center; background-color: transparent;color: white;">{{
exit_TEXT }}</text>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var lib = require("factory_bleInfo.js");
var macGetId = null;
var qosGetId = null;
// var pageInterval = null;
export default {
data: {
title_TEXT: "MAC:",
// title2_TEXT: "MAC:",
qos_TEXT: "NC",
mac_TEXT: "NC",
exit_TEXT: "退出",
},
onInit() {
},
onShow: function () {
var qosValue;
var macValue;
this.checkCnt = 0;
// lib.start();
if (macGetId != null) {
clearInterval(macGetId);
macGetId = null;
}
macGetId = setInterval(() => {
macValue = lib.read("mac");
this.mac_TEXT = macValue;
this.checkCnt++
if (this.checkCnt > 10) {
if (this.mac_TEXT == undefined) {
globalThis.factoryTest.ble = 2
} else {
globalThis.factoryTest.ble = 1
}
this.exitEvent()
}
}, 200);
},
exit: function (node, topNode, x, y) {
this.exitEvent();
},
exitEvent: function () {
if (macGetId != null) {
clearTimeout(macGetId);
macGetId = null;
}
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
// lib.close();
router.push({
path: 'factory_testList'
})
},
};
</script>
<style>
.screen {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.trueActiveDiv {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.gifIcon {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.fontsize120 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 120px;
color: #ffffff;
background-color: transparent;
}
.fontsize60 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 60px;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onlongpress="touchedResetRecord">
<template for="appItem" key="app" index="index">
<div class="chooseBlock" id="app.id" :url="app.startup" :top="app.top" :left="app.left" onclick="touchedBlock">
<text class="testName" :url="app.startup">{{app.name}}</text>
<text class="testInfo" :url="app.startup">{{app.info}}</text>
</div>
</template>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var file = require("file.js");
// var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
index: 0,
onlyOnceFlag: 0,
appItem: [
{
"id": "id_testEncoder",
"name": "喇叭测试",
"info": "hold press to return",
"startup": "testEncoder",
"top": 0,
"left": 0,
},
{
"id": "id_testTCard",
"name": "T卡检测",
"info": "scan TCard",
"startup": "testTCard",
"top": 0,
"left": 262,
},
{
"id": "id_testBglight",
"name": "背光测试",
"info": "Change the backlight",
"startup": "testBgLight",
"top": 240,
"left": 0,
},
],
},
/*************** struct ***************/
onInit: function () {
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.timerSet();
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.normalTimerOutId = this.$setTimeout(this.normalTimerOut, 100, [], this);
},
normalTimerOut: function () {
// rd190_factory.pwmInit()
this.testStatus()
},
clearTimer: function () {
this.$clearTimeout(this.normalTimerOutId);
this.$clearTimeout(this.tempTimerOutId);
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url");
console.log("url:" + url);
if (url == undefined)
return;
if (url == "testTCard")
return;
router.push({
path: url
});
},
blockColorChange: function (relId, val) {
console.log(relId + ":" + val)
if (val == 1) {
this.$setBackgroundColor(relId, 0x00ff00)
}
else if (val == 2) {
this.$setBackgroundColor(relId, 0xff0000)
} else {
this.$setBackgroundColor(relId, 0xDCDCDC)
}
},
testStatus: function () {
this.blockColorChange(this.appItem[0].id, globalThis.factoryTest.encoder)
this.blockColorChange(this.appItem[1].id, globalThis.factoryTest.tcard)
this.blockColorChange(this.appItem[2].id, globalThis.factoryTest.bgLight)
},
tempSave: function () {
router.push({
path: "factory_testList"
});
},
touchedResetRecord: function (node, topNode, x, y) {
if (x > 600) {
console.log("will reset record.")
globalThis.factoryTest.color = 0
globalThis.factoryTest.touch = 0
globalThis.factoryTest.wifi = 0
globalThis.factoryTest.tcard = 0
globalThis.factoryTest.bgLight = 0
globalThis.factoryTest.serial = 0
globalThis.factoryTest.serialNG = 0
globalThis.factoryTest.beepLT = 0
globalThis.factoryTest.encoder = 0
globalThis.factoryTest.rtc = 0
var obj = {
"color": 0,
"touch": 0,
"wifi": 0,
"tcard": 0,
"serial": 0,
"serialNG": 0,
"rtcTimes": globalThis.factoryTest.rtcTimes,
"beepLT": 0,
"encoder": 0,
"rtc": 0,
"bgLight": 0,
}
console.log(obj)
file.write("product_res.json", obj)
this.tempTimerOutId = this.$setTimeout(this.tempSave, 100, [], this);
}
}
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: white;
}
/*********************************/
.chooseBlock {
width: 260;
height: 235;
background-color: gainsboro;
border-radius: 5;
border-color: black;
border-width: 2;
}
.testName {
top: 50;
left: 0;
width: 260;
height: 45;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
}
.testInfo {
top: 140;
left: 0;
width: 260;
height: 80;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 30;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onlongpress="touchedTime">
<div id="id_color"></div>
<text id="id_time">{{textTimer}}</text>
<text class="class_msg" id="id_ok" onclick="touchedOk">yes</text>
<text class="class_msg" id="id_ng" onclick="touchedNg">no</text>
</div>
</html>
<script>
var router = require("@system.router");
// var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
textTimer: "有声音吗?",
crtSec: 0,
imgCnt: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
// rd190_factory.rmmodEncoder()
// rd190_factory.soundInit()
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
// this.$hide("id_ok")
// this.$hide("id_ng")
this.timerSet()
// this.imgCnt = 0
// this.crtSec = 0
// this.checkFlagBash(this.imgCnt)
// this.imgCnt++
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer()
// rd190_factory.insmodEncoder()
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer()
// rd190_factory.insmodEncoder()
},
/*************** timer ***************/
timerSet: function () {
this.normalTimerOutId = this.$setInterval(this.normalTimerOut, 1000, [], this);
},
refTime: function () {
this.textTimer = "now light index:" + this.imgCnt
},
normalTimerOut: function () {
// if (this.imgCnt < 7) {
// } else {
// this.imgCnt = 0
// }
// this.checkFlagBash(this.imgCnt)
// this.imgCnt++
// this.crtSec++
// this.refTime()
// rd190_factory.soundOn()
this.$clearTimeout(this.normalTimerOutId);
},
clearTimer: function () {
this.$clearTimeout(this.normalTimerOutId);
},
/*************** connect ***************/
/*************** event ***************/
touchedOk: function (node, topNode, x, y) {
globalThis.factoryTest.encoder = 1
router.push({
path: "factory_testList"
});
},
touchedNg: function (node, topNode, x, y) {
globalThis.factoryTest.encoder = 2
router.push({
path: "factory_testList"
});
},
touchedTime: function (node, topNode, x, y) {
this.$show("id_ok")
this.$show("id_ng")
this.$clearInterval(this.timerColor);
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
checkFlagBash: function (val) {
var tempArray = [0, 0, 0, 0, 0, 0, 0]
tempArray[val] = 1
for (var cnt = 0; cnt < tempArray.length; cnt++) {
// rd190_factory.gpio(cnt + 1, tempArray[cnt])
}
},
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
#id_color {
width: 800;
height: 480;
background-color: black;
}
.class_msg {
top: 240;
width: 200;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
#id_ok {
left: 100;
}
#id_ng {
left: 500;
}
#id_time {
top: 100;
width: 800;
height: 100;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: white;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" id="id_screen">
<div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;">
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
</div>
<text class="fontsize60" id="title_TEXT" style="left:0;top: 10;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title_TEXT }}</text>
<text class="fontsize60" id="title2_TEXT" style="left:0;top: 640;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title2_TEXT }}</text>
<text class="fontsize40" id="data_TEXT" style="left:0;top: 80;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
data_TEXT }}</text>
<text class="fontsize40" id="iccid_TEXT" style="left:0;top: 710;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
iccid_TEXT }}</text>
<div id="exit" style="width: 300;height: 80;left:200;top:1180;background-color: blue; border-radius: 10px;" onclick="exit">
<text class="fontsize60" id="exit_TEXT" style="width: 300;height: 80;text-align: center; background-color: transparent;color: white;">{{
exit_TEXT }}</text>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var lib = require("factory_esim.js");
var Get1Id = null;
var Get2Id = null;
// var pageInterval = null;
export default {
data: {
title_TEXT: "E-SIM信息",
title2_TEXT: "ICCID",
iccid_TEXT: "NC",
data_TEXT: "NC",
exit_TEXT: "退出",
},
onInit() {
},
onShow: function () {
var qosValue;
var macValue;
this.checkCnt = 0;
var signal = lib.read("signal");
var imei = lib.read("imei");
this.data_TEXT = "signal :" + signal + "imei :" + imei;
this.iccid_TEXT = lib.read("iccid");
// lib.start();
if (Get1Id != null) {
clearInterval(Get1Id);
Get1Id = null;
}
Get1Id = setInterval(() => {
var signal = lib.read("signal");
var imei = lib.read("imei");
this.data_TEXT = "signal :" + signal + "imei :" + imei;
}, 2000);
if (Get2Id != null) {
clearInterval(Get2Id);
Get2Id = null
}
Get2Id = setInterval(() => {
this.iccid_TEXT = lib.read("iccid");
// this.iccid_TEXT = lib.read("iccid");
this.checkCnt++
if(this.checkCnt>2){
if(this.iccid_TEXT==undefined){
globalThis.factoryTest.esim = 2
}else{
globalThis.factoryTest.esim = 1
}
this.exitEvent();
}
}, 2000);
},
exit: function (node, topNode, x, y) {
this.exitEvent();
},
exitEvent: function () {
if (Get1Id != null) {
clearTimeout(Get1Id);
Get1Id = null;
}
if (Get2Id != null) {
clearInterval(Get2Id);
Get2Id = null
}
// lib.close();
router.push({
path: 'factory_testList'
})
},
};
</script>
<style>
.screen {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.trueActiveDiv {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.gifIcon {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.fontsize60 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: #ffffff;
background-color: transparent;
}
.fontsize40 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onlongpress="touchedTime" onclick="activeScreen">
<div id="id_color"></div>
<text id="id_time">{{textTimer}}</text>
<text class="class_msg" id="id_exit" onclick="touchedExit">退出</text>
<text class="class_msg" id="id_cancel" onclick="touchedCancel">继续</text>
<text id="id_reminder">{{text_reminder}}</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var file = require("file.js");
var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
textTimer: "00:00:00",
crtSec: 0,
crtMinu: 0,
crtHour: 0,
colorBash: [
{
"val": 0xffffff,//纯白
"text": "white:#ffffff"//纯白
},
{
"val": 0xff0000,//纯红
"text": "red:#ff0000",//纯红
},
{
"val": 0x00ff00,//纯绿
"text": "green:#00ff00",//纯绿
},
{
"val": 0x0000ff,//纯蓝
"text": "blue:#0000ff",//纯蓝
},
{
"val": 0x000000,//纯黑
"text": "black:#000000",//纯黑
},
],
imgCnt: 0,
index: 0,
text_reminder: "This screen has been clicked!",
},
/*************** struct ***************/
onInit: function () {
// rd190_factory.pwmInit()
// rd190_factory.soundInit()
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.timerSet();
this.$hide("id_reminder")
this.$hide("id_exit")
this.$hide("id_cancel")
this.imgCnt = 0
this.crtSec = 0
this.crtMinu = 0
this.crtHour = 0
this.index = 0
this.checkFlagBash(this.imgCnt)
this.imgCnt++
this.text_reminder = "This screen has been clicked!"
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.timerBeepId = this.$setInterval(this.timerBeep, 1000, [], this);
// this.timerScreenId = this.$setInterval(this.timerScreen, 1000, [], this);
},
refTime: function () {
if (this.crtSec >= 60) {
this.crtMinu++
this.crtSec = 0
}
if (this.crtMinu >= 60) {
this.crtHour++
this.crtMinu = 0
}
var depText = ""
var tempText = ""
if (this.crtHour < 10) {
depText = "0" + this.crtHour
} else {
depText = "" + this.crtHour
}
tempText = "" + depText + ":"
if (this.crtMinu < 10) {
depText = "0" + this.crtMinu
} else {
depText = "" + this.crtMinu
}
tempText += depText + ":"
if (this.crtSec < 10) {
depText = "0" + this.crtSec
} else {
depText = "" + this.crtSec
}
tempText += depText
this.textTimer = tempText
},
timerBeep: function () {
this.crtSec++
this.index++
this.refTime()
if (this.index % 2 == 0) {
rd190_factory.pwm(0)
} else {
rd190_factory.pwm(1)
}
if (this.crtSec % 20 == 0) {
rd190_factory.soundOn()
}
if (this.crtHour >= 96) {
globalThis.factoryTest.beepLT = 1
rd190_factory.pwm(0)
this.text_reminder = "The test time reached 96 hours!"
this.$show("id_reminder")
// router.push({
// path: "testLongTimeList"
// });
}
if (this.imgCnt < this.colorBash.length) {
} else {
this.imgCnt = 0
}
this.checkFlagBash(this.imgCnt)
this.imgCnt++
},
// timerScreen: function () {
// },
clearTimer: function () {
this.$clearInterval(this.timerBeepId);
// this.$clearInterval(this.timerScreenId);
this.$clearTimeout(this.showThrSecondId)
},
/*************** connect ***************/
/*************** event ***************/
activeScreen: function (node, topnode, x, y) {
this.$show("id_reminder")
this.showThrSecondId = this.$setTimeout(this.showOneSecond, 3000, [], this)
},
showOneSecond: function () {
this.$hide("id_reminder")
this.$clearTimeout(this.showThrSecondId)
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedExit: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
// globalThis.factoryTest.beepLT = 1
this.returnResult()
},
touchedCancel: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
// globalThis.factoryTest.beepLT = 2
this.timerSet();
this.$hide("id_exit")
this.$hide("id_cancel")
},
touchedTime: function (node, topNode, x, y) {
this.$show("id_exit")
this.$show("id_cancel")
rd190_factory.pwm(0)
// this.$clearInterval(this.timerScreenId);
this.$clearInterval(this.timerBeepId);
},
returnResult: function () {
rd190_factory.pwm(0)
router.push({
path: "factory_testList"
});
},
checkFlagBash: function (val) {
var temp = this.colorBash[val].val
this.$setBackgroundColor("id_color", temp)
val++
if (val < this.colorBash.length) {
} else {
val = 0
}
temp = this.colorBash[val].val
this.$setTextColor("id_time", temp)
},
touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url");
console.log("url:" + url);
if (url == undefined)
return;
if (url == "testTCard")
return;
router.push({
path: url
});
},
blockColorChange: function (relId, val) {
console.log(relId + ":" + val)
if (val == 1) {
this.$setBackgroundColor(relId, "#00ff00")
}
else if (val == 2) {
this.$setBackgroundColor(relId, "#ff0000")
} else {
this.$setBackgroundColor(relId, "#DCDCDC")
}
},
testStatus: function () {
this.blockColorChange(this.appItem[0].id, globalThis.factoryTest.beepLT)
this.blockColorChange(this.appItem[1].id, globalThis.factoryTest.beepLT)
},
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: white;
}
/*********************************/
#id_color {
width: 800;
height: 480;
background-color: black;
}
#id_time {
top: 100;
width: 800;
height: 100;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: black;
background-color: transparent;
}
.class_msg {
top: 360;
width: 300;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 56;
color: black;
background-color: gainsboro;
}
#id_exit {
left: 50;
}
#id_cancel {
left: 450;
}
#id_reminder {
top: 216;
left: 0;
width: 800;
height: 52;
font-size: 45;
text-align: center;
color: #f76832;
}
.chooseBlock {
width: 260;
height: 235;
background-color: gainsboro;
border-radius: 5;
border-color: black;
border-width: 2;
}
.testName {
top: 50;
left: 0;
width: 260;
height: 45;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
}
.testInfo {
top: 140;
left: 0;
width: 260;
height: 80;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 30;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onlongpress="touchedTime" onclick="activeScreen">
<div id="id_color"></div>
<text id="id_time">{{textTimer}}</text>
<text class="class_msg" id="id_exit" onclick="touchedExit">退出</text>
<text class="class_msg" id="id_cancel" onclick="touchedCancel">继续</text>
<text id="id_reminder">{{text_reminder}}</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var file = require("file.js");
// var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
textTimer: "00:00:00",
crtSec: 0,
crtMinu: 0,
crtHour: 0,
colorBash: [
{
"val": 0xffffff,//纯白
"text": "white:#ffffff"//纯白
},
{
"val": 0xff0000,//纯红
"text": "red:#ff0000",//纯红
},
{
"val": 0x00ff00,//纯绿
"text": "green:#00ff00",//纯绿
},
{
"val": 0x0000ff,//纯蓝
"text": "blue:#0000ff",//纯蓝
},
{
"val": 0x000000,//纯黑
"text": "black:#000000",//纯黑
},
],
imgCnt: 0,
index: 0,
text_reminder: "This screen has been clicked!",
},
/*************** struct ***************/
onInit: function () {
// rd190_factory.pwmInit()
// rd190_factory.soundInit()
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.timerSet();
this.$hide("id_reminder")
this.$hide("id_exit")
this.$hide("id_cancel")
this.imgCnt = 0
this.crtSec = 0
this.crtMinu = 0
this.crtHour = 0
this.index = 0
this.checkFlagBash(this.imgCnt)
this.imgCnt++
this.text_reminder = "This screen has been clicked!"
globalThis.factoryTest.beepLT = 0
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.timerBeepId = this.$setInterval(this.timerBeep, 1000, [], this);
// this.timerScreenId = this.$setInterval(this.timerScreen, 1000, [], this);
},
refTime: function () {
if (this.crtSec >= 60) {
this.crtMinu++
this.crtSec = 0
}
if (this.crtMinu >= 60) {
this.crtHour++
this.crtMinu = 0
}
var depText = ""
var tempText = ""
if (this.crtHour < 10) {
depText = "0" + this.crtHour
} else {
depText = "" + this.crtHour
}
tempText = "" + depText + ":"
if (this.crtMinu < 10) {
depText = "0" + this.crtMinu
} else {
depText = "" + this.crtMinu
}
tempText += depText + ":"
if (this.crtSec < 10) {
depText = "0" + this.crtSec
} else {
depText = "" + this.crtSec
}
tempText += depText
this.textTimer = tempText
},
timerBeep: function () {
this.crtSec++
this.index++
this.refTime()
if (this.index % 2 == 0) {
// rd190_factory.pwm(0)
} else {
// rd190_factory.pwm(1)
}
if (this.crtSec % 20 == 0) {
// rd190_factory.soundOn()
}
if (this.crtHour >= 96) {
globalThis.factoryTest.beepLT = 1
// rd190_factory.pwm(0)
this.text_reminder = "Test time reached 96 hours!"
this.$show("id_reminder")
// router.push({
// path: "testLongTimeList"
// });
}
if (this.imgCnt < this.colorBash.length) {
} else {
this.imgCnt = 0
}
this.checkFlagBash(this.imgCnt)
this.imgCnt++
},
// timerScreen: function () {
// },
clearTimer: function () {
this.$clearInterval(this.timerBeepId);
// this.$clearInterval(this.timerScreenId);
this.$clearTimeout(this.showThrSecondId)
},
/*************** connect ***************/
/*************** event ***************/
activeScreen: function (node, topnode, x, y) {
this.$show("id_reminder")
this.showThrSecondId = this.$setTimeout(this.showOneSecond, 3000, [], this)
},
showOneSecond: function () {
this.$hide("id_reminder")
this.$clearTimeout(this.showThrSecondId)
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedExit: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
// globalThis.factoryTest.beepLT = 1
this.returnResult()
},
touchedCancel: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
// globalThis.factoryTest.beepLT = 2
this.timerSet();
this.$hide("id_exit")
this.$hide("id_cancel")
},
touchedTime: function (node, topNode, x, y) {
this.$show("id_exit")
this.$show("id_cancel")
// rd190_factory.pwm(0)
// this.$clearInterval(this.timerScreenId);
this.$clearInterval(this.timerBeepId);
},
returnResult: function () {
// rd190_factory.pwm(0)
router.push({
path: "factory_testList"
});
},
checkFlagBash: function (val) {
var temp = this.colorBash[val].val
this.$setBackgroundColor("id_color", temp)
val++
if (val < this.colorBash.length) {
} else {
val = 0
}
temp = this.colorBash[val].val
this.$setTextColor("id_time", temp)
},
touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url");
console.log("url:" + url);
if (url == undefined)
return;
if (url == "testTCard")
return;
router.push({
path: url
});
},
blockColorChange: function (relId, val) {
console.log(relId + ":" + val)
if (val == 1) {
this.$setBackgroundColor(relId, "#00ff00")
}
else if (val == 2) {
this.$setBackgroundColor(relId, "#ff0000")
} else {
this.$setBackgroundColor(relId, "#DCDCDC")
}
},
testStatus: function () {
this.blockColorChange(this.appItem[0].id, globalThis.factoryTest.beepLT)
this.blockColorChange(this.appItem[1].id, globalThis.factoryTest.beepLT)
},
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 1280;
height: 1280;
background-color: white;
}
/*********************************/
#id_color {
width: 1280;
height: 1280;
background-color: black;
}
#id_time {
top: 100;
width: 800;
height: 100;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: black;
background-color: transparent;
}
.class_msg {
top: 360;
width: 300;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 56;
color: black;
background-color: gainsboro;
}
#id_exit {
left: 50;
}
#id_cancel {
left: 450;
}
#id_reminder {
top: 216;
left: 0;
width: 800;
height: 52;
font-size: 45;
text-align: center;
color: #f76832;
}
.chooseBlock {
width: 260;
height: 235;
background-color: gainsboro;
border-radius: 5;
border-color: black;
border-width: 2;
}
.testName {
top: 50;
left: 0;
width: 260;
height: 45;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
}
.testInfo {
top: 140;
left: 0;
width: 260;
height: 80;
color: black;
text-align: center;
text-overflow: ellipsis;
font-size: 30;
}
</style>
\ No newline at end of file
<!--结构描述-->
<html>
<!--背景块区域 样式container 点击事件 bgclick-->
<div class="screen">
<text id="date">{{crtDate}}</text>
<text class="class_msg" id="id_ok">自检</text>
<text class="class_msg" id="id_ng">勿触</text>
</div>
</html>
<!--功能描述-->
<script>
//接口声明 使用路由功能模块
var router = require("@system.router");
var librtc = require("factory_rtc.js");
var file = require("file.js");
var libtime = require("factory_time.js");
//写入内容与操作
export default {
//数据写入 变量pagetitle 类型字符串 内容“页0”
data: {
crtDate: "检测RTC是否存在",
// crtDate: "08/14 周一 15:10:00",
},
dateClick: function (node, topnode, x, y) {
if (this.beepEn == 0) {
this.beepEn = 1;
// var dateObj = libtime.getCurrentTime();
// console.log("============dataObj=" + dateObj);
// console.log("dateObjType = " + typeof dateObj)
// this.crtDate = dateObj['tempstr1'] + dateObj['tempstr2']
this.crtDate = this.new_tiemr();
// console.log("============crtDate=" + this.crtDate);
} else {
this.beepEn = 0;
this.crtDate = "";
}
},
timerset: function () {
this.refreshTimeId = this.$setInterval(this.refreshTime, 1000, [], this);
this.Timedexitid = this.$setInterval(this.autotest, 1000, [], this);
},
onShow: function () {
console.log(this.$uri + "===========onShow=============");
// this.timerset();
this.beepEn = 1;
var ret = (librtc.getrtc("getRTC"))
console.log('ret===' + ret)
if (ret == 1) {
this.okShortDelayId = this.$setTimeout(this.okShortDelay, 1000, [], this);
} else {
this.ngShortDelayId = this.$setTimeout(this.ngShortDelay, 1000, [], this);
}
// var dateObj = libtime.getCurrentTime()
// console.log("dataObj=" + dateObj)
if (globalThis.factoryTest.rtcTimes == 100) {
librtc.ctrl("set", {
year: 2023,
month: 8,
day: 14,
hour: 15,
minute: 10,
second: 0,
});
globalThis.factoryTest.rtcTimes = 1;
// this.saveValue();
}
},
clearTimer: function () {
if (this.refreshTimeId) {
this.$clearInterval(this.refreshTimeId);
}
if (this.Timedexitid) {
this.$clearInterval(this.Timedexitid);
}
this.$clearTimeout(this.okShortDelayId);
this.$clearTimeout(this.ngShortDelayId);
this.autotestnum = 1;
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
okShortDelay: function () {
this.touchedOk("", "", "", "");
this.$clearTimeout(this.okShortDelayId);
},
ngShortDelay: function () {
this.touchedNg("", "", "", "");
this.$clearTimeout(this.ngShortDelayId);
},
refreshTime: function () {
this.crtDate = this.new_tiemr();
},
new_tiemr: function () {
var weekName = new Array(
"周日",
"周一",
"周二",
"周三",
"周四",
"周五",
"周六"
);
var newdata = new Date();
var years = newdata.getFullYear();
var year = String(years).substring(2, 4);
var month = newdata.getMonth() + 1;
var data1 = newdata.getDate();
var day = newdata.getDay(); //0-6
var houurs = newdata.getUTCHours();
var minutes = newdata.getMinutes();
var seconds = newdata.getSeconds();
let dataobj =
this.addZero(month) +
"/" +
this.addZero(data1) +
" " +
weekName[day] +
" " +
this.addZero(houurs) +
":" +
this.addZero(minutes) +
":" +
this.addZero(seconds);
return dataobj;
},
addZero: function (params) {
return params < 10 ? "0" + params : params;
},
autotest: function () {
if (this.autotestnum) {
this.autotestnum += 1;
} else this.autotestnum = 1;
if (this.autotestnum > 3) {
this.tests_timer();
}
},
tests_timer: function () {
console.log('this.crtDate===' + this.crtDate)
let ndata = this.crtDate.split(" ");
if (ndata[0] == "01/01") {
this.touchedNg("", "", "", "");
} else {
this.touchedOk("", "", "", "");
}
},
saveValue: function () {
var color = globalThis.factoryTest.color;
var touch = globalThis.factoryTest.touch;
var wifi = globalThis.factoryTest.wifi;
var tcard = globalThis.factoryTest.tcard;
var serial = globalThis.factoryTest.serial;
var serialNG = globalThis.factoryTest.serialNG;
var rtcTimes = globalThis.factoryTest.rtcTimes;
var beepLT = globalThis.factoryTest.beepLT;
var encoder = globalThis.factoryTest.encoder;
var rtc = globalThis.factoryTest.rtc;
var bgLight = globalThis.factoryTest.bgLight;
var obj = {
color: color,
touch: touch,
wifi: wifi,
tcard: tcard,
serial: serial,
serialNG: serialNG,
rtcTimes: rtcTimes,
beepLT: beepLT,
encoder: encoder,
rtc: rtc,
// "bgLight": bgLight,
};
console.log(obj);
file.write("product_res.json", obj);
},
touchedOk: function (node, topNode, x, y) {
globalThis.factoryTest.rtc = 1;
router.push({
path: "factory_testList",
});
},
touchedNg: function (node, topNode, x, y) {
globalThis.factoryTest.rtc = 2;
router.push({
path: "factory_testList",
});
},
};
</script>
<!--样式描述-->
<style>
/*背景块的样式*/
.screen {
width: 1280;
height: 1280;
background-color: black;
}
#date {
left: 40;
top: 50;
width: 600;
height: 60;
font-size: 55;
color: white;
text-align: center;
/* text-overflow: ellipsis; */
}
.class_msg {
top: 240;
width: 250;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 50;
color: red;
background-color: gainsboro;
}
#id_ok {
left: 75;
}
#id_ng {
left: 475;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onlongpress="touchedTime">
<div id="id_color"></div>
<text id="id_time">{{textTimer}}</text>
<text class="class_msg" id="id_ok" onclick="touchedOk">yes</text>
<text class="class_msg" id="id_ng" onclick="touchedNg">no</text>
</div>
</html>
<script>
var router = require("@system.router");
export default {
data: {
textTimer: "00:00:00",
crtSec: 0,
crtMinu: 0,
crtHour: 0,
colorBash: [
{
"val": 0xffffff,//纯白
"text": "white:#ffffff"//纯白
},
{
"val": 0xff0000,//纯红
"text": "red:#ff0000",//纯红
},
{
"val": 0x00ff00,//纯绿
"text": "green:#00ff00",//纯绿
},
{
"val": 0x0000ff,//纯蓝
"text": "blue:#0000ff",//纯蓝
},
{
"val": 0x000000,//纯黑
"text": "black:#000000",//纯黑
},
],
imgCnt: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.$hide("id_ok")
this.$hide("id_ng")
this.timerSet()
this.imgCnt = 0
this.crtSec = 0
this.crtMinu = 0
this.crtHour = 0
this.checkFlagBash(this.imgCnt)
this.imgCnt++
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer()
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer()
},
/*************** timer ***************/
timerSet: function () {
this.timerColor = this.$setInterval(this.normalTimerOut, 1000, [], this);
},
refTime: function () {
if (this.crtSec >= 60) {
this.crtMinu++
this.crtSec = 0
}
if (this.crtMinu >= 60) {
this.crtHour++
this.crtMinu = 0
}
var depText = ""
var tempText = ""
if (this.crtHour < 10) {
depText = "0" + this.crtHour
} else {
depText = "" + this.crtHour
}
tempText = "" + depText + ":"
if (this.crtMinu < 10) {
depText = "0" + this.crtMinu
} else {
depText = "" + this.crtMinu
}
tempText += depText + ":"
if (this.crtSec < 10) {
depText = "0" + this.crtSec
} else {
depText = "" + this.crtSec
}
tempText += depText
this.textTimer = tempText
},
normalTimerOut: function () {
if (this.imgCnt < this.colorBash.length) {
} else {
this.imgCnt = 0
}
this.checkFlagBash(this.imgCnt)
this.imgCnt++
this.crtSec++
this.refTime()
},
clearTimer: function () {
},
/*************** connect ***************/
/*************** event ***************/
touchedOk: function (node, topNode, x, y) {
globalThis.factoryTest.screen = 1
router.push({
path: "factory_testList"
});
},
touchedNg: function (node, topNode, x, y) {
globalThis.factoryTest.screen = 2
router.push({
path: "factory_testList"
});
},
touchedTime: function (node, topNode, x, y) {
this.$show("id_ok")
this.$show("id_ng")
this.$clearInterval(this.timerColor);
},
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
checkFlagBash: function (val) {
var temp = this.colorBash[val].val
this.$setBackgroundColor("id_color", temp)
val++
if (val < this.colorBash.length) {
} else {
val = 0
}
temp = this.colorBash[val].val
this.$setTextColor("id_time", temp)
},
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
#id_color {
width: 800;
height: 480;
background-color: black;
}
.class_msg {
top: 240;
width: 200;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: red;
background-color: gainsboro;
}
#id_ok {
left: 100;
}
#id_ng {
left: 500;
}
#id_time {
top: 100;
width: 800;
height: 100;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: black;
background-color: transparent;
}
</style>
<html>
<div class="screen" onclick="touchedScreen">
<text class="testLog">{{ testLogs }}</text>
<text class="testPct">{{ testPcts }}</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var process = require("@system.process");
var uart = require("uart.js");
var dpkt = require("dpkt.js");
function HeaderPacket() {
this.__hdr__ = [
["header", "H", 0x5aa5],
["data", "H", 0xffff],
];
this.__byteorder__ = ">";
}
export default {
data: {
testPct: 0,
testPcts: "",
testLogs: "",
testCnt: 0,
testData: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onReady: function () {
this.normalTimerOutId = this.$setTimeout(
this.normalTimerOut,
100,
[],
this
);
},
onShow: function () {
this.testPct = 0;
this.testCnt = 0;
console.log(this.$uri + "===========onShow=============");
this.timerSet();
globalThis.getUartData = this.getUartData;
// if (globalThis.uart1 != undefined) {
// globalThis.uart1.on("data", globalThis.getUartData, this);
// }
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.normalIntervalId = this.$setInterval(
this.normalInterval,
300,
[],
this
);
},
clearTimer: function () {
this.$clearInterval(this.normalIntervalId);
// this.$clearInterval(this.timer1);
this.$clearTimeout(this.normalTimerOutId);
// uart.close({
// path: "/dev/ttyS0",
// baudRate: 115200,
// dataBits: 8,
// stopbits: 1,
// parity: 0,
// mode: 'text' // mode="text/json/bin"
// })
},
normalInterval: function () {
console.log("------user uart send.----------------");
if (this.testCnt > 5) {
var tempVal = this.testPct;
if (tempVal >= 2) {
globalThis.factoryTest.serial = 1;
} else {
globalThis.factoryTest.serial = 2;
}
router.push({
path: "factory_testList",
});
}
var _person = new HeaderPacket();
var packet = dpkt.Packet(_person);
this.testData = Math.floor(Math.random() * 65535);
var obj = {
header: 0x5aa5,
data: this.testData,
};
var res = packet.pack(obj);
res.print();
try {
globalThis.uart1.write(res);
} catch (e) {
console.log("!!!ERROR:" + e)
}
this.testLogs =
"the times:" +
this.testCnt +
"\ndata:" +
this.testData +
"\nstatus:sent.";
this.testCnt++;
},
normalTimerOut: function () {
console.log("in timerout");
this.setUart();
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedScreen: function (node, topnode, x, y) {
router.push({
path: "factory_testList",
});
},
getUartDataBuf: function (data, length, prop) {
console.log("length:" + length);
data.print();
globalThis.getUartData(data, length, prop);
return;
// var _hpacket = new HeaderPacket();
// var hpacket = dpkt.Packet(_hpacket);
// var headerObj = hpacket.unpack(data);
// if (headerObj["header"] == 0x5aa5) {
// this.testLogs += "\nhad been received\nhead status:correct.";
// console.log("is correct.");
// var pData = headerObj["data"];
// console.log("the package data:" + pData);
// if (pData == this.testData) {
// this.testLogs += "\ndata:" + this.testData + "\nstatus:normal。";
// this.testPct++;
// var tempVal = Math.round((this.testPct / this.testCnt) * 100);
// this.testPcts = "pass rate:" + tempVal + "%";
// }
// } else {
// this.testLogs +=
// "\nhad been received\nhead status:abnormal-" + headerObj["header"];
// console.log("isnt correct.header:" + headerObj["header"]);
// }
// // this.testPct++;
// data.free();
// console.log("serial data read finished.");
// return;
},
getUartData: function (data, length, prop) {
var router = require("@system.router");
var indexObj = router.currentPage.$indexObj;
prop = indexObj;
console.log("length:" + length);
data.print();
var _hpacket = new HeaderPacket();
var hpacket = dpkt.Packet(_hpacket);
var headerObj = hpacket.unpack(data);
if (headerObj["header"] == 0x5aa5) {
prop.testLogs += "\nhad been received\nhead status:correct.";
console.log("is correct.");
var pData = headerObj["data"];
console.log("the package data:" + pData);
if (pData == prop.testData) {
prop.testLogs += "\ndata:" + prop.testData + "\nstatus:normal。";
prop.testPct++;
var tempVal = Math.round((prop.testPct / prop.testCnt) * 100);
prop.testPcts = "pass rate:" + tempVal + "%";
}
} else {
prop.testLogs +=
"\nhad been received\nhead status:abnormal-" + headerObj["header"];
console.log("isnt correct.header:" + headerObj["header"]);
}
// prop.testPct++;
data.free();
console.log("serial data read finished.");
return;
},
setUart: function () {
console.log("=====function setUart=====");
console.log(uart);
if (globalThis.uart1 != undefined) {
globalThis.getUartData = this.getUartData;
// globalThis.uart1.on("data", globalThis.getUartData, this);
// this.timer1 = this.$setInterval(
// () => {
// globalThis.uart1.read();
// //uart1.write(`11111111111111111111111111111111111111\n`)
// },
// 50,
// [],
// this
// );
return;
}
globalThis.getUartData = this.getUartData;
var port = "/dev/ttyS0";
console.log(require("@system.process"));
if (process.platform == "win32") {
console.log("its win32.");
port = "COM4";
}
console.log(port);
globalThis.uart1 = uart.open({
path: port,
baudRate: 115200,
dataBits: 8,
stopbits: 1,
parity: 0,
mode: "text", // mode="text/json/bin"
});
var prop = this;
try {
globalThis.uart1.on("data", this.getUartDataBuf, prop);
} catch (e) {
console.log("!!!ERROR:" + e)
}
this.timer1 = this.$setInterval(
() => {
try {
globalThis.uart1.read();
} catch (e) {
console.log("!!!ERROR:" + e)
}
//uart1.write(`11111111111111111111111111111111111111\n`)
},
50,
[],
this
);
},
};
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 1280;
height: 1280;
background-color: black;
}
/*********************************/
.testLog {
width: 1280;
height: 1280;
color: white;
text-align: left;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
.testPct {
top: 420;
width: 1280;
height: 40;
color: white;
text-align: left;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
</style>
\ No newline at end of file
<html>
<div class="screen" onclick="touchedScreen">
<text class="testLog">{{ testLogs }}</text>
<text class="testPct">{{ testPcts }}</text>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var process = require("@system.process");
var uart = require("uart.js");
var dpkt = require("dpkt.js");
function HeaderPacket() {
this.__hdr__ = [
["header", "H", 0x5aa5],
["data", "H", 0xffff],
];
this.__byteorder__ = ">";
}
export default {
data: {
testPct: 0,
testPcts: "",
testLogs: "",
testCnt: 0,
testData: 0,
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
},
onReady: function () {
this.normalTimerOutId = this.$setTimeout(
this.normalTimerOut,
100,
[],
this
);
},
onShow: function () {
this.testPct = 0;
this.testCnt = 0;
console.log(this.$uri + "===========onShow=============");
this.timerSet();
globalThis.getUartData = this.getUartData;
// if (globalThis.uart1 != undefined) {
// globalThis.uart1.on("data", globalThis.getUartData, this);
// }
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.normalIntervalId = this.$setInterval(
this.normalInterval,
300,
[],
this
);
},
clearTimer: function () {
this.$clearInterval(this.normalIntervalId);
// this.$clearInterval(this.timer1);
this.$clearTimeout(this.normalTimerOutId);
// uart.close({
// path: "/dev/ttyS0",
// baudRate: 115200,
// dataBits: 8,
// stopbits: 1,
// parity: 0,
// mode: 'text' // mode="text/json/bin"
// })
},
normalInterval: function () {
console.log("------user uart send.----------------");
if (this.testCnt > 5) {
var tempVal = this.testPct;
if (tempVal < 1) {
globalThis.factoryTest.serialNG = 1;
} else {
globalThis.factoryTest.serialNG = 2;
}
router.push({
path: "factory_testList",
});
}
var _person = new HeaderPacket();
var packet = dpkt.Packet(_person);
this.testData = Math.floor(Math.random() * 65535);
var obj = {
header: 0x5aa5,
data: this.testData,
};
var res = packet.pack(obj);
res.print();
try {
globalThis.uart1.write(res);
} catch (e) {
console.log("!!!ERROR:" + e)
}
this.testLogs =
"the times:" +
this.testCnt +
"\ndata:" +
this.testData +
"\nstatus:sent.";
this.testCnt++;
},
normalTimerOut: function () {
console.log("in timerout");
this.setUart();
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedScreen: function (node, topnode, x, y) {
router.push({
path: "factory_testList",
});
},
getUartDataBuf: function (data, length, prop) {
console.log("length:" + length);
data.print();
globalThis.getUartData(data, length, prop);
return;
// var _hpacket = new HeaderPacket();
// var hpacket = dpkt.Packet(_hpacket);
// var headerObj = hpacket.unpack(data);
// if (headerObj["header"] == 0x5aa5) {
// this.testLogs += "\nhad been received\nhead status:correct.";
// console.log("is correct.");
// var pData = headerObj["data"];
// console.log("the package data:" + pData);
// if (pData == this.testData) {
// this.testLogs += "\ndata:" + this.testData + "\nstatus:normal。";
// this.testPct++;
// var tempVal = Math.round((this.testPct / this.testCnt) * 100);
// this.testPcts = "pass rate:" + tempVal + "%";
// }
// } else {
// this.testLogs +=
// "\nhad been received\nhead status:abnormal-" + headerObj["header"];
// console.log("isnt correct.header:" + headerObj["header"]);
// }
// // this.testPct++;
// data.free();
// console.log("serial data read finished.");
// return;
},
getUartData: function (data, length, prop) {
var router = require("@system.router");
var indexObj = router.currentPage.$indexObj;
prop = indexObj;
console.log("length:" + length);
data.print();
var _hpacket = new HeaderPacket();
var hpacket = dpkt.Packet(_hpacket);
var headerObj = hpacket.unpack(data);
if (headerObj["header"] == 0x5aa5) {
prop.testLogs += "\nhad been received\nhead status:correct.";
console.log("is correct.");
var pData = headerObj["data"];
console.log("the package data:" + pData);
if (pData == prop.testData) {
prop.testLogs += "\ndata:" + prop.testData + "\nstatus:normal。";
prop.testPct++;
var tempVal = Math.round((prop.testPct / prop.testCnt) * 100);
prop.testPcts = "pass rate:" + tempVal + "%";
}
} else {
prop.testLogs +=
"\nhad been received\nhead status:abnormal-" + headerObj["header"];
console.log("isnt correct.header:" + headerObj["header"]);
}
// prop.testPct++;
data.free();
console.log("serial data read finished.");
return;
},
setUart: function () {
console.log("=====function setUart=====");
console.log(uart);
if (globalThis.uart1 != undefined) {
globalThis.getUartData = this.getUartData;
// globalThis.uart1.on("data", globalThis.getUartData, this);
// this.timer1 = this.$setInterval(
// () => {
// globalThis.uart1.read();
// //uart1.write(`11111111111111111111111111111111111111\n`)
// },
// 50,
// [],
// this
// );
return;
}
globalThis.getUartData = this.getUartData;
var port = "/dev/ttyS0";
console.log(require("@system.process"));
if (process.platform == "win32") {
console.log("its win32.");
port = "COM4";
}
console.log(port);
globalThis.uart1 = uart.open({
path: port,
baudRate: 115200,
dataBits: 8,
stopbits: 1,
parity: 0,
mode: "text", // mode="text/json/bin"
});
var prop = this;
try {
globalThis.uart1.on("data", this.getUartDataBuf, prop);
} catch (e) {
console.log("!!!ERROR:" + e)
}
this.timer1 = this.$setInterval(
() => {
try {
globalThis.uart1.read();
} catch (e) {
console.log("!!!ERROR:" + e)
}
//uart1.write(`11111111111111111111111111111111111111\n`)
},
50,
[],
this
);
},
};
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 1280;
height: 1280;
background-color: black;
}
/*********************************/
.testLog {
width: 1280;
height: 1280;
color: white;
text-align: left;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
.testPct {
top: 420;
width: 1280;
height: 40;
color: white;
text-align: left;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
</style>
\ No newline at end of file
<html>
<div class="screen">
<text class="functionBlock" id="id_ok" onclick="touchedOK">yes</text>
<text class="functionBlock" id="id_ng" onclick="touchedNG">no</text>
<text class="functionBlock" id="id_reset" onclick="touchedReset">{{crtText}}</text>
</div>
</html>
<script>
var router = require("@system.router");
var fs = require("@system.fs");
// var rd190_factory = require("factory_rd190_factory.js");
export default {
data: {
index: 0,
crtText: "未检测到TCard",
},
/*************** struct ***************/
onInit: function () {
//this.$setImageForceUpdate(true);
this.timeCnt = 0;
},
onShow: function () {
console.log(this.$uri + "===========onShow=============")
this.index = 0
this.timerSet();
},
onHide: function () {
console.log(this.$uri + "===========onHide=============")
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============")
this.clearTimer();
},
/*************** timer ***************/
timerSet: function () {
this.readFileId = this.$setInterval(this.readFile, 1000, [], this);
},
readFile: function () {
this.timeCnt++
var ret = fs.readFile("../../update.txt"); //返回二进制数据
if (this.timeCnt % 4 == 0) {
console.log("From update.txt ret=" + ret);
}
if (ret == 1) {
this.crtText = "检测到TCard";
globalThis.factoryTest.tcard = 1
this.$setBackgroundColor("id_reset", 0x00ff00)
}
else {
this.crtText = "未检测到TCard";
globalThis.factoryTest.tcard = 2
this.$setBackgroundColor("id_reset", 0xff0000)
}
},
clearTimer: function () {
this.$clearInterval(this.readFileId);
},
/*************** connect ***************/
/*************** event ***************/
/*************** gesture ***************/
onGestureEvent: function (dir, x, y) {
console.log(dir + " " + x + " " + y);
},
/*************** work ***************/
touchedOK: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
this.returnResult()
// rd190_factory.pwm(1)
},
touchedNG: function (node, topnode, x, y) {
console.log("Enable:" + this.index);
this.returnResult()
// rd190_factory.pwm(1)
},
returnResult: function () {
// rd190_factory.pwm(0)
router.push({
path: "factory_testList"
});
}
}
</script>
<style>
.screen {
left: 0px;
top: 0px;
width: 800;
height: 480;
background-color: gray;
}
/*********************************/
.chooseBlock {
width: 240;
height: 160;
border-radius: 5;
border-width: 2;
border-color: white;
background-color: gainsboro;
}
.cbName {
top: 65;
width: 240;
height: 50;
color: black;
text-align: center;
text-overflow: ellipsis;
background-color: transparent;
font-size: 35;
}
#id_cb1 {
left: 20;
top: 20;
}
#id_cb2 {
left: 280;
top: 20;
}
#id_cb3 {
left: 540;
top: 20;
}
#id_cb4 {
left: 20;
top: 200;
}
#id_cb5 {
left: 280;
top: 200;
}
#id_cb6 {
left: 540;
top: 200;
}
.functionBlock {
width: 320;
height: 100;
color: black;
border-radius: 5;
border-width: 2;
border-color: black;
background-color: gainsboro;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
}
#id_ok {
left: 40;
top: 360;
}
#id_ng {
left: 440;
top: 360;
}
#id_reset {
left: 240;
top: 180;
}
</style>
\ No newline at end of file
<!--结构描述-->
<html>
<!--背景块区域 样式container 点击事件 bgclick-->
<div class="screen">
<text id="wifiInfo">{{crtWifiInfo}}</text>
<text id="wifiStatus">{{crtWifi}}</text>
<text id="wifi_mac" style="font-size: 40; left:0;top: 500; width: 700; height: 500; text-align: center;">{{wifi_mac}}</text>
</div>
</html>
<!--功能描述-->
<script>
//接口声明 使用路由功能模块
var router = require("@system.router");
// var libwifi = require("factory_wifi.js");
var file = require("file.js");
var macGetId = null;
//写入内容与操作
export default {
//数据写入 变量pagetitle 类型字符串 内容“页0”
data: {
crtWifi: "Start testing wifi connect...",
crtWifiInfo: "",
wifi_mac: ""
},
onShow: function () {
var mac = null;
// var mac = libwifi.getWifiMac();
this.wifi_mac = "mac:"+mac;
console.log(this.$uri + "===========onShow=============");
this.crtWifi = "Start testing wifi connect...";
this.SSID = "re832b_test 12345678";
this.crtWifiInfo = "Scan..." + this.SSID;
this.wifiFlag = 0;
this.signal = -61;
this.shortDelayId = this.$setTimeout(this.shortDelay, 200, [], this);
},
clearTimer: function () {
this.$clearTimeout(this.shortDelayId);
this.$clearTimeout(this.okShortDelayId);
this.$clearTimeout(this.ngShortDelayId);
this.$clearTimeout(this.backtoListId);
this.autotestnum = 1;
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
shortDelay: function () {
var ret = 0;
// ret = libwifi.testWifiConnect("testWifi", this.SSID);
this.wifiFlag = ret;
// ret = globalThis.factoryTest.wifi;
console.log('ret===' + ret);
var signal = null;
// var signal = libwifi.testWifiConnect("getSignal", this.SSID); //返回十进制数据
if (signal != undefined) {
this.signal = signal;
}
console.log('this.signal===' + this.signal);
var result = 0;
if (ret == 1 && (this.signal >= -60 && this.signal != undefined)) {
result = 1;
console.log('result===' + result);
}
if (result == 1) {
this.okShortDelayId = this.$setTimeout(this.okShortDelay, 500, [], this);
} else {
this.ngShortDelayId = this.$setTimeout(this.ngShortDelay, 500, [], this);
}
this.$clearTimeout(this.shortDelayId);
},
backtoList: function () {
router.push({
path: "factory_testList",
});
this.$clearTimeout(this.backtoListId);
},
okShortDelay: function () {
globalThis.factoryTest.wifi = 1;
this.crtWifiInfo = this.SSID + " || " + this.signal;
this.crtWifi = "Wifi Connection Successful!";
this.$clearTimeout(this.okShortDelayId);
this.backtoListId = this.$setTimeout(this.backtoList, 1000, [], this);
},
ngShortDelay: function () {
globalThis.factoryTest.wifi = 2;
if (this.wifiFlag != 1) {
this.crtWifiInfo = "Not Found " + this.SSID;
}
else {
this.crtWifiInfo = this.SSID + " || " + this.signal;
}
this.crtWifi = "Wifi Connection Failed!";
this.$clearTimeout(this.ngShortDelayId);
this.backtoListId = this.$setTimeout(this.backtoList, 1000, [], this);
},
saveValue: function () {
var color = globalThis.factoryTest.color;
var touch = globalThis.factoryTest.touch;
var wifi = globalThis.factoryTest.wifi;
var tcard = globalThis.factoryTest.tcard;
var serial = globalThis.factoryTest.serial;
var serialNG = globalThis.factoryTest.serialNG;
var rtcTimes = globalThis.factoryTest.rtcTimes;
var beepLT = globalThis.factoryTest.beepLT;
var encoder = globalThis.factoryTest.encoder;
var rtc = globalThis.factoryTest.rtc;
var bgLight = globalThis.factoryTest.bgLight;
var obj = {
color: color,
touch: touch,
wifi: wifi,
tcard: tcard,
serial: serial,
serialNG: serialNG,
rtcTimes: rtcTimes,
beepLT: beepLT,
encoder: encoder,
rtc: rtc,
// "bgLight": bgLight,
};
console.log(obj);
file.write("product_res.json", obj);
},
};
</script>
<!--样式描述-->
<style>
/*背景块的样式*/
.screen {
width: 1280;
height: 1280;
background-color: black;
}
#wifiInfo {
left: 0;
top: 128;
width: 720;
height: 150;
font-size: 44;
color: white;
text-align: center;
/* text-overflow: ellipsis; */
}
#wifiStatus {
left: 0;
top: 240;
width: 720;
height: 60;
font-size: 44;
color: white;
text-align: center;
/* text-overflow: ellipsis; */
}
.class_msg {
top: 240;
width: 250;
height: 100;
border-radius: 10;
border-width: 2;
border-color: white;
text-align: center;
text-overflow: ellipsis;
font-size: 50;
color: red;
background-color: gainsboro;
}
#id_ok {
left: 75;
}
#id_ng {
left: 475;
}
</style>
\ No newline at end of file
<html>
<div class="screen" id="id_screen">
<div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;">
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
</div>
<text class="fontsize60" id="title_TEXT"
style="left:0;top: 10;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title_TEXT }}</text>
<text class="fontsize60" id="title2_TEXT"
style="left:0;top: 640;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title2_TEXT }}</text>
<text class="fontsize40" id="data_TEXT"
style="left:0;top: 80;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
data_TEXT }}</text>
<text class="fontsize40" id="author_TEXT"
style="left:0;top: 710;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
author_TEXT }}</text>
<div id="exit" style="width: 300;height: 80;left:200;top:1180;background-color: blue; border-radius: 10px;"
onclick="exit">
<text class="fontsize60" id="exit_TEXT"
style="width: 300;height: 80;text-align: center; background-color: transparent;color: white;">{{
exit_TEXT }}</text>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
// var lib = require("factory_fiveInch.js");
var macGetId = null;
var qosGetId = null;
// var pageInterval = null;
export default {
data: {
title_TEXT: "E-SIM信息",
title2_TEXT: "ICCID",
data_TEXT: "NC",
author_TEXT: "NC",
exit_TEXT: "退出",
},
onInit() {
},
onShow: function () {
this.checkCnt = 0;
// lib.start();
if (macGetId != null) {
clearInterval(macGetId);
macGetId = null;
}
macGetId = setInterval(() => {
// this.author_TEXT = lib.read("data");
}, 200);
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
qosGetId = setInterval(() => {
// this.data_TEXT = lib.read("author");
}, 200);
},
exit: function (node, topNode, x, y) {
this.exitEvent();
},
exitEvent: function () {
if (macGetId != null) {
clearTimeout(macGetId);
macGetId = null;
}
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
// lib.close();
router.push({
path: 'factory_testList'
})
},
};
</script>
<style>
.screen {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.trueActiveDiv {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.gifIcon {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.fontsize60 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: #ffffff;
background-color: transparent;
}
.fontsize40 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
<html>
<div class="screen" id="id_screen">
<div class="trueActiveDiv" id="id_gifIconDiv" style="top:0; color: black; background-color: black;">
<!-- <image class="gifIcon" id="id_gifIcon" :src="gifIconSrc" style="color: black; background-color: black;"></image> -->
</div>
<text class="fontsize60" id="title_TEXT"
style="left:0;top: 10;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title_TEXT }}</text>
<text class="fontsize60" id="title2_TEXT"
style="left:0;top: 640;width: 728;height: 1280;text-align: center; background-color: transparent;color: blue;">{{
title2_TEXT }}</text>
<text class="fontsize40" id="imei_TEXT"
style="left:0;top: 80;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
imei_TEXT }}</text>
<text class="fontsize40" id="data_TEXT"
style="left:0;top: 710;width: 728;height: 1280;text-align: center; background-color: transparent;color: white;">{{
data_TEXT }}</text>
<div id="exit" style="width: 300;height: 80;left:200;top:1180;background-color: blue; border-radius: 10px;"
onclick="exit">
<text class="fontsize60" id="exit_TEXT"
style="width: 300;height: 80;text-align: center; background-color: transparent;color: white;">{{
exit_TEXT }}</text>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
// var lib = require("factory_testlte.js");
var macGetId = null;
var qosGetId = null;
// var pageInterval = null;
export default {
data: {
title_TEXT: "4G信息",
title2_TEXT: "IMEI",
imei_TEXT: "NC",
data_TEXT: "NC",
exit_TEXT: "退出",
},
onInit() {
},
onShow: function () {
// lib.start();
if (macGetId != null) {
clearInterval(macGetId);
macGetId = null;
}
macGetId = setInterval(() => {
// this.data_TEXT =lib.read("data");
}, 200);
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
qosGetId = setInterval(() => {
// this.imei_TEXT = lib.read("imei");
}, 200);
},
exit: function (node, topNode, x, y) {
this.exitEvent();
},
exitEvent: function () {
if (macGetId != null) {
clearTimeout(macGetId);
macGetId = null;
}
if (qosGetId != null) {
clearInterval(qosGetId);
qosGetId = null
}
// lib.close();
router.push({
path: 'factory_testList'
})
},
};
</script>
<style>
.screen {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.trueActiveDiv {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.gifIcon {
width: 728;
height: 1280;
background-color: black;
color: black;
}
.fontsize60 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 60;
color: #ffffff;
background-color: transparent;
}
.fontsize40 {
width: 728;
height: 1280;
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
</style>
\ No newline at end of file
# WiFi连接脚本
# 用法: ./connect_wifi.sh <SSID> <PSK>
if [ $# -ne 2 ]; then
echo "用法: $0 <SSID> <PSK>"
exit 1
fi
SSID=$1
PSK=$2
# 终止现有的udhcpc进程
killall -9 udhcpc
# 配置WiFi网络
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 set_network 0 ssid '\"'$SSID'\"'
usleep 10000 # 10ms缓冲
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 set_network 0 psk '\"'$PSK'\"'
usleep 10000 # 10ms缓冲
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 save_config
usleep 10000 # 10ms缓冲
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 reconfigure
usleep 200000 # 200ms缓冲设置和执行
# 重新启用网络连接
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 disable_network 0
usleep 10000 # 10ms缓冲
wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 enable_network 0
usleep 500000 # 500ms缓冲联网状态
# 启动DHCP客户端
udhcpc -b -i wlan0 -t 1 -A 1 -R -H test
echo "WiFi连接命令已执行"
{"color":2,"touch":0,"wifi":2,"sound":0,"uartComm":0,"bright":0,"licenseAuthor":0,"systemCheck":0,"clearAll":0,"start":0}
\ No newline at end of file
{"color":1,"touch":2,"wifi":0,"sound":0,"uartComm":0,"bright":0,"licenseAuthor":0,"systemCheck":0,"clearAll":0,"start":0}
\ 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