Commit 0e340286 authored by lyong's avatar lyong

refactor(factoryTest): 优化系统

parent 3dd90d38
......@@ -3,6 +3,7 @@ var _userdata = require("userdata.js");
var userData = _userdata.userData;
const fs = require("@system.fs");
var systemCtrl = require("systemCtrl.js");
var process = require("@system.process");
var that;
var systemInfoTimer = null;
var systemInfo = {};
......@@ -56,7 +57,7 @@ function setTextColorByValue(that, fullKey, value) {
if (value === "NG") ngCount++;
// 3. 等所有项都检测完再写全局变量
console.log("textValueKeys.length: " + textValueKeys.length +", checkedCount: " + checkedCount + ", ngCount: " + ngCount)
console.log("textValueKeys.length: " + textValueKeys.length + ", checkedCount: " + checkedCount + ", ngCount: " + ngCount)
console.log("factoryTestSystemCheck: " + that.factoryTestSystemCheck)
if (checkedCount === textValueKeys.length) {
......@@ -81,16 +82,32 @@ function updateSystemInfo() {
systemInfo.softwareVersion = userData.softwareVersion;
systemInfo.hardwareVersion = userData.hardwareVersion;
systemInfo.factorywareVersion = userData.factorywareVersion;
if (process.platform == "win32") {
systemInfo.cpuTemperature = "NG";
systemInfo.cpuFrequency = "NG";
systemInfo.storageInfo = {
totalSizeMB: "NG",
totalAvailableMB: "NG"
}
systemInfo.wifiMac = "NG";
systemInfo.licenseRegistered = "NG";
systemInfo.wifiIp = "NG";
} else {
systemInfo.cpuTemperature = getCPUTemperature();
systemInfo.cpuFrequency = getCPUFrequency();
systemInfo.storageInfo = getTotalStorageInfo();
systemInfo.wifiMac = getWifiInfo("address");
systemInfo.licenseRegistered = (checkLicense() == 1 ? "Pass" : "NG"); // 需根据实际实现
systemInfo.wifiIp = getWifiInfo("ip_address"); //前提wifi要连接
}
systemInfo.sn = userData.aboutSNValue || "NG";
systemInfo.tpVersion = "V5A"; // 示例值
systemInfo.screenVendor = getScreenVendor(); // 需根据实际实现
systemInfo.wifiModel = "AP62212"; // 示例值
systemInfo.licenseRegistered = (checkLicense() == 1 ? "Pass" : "NG"); // 需根据实际实现
systemInfo.wifiIp = getWifiInfo("ip_address"); //前提wifi要连接
......@@ -115,7 +132,7 @@ function updateSystemInfo() {
// that.crtsystemId2_TextValue2: "NG",
that.crtsystemId2_TextValue3 = systemInfo.licenseRegistered;
that.crtsystemId2_TextValue4 = (systemInfo.cpuTemperature != "NG") ? systemInfo.cpuTemperature + "" : systemInfo.cpuTemperature;
that.crtsystemId2_TextValue5 =(systemInfo.storageInfo.totalAvailableMB != "NG" && systemInfo.storageInfo.totalSizeMB != "NG") ? systemInfo.storageInfo.totalAvailableMB + "MB" + "/" + systemInfo.storageInfo.totalSizeMB + "MB" : "NG";
that.crtsystemId2_TextValue5 = (systemInfo.storageInfo.totalAvailableMB != "NG" && systemInfo.storageInfo.totalSizeMB != "NG") ? systemInfo.storageInfo.totalAvailableMB + "MB" + "/" + systemInfo.storageInfo.totalSizeMB + "MB" : "NG";
// that.crtsystemId3_TextHeader1: "产测版本:",
// that.crtsystemId3_TextHeader2: "屏模组信息:",
......@@ -124,7 +141,7 @@ function updateSystemInfo() {
// that.crtsystemId3_TextHeader5: "IP地址:",
that.crtsystemId3_TextValue1 = systemInfo.factorywareVersion;
that.crtsystemId3_TextValue2 = systemInfo.screenVendor;
that.crtsystemId3_TextValue3 = (systemInfo.cpuFrequency != "NG") ? systemInfo.cpuFrequency +"MHz" : systemInfo.cpuFrequency;
that.crtsystemId3_TextValue3 = (systemInfo.cpuFrequency != "NG") ? systemInfo.cpuFrequency + "MHz" : systemInfo.cpuFrequency;
that.crtsystemId3_TextValue4 = systemInfo.wifiIp;
// that.crtsystemId3_TextValue5: "NG",
......@@ -162,8 +179,8 @@ function startSystemInfoTimer(obj) {
}
systemInfoTimer = setInterval(() => {
updateSystemInfo();
}, 2000);
console.log("系统信息定时器已启动(500ms)");
}, 5000);
console.log("系统信息定时器已启动(5000ms)");
}
// 停止定时器
......
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