From a3c194e003b0cfb272e153ff11c510e02c5f72cd Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期一, 25 五月 2020 18:32:11 +0800
Subject: [PATCH] 坐标

---
 lib/src/main/cpp/test_items2/drive_straight.cpp |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/lib/src/main/cpp/test_items2/drive_straight.cpp b/lib/src/main/cpp/test_items2/drive_straight.cpp
index 3b9f8d3..4e006f3 100644
--- a/lib/src/main/cpp/test_items2/drive_straight.cpp
+++ b/lib/src/main/cpp/test_items2/drive_straight.cpp
@@ -8,6 +8,7 @@
 #include "../jni_log.h"
 #include "road_exam.h"
 #include "../master/comm_if.h"
+#include "../common/apptimer.h"
 #include <cmath>
 
 #define DEBUG(fmt, args...)     LOGD("<drive_straight> <%s>: " fmt, __func__, ##args)
@@ -20,24 +21,30 @@
 static bool reportOffsetOver;
 static double edgeDistance;
 static double distanceToStartSum;
+static int examTtsSeq;
 
 static double CalcDistance2Edge(road_t &road,  const car_model *car);
+static void PlayTTSTimeout(union sigval sig);
 
 void StartDriveStraightExam(std::string tts) {
     DEBUG("寮�濮嬬洿绾胯椹�");
 
+    ttsPlayEnd = 0;
     if (!tts.empty()) {
-        PlayTTS(tts.c_str());
+        examTtsSeq = PlayTTS(tts.c_str());
     } else {
-        DEBUG("娌℃湁TTS");
+        examTtsSeq = PlayTTS("璇蜂繚鎸佺洿绾胯椹�");
     }
 
     distanceToStartSum = 0;
     reportOffsetOver = false;
+
+    AppTimer_delete(PlayTTSTimeout);
+    AppTimer_add(PlayTTSTimeout, D_SEC(5));
 }
 
 int ExecuteDriveStraightExam(road_t &road,  const car_model *car,
-                             LIST_CAR_MODEL &CarModelList, double speed, int moveDirect, const struct RtkTime *rtkTime) {
+                             const trigger_line_t *item, const struct RtkTime *rtkTime) {
     static PointF startPoint;
 
     double dis2roadEdge = 0;
@@ -86,6 +93,27 @@
     return 1;
 }
 
+void DriveStraightTTSDone(int id)
+{
+    // 绛夎闊虫挱鎶ュ畬姣曞悗璁℃椂
+    if (id == examTtsSeq) {
+        DEBUG("StopCarTTSDone %d", id);
+        ttsPlayEnd = 1;
+    }
+}
+
+void TerminateDriveStraightExam(void)
+{
+    AppTimer_delete(PlayTTSTimeout);
+}
+
+static void PlayTTSTimeout(union sigval sig)
+{
+    AppTimer_delete(PlayTTSTimeout);
+
+    ttsPlayEnd = 1;
+}
+
 static double CalcDistance2Edge(road_t &road,  const car_model *car)
 {
     PointF vp;

--
Gitblit v1.8.0