yy1717
2020-10-23 c484cbb09d445e2ab30ea011c6d2ffd87202bb26
lib/src/main/cpp/master/comm_if.cpp
@@ -40,6 +40,7 @@
#define ID_MS_ROAD_MAP          0x8014
#define ID_MS_ROAD_MAP2         0x8013
#define ID_MS_SCHEME            0x8017
#define ID_MS_EXAM_PARAM        0x8019
#define ID_SM_READ_CAR          0x0007
#define ID_MS_CAR               0x8007
@@ -1370,6 +1371,232 @@
            }
            break;
        }
        case ID_MS_EXAM_PARAM: {
            Document doc;
            doc.Parse(value);
            if (!doc.HasParseError()) {
                if (doc.HasMember("hold_start_key_limit_time")) {
                    const Value &a = doc["hold_start_key_limit_time"];
                    examParam.hold_start_key_limit_time = a.GetInt();
                }
                if (doc.HasMember("curve_pause_criteria")) {
                    const Value &a = doc["curve_pause_criteria"];
                    examParam.curve_pause_criteria = a.GetInt();
                }
                if (doc.HasMember("park_bottom_pause_criteria")) {
                    const Value &a = doc["park_bottom_pause_criteria"];
                    examParam.park_bottom_pause_criteria = a.GetInt();
                }
                if (doc.HasMember("park_bottom_limit_time")) {
                    const Value &a = doc["park_bottom_limit_time"];
                    examParam.park_bottom_limit_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("park_edge_pause_criteria")) {
                    const Value &a = doc["park_edge_pause_criteria"];
                    examParam.park_edge_pause_criteria = a.GetInt();
                }
                if (doc.HasMember("park_edge_limit_time")) {
                    const Value &a = doc["park_edge_limit_time"];
                    examParam.park_edge_limit_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("turn_a90_pause_criteria")) {
                    const Value &a = doc["turn_a90_pause_criteria"];
                    examParam.turn_a90_pause_criteria = a.GetInt();
                }
                if (doc.HasMember("ramp_stoppoint_red_distance")) {
                    const Value &a = doc["ramp_stoppoint_red_distance"];
                    examParam.ramp_stoppoint_red_distance = a.GetDouble();
                }
                if (doc.HasMember("ramp_edge_yellow_distance")) {
                    const Value &a = doc["ramp_edge_yellow_distance"];
                    examParam.ramp_edge_yellow_distance = a.GetDouble();
                }
                if (doc.HasMember("ramp_edge_red_distance")) {
                    const Value &a = doc["ramp_edge_red_distance"];
                    examParam.ramp_edge_red_distance = a.GetDouble();
                }
                if (doc.HasMember("ramp_slide_yellow_distance")) {
                    const Value &a = doc["ramp_slide_yellow_distance"];
                    examParam.ramp_slide_yellow_distance = a.GetDouble();
                }
                if (doc.HasMember("ramp_slide_red_distance")) {
                    const Value &a = doc["ramp_slide_red_distance"];
                    examParam.ramp_slide_red_distance = a.GetDouble();
                }
                if (doc.HasMember("ramp_start_car_limit_time")) {
                    const Value &a = doc["ramp_start_car_limit_time"];
                    examParam.ramp_start_car_limit_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("road_slide_yellow_distance")) {
                    const Value &a = doc["road_slide_yellow_distance"];
                    examParam.road_slide_yellow_distance = a.GetDouble();
                }
                double road_slide_red_distance;
                if (doc.HasMember("road_slide_red_distance")) {
                    const Value &a = doc["road_slide_red_distance"];
                    examParam.road_slide_red_distance = a.GetDouble();
                }
                if (doc.HasMember("road_total_distance")) {
                    const Value &a = doc["road_total_distance"];
                    examParam.road_total_distance = a.GetDouble();
                }
                if (doc.HasMember("road_max_speed")) {
                    const Value &a = doc["road_max_speed"];
                    examParam.road_max_speed = a.GetInt();
                }
                if (doc.HasMember("gear_speed_table")) {
                    const Value &a = doc["gear_speed_table"];
                    int m = 0, n = 0;
                    for (Value::ConstValueIterator itr = a.Begin();
                         itr != a.End() && m < 6; ++itr, ++m) {
                        n = 0;
                        for (Value::ConstValueIterator itr2 = (*itr).Begin();
                             itr2 != (*itr).End() && n < 2; ++itr2, ++n) {
                            examParam.gear_speed_table[m][n] = (*itr2).GetInt();
                        }
                    }
                }
                if (doc.HasMember("gear_n_allow_time")) {
                    const Value &a = doc["gear_n_allow_time"];
                    examParam.gear_n_allow_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("same_gear_min_time")) {
                    const Value &a = doc["same_gear_min_time"];
                    examParam.same_gear_min_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("gear_speed_error_cumulative_time")) {
                    const Value &a = doc["gear_speed_error_cumulative_time"];
                    examParam.gear_speed_error_cumulative_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("road_pause_criteria")) {
                    const Value &a = doc["road_pause_criteria"];
                    examParam.road_pause_criteria = a.GetInt();
                }
                if (doc.HasMember("continuous_change_lane_min_time")) {
                    const Value &a = doc["continuous_change_lane_min_time"];
                    examParam.continuous_change_lane_min_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("crash_dotted_line_cumulative_time")) {
                    const Value &a = doc["crash_dotted_line_cumulative_time"];
                    examParam.crash_dotted_line_cumulative_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("turn_signal_min_advance")) {
                    const Value &a = doc["turn_signal_min_advance"];
                    examParam.turn_signal_min_advance = D_SEC(a.GetInt());
                }
                if (doc.HasMember("start_car_max_rpm")) {
                    const Value &a = doc["start_car_max_rpm"];
                    examParam.start_car_max_rpm = a.GetInt();
                }
                if (doc.HasMember("start_car_limit_distance")) {
                    const Value &a = doc["start_car_limit_distance"];
                    examParam.start_car_limit_distance = a.GetInt();
                }
                if (doc.HasMember("open_door_drive_allow_distance")) {
                    const Value &a = doc["open_door_drive_allow_distance"];
                    examParam.open_door_drive_allow_distance = a.GetDouble();
                }
                if (doc.HasMember("change_lane_limit_distance")) {
                    const Value &a = doc["change_lane_limit_distance"];
                    examParam.change_lane_limit_distance = a.GetInt();
                }
                if (doc.HasMember("shift_limit_distance")) {
                    const Value &a = doc["shift_limit_distance"];
                    examParam.shift_limit_distance = a.GetInt();
                }
                if (doc.HasMember("shift_hold_time")) {
                    const Value &a = doc["shift_hold_time"];
                    examParam.shift_hold_time = D_SEC(a.GetInt());
                }
                int straight_limit_distance;
                if (doc.HasMember("straight_limit_distance")) {
                    const Value &a = doc["straight_limit_distance"];
                    examParam.straight_limit_distance = a.GetInt();
                }
                if (doc.HasMember("straight_max_offset")) {
                    const Value &a = doc["straight_max_offset"];
                    examParam.straight_max_offset = a.GetDouble();
                }
                if (doc.HasMember("overtake_limit_distance")) {
                    const Value &a = doc["overtake_limit_distance"];
                    examParam.overtake_limit_distance = a.GetInt();
                }
                if (doc.HasMember("stop_car_limit_distance")) {
                    const Value &a = doc["stop_car_limit_distance"];
                    examParam.stop_car_limit_distance = a.GetInt();
                }
                if (doc.HasMember("stop_car_open_door_allow_time")) {
                    const Value &a = doc["stop_car_open_door_allow_time"];
                    examParam.stop_car_open_door_allow_time = D_SEC(a.GetInt());
                }
                if (doc.HasMember("stop_car_edge_red_distance")) {
                    const Value &a = doc["stop_car_edge_red_distance"];
                    examParam.stop_car_edge_red_distance = a.GetDouble();
                }
                if (doc.HasMember("stop_car_edge_yellow_distance")) {
                    const Value &a = doc["stop_car_edge_yellow_distance"];
                    examParam.stop_car_edge_yellow_distance = a.GetDouble();
                }
                if (doc.HasMember("crossing_stop_valid_distance")) {
                    const Value &a = doc["crossing_stop_valid_distance"];
                    examParam.crossing_stop_valid_distance = a.GetDouble();
                }
                if (doc.HasMember("cross_school_max_speed")) {
                    const Value &a = doc["cross_school_max_speed"];
                    examParam.cross_school_max_speed = a.GetInt();
                }
                if (doc.HasMember("crossing_break_valid_distance")) {
                    const Value &a = doc["crossing_break_valid_distance"];
                    examParam.crossing_break_valid_distance = a.GetInt();
                }
            }
            break;
        }
        case ID_MS_MAP: {
            Document doc;
            doc.Parse(value);