与工控机联调完成
This commit is contained in:
1
app_ipc_monitoring/README.md
Normal file
1
app_ipc_monitoring/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# 工控机测试程序
|
||||
@@ -12,6 +12,11 @@ android {
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
flavorDimensions "multi_device"
|
||||
|
||||
packagingOptions {
|
||||
//解决编译时com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/rxjava.properties'这个错误
|
||||
exclude 'META-INF/rxjava.properties'
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -49,7 +54,7 @@ dependencies {
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':core:mogo-core-data')
|
||||
// implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
// api "com.zhidao.support.adas:high:1.2.1.2_bate21"
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class ArrivalNotification extends Base {
|
||||
@@ -13,9 +15,7 @@ public class ArrivalNotification extends Base {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ArrivalNotification{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class AutopilotState extends Base {
|
||||
@@ -11,12 +13,10 @@ public class AutopilotState extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotState{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public abstract class Base {
|
||||
@@ -14,6 +16,6 @@ public abstract class Base {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + len + "}header=" + header;
|
||||
return len + "##Header:[" + TextFormat.shortDebugString(header)+"]\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class BasicInfoReq extends Base {
|
||||
@@ -11,11 +13,9 @@ public class BasicInfoReq extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BasicInfoReq{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class CarConfigResp extends Base {
|
||||
@@ -11,10 +13,9 @@ public class CarConfigResp extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarConfigResp{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
|
||||
public class ErrorData {
|
||||
private final ProtocolStatus status;
|
||||
private final byte[] bytes;
|
||||
|
||||
public ErrorData(ProtocolStatus status, byte[] bytes) {
|
||||
this.status = status;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return status + "\n原始数据:" + DigitalTrans.byte2HexStr(bytes);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GlobalPathResp extends Base {
|
||||
@@ -13,10 +15,7 @@ public class GlobalPathResp extends Base {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GlobalPathResp{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GnssInfo extends Base {
|
||||
@@ -11,11 +13,10 @@ public class GnssInfo extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GnssInfo{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
@@ -12,12 +14,10 @@ public class MogoReportMessage extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoReportMessage{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
@@ -12,12 +14,9 @@ public class RecordPanel extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RecordPanel{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class TrackedObjects extends Base {
|
||||
@@ -10,12 +12,8 @@ public class TrackedObjects extends Base {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrackedObjects{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Trajectory extends Base {
|
||||
@@ -9,14 +11,9 @@ public class Trajectory extends Base {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Trajectory{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -11,13 +13,8 @@ public class VehicleState extends Base {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VehicleState{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Warn extends Base {
|
||||
@@ -10,11 +12,8 @@ public class Warn extends Base {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Warn{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class AutopilotConfigActivity extends AppCompatActivity {
|
||||
}
|
||||
json = json.split("##")[1];
|
||||
Log.i("开始执行自动驾驶", json);
|
||||
AdasManager.getInstance().aiCloudToAdasData(json);
|
||||
// AdasManager.getInstance().aiCloudToAdasData(json);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -11,10 +12,13 @@ import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
//log所用
|
||||
public class DataShowAdapter extends BaseAdapter<LogModel, DataShowAdapter.ViewHolder> {
|
||||
|
||||
public class DataShowAdapter extends BaseAdapter<String, DataShowAdapter.ViewHolder> {
|
||||
private final int[] colors = {Color.parseColor("#FA8072"), Color.parseColor("#FF00FF"), Color.parseColor("#228B22"), Color.parseColor("#871f78")};
|
||||
private final Random random = new Random();
|
||||
|
||||
public void refreshView(int position) {
|
||||
if (position == -1) {
|
||||
@@ -28,10 +32,18 @@ public class DataShowAdapter extends BaseAdapter<LogModel, DataShowAdapter.ViewH
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, LogModel data, int position) {
|
||||
viewHolder.id.setText("[" + data.data.length() + "]" + (position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(viewHolder.editText.getResources().getColor(data.getColor()));
|
||||
viewHolder.editText.setText(data.data);
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, String data, int position) {
|
||||
if (data.contains("##")) {
|
||||
String[] temp = data.split("##");
|
||||
viewHolder.id.setText("[" + temp[0] + "]" + (position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(colors[random.nextInt(4)]);
|
||||
viewHolder.editText.setText(temp[1]);
|
||||
} else {
|
||||
viewHolder.id.setText((position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(colors[random.nextInt(4)]);
|
||||
viewHolder.editText.setText(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,8 +64,8 @@ public class DataShowAdapter extends BaseAdapter<LogModel, DataShowAdapter.ViewH
|
||||
|
||||
public ViewHolder(View itemView, DataShowAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
editText =itemView.findViewById(R.id.log);
|
||||
id =itemView.findViewById(R.id.id);
|
||||
editText = itemView.findViewById(R.id.log);
|
||||
id = itemView.findViewById(R.id.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
@@ -42,7 +43,7 @@ import java.util.List;
|
||||
public class InfoFragment extends Fragment {
|
||||
|
||||
private String title;
|
||||
private List<LogModel> data = new ArrayList<>();
|
||||
private final List<String> data = new ArrayList<>();
|
||||
private DataShowAdapter adapter;
|
||||
|
||||
public InfoFragment() {
|
||||
@@ -102,28 +103,36 @@ public class InfoFragment extends Fragment {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onWarnEvent(Warn info) {
|
||||
if (title.equals("预警数据")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_WARN)) {
|
||||
if (data.size() > 19) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onRectEvent(TrackedObjects info) {
|
||||
if (title.equals("感知数据")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_TRACKED_OBJECTS)) {
|
||||
if (data.size() > 4) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onErrorEvent(ErrorData info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_ERROR)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void onTurnLightState(int turnLight, boolean brake_light) {
|
||||
StringBuilder builder = new StringBuilder("底盘数据\t");
|
||||
StringBuilder builder = new StringBuilder(MainActivity.TITLE.RECEIVE_VEHICLE_STATE + "\t");
|
||||
if (turnLight == 0) {
|
||||
builder.append("左转:关");
|
||||
builder.append("右转:关");
|
||||
@@ -169,36 +178,36 @@ public class InfoFragment extends Fragment {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onCarEvent(VehicleState info) {
|
||||
if (title.equals("底盘数据")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_VEHICLE_STATE)) {
|
||||
if (data.size() > 5) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
int light = info.bean.getLight().getNumber();//转向灯状态 0是正常 1是左转 2是右转
|
||||
onTurnLightState(setTurnLightState(light), info.bean.getBrake_light());
|
||||
onTurnLightState(setTurnLightState(light), info.bean.getBrakeLightStatus());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(GnssInfo info) {
|
||||
if (title.equals("GNSS数据")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_GNSS_INFO)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(AutopilotState info) {
|
||||
if (title.equals("自动驾驶状态")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_AUTOPILOT_STATE)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -206,43 +215,43 @@ public class InfoFragment extends Fragment {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onTrajectoryEvent(Trajectory info) {
|
||||
if (title.equals("局部轨迹")) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_TRAJECTORY)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotWayArriveEvent(ArrivalNotification info) {
|
||||
if (title.equals("自动驾驶站点")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_ARRIVAL_NOTIFICATION)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRouteEvent(GlobalPathResp info) {
|
||||
if (title.equals("自动驾驶路径")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_GLOBAL_PATH_RESP)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRecordResultEvent(RecordPanel info) {
|
||||
if (title.equals("BadCase数据")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_RECORD_RESULT)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotGuardianInfoEvent(ReportMessage info) {
|
||||
if (title.equals("监控事件报告")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_REPORT_MESSAGE)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
|
||||
|
||||
//保存的log
|
||||
public class LogModel {
|
||||
|
||||
public interface ACTION {
|
||||
String SEND = "发送";
|
||||
String RECEIVE = "接收";
|
||||
String PARSE = "解析";
|
||||
}
|
||||
|
||||
public long id;
|
||||
public String action;//log标签
|
||||
public String data;//log数据
|
||||
public String time;
|
||||
|
||||
public LogModel() {
|
||||
}
|
||||
|
||||
public LogModel(String action, String data) {
|
||||
this.action = action;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public int getColor() {
|
||||
switch (action) {
|
||||
case ACTION.SEND:
|
||||
return R.color.colorAccent;
|
||||
case ACTION.RECEIVE:
|
||||
return R.color.colorPrimary;
|
||||
case ACTION.PARSE:
|
||||
return Color.parseColor("#228B22");
|
||||
default:
|
||||
return Color.parseColor("#871f78");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return data+"";
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,14 @@ import com.mogo.telematic.NSDNettyManager;
|
||||
import com.mogo.telematic.client.listener.NettyClientListener;
|
||||
import com.mogo.telematic.client.status.ConnectState;
|
||||
import com.mogo.telematic.server.netty.NettyServerListener;
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.MogoReportMessage;
|
||||
@@ -60,6 +62,7 @@ import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.recorder.RecordDataManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -122,16 +125,47 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
private InfoFragment autopilotRouteFragment;
|
||||
private UpgradeFragment upgradeFragment;
|
||||
private InfoFragment badcseFragment;
|
||||
private InfoFragment errorFragment;
|
||||
private InfoFragment reportMessageFragment;
|
||||
private VersionFragment versionFragment;
|
||||
private FragmentManager manager;
|
||||
private FragmentTransaction transaction;
|
||||
private String ftpTime;
|
||||
private boolean isPad;
|
||||
private String recordKey;
|
||||
private long recordKey;
|
||||
private String recordFileName;
|
||||
private int connectStatus;
|
||||
|
||||
|
||||
public interface TITLE {
|
||||
String RECEIVE_TRAJECTORY = "车前引导线";
|
||||
String RECEIVE_TRACKED_OBJECTS = "障碍物信息";
|
||||
String RECEIVE_GNSS_INFO = "惯导信息";
|
||||
String RECEIVE_VEHICLE_STATE = "底盘信息";
|
||||
String RECEIVE_AUTOPILOT_STATE = "自动驾驶状态";
|
||||
String RECEIVE_REPORT_MESSAGE = "监控事件";
|
||||
// String RECEIVE_BASIC_INFO_REQ = "自动驾驶设备基础信息请求";
|
||||
String RECEIVE_CAR_CONFIG_RESP = "信息与配置";
|
||||
String RECEIVE_RECORD_RESULT = "数据采集结果";
|
||||
String RECEIVE_GLOBAL_PATH_RESP = "自动驾驶路径";
|
||||
String RECEIVE_WARN = "预警数据";
|
||||
String RECEIVE_ARRIVAL_NOTIFICATION = "到站提醒";
|
||||
String RECEIVE_IPC_UPGRADE_STATUS = "升级状态";
|
||||
String RECEIVE_ERROR = "错误数据";
|
||||
|
||||
|
||||
String SEND_BASIC_INFO_RESP = "自动驾驶设备基础信息应答";
|
||||
String SEND_SET_AUTOPILOT_MODE_REQ = "设置自动驾驶模式 启动自动驾驶";
|
||||
String SEND_SET_DEMO_MODE_REQ = "设置演示模式";
|
||||
String SEND_CAR_CONFIG_REQ = "车机基础信息请求";
|
||||
String SEND_RECORD_CAUSE = "记录人工接管原因";
|
||||
String SEND_RECORD_DATA = "数据采集请求";
|
||||
String SEND_SET_AUTOPILOT_SPEED_REQ = "设置自动驾驶最大速度";
|
||||
String SEND_GLOBAL_PATH_REQ = "自动驾驶路径请求";
|
||||
String SEND_TRAFFIC_LIGHT_DATA = "发送红绿灯数据到工控机";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -292,18 +326,20 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
}
|
||||
|
||||
private void initListData() {
|
||||
titleFragmentData.add("GNSS数据");
|
||||
titleFragmentData.add("底盘数据");
|
||||
titleFragmentData.add("感知数据");
|
||||
titleFragmentData.add("自动驾驶状态");
|
||||
titleFragmentData.add("预警数据");
|
||||
titleFragmentData.add("局部轨迹");
|
||||
titleFragmentData.add("自动驾驶站点");
|
||||
titleFragmentData.add("自动驾驶路径");
|
||||
titleFragmentData.add("IPC升级");
|
||||
titleFragmentData.add("BadCase数据");
|
||||
titleFragmentData.add("监控事件报告");
|
||||
titleFragmentData.add("版本和配置");
|
||||
titleFragmentData.add(TITLE.RECEIVE_GNSS_INFO);
|
||||
titleFragmentData.add(TITLE.RECEIVE_TRAJECTORY);
|
||||
titleFragmentData.add(TITLE.RECEIVE_TRACKED_OBJECTS);
|
||||
titleFragmentData.add(TITLE.RECEIVE_VEHICLE_STATE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_AUTOPILOT_STATE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_REPORT_MESSAGE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_CAR_CONFIG_RESP);
|
||||
titleFragmentData.add(TITLE.RECEIVE_RECORD_RESULT);
|
||||
titleFragmentData.add(TITLE.RECEIVE_GLOBAL_PATH_RESP);
|
||||
titleFragmentData.add(TITLE.RECEIVE_WARN);
|
||||
titleFragmentData.add(TITLE.RECEIVE_ARRIVAL_NOTIFICATION);
|
||||
titleFragmentData.add(TITLE.RECEIVE_IPC_UPGRADE_STATUS);
|
||||
titleFragmentData.add(TITLE.RECEIVE_ERROR);
|
||||
|
||||
|
||||
titleBtnData.add("下发站点1");
|
||||
titleBtnData.add("下发站点2");
|
||||
@@ -362,18 +398,18 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction = manager.beginTransaction();
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
switch (data) {
|
||||
case "GNSS数据":
|
||||
case TITLE.RECEIVE_GNSS_INFO:
|
||||
firstFragment();
|
||||
break;
|
||||
case "底盘数据":
|
||||
case TITLE.RECEIVE_VEHICLE_STATE:
|
||||
if (canFragment == null)
|
||||
canFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
if (!canFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, canFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "感知数据":
|
||||
case TITLE.RECEIVE_TRACKED_OBJECTS:
|
||||
if (viewFragment == null)
|
||||
viewFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
@@ -381,7 +417,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶状态":
|
||||
case TITLE.RECEIVE_AUTOPILOT_STATE:
|
||||
if (autoFragment == null)
|
||||
autoFragment = new InfoFragment(data);
|
||||
if (!autoFragment.isVisible()) {
|
||||
@@ -389,7 +425,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "预警数据":
|
||||
case TITLE.RECEIVE_WARN:
|
||||
if (warnFragment == null)
|
||||
warnFragment = new InfoFragment(data);
|
||||
if (!warnFragment.isVisible()) {
|
||||
@@ -397,7 +433,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "局部轨迹":
|
||||
case TITLE.RECEIVE_TRAJECTORY:
|
||||
if (trajectoryFragment == null)
|
||||
trajectoryFragment = new InfoFragment(data);
|
||||
if (!trajectoryFragment.isVisible()) {
|
||||
@@ -405,7 +441,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶站点":
|
||||
case TITLE.RECEIVE_ARRIVAL_NOTIFICATION:
|
||||
if (autopilotWayArriveFragment == null)
|
||||
autopilotWayArriveFragment = new InfoFragment(data);
|
||||
if (!autopilotWayArriveFragment.isVisible()) {
|
||||
@@ -413,7 +449,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶路径":
|
||||
case TITLE.RECEIVE_GLOBAL_PATH_RESP:
|
||||
if (autopilotRouteFragment == null)
|
||||
autopilotRouteFragment = new InfoFragment(data);
|
||||
if (!autopilotRouteFragment.isVisible()) {
|
||||
@@ -421,7 +457,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "IPC升级":
|
||||
case TITLE.RECEIVE_IPC_UPGRADE_STATUS:
|
||||
if (upgradeFragment == null)
|
||||
upgradeFragment = new UpgradeFragment(data);
|
||||
if (!upgradeFragment.isVisible()) {
|
||||
@@ -429,7 +465,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "BadCase数据":
|
||||
case TITLE.RECEIVE_RECORD_RESULT:
|
||||
if (badcseFragment == null)
|
||||
badcseFragment = new InfoFragment(data);
|
||||
if (!badcseFragment.isVisible()) {
|
||||
@@ -437,7 +473,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "监控事件报告":
|
||||
case TITLE.RECEIVE_REPORT_MESSAGE:
|
||||
if (reportMessageFragment == null)
|
||||
reportMessageFragment = new InfoFragment(data);
|
||||
if (!reportMessageFragment.isVisible()) {
|
||||
@@ -445,7 +481,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "版本和配置":
|
||||
case 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固定IP配置");
|
||||
@@ -454,21 +490,36 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
|
||||
case TITLE.RECEIVE_ERROR:
|
||||
if (errorFragment == null)
|
||||
errorFragment = new InfoFragment(data);
|
||||
if (!errorFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, errorFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showIPCIP(String ip, int port) {
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
ip = "IPC IP:" + ip + ":" + port;
|
||||
public void showIPCIP(final String ip, final int port) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
String temp = "";
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
temp = "IPC IP:" + ip + ":" + port;
|
||||
}
|
||||
ipcIp.setText(temp);
|
||||
} else {
|
||||
ipcIp.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
ipcIp.setText(ip);
|
||||
} else {
|
||||
ipcIp.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -532,6 +583,11 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
CupidLogUtils.w(TAG, "IPC命令下发结果:" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ProtocolStatus status, byte[] bytes) {
|
||||
EventBus.getDefault().postSticky(new ErrorData(status, bytes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
|
||||
EventBus.getDefault().postSticky(new Trajectory(header, trajectory));
|
||||
@@ -564,7 +620,15 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
|
||||
@Override
|
||||
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
|
||||
EventBus.getDefault().postSticky(new BasicInfoReq(header, basicInfoReq));
|
||||
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
toastMsg("收到车机基础信息请求:" + info.toString());
|
||||
}
|
||||
});
|
||||
// EventBus.getDefault().postSticky(new BasicInfoReq(header, basicInfoReq));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -574,6 +638,8 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
|
||||
@Override
|
||||
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
recordKey = recordPanel.getKey();
|
||||
recordFileName = recordPanel.getFilename();
|
||||
EventBus.getDefault().postSticky(new RecordPanel(header, recordPanel));
|
||||
}
|
||||
|
||||
@@ -623,7 +689,6 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
|
||||
@Override
|
||||
public void onMessageResponseClient(MogoProtocolMsg msg, String sign) {
|
||||
Log.d("dddd", "12345678=" + Arrays.toString(msg.getBody()));
|
||||
AdasManager.getInstance().parseIPCData(msg.getBody());
|
||||
}
|
||||
|
||||
@@ -743,7 +808,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectSuccess");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
} else if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("ws连接失败:" + failedMsg);
|
||||
toastMsg("连接失败:" + failedMsg);
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectFailed");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
}
|
||||
@@ -796,7 +861,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
|
||||
private void firstFragment() {
|
||||
if (carFragment == null)
|
||||
carFragment = new InfoFragment("自车状态");
|
||||
carFragment = new InfoFragment(TITLE.RECEIVE_GNSS_INFO);
|
||||
if (!carFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, carFragment);
|
||||
transaction.commit();
|
||||
@@ -825,7 +890,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
.setStartName("KXCNMZ")
|
||||
.setEndLocation(endLocation)
|
||||
.setEndName("SDYJKXCXMBZ")
|
||||
.addAllWayPoints(null)
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
@@ -848,7 +913,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
.setStartName("SDYJKXCXMBDM")
|
||||
.setEndLocation(endLocation2)
|
||||
.setEndName("KXCNMDM")
|
||||
.addAllWayPoints(null)
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
@@ -882,7 +947,27 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
RecordDataManager.getInstance().record();
|
||||
break;
|
||||
case "发送信号灯":
|
||||
AdasManager.getInstance().sendTrafficLightData(null);
|
||||
MessagePad.TrafficLightStatus left = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("1")
|
||||
.setColor("R")
|
||||
.setRemain(249)
|
||||
.build();
|
||||
MessagePad.TrafficLightStatus mid = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("2")
|
||||
.setColor("G")
|
||||
.setRemain(199)
|
||||
.build();
|
||||
MessagePad.TrafficLightStatus right = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("3")
|
||||
.setColor("G")
|
||||
.setRemain(199)
|
||||
.build();
|
||||
MessagePad.TrafficLightDetail detail = MessagePad.TrafficLightDetail.newBuilder()
|
||||
.setLeft(left)
|
||||
.setMid(mid)
|
||||
.setRight(right)
|
||||
.build();
|
||||
AdasManager.getInstance().sendTrafficLightData("10038", 26.848153, 112.574883, "180.0", "SN", 100413, -4, 201, 0, detail);
|
||||
break;
|
||||
case "速度设置":
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(30);
|
||||
|
||||
@@ -207,7 +207,7 @@ public class VersionFragment extends Fragment {
|
||||
protocol_version_hint.setVisibility(View.GONE);
|
||||
app_protocol_version_hint.setVisibility(View.GONE);
|
||||
}
|
||||
// appVersionView.setText(AppUtils.getAppVersionName());
|
||||
appVersionView.setText(AppUtils.getAppVersionName());
|
||||
mapVersionView.setText(AdasManager.getInstance().getAPVersion());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<dimen name="dp_52">52px</dimen>
|
||||
<dimen name="dp_65">65px</dimen>
|
||||
<dimen name="dp_200">200px</dimen>
|
||||
<dimen name="dp_100">100px</dimen>
|
||||
<dimen name="module_ext_speed_width">300px</dimen>
|
||||
<dimen name="module_ext_speed_height">300px</dimen>
|
||||
<dimen name="module_ext_speed_padding">60px</dimen>
|
||||
|
||||
Reference in New Issue
Block a user