| | |
| | | test_items/comm_test.cpp |
| | | |
| | | test_items2/common_check.cpp |
| | | test_items2/dummy_light.cpp |
| | | |
| | | rtk_module/rtk.cpp |
| | | rtk_module/virtual_rtk.cpp |
| | |
| | | |
| | | static int SensorValidLevel; |
| | | |
| | | static struct dummy_light_exam *DummyLightContent; |
| | | static int DummyLightContentSize; |
| | | |
| | | #define MOV_AVG_SIZE 1 |
| | | #define RTK_BUFFER_SIZE 100 |
| | | #define CAR_MODEL_CACHE_SIZE 10 |
| | |
| | | memset(SensorConfig, 0, sizeof(SensorConfig)); |
| | | |
| | | SensorValidLevel = 0; |
| | | |
| | | DummyLightContentSize = 0; |
| | | DummyLightContent = NULL; |
| | | |
| | | RtkBuffer = (rtk_info *) malloc(RTK_BUFFER_SIZE * sizeof(rtk_info)); |
| | | RtkBufferNum = RtkBufferIn = 0; |
| | |
| | | } |
| | | } |
| | | |
| | | void StartDriverExam(int start) |
| | | void SetDummyLightExam(int n, struct dummy_light_exam *cfg) |
| | | { |
| | | if (TestStart) return; |
| | | |
| | | if (DummyLightContent != NULL) { |
| | | free(DummyLightContent); |
| | | DummyLightContent = NULL; |
| | | } |
| | | |
| | | DummyLightContent = (struct dummy_light_exam *)malloc(n * sizeof(struct dummy_light_exam)); |
| | | DummyLightContentSize = n; |
| | | |
| | | for (int i = 0; i < n; i++) { |
| | | DummyLightContent[i] = cfg[i]; |
| | | } |
| | | } |
| | | |
| | | void StartDriverExam(int start, int type) |
| | | { |
| | | bool err = false; |
| | | |
| | |
| | | err = true; |
| | | MA_SendExamStatus(0, -2); |
| | | } |
| | | if (DummyLightContent == NULL && type == 3) { |
| | | err = true; |
| | | MA_SendExamStatus(0, -3); |
| | | } |
| | | |
| | | if (!err) { |
| | | if (!TestStart) { |
| | | ExamFaultList.clear(); |
| | |
| | | CurrEnterMapIndex = EnterMap(CarModel, MapList, MapNum); |
| | | if (CurrEnterMapIndex >= 0) { |
| | | DEBUG("发送进入场地报告 %d", GetMapId(CurrEnterMapIndex, MapList, MapNum)); |
| | | MA_EnterMap(GetMapId(CurrEnterMapIndex, MapList, MapNum), 1); |
| | | MA_EnterMap(GetMapId(CurrEnterMapIndex, MapList, MapNum), GetMapType(CurrEnterMapIndex, MapList, MapNum), 1); |
| | | |
| | | CurrExamMapIndex = CurrEnterMapIndex; |
| | | CurrExamStatus = EXAM_AREA_START; |
| | |
| | | } else { |
| | | if (ExitMap(CarModel, CurrEnterMapIndex, MapList, MapNum)) { |
| | | DEBUG("发送离开场地报告 %d", GetMapId(CurrEnterMapIndex, MapList, MapNum)); |
| | | MA_EnterMap(GetMapId(CurrEnterMapIndex, MapList, MapNum), 0); |
| | | MA_EnterMap(GetMapId(CurrEnterMapIndex, MapList, MapNum), GetMapType(CurrEnterMapIndex, MapList, MapNum), 0); |
| | | CurrEnterMapIndex = -1; |
| | | } |
| | | } |
| | |
| | | |
| | | #include "Geometry.h" |
| | | #include "rtk_module/rtk.h" |
| | | #include "test_items2/dummy_light.h" |
| | | |
| | | #include <vector> |
| | | |
| | |
| | | void GetSensorCfg(int gpio, int &func, bool &lvl); |
| | | void FindSensorCfg(int func, int &gpio, bool &lvl); |
| | | |
| | | void StartDriverExam(int start); |
| | | void StartDriverExam(int start, int type); |
| | | void StartMapExam(int map_id, int exam); |
| | | void GetRtkClock(struct RtkTime *s); |
| | | void UpdateRTKInfo(const rtk_info *s); |
| | |
| | | car_model_cache_t *GetCarModelCache(int node); |
| | | void SystemShutdown(int event, int timeout); |
| | | |
| | | void SetDummyLightExam(int n, struct dummy_light_exam *cfg);; |
| | | |
| | | #endif //RTKDRIVERTEST_DRIVER_TEST_H |
| | |
| | | #define ID_MS_READ_CARD 0x8011 |
| | | #define ID_SM_PUT_CARD 0x0011 |
| | | #define ID_MS_SYS_SHUTDOWN 0x8010 |
| | | #define ID_SM_LIGHT_EXAM_REQ 0x0012 |
| | | #define ID_MS_LIGHT_EXAM_RES 0x8012 |
| | | |
| | | #define MA_OUT_GPS_BRIEF 0x0001 |
| | | #define MA_OUT_RTK_BRIEF 0x0002 |
| | |
| | | Document doc; |
| | | doc.Parse(value); |
| | | if (!doc.HasParseError()) { |
| | | int start = 0, type = 0; |
| | | if (doc.HasMember("exam")) { |
| | | Value& s = doc["exam"]; |
| | | StartDriverExam(s.GetInt()); |
| | | start = s.GetInt(); |
| | | } |
| | | if (doc.HasMember("type")) { |
| | | Value& s = doc["type"]; |
| | | type = s.GetInt(); |
| | | } |
| | | StartDriverExam(start, type); |
| | | } |
| | | break; |
| | | } |
| | |
| | | } |
| | | break; |
| | | } |
| | | case ID_MS_LIGHT_EXAM_RES: { |
| | | Document doc; |
| | | doc.Parse(value); |
| | | if (!doc.HasParseError()) { |
| | | if (doc.HasMember("exam")) { |
| | | const Value& s = doc["exam"]; |
| | | s.GetInt(); |
| | | } |
| | | if (doc.HasMember("question")) { |
| | | const Value& s = doc["question"]; |
| | | if (s.IsArray() && s.Size() > 0) { |
| | | int n = 0; |
| | | struct dummy_light_exam *content = new struct dummy_light_exam[s.Size()]; |
| | | |
| | | for(Value::ConstValueIterator itr = s.Begin(); itr != s.End(); ++itr) { |
| | | if (itr->HasMember("item") && itr->HasMember("tts")) { |
| | | const Value &s1 = (*itr)["item"]; |
| | | const Value &s2 = (*itr)["tts"]; |
| | | |
| | | content[n].item = s1.GetInt(); |
| | | strcpy(content[n].tts, s1.GetString()); |
| | | n++; |
| | | } |
| | | } |
| | | |
| | | SetDummyLightExam(n, content); |
| | | |
| | | delete []content; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | default:break; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | void MA_EnterMap(int map_id, int enter) |
| | | void MA_EnterMap(int map_id, int type, int enter) |
| | | { |
| | | StringBuffer sb; |
| | | Writer<StringBuffer> writer(sb); |
| | |
| | | writer.StartObject(); |
| | | writer.Key("map_id"); |
| | | writer.Int(map_id); |
| | | writer.Key("type"); |
| | | writer.Int(type); |
| | | writer.Key("enter"); |
| | | writer.Int(enter); |
| | | writer.EndObject(); |
| | | |
| | | SendMsgToMainProc(ID_SM_ENTER_MAP, sb.GetString()); |
| | | } |
| | | |
| | | void MA_ExamLight(void) |
| | | { |
| | | SendMsgToMainProc(ID_SM_LIGHT_EXAM_REQ, NULL); |
| | | } |
| | |
| | | void MA_SendExamWrong(vector<ExamFault> &ExamFaultList); |
| | | void MA_SendRtcmInd(int length); |
| | | void MA_SendDebugInfo(const char *str, ...); |
| | | void MA_EnterMap(int map_id, int enter); |
| | | void MA_EnterMap(int map_id, int type, int enter); |
| | | void MA_ExamLight(void); |
| | | |
| | | #endif //MYAPPLICATION2_COMM_IF_H |
| | |
| | | const int RTK_PLATFORM_PORT = 12125; |
| | | const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x01}; |
| | | |
| | | const char *VIRTUAL_RTK_IP = "192.168.3.52"; |
| | | const char *VIRTUAL_RTK_IP = "192.168.16.100"; |
| | | const int VIRTUAL_RTK_PORT = 9001; |
| | | |
| | | static void SendBootIndicate(union sigval sig); |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/3/9. |
| | | // |
| | | |
| | | #include <cstdlib> |
| | | #include "dummy_light.h" |
| | | |
| | | static struct dummy_light_exam *content; |
| | | static int cn; |
| | | |
| | | void StartDummyLightExam(struct dummy_light_exam *ptr, int num) |
| | | { |
| | | content = ptr; |
| | | cn = num; |
| | | } |
| | | |
New file |
| | |
| | | // |
| | | // Created by YY on 2020/3/9. |
| | | // |
| | | |
| | | #ifndef MYAPPLICATION2_DUMMY_LIGHT_H |
| | | #define MYAPPLICATION2_DUMMY_LIGHT_H |
| | | |
| | | struct dummy_light_exam { |
| | | int item; |
| | | char tts[512]; |
| | | }; |
| | | |
| | | #endif //MYAPPLICATION2_DUMMY_LIGHT_H |
| | |
| | | private IListenerInterface mListener; |
| | | private int msgId = 0; |
| | | private Speaker speaker = null; |
| | | private boolean ttsInitSucc = false; |
| | | |
| | | private IRemoteInterface.Stub iRemoteInterface = new IRemoteInterface.Stub(){ |
| | | @Override |
| | |
| | | speaker = new Speaker(getApplicationContext()); |
| | | |
| | | new Thread(new StartNative()).start(); |
| | | |
| | | new Thread(new TestThread()).start(); |
| | | } |
| | | |
| | | class TestThread implements Runnable { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Thread.sleep(500); |
| | | } catch (InterruptedException e) { |
| | | |
| | | } |
| | | ttsInitSucc = true; |
| | | } |
| | | } |
| | | |
| | | class StartNative implements Runnable { |
| | |
| | | } |
| | | |
| | | public void TextSpeak(String text) { |
| | | if (speaker != null) { |
| | | if (speaker != null && ttsInitSucc) { |
| | | speaker.speak(text); |
| | | } |
| | | } |
| | | |
| | | public void TextSpeakInitCallback(boolean ret) { |
| | | ttsInitSucc = ret; |
| | | } |
| | | |
| | | private String byte2hex(byte [] buffer){ |
| | | StringBuilder h = new StringBuilder(); |
| | | |
| | |
| | | import android.speech.tts.TextToSpeech; |
| | | import android.util.Log; |
| | | |
| | | import com.anyun.exam.lib.RemoteService; |
| | | |
| | | import java.util.Locale; |
| | | |
| | | public class Speaker { |
| | |
| | | |
| | | public Speaker(final Context context) { |
| | | // TODO Auto-generated constructor stub |
| | | Log.d(TAG, "Speaker Init..."); |
| | | this.context = context; |
| | | tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() { |
| | | @Override |