From 2dd405a64e0a6e468a205e7348520e87576e5358 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 09 三月 2020 17:13:12 +0800 Subject: [PATCH] 更新地图 --- lib/src/main/cpp/master/comm_if.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp index 3ee83da..5b64329 100644 --- a/lib/src/main/cpp/master/comm_if.cpp +++ b/lib/src/main/cpp/master/comm_if.cpp @@ -53,6 +53,8 @@ #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 @@ -708,10 +710,16 @@ 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; } @@ -763,6 +771,39 @@ } 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; } } @@ -779,7 +820,7 @@ } } -void MA_EnterMap(int map_id, int enter) +void MA_EnterMap(int map_id, int type, int enter) { StringBuffer sb; Writer<StringBuffer> writer(sb); @@ -787,9 +828,16 @@ 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); +} -- Gitblit v1.8.0