From 10c6d47260b4fb34262ec7a703a06fffa6a90ad0 Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期二, 10 三月 2020 15:08:05 +0800
Subject: [PATCH] 角度修正。

---
 lib/src/main/cpp/driver_test.cpp             |   13 ++++++++++++-
 lib/src/main/cpp/test_items2/dummy_light.cpp |   26 ++++++++++++++++++++++++--
 lib/src/main/cpp/test_items2/dummy_light.h   |    2 ++
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index 699c23c..bb73b52 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -59,7 +59,14 @@
     TEST_END
 };
 
+enum {
+    TEST_TYPE_AREA = 2,
+    TEST_TYPE_ROAD_DUMMY_LIGHT,
+    TEST_TYPE_ROAD_TRUE_LIGHT
+};
+
 static bool TestStart = false;
+static int TestType;
 
 static int CarInArea = 0;
 int errs = 0;
@@ -406,7 +413,7 @@
         err = true;
         MA_SendExamStatus(0, -2);
     }
-    if (DummyLightContent == NULL && type == 3) {
+    if (DummyLightContent == NULL && type == TEST_TYPE_ROAD_DUMMY_LIGHT) {
         err = true;
         MA_SendExamStatus(0, -3);
     }
@@ -418,6 +425,10 @@
 
             TestStart = true;
             CommTestStart(true);
+
+            if (type == TEST_TYPE_ROAD_DUMMY_LIGHT) {
+                StartDummyLightExam(DummyLightContent, DummyLightContentSize);
+            }
         }
         MA_SendExamStatus(1, 0);
     }
diff --git a/lib/src/main/cpp/test_items2/dummy_light.cpp b/lib/src/main/cpp/test_items2/dummy_light.cpp
index 4cd2771..8bf7ec4 100644
--- a/lib/src/main/cpp/test_items2/dummy_light.cpp
+++ b/lib/src/main/cpp/test_items2/dummy_light.cpp
@@ -3,14 +3,36 @@
 //
 
 #include <cstdlib>
+#include "../common/apptimer.h"
 #include "dummy_light.h"
+#include "../native-lib.h"
+#include "../jni_log.h"
+
+#define DEBUG(fmt, args...)     LOGD("<dummy_light> <%s>: " fmt, __func__, ##args)
 
 static struct dummy_light_exam *content;
-static int cn;
+static int contentNum;
+static int currContent;
+
+static void ExamDummyLight(union sigval sig);
 
 void StartDummyLightExam(struct dummy_light_exam *ptr, int num)
 {
     content = ptr;
-    cn = num;
+    contentNum = num;
+    currContent = 0;
+    AppTimer_add(ExamDummyLight, D_SEC(2));
 }
 
+static void ExamDummyLight(union sigval sig)
+{
+    AppTimer_delete(ExamDummyLight);
+
+    if (currContent < contentNum) {
+        DEBUG("妯℃嫙鐏厜娴嬭瘯 %s", content[currContent].tts);
+
+        PlayTTS(content[currContent].tts);
+        currContent++;
+        AppTimer_add(ExamDummyLight, D_SEC(5));
+    }
+}
diff --git a/lib/src/main/cpp/test_items2/dummy_light.h b/lib/src/main/cpp/test_items2/dummy_light.h
index 68d4a06..7ae97b3 100644
--- a/lib/src/main/cpp/test_items2/dummy_light.h
+++ b/lib/src/main/cpp/test_items2/dummy_light.h
@@ -10,4 +10,6 @@
     char tts[512];
 };
 
+void StartDummyLightExam(struct dummy_light_exam *ptr, int num);
+
 #endif //MYAPPLICATION2_DUMMY_LIGHT_H

--
Gitblit v1.8.0