完善 WOER 品牌与终端交互
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>星元智灵异常场景测试</title>
|
||||
<title>WOER 回收箱异常场景测试</title>
|
||||
<link rel="stylesheet" href="../../app/src/main/assets/www/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -15,6 +15,7 @@
|
||||
var scenario = params.get("scenario") || "pass";
|
||||
var baselineDelay = Number(params.get("baselineDelay") || 30);
|
||||
var weightQueryCounts = {};
|
||||
var connectionCheckCount = 0;
|
||||
if (params.get("clear") === "1") localStorage.clear();
|
||||
window.__nativeCalls = [];
|
||||
|
||||
@@ -42,7 +43,9 @@
|
||||
},
|
||||
requestConnectionCheck: function (json) {
|
||||
var request = record("requestConnectionCheck", json);
|
||||
var serialOnline = scenario !== "serial-fail" && scenario !== "all-fail";
|
||||
connectionCheckCount += 1;
|
||||
var serialOnline = scenario !== "serial-fail" && scenario !== "all-fail" &&
|
||||
!(scenario === "serial-recover" && connectionCheckCount < 3);
|
||||
var networkOnline = scenario !== "network-fail" && scenario !== "all-fail";
|
||||
emitConnection({
|
||||
requestId: request.requestId,
|
||||
@@ -78,10 +81,67 @@
|
||||
openThrowDoor: function (json) { record("openThrowDoor", json); return scenario !== "open-fail"; },
|
||||
closeThrowDoor: function (json) { record("closeThrowDoor", json); return scenario !== "close-fail"; },
|
||||
reportXingyuanDelivery: function (json) { record("reportXingyuanDelivery", json); return true; },
|
||||
saveLocalBackup: function (json) { record("saveLocalBackup", json); return "/tmp/test-backup.json"; }
|
||||
saveLocalBackup: function (json) { record("saveLocalBackup", json); return "/tmp/test-backup.json"; },
|
||||
setFaceRecognitionActive: function (json) { record("setFaceRecognitionActive", json); },
|
||||
setFacePreviewLayout: function (json) { record("setFacePreviewLayout", json); },
|
||||
prepareFaceEnrollment: function (json) { record("prepareFaceEnrollment", json); return true; },
|
||||
getFaceRecognitionStatus: function () {
|
||||
return JSON.stringify({ ok: true, status: "ready", message: "SeetaFace6 识别引擎已就绪", enrolledCount: 1 });
|
||||
},
|
||||
enrollCurrentFace: function (json) {
|
||||
record("enrollCurrentFace", json);
|
||||
return JSON.stringify({ ok: true, message: "人脸录入成功" });
|
||||
},
|
||||
setFaceMatchThreshold: function (json) {
|
||||
var request = record("setFaceMatchThreshold", json);
|
||||
return JSON.stringify({ ok: true, threshold: Number(request.threshold || 0.75) });
|
||||
},
|
||||
listFacePeople: function () {
|
||||
var people = scenario === "no-people" ? [] : [
|
||||
{ faceId: "FACE-1000", employeeNo: "1000", name: "测试员" }
|
||||
];
|
||||
return JSON.stringify({ ok: true, people: people, count: people.length });
|
||||
},
|
||||
verifyMember: function (json) {
|
||||
var request = record("verifyMember", json);
|
||||
if (scenario === "auth-fail") return JSON.stringify({ ok: false, error: "测试鉴权失败" });
|
||||
return JSON.stringify({
|
||||
ok: true,
|
||||
memberCode: request.idContent || "1000",
|
||||
employeeNo: request.idContent || "1000",
|
||||
memberId: "MEMBER-TEST",
|
||||
name: "测试员"
|
||||
});
|
||||
},
|
||||
listSerialPorts: function () {
|
||||
return JSON.stringify({
|
||||
ok: true,
|
||||
ports: [
|
||||
{ path: "/dev/ttyS0", readable: true, writable: true },
|
||||
{ path: "/dev/ttysWK0", readable: true, writable: true },
|
||||
{ path: "/dev/ttyUSB0", readable: true, writable: true }
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
<script src="../../app/src/main/assets/www/app.js"></script>
|
||||
<script src="../../app/src/main/assets/www/app.js?v=1.2.22"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var scenario = new URLSearchParams(location.search).get("scenario") || "pass";
|
||||
if (scenario !== "camera-fail") return;
|
||||
window.setTimeout(function () {
|
||||
var receiver = window.ZhitouSerial || window.XingyuanSerial;
|
||||
if (receiver && typeof receiver.onFaceStatus === "function") {
|
||||
receiver.onFaceStatus({
|
||||
status: "camera_error",
|
||||
message: "摄像头启动失败:设备被占用",
|
||||
enrolledCount: 1
|
||||
});
|
||||
}
|
||||
}, 3400);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user