Commit 8954c7e3 authored by waterword's avatar waterword

完成产测

parent 87feed56
......@@ -7,6 +7,12 @@
// console.trace = function () {
// }
console.debug = function (text) {
var date = new Date()
text = `========= [${date}] ${text}`
print(text)
}
function initEventLister() {
var EventEmitter = require('@system.events');
globalThis.eventEmitter = new EventEmitter();
......@@ -114,7 +120,7 @@ EvueApp({
'onDestroy': onDestroy,
'onMoveEvent': onMoveEvent,
'onGestureEvent': onGestureEvent,
'paths': ["../RD190/", "../../enode_modules/","./../RE860A/logicJS/","./../RE860A/common/","./../RE860A/common/","./../RE860A/","./../re860a-v1.0/","./../re860a-v1.0/logicJS/","./../re860a-v1.0/common/","./factoryTest_plugin/", "./factoryTest_plugin/ref/", "./factoryTestItem/"],
'paths': ["../RD190/", "../../enode_modules/","./../RE860A/logicJS/","./../RE860A/common/","./../RE860A/","./../re860a-v1.0/","./../re860a-v1.0/logicJS/","./../re860a-v1.0/common/","./factoryTest_plugin/", "./factoryTest_plugin/ref/", "./factoryTestItem/"],
'uri': 'factory_testList',
// 'uri': 'testLongTimeList',
'minFreeJSHeapSize': 200
......
......@@ -5,19 +5,22 @@
<!-- </div> -->
<div style="left:10;top: 10;width: 460;height: 55; background-color: #99D0F7;">
<text class="fontsize40" id="title_TEXT" style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
<text class="fontsize40" id="title_TEXT"
style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
title_TEXT }}</text>
</div>
<div style="left:140 ; top:120 ;width: 200;height: 96;background-color: #99D0F7">
<text class="testReturn" id="brightnessValueText" style="top: 15;color: rgb(43, 123, 25);text-align: center;width: 200;">{{crtBrightnessValue}}</text>
<text class="testReturn" id="brightnessValueText"
style="top: 15;color: rgb(43, 123, 25);text-align: center;width: 200;">{{crtBrightnessValue}}</text>
</div>
<div style="width: 480;height: 72;top: 230;">
<!-- <image class="brightnessPng" style="left:23;top:20;" :src="lowBrightnessPngSrc"></image> -->
<div class="setBrightnessLineDivBg"></div>
<div class="setBrightnessLineShowDiv" id="id_setBrightnessLineShowDiv"></div>
<slider id="setBrightnessSlider" min="1" max="100" value="100" onValueChanged="onBrightnessValueChanged" onrelease="onBrightnessValueRelease">
<slider id="setBrightnessSlider" min="1" max="100" value="100" onValueChanged="onBrightnessValueChanged"
onrelease="onBrightnessValueRelease">
</slider>
<!-- <image class="brightnessPng" style="left:425;top:20;" :src="highBrightnessPngSrc"></image> -->
</div>
......@@ -27,13 +30,16 @@
<div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="color: #000000; top: 15;">back</text>
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton"
style="color: #000000; top: 15;">back</text>
</div>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton" style="color: #F44236;top: 15;">NG</text>
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton"
style="color: #F44236;top: 15;">NG</text>
</div>
<div style="left:220 ; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" id="id_yes" onpress="touchedScreen" onclick="touchedYesButton" style="color: #000000;top: 15;left: 0; ">PASS</text>
<text class="testReturn" id="id_yes" onpress="touchedScreen" onclick="touchedYesButton"
style="color: #000000;top: 15;left: 0; ">PASS</text>
</div>
</div>
......@@ -91,9 +97,9 @@
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 1;
router.push({
path: "factory_testList",
});
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestBright);")
yesJumpPage.yesGoToNextPage("factoryTestBright");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 2;
......
......@@ -133,8 +133,9 @@
// router.push({
// path: "factory_testList"
// }
var yesJumpPage = require("yesJumpPage.js");
yesJumpPage.yesGoToNextPage(this);
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestColor);")
yesJumpPage.yesGoToNextPage("factoryTestColor");
//);
},
......
......@@ -5,13 +5,15 @@
<!-- </div> -->
<div style="left:20;top: 10;width: 440;height: 55; background-color: #99D0F7;">
<text class="fontsize40" id="title_TEXT" style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
<text class="fontsize40" id="title_TEXT"
style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
title_TEXT }}</text>
</div>
<!-- <div style="left:140 ; top:120 ;width: 200;height: 96;background-color: #99D0F7"> -->
<text class="testReturn" id="brightnessValueText" style="top: 200;color: rgb(246, 250, 3);text-align: center;width: 480;">{{crtBrightnessValue}}</text>
<text class="testReturn" id="brightnessValueText"
style="top: 200;color: rgb(246, 250, 3);text-align: center;width: 480;">{{crtBrightnessValue}}</text>
<!-- </div> -->
......@@ -20,19 +22,24 @@
<div style="left:25;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="color: #000000; top: 15;">back</text>
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton"
style="color: #000000; top: 15;">back</text>
</div>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton" style="color: #F44236;top: 15;">NG</text>
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton"
style="color: #F44236;top: 15;">NG</text>
</div>
<div style="left:220 ; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" id="id_startTest" onpress="touchedScreen" onclick="touchedstartTestButton" style="color: #000000;top: 0;left: 0; ">开始测试</text>
<text class="testReturn" id="id_startTest" onpress="touchedScreen" onclick="touchedstartTestButton"
style="color: #000000;top: 0;left: 0; ">开始测试</text>
</div>
<!-- test -->
<!-- <div id="id_yes" style=" left:330 ;top: 0; width: 100;height: 96;background-color: #FF9700;"> -->
<div id="id_yes" style=" left:330 ;top: -480; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" onpress="touchedScreen" onclick="touchedYesButton" style="color: #000000;top: 15;left: 0; ">PASS</text>
</div>
<text class="testReturn" onpress="touchedScreen" onclick="touchedYesButton"
style="color: #000000;top: 15;left: 0; ">PASS</text>
</div>
</div>
......@@ -80,13 +87,13 @@
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1;
router.push({
path: "factory_testList",
});
globalThis.factoryTest.licenseAuthor = 1;
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestLicenseAuthor);")
yesJumpPage.yesGoToNextPage("factoryTestLicenseAuthor");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2;
globalThis.factoryTest.licenseAuthor = 2;
router.push({
path: "factory_testList",
});
......
......@@ -81,9 +81,9 @@
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1;
router.push({
path: "factory_testList",
});
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
yesJumpPage.yesGoToNextPage("factoryTestSound");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2;
......
......@@ -19,6 +19,7 @@
var lvgl = require("@native.lvgl7");
var point_div = undefined;
var point_div_list = undefined;
var FirstStartupFlag = 1;
export default {
data: {
......@@ -154,7 +155,7 @@
}, getPointTopDiv)
}
if (point_div_list) {
//point_div.removeChild(point_div_list)
point_div.removeChild(point_div_list)
return;
}
point_div_list = document.createElement('div', {
......@@ -173,24 +174,73 @@
"background-color": "#ff0000",
}, point_div_list)
},
drawChanlePointEvent: function (x, y) {
document.createElement('div', {
top: y,
left: x,
width: 4,
height: 4,
"background-color": "#ff0000",
}, point_div_list)
},
resetDrawDiv: function () {
// if (point_div_list) {
point_div.removeChild(point_div_list)
// return;
//}
point_div_list = document.createElement('div', {
top: 0,
left: 0,
width: 480,
height: 480,
}, point_div)
},
onInit: function () {
},
onShow: function () {
console.log(this.$uri + "===========onShow=============");
console.log(this.$uri + "===========factoryTestTouch onShow=============");
console.log("FirstStartupFlag:" + FirstStartupFlag);
if (FirstStartupFlag == 1) {
this.timerSet();
this.dataInit();
this.pointInit();
}
this.dataInit();
// this.$enableMouseMoveEvent(true);
},
exitEvent: function () {
FirstStartupFlag = 0;
var x = 0;
var y = 0;
var divheight = 32;
var divwidth = 32;
var xmax = 480 / divwidth;
var ymax = 480 / divheight;
var relId = "";
for (x = 0; x < xmax; x++) {
for (y = 0; y < ymax; y++) {
if (x == 0 || y == 0 || x == 14 || y == 14 ||
x == ymax - 1 - y || x == ymax - 1 - x ||
y == xmax - 1 - y || y == x) {
relId = x + "_" + y;
this.refChannleDivColor(relId);
}
}
}
this.resetDrawDiv();
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
console.log(this.$uri + "===========factoryTestTouch onHide=============");
this.clearTimer();
this.exitEvent();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
console.log(this.$uri + "===========factoryTestTouch onQuit=============");
this.clearTimer();
this.exitEvent();
},
/*************** timer ***************/
timerSet: function () {
......@@ -283,6 +333,16 @@
// this.$setBackgroundColor(relId, 0x00ff00);
// // this.$setPos(relId, gridX * 32, gridY * 32); // 确保位置正确
// },
refChannleDivColor: function (coor) {
var relId = "id_block" + coor;
console.log("refDivColor - relId: " + relId);
if (document.getElementById(relId)) {
console.log("Element found: " + relId);
this.$setBackgroundColor(relId, 0xFFFFFF);
} else {
console.log("Element not found: " + relId);
}
},
refDivColor: function (coor) {
var relId = "id_block" + coor;
......@@ -304,7 +364,6 @@
var coor = this.figCoor(gx, gy);
if (coor == undefined) return;
this.refDivColor(coor);
},
/*************** work ***************/
// onmousemove: function (gx, gy, topNode, x, y) {
......@@ -347,9 +406,9 @@
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 1;
router.push({
path: "factory_testList",
});
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestTouch);")
yesJumpPage.yesGoToNextPage("factoryTestTouch");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 2;
......
......@@ -5,33 +5,41 @@
<!-- </div> -->
<div style="left:20;top: 10;width: 440;height: 55; background-color: #99D0F7;">
<text class="fontsize40" id="title_TEXT" style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
<text class="fontsize40" id="title_TEXT"
style="left:0;top: 0;width: 460;height: 55;text-align: center; background-color: transparent;color: black;">{{
title_TEXT }}</text>
</div>
<div style="left:140 ; top:80 ;width: 200;height: 96;">
<text class="fontsize24" style="width: 200; top: 0;color: rgb(0, 0, 0);text-align: center;">发送次数</text>
<div style="left:0 ; top:34 ;width: 200;height: 96;background-color: #99D0F7">
<text class="fontsize24" id="sendCommValueText" style="top: 15;width: 200;color:rgb(44, 123, 24);text-align: center;">{{sendCommValueText}}</text>
<text class="fontsize24" id="sendCommValueText"
style="top: 15;width: 200;color:rgb(44, 123, 24);text-align: center;">{{sendCommValueText}}</text>
</div>
</div>
<div style="left:140 ; top:190 ;width: 200;height: 96;">
<text class="fontsize24" style="width: 200; top: 0;color: rgb(0, 0, 0);text-align: center;">发送次数</text>
<div style="left:0 ; top:34 ;width: 200;height: 96;background-color: #99D0F7">
<text class="fontsize24" id="recvCommValueText" style="top: 15;width: 200;color:rgb(44, 123, 24);text-align: center;">{{recvCommValueText}}</text>
<text class="fontsize24" id="recvCommValueText"
style="top: 15;width: 200;color:rgb(44, 123, 24);text-align: center;">{{recvCommValueText}}</text>
</div>
</div>
<div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton" style="color: #000000; top: 15;">back</text>
<text class="testReturn" id="id_back" onpress="touchedScreen" onclick="touchedBackButton"
style="color: #000000; top: 15;">back</text>
</div>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;">
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton" style="color: #F44236;top: 15;">NG</text>
<text class="testReturn" id="id_ng" onpress="touchedScreen" onclick="touchedNGButton"
style="color: #F44236;top: 15;">NG</text>
</div>
<!-- test -->
<!-- <div id="id_yes" style=" left:220 ;top: 0; width: 100;height: 96;background-color: #FF9700;"> -->
<div id="id_yes" style=" left:330 ;top: -480; width: 100;height: 96;background-color: #FF9700;">
<text class="testReturn" onpress="touchedScreen" onclick="touchedYesButton" style="color: #000000;top: 15;left: 0; ">PASS</text>
<text class="testReturn" onpress="touchedScreen" onclick="touchedYesButton"
style="color: #000000;top: 15;left: 0; ">PASS</text>
</div>
</div>
......@@ -61,13 +69,13 @@
console.log("sendValue:" + sendValue);
sendValue += 1;
packet_cmd.pack_cmd_packet_0x50();
this.sendCommValueText ="" + sendValue;
this.recvCommValueText ="" + userData.factoryRecvCnt;
this.sendCommValueText = "" + sendValue;
this.recvCommValueText = "" + userData.factoryRecvCnt;
if (userData.factoryRecvCnt > 0) {
this.$setY("id_yes", 0);
}
},
uartComm:function(){
uartComm: function () {
var serialPortName = undefined
// var serialManager = require("serialmanager.js");
var process = require("@system.process");
......@@ -78,10 +86,12 @@
else {
serialPortName = "/dev/ttyProto"
}
var process = require("@system.process")
if (process.platform != "win32") {
serialManager.open(serialPortName, function (isSuccess, status) {
console.log("=========open_async [".concat(isSuccess, "] [").concat(status, "]========="));
});
}
},
onShow: function () {
......@@ -104,11 +114,11 @@
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0;
router.push({
path: "factory_testList",
});
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestUartComm);")
yesJumpPage.yesGoToNextPage("factoryTestUartComm");
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 2;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -221,9 +221,12 @@
this.movePage("systemId"+this.pagecnt, "systemId1");
this.pagecnt = 1;
router.push({
path: "factory_testList",
});
//添加检查全绿为测试功能
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestsystemCheck);")
yesJumpPage.yesGoToNextPage("factoryTestsystemCheck");
},
hideNextPageButton: function () {
......
<html>
<div class="screen" onclick="touchedBg">
<template for="appItem" key="app" index="index">
<div class="chooseBlock" id="app.id" :url="app.startup" :ena="app.en" :top="app.top" :left="app.left" onclick="touchedBlock">
<div class="chooseBlock" id="app.id" :url="app.startup" :ena="app.en" :top="app.top" :left="app.left"
onclick="touchedBlock">
<text class="testName" :url="app.startup" :ena="app.en">{{
app.name
}}</text>
......@@ -18,12 +19,14 @@
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var file = require("file.js");
var bglight = require("factory_bglight.js");
// var systemCtrl = require("systemCtrl.js");
var systemCtrl = require("systemCtrl.js");
var yesJumpPage = require("yesJumpPage.js");
var yesJumpPage = require("factoryYesJumpPage.js");
// var _userdata = require("userdata.js");
// var userData = _userdata.userData;
export default {
......@@ -48,6 +51,7 @@
top: 10,
left: 20,
en: 1,
index: 1,
},
{
id: "id_factoryTestTouch",
......@@ -56,6 +60,7 @@
top: 10,
left: 130,
en: 1,
index: 2,
},
{
id: "id_factoryTestWifi",
......@@ -64,6 +69,7 @@
top: 10,
left: 240,
en: 1,
index: 3,
},
{
id: "id_factoryTestSound",
......@@ -72,38 +78,42 @@
top: 10,
left: 350,
en: 1,
index: 4,
},
{
id: "id_factoryTestBle",
name: "蓝牙",
startup: "factoryTestBle",
top: 100,
left: 20,
en: 0,
},
// {
// id: "id_factoryTestBle",
// name: "蓝牙",
//startup: "factoryTestBle",
// top: 100,
// left: 20,
// en: 0,
//},
{
id: "id_factoryTestUartComm",
name: "无极性通信",
startup: "factoryTestUartComm",
top: 100,
left: 130,
left: 20,
en: 1,
index: 5,
},
{
id: "id_factoryTestBright",
name: "亮度调节",
startup: "factoryTestBright",
top: 100,
left: 240,
left: 130,
en: 1,
index: 6,
},
{
id: "id_factoryTestLicenseAuthor",
name: "license授权",
startup: "factoryTestLicenseAuthor",
top: 100,
left: 350,
left: 240,
en: 1,
index: 7,
},
{
id: "id_factoryTestsystemCheck",
......@@ -112,6 +122,7 @@
top: 370,
left: 20,
en: 1,
index: 0,
},
{
id: "id_factoryTestClearAll",
......@@ -120,22 +131,16 @@
top: 370,
left: 130,
en: 1,
},
{
id: "id_factoryTestPCBA",
name: "PCBA",
startup: "factoryTestPCBA",
top: 370,
left: 240,
en: 1,
index: 0,
},
{
id: "id_factoryTestStart",
name: "开始测试",
startup: "factoryTestStart",
top: 370,
left: 350,
left: 240,
en: 1,
index: 0,
},
],
......@@ -143,6 +148,7 @@
/*************** struct ***************/
onInit: function () {
//this.activePage= "id_languageBasicPage";
this.onlyOnceFlag = 0;
if (globalThis.factoryTest == undefined) {
var obj = {
......@@ -150,28 +156,28 @@
touch: 0,
wifi: 0,
sound: 0,
ble: 0,
uartComm: 0,
bright: 0,
licenseAuthor: 0,
systemCheck: 0,
clearAll: 0,
pcba: 0,
start: 0,
};
globalThis.factoryTest = obj;
}
this.initializeFactoryTestProperties();
yesJumpPage.initPage();
},
initializeFactoryTestProperties: function () {
const properties = [
"color", "touch", "wifi", "sound", "ble",
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor",
"systemCheck", "clearAll", "pcba", "start"
"systemCheck", "clearAll", "start"
];
properties.forEach(prop => {
if (globalThis.factoryTest[prop] === undefined) {
globalThis.factoryTest[prop] = 0;
......@@ -185,12 +191,13 @@
var appVersion = "The code has been annotated"
console.log("sysVersion=" + sysVersion);
console.log("appVersion=" + appVersion);
this.crtSNValue = sysVersion + "-" + appVersion;
//this.crtSNValue = sysVersion + "-" + appVersion;
this.crtSNValue = userData.aboutSNValue || "NG"
yesJumpPage.initPage(this.appItem);
yesJumpPage.testCode(this)
},
onShow: function () {
console.log(this.$uri + "===========onShow=============");
initShow: function () {
this.snShow();
this.timerSet();
......@@ -211,13 +218,20 @@
this.saveValue();
},
onShow: function () {
console.log(this.$uri + "===========onShow=============");
this.initShow();
},
restoreFactoryTestValues: function (obj) {
const properties = [
"color", "touch", "wifi", "sound", "ble",
"color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor",
"systemCheck", "clearAll", "pcba", "start"
"systemCheck", "clearAll", "start"
];
properties.forEach(prop => {
if (obj[prop] !== undefined) {
globalThis.factoryTest[prop] = obj[prop];
......@@ -255,39 +269,54 @@
touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url");
console.log("===============url:" + url + "=============== topnode:"+topnode);
console.log("===============url:" + url + "=============== topnode:" + topnode);
if (url == undefined) return;
var en = parseInt(this.$eval(topnode, ":ena"));
if (en != 1) {
return;
}
if (url == "factoryTestClearAll") {
this.clearValue()
console.log("==============factoryTestClearAll================");
this.initShow();
return;
}
if (url == "factoryTestStart") {
console.log("==============factoryTestStart================");
url = "factoryTestColor";
}
router.push({
path: url,
});
},
blockColorChange: function (relId, val) {
console.log("relId:" + relId + " val:" + val);
const colors = [0x9E9E9E, 0x4CB050, 0xF44236];
this.$setBackgroundColor(relId, colors[Math.min(val, 2)]);
},
testStatus: function () {
const testMappings = [
{ index: 0, property: "color" },
{ index: 1, property: "touch" },
{ index: 2, property: "wifi" },
{ index: 3, property: "sound" },
{ index: 4, property: "ble" },
{ index: 5, property: "uartComm" },
{ index: 6, property: "bright" },
{ index: 9, property: "systemCheck" },
{ index: 10, property: "clearAll" },
{ index: 11, property: "pcba" },
{ index: 12, property: "start" },
{ index: 4, property: "uartComm" },
{ index: 5, property: "bright" },
{ index: 6, property: "licenseAuthor" },
{ index: 7, property: "systemCheck" },
{ index: 8, property: "clearAll" },
// { index: 9, property: "pcba" },
{ index: 9, property: "start" },
];
testMappings.forEach(mapping => {
const appItem = this.appItem[mapping.index];
if (appItem) {
......@@ -307,6 +336,42 @@
this.beepTimerOutId = this.$setTimeout(this.beepTimerOut, 500, [], this);
},
clearValue: function () {
globalThis.factoryTest.color = 0;
globalThis.factoryTest.touch = 0;
globalThis.factoryTest.wifi = 0;
globalThis.factoryTest.sound = 0;
globalThis.factoryTest.uartComm = 0;
globalThis.factoryTest.bright = 0;
globalThis.factoryTest.licenseAuthor = 0;
globalThis.factoryTest.systemCheck = 0;
globalThis.factoryTest.clearAll = 0;
globalThis.factoryTest.start = 0;
const saveObj = {
color: globalThis.factoryTest.color,
touch: globalThis.factoryTest.touch,
wifi: globalThis.factoryTest.wifi,
sound: globalThis.factoryTest.sound,
// ble: globalThis.factoryTest.ble,
uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
// pcba: globalThis.factoryTest.pcba,
start: globalThis.factoryTest.start,
};
console.log(saveObj);
file.write("product_res.json", saveObj);
// libwifi.syncSave("save");
},
saveValue: function () {
const saveObj = {
......@@ -314,13 +379,13 @@
touch: globalThis.factoryTest.touch,
wifi: globalThis.factoryTest.wifi,
sound: globalThis.factoryTest.sound,
ble: globalThis.factoryTest.ble,
// ble: globalThis.factoryTest.ble,
uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor,
systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll,
pcba: globalThis.factoryTest.pcba,
// pcba: globalThis.factoryTest.pcba,
start: globalThis.factoryTest.start,
};
console.log(saveObj);
......
// yesJumpPage.js
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var router = require("@system.router");
var that;
function commonInitPage(obj) {
that = obj;
}
function movePage (newPage) {
console.log(that.activePage + "==========to==========" + newPage);
that.$hide(that.activePage); // תҳ֮ǰصtoast
that.$setY(that.activePage, -480); // hide
that.$show(newPage)
that.$setY(newPage, 0); // show
that.activePage = newPage;
}
module.exports = {
commonInitPage: commonInitPage,
movePage: movePage,
}
\ No newline at end of file
// yesJumpPage.js
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var router = require("@system.router");
var appItem = [];
console.log("===============factoryYesJumpPage==============");
function initPage(pageAppItem) {
userData.factoryappItem = pageAppItem;
// console.log("Initialized appItem data: " + appItem);
// console.log("=============================");
// console.log("Initialized appItem data: " + appItem[1].index);
}
function testCode(that){
var activePage = that.activePage
console.log("=======================================activePage: " + activePage)
}
function yesGoToNextPage(currentPageName) {
// try {
// 找到当前页面对应的 appItem
const currentApp = userData.factoryappItem.find(item => item.startup === currentPageName);
if (!currentApp) {
console.log("Current page not found in appItem.");
router.push({ path: "factory_testList" });
return;
}
console.log("Current appItem: " + currentPageName);
console.log("appItem", userData.factoryappItem);
const currentIndex = currentApp.index;
console.log("Current index: " + currentIndex);
// 如果当前 index 为 0,直接返回 factory_testList
if (currentIndex === 0) {
console.log("Current item has index 0, no navigation.");
router.push({ path: "factory_testList" });
return;
}
let nextApp = null;
let searchIndex = currentIndex + 1;
// 获取所有存在的 index 值,用于判断 index 是否存在
const existingIndexes = new Set(userData.factoryappItem.map(item => item.index));
// 使用 do...while 循环查找下一个 index 存在且 en === 1 的项
do {
const found = userData.factoryappItem.find(item => item.index === searchIndex && item.en === 1);
if (found) {
nextApp = found;
break;
} else {
searchIndex++;
}
} while (existingIndexes.has(searchIndex));
if (nextApp) {
router.push({
path: nextApp.startup
});
} else {
console.log("No next enabled test item found by increasing index.");
router.push({ path: "factory_testList" });
}
// } catch (error) {
// console.error("Error in yesGoToNextPage:", error);
// router.push({ path: "factory_testList" });
// }
}
module.exports = {
yesGoToNextPage: yesGoToNextPage,
initPage: initPage,
testCode: testCode,
}
\ No newline at end of file
......@@ -2,11 +2,48 @@
var _userdata = require("userdata.js");
var userData = _userdata.userData;
const fs = require("@system.fs")
var factoryDivPageJump = require("factoryDivPageJump.js");
var systemCtrl = require("systemCtrl.js");
// var systemCtrl = require("systemCtrl.js");
var resultsWifiList = undefined;
var that;
var wlan_enalbed = userData.enableWLANSwitchFlag
// const generalSettingPage = proxy.indexObj.getPage("installationGeneralSetting");
var wifi_div = undefined;
var wifi_list_div = undefined;
// this.proxy = proxy;
// this.pageObj = proxy.indexObj;
// var that = this;
// var resultsWifiList = null;
var cnt = 0;
var connectWifiSSID = null;
var connectWifiPassword = null;
var signalLevel = 0;
var _connectWifiTimerId = undefined
var _connectWifiCnt = 0;
var connectingWifiTimer = false;
var connectingState = 0; //模拟用来表示连接wifi的状态,0表示未连接,1表示已连接
var connectTimeout = 0;
var flushTimeTimer = null;
// var wlan_enalbed = userData.enableWLANSwitchFlag
// const generalSettingPage = proxy.indexObj.getPage("generalSetting");
// var wifi_div = undefined;
// var wifi_list_div = undefined;
function testWifiInitPage(obj) {
that = obj;
}
function parseWifiScanResults(output) {
const lines = output.split('\n');
const results = [];
......@@ -39,11 +76,11 @@ function parseWifiScanResults(output) {
}
var wlan_enalbed = userData.enableWLANSwitchFlag
// const generalSettingPage = proxy.indexObj.getPage("generalSetting");
// var wlan_enalbed = userData.enableWLANSwitchFlag
// // const generalSettingPage = proxy.indexObj.getPage("generalSetting");
var wifi_div = undefined;
var wifi_list_div = undefined;
// var wifi_div = undefined;
// var wifi_list_div = undefined;
// this.proxy = proxy;
// this.pageObj = proxy.indexObj.getPage("generalSetting");
// var that = this;
......@@ -53,6 +90,21 @@ var wifi_list_div = undefined;
// proxy.on("onEnableWLANSwitch", function () {
function onGotoWlanEnterPasswordPageEvent(value, signal) {
console.log("receive onGotoWlanEnterPasswordPage singal!");
// var activePage = that.activePage;
that.crtTitleWlanEnterPasswordText = value; //刷新标题
that.crtTitleWlanConnectingText = value;
connectWifiSSID = value;
signalLevel = signal;
console.log("==========signalLevel :" + signalLevel + "connectWifiSSID :" + connectWifiSSID + "=======");
that.crtEnterPasswordShowText = "";
that.crtEnterPasswordShowInvisiableText = "";
that.output = ""; //每次从外面进入页面时,还原已经输入的字符
that.invisiableOutput = "";
factoryDivPageJump.movePage("id_wlanEnterPasswordPage");
}
function connect_wifi(ssid, psk) {
......@@ -91,10 +143,10 @@ function WifiNoActive() {
userData.wlanSignalLevel = 0;
userData.wlanPassword = null;
that.pageObj.$setY("id_enableWLANListArea0", -800);
that.pageObj.$setY("wifiListItem", 0);
that.pageObj.$setY("id_wifiListItem_Text", -800);
that.pageObj.$setY("id_wifiListItem_xLine", -800);
that.$setY("id_enableWLANListArea0", -800);
that.$setY("wifiListItem", 0);
that.$setY("id_wifiListItem_Text", -800);
that.$setY("id_wifiListItem_xLine", -800);
systemCtrl.executeSystemCommand("ifconfig wlan0 down")
......@@ -176,14 +228,17 @@ function refreshWifiList(wifi_list) {
"color": "white",
'text-overflow': "ellipsis",
"background-color": "transparent",
"text": ssid+"("+signalLevel+" dBm)",
"text": ssid + "(" + signalLevel + " dBm)",
"ssid": ssid,
"signalValue": signalLevel,
"events": {
onclick: function (node, topNode, x, y) {
// node.attributes.text = "selected";
systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
console.log("node.attributes.text = " + this.attributes.text);
console.log("node.attributes.text = " + this.attributes.text + " node.attributes.signalValue = " + this.attributes.signalValue);
console.log("click wlan_list_item"); //需要添加一个点击事件
console.log("this.attributes.ssid = " + this.attributes.ssid);
onGotoWlanEnterPasswordPageEvent(this.attributes.ssid, this.attributes.signalValue);
// proxy.emit("onGotoWlanEnterPasswordPage", this.attributes.text, this.attributes.signalValue);
}
}
......@@ -230,7 +285,11 @@ function enableWLANSwitch() {
// if (!userData.enableWLANSwitchFlag) {
// return;
// }
var process = require("@system.process")
if (process.platform == "win32") {
console.log("its win32.")
return;
}
systemCtrl.executeSystemCommand("rm -fr /tmp/scan_result.txt")
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets scan")
......@@ -308,10 +367,118 @@ function getWifiInfo(ssid) {
};
}
function onInstallationGeneralSettingConnectWifi(value) {
console.log("receive onInstallationGeneralSettingConnectWifi singal!");
console.log("Send cmd to connect wifi,connecting...");
if (value != undefined) {
connectWifiPassword = value;
}
var cmdStr = "02|0A|0A|";
var ssidCode = connectWifiPassword;
// var ssidCode = "HUAWEIK50S";
var ssidBytes = Array.from(ssidCode, char => char.charCodeAt(0));
var ssidHexString = ssidBytes.map(byte => byte.toString(16).padStart(2, '0')).join('|');
cmdStr += ssidHexString + "|";
var passWordCode = connectWifiSSID;
// var passWordCode = "Ww88888888";
var passWordBytes = Array.from(passWordCode, char => char.charCodeAt(0));
var passWordHexString = passWordBytes.map(byte => byte.toString(16).padStart(2, '0')).join('|');
cmdStr += passWordHexString + "|";
console.log("aaaaaaaaaaaaaaaaaaaaaaaa==================")
var msdk6ACmdArr = cloudComSerial.serialMsdkCmdArrayPack(0x6A, cmdStr);
cloudComSerial.sendCmd(msdk6ACmdArr);
if (connectingWifiTimer) {
clearInterval(connectingWifiTimer);
}
connectTimeout = 0;
connectingWifiTimer = setInterval(function () {
var dotContext = ["", ".", "..", "..."];
console.debug("================test=============")
if (connectingState == 0) {
connectTimeout++;
} else {
connectTimeout = 0;
console.log("wifi connect success!");
setAreaButtonDivOn();
userData.wlanSsid = connectWifiSSID;
userData.wlanPassword = passWordCode;
WifiActive();
var activePage = that.pageObj.activePage;
handleJumpPage.moveShowHidePage(that.pageObj, activePage, "SuccessConnectWifi");
clearInterval(connectingWifiTimer);
}
if (connectTimeout > 60) {
console.log("wifi connect timeout!");
setAreaButtonDivOn();
WifiNoActive();
// handleJumpPage.moveShowHidePage(that.pageObj, activePage, "failConnectWifi");
clearInterval(connectingWifiTimer);
}
}, 1000);
//使用wpa模式去连wifi
connectWifiByWpa(connectWifiSSID, connectWifiPassword, function (result) {
if (result == 0) {
console.log("Connect wifi success");
setTimeout(() => {
console.debug("Will send 0xF3 request to msdk");
//向msdk发送0xF3请求联网命令
var msdk17CmdArr = cloudComSerial.serialMsdkCmdArrayPack(0xF3, "01")
cloudComSerial.sendCmd(msdk17CmdArr);
}, 3000);
//跳转成功页面
connectingState = 1
// gotoConnectSuccessPage()
} else {
console.log("Connect wifi failed");
//跳转失败页面
connectTimeout = 70
// gotoConnectFailedPage()
}
});
//跳转正在连接页面
// gotoConnectingPage()
}
// proxy.on("onInstallationGeneralSettingConnectWifi", onInstallationGeneralSettingConnectWifi);
function ConnectWifi(value) {
var ssid = connectWifiSSID;
var pwd = value;
console.log("ConnectWifi: " + ssid + "pwd: " + pwd);
// var factory_wifi = require("factory_wifi.js");
// factory_wifi.testWifiConnect(ssid, pwd);
// connect_wifi(ssid,pwd);
that.initWifissid = ssid;
that.initWifipwd = pwd;
that.InterValTime();
console.log("===================ConnectWifi: " + that.initWifissid + "--pwd: " + that.initWifipwd);
}
module.exports = {
enableWLANSwitch: enableWLANSwitch,
connect_wifi: connect_wifi,
getWifiInfo: getWifiInfo,
testWifiInitPage: testWifiInitPage,
ConnectWifi: ConnectWifi,
}
\ No newline at end of file
var appItem = [];
function initPage(pageAppItem){
appItem = pageAppItem;
}
function yesGoToNextPage(that) {
// 获取当前页面索引
let currentIndex = that.index;
// 检查是否在列表范围内
if (currentIndex < appItem.length - 1) {
// 增加索引以获取下一个页面信息
currentIndex++;
let nextApp = appItem[currentIndex];
// 确保下一个测试项是启用状态
if (nextApp.en === 1) {
router.push({
path: nextApp.startup
});
} else {
console.log("Next test item is disabled.");
}
} else {
console.log("Already at the last test item.");
}
}
module.exports = {
yesGoToNextPage: yesGoToNextPage,
initPage: initPage,
}
\ No newline at end of file
{"color":2,"touch":1,"wifi":2,"sound":0,"ble":0,"uartComm":0,"bright":0,"licenseAuthor":0,"systemCheck":0,"clearAll":0,"pcba":0,"start":0}
\ No newline at end of file
{"color":2,"touch":0,"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