Merge branch 'dev_trajectory_from270' into dev_robotaxi-d-app-module_280_220608_2.8.0
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.zhidao.adas.client.utils.CrashHandler;
|
||||
|
||||
public class App extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
CrashHandler.getInstance().init(this);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BaseInfo;
|
||||
@@ -11,6 +13,7 @@ import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.MogoReportMessage;
|
||||
import com.zhidao.adas.client.bean.MyPointCloud;
|
||||
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
|
||||
import com.zhidao.adas.client.bean.PlanningObjects;
|
||||
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
@@ -18,6 +21,7 @@ import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.log.LogSave;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -37,8 +41,7 @@ public class DataDistribution {
|
||||
private final LinkedBlockingQueue<BaseInfo> queue;
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ", Locale.getDefault());
|
||||
private Future future;
|
||||
// private final List<OnAdasClientListener> listeners = new ArrayList<>();
|
||||
private OnAdasClientListener listener;
|
||||
private Pair<String, OnAdasClientListener> listener;
|
||||
private volatile boolean isCutDown = true;//是否缩短日志显示
|
||||
|
||||
private DataDistribution() {
|
||||
@@ -57,17 +60,16 @@ public class DataDistribution {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void registerOnAdasClientListener(OnAdasClientListener listener) {
|
||||
this.listener = null;
|
||||
public void registerAdasClientListener(Pair<String, OnAdasClientListener> listener) {
|
||||
this.listener = listener;
|
||||
// if (!listeners.contains(listener)) {
|
||||
// listeners.add(listener);
|
||||
// }
|
||||
}
|
||||
|
||||
// public void unregisterOnAdasClientListener(OnAdasClientListener listener) {
|
||||
// listeners.remove(listener);
|
||||
// }
|
||||
public void unregisterAdasClientListener(Pair<String, OnAdasClientListener> listener) {
|
||||
if (this.listener != null && listener != null)
|
||||
if (listener.second.hashCode() == this.listener.second.hashCode()) {
|
||||
this.listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addData(BaseInfo info) {
|
||||
@@ -102,13 +104,13 @@ public class DataDistribution {
|
||||
public final List<String> listMogoReportMessage = new ArrayList<>();
|
||||
public final List<String> listPerceptionTrafficLight = new ArrayList<>();
|
||||
public final List<String> listPredictionObstacleTrajectory = new ArrayList<>();
|
||||
public final List<String> listBasicInfoReq = new ArrayList<>();
|
||||
public final List<String> listRecordPanel = new ArrayList<>();
|
||||
public final List<String> listGlobalPathResp = new ArrayList<>();
|
||||
public final List<String> listWarn = new ArrayList<>();
|
||||
public final List<String> listArrivalNotification = new ArrayList<>();
|
||||
public final List<String> listErrorData = new ArrayList<>();
|
||||
public final List<String> listPointCloud = new ArrayList<>();
|
||||
public final List<String> listPlanningObjects = new ArrayList<>();
|
||||
|
||||
public String cutDown(String str) {
|
||||
if (isCutDown && str.length() > 650) {
|
||||
@@ -125,207 +127,128 @@ public class DataDistribution {
|
||||
if (listTrajectory.size() > LIST_SIZE) {
|
||||
listTrajectory.remove(listTrajectory.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_TRAJECTORY.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof TrackedObjects) {
|
||||
listTrackedObjects.add(0, time + str);
|
||||
if (listTrackedObjects.size() > LIST_SIZE) {
|
||||
listTrackedObjects.remove(listTrackedObjects.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_TRACKED_OBJECTS.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof MyPointCloud) {
|
||||
listPointCloud.add(0, time + str);
|
||||
if (listPointCloud.size() > LIST_SIZE) {
|
||||
listPointCloud.remove(listPointCloud.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_POINT_CLOUD.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof PlanningObjects) {
|
||||
listPlanningObjects.add(0, time + str);
|
||||
if (listPlanningObjects.size() > LIST_SIZE) {
|
||||
listPlanningObjects.remove(listPlanningObjects.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_PLANNING_OBJECTS.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof GnssInfo) {
|
||||
listGnssInfo.add(0, time + str);
|
||||
if (listGnssInfo.size() > LIST_SIZE) {
|
||||
listGnssInfo.remove(listGnssInfo.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_GNSS_INFO.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof VehicleState) {
|
||||
listVehicleState.add(0, time + str);
|
||||
if (listVehicleState.size() > LIST_SIZE) {
|
||||
listVehicleState.remove(listVehicleState.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_VEHICLE_STATE.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof AutopilotState) {
|
||||
listAutopilotState.add(0, time + str);
|
||||
if (listAutopilotState.size() > LIST_SIZE) {
|
||||
listAutopilotState.remove(listAutopilotState.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_AUTOPILOT_STATE.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof MogoReportMessage) {
|
||||
listMogoReportMessage.add(0, time + str);
|
||||
if (listMogoReportMessage.size() > LIST_SIZE) {
|
||||
listMogoReportMessage.remove(listMogoReportMessage.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_REPORT_MESSAGE.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof PerceptionTrafficLight) {
|
||||
listPerceptionTrafficLight.add(0, time + str);
|
||||
if (listPerceptionTrafficLight.size() > LIST_SIZE) {
|
||||
listPerceptionTrafficLight.remove(listPerceptionTrafficLight.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onPerceptionTrafficLight((PerceptionTrafficLight) data);
|
||||
if (listener != null && Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT.equals(listener.first)) {
|
||||
listener.second.onPerceptionTrafficLight((PerceptionTrafficLight) data);
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onPerceptionTrafficLight((PerceptionTrafficLight) data);
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof PredictionObstacleTrajectory) {
|
||||
listPredictionObstacleTrajectory.add(0, time + str);
|
||||
if (listPredictionObstacleTrajectory.size() > LIST_SIZE) {
|
||||
listPredictionObstacleTrajectory.remove(listPredictionObstacleTrajectory.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof BasicInfoReq) {
|
||||
listBasicInfoReq.add(0, time + str);
|
||||
if (listBasicInfoReq.size() > LIST_SIZE) {
|
||||
listBasicInfoReq.remove(listBasicInfoReq.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
|
||||
} else if (data instanceof CarConfigResp) {
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.TITLE_CAR_CONFIG_RESP.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof RecordPanel) {
|
||||
listRecordPanel.add(0, time + str);
|
||||
if (listRecordPanel.size() > LIST_SIZE) {
|
||||
listRecordPanel.remove(listRecordPanel.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_RECORD_RESULT.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof GlobalPathResp) {
|
||||
listGlobalPathResp.add(0, time + str);
|
||||
if (listGlobalPathResp.size() > LIST_SIZE) {
|
||||
listGlobalPathResp.remove(listGlobalPathResp.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof Warn) {
|
||||
listWarn.add(0, time + str);
|
||||
if (listWarn.size() > LIST_SIZE) {
|
||||
listWarn.remove(listWarn.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_WARN.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof ArrivalNotification) {
|
||||
listArrivalNotification.add(0, time + str);
|
||||
if (listArrivalNotification.size() > LIST_SIZE) {
|
||||
listArrivalNotification.remove(listArrivalNotification.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
} else if (data instanceof ErrorData) {
|
||||
listErrorData.add(0, time + str);
|
||||
if (listErrorData.size() > 100) {
|
||||
listErrorData.remove(listErrorData.size() - 1);
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onRefresh();
|
||||
if (listener != null && Constants.TITLE.RECEIVE_ERROR.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
// if (!listeners.isEmpty()) {
|
||||
// for (OnAdasClientListener listener : listeners) {
|
||||
// listener.onRefresh();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhidao.adas.client.base;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -42,17 +43,25 @@ public abstract class BaseFragment extends Fragment {
|
||||
initHandler();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
DataDistribution.getInstance().registerOnAdasClientListener(adasClientListener);
|
||||
if (!isHidden())
|
||||
DataDistribution.getInstance().registerAdasClientListener(new Pair<>(title, adasClientListener));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// DataDistribution.getInstance().unregisterOnAdasClientListener(adasClientListener);
|
||||
DataDistribution.getInstance().unregisterAdasClientListener(new Pair<>(title, adasClientListener));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
if (!hidden) {
|
||||
DataDistribution.getInstance().registerAdasClientListener(new Pair<>(title, adasClientListener));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +194,8 @@ public abstract class BaseFragment extends Fragment {
|
||||
protected void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case WHAT_REFRESH:
|
||||
onRefreshView();
|
||||
if (isVisible())
|
||||
onRefreshView();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class PlanningObjects extends BaseInfo {
|
||||
public final MessagePad.PlanningObjects bean;
|
||||
|
||||
public PlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects bean) {
|
||||
super("接收", bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -20,17 +21,16 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.DataDistribution;
|
||||
import com.zhidao.adas.client.OnAdasClientListener;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.AutopilotConfigAdapter;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
import com.zhidao.adas.client.bean.UpdateDataEvent;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.adas.client.DataDistribution;
|
||||
import com.zhidao.adas.client.bean.UpdateDataEvent;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
@@ -38,6 +38,7 @@ import java.util.List;
|
||||
|
||||
public class AutopilotConfigActivity extends BaseActivity {
|
||||
private static final String TAG = "CreateActivity";
|
||||
private Pair<String, OnAdasClientListener> listenerPair;
|
||||
private TextView toolbar_title;
|
||||
private RecyclerView recyclerView;
|
||||
private AutopilotConfigAdapter autopilotConfigAdapter;
|
||||
@@ -66,6 +67,7 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用
|
||||
initHandler();
|
||||
initRecyclerView();
|
||||
listenerPair = new Pair<>(Constants.TITLE.RECEIVE_GNSS_INFO, listener);
|
||||
toolbar_title.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
@@ -80,6 +82,15 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
init();
|
||||
DataDistribution.getInstance().registerAdasClientListener(new Pair<>(Constants.TITLE.RECEIVE_GNSS_INFO, listener));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
DataDistribution.getInstance().unregisterAdasClientListener(new Pair<>(Constants.TITLE.RECEIVE_GNSS_INFO, listener));
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -148,17 +159,6 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
ThreadPoolManager.getsInstance().execute(runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
DataDistribution.getInstance().registerOnAdasClientListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
// DataDistribution.getInstance().unregisterOnAdasClientListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.zhidao.adas.client.adapter.DataShowAdapter;
|
||||
import com.zhidao.adas.client.base.BaseFragment;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.MyLinearLayoutManager;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
@@ -142,7 +141,9 @@ public class InfoFragment extends BaseFragment {
|
||||
case Constants.TITLE.RECEIVE_POINT_CLOUD:
|
||||
adapter.setData(DataDistribution.getInstance().listPointCloud);
|
||||
break;
|
||||
|
||||
case Constants.TITLE.RECEIVE_PLANNING_OBJECTS:
|
||||
adapter.setData(DataDistribution.getInstance().listPlanningObjects);
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_ERROR:
|
||||
adapter.setData(DataDistribution.getInstance().listErrorData);
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@@ -50,6 +51,7 @@ import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.InfoTitleAdapter;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseFragment;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
@@ -61,6 +63,7 @@ import com.zhidao.adas.client.bean.IPCConnectState;
|
||||
import com.zhidao.adas.client.bean.MogoReportMessage;
|
||||
import com.zhidao.adas.client.bean.MyPointCloud;
|
||||
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
|
||||
import com.zhidao.adas.client.bean.PlanningObjects;
|
||||
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
@@ -86,7 +89,9 @@ import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
@@ -129,26 +134,9 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
private final List<String> titleFragmentData = new ArrayList<>();
|
||||
private final List<String> titleBtnData = new ArrayList<>();
|
||||
private final List<IPCConnectState> connectStatusList = new ArrayList<>();
|
||||
private InfoTitleAdapter btnAdapter;
|
||||
private InfoTitleAdapter fragmentAdapter;
|
||||
|
||||
private InfoFragment carFragment;
|
||||
private InfoFragment viewFragment;
|
||||
private InfoFragment canFragment;
|
||||
private InfoFragment autoFragment;
|
||||
private InfoFragment warnFragment;
|
||||
private InfoFragment trajectoryFragment;
|
||||
private InfoFragment autopilotWayArriveFragment;
|
||||
private InfoFragment autopilotRouteFragment;
|
||||
private InfoFragment badcseFragment;
|
||||
private InfoFragment errorFragment;
|
||||
private InfoFragment reportMessageFragment;
|
||||
private InfoFragment perceptionTrafficLightFragment;
|
||||
private InfoFragment predictionObstacleTrajectoryFragment;
|
||||
private InfoFragment pointCloudFragment;
|
||||
private VersionFragment versionFragment;
|
||||
private Fragment fromFragment;
|
||||
private FragmentManager manager;
|
||||
private FragmentTransaction transaction;
|
||||
private String ftpTime;
|
||||
private boolean isPad;
|
||||
private long recordKey;
|
||||
@@ -181,8 +169,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
if (!isPad)
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
initView();
|
||||
firstFragment();
|
||||
|
||||
showFragment(Constants.TITLE.RECEIVE_GNSS_INFO);
|
||||
initAdas();
|
||||
connectStatus = AdasManager.getInstance().getIpcConnectionStatus();
|
||||
onUpdateConnectStateView();
|
||||
@@ -331,7 +318,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
|
||||
//初始化fragment
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
|
||||
cb_print.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
@@ -523,21 +509,22 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_GNSS_INFO);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_TRAJECTORY);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_TRACKED_OBJECTS);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_POINT_CLOUD);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_VEHICLE_STATE);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_AUTOPILOT_STATE);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_REPORT_MESSAGE);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_POINT_CLOUD);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_PLANNING_OBJECTS);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_CAR_CONFIG_RESP);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_RECORD_RESULT);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_WARN);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_WARN);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_ERROR);
|
||||
|
||||
|
||||
titleBtnData.add("启动自动驾驶");
|
||||
titleBtnData.add("自动驾驶模式");
|
||||
titleBtnData.add("自动驾驶路径查询");
|
||||
titleBtnData.add("下发SN");
|
||||
titleBtnData.add("数据采集5秒");
|
||||
@@ -563,7 +550,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
if (animatorInfo != null)
|
||||
animatorInfo.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
btnAdapter = new InfoTitleAdapter(titleBtnData, false);
|
||||
InfoTitleAdapter btnAdapter = new InfoTitleAdapter(titleBtnData, false);
|
||||
infoBtn.setAdapter(btnAdapter);
|
||||
btnAdapter.setOnItemClickListener(this);
|
||||
}
|
||||
@@ -603,128 +590,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
fragmentAdapter.setSelectedPosition(position);
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
switch (data) {
|
||||
case Constants.TITLE.RECEIVE_GNSS_INFO:
|
||||
firstFragment();
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_VEHICLE_STATE:
|
||||
if (canFragment == null)
|
||||
canFragment = new InfoFragment(data);
|
||||
if (!canFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, canFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_TRACKED_OBJECTS:
|
||||
// hintTrackedObjects(false);
|
||||
if (viewFragment == null)
|
||||
viewFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, viewFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_AUTOPILOT_STATE:
|
||||
if (autoFragment == null)
|
||||
autoFragment = new InfoFragment(data);
|
||||
if (!autoFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autoFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_WARN:
|
||||
if (warnFragment == null)
|
||||
warnFragment = new InfoFragment(data);
|
||||
if (!warnFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, warnFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_TRAJECTORY:
|
||||
if (trajectoryFragment == null)
|
||||
trajectoryFragment = new InfoFragment(data);
|
||||
if (!trajectoryFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, trajectoryFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION:
|
||||
if (autopilotWayArriveFragment == null)
|
||||
autopilotWayArriveFragment = new InfoFragment(data);
|
||||
if (!autopilotWayArriveFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotWayArriveFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP:
|
||||
if (autopilotRouteFragment == null)
|
||||
autopilotRouteFragment = new InfoFragment(data);
|
||||
if (!autopilotRouteFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotRouteFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_RECORD_RESULT:
|
||||
if (badcseFragment == null)
|
||||
badcseFragment = new InfoFragment(data);
|
||||
if (!badcseFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, badcseFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_REPORT_MESSAGE:
|
||||
if (reportMessageFragment == null)
|
||||
reportMessageFragment = new InfoFragment(data);
|
||||
if (!reportMessageFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, reportMessageFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT:
|
||||
if (perceptionTrafficLightFragment == null)
|
||||
perceptionTrafficLightFragment = new InfoFragment(data);
|
||||
if (!perceptionTrafficLightFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, perceptionTrafficLightFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY:
|
||||
if (predictionObstacleTrajectoryFragment == null)
|
||||
predictionObstacleTrajectoryFragment = new InfoFragment(data);
|
||||
if (!predictionObstacleTrajectoryFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, predictionObstacleTrajectoryFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_POINT_CLOUD:
|
||||
if (pointCloudFragment == null)
|
||||
pointCloudFragment = new InfoFragment(data);
|
||||
if (!pointCloudFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, pointCloudFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case Constants.TITLE.RECEIVE_CAR_CONFIG_RESP:
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
if (versionFragment == null)
|
||||
versionFragment = new VersionFragment("工控机版本\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t固定IP配置");
|
||||
if (!versionFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, versionFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
|
||||
case Constants.TITLE.RECEIVE_ERROR:
|
||||
if (errorFragment == null)
|
||||
errorFragment = new InfoFragment(data);
|
||||
if (!errorFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, errorFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
showFragment(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -878,11 +744,17 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
// LogSave.getInstance().saveLog("转换数据=" + data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) {
|
||||
PlanningObjects base = new PlanningObjects(header, planningObjects);
|
||||
DataDistribution.getInstance().addData(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
|
||||
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
|
||||
DataDistribution.getInstance().addData(info);
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 0);
|
||||
showToastCenter("收到车机基础信息请求:" + info.toString());
|
||||
}
|
||||
|
||||
@@ -1087,13 +959,28 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
private void firstFragment() {
|
||||
if (carFragment == null)
|
||||
carFragment = new InfoFragment(Constants.TITLE.RECEIVE_GNSS_INFO);
|
||||
if (!carFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, carFragment);
|
||||
transaction.commit();
|
||||
private void showFragment(String title) {
|
||||
Fragment to = manager.findFragmentByTag(title);
|
||||
if (to == null) {
|
||||
if (Constants.TITLE.RECEIVE_CAR_CONFIG_RESP.equals(title)) {
|
||||
to = new VersionFragment(Constants.TITLE.TITLE_CAR_CONFIG_RESP);
|
||||
} else {
|
||||
to = new InfoFragment(title);
|
||||
}
|
||||
}
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
if (fromFragment != null) {
|
||||
transaction.hide(fromFragment);
|
||||
}
|
||||
if (!to.isAdded()) {
|
||||
transaction.add(R.id.fl_info, to, title).commit();
|
||||
} else {
|
||||
transaction.show(to).commit();
|
||||
}
|
||||
if (Constants.TITLE.RECEIVE_CAR_CONFIG_RESP.equals(title)) {
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
}
|
||||
fromFragment = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1104,6 +991,15 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
switch (position) {
|
||||
case 0:
|
||||
// MessagePad.Line.Builder line = MessagePad.Line.newBuilder();
|
||||
// line.setLineId(10);
|
||||
// line.setTrajUrl("我是TrajUrl");
|
||||
// line.setTrajMd5("我是TrajMd5");
|
||||
// line.setStopUrl("我是StopUrl");
|
||||
// line.setStopMd5("我是StopMd5");
|
||||
// line.setTimestamp(60);
|
||||
// line.setVehicleModel("我是VehicleModel");
|
||||
// AdasManager.getInstance().sendTrajectoryDownloadReq(line.build());
|
||||
if (autoPilotModeDialog == null) {
|
||||
autoPilotModeDialog = new AutoPilotModeDialog(this);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,15 @@ import com.zhidao.adas.client.base.BaseFragment;
|
||||
import com.zhidao.adas.client.bean.Config;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.bean.VersionCompatibility;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -37,6 +41,7 @@ import mogo.telematics.pad.MessagePad;
|
||||
* @des 升级页面
|
||||
*/
|
||||
public class VersionFragment extends BaseFragment {
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ", Locale.getDefault());
|
||||
|
||||
public VersionFragment() {
|
||||
}
|
||||
@@ -159,6 +164,7 @@ public class VersionFragment extends BaseFragment {
|
||||
temp = ip + ":" + AdasManager.getInstance().getIpcConnectedPort();
|
||||
}
|
||||
MessagePad.CarConfigResp adasConfig = AdasManager.getInstance().getCarConfig();
|
||||
list.add(new Config("更新时间:", AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED ? sdf.format(new Date()) : null));
|
||||
list.add(new Config("工控机IP:", temp));
|
||||
list.add(new Config("工控机版本:", adasConfig == null ? null : adasConfig.getDockVersion()));
|
||||
list.add(new Config("车牌号:", adasConfig == null ? null : adasConfig.getPlateNumber()));
|
||||
|
||||
@@ -152,8 +152,10 @@ public class Constants {
|
||||
String RECEIVE_PERCEPTION_TRAFFIC_LIGHT = "感知红绿灯";
|
||||
String RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY = "他车轨迹预测";
|
||||
String RECEIVE_POINT_CLOUD = "点云透传";
|
||||
String RECEIVE_PLANNING_OBJECTS = "Planning障碍物";
|
||||
|
||||
// String RECEIVE_BASIC_INFO_REQ = "自动驾驶设备基础信息请求";
|
||||
String TITLE_CAR_CONFIG_RESP = "工控机版本\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t固定IP配置";
|
||||
String RECEIVE_CAR_CONFIG_RESP = "信息与配置";
|
||||
String RECEIVE_RECORD_RESULT = "数据采集结果";
|
||||
String RECEIVE_GLOBAL_PATH_RESP = "自动驾驶路径";
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* ClassName: CrashHandler
|
||||
* Function: UncaughtException处理类,当程序发生Uncaught异常的时候,由该类来接管程序,并记录发送错误报告.
|
||||
*
|
||||
* @author Norris Norris.sly@gmail.com
|
||||
* @Date 2013 2013-3-24 下午12:27:10
|
||||
* @Fields ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* @Methods ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-24下午12:27:10 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* @see ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* @since Ver 1.0 I used to be a programmer like you, then I took an arrow in the knee
|
||||
*/
|
||||
public class CrashHandler implements UncaughtExceptionHandler {
|
||||
private static final String FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "IPCMonitoring" + File.separator + "Crash" + File.separator;//程序外部存储跟目录
|
||||
/**
|
||||
* Log日志的tag
|
||||
* String : TAG
|
||||
*
|
||||
* @since 2013-3-21下午8:44:28
|
||||
*/
|
||||
private static final String TAG = "NorrisInfo";
|
||||
/**
|
||||
* 系统默认的UncaughtException处理类
|
||||
* Thread.UncaughtExceptionHandler : mDefaultHandler
|
||||
*
|
||||
* @since 2013-3-21下午8:44:43
|
||||
*/
|
||||
private UncaughtExceptionHandler mDefaultHandler;
|
||||
/**
|
||||
* CrashHandler实例
|
||||
* CrashHandler : mInstance
|
||||
*
|
||||
* @since 2013-3-21下午8:44:53
|
||||
*/
|
||||
private static CrashHandler mInstance = new CrashHandler();
|
||||
/**
|
||||
* 程序的Context对象
|
||||
* Context : mContext
|
||||
*
|
||||
* @since 2013-3-21下午8:45:02
|
||||
*/
|
||||
private Context mContext;
|
||||
/**
|
||||
* 用来存储设备信息和异常信息
|
||||
* Map<String,String> : mLogInfo
|
||||
*
|
||||
* @since 2013-3-21下午8:46:15
|
||||
*/
|
||||
private final Map<String, String> mLogInfo = new HashMap<String, String>();
|
||||
/**
|
||||
* 用于格式化日期,作为日志文件名的一部分(FIXME 注意在windows下文件名无法使用:等符号!)
|
||||
* SimpleDateFormat : mSimpleDateFormat
|
||||
*
|
||||
* @since 2013-3-21下午8:46:39
|
||||
*/
|
||||
private SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("yyyyMMdd_HH-mm-ss");
|
||||
|
||||
/**
|
||||
* Creates a new instance of CrashHandler.
|
||||
*/
|
||||
private CrashHandler() {
|
||||
}
|
||||
|
||||
/**
|
||||
* getInstance:{获取CrashHandler实例 ,单例模式 }
|
||||
* ──────────────────────────────────
|
||||
*
|
||||
* @return CrashHandler
|
||||
* @throws
|
||||
* @since I used to be a programmer like you, then I took an arrow in the knee Ver 1.0
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-21下午8:52:24 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
public static CrashHandler getInstance() {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* init:{初始化}
|
||||
* ──────────────────────────────────
|
||||
*
|
||||
* @param paramContext
|
||||
* @return void
|
||||
* @throws
|
||||
* @since I used to be a programmer like you, then I took an arrow in the knee Ver 1.0
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-21下午8:52:45 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
public void init(Context paramContext) {
|
||||
mContext = paramContext;
|
||||
// 获取系统默认的UncaughtException处理器
|
||||
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
// 设置该CrashHandler为程序的默认处理器
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当UncaughtException发生时会转入该重写的方法来处理
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see UncaughtExceptionHandler#uncaughtException(Thread, Throwable)
|
||||
*/
|
||||
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
|
||||
// 获取设备参数信息
|
||||
getDeviceInfo(mContext);
|
||||
// mLogInfo.put("versionName", String.valueOf(BuildConfig.VERSION_CODE));
|
||||
// mLogInfo.put("versionCode", BuildConfig.VERSION_NAME);
|
||||
// 保存日志文件
|
||||
String result = saveCrashLogToFile(paramThrowable);
|
||||
mDefaultHandler.uncaughtException(paramThread, paramThrowable);
|
||||
// if (!handleException(paramThrowable) && mDefaultHandler != null) {
|
||||
// // 如果自定义的没有处理则让系统默认的异常处理器来处理
|
||||
// mDefaultHandler.uncaughtException(paramThread, paramThrowable);
|
||||
// } else {
|
||||
//// try {
|
||||
//// // 如果处理了,让程序继续运行1秒再退出,保证文件保存并上传到服务器
|
||||
//// paramThread.sleep(1000);
|
||||
//// } catch (InterruptedException e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
// // 退出程序
|
||||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||
// System.exit(1);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* handleException:{自定义错误处理,收集错误信息 发送错误报告等操作均在此完成.}
|
||||
* ──────────────────────────────────
|
||||
*
|
||||
* @param paramThrowable
|
||||
* @return true:如果处理了该异常信息;否则返回false.
|
||||
* @throws
|
||||
* @since I used to be a programmer like you, then I took an arrow in the knee Ver 1.0
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-24下午12:28:53 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
public boolean handleException(Throwable paramThrowable) {
|
||||
if (paramThrowable == null)
|
||||
return false;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
Toast.makeText(mContext, "很抱歉,程序出现异常,即将退出", Toast.LENGTH_SHORT).show();
|
||||
Looper.loop();
|
||||
}
|
||||
}.start();
|
||||
// 获取设备参数信息
|
||||
getDeviceInfo(mContext);
|
||||
// 保存日志文件
|
||||
String result = saveCrashLogToFile(paramThrowable);
|
||||
//上传崩溃日志
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDeviceInfo:{获取设备参数信息}
|
||||
* ──────────────────────────────────
|
||||
*
|
||||
* @param paramContext
|
||||
* @throws
|
||||
* @since I used to be a programmer like you, then I took an arrow in the knee Ver 1.0
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-24下午12:30:02 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
public void getDeviceInfo(Context paramContext) {
|
||||
try {
|
||||
// 获得包管理器
|
||||
PackageManager mPackageManager = paramContext.getPackageManager();
|
||||
// 得到该应用的信息,即主Activity
|
||||
PackageInfo mPackageInfo = mPackageManager.getPackageInfo(
|
||||
paramContext.getPackageName(), PackageManager.GET_ACTIVITIES);
|
||||
if (mPackageInfo != null) {
|
||||
String versionName = mPackageInfo.versionName == null ? "null"
|
||||
: mPackageInfo.versionName;
|
||||
String versionCode = mPackageInfo.versionCode + "";
|
||||
mLogInfo.put("versionName", versionName);
|
||||
mLogInfo.put("versionCode", versionCode);
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 反射机制
|
||||
Field[] mFields = Build.class.getDeclaredFields();
|
||||
// 迭代Build的字段key-value 此处的信息主要是为了在服务器端手机各种版本手机报错的原因
|
||||
for (Field field : mFields) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
mLogInfo.put(field.getName(), Objects.requireNonNull(field.get("")).toString());
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* saveCrashLogToFile:{将崩溃的Log保存到本地}
|
||||
* TODO 可拓展,将Log上传至指定服务器路径
|
||||
* ──────────────────────────────────
|
||||
*
|
||||
* @param paramThrowable
|
||||
* @return FileName
|
||||
* @throws
|
||||
* @since I used to be a programmer like you, then I took an arrow in the knee Ver 1.0
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
* 2013-3-24下午12:31:01 Modified By Norris
|
||||
* ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
|
||||
private String saveCrashLogToFile(Throwable paramThrowable) {
|
||||
StringBuffer mStringBuffer = new StringBuffer();
|
||||
for (Map.Entry<String, String> entry : mLogInfo.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
mStringBuffer.append(key + "=" + value + "\r\n");
|
||||
}
|
||||
Writer mWriter = new StringWriter();
|
||||
PrintWriter mPrintWriter = new PrintWriter(mWriter);
|
||||
paramThrowable.printStackTrace(mPrintWriter);
|
||||
paramThrowable.printStackTrace();
|
||||
Throwable mThrowable = paramThrowable.getCause();
|
||||
// 迭代栈队列把所有的异常信息写入writer中
|
||||
while (mThrowable != null) {
|
||||
mThrowable.printStackTrace(mPrintWriter);
|
||||
// 换行 每个个异常栈之间换行
|
||||
mThrowable = mThrowable.getCause();
|
||||
}
|
||||
|
||||
//记得关闭
|
||||
|
||||
String mResult = mWriter.toString();
|
||||
// String mResult = mWriter.toString().replace("\n", "").replace(":", "").replace("/", "").replace("\t", "");
|
||||
mStringBuffer.append(mResult);
|
||||
// 保存文件,设置文件名
|
||||
String mTime = mSimpleDateFormat.format(new Date());
|
||||
String mFileName = mContext.getPackageName() + "_Exception-" + mTime + ".log";
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
try {
|
||||
File mDirectory = new File(FILE_PATH);
|
||||
Log.v(TAG, mDirectory.toString());
|
||||
if (!mDirectory.exists())
|
||||
mDirectory.mkdirs();
|
||||
FileOutputStream mFileOutputStream = new FileOutputStream(mDirectory + File.separator + mFileName);
|
||||
mFileOutputStream.write(mStringBuffer.toString().getBytes());
|
||||
mFileOutputStream.close();
|
||||
return mResult;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return mResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.toAutoPilotLine
|
||||
import com.mogo.eagle.core.data.autopilot.toRouteInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
@@ -262,6 +263,10 @@ class MoGoAutopilotProvider :
|
||||
)
|
||||
}
|
||||
|
||||
override fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) {
|
||||
AdasManager.getInstance().sendTrajectoryDownloadReq(autoPilotLine.toAutoPilotLine())
|
||||
}
|
||||
|
||||
override fun cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
|
||||
|
||||
@@ -247,6 +247,13 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
CallerAutopilotPointCloudListenerManager.invokeAutopilotPointCloudDataUpdate(header,pointCloud)
|
||||
}
|
||||
|
||||
override fun onPlanningObjects(
|
||||
header: MessagePad.Header?,
|
||||
planningObjects: MessagePad.PlanningObjects?
|
||||
) {
|
||||
//planning障碍物
|
||||
}
|
||||
|
||||
override fun onBasicInfoReq(
|
||||
header: MessagePad.Header,
|
||||
basicInfoReq: MessagePad.BasicInfoReq?
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.mogo.eagle.core.data.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @author donghongyuO
|
||||
* @since 2021/09/22
|
||||
*
|
||||
*
|
||||
@@ -32,7 +31,7 @@ import mogo.telematics.pad.MessagePad
|
||||
* }
|
||||
*/
|
||||
|
||||
fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo{
|
||||
fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo {
|
||||
val routeInfo = MessagePad.RouteInfo.newBuilder()
|
||||
val startLoc = routeInfo.startLocationBuilder
|
||||
val endLoc = routeInfo.endLocationBuilder
|
||||
@@ -61,27 +60,61 @@ fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo{
|
||||
routeInfo.speedLimit = this.speedLimit.toDouble()
|
||||
routeInfo.startLocation = startLoc.build()
|
||||
routeInfo.endLocation = endLoc.build()
|
||||
|
||||
val line = MessagePad.Line.newBuilder()
|
||||
this.autoPilotLine?.let {
|
||||
line.lineId = it.lineId
|
||||
line.trajMd5 = it.trajMd5
|
||||
line.trajUrl = it.trajUrl
|
||||
line.stopMd5 = it.stopMd5
|
||||
line.stopUrl = it.stopUrl
|
||||
line.timestamp = it.timestamp
|
||||
line.setVehicleModel(it.vehicleModel)
|
||||
}
|
||||
|
||||
routeInfo.line = line.build()
|
||||
|
||||
return routeInfo.build()
|
||||
}
|
||||
|
||||
fun AutopilotControlParameters.AutoPilotLine.toAutoPilotLine(): MessagePad.Line {
|
||||
val line = MessagePad.Line.newBuilder()
|
||||
line.lineId = this.lineId
|
||||
line.trajMd5 = this.trajMd5
|
||||
line.trajUrl = this.trajUrl
|
||||
line.stopMd5 = this.stopMd5
|
||||
line.stopUrl = this.stopUrl
|
||||
line.timestamp = this.timestamp
|
||||
line.vehicleModel = this.vehicleModel
|
||||
return line.build()
|
||||
}
|
||||
|
||||
|
||||
class AutopilotControlParameters {
|
||||
@JvmField
|
||||
var startName = ""
|
||||
|
||||
@JvmField
|
||||
var endName = ""
|
||||
|
||||
@JvmField
|
||||
var startLatLon: AutoPilotLonLat? = null
|
||||
|
||||
@JvmField
|
||||
var wayLatLons: List<AutoPilotLonLat>? = null
|
||||
|
||||
@JvmField
|
||||
var endLatLon: AutoPilotLonLat? = null
|
||||
var speedLimit = 0f
|
||||
|
||||
@JvmField
|
||||
var vehicleType // 运营类型
|
||||
= 0
|
||||
var speedLimit = 0f
|
||||
|
||||
@JvmField
|
||||
var vehicleType = 0// 运营类型
|
||||
|
||||
@JvmField
|
||||
var routeID = 0 //线路id(bus用)
|
||||
|
||||
@JvmField
|
||||
var routeName = "" //线路名称(bus用)
|
||||
|
||||
@@ -91,6 +124,37 @@ class AutopilotControlParameters {
|
||||
@JvmField
|
||||
var isSpeakVoice = true
|
||||
|
||||
@JvmField
|
||||
var autoPilotLine: AutoPilotLine? = null // 自动驾驶路线
|
||||
|
||||
class AutoPilotLine {
|
||||
var lineId = 0L
|
||||
var trajUrl = ""
|
||||
var trajMd5 = ""
|
||||
var stopUrl = ""
|
||||
var stopMd5 = ""
|
||||
var timestamp = 0L
|
||||
var vehicleModel = ""
|
||||
|
||||
constructor(lineId: Long, trajUrl: String,
|
||||
trajMd5: String, stopUrl: String,
|
||||
stopMd5: String, timestamp: Long,
|
||||
vehicleModel: String) {
|
||||
this.lineId = lineId
|
||||
this.trajUrl = trajUrl
|
||||
this.trajMd5 = trajMd5
|
||||
this.stopUrl = stopUrl
|
||||
this.stopMd5 = stopMd5
|
||||
this.timestamp = timestamp
|
||||
this.vehicleModel = vehicleModel
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "AutoPilotLine(lineId=$lineId, trajUrl='$trajUrl', trajMd5='$trajMd5', stopUrl='$stopUrl', stopMd5='$stopMd5', timestamp=$timestamp, vehicleModel='$vehicleModel')"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class AutoPilotLonLat {
|
||||
var lat = 0.0
|
||||
var lon = 0.0
|
||||
|
||||
@@ -34,6 +34,11 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
*/
|
||||
fun sendTrafficLightData(trafficLightResult: TrafficLightResult)
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*/
|
||||
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine)
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
|
||||
@@ -72,6 +72,13 @@ object CallerAutoPilotManager {
|
||||
providerApi?.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*/
|
||||
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) {
|
||||
providerApi?.sendTrajectoryDownloadReq(autoPilotLine)
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ enum MessageType
|
||||
MsgTypePerceptionTrafficLight = 0x10006; //感知红绿灯
|
||||
MsgTypePredictionObstacleTrajectory = 0x10007; //他车轨迹预测
|
||||
MsgTypePointCloud = 0x10008; //点云透传
|
||||
MsgTypePlanningObjects = 0x10009; //planning障碍物
|
||||
|
||||
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
|
||||
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
|
||||
@@ -36,6 +37,7 @@ enum MessageType
|
||||
MsgTypeWarn = 0x1010d; //预警数据
|
||||
MsgTypeArrivalNotification = 0x1010e; //到站提醒
|
||||
MsgTypeSystemCmdReq = 0x1010f; //系统命令请求, 比如系统重启,启用新镜像
|
||||
MsgTypeTrajectoryDownloadReq = 0x10110; //轨迹下载请求
|
||||
}
|
||||
|
||||
message Header
|
||||
@@ -83,7 +85,7 @@ message TrackedObject
|
||||
double heading = 10; //车辆朝向
|
||||
double speed = 11; //车辆速度
|
||||
uint32 drawLevel = 12; //危险等级 1 绿,2 黄,3 红
|
||||
double driverTime = 13; //驱动感知时间
|
||||
double driverTime = 13; //驱动感知时间, abandoned
|
||||
}
|
||||
|
||||
message TrackedObjects
|
||||
@@ -112,13 +114,13 @@ message GnssInfo
|
||||
// message definition for MessageType: MsgTypeAutopilotState
|
||||
message AutopilotState
|
||||
{
|
||||
uint32 state = 1; //0: 不可用, 1:ready, 2:自动驾驶中
|
||||
uint32 state = 1; //0: 不可用(abandoned), 1:ready, 2:自动驾驶中
|
||||
uint32 camera = 2; //camera节点状态 1:开启,0:关闭
|
||||
uint32 radar = 3; //雷达节点状态 1:开启,0:关闭
|
||||
uint32 rtk = 4; //RTK节点状态 1:开启,0:关闭
|
||||
uint32 autopilotMode = 5; //自动驾驶状态 0: 非自动驾驶,1: 自动驾驶
|
||||
double speed = 6; //惯导车速 m/s
|
||||
string reason = 7; //不可用原因
|
||||
string reason = 7; //不可用原因(abandoned)
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeReportMessage
|
||||
@@ -131,7 +133,36 @@ message AutopilotState
|
||||
// refer to prediction.proto
|
||||
|
||||
// message definition for MessageType: MsgTypePointCloud
|
||||
// refer to point_cloud.proto
|
||||
// refer to mogo_point_cloud.proto
|
||||
|
||||
// message definition for MessageType: MsgTypePlanningObjects
|
||||
message PlanningObject
|
||||
{
|
||||
uint32 uuid = 1;
|
||||
uint32 type = 2; //影响自车决策的类型, 和感知的障碍物类型不是一回事
|
||||
}
|
||||
|
||||
message PlanningObjects
|
||||
{
|
||||
repeated PlanningObject objs = 1;
|
||||
}
|
||||
|
||||
// message definition for MsgTypeTrajectoryDownloadReq
|
||||
message Line
|
||||
{
|
||||
uint64 lineId = 1; //路线id,默认-1
|
||||
string trajUrl = 2; //轨迹文件下载的cos url,默认“”
|
||||
string trajMd5 = 3; //轨迹文件md5,默认“”
|
||||
string stopUrl = 4; //打点文件下载的cos url,默认“”
|
||||
string stopMd5 = 5; //轨迹文件md5,默认“”
|
||||
uint64 timestamp = 6; //上传轨迹完成时间戳(ms):用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
string vehicleModel = 7; //车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
}
|
||||
|
||||
message TrajectoryDownloadReq
|
||||
{
|
||||
Line line = 1; //路线
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeBasicInfoReq
|
||||
message BasicInfoReq
|
||||
@@ -162,9 +193,10 @@ message RouteInfo{
|
||||
repeated Location wayPoints = 5;
|
||||
double speedLimit = 6; //单位: km/h
|
||||
uint32 vehicleType = 7;
|
||||
bool isSpeakVoice = 8;
|
||||
bool isSpeakVoice = 8; //abandoned
|
||||
uint32 routeID = 9;
|
||||
string routeName = 10;
|
||||
Line line = 11; //路线信息
|
||||
}
|
||||
|
||||
message SetAutopilotModeReq
|
||||
@@ -280,7 +312,7 @@ message Warn
|
||||
// message definition for MsgTypeArrivalNotification
|
||||
message ArrivalNotification
|
||||
{
|
||||
uint32 carType = 1; //deserted
|
||||
uint32 carType = 1; //abandoned
|
||||
Location endLocation = 2;
|
||||
}
|
||||
|
||||
@@ -292,7 +324,7 @@ enum SystemCmdType {
|
||||
|
||||
message SystemCmdReq
|
||||
{
|
||||
SystemCmdType cmdType = 1;
|
||||
SystemCmdType cmdType = 1; //
|
||||
}
|
||||
|
||||
|
||||
@@ -301,3 +333,6 @@ message SystemCmdReq
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.bean.VersionCompatibility;
|
||||
import com.zhidao.support.adas.high.common.ByteUtil;
|
||||
@@ -40,8 +39,6 @@ import com.zhidao.support.adas.high.thread.DispatchHandler;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -851,5 +848,19 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
MessagePad.SystemCmdReq req = builder.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_SYSTEM_CMD_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line) {
|
||||
MessagePad.TrajectoryDownloadReq.Builder builder = MessagePad.TrajectoryDownloadReq.newBuilder();
|
||||
builder.setLine(line);
|
||||
MessagePad.TrajectoryDownloadReq req = builder.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -395,6 +395,17 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendSystemCmdReq(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line) {
|
||||
return mChannel != null && mChannel.sendTrajectoryDownloadReq(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工控机固定IP列表
|
||||
*
|
||||
|
||||
@@ -180,6 +180,14 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type);
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendTrajectoryDownloadReq(MessagePad.Line line);
|
||||
|
||||
// TODO 需求暂停 待讨论
|
||||
// boolean getRoutes();
|
||||
|
||||
|
||||
@@ -96,6 +96,14 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onPointCloud(MessagePad.Header header, MogoPointCloudOuterClass.MogoPointCloud pointCloud);
|
||||
|
||||
/**
|
||||
* planning障碍物
|
||||
*
|
||||
* @param header 头
|
||||
* @param planningObjects 数据
|
||||
*/
|
||||
void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects);
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息请求
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@ public enum MessageType {
|
||||
TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT(MessagePad.MessageType.MsgTypePerceptionTrafficLight, "感知红绿灯"),
|
||||
TYPE_RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY(MessagePad.MessageType.MsgTypePredictionObstacleTrajectory, "他车轨迹预测"),
|
||||
TYPE_RECEIVE_POINT_CLOUD(MessagePad.MessageType.MsgTypePointCloud, "点云透传"),
|
||||
TYPE_RECEIVE_PLANNING_OBJECTS(MessagePad.MessageType.MsgTypePlanningObjects, "planning障碍物"),
|
||||
|
||||
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
|
||||
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),
|
||||
@@ -38,7 +39,8 @@ public enum MessageType {
|
||||
@Deprecated
|
||||
TYPE_RECEIVE_WARN(MessagePad.MessageType.MsgTypeWarn, "预警数据"),
|
||||
TYPE_RECEIVE_ARRIVAL_NOTIFICATION(MessagePad.MessageType.MsgTypeArrivalNotification, "到站提醒"),
|
||||
TYPE_SEND_SYSTEM_CMD_REQ(MessagePad.MessageType.MsgTypeSystemCmdReq, "系统命令请求, 比如系统重启,启用新镜像");
|
||||
TYPE_SEND_SYSTEM_CMD_REQ(MessagePad.MessageType.MsgTypeSystemCmdReq, "系统命令请求, 比如系统重启,启用新镜像"),
|
||||
TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ(MessagePad.MessageType.MsgTypeTrajectoryDownloadReq, "轨迹下载请求");
|
||||
|
||||
/**
|
||||
* 消息action code
|
||||
|
||||
@@ -20,6 +20,7 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg perceptionTrafficLightMessage;//感知红绿灯
|
||||
private IMsg predictionObstacleTrajectoryMessage;//他车轨迹预测
|
||||
private IMsg pointCloudMessage;//透传点云数据
|
||||
private IMsg planningObjectsMessage;//planning障碍物
|
||||
|
||||
private IMsg basicInfoReqMessage;//自动驾驶设备基础信息请求
|
||||
private IMsg carConfigRespMessage;//车机基础信息应答
|
||||
@@ -80,11 +81,17 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
}
|
||||
return predictionObstacleTrajectoryMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_POINT_CLOUD.typeCode) {
|
||||
//他车轨迹预测
|
||||
//点云透传
|
||||
if (pointCloudMessage == null) {
|
||||
pointCloudMessage = new PointCloudMessage();
|
||||
}
|
||||
return pointCloudMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_PLANNING_OBJECTS.typeCode) {
|
||||
//planning障碍物
|
||||
if (planningObjectsMessage == null) {
|
||||
planningObjectsMessage = new PlanningObjectsMessage();
|
||||
}
|
||||
return planningObjectsMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_BASIC_INFO_REQ.typeCode) {
|
||||
//自动驾驶设备基础信息请求
|
||||
if (basicInfoReqMessage == null) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* planning障碍物
|
||||
*/
|
||||
public class PlanningObjectsMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.PlanningObjects planningObjects = MessagePad.PlanningObjects.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
if (adasListener != null) {
|
||||
adasListener.onPlanningObjects(raw.getHeader(), planningObjects);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user