Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re860_factory
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
waterword
re860_factory
Commits
0e340286
Commit
0e340286
authored
Jul 13, 2025
by
lyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(factoryTest): 优化系统
parent
3dd90d38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
24 deletions
+41
-24
factoryTest_plugin/factory_testSystemInfo.js
factoryTest_plugin/factory_testSystemInfo.js
+41
-24
No files found.
factoryTest_plugin/factory_testSystemInfo.js
View file @
0e340286
...
...
@@ -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
=
{};
...
...
@@ -29,7 +30,7 @@ const textValueKeys = [
// "crtsystemId3_TextValue2",
// "crtsystemId3_TextValue3",
// "crtsystemId3_TextValue4",
// "crtsystemId3_TextValue5"
];
...
...
@@ -43,12 +44,12 @@ const textValueKeys = [
let
checkedCount
=
0
;
let
ngCount
=
0
;
let
ngCount
=
0
;
function
setTextColorByValue
(
that
,
fullKey
,
value
)
{
// 1. 设置颜色
const
color
=
(
value
===
"
NG
"
)
?
"
#ff0000
"
:
"
#00ff00
"
;
const
key
=
fullKey
.
replace
(
/^crt/
,
""
);
const
key
=
fullKey
.
replace
(
/^crt/
,
""
);
that
.
$setTextColor
(
key
,
color
);
// 2. 更新计数
...
...
@@ -56,14 +57,14 @@ 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
)
{
that
.
factoryTestSystemCheck
=
(
ngCount
===
0
)
?
1
:
2
;
// 重置计数器,方便下次调用
checkedCount
=
0
;
ngCount
=
0
;
ngCount
=
0
;
}
}
...
...
@@ -81,16 +82,32 @@ function updateSystemInfo() {
systemInfo
.
softwareVersion
=
userData
.
softwareVersion
;
systemInfo
.
hardwareVersion
=
userData
.
hardwareVersion
;
systemInfo
.
factorywareVersion
=
userData
.
factorywareVersion
;
systemInfo
.
cpuTemperature
=
getCPUTemperature
();
systemInfo
.
cpuFrequency
=
getCPUFrequency
();
systemInfo
.
storageInfo
=
getTotalStorageInfo
();
systemInfo
.
wifiMac
=
getWifiInfo
(
"
address
"
);
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要连接
...
...
@@ -104,18 +121,18 @@ function updateSystemInfo() {
that
.
crtsystemId1_TextValue2
=
systemInfo
.
softwareVersion
;
that
.
crtsystemId1_TextValue3
=
systemInfo
.
hardwareVersion
;
that
.
crtsystemId1_TextValue4
=
"
NG
"
,
that
.
crtsystemId1_TextValue5
=
"
792 MHZ
"
,
// that.crtsystemId2_TextHeader1: "WiFi MAC:",
// that.crtsystemId2_TextHeader2: "蓝牙MAC:",
// that.crtsystemId2_TextHeader3: "语音license:",
// that.crtsystemId2_TextHeader4: "CPU温度:",
// that.crtsystemId2_TextHeader5: "存储空间:",
that
.
crtsystemId2_TextValue1
=
systemInfo
.
wifiMac
;
that
.
crtsystemId1_TextValue5
=
"
792 MHZ
"
,
// that.crtsystemId2_TextHeader1: "WiFi MAC:",
// that.crtsystemId2_TextHeader2: "蓝牙MAC:",
// that.crtsystemId2_TextHeader3: "语音license:",
// that.crtsystemId2_TextHeader4: "CPU温度:",
// that.crtsystemId2_TextHeader5: "存储空间:",
that
.
crtsystemId2_TextValue1
=
systemInfo
.
wifiMac
;
// 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
();
},
2
000
);
console
.
log
(
"
系统信息定时器已启动(500ms)
"
);
},
5
000
);
console
.
log
(
"
系统信息定时器已启动(500
0
ms)
"
);
}
// 停止定时器
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment