| | |
| | | #include "../utils/xconvert.h" |
| | | #include "../driver_test.h" |
| | | #include "../defs.h" |
| | | #include "../common/apptimer.h" |
| | | #include "../jni_log.h" |
| | | |
| | | #include <string> |
| | | #include <iostream> |
| | | #include <vector> |
| | | |
| | | #define DEBUG(fmt, args...) LOGD("<comm_if> <%s>: " fmt, __func__, ##args) |
| | | |
| | | using namespace rapidjson; |
| | | using namespace std; |
| | |
| | | SendMsgToMainProc(ID_SM_RTK_BRIEF, sb.GetString()); |
| | | } |
| | | |
| | | void MA_SendExamWrong(vector<int>&err) |
| | | void MA_SendExamWrong(vector<ExamFault> &ExamFaultList) |
| | | { |
| | | StringBuffer sb; |
| | | Writer<StringBuffer> writer(sb); |
| | | |
| | | writer.StartArray(); |
| | | |
| | | for (int i = 0; i < 3; ++i) { |
| | | writer.StartObject(); // Between StartObject()/EndObject(), |
| | | writer.Key("wrong_id"); // output a key, |
| | | writer.Int(i+1); |
| | | writer.EndObject(); |
| | | } |
| | | |
| | | for (vector<ExamFault>::iterator iter = ExamFaultList.begin(); iter != ExamFaultList.end(); ++iter) { |
| | | writer.StartObject(); |
| | | |
| | | writer.Key("sn"); |
| | | writer.Int(iter->sn); |
| | | writer.Key("utc"); |
| | | writer.String(iter->utc); |
| | | writer.Key("wrong_id"); |
| | | writer.Int(iter->wrong_id); |
| | | |
| | | writer.EndObject(); |
| | | } |
| | | |
| | | writer.EndArray(); |
| | | |
| | | SendMsgToMainProc(ID_SM_EXAM_BRIEF, sb.GetString()); |
| | | } |
| | | |
| | | void MA_SendCarPosition(const struct carBrief *brief) |
| | |
| | | writer.Int(brief->right_rear_tire[1]); |
| | | writer.EndArray(); |
| | | |
| | | writer.Key("body"); |
| | | writer.StartArray(); |
| | | for (int i = 0; i < brief->bodyNum; ++i) { |
| | | writer.Int(brief->body[i]); |
| | | } |
| | | writer.EndArray(); |
| | | |
| | | writer.Key("point"); |
| | | writer.StartArray(); |
| | | for (int i = 0; i < brief->pointNum; ++i) { |
| | |
| | | writer.EndArray(); |
| | | writer.EndObject(); |
| | | |
| | | uint32_t a = AppTimer_GetTickCount(); |
| | | SendMsgToMainProc(ID_SM_CAR, sb.GetString()); |
| | | DEBUG("耗时 %ld", AppTimer_GetTickCount() - a); |
| | | } |
| | | |
| | | void MA_MainProcMsgEntry(int cmd, const char *value) |
| | |
| | | if (!doc.HasParseError()) { |
| | | double basePoint[2]; |
| | | int axial[2], left_front_tire[2], right_front_tire[2], left_rear_tire[2], right_rear_tire[2]; |
| | | int bodyNum = 0; |
| | | int *body = NULL; |
| | | int pointNum = 0; |
| | | double (*point)[2] = NULL; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (doc.HasMember("body")) { |
| | | const Value& s = doc["body"]; |
| | | if (s.IsArray()) { |
| | | int i = 0; |
| | | bodyNum = s.Size(); |
| | | body = new int[bodyNum]; |
| | | for(Value::ConstValueIterator itr = s.Begin(); itr != s.End(); ++itr) { |
| | | body[i++] = itr->GetInt(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (doc.HasMember("point")) { |
| | | const Value& s = doc["point"]; |
| | | if (s.IsArray()) { |
| | |
| | | } |
| | | |
| | | SetCarMeasurePoint(basePoint, axial, left_front_tire, right_front_tire, |
| | | left_rear_tire, right_rear_tire, point, pointNum); |
| | | left_rear_tire, right_rear_tire, body, bodyNum, point, pointNum); |
| | | |
| | | if (body != NULL) delete []body; |
| | | if (point != NULL) delete []point; |
| | | } |
| | | break; |