Commit 8954c7e3 authored by waterword's avatar waterword

完成产测

parent 87feed56
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
// console.trace = function () { // console.trace = function () {
// } // }
console.debug = function (text) {
var date = new Date()
text = `========= [${date}] ${text}`
print(text)
}
function initEventLister() { function initEventLister() {
var EventEmitter = require('@system.events'); var EventEmitter = require('@system.events');
globalThis.eventEmitter = new EventEmitter(); globalThis.eventEmitter = new EventEmitter();
...@@ -114,7 +120,7 @@ EvueApp({ ...@@ -114,7 +120,7 @@ EvueApp({
'onDestroy': onDestroy, 'onDestroy': onDestroy,
'onMoveEvent': onMoveEvent, 'onMoveEvent': onMoveEvent,
'onGestureEvent': onGestureEvent, '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': 'factory_testList',
// 'uri': 'testLongTimeList', // 'uri': 'testLongTimeList',
'minFreeJSHeapSize': 200 'minFreeJSHeapSize': 200
......
...@@ -5,19 +5,22 @@ ...@@ -5,19 +5,22 @@
<!-- </div> --> <!-- </div> -->
<div style="left:10;top: 10;width: 460;height: 55; background-color: #99D0F7;"> <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> title_TEXT }}</text>
</div> </div>
<div style="left:140 ; top:120 ;width: 200;height: 96;background-color: #99D0F7"> <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>
<div style="width: 480;height: 72;top: 230;"> <div style="width: 480;height: 72;top: 230;">
<!-- <image class="brightnessPng" style="left:23;top:20;" :src="lowBrightnessPngSrc"></image> --> <!-- <image class="brightnessPng" style="left:23;top:20;" :src="lowBrightnessPngSrc"></image> -->
<div class="setBrightnessLineDivBg"></div> <div class="setBrightnessLineDivBg"></div>
<div class="setBrightnessLineShowDiv" id="id_setBrightnessLineShowDiv"></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> </slider>
<!-- <image class="brightnessPng" style="left:425;top:20;" :src="highBrightnessPngSrc"></image> --> <!-- <image class="brightnessPng" style="left:425;top:20;" :src="highBrightnessPngSrc"></image> -->
</div> </div>
...@@ -27,13 +30,16 @@ ...@@ -27,13 +30,16 @@
<div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;"> <div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;"> <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>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;"> <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>
<div style="left:220 ; width: 100;height: 96;background-color: #FF9700;"> <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>
</div> </div>
...@@ -91,9 +97,9 @@ ...@@ -91,9 +97,9 @@
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 1; globalThis.factoryTest.bright = 1;
router.push({ var yesJumpPage = require("factoryYesJumpPage.js");
path: "factory_testList", console.log("=====yesJumpPage.yesGoToNextPage(factoryTestBright);")
}); yesJumpPage.yesGoToNextPage("factoryTestBright");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 2; globalThis.factoryTest.bright = 2;
......
...@@ -133,8 +133,9 @@ ...@@ -133,8 +133,9 @@
// router.push({ // router.push({
// path: "factory_testList" // path: "factory_testList"
// } // }
var yesJumpPage = require("yesJumpPage.js"); var yesJumpPage = require("factoryYesJumpPage.js");
yesJumpPage.yesGoToNextPage(this); console.log("=====yesJumpPage.yesGoToNextPage(factoryTestColor);")
yesJumpPage.yesGoToNextPage("factoryTestColor");
//); //);
}, },
......
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
<!-- </div> --> <!-- </div> -->
<div style="left:20;top: 10;width: 440;height: 55; background-color: #99D0F7;"> <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> title_TEXT }}</text>
</div> </div>
<!-- <div style="left:140 ; top:120 ;width: 200;height: 96;background-color: #99D0F7"> --> <!-- <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> --> <!-- </div> -->
...@@ -20,19 +22,24 @@ ...@@ -20,19 +22,24 @@
<div style="left:25;top: 366;width: 460;height: 96; background-color: transparent;"> <div style="left:25;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;"> <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>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;"> <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>
<div style="left:220 ; width: 100;height: 96;background-color: #FF9700;"> <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> </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;"> <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"
</div> style="color: #000000;top: 15;left: 0; ">PASS</text>
</div> </div>
</div>
...@@ -80,13 +87,13 @@ ...@@ -80,13 +87,13 @@
}, },
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1; globalThis.factoryTest.licenseAuthor = 1;
router.push({ var yesJumpPage = require("factoryYesJumpPage.js");
path: "factory_testList", console.log("=====yesJumpPage.yesGoToNextPage(factoryTestLicenseAuthor);")
}); yesJumpPage.yesGoToNextPage("factoryTestLicenseAuthor");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2; globalThis.factoryTest.licenseAuthor = 2;
router.push({ router.push({
path: "factory_testList", path: "factory_testList",
}); });
...@@ -97,17 +104,17 @@ ...@@ -97,17 +104,17 @@
}); });
}, },
touchedstartTestButton: function (node, topNode, x, y) { touchedstartTestButton: function (node, topNode, x, y) {
const fs = require("@system.fs") const fs = require("@system.fs")
var filenm = "operation_license" var filenm = "operation_license"
var partFilePath = "../../../../../mnt/extsd/msdkFiles/" + filenm var partFilePath = "../../../../../mnt/extsd/msdkFiles/" + filenm
if (fs.exists(partFilePath)) { if (fs.exists(partFilePath)) {
this.crtBrightnessValue = "已注册!" this.crtBrightnessValue = "已注册!"
console.log("the " + filenm + " is exists.") console.log("the " + filenm + " is exists.")
this.$setY("id_yes", 0); this.$setY("id_yes", 0);
return 0 return 0
} }
// console.log("the " + filenm + " is exists.") // console.log("the " + filenm + " is exists.")
this.crtBrightnessValue = "未注册" this.crtBrightnessValue = "未注册"
......
...@@ -81,9 +81,9 @@ ...@@ -81,9 +81,9 @@
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1; globalThis.factoryTest.sound = 1;
router.push({ var yesJumpPage = require("factoryYesJumpPage.js");
path: "factory_testList", console.log("=====yesJumpPage.yesGoToNextPage(factoryTestSound);")
}); yesJumpPage.yesGoToNextPage("factoryTestSound");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2; globalThis.factoryTest.sound = 2;
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
}, },
}; };
</script> </script>
<style> <style>
.screen { .screen {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
var lvgl = require("@native.lvgl7"); var lvgl = require("@native.lvgl7");
var point_div = undefined; var point_div = undefined;
var point_div_list = undefined; var point_div_list = undefined;
var FirstStartupFlag = 1;
export default { export default {
data: { data: {
...@@ -128,11 +129,11 @@ ...@@ -128,11 +129,11 @@
dataInit: function () { dataInit: function () {
if (globalThis.factoryTest.touch == 0) { if (globalThis.factoryTest.touch == 0) {
this.$setY("id_yes", -480); this.$setY("id_yes", -480);
// this.resetArrays(); // this.resetArrays();
// if (point_div_list) { // if (point_div_list) {
// point_div.removeChild(point_div_list) // point_div.removeChild(point_div_list)
// } // }
// this.notRender(); // this.notRender();
// this.$setY("id_ng", -480); // this.$setY("id_ng", -480);
// this.$setY("id_back", -480); // this.$setY("id_back", -480);
} }
...@@ -154,7 +155,7 @@ ...@@ -154,7 +155,7 @@
}, getPointTopDiv) }, getPointTopDiv)
} }
if (point_div_list) { if (point_div_list) {
//point_div.removeChild(point_div_list) point_div.removeChild(point_div_list)
return; return;
} }
point_div_list = document.createElement('div', { point_div_list = document.createElement('div', {
...@@ -173,24 +174,73 @@ ...@@ -173,24 +174,73 @@
"background-color": "#ff0000", "background-color": "#ff0000",
}, point_div_list) }, 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 () { onInit: function () {
}, },
onShow: function () { onShow: function () {
console.log(this.$uri + "===========onShow============="); console.log(this.$uri + "===========factoryTestTouch onShow=============");
this.timerSet(); console.log("FirstStartupFlag:" + FirstStartupFlag);
if (FirstStartupFlag == 1) {
this.timerSet();
this.pointInit();
}
this.dataInit(); this.dataInit();
this.pointInit();
// this.$enableMouseMoveEvent(true); // 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 () { onHide: function () {
console.log(this.$uri + "===========onHide============="); console.log(this.$uri + "===========factoryTestTouch onHide=============");
this.clearTimer(); this.clearTimer();
this.exitEvent();
}, },
onQuit: function () { onQuit: function () {
console.log(this.$uri + "===========onQuit============="); console.log(this.$uri + "===========factoryTestTouch onQuit=============");
this.clearTimer(); this.clearTimer();
this.exitEvent();
}, },
/*************** timer ***************/ /*************** timer ***************/
timerSet: function () { timerSet: function () {
...@@ -283,6 +333,16 @@ ...@@ -283,6 +333,16 @@
// this.$setBackgroundColor(relId, 0x00ff00); // this.$setBackgroundColor(relId, 0x00ff00);
// // this.$setPos(relId, gridX * 32, gridY * 32); // 确保位置正确 // // 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) { refDivColor: function (coor) {
var relId = "id_block" + coor; var relId = "id_block" + coor;
...@@ -304,7 +364,6 @@ ...@@ -304,7 +364,6 @@
var coor = this.figCoor(gx, gy); var coor = this.figCoor(gx, gy);
if (coor == undefined) return; if (coor == undefined) return;
this.refDivColor(coor); this.refDivColor(coor);
}, },
/*************** work ***************/ /*************** work ***************/
// onmousemove: function (gx, gy, topNode, x, y) { // onmousemove: function (gx, gy, topNode, x, y) {
...@@ -347,9 +406,9 @@ ...@@ -347,9 +406,9 @@
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 1; globalThis.factoryTest.touch = 1;
router.push({ var yesJumpPage = require("factoryYesJumpPage.js");
path: "factory_testList", console.log("=====yesJumpPage.yesGoToNextPage(factoryTestTouch);")
}); yesJumpPage.yesGoToNextPage("factoryTestTouch");
}, },
touchedNGButton: function (node, topNode, x, y) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.touch = 2; globalThis.factoryTest.touch = 2;
......
...@@ -5,33 +5,41 @@ ...@@ -5,33 +5,41 @@
<!-- </div> --> <!-- </div> -->
<div style="left:20;top: 10;width: 440;height: 55; background-color: #99D0F7;"> <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> title_TEXT }}</text>
</div> </div>
<div style="left:140 ; top:80 ;width: 200;height: 96;"> <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> <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"> <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> </div>
<div style="left:140 ; top:190 ;width: 200;height: 96;"> <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> <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"> <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> </div>
<div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;"> <div style="left:80;top: 366;width: 460;height: 96; background-color: transparent;">
<div style="left:0 ; width: 100;height: 96;background-color: #858282;"> <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>
<div style="left:110 ; width: 100;height: 96;background-color: #858282;"> <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>
<!-- 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;"> <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>
</div> </div>
...@@ -46,7 +54,7 @@ ...@@ -46,7 +54,7 @@
var packet_cmd = require("packet_cmd.js"); var packet_cmd = require("packet_cmd.js");
var _userdata = require("userdata.js"); var _userdata = require("userdata.js");
var userData = _userdata.userData; var userData = _userdata.userData;
var serialManager = require("serialmanager.js"); var serialManager = require("serialmanager.js");
var sendValue = 0; var sendValue = 0;
export default { export default {
data: { data: {
...@@ -61,14 +69,14 @@ ...@@ -61,14 +69,14 @@
console.log("sendValue:" + sendValue); console.log("sendValue:" + sendValue);
sendValue += 1; sendValue += 1;
packet_cmd.pack_cmd_packet_0x50(); packet_cmd.pack_cmd_packet_0x50();
this.sendCommValueText ="" + sendValue; this.sendCommValueText = "" + sendValue;
this.recvCommValueText ="" + userData.factoryRecvCnt; this.recvCommValueText = "" + userData.factoryRecvCnt;
if (userData.factoryRecvCnt > 0) { if (userData.factoryRecvCnt > 0) {
this.$setY("id_yes", 0); this.$setY("id_yes", 0);
} }
}, },
uartComm:function(){ uartComm: function () {
var serialPortName = undefined var serialPortName = undefined
// var serialManager = require("serialmanager.js"); // var serialManager = require("serialmanager.js");
var process = require("@system.process"); var process = require("@system.process");
if (process.platform == "win32") { if (process.platform == "win32") {
...@@ -78,13 +86,15 @@ ...@@ -78,13 +86,15 @@
else { else {
serialPortName = "/dev/ttyProto" serialPortName = "/dev/ttyProto"
} }
var process = require("@system.process")
serialManager.open(serialPortName, function (isSuccess, status) { if (process.platform != "win32") {
console.log("=========open_async [".concat(isSuccess, "] [").concat(status, "]=========")); serialManager.open(serialPortName, function (isSuccess, status) {
}); console.log("=========open_async [".concat(isSuccess, "] [").concat(status, "]========="));
});
}
}, },
onShow: function () { onShow: function () {
this.uartComm(); this.uartComm();
this.testTimer = this.$setInterval(this.InterValTime, 1000, [], this); this.testTimer = this.$setInterval(this.InterValTime, 1000, [], this);
}, },
...@@ -104,11 +114,11 @@ ...@@ -104,11 +114,11 @@
touchedYesButton: function (node, topNode, x, y) { touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1; globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0; 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) { touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 2; 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 @@ ...@@ -221,9 +221,12 @@
this.movePage("systemId"+this.pagecnt, "systemId1"); this.movePage("systemId"+this.pagecnt, "systemId1");
this.pagecnt = 1; this.pagecnt = 1;
router.push({
path: "factory_testList", //添加检查全绿为测试功能
});
var yesJumpPage = require("factoryYesJumpPage.js");
console.log("=====yesJumpPage.yesGoToNextPage(factoryTestsystemCheck);")
yesJumpPage.yesGoToNextPage("factoryTestsystemCheck");
}, },
hideNextPageButton: function () { hideNextPageButton: function () {
......
<html> <html>
<div class="screen" onclick="touchedBg"> <div class="screen" onclick="touchedBg">
<template for="appItem" key="app" index="index"> <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">{{ <text class="testName" :url="app.startup" :ena="app.en">{{
app.name app.name
}}</text> }}</text>
...@@ -18,12 +19,14 @@ ...@@ -18,12 +19,14 @@
<script> <script>
var router = require("@system.router"); var router = require("@system.router");
var lvgl = require("@native.lvgl7"); var lvgl = require("@native.lvgl7");
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var file = require("file.js"); var file = require("file.js");
var bglight = require("factory_bglight.js"); var bglight = require("factory_bglight.js");
// var systemCtrl = require("systemCtrl.js"); // var systemCtrl = require("systemCtrl.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 = require("userdata.js");
// var userData = _userdata.userData; // var userData = _userdata.userData;
export default { export default {
...@@ -48,6 +51,7 @@ ...@@ -48,6 +51,7 @@
top: 10, top: 10,
left: 20, left: 20,
en: 1, en: 1,
index: 1,
}, },
{ {
id: "id_factoryTestTouch", id: "id_factoryTestTouch",
...@@ -56,6 +60,7 @@ ...@@ -56,6 +60,7 @@
top: 10, top: 10,
left: 130, left: 130,
en: 1, en: 1,
index: 2,
}, },
{ {
id: "id_factoryTestWifi", id: "id_factoryTestWifi",
...@@ -64,6 +69,7 @@ ...@@ -64,6 +69,7 @@
top: 10, top: 10,
left: 240, left: 240,
en: 1, en: 1,
index: 3,
}, },
{ {
id: "id_factoryTestSound", id: "id_factoryTestSound",
...@@ -72,38 +78,42 @@ ...@@ -72,38 +78,42 @@
top: 10, top: 10,
left: 350, left: 350,
en: 1, en: 1,
index: 4,
}, },
{ // {
id: "id_factoryTestBle", // id: "id_factoryTestBle",
name: "蓝牙", // name: "蓝牙",
startup: "factoryTestBle", //startup: "factoryTestBle",
top: 100, // top: 100,
left: 20, // left: 20,
en: 0, // en: 0,
}, //},
{ {
id: "id_factoryTestUartComm", id: "id_factoryTestUartComm",
name: "无极性通信", name: "无极性通信",
startup: "factoryTestUartComm", startup: "factoryTestUartComm",
top: 100, top: 100,
left: 130, left: 20,
en: 1, en: 1,
index: 5,
}, },
{ {
id: "id_factoryTestBright", id: "id_factoryTestBright",
name: "亮度调节", name: "亮度调节",
startup: "factoryTestBright", startup: "factoryTestBright",
top: 100, top: 100,
left: 240, left: 130,
en: 1, en: 1,
index: 6,
}, },
{ {
id: "id_factoryTestLicenseAuthor", id: "id_factoryTestLicenseAuthor",
name: "license授权", name: "license授权",
startup: "factoryTestLicenseAuthor", startup: "factoryTestLicenseAuthor",
top: 100, top: 100,
left: 350, left: 240,
en: 1, en: 1,
index: 7,
}, },
{ {
id: "id_factoryTestsystemCheck", id: "id_factoryTestsystemCheck",
...@@ -112,6 +122,7 @@ ...@@ -112,6 +122,7 @@
top: 370, top: 370,
left: 20, left: 20,
en: 1, en: 1,
index: 0,
}, },
{ {
id: "id_factoryTestClearAll", id: "id_factoryTestClearAll",
...@@ -120,22 +131,16 @@ ...@@ -120,22 +131,16 @@
top: 370, top: 370,
left: 130, left: 130,
en: 1, en: 1,
}, index: 0,
{
id: "id_factoryTestPCBA",
name: "PCBA",
startup: "factoryTestPCBA",
top: 370,
left: 240,
en: 1,
}, },
{ {
id: "id_factoryTestStart", id: "id_factoryTestStart",
name: "开始测试", name: "开始测试",
startup: "factoryTestStart", startup: "factoryTestStart",
top: 370, top: 370,
left: 350, left: 240,
en: 1, en: 1,
index: 0,
}, },
], ],
...@@ -143,6 +148,7 @@ ...@@ -143,6 +148,7 @@
/*************** struct ***************/ /*************** struct ***************/
onInit: function () { onInit: function () {
//this.activePage= "id_languageBasicPage";
this.onlyOnceFlag = 0; this.onlyOnceFlag = 0;
if (globalThis.factoryTest == undefined) { if (globalThis.factoryTest == undefined) {
var obj = { var obj = {
...@@ -150,28 +156,28 @@ ...@@ -150,28 +156,28 @@
touch: 0, touch: 0,
wifi: 0, wifi: 0,
sound: 0, sound: 0,
ble: 0,
uartComm: 0, uartComm: 0,
bright: 0, bright: 0,
licenseAuthor: 0, licenseAuthor: 0,
systemCheck: 0, systemCheck: 0,
clearAll: 0, clearAll: 0,
pcba: 0,
start: 0, start: 0,
}; };
globalThis.factoryTest = obj; globalThis.factoryTest = obj;
} }
this.initializeFactoryTestProperties(); this.initializeFactoryTestProperties();
yesJumpPage.initPage();
}, },
initializeFactoryTestProperties: function () { initializeFactoryTestProperties: function () {
const properties = [ const properties = [
"color", "touch", "wifi", "sound", "ble", "color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "uartComm", "bright", "licenseAuthor",
"systemCheck", "clearAll", "pcba", "start" "systemCheck", "clearAll", "start"
]; ];
properties.forEach(prop => { properties.forEach(prop => {
if (globalThis.factoryTest[prop] === undefined) { if (globalThis.factoryTest[prop] === undefined) {
globalThis.factoryTest[prop] = 0; globalThis.factoryTest[prop] = 0;
...@@ -185,12 +191,13 @@ ...@@ -185,12 +191,13 @@
var appVersion = "The code has been annotated" var appVersion = "The code has been annotated"
console.log("sysVersion=" + sysVersion); console.log("sysVersion=" + sysVersion);
console.log("appVersion=" + appVersion); console.log("appVersion=" + appVersion);
this.crtSNValue = sysVersion + "-" + appVersion; //this.crtSNValue = sysVersion + "-" + appVersion;
this.crtSNValue = userData.aboutSNValue || "NG"
yesJumpPage.initPage(this.appItem);
yesJumpPage.testCode(this)
}, },
initShow: function () {
onShow: function () {
console.log(this.$uri + "===========onShow=============");
this.snShow(); this.snShow();
this.timerSet(); this.timerSet();
...@@ -211,13 +218,20 @@ ...@@ -211,13 +218,20 @@
this.saveValue(); this.saveValue();
}, },
onShow: function () {
console.log(this.$uri + "===========onShow=============");
this.initShow();
},
restoreFactoryTestValues: function (obj) { restoreFactoryTestValues: function (obj) {
const properties = [ const properties = [
"color", "touch", "wifi", "sound", "ble", "color", "touch", "wifi", "sound",
"uartComm", "bright", "licenseAuthor", "uartComm", "bright", "licenseAuthor",
"systemCheck", "clearAll", "pcba", "start" "systemCheck", "clearAll", "start"
]; ];
properties.forEach(prop => { properties.forEach(prop => {
if (obj[prop] !== undefined) { if (obj[prop] !== undefined) {
globalThis.factoryTest[prop] = obj[prop]; globalThis.factoryTest[prop] = obj[prop];
...@@ -255,39 +269,54 @@ ...@@ -255,39 +269,54 @@
touchedBlock: function (node, topnode, x, y) { touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y); console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url"); var url = this.$eval(topnode, ":url");
console.log("===============url:" + url + "=============== topnode:"+topnode); console.log("===============url:" + url + "=============== topnode:" + topnode);
if (url == undefined) return; if (url == undefined) return;
var en = parseInt(this.$eval(topnode, ":ena")); var en = parseInt(this.$eval(topnode, ":ena"));
if (en != 1) { if (en != 1) {
return; return;
} }
if (url == "factoryTestClearAll") {
this.clearValue()
console.log("==============factoryTestClearAll================");
this.initShow();
return;
}
if (url == "factoryTestStart") {
console.log("==============factoryTestStart================");
url = "factoryTestColor";
}
router.push({ router.push({
path: url, path: url,
}); });
}, },
blockColorChange: function (relId, val) { blockColorChange: function (relId, val) {
console.log("relId:" + relId + " val:" + val);
const colors = [0x9E9E9E, 0x4CB050, 0xF44236]; const colors = [0x9E9E9E, 0x4CB050, 0xF44236];
this.$setBackgroundColor(relId, colors[Math.min(val, 2)]); this.$setBackgroundColor(relId, colors[Math.min(val, 2)]);
}, },
testStatus: function () { testStatus: function () {
const testMappings = [ const testMappings = [
{ index: 0, property: "color" }, { index: 0, property: "color" },
{ index: 1, property: "touch" }, { index: 1, property: "touch" },
{ index: 2, property: "wifi" }, { index: 2, property: "wifi" },
{ index: 3, property: "sound" }, { index: 3, property: "sound" },
{ index: 4, property: "ble" }, { index: 4, property: "uartComm" },
{ index: 5, property: "uartComm" }, { index: 5, property: "bright" },
{ index: 6, property: "bright" }, { index: 6, property: "licenseAuthor" },
{ index: 9, property: "systemCheck" }, { index: 7, property: "systemCheck" },
{ index: 10, property: "clearAll" }, { index: 8, property: "clearAll" },
{ index: 11, property: "pcba" }, // { index: 9, property: "pcba" },
{ index: 12, property: "start" }, { index: 9, property: "start" },
]; ];
testMappings.forEach(mapping => { testMappings.forEach(mapping => {
const appItem = this.appItem[mapping.index]; const appItem = this.appItem[mapping.index];
if (appItem) { if (appItem) {
...@@ -307,6 +336,42 @@ ...@@ -307,6 +336,42 @@
this.beepTimerOutId = this.$setTimeout(this.beepTimerOut, 500, [], this); 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 () { saveValue: function () {
const saveObj = { const saveObj = {
...@@ -314,13 +379,13 @@ ...@@ -314,13 +379,13 @@
touch: globalThis.factoryTest.touch, touch: globalThis.factoryTest.touch,
wifi: globalThis.factoryTest.wifi, wifi: globalThis.factoryTest.wifi,
sound: globalThis.factoryTest.sound, sound: globalThis.factoryTest.sound,
ble: globalThis.factoryTest.ble, // ble: globalThis.factoryTest.ble,
uartComm: globalThis.factoryTest.uartComm, uartComm: globalThis.factoryTest.uartComm,
bright: globalThis.factoryTest.bright, bright: globalThis.factoryTest.bright,
licenseAuthor: globalThis.factoryTest.licenseAuthor, licenseAuthor: globalThis.factoryTest.licenseAuthor,
systemCheck: globalThis.factoryTest.systemCheck, systemCheck: globalThis.factoryTest.systemCheck,
clearAll: globalThis.factoryTest.clearAll, clearAll: globalThis.factoryTest.clearAll,
pcba: globalThis.factoryTest.pcba, // pcba: globalThis.factoryTest.pcba,
start: globalThis.factoryTest.start, start: globalThis.factoryTest.start,
}; };
console.log(saveObj); 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 @@ ...@@ -2,11 +2,48 @@
var _userdata = require("userdata.js"); var _userdata = require("userdata.js");
var userData = _userdata.userData; var userData = _userdata.userData;
const fs = require("@system.fs") const fs = require("@system.fs")
var factoryDivPageJump = require("factoryDivPageJump.js");
var systemCtrl = require("systemCtrl.js"); var systemCtrl = require("systemCtrl.js");
// var systemCtrl = require("systemCtrl.js"); // var systemCtrl = require("systemCtrl.js");
var resultsWifiList = undefined; 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) { function parseWifiScanResults(output) {
const lines = output.split('\n'); const lines = output.split('\n');
const results = []; const results = [];
...@@ -39,11 +76,11 @@ function parseWifiScanResults(output) { ...@@ -39,11 +76,11 @@ function parseWifiScanResults(output) {
} }
var wlan_enalbed = userData.enableWLANSwitchFlag // var wlan_enalbed = userData.enableWLANSwitchFlag
// const generalSettingPage = proxy.indexObj.getPage("generalSetting"); // // const generalSettingPage = proxy.indexObj.getPage("generalSetting");
var wifi_div = undefined; // var wifi_div = undefined;
var wifi_list_div = undefined; // var wifi_list_div = undefined;
// this.proxy = proxy; // this.proxy = proxy;
// this.pageObj = proxy.indexObj.getPage("generalSetting"); // this.pageObj = proxy.indexObj.getPage("generalSetting");
// var that = this; // var that = this;
...@@ -53,6 +90,21 @@ var wifi_list_div = undefined; ...@@ -53,6 +90,21 @@ var wifi_list_div = undefined;
// proxy.on("onEnableWLANSwitch", function () { // 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) { function connect_wifi(ssid, psk) {
...@@ -91,10 +143,10 @@ function WifiNoActive() { ...@@ -91,10 +143,10 @@ function WifiNoActive() {
userData.wlanSignalLevel = 0; userData.wlanSignalLevel = 0;
userData.wlanPassword = null; userData.wlanPassword = null;
that.pageObj.$setY("id_enableWLANListArea0", -800); that.$setY("id_enableWLANListArea0", -800);
that.pageObj.$setY("wifiListItem", 0); that.$setY("wifiListItem", 0);
that.pageObj.$setY("id_wifiListItem_Text", -800); that.$setY("id_wifiListItem_Text", -800);
that.pageObj.$setY("id_wifiListItem_xLine", -800); that.$setY("id_wifiListItem_xLine", -800);
systemCtrl.executeSystemCommand("ifconfig wlan0 down") systemCtrl.executeSystemCommand("ifconfig wlan0 down")
...@@ -176,14 +228,17 @@ function refreshWifiList(wifi_list) { ...@@ -176,14 +228,17 @@ function refreshWifiList(wifi_list) {
"color": "white", "color": "white",
'text-overflow': "ellipsis", 'text-overflow': "ellipsis",
"background-color": "transparent", "background-color": "transparent",
"text": ssid+"("+signalLevel+" dBm)", "text": ssid + "(" + signalLevel + " dBm)",
"ssid": ssid,
"signalValue": signalLevel, "signalValue": signalLevel,
"events": { "events": {
onclick: function (node, topNode, x, y) { onclick: function (node, topNode, x, y) {
// node.attributes.text = "selected"; // node.attributes.text = "selected";
systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav"); 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("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); // proxy.emit("onGotoWlanEnterPasswordPage", this.attributes.text, this.attributes.signalValue);
} }
} }
...@@ -216,7 +271,7 @@ function refreshWifiList(wifi_list) { ...@@ -216,7 +271,7 @@ function refreshWifiList(wifi_list) {
src: src, src: src,
}, chooseAreaDiv) }, chooseAreaDiv)
top += 70 top += 70
} }
wifi_list_div.setAttribute('height', top) wifi_list_div.setAttribute('height', top)
...@@ -230,7 +285,11 @@ function enableWLANSwitch() { ...@@ -230,7 +285,11 @@ function enableWLANSwitch() {
// if (!userData.enableWLANSwitchFlag) { // if (!userData.enableWLANSwitchFlag) {
// return; // 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("rm -fr /tmp/scan_result.txt")
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets scan") systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets scan")
...@@ -308,10 +367,118 @@ function getWifiInfo(ssid) { ...@@ -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 = { module.exports = {
enableWLANSwitch: enableWLANSwitch, enableWLANSwitch: enableWLANSwitch,
connect_wifi: connect_wifi, connect_wifi: connect_wifi,
getWifiInfo: getWifiInfo, 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} {"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 \ 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