Commit 353aaeea authored by lyong's avatar lyong

add

parent d9f0ef4a
......@@ -12,6 +12,7 @@ function initEventLister() {
globalThis.eventEmitter = new EventEmitter();
}
function onCreate(uri) {
globalThis.Simu = {
"En": 0,
}
......@@ -113,7 +114,7 @@ EvueApp({
'onDestroy': onDestroy,
'onMoveEvent': onMoveEvent,
'onGestureEvent': onGestureEvent,
'paths': ["../RD190/","../../enode_modules/","./../RE860A/logicJS/","./../RE860A/common/","./../RE860A/common/","./../re860a-v1.0/logicJS/","./../re860a-v1.0/common/","./factoryTest_plugin/", "./factoryTest_plugin/ref/", "./factoryTestItem/"],
'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/"],
'uri': 'factory_testList',
// 'uri': 'testLongTimeList',
'minFreeJSHeapSize': 200
......
<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> -->
<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;">{{
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>
</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>
<!-- <image class="brightnessPng" style="left:425;top:20;" :src="highBrightnessPngSrc"></image> -->
</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>
</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>
</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>
</div>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var bglight = require("bglight.js");
export default {
data: {
title_TEXT: "屏背光",
crtBrightnessValue: "",
},
onInit() {
},
initSatte: function () {
var initValue = 100;
this.crtBrightnessValue = initValue;
var value = Math.round(initValue * 255 / 100);
bglight.ctrl(value);
var tempWidth = Math.round((initValue / 100) * 324);
this.$setWidth("id_setBrightnessLineShowDiv", tempWidth);
},
onShow: function () {
this.initSatte();
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
this.initSatte();
this.$clearTimeout(this.testTimer);
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 1;
router.push({
path: "factory_testList",
});
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.bright = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
movePage: function (oldPage, newPage) {
console.log(oldPage + "==========to==========" + newPage);
this.$hide(oldPage); // 跳转页面之前立即关掉toast
this.$setY(oldPage, -480); // hide
this.$show(newPage)
this.$setY(newPage, 0); // show
},
onBrightnessValueChanged: function (node, value) {
console.log("value=" + value);
this.brightnessValue = value;
this.crtBrightnessValue = value;
var tempWidth = Math.round((value / 100) * 324);
this.$setWidth("id_setBrightnessLineShowDiv", tempWidth);
console.log("value=" + value);
console.log("send onBrightnessValueChanged signal!");
this.onBrightnessValueChangedEvent(this.brightnessValue);
},
onBrightnessValueRelease: function (node, topnode, x, y) {
console.log("send onBrightnessValueRelease signal!");
},
onBrightnessValueChangedEvent: function (brightnessValue) {
console.log("receive onBrightnessValueChangedEvent singal!");
// todo: 控制屏幕亮度, brightnessValue:0~100
// userData.brightnessValue = brightnessValue;
var value = Math.round(brightnessValue * 255 / 100);
console.log("onBrightnessValueChangedEvent value=" + value);
bglight.ctrl(value);
}
};
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
.fontsize20 {
font-size: 20;
text-align: center;
text-overflow: ellipsis;
color: #ffffff;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.fontsize24 {
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
#id_scanWifiList {
bottom: 20px;
right: 20px;
}
#id_startscanWifi {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.oneRow {
top: 15px;
}
.setBrightnessLineDivBg {
left: 78;
top: 33;
width: 324;
height: 24;
border-radius: 12px;
background-color: #4D4D4D;
}
.setBrightnessLineShowDiv {
left: 78;
top: 33;
width: 162;
height: 24;
border-radius: 12px;
background-color: rgb(32, 148, 240);
}
#setBrightnessSlider {
left: 78;
top: 30;
width: 324;
height: 32;
border-width: 0px;
border-radius: 3px;
border-color: gray;
/* background-color: #4D4D4D;
slider-indic-color: white; */
background-color: transparent;
slider-indic-color: transparent;
slider-knob-color: rgb(32, 148, 240);
slider-knob-height: 32;
}
</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> -->
<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;">{{
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>
<!-- </div> -->
<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>
</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>
</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>
</div>
<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>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var systemCtrl = require("systemCtrl.js");
export default {
data: {
title_TEXT: "License注册",
crtBrightnessValue: "点击开始测试检查",
},
onInit() {
},
onShow: function () {
// this.crtBrightnessValue = "点击开始测试播放";
// this.$hide("id_yes");
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
this.$clearTimeout(this.testTimer);
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1;
router.push({
path: "factory_testList",
});
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
touchedstartTestButton: function (node, topNode, x, y) {
const fs = require("@system.fs")
var filenm = "operation_license"
var partFilePath = "../../../../../mnt/extsd/msdkFiles/" + filenm
if (fs.exists(partFilePath)) {
this.crtBrightnessValue = "已注册!"
console.log("the " + filenm + " is exists.")
this.$setY("id_yes", 0);
return 0
}
// console.log("the " + filenm + " is exists.")
this.crtBrightnessValue = "未注册"
},
movePage: function (oldPage, newPage) {
console.log(oldPage + "==========to==========" + newPage);
this.$hide(oldPage); // 跳转页面之前立即关掉toast
this.$setY(oldPage, -480); // hide
this.$show(newPage)
this.$setY(newPage, 0); // show
},
};
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
.fontsize20 {
font-size: 20;
text-align: center;
text-overflow: ellipsis;
color: #ffffff;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.fontsize24 {
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
#id_scanWifiList {
bottom: 20px;
right: 20px;
}
#id_startscanWifi {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.oneRow {
top: 15px;
}
.setBrightnessLineDivBg {
left: 78;
top: 33;
width: 324;
height: 24;
border-radius: 12px;
background-color: #4D4D4D;
}
.setBrightnessLineShowDiv {
left: 78;
top: 33;
width: 162;
height: 24;
border-radius: 12px;
background-color: rgb(32, 148, 240);
}
#setBrightnessSlider {
left: 78;
top: 30;
width: 324;
height: 32;
border-width: 0px;
border-radius: 3px;
border-color: gray;
/* background-color: #4D4D4D;
slider-indic-color: white; */
background-color: transparent;
slider-indic-color: transparent;
slider-knob-color: rgb(32, 148, 240);
slider-knob-height: 32;
}
</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> -->
<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;">{{
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>
<!-- </div> -->
<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>
</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>
</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>
</div>
<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>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var systemCtrl = require("systemCtrl.js");
export default {
data: {
title_TEXT: "喇叭",
crtBrightnessValue: "点击开始测试播放",
},
onInit() {
},
onShow: function () {
// this.crtBrightnessValue = "点击开始测试播放";
// this.$hide("id_yes");
// document.setAttribute('id_enableWLANPageList', 'list-set-edge-flash', false);
// wifiEventJS.connect_wifi(initWifissid, initWifipwd);
// wifiEventJS.enableWLANSwitch();
// this.testTimer = this.$setTimeout(this.InterValTime, 5000, [], this);
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
this.$clearTimeout(this.testTimer);
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 1;
router.push({
path: "factory_testList",
});
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.sound = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
touchedstartTestButton: function (node, topNode, x, y) {
var soundLevelText = "tinymix set 16 " + 7
// systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
systemCtrl.executeSystemCommand(soundLevelText);
systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
this.crtBrightnessValue = "播放结束,点击开始测试重复播放";
this.$setY("id_yes",0);
},
movePage: function (oldPage, newPage) {
console.log(oldPage + "==========to==========" + newPage);
this.$hide(oldPage); // 跳转页面之前立即关掉toast
this.$setY(oldPage, -480); // hide
this.$show(newPage)
this.$setY(newPage, 0); // show
},
};
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
.fontsize20 {
font-size: 20;
text-align: center;
text-overflow: ellipsis;
color: #ffffff;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.fontsize24 {
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
#id_scanWifiList {
bottom: 20px;
right: 20px;
}
#id_startscanWifi {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.oneRow {
top: 15px;
}
.setBrightnessLineDivBg {
left: 78;
top: 33;
width: 324;
height: 24;
border-radius: 12px;
background-color: #4D4D4D;
}
.setBrightnessLineShowDiv {
left: 78;
top: 33;
width: 162;
height: 24;
border-radius: 12px;
background-color: rgb(32, 148, 240);
}
#setBrightnessSlider {
left: 78;
top: 30;
width: 324;
height: 32;
border-width: 0px;
border-radius: 3px;
border-color: gray;
/* background-color: #4D4D4D;
slider-indic-color: white; */
background-color: transparent;
slider-indic-color: transparent;
slider-knob-color: rgb(32, 148, 240);
slider-knob-height: 32;
}
</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> -->
<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;">{{
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>
</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>
</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>
</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>
</div>
<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>
</div>
</div>
</html>
<script>
var router = require("@system.router");
var lvgl = require("@native.lvgl7");
var packet_cmd = require("packet_cmd.js");
var _userdata = require("userdata.js");
var userData = _userdata.userData;
var serialManager = require("serialmanager.js");
var sendValue = 0;
export default {
data: {
title_TEXT: "无极性",
sendCommValueText: "0",
recvCommValueText: "0"
},
onInit() {
},
InterValTime: function () {
console.log("sendValue:" + sendValue);
sendValue += 1;
packet_cmd.pack_cmd_packet_0x50();
this.sendCommValueText ="" + sendValue;
this.recvCommValueText ="" + userData.factoryRecvCnt;
if (userData.factoryRecvCnt > 0) {
this.$setY("id_yes", 0);
}
},
uartComm:function(){
var serialPortName = undefined
// var serialManager = require("serialmanager.js");
var process = require("@system.process");
if (process.platform == "win32") {
// return;
serialPortName = "COM4"
}
else {
serialPortName = "/dev/ttyProto"
}
serialManager.open(serialPortName, function (isSuccess, status) {
console.log("=========open_async [".concat(isSuccess, "] [").concat(status, "]========="));
});
},
onShow: function () {
this.uartComm();
this.testTimer = this.$setInterval(this.InterValTime, 1000, [], this);
},
onHide: function () {
console.log(this.$uri + "===========onHide=============");
this.clearTimer();
},
onQuit: function () {
console.log(this.$uri + "===========onQuit=============");
this.clearTimer();
},
clearTimer: function () {
serialManager.close();
this.$clearInterval(this.testTimer);
},
touchedYesButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 1;
userData.factoryRecvCnt = 0;
router.push({
path: "factory_testList",
});
},
touchedNGButton: function (node, topNode, x, y) {
globalThis.factoryTest.uartComm = 2;
router.push({
path: "factory_testList",
});
},
touchedBackButton: function (node, topNode, x, y) {
router.push({
path: "factory_testList",
});
},
movePage: function (oldPage, newPage) {
console.log(oldPage + "==========to==========" + newPage);
this.$hide(oldPage); // 跳转页面之前立即关掉toast
this.$setY(oldPage, -480); // hide
this.$show(newPage)
this.$setY(newPage, 0); // show
},
};
</script>
<style>
.screen {
top: 0;
left: 0;
width: 480;
height: 480;
background-color: #A8A8A8;
/* color: black; */
}
.fontsize20 {
font-size: 20;
text-align: center;
text-overflow: ellipsis;
color: #ffffff;
background-color: transparent;
}
.fontsize22Left {
left: 28;
width: 240;
height: 40;
text-align: left;
text-overflow: ellipsis;
font-size: 22;
color: #FFFFFF;
background-color: transparent;
}
.fontsize40 {
text-align: center;
text-overflow: ellipsis;
font-size: 40;
color: #ffffff;
background-color: transparent;
}
.fontsize24 {
height: 34;
text-align: center;
text-overflow: ellipsis;
font-size: 24;
color: #ffffff;
background-color: transparent;
}
#id_yes {
bottom: 20px;
left: 20px;
}
#id_ng {
bottom: 20px;
right: 20px;
}
#id_back {
bottom: 20px;
right: 20px;
}
#id_scanWifiList {
bottom: 20px;
right: 20px;
}
#id_startscanWifi {
bottom: 20px;
right: 20px;
}
.testReturn {
position: absolute;
width: 100;
height: 96;
text-align: center;
text-overflow: ellipsis;
font-size: 44;
}
.oneRow {
top: 15px;
}
.setBrightnessLineDivBg {
left: 78;
top: 33;
width: 324;
height: 24;
border-radius: 12px;
background-color: #4D4D4D;
}
.setBrightnessLineShowDiv {
left: 78;
top: 33;
width: 162;
height: 24;
border-radius: 12px;
background-color: rgb(32, 148, 240);
}
#setBrightnessSlider {
left: 78;
top: 30;
width: 324;
height: 32;
border-width: 0px;
border-radius: 3px;
border-color: gray;
/* background-color: #4D4D4D;
slider-indic-color: white; */
background-color: transparent;
slider-indic-color: transparent;
slider-knob-color: rgb(32, 148, 240);
slider-knob-height: 32;
}
</style>
\ No newline at end of file
......@@ -21,6 +21,7 @@
var file = require("file.js");
var bglight = require("factory_bglight.js");
// var systemCtrl = require("systemCtrl.js");
var systemCtrl = require("systemCtrl.js");
// var _userdata = require("userdata.js");
......@@ -78,7 +79,7 @@
startup: "factoryTestBle",
top: 100,
left: 20,
en: 1,
en: 0,
},
{
id: "id_factoryTestUartComm",
......@@ -102,7 +103,7 @@
startup: "factoryTestLicenseAuthor",
top: 100,
left: 350,
en: 0,
en: 1,
},
{
id: "id_factoryTestsystemCheck",
......@@ -253,7 +254,7 @@
touchedBlock: function (node, topnode, x, y) {
console.log("X:" + x + " Y:" + y);
var url = this.$eval(topnode, ":url");
console.log("===============url:" + url + "===============");
console.log("===============url:" + url + "=============== topnode:"+topnode);
if (url == undefined) return;
var en = parseInt(this.$eval(topnode, ":ena"));
......
var systemCtrl = require("factory_systemCtrl.js");
var systemCtrl = require("systemCtrl.js");
var egenmd5 = require("factory_egenmd5.js");
var process = require("@system.process");
/**
......
......@@ -5,6 +5,7 @@ const fs = require("@system.fs")
var systemCtrl = require("systemCtrl.js");
// var systemCtrl = require("systemCtrl.js");
var resultsWifiList = undefined;
function parseWifiScanResults(output) {
const lines = output.split('\n');
......@@ -183,7 +184,7 @@ function refreshWifiList(wifi_list) {
systemCtrl.executeSystemCommand("/mnt/app/quicknode/shell/eAplay.sh /mnt/app/voice_click.wav");
console.log("node.attributes.text = " + this.attributes.text);
console.log("click wlan_list_item"); //需要添加一个点击事件
proxy.emit("onGotoWlanEnterPasswordPage", this.attributes.text, this.attributes.signalValue);
// proxy.emit("onGotoWlanEnterPasswordPage", this.attributes.text, this.attributes.signalValue);
}
}
}, chooseAreaDiv)
......
// const systemCtrl = require("systemCtrl.js");
const process = require("@system.process");
const rnapi = require('rnapi.js')
var _userdata = require("userdata.js");
var userData = _userdata.userData;
const fs = require("@system.fs")
var systemCtrl = require("systemCtrl.js");
const userdata = require("../logicJS/userdata");
var handleJumpPage = require("handleJumpPage.js");
// const system = rnapi.require('lib/system/build-lib/libsystem.so')
function parseWifiScanResults(output) {
const lines = output.split('\n');
const results = [];
// 从第三行开始解析(跳过前两行标题)
for (let i = 2; i < lines.length; i++) {
const line = lines[i].trim();
if (!line) continue; // 跳过空行
// 按多个空格分割行
const parts = line.split(/\s+/).filter(part => part !== '');
if (parts.length >= 4) {
const signalLevel = parseInt(parts[2]); // 信号强度在第3列
let ssid = parts.slice(4).join(' '); // SSID 在第5列及之后(可能包含空格)
const flags = parts[3]; // 加密标志在第4列
const isEncrypted = !flags.includes("[ESS]") ||
flags.includes("WPA") ||
flags.includes("WEP") ||
flags.includes("PSK");
results.push({
ssid: ssid || '', // 如果 SSID 为空,则设为空字符串
signalLevel: signalLevel,
isEncrypted: isEncrypted
});
}
}
return results;
}
function Wlan(proxy) {
var wlan_enalbed = userData.enableWLANSwitchFlag
const generalSettingPage = proxy.indexObj.getPage("generalSetting");
var wifi_div = undefined;
var wifi_list_div = undefined;
this.proxy = proxy;
this.pageObj = proxy.indexObj.getPage("generalSetting");
var that = this;
function refreshWifiList(wifi_list) {
var enableWLANListItemSearchDiv = generalSettingPage.$getElementById('id_enableWLANListItemSearchDiv')
if (!enableWLANListItemSearchDiv)
return
if (!wifi_div) {
wifi_div = document.createElement('div', {
top: 0,
left: 0,
width: 480,
}, enableWLANListItemSearchDiv)
}
// if (wifi_list_div) {
// wifi_div.removeChild(wifi_list_div)
// }
wifi_list_div = document.createElement('div', {
top: 0,
left: 0,
width: 480,
}, wifi_div)
var top = 0;
for (var i = 0; i < wifi_list.length; i++) {
if (wifi_list[i].ssid == userData.wlanSsid) {
continue;
}
var ssid = wifi_list[i].ssid
var signalLevel = wifi_list[i].signalLevel
var isEncrypted = wifi_list[i].isEncrypted
if (ssid.length == 0)
continue
if (signalLevel > -50) {
var src = 'images/main/wifiSignalLevel3.png'
} else if (signalLevel <= -50 && signalLevel > -70) {
var src = 'images/main/wifiSignalLevel2.png'
} else {
var src = 'images/main/wifiSignalLevel1.png'
}
var chooseAreaDiv = document.createElement('div', {
top: top,
left: 20,
width: 460,
height: 66,
}, wifi_list_div)
document.createElement('text', {
top: 14,
left: 8,
width: 480,
height: 50,
"text-align": "left",
"font-size": 22,
"color": "white",
'text-overflow': "ellipsis",
"background-color": "transparent",
"text": 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("click wlan_list_item"); //需要添加一个点击事件
proxy.emit("onGotoWlanEnterPasswordPage", this.attributes.text, this.attributes.signalValue);
}
}
}, chooseAreaDiv)
document.createElement('div', {
top: 65,
left: 8,
width: 464,
height: 1,
opactity: 1,
"background-color": "#999999",
}, chooseAreaDiv)
if (isEncrypted) {
document.createElement('img', {
top: 20,
left: 363,
width: 21,
height: 26,
src: "./images/settings/connecteWlanLockedPng.png",
}, chooseAreaDiv)
}
document.createElement('img', {
top: 14,
left: 392,
width: 38,
height: 38,
src: src,
}, chooseAreaDiv)
top += 70
}
wifi_list_div.setAttribute('height', top)
wifi_div.setAttribute('height', top)
}
refreshWifiList([]);
proxy.on("onEnableWLANSwitch", function () {
console.debug("Is @@@@@@@@@@@@@@@@@@@@@@@@@@#3333333")
if (!userData.enableWLANSwitchFlag) {
return;
}
if (wifi_list_div) {
wifi_div.removeChild(wifi_list_div)
}
// if (userData.wlanEnalbed)
// if (wlan_enalbed) {
// if (process.platform == "win32") {
// systemCtrl.executeSystemCommand("wpa_cli scan")
systemCtrl.executeSystemCommand("rm -fr /tmp/scan_result.txt")
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets scan")
setTimeout(function () {
// systemCtrl.executeSystemCommand("wpa_cli scan_results > /tmp/scan_result.txt")
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets scan_results > /tmp/scan_result.txt")
var content = fs.read("/tmp/scan_result.txt", "r")
if (content) {
var results = parseWifiScanResults(content)
console.debug(JSON.stringify(results))
refreshWifiList(results)
}
}, 5000)
// }
// }
})
function connect_wifi(ssid, psk) {
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 set_network 0 ssid \'\"" + ssid + "\"\'")
systemCtrl.executeSystemCommand("usleep 10000") //10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 set_network 0 psk \'\"" + psk + "\"\'")
systemCtrl.executeSystemCommand("usleep 10000") //10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 save_config")
systemCtrl.executeSystemCommand("usleep 10000") //10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 reconfigure")
//启动wpa_supplicant进程
systemCtrl.executeSystemCommand("usleep 200000") //200ms 用于缓冲设置和执行
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 disable_network 0")
systemCtrl.executeSystemCommand("usleep 10000") //10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 enable_network 0")
systemCtrl.executeSystemCommand("usleep 500000") //500ms 用于缓冲联网状态
//启动udhcpc
systemCtrl.executeSystemCommand("udhcpc -b -i wlan0 -t 1 -A 1 -R -H test")
}
function diConnectWifi() {
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 disable_network 0")
systemCtrl.executeSystemCommand("usleep 10000") // 10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 remove_network 0")
systemCtrl.executeSystemCommand("usleep 10000") // 10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 save_config")
systemCtrl.executeSystemCommand("usleep 10000") // 10ms 用于缓冲
systemCtrl.executeSystemCommand("wpa_cli -p /tmp/wpa_supplicant/sockets -i wlan0 reconfigure")
systemCtrl.executeSystemCommand("usleep 200000") // 200ms 用于缓冲设置和执行
systemCtrl.executeSystemCommand("killall -9 udhcpc") // 停止 udhcpc
}
function WifiNoActive() {
console.debug("=====WifiNoActive=====");
userData.wlanSsid = null;
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);
systemCtrl.executeSystemCommand("ifconfig wlan0 down")
}
proxy.on("onEnableWLANSwitchClick", function () {
console.debug("onEnableWLANSwitchClick")
if (userData.enableWLANSwitchFlag == 0) {
userData.enableWLANSwitchFlag = 1;
systemCtrl.executeSystemCommand("ifconfig wlan0 up")
if (userData.wlanSsid != null) {
console.debug("userData.wlanSsid :" + userData.wlanSsid + "userData.wlanPassword :" + userData.wlanPassword + "---> reload wifi");
connect_wifi(userData.wlanSsid, userData.wlanPassword);
}
that.pageObj.refreshEnableWLANSwitchState(userData.enableWLANSwitchFlag);
//判断文件是否有ssid ,如果有开启onGotoWlanEnterPasswordPage
} else {
userData.enableWLANSwitchFlag = 0;
// diConnectWifi();
WifiNoActive();
}
that.pageObj.refreshEnableWLANSwitchState(userData.enableWLANSwitchFlag);
})
}
module.exports = {
Wlan: Wlan
}
\ No newline at end of file
var dlfcn = require("dlfcna.js");
console.log(dlfcn)
var funcs = [
["executeSync", "vi"],
["testPrint", "ii"],
["executeUpdate", "ii"],
["systemMain", "vi"],
["systemReboot", "vi"],
["findSwuFile", "ii"],
["checkPartition", "ii"],
["executeSystemCommand", "is"],
["executePrint", "is"],
];
console.log("in systemCtrl.js")
function register() {
if (globalThis.$simulatorFlag == true) {
return undefined
}
var process = require("@system.process")
if (process.platform == "win32") {
console.log("***will register win32_register_func*****")
const Win32RegFunc = require("win32_register_func.js").Win32RegFunc;
var win32Reg = new Win32RegFunc(funcs);
return win32Reg;
}
console.log("will register systemCtrl.so")
var isSuccess = dlfcn.register("@native.systemCtrl", "./lib/factory/systemCtrl.so", funcs);
if (isSuccess) {
console.log("load so successfully")
var systemCtrl = require("@native.systemCtrl");
return systemCtrl
} else {
console.log("load so failed")
}
return undefined;
}
var systemCtrl = register();
function sync(value) {
systemCtrl.executeSync(value);
}
function findSwuFile(value) {
console.log("There are in findSwuFile function! ");
var findSwuFlag = 0;
findSwuFlag = systemCtrl.findSwuFile(value);
console.log("findSwuFlag=" + findSwuFlag);
return findSwuFlag;
}
function executeSwuUpdate(value1, value2) {
var updateFlag = 0;//升级成功置为1,失败置为0
if ((value1 == 1 || value1 == 0) && (value2 == 1)) {
updateFlag = systemCtrl.executeUpdate(value1);
}
console.log("updateFlag=" + updateFlag);
}
function executeSystemCommand(cmd) {
var executeFlag = systemCtrl.executeSystemCommand(cmd);
// console.log("executeFlag=" + executeFlag);
// if (executeFlag == -1) {
// console.log("executeSystemCommand failed!");
// }
// else {
// console.log("executeSystemCommand success!");
// }
}
function executePrint(str) {
console.log("There are in executePrint function! ");
var executeFlag = systemCtrl.executePrint(str);
}
function systemReboot(value) {
systemCtrl.systemReboot(value);
console.log("There are in systemReboot function! ");
}
function checkPartition(value) {
console.log("There are in checkPartition function! ");
var checkValue = systemCtrl.checkPartition(value);
console.log("checkValue=" + checkValue);
return checkValue;
}
function systemMain(value) {
systemCtrl.systemMain(value);
console.log("There are in systemMain function! ");
}
module.exports = {
sync: sync,
findSwuFile: findSwuFile,
systemMain: systemMain,
systemReboot: systemReboot,
checkPartition: checkPartition,
executeSwuUpdate: executeSwuUpdate,
executeSystemCommand: executeSystemCommand,
executePrint: executePrint,
}
\ 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