yy1717
2020-09-18 03a05501800d2c02bca1c05ca6f7080d715aba23
lib/src/main/cpp/master/comm_if.cpp
@@ -39,6 +39,7 @@
#define ID_MS_MAP               0x8006
#define ID_MS_ROAD_MAP          0x8014
#define ID_MS_ROAD_MAP2         0x8013
#define ID_MS_SCHEME            0x8017
#define ID_SM_READ_CAR          0x0007
#define ID_MS_CAR               0x8007
@@ -1263,6 +1264,90 @@
            break;
        }
        case ID_MS_SCHEME: {
            Document doc;
            doc.Parse(value);
            if (!doc.HasParseError()) {
                DEBUG("开始解析路考方案");
                vector<scheme_t> schemes;
                if (doc.HasMember("scheme")) {
                    const Value &a = doc["scheme"];
                    for (Value::ConstValueIterator itr = a.Begin();
                         itr != a.End(); ++itr) {
                        scheme_t scheme;
                        if (itr->HasMember("name")) {
                            const Value &s = (*itr)["name"];
                            scheme.name = s.GetString();
                        }
                        if (itr->HasMember("crossing_active")) {
                            const Value &a2 = (*itr)["crossing_active"];
                            for (Value::ConstValueIterator itr2 = a2.Begin();
                                 itr2 != a2.End(); ++itr2) {
                                crossing_active_t act;
                                if (itr2->HasMember("road")) {
                                    const Value &s = (*itr2)["road"];
                                    act.road_id = s.GetInt();
                                }
                                if (itr2->HasMember("idx")) {
                                    const Value &s = (*itr2)["idx"];
                                    act.index = s.GetInt();
                                }
                                if (itr2->HasMember("active")) {
                                    const Value &s = (*itr2)["active"];
                                    act.active = s.GetInt();
                                }
                                scheme.crossingActive.push_back(act);
                            }
                        }
                        if (itr->HasMember("trigger_line")) {
                            const Value &a2 = (*itr)["trigger_line"];
                            for (Value::ConstValueIterator itr2 = a2.Begin();
                                 itr2 != a2.End(); ++itr2) {
                                trigger_line_t ins;
                                if (itr2->HasMember("x_y")) {
                                    const Value &a3 = (*itr2)["x_y"];
                                    if (a3.IsArray()) {
                                        PointF point;
                                        int n = 0;
                                        for (Value::ConstValueIterator itr3 = a3.Begin();
                                             itr3 != a3.End(); ++itr3) {
                                            if (n == 0) {
                                                point.X = (*itr3).GetDouble();
                                                n = 1;
                                            } else if (n == 1) {
                                                point.Y = (*itr3).GetDouble();
                                                ins.points.push_back(point);
                                                n = 0;
                                            }
                                        }
                                    }
                                }
                                if (itr2->HasMember("road")) {
                                    const Value &s = (*itr2)["road"];
                                    ins.road = s.GetInt();
                                }
                                if (itr2->HasMember("type")) {
                                    const Value &s = (*itr2)["type"];
                                    ins.active = s.GetInt();
                                }
                                scheme.triggerLines.push_back(ins);
                            }
                        }
                        schemes.push_back(scheme);
                    }
                }
                SetRoadExamScheme(schemes);
            }
            break;
        }
        case ID_MS_MAP: {
            Document doc;
            doc.Parse(value);
@@ -1471,7 +1556,7 @@
            break;
        }
        case ID_MS_SENSOR_CFG: {
            Document doc;
            /*Document doc;
            doc.Parse(value);
            if (!doc.HasParseError()) {
                const Value &a = doc.GetArray();
@@ -1500,7 +1585,7 @@
                    SetSensorCfg(sensor, n);
                    delete []sensor;
                }
            }
            }*/
            break;
        }
        case ID_MS_START_EXAM: {