[626][adas] 能否启动自驾检测接口新增原始数据字段修改成:只保留解析后有用的数据
This commit is contained in:
@@ -3,7 +3,6 @@ package com.zhjt.mogo.adas.data.bean;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.util.JsonFormat;
|
||||
import com.zhjt.mogo.adas.utils.ByteUtil;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -66,10 +65,10 @@ public class UnableLaunchData {
|
||||
jsonObject.put("ability_version", abilityVersion);
|
||||
JSONArray array = new JSONArray();
|
||||
if (statusInfo != null) {
|
||||
arrayPut(array, statusInfo);
|
||||
arrayPut(array, statusInfo.getClass().getName(), statusInfo.getAutoPilotReady(), statusInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
if (ssmInfo != null) {
|
||||
arrayPut(array, ssmInfo);
|
||||
arrayPut(array, ssmInfo.getClass().getName(), ssmInfo.getAutoPilotReady(), ssmInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
if (fsmStatusReasonRespond != null) {
|
||||
arrayPut(array, fsmStatusReasonRespond);
|
||||
@@ -83,10 +82,22 @@ public class UnableLaunchData {
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
private void arrayPut(JSONArray array, String name, boolean isReady, String reason) throws JSONException {
|
||||
JSONObject objectParse = new JSONObject();
|
||||
objectParse.put("auto_pilot_ready", isReady);
|
||||
if (reason != null) {
|
||||
objectParse.put("auto_pilot_unready_reason", reason);
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("name", name);
|
||||
object.put("parse", objectParse);
|
||||
array.put(object);
|
||||
}
|
||||
|
||||
private void arrayPut(JSONArray array, GeneratedMessageV3 message) throws JSONException, InvalidProtocolBufferException {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("name", message.getClass().getName());
|
||||
object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false));
|
||||
// object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false));
|
||||
object.put("parse", new JSONObject(JsonFormat.printer().print(message)));
|
||||
array.put(object);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user