[Taxi driver V2.6.5] merge

This commit is contained in:
wangmingjun
2022-04-01 18:19:42 +08:00
25 changed files with 788 additions and 232 deletions

View File

@@ -56,5 +56,7 @@ class OchBusConst {
const val EVENT_PARAM_END_NAME = "end_name"
const val EVENT_PARAM_LINE_ID = "line_id"
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境true/false
}
}

View File

@@ -1,6 +1,10 @@
package com.mogo.och.bus.util;
import android.text.TextUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -25,11 +29,15 @@ public class OchBusAnalyticsUtil {
boolean send, String startName, String endName, int lineId) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
String dateTime = DateTimeUtils.getTimeText(
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
Map<String, Object> params = new HashMap<>();
params.put(OchBusConst.EVENT_PARAM_SN, sn);
params.put(OchBusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
params.put(OchBusConst.EVENT_PARAM_ENV_ONLINE,
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
params.put(OchBusConst.EVENT_PARAM_TIME, dateTime);
params.put(OchBusConst.EVENT_PARAM_START_NAME, startName);
params.put(OchBusConst.EVENT_PARAM_END_NAME, endName);

View File

@@ -58,6 +58,8 @@ class OCHTaxiConst {
const val EVENT_PARAM_END_NAME = "end_name"
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境true/false
// 实时计算当前剩余里程和时间 间隔 2秒
const val LOOP_CALCULATEROUTE_2S = 2 * 1000L

View File

@@ -1,6 +1,10 @@
package com.mogo.och.taxi.utils;
import android.text.TextUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -25,11 +29,15 @@ public class OchTaxiAnalyticsUtil {
boolean send, String startName, String endName, String orderNo) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
String dateTime = DateTimeUtils.getTimeText(
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
Map<String, Object> params = new HashMap<>();
params.put(OCHTaxiConst.EVENT_PARAM_SN, sn);
params.put(OCHTaxiConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
params.put(OCHTaxiConst.EVENT_PARAM_ENV_ONLINE,
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
params.put(OCHTaxiConst.EVENT_PARAM_TIME, dateTime);
params.put(OCHTaxiConst.EVENT_PARAM_START_NAME, startName);
params.put(OCHTaxiConst.EVENT_PARAM_END_NAME, endName);

View File

@@ -5,7 +5,7 @@ android {
defaultConfig {
applicationId "com.zhidao.adas.client"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"

View File

@@ -27,6 +27,7 @@ public class InfoTitleAdapter extends BaseAdapter<String, InfoTitleAdapter.ViewH
selectedPosition = position;
}
}
public InfoTitleAdapter(List<String> data, boolean isFragment) {
super(data);
this.isFragment = isFragment;
@@ -37,7 +38,7 @@ public class InfoTitleAdapter extends BaseAdapter<String, InfoTitleAdapter.ViewH
if (data == null) {
return;
}
if (isFragment){
if (isFragment) {
viewHolder.itemView.setSelected(selectedPosition == position);
}
viewHolder.title.setText(data);
@@ -46,7 +47,24 @@ public class InfoTitleAdapter extends BaseAdapter<String, InfoTitleAdapter.ViewH
@Override
protected View getItemViewResource(ViewGroup viewGroup) {
return LayoutInflater.from(mContext).inflate(R.layout.item_info, viewGroup, false);
View view;
if (isFragment) {
view = LayoutInflater.from(mContext).inflate(R.layout.item_info, viewGroup, false);
} else {
view = LayoutInflater.from(mContext).inflate(R.layout.item_info1, viewGroup, false);
}
// if (!isFragment) {
// int h = viewGroup.getHeight() - DensityUtil.dip2px(mContext, 16);
// ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
// if (layoutParams != null) {
// layoutParams.width = DensityUtil.dip2px(mContext, 150);
//// layoutParams.height = DensityUtil.dip2px(mContext, 50);
// layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
//// layoutParams.height = h / 2;
// }
// }
return view;
}
@Override

View File

@@ -49,11 +49,11 @@ public class LineAdapter extends BaseAdapter<AutoPilotMode, LineAdapter.ViewHold
public ViewHolder(View itemView, LineAdapter adapter) {
super(itemView, adapter);
ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams();
if (layoutParams != null) {
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
}
// ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams();
// if (layoutParams != null) {
// layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
//
// }
title = itemView.findViewById(R.id.tv_info_title);
}
}

View File

@@ -0,0 +1,51 @@
package com.zhidao.adas.client.log;
import android.graphics.Color;
import android.text.TextUtils;
//保存的log
public class LogModel {
public interface ACTION {
String SEND = "发送";
String RECEIVE = "接收";
String PARSE = "解析";
}
public long id;
public int op_code;//发送Mask 接收:数据帧类型
public String action;//log标签
public String data;//log数据
public String time;
public LogModel() {
}
public LogModel(String action, int op_code, String data) {
this.action = action;
this.op_code = op_code;
this.data = data;
}
public int getColor() {
if (TextUtils.isEmpty(action)) {
return Color.parseColor("#871f78");
}
switch (action) {
case ACTION.SEND:
// return 0xFA8072;
return Color.parseColor("#FA8072");
case ACTION.RECEIVE:
// return 0xDCDCDC;
return Color.parseColor("#FF00FF");
case ACTION.PARSE:
// return 0xDCDCDC;
return Color.parseColor("#228B22");
default:
// return 0xFFFFFF;
return Color.parseColor("#871f78");
}
}
}

View File

@@ -0,0 +1,167 @@
package com.zhidao.adas.client.log;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ThreadPoolManager;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
/**
* 与服务器交互日志管理任务
*/
public class LogSave {
private static final String TAG = LogSave.class.getSimpleName();
private static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "IPCMonitoring" + File.separator;//程序外部存储跟目录
private static final String LOG_FILE_NAME = "data%s.log";//文件名称
private volatile static LogSave INSTANCE;
private static final long MAX_CAPACITY = 2 * 1024 * 1024L;//单文件最大存储容量 kb
private final LinkedBlockingQueue<String> queue;
private BufferedWriter buff = null;
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
private final SimpleDateFormat FILE_SDF = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss-SSS", Locale.getDefault());
private File file;
private boolean isLogSwitch = false;
private long capacity = MAX_CAPACITY;
private Future future;
private LogSave() {
queue = new LinkedBlockingQueue<>();
start();
}
public static LogSave getInstance() {
if (INSTANCE == null) {
synchronized (LogSave.class) {
if (INSTANCE == null) {
INSTANCE = new LogSave();
}
}
}
return INSTANCE;
}
public void setIsLogSwitch(boolean isLogSwitch) {
this.isLogSwitch = isLogSwitch;
}
public boolean isLogSwitch() {
return isLogSwitch;
}
public boolean isSdcardUse() {
boolean bl = false;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
bl = true;
}
return bl;
}
private void getFile() throws IOException {
if (isSdcardUse()) {
String time = FILE_SDF.format(new Date());
String childPath = time.split("_")[0] + File.separator;
file = new File(ROOT_PATH + childPath + String.format(LOG_FILE_NAME, time));
if (!file.exists()) {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
file.createNewFile();
}
FileWriter fw = new FileWriter(file, true);
buff = new BufferedWriter(fw);
}
}
public void saveLog(String action, String data) {
if (isLogSwitch) {
long nowTime = System.currentTimeMillis();
String time = sdf.format(new Date(nowTime));
// L.i(TAG, "time=" + time);
data = data.replace("\n", "");
String builder = time + " [action]:" + action + " [data]:" + data;
queue.add(builder);
}
}
public void start() {
if (future == null) {
future = ThreadPoolManager.getsInstance().submit(new WriteThread());
}
}
public void stop() {
queue.clear();
if (future != null && !future.isCancelled()) {
future.cancel(true);
}
future = null;
closeBufferedWriter();
}
private void closeBufferedWriter() {
if (buff != null) {
try {
buff.flush();
buff.close();
} catch (IOException e) {
e.printStackTrace();
}
buff = null;
}
}
private class WriteThread implements Runnable {
@Override
public void run() {
synchronized (this) {
while (!Thread.currentThread().isInterrupted()) {
try {
long size = 0;
if (file != null) {
size = file.length();
}
if (size > capacity || file == null || !file.exists() || buff == null) {
closeBufferedWriter();
getFile();
}
String data = queue.take();
if (!TextUtils.isEmpty(data)) {
buff.write(data);
buff.newLine();
buff.flush();
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
Log.i(TAG, "退出线程");
}
}
}
}

View File

@@ -14,6 +14,7 @@ import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
@@ -32,6 +33,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.zhidao.adas.client.bean.Base;
import com.zhidao.adas.client.log.LogSave;
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
import com.google.gson.Gson;
import com.mogo.telematic.MogoProtocolMsg;
import com.mogo.telematic.NSDNettyManager;
@@ -82,6 +86,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadLocalRandom;
import chassis.VehicleStateOuterClass;
import io.netty.channel.Channel;
@@ -104,7 +109,8 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
private AppCompatButton disconnect;
private RadioButton fixation;
private RadioButton assign;
private Switch switchLog;
private CheckBox cb_print;
private CheckBox cb_save;
private RecyclerView infoBtn;
private RecyclerView infoFragment;
private TextView tvConnectState;
@@ -220,7 +226,8 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
disconnect = findViewById(R.id.disconnect);
fixation = findViewById(R.id.fixation);
assign = findViewById(R.id.assign);
switchLog = findViewById(R.id.switch_log);
cb_print = findViewById(R.id.cb_print);
cb_save = findViewById(R.id.cb_save);
title = findViewById(R.id.title);
infoBtn = findViewById(R.id.info_btn);
infoFragment = findViewById(R.id.info_fragment);
@@ -271,18 +278,22 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
manager = getSupportFragmentManager();
transaction = manager.beginTransaction();
switchLog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
cb_print.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
AdasManager.getInstance().setEnableLog(true);
switchLog.setText("日志:开");
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
AdasManager.getInstance().setEnableLog(isChecked);
}
});
cb_save.setChecked(LogSave.getInstance().isLogSwitch());
cb_save.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
LogSave.getInstance().start();
} else {
AdasManager.getInstance().setEnableLog(false);
switchLog.setText("日志:关");
LogSave.getInstance().stop();
}
LogSave.getInstance().setIsLogSwitch(isChecked);
}
});
connectionType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@@ -291,7 +302,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
int type;
switch (checkedId) {
default:
case R.id.assign:
type = AdasOptions.IPC_CONNECTION_MODE.ASSIGN;
break;
@@ -537,29 +547,28 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
private void onUpdateConnectStateView() {
private String onUpdateConnectStateView() {
String status;
int color;
switch (connectStatus) {
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED:
case IPC_CONNECTION_STATUS.CONNECTED:
status = "已连接";
color = R.color.connect_status_connected;
break;
default:
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED:
case IPC_CONNECTION_STATUS.DISCONNECTED:
status = "未连接";
color = R.color.connect_status_disconnected;
break;
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTING:
case IPC_CONNECTION_STATUS.CONNECTING:
status = "连接中";
color = R.color.connect_status_connecting;
break;
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS:
case IPC_CONNECTION_STATUS.SEARCH_ADDRESS:
status = "搜索IP";
color = R.color.connect_status_search_address;
break;
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS:
case IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS:
status = "未找到";
color = R.color.connect_status_disconnecting;
break;
@@ -572,6 +581,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
tvConnectState.setTextColor(getResources().getColor(color));
}
});
return status;
}
@@ -588,6 +598,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onSSHResult(final SSHResult info) {
LogSave.getInstance().saveLog("接收", info.toString());
runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -599,47 +610,64 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onError(ProtocolStatus status, byte[] bytes) {
EventBus.getDefault().postSticky(new ErrorData(status, bytes));
ErrorData base = new ErrorData(status, bytes);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
EventBus.getDefault().postSticky(new Trajectory(header, trajectory));
Trajectory base = new Trajectory(header, trajectory);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
EventBus.getDefault().postSticky(new TrackedObjects(header, trackedObjects));
TrackedObjects base = new TrackedObjects(header, trackedObjects);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
EventBus.getDefault().postSticky(new GnssInfo(header, gnssInfo));
GnssInfo base = new GnssInfo(header, gnssInfo);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
EventBus.getDefault().postSticky(new VehicleState(header, vehicleState));
VehicleState base = new VehicleState(header, vehicleState);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
EventBus.getDefault().postSticky(new AutopilotState(header, autopilotState));
AutopilotState base = new AutopilotState(header, autopilotState);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
EventBus.getDefault().postSticky(new MogoReportMessage(header, mogoReportMessage));
MogoReportMessage base = new MogoReportMessage(header, mogoReportMessage);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) {
EventBus.getDefault().postSticky(new PerceptionTrafficLight(header, trafficLights));
PerceptionTrafficLight base = new PerceptionTrafficLight(header, trafficLights);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
LogSave.getInstance().saveLog("接收", info.toString());
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
runOnUiThread(new Runnable() {
@Override
@@ -652,33 +680,44 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
EventBus.getDefault().postSticky(new CarConfigResp(header, carConfigResp));
CarConfigResp base = new CarConfigResp(header, carConfigResp);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
RecordPanel base = new RecordPanel(header, recordPanel);
LogSave.getInstance().saveLog("接收", base.toString());
recordKey = recordPanel.getKey();
recordFileName = recordPanel.getFilename();
EventBus.getDefault().postSticky(new RecordPanel(header, recordPanel));
EventBus.getDefault().postSticky(base);
}
@Override
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
EventBus.getDefault().postSticky(new GlobalPathResp(header, globalPathResp));
GlobalPathResp base = new GlobalPathResp(header, globalPathResp);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
EventBus.getDefault().postSticky(new Warn(header, warn));
Warn base = new Warn(header, warn);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
EventBus.getDefault().postSticky(new ArrivalNotification(header, arrivalNotification));
ArrivalNotification base = new ArrivalNotification(header, arrivalNotification);
LogSave.getInstance().saveLog("接收", base.toString());
EventBus.getDefault().postSticky(base);
}
@Override
public void onUpgradeStateInfo(final IPCUpgradeStateInfo info) {
LogSave.getInstance().saveLog("接收", info.toString());
EventBus.getDefault().postSticky(info);
}
@@ -714,9 +753,9 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onClientStatusConnectChanged(int statusCode, String sign) {
if (statusCode == ConnectState.STATUS_CONNECT_SUCCESS) {
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED;
connectStatus = IPC_CONNECTION_STATUS.CONNECTED;
} else {
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED;
connectStatus = IPC_CONNECTION_STATUS.DISCONNECTED;
}
runOnUiThread(new Runnable() {
@Override
@@ -822,11 +861,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onConnectionIPCStatus(int ipcConnectionStatus, String failedMsg) {
connectStatus = ipcConnectionStatus;
onUpdateConnectStateView();
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED) {
String status = onUpdateConnectStateView();
status += "failedMsg=" + failedMsg;
LogSave.getInstance().saveLog("连接状态", status);
if (connectStatus == IPC_CONNECTION_STATUS.CONNECTED) {
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) {
} else if (connectStatus == IPC_CONNECTION_STATUS.DISCONNECTED) {
toastMsg("连接失败:" + failedMsg);
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectFailed");
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
@@ -889,8 +930,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onItemClick(int position, String data) {
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
// if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
// if (connectStatus != IPC_CONNECTION_STATUS.CONNECTED) {
// toastMsg("IPC 未连接");
// return;
// }

View File

@@ -4,6 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F5F5F5"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".ui.MainActivity">
<include
@@ -38,9 +40,9 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/info_btn"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight=".225" />
</LinearLayout>

View File

@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp"
android:background="@drawable/item_bg">
android:background="@drawable/item_bg"
android:gravity="center"
android:minHeight="50dp">
<TextView
android:id="@+id/tv_info_title"
@@ -14,6 +16,6 @@
android:gravity="center"
android:text="INFO"
android:textColor="@drawable/item_text_color"
android:textSize="16dp" />
android:textSize="16sp" />
</LinearLayout>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="4dp"
android:background="@drawable/item_bg"
android:gravity="center"
android:minWidth="150dp">
<TextView
android:id="@+id/tv_info_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:text="INFO"
android:textColor="@drawable/item_text_color"
android:textSize="16sp" />
</LinearLayout>

View File

@@ -56,145 +56,179 @@
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/tv_connect_state"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:gravity="right|center_vertical"
android:text="未连接"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<View
android:id="@+id/line2"
android:layout_width="1dp"
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/tv_connect_state"
android:background="#fff124" />
<Switch
android:id="@+id/switch_log"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/line2"
android:checked="true"
android:text="日志:开"
android:textColor="@color/colorWhile" />
android:layout_marginStart="20dp"
android:layout_toEndOf="@id/local_ip"
android:layoutDirection="rtl">
<View
android:id="@+id/line1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/switch_log"
android:background="#fff124" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/disconnect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_toStartOf="@+id/line1"
android:background="@drawable/btn_bg"
android:text="断开"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_toStartOf="@+id/disconnect"
android:background="@drawable/btn_bg"
android:text="连接"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/connect"
android:background="#fff124" />
<RadioGroup
android:id="@+id/connection_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/line"
android:orientation="horizontal">
<RadioButton
android:id="@+id/assign"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="指定"
android:textColor="#ffffff" />
<RadioButton
android:id="@+id/fixation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="固定"
android:textColor="#ffffff" />
</RadioGroup>
android:layout_height="match_parent">
<EditText
android:id="@+id/et_ip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="5dp"
android:layout_toStartOf="@+id/connection_type"
android:digits="0123456789.:"
android:gravity="right|center_vertical"
android:hint="IP地址"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:maxLength="21"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="@color/colorWhile"
android:textSize="16dp" />
<TextView
android:id="@+id/tv_connect_state"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:gravity="right|center_vertical"
android:text="未连接"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_ip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_toStartOf="@+id/et_ip"
android:gravity="right|center_vertical"
android:text="指定IP"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<View
android:id="@+id/line2"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/tv_connect_state"
android:background="#fff124" />
<LinearLayout
android:id="@+id/layout_cb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layoutDirection="ltr"
android:orientation="vertical">
<CheckBox
android:id="@+id/cb_print"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:checked="true"
android:text="打印"
android:textColor="#ffffff" />
<CheckBox
android:id="@+id/cb_save"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="存储"
android:textColor="#ffffff" />
</LinearLayout>
<TextView
android:id="@+id/log_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="日志:"
android:textColor="#ffffff" />
<View
android:id="@+id/line1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/log_hint"
android:background="#fff124" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/disconnect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="8dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="8dp"
android:background="@drawable/btn_bg"
android:text="断开"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/btn_bg"
android:text="连接"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
<View
android:id="@+id/line"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_toStartOf="@+id/connect"
android:background="#fff124" />
<RadioGroup
android:id="@+id/connection_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layoutDirection="ltr"
android:orientation="horizontal">
<RadioButton
android:id="@+id/assign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="指定"
android:textColor="#ffffff" />
<RadioButton
android:id="@+id/fixation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="固定"
android:textColor="#ffffff" />
</RadioGroup>
<EditText
android:id="@+id/et_ip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:digits="0123456789.:"
android:gravity="right|center_vertical"
android:hint="IP地址"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:layoutDirection="ltr"
android:maxLength="21"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="@color/colorWhile"
android:textSize="16dp" />
<TextView
android:id="@+id/tv_ip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="right|center_vertical"
android:text="指定IP"
android:textColor="@color/colorWhile"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>

View File

@@ -112,8 +112,8 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.21',
mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.12',
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.22',
mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.13',
adasHigh : 'com.zhidao.support.adas:high:1.2.1.2_bate25',
// google

View File

@@ -152,6 +152,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
//挂挡档位数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
}
}

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
@@ -20,7 +18,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
@@ -159,4 +156,22 @@ public class MoGoHandAdasMsgManager implements
}
}
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
@Override
public void onAutopilotSteeringData(float steering) {
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
}
}

View File

@@ -17,36 +17,44 @@ internal object MedialControlFacade : IMoGoMediaFacade {
}
override fun play(context: Context, audioSources: Int, isLoop: Boolean, channel: Int) {
val player = player.get()?.get() ?: MediaPlayer().also { player.set(WeakReference(it)) }
resetStatus(player)
val file = context.resources.openRawResourceFd(audioSources)
player.apply {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setAudioStreamType(channel)
} else {
setAudioAttributes(AudioAttributes.Builder().setLegacyStreamType(channel).build())
}
setDataSource(file.fileDescriptor, file.startOffset, file.length)
file.close()
isLooping = isLoop
prepareAsync()
setOnPreparedListener { player ->
log(ChatConsts.TAG,"real play 准备播放音频====")
player.start()
}
setOnCompletionListener { player ->
log(ChatConsts.TAG,"播放完成====")
player.reset()
try {
val player = player.get()?.get() ?: MediaPlayer().also { player.set(WeakReference(it)) }
resetStatus(player)
val file = context.resources.openRawResourceFd(audioSources)
player.apply {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setAudioStreamType(channel)
} else {
setAudioAttributes(AudioAttributes.Builder().setLegacyStreamType(channel).build())
}
setDataSource(file.fileDescriptor, file.startOffset, file.length)
file.close()
isLooping = isLoop
prepareAsync()
setOnPreparedListener { player ->
log(ChatConsts.TAG,"real play 准备播放音频====")
player.start()
}
setOnCompletionListener { player ->
log(ChatConsts.TAG,"播放完成====")
player.reset()
}
}
} catch (t: Throwable) {
log(ChatConsts.TAG, "播放铃声异常:$t")
}
}
override fun release() {
val player = this.player.get()?.get() ?: return
log(ChatConsts.TAG,"release 释放音频播放====")
player.run {
resetStatus(this)
release()
try {
val player = this.player.get()?.get() ?: return
log(ChatConsts.TAG,"release 释放音频播放====")
player.run {
resetStatus(this)
release()
}
} catch (t: Throwable) {
log(ChatConsts.TAG, "释放MediaPlay异常: $t")
}
}

View File

@@ -69,6 +69,10 @@ internal class CallChatWindowManager {
private var hasHangUpped = false
private var isInComingShow = false
private var isCallingShow = false
@OptIn(ExperimentalCoroutinesApi::class)
private var interrupt = Channel<Boolean>(RENDEZVOUS)
@Synchronized
@@ -141,10 +145,14 @@ internal class CallChatWindowManager {
var refuse = incomingView.findViewById<View>(R.id.module_carchatting_incoming_hangUp)
val dismissJob = AtomicReference<Job>()
var timer: Job? = null
var ring: Job? = null
var ring: Job?
launch {
speak(REQUEST_CLOUD_VOICE_CALL)
calling()
try {
speak(REQUEST_CLOUD_VOICE_CALL)
calling()
} catch (t: Throwable) {
log(TAG, "来电呼叫异常:$t")
}
}.also { ring = it }
answer.onClick {
timer = resetInComingTimer(timer, user, incomingView)
@@ -160,10 +168,11 @@ internal class CallChatWindowManager {
ToastUtils.showShort("正在处理, 请稍候...")
return@onClick
}
doRefuse(user)
doRefuse(user, inComingView = incomingView, isAnswerFail = false)
}
incomingView.observe(arrayOf(ON_CREATE, ON_DESTROY)) { itx ->
if (itx == ON_CREATE) {
isInComingShow = true
timer = inComingTimer(user, incomingView)
launch(Dispatchers.Main) {
val d1 = async {
@@ -201,6 +210,7 @@ internal class CallChatWindowManager {
}.also { dismissJob.set(it) }
}
if (itx == ON_DESTROY) {
isInComingShow = false
ring?.safeCancel()
timer?.safeCancel()
hasAnswered = false
@@ -263,7 +273,7 @@ internal class CallChatWindowManager {
log(TAG, "延迟30s消失计时开始...")
delay(DEFAULT_MAX_DIALING_TIME)
log(TAG, "延迟30s消失计时结束...")
doRefuse(user, false)
doRefuse(user, false, incomingView, false)
hide(incomingView)
releaseAudioAndVoice()
}
@@ -300,9 +310,10 @@ internal class CallChatWindowManager {
}
doHangUp(user, callingView)
}
callingView.observe(arrayOf(ON_CREATE, ON_DESTROY)) {
callingView.observe(arrayOf(ON_CREATE, ON_DESTROY)) { itx ->
var job: Job? = null
if (it == ON_CREATE) {
if (itx == ON_CREATE) {
isCallingShow = true
launch(Dispatchers.Main) {
val d1 = async {
log(ChatConsts.TAG, "等着新用户进来...")
@@ -344,7 +355,8 @@ internal class CallChatWindowManager {
facade.audioFocus().releaseAudioFocus()
}.also { job = it }
}
if (it == ON_DESTROY) {
if (itx == ON_DESTROY) {
isCallingShow = false
job?.safeCancel()
callerEnter.safeCancel()
exitRoom.safeCancel()
@@ -407,23 +419,29 @@ internal class CallChatWindowManager {
}
private fun onNewUserEnterRoom() {
if (!isCallingShow) {
return
}
scope.launch {
callerEnter.send(true)
}
}
private fun onCallInterrupt() {
if (!isInComingShow) {
return
}
scope.launch {
interrupt.send(true)
}
}
private fun doAnswer(user: UserInfo, incommingView: View) {
private fun doAnswer(user: UserInfo, inComingView: View) {
answer(
user,
onEnter = {
releaseAudioAndVoice()
hide(incommingView)
hide(inComingView)
showCallingView(user)
},
onNewEnter = {
@@ -442,9 +460,9 @@ internal class CallChatWindowManager {
ToastUtils.showShort("应答失败")
}
}
doRefuse(user, false)
doRefuse(user, false, inComingView, true)
releaseAudioAndVoice()
hide(incommingView)
hide(inComingView)
facade.audioFocus().releaseAudioFocus()
}
)
@@ -489,7 +507,7 @@ internal class CallChatWindowManager {
}
}
private fun doRefuse(user: UserInfo, notify: Boolean = true) {
private fun doRefuse(user: UserInfo, notify: Boolean = true, inComingView: View, isAnswerFail: Boolean) {
refuse(user,
onSuccess = {
if (notify) {
@@ -499,7 +517,14 @@ internal class CallChatWindowManager {
},
onError = { code, msg, extra ->
log(TAG, "-- 拒绝失败 --: code:: $code; msg:: $msg; extra:: $extra")
ToastUtils.showShort("拒绝异常")
if (isAnswerFail) {
ToastUtils.showShort("应答异常")
} else {
ToastUtils.showShort("拒绝异常")
}
releaseAudioAndVoice()
hide(inComingView)
facade.audioFocus().releaseAudioFocus()
})
}
@@ -543,12 +568,18 @@ internal class CallChatWindowManager {
}
private fun exitRoom() {
if (!isCallingShow) {
return
}
scope.launch {
exitRoom.send(true)
}
}
private fun onRefuseOK() {
if (!isInComingShow) {
return
}
scope.launch {
refused.send(true)
}

View File

@@ -12,6 +12,7 @@ import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import chassis.Chassis
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
@@ -77,7 +78,8 @@ class DebugSettingView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener,
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener {
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener
,IMoGoAutopilotVehicleStateListener{
private val TAG = "DebugSettingView"
@@ -170,6 +172,8 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotPlanningListenerManager.addListener(TAG, this)
// 添加 工控机基础信息回调 监听
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
//添加 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.addListener(TAG,this)
if (logInfoView != null) {
logInfoView!!.onEnterForeground()
}
@@ -191,6 +195,11 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
// 移除 规划路径相关回调 监听
CallerAutopilotPlanningListenerManager.removeListener(TAG)
// 移除 工控机基础信息回调 监听
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
//移除 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
if (logInfoView != null) {
logInfoView!!.onEnterBackground()
}
@@ -318,6 +327,21 @@ class DebugSettingView @JvmOverloads constructor(
}
}
/**
* 车辆状态控制中心
*/
tbVehicleStateController.setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示车辆状态中心
vehicleStateLayout.visibility = View.VISIBLE
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏车辆状态中心
vehicleStateLayout.visibility = View.GONE
}
}
/**
* HMI控制中心
*/
@@ -1615,6 +1639,38 @@ class DebugSettingView @JvmOverloads constructor(
tvObuDelay.text = "obu时延" + delayTime.toString()
}
/**
* 车辆转向灯 数据
* @param lightSwitch
*/
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
}
/**
* 车辆刹车灯 数据
* @param brakeLight
*/
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
}
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
override fun onAutopilotSteeringData(steering: Float) {
tvSteeringInfo.text = "方向盘转向角:${steering}"
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
override fun onAutopilotGearData(gear: Chassis.GearPosition) {
tvGearInfo.text = "挂挡档位:${gear}"
}
/**
* 吐司提示
*/

View File

@@ -843,6 +843,53 @@
app:layout_constraintTop_toBottomOf="@id/obuDivider2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ToggleButton
android:id="@+id/tbVehicleStateController"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/setting_toggle_button_background"
android:drawableEnd="@drawable/icon_right"
android:padding="@dimen/dp_20"
android:textOff="车辆状态"
android:textOn="车辆状态"
/>
<LinearLayout
android:id="@+id/vehicleStateLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tvSteeringInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="方向盘转向角:"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<TextView
android:id="@+id/tvGearInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="挂挡档位:"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
</LinearLayout>
<ToggleButton
android:id="@+id/tbHmiController"
android:layout_width="match_parent"

View File

@@ -4,6 +4,8 @@ import android.content.Context
import android.telecom.Call
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
@@ -52,6 +54,8 @@ class MogoPrivateObuManager private constructor() {
.navigation(context) as IMogoServiceApis
mContext = context
connectObu(context, ipAddress)
//控制日志输出
MogoObuManager.getInstance().init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString())
MogoObuManager.getInstance().registerListener(mogoObuListener)
}

View File

@@ -19,4 +19,16 @@ interface IMoGoAutopilotVehicleStateListener {
*/
fun onAutopilotBrakeLightData(brakeLight: Boolean)
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
fun onAutopilotSteeringData(steering: Float)
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun onAutopilotGearData(gear: Chassis.GearPosition)
}

View File

@@ -77,5 +77,29 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
}
}
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
@Synchronized
fun invokeAutopilotSteeringData(steering: Float){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotSteeringData(steering)
}
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
@Synchronized
fun invokeAutopilotGearData(gear: Chassis.GearPosition){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotGearData(gear)
}
}
}

View File

@@ -438,10 +438,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.CONNECTED;
ipcConnectedIp = ipAddress;
ipcConnectedPort = port;
sendCarConfigReq();
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, null);
}
sendCarConfigReq();
}
@Override