From 683b1595260e638d1d3c6cc0d6543a72f6d6f925 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期二, 12 一月 2021 14:36:42 +0800
Subject: [PATCH] 扣分码标准化
---
lib/src/main/cpp/master/comm_if.cpp | 65 ++++++++++++++++++++++++++++++--
1 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp
index 1af9356..b1898f6 100644
--- a/lib/src/main/cpp/master/comm_if.cpp
+++ b/lib/src/main/cpp/master/comm_if.cpp
@@ -22,6 +22,7 @@
#include <vector>
#include <list>
#include <semaphore.h>
+#include <unistd.h>
#define DEBUG(fmt, args...) LOGD("<comm_if> <%s>: " fmt, __func__, ##args)
@@ -74,6 +75,8 @@
#define ID_SM_CAN_BRIEF 0x0021
#define ID_SM_BLUETOOTH_BRIEF 0x0022
+#define ID_SM_RTK_STATUS_BRIEF 0x0023
+
#define MA_OUT_GPS_BRIEF 0x0001
#define MA_OUT_RTK_BRIEF 0x0002
#define MA_OUT_CAR_BRIEF 0x0004
@@ -121,16 +124,26 @@
if (MessageBuffer.size() > 0) {
struct msg_2_main_t msg;
+ int success;
pthread_mutex_lock(&msg_mutex);
msg = MessageBuffer.back();
- MessageBuffer.pop_back();
pthread_mutex_unlock(&msg_mutex);
if (msg.value.length() > 0)
- SendMsgToMainProc(msg.cmd, msg.value.c_str());
+ success = SendMsgToMainProc(msg.cmd, msg.value.c_str());
else
- SendMsgToMainProc(msg.cmd, NULL);
+ success = SendMsgToMainProc(msg.cmd, NULL);
+
+ if (success == 0) {
+ pthread_mutex_lock(&msg_mutex);
+ MessageBuffer.pop_back();
+ pthread_mutex_unlock(&msg_mutex);
+ } else {
+ // 寤惰繜閲嶅彂
+ usleep(500000);
+ sem_post(&sem_msg_income);
+ }
}
}
}
@@ -646,6 +659,7 @@
{
switch (cmd) {
case ID_MS_RTK_PLAT_CFG: {
+ DEBUG("骞冲彴淇℃伅 %s", value);
if (OnOff == 0) OnOff = MA_OUT_GPS_BRIEF + MA_OUT_RTK_BRIEF + MA_OUT_CAR_BRIEF;
rtk_platform_cfg_t cfg;
@@ -1971,9 +1985,28 @@
const Value &s2 = (*itr)["tts"];
content[n].item = s1.GetInt();
- strcpy(content[n].tts, s2.GetString());
- n++;
+ content[n].tts = s2.GetString();
}
+
+ if (itr->HasMember("wrong_code")) {
+ const Value &s = (*itr)["wrong_code"];
+
+ content[n].wrongCode = s.GetInt();
+ }
+
+ if (itr->HasMember("process")) {
+ const Value& s = doc["process"];
+ for(Value::ConstValueIterator itr2 = s.Begin(); itr2 != s.End(); ++itr2) {
+ content[n].process.push_back(itr2->GetInt());
+ }
+ }
+ if (itr->HasMember("solution")) {
+ const Value& s = doc["solution"];
+ for(Value::ConstValueIterator itr2 = s.Begin(); itr2 != s.End(); ++itr2) {
+ content[n].solution.push_back(itr2->GetInt());
+ }
+ }
+ n++;
}
SetDummyLightExam(n, content);
@@ -2063,3 +2096,25 @@
SendMsgToMainProcIndep(ID_SM_BLUETOOTH_BRIEF, sb.GetString());
}
+
+void MA_SendRtkStatus(const char *model, int status)
+{
+ StringBuffer sb;
+ Writer<StringBuffer> writer(sb);
+
+ writer.StartObject();
+
+ writer.Key("model");
+ if (model == NULL || model[0] == 0) {
+ writer.String("Unknown");
+ } else {
+ writer.String(model);
+ }
+
+ writer.Key("status");
+ writer.Int(status);
+
+ writer.EndObject();
+
+ SendMsgToMainProcIndep(ID_SM_RTK_STATUS_BRIEF, sb.GetString());
+}
--
Gitblit v1.8.0