Merge branch 'dev_robotaxi-d-app-module_270_220510_2.7.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_270_220510_2.7.0

 Conflicts:
	core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt
This commit is contained in:
xinfengkun
2022-05-17 19:07:03 +08:00
123 changed files with 3112 additions and 811 deletions

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_MULTI_CONNECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
@@ -42,6 +43,7 @@ import com.mogo.telematic.server.netty.NettyTcpServer
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.AdasOptions
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
import com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_CONNECT_STATUS
import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS
import com.zhidao.support.adas.high.common.CupidLogUtils
@@ -100,10 +102,7 @@ class MoGoAutopilotProvider :
platNumberArray.size, platNumberArray
), channel
) {
CallerLogger.d(
"$M_ADAS_IMPL$TAG",
"司机端发送车牌号到乘客端是否成功:${it.isSuccess}"
)
invokeNettyConnResult("司机屏发送车牌号到乘客屏是否成功:${it.isSuccess}")
}
} else {
CallerAutoPilotManager.getCarConfig()
@@ -117,10 +116,12 @@ class MoGoAutopilotProvider :
override fun onStartServer() {
ToastUtils.showShort("司机端服务启动成功!")
invokeNettyConnResult("司机端服务启动成功!")
}
override fun onStopServer() {
ToastUtils.showLong("司机端服务停止!")
invokeNettyConnResult("司机端服务停止!")
}
override fun onChannelConnect(channel: Channel?) {
@@ -142,6 +143,10 @@ class MoGoAutopilotProvider :
override fun onChannelDisConnect(channel: Channel?) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "onChannelDisConnect")
}
override fun onReceiveClientSign(channel: Channel?, sn: String?) {
}
}, MoGoAiCloudClientConfig.getInstance().sn)
} else {
// 乘客端默认接收绘制全局路径+引导线
@@ -249,7 +254,7 @@ class MoGoAutopilotProvider :
}
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
if (AdasManager.getInstance().ipcConnectionStatus == IPC_CONNECTION_STATUS.CONNECTED) {
val invokeResult = AdasManager.getInstance().sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
invokeAutoPilotResult(if (invokeResult) "自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
@@ -285,9 +290,6 @@ class MoGoAutopilotProvider :
)
}
override fun sendMessageToAutopilot(jsonString: String) {
}
override fun cancelAutoPilot() {
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
@@ -472,50 +474,51 @@ class MoGoAutopilotProvider :
}
private fun handleMsgFromServer(msg: MogoProtocolMsg?, channel: Channel) {
try {
msg?.let {
when (it.protocolType) {
NORMAL_DATA -> AdasManager.getInstance().decoderRaw(it.body)
SYNC_MODE_STATUS -> {
FunctionBuildConfig.isDemoMode = when (it.body[0].toInt()) {
1 -> true
else -> false
}
setDemoMode(FunctionBuildConfig.isDemoMode)
}
REQ_CAR_NUMBER -> {
AppConfigInfo.plateNumber = String(msg.body)
}
else -> {
msg?.let {
when (it.protocolType) {
NORMAL_DATA -> {
try {
AdasManager.getInstance().decoderRaw(it.body)
} catch (e: Exception) {
e.printStackTrace()
CallerLogger.e("$M_ADAS_IMPL$TAG", "乘客屏解析数据过程中出现异常:${e.message}")
}
}
SYNC_MODE_STATUS -> {
FunctionBuildConfig.isDemoMode = when (it.body[0].toInt()) {
1 -> true
else -> false
}
setDemoMode(FunctionBuildConfig.isDemoMode)
}
REQ_CAR_NUMBER -> {
AppConfigInfo.plateNumber = String(msg.body)
invokeNettyConnResult("司机屏发送给乘客屏车牌号为:${AppConfigInfo.plateNumber}")
}
else -> {
}
}
} catch (e: Exception) {
e.printStackTrace()
CallerLogger.e("$M_ADAS_IMPL$TAG", "乘客屏解析数据流程中出现异常:${e.message}")
}
}
private fun handleConnStatusWithServer(statusCode: Int, sign: String?) {
when (statusCode) {
ConnectState.STATUS_CONNECT_SUCCESS -> {
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
ToastUtils.showShort("连接司机屏成功!")
invokeNettyConnResult("乘客屏连接司机屏成功司机屏SN为$sign")
// 连接成功后,乘客屏没拿到车牌号就像司机屏请求
if (AppConfigInfo.plateNumber.isNullOrEmpty()) {
var byteArray = byteArrayOf(0)
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
MogoProtocolMsg(REQ_CAR_NUMBER, byteArray.size, byteArray)
) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "请求车牌号数据发送是否成功:${it}")
invokeNettyConnResult("乘客屏请求车牌号数据发送是否成功:${it}")
}
}
}
else -> {
ToastUtils.showLong("和司机端连接异常!")
CallerLogger.d(
"$M_ADAS_IMPL$TAG",
"client statusCode is:${statusCode}"
)
invokeNettyConnResult("乘客屏和司机屏连接异常,状态码为:$statusCode")
}
}
}
@@ -523,5 +526,18 @@ class MoGoAutopilotProvider :
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
// 乘客屏才监听
AppConfigInfo.plateNumber = carConfigResp.plateNumber
invokeNettyConnResult("乘客屏车牌号:${carConfigResp.plateNumber}")
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_MULTI_CONNECT,
paramIndexes = [0],
clientPkFileName = "sn"
)
private fun invokeNettyConnResult(status: String) {
CallerLogger.d("$M_ADAS_IMPL$TAG", status)
}
}

View File

@@ -8,6 +8,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_C
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAFFIC_LIGHT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
@@ -15,6 +16,8 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_C
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_GNSSINFO
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_TRAFFIC_LIGHT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
@@ -25,6 +28,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
@@ -110,7 +114,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
//自车定位信息
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT,
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_GNSSINFO,
linkCode = CHAIN_LINK_ADAS,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
@@ -220,11 +224,23 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
//感知红绿灯
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_TRAFFIC_LIGHT,
linkCode = CHAIN_LINK_ADAS,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAFFIC_LIGHT,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
override fun onPerceptionTrafficLight(
header: MessagePad.Header?,
trafficLights: TrafficLightOuterClass.TrafficLights?
) {
if(trafficLights != null){
CallerAutopilotIdentifyListenerManager.invokeAutopilotPerceptionTrafficLight(
trafficLights
)
}
}
override fun onPredictionObstacleTrajectory(
@@ -326,14 +342,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
// override fun onSSHResult(info: com.zhidao.adas.client.ssh.SSHResult?) {
// if (info != null && "docker restart autocar_default_1" == info.cmd) {
// showDockerRebootResult(info.code, info.msg)
// } else {
// CallerLogger.w("$M_ADAS_IMPL$TAG", "onSSHResult : result info is null")
// }
// }
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
}

View File

@@ -75,6 +75,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
}
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus = ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe=reason
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
}

View File

@@ -1,7 +1,6 @@
package com.mogo.eagle.core.function.bindingcar;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -10,6 +9,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingcarProvider;
import com.mogo.eagle.core.function.bindingcar.network.BindingcarNetWorkManager;
import com.mogo.eagle.core.function.ipcupgrade.IPCUpgradeManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import org.jetbrains.annotations.NotNull;
@@ -34,12 +34,13 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
@Override
public void onDestroy() {
IPCUpgradeManager.Companion.getINSTANCE().destroy();
}
@Override
public void init(Context context) {
mContext = context;
IPCUpgradeManager.Companion.getINSTANCE().initServer(context);
}
/**
@@ -50,18 +51,14 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
@Override
public void getBindingcarInfo(String macAddress) {
mAddress = macAddress;
if (HmiBuildConfig.isShowSnBindingView) {
if (getScreenType() == 1) {
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
}
if (HmiBuildConfig.isShowSnBindingView) { //TODO 需要验证
// BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
}
}
@Override
public void modifyCarInfo(BindingcarCallBack callBack) {
if (getScreenType() == 1) {
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
}
// BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
}
@@ -71,9 +68,9 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
screenType = 1; //司机屏
}
// if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
// screenType = 2; //乘客屏
// }
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
screenType = 2; //乘客屏
}
return screenType;
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.CarInfo;
@@ -14,6 +15,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.utils.GsonUtil;
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.DeviceIdUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.module.common.constants.HostConst;
@@ -37,7 +39,7 @@ public class BindingcarNetWorkManager {
private static final String TAG = "BindingcarNetWorkManager";
private BindingcarNetWorkManager() {
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST)
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST_TEST)
.create(BindingcarApiService.class);
}
@@ -54,12 +56,17 @@ public class BindingcarNetWorkManager {
/**
* 获取绑定的车辆信息
* 获取绑定的车辆信息 TODO
*
* @param macAddress mac地址
*/
public void getBindingcarInfo(Context context, String macAddress, int screenType) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
// String macAddress = "48:b0:2d:3a:bc:7";
// String sn = "X20202203105S688HZ";
// int screenType = 1;
Log.d("liyz", "getBindingcarInfo --- sn = " + sn + "--macAddress = " +macAddress + "--screenType = " + screenType);
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mBindingcarApiService.getBindingcarInfo(token, requestBody)
@@ -75,13 +82,13 @@ public class BindingcarNetWorkManager {
if (info != null && info.getData() != null) {
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
Log.d("liyz", "getBindingcarInfo onNext info.getData() =" + info.getData().toString() + "--compare = " + info.getData().getCompare());
if (info.getData().getCompare() == 0) {
if (info.getData().getCompare().equals(0)) {
CallerHmiManager.INSTANCE.showBindingcarDialog();
} else if (info.getData().getCompare() == 3) {
} else if (info.getData().getCompare().equals(3)) {
CallerHmiManager.INSTANCE.showModifyBindingcarDialog();
}
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.data));
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.getData()));
}
}
@@ -93,6 +100,7 @@ public class BindingcarNetWorkManager {
@Override
public void onComplete() {
Log.d("liyz", "getBindingcarInfo onComplete -------- ");
}
});
@@ -103,7 +111,9 @@ public class BindingcarNetWorkManager {
* mac: 48:b0:2d:3a:9c:19
*/
public void modifyBindingcar(String macAddress, BindingcarCallBack callBack, int screenType) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
Log.d("liyz", "modifyBindingcar --- sn = " + sn + "---macAddress = " + macAddress);
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
@@ -120,6 +130,8 @@ public class BindingcarNetWorkManager {
callBack.callBackResult(info);
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
Log.d("liyz", "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
} else {
Log.e("liyz", "modifyBindingcar info == null");
}
}

View File

@@ -0,0 +1,64 @@
package com.mogo.eagle.core.function.ipcupgrade
import android.content.Context
import android.util.Log
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
/**
* @author XuXinChao
* @description 工控机镜像版本升级管理
* @since: 2022/5/12
*/
class IPCUpgradeManager: IMogoOnMessageListener<IPCUpgradeStateInfo> ,
IMoGoAutopilotStatusListener {
companion object{
const val TAG ="IPCUpgradeManager"
const val IPC_UPGRADE_MSG_TYPE = 50000
val INSTANCE: IPCUpgradeManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
IPCUpgradeManager()
}
}
private var mContext: Context? = null
fun initServer(context: Context){
mContext = context
//添加长链接监听
MogoAiCloudSocketManager.getInstance(context)
.registerOnMessageListener(IPC_UPGRADE_MSG_TYPE, this)
// 添加 ADAS状态 监听
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
override fun target(): Class<IPCUpgradeStateInfo> {
return IPCUpgradeStateInfo::class.java
}
override fun onMsgReceived(obj: IPCUpgradeStateInfo?) {
}
/**
* 自动驾驶状态信息
* @param autoPilotStatusInfo 状态信息
*/
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
}
fun destroy(){
//注销长链接监听
MogoAiCloudSocketManager.getInstance(mContext)
.unregisterLifecycleListener(IPC_UPGRADE_MSG_TYPE)
// 移除 ADAS状态 监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
mContext = null
}
}

View File

@@ -11,6 +11,7 @@ import com.mogo.eagle.core.function.check.net.CheckNetWork.checkNetWork
import com.mogo.eagle.core.function.check.net.CheckResultData
import com.mogo.eagle.core.function.check.view.CheckActivity
import com.mogo.eagle.core.function.check.view.CheckDialog
import com.mogo.eagle.core.function.report.IPCReportManager
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.statusmanager.IMogoStatusChangedListener
@@ -31,6 +32,10 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
private val mListeners: ConcurrentHashMap<String, IMogoCheckListener> = ConcurrentHashMap()
private var hasTipShow = false //是否已经弹框提示
var dialog: CheckDialog? = null
override val functionName: String
get() = "VehicleMonitoringManager"
override fun init(context: Context) {
mContext = context
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
@@ -38,6 +43,8 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
StatusDescriptor.MAIN_PAGE_RESUME,
this
)
//开启工控机监控节点上报服务
IPCReportManager.INSTANCE.initServer()
}
override fun registerVehicleMonitoringListener(module: String, listener: IMogoCheckListener) {
@@ -113,4 +120,10 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
}
}
}
override fun onDestroy() {
//停止工控机监控节点上报服务
IPCReportManager.INSTANCE.destroy()
}
}

View File

@@ -0,0 +1,58 @@
package com.mogo.eagle.core.function.report
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import mogo_msg.MogoReportMsg
/**
* @author XuXinChao
* @description 工控机监控节点信息上报管理
* @since: 2022/5/12
*/
class IPCReportManager : IMoGoAutopilotStatusListener {
private var ipcReportList = arrayListOf<ReportEntity>()
companion object{
const val TAG ="IPCReportManager"
val INSTANCE: IPCReportManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
IPCReportManager()
}
}
fun initServer(){
// 添加 ADAS状态 监听
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
/**
*工控机监控节点上报
*/
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
guardianInfo?.let{
if(it.level=="error"){
if(ipcReportList.size>20){
ipcReportList.removeLast()
}
ipcReportList.add(0,
ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()),
it.src,it.level,it.msg,it.code,it.resultList,it.actionsList))
//当前不处于美化模式时,展示监控节点上报
if(!FunctionBuildConfig.isDemoMode){
CallerHmiManager.showIPCReportWindow(ipcReportList)
}
}
}
}
fun destroy(){
// 移除 ADAS状态 监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}

View File

@@ -24,5 +24,10 @@ class MogoLogCatchConst {
* 本应用设置,关闭日志
*/
const val LOCAL_CONFIG_CLOSE_LOG = 4
/**
* 上传本地缓存链路日志
*/
const val CACHE_TRACE_UPLOAD = 5
}
}

View File

@@ -27,6 +27,7 @@ import com.zhidao.loglib.bean.RemoteLogPushContent
import com.zhidao.loglib.call.LogInfoManagerFactory
import com.zhidao.loglib.core.ILogListener
import com.zhidao.loglib.core.LogInfoManager
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.CACHE_TRACE_UPLOAD
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOCAL_CONFIG_CLOSE_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOCAL_CONFIG_OPEN_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOG_PUSH_TYPE
@@ -103,6 +104,10 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
TipToast.longTip("云端下发关闭日志开关")
closeLoggerLevel()
}
CACHE_TRACE_UPLOAD -> {
TipToast.longTip("上传本地缓存链路日志")
}
else -> {
}
}
@@ -233,7 +238,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
val file = File(filePath)
if (file.isFile) {
CallerLogger.d("$M_DEVA$TAG", "uploadFile path : $filePath")
// LogInfoManagerFactory.handleSingleUploadFile(filePath)
LogInfoManagerFactory.handleSingleUploadFile(filePath)
}else{
CallerLogger.d("$M_DEVA$TAG", "file absPath : ${file.absolutePath}")
}

View File

@@ -4,7 +4,10 @@ import android.content.Context
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.eagle.core.utilcode.util.Utils
@@ -33,20 +36,26 @@ class TraceManager {
// Trace过程中进行日志抓取对日志进行配置
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS] =
FwBuild(true, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_INIT)
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_INIT)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_GNSSINFO] =
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_GNSS)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT] =
FwBuild(true, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_AUTO)
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_AUTO)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED] =
FwBuild(false, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_DATA_TRACK)
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_DATA_TRACK)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY] =
FwBuild(false, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAJECTORY)
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAJECTORY)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE] =
FwBuild(false, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAFFIC_LIGHT] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS] =
ChainLogParam(true, "ADAS连接状态")
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_GNSSINFO] =
ChainLogParam(true, "ADAS自车定位")
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT] =
ChainLogParam(true, "ADAS自动驾驶链路(包含: 定位,自动驾驶状态,全局路径,到站提醒,节点状态,异常上报)")
ChainLogParam(true, "ADAS自动驾驶链路(包含: 自动驾驶状态交互,全局路径,到站提醒,节点状态,异常上报)")
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED] =
ChainLogParam(false, "ADAS感知物体")
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY] =
@@ -56,6 +65,14 @@ class TraceManager {
FileWriteManager.getInstance()
.init(context, MoGoAiCloudClientConfig.getInstance().sn, pkgName, fwBuildMap)
FileWriteManager.getInstance().registerListener { type ->
val param = traceInfoCache[type]
param?.let {
it.record = false
traceInfoCache[type] = it
}
CallerDevaToolsListenerManager.invokeDevaToolsFwThreadClose()
}
}
fun setTraceLogEnable(enable:Boolean){

View File

@@ -11,9 +11,9 @@ import android.view.WindowManager.LayoutParams
import android.view.animation.*
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
@@ -47,6 +47,7 @@ import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ReportListFloatWindow
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
@@ -62,6 +63,7 @@ import kotlinx.coroutines.*
import mogo_msg.MogoReportMsg
import record_cache.RecordPanelOuterClass
import java.util.*
import kotlin.collections.ArrayList
/**
@@ -112,6 +114,8 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
private var reportList = arrayListOf<ReportEntity>()
//工控机上报列表悬浮窗
private var reportListFloatWindow: ReportListFloatWindow?=null
private var ipcReportWindow: IPCReportWindow?=null
override fun vipIdentification(visible: Boolean) {
ThreadUtils.runOnUiThread {
@@ -210,13 +214,28 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
ToastUtils.showShort("重启成功")
} else {
//重启失败
msg?.let {
msg.let {
ToastUtils.showShort(it)
}
}
}
}
/**
* 展示工控机监控上报数据
* @param reportList 上报数据列表
*/
override fun showIPCReportWindow(reportList: ArrayList<ReportEntity>) {
ThreadUtils.runOnUiThread{
if(ipcReportWindow==null){
ipcReportWindow= activity?.let { IPCReportWindow(it) }
ipcReportWindow?.showFloatWindow()
AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice("")
}
ipcReportWindow?.refreshData(reportList)
}
}
/**
* 设置 V2X 通知 代理View
*/

View File

@@ -51,7 +51,8 @@ class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifec
*/
fun modifyBindingcar() {
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
if (it.code == 200) {
Log.e("liyz", "it.code == ${it.code}" )
if (it.code != 205) {
TipToast.shortTip("修改绑定成功")
} else {
TipToast.shortTip("修改绑定失败")

View File

@@ -50,7 +50,7 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
*/
fun toBindingcar() {
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
if (it.code == 200) {
if (it.code != 205) {
TipToast.shortTip("绑定成功")
} else {
TipToast.shortTip("绑定失败")

View File

@@ -2,6 +2,8 @@ package com.mogo.eagle.core.function.hmi.ui.setting
import android.annotation.SuppressLint
import android.app.Activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.os.Build
@@ -12,6 +14,7 @@ import android.view.View
import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getSystemService
import androidx.recyclerview.widget.LinearLayoutManager
import chassis.Chassis
import com.mogo.cloud.passport.MoGoAiCloudClient
@@ -48,8 +51,6 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog
import com.mogo.eagle.core.function.hmi.ui.upgrade.UpgradeListAdapter
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -83,8 +84,8 @@ class DebugSettingView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener,
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener
,IMoGoAutopilotVehicleStateListener{
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener,
IMoGoAutopilotVehicleStateListener {
private val TAG = "DebugSettingView"
@@ -94,7 +95,7 @@ class DebugSettingView @JvmOverloads constructor(
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
private var mGnssInfo: MessagePad.GnssInfo? = null
private var accelerationFloatWindow: AccelerationFloatWindow?=null
private var accelerationFloatWindow: AccelerationFloatWindow? = null
private var accelerationList = arrayListOf<AccelerationEntity>()
private var accelerationIsShow: Boolean = false //实时加速度面板是否展示
private var accelerationThresholdNum: Double = 0.0
@@ -114,19 +115,6 @@ class DebugSettingView @JvmOverloads constructor(
//日志过滤标签集合
private val sceneMap = mutableMapOf<String, SceneModule>()
private var dockerRebootDialog: DockerRebootDialog? = null //docker重启对话框
private var adUpgradeDialog: AdUpgradeDialog? = null //工控机升级对话框
private var upgradeMode: Int = -1 //升级模式
private var downloadStatus: Int = -1 //下载状态
private var currentProgress: Int = -1 //当前已下载包体大小
private var previousProgress: Int = -1 //前一秒的下载进度,用于计算下载剩余时间
private var totalProgress: Int = -1 //包体总大小
private var downloadVersion: String? = null //工控机docker版本
private var upgradeStatus: Int = -1 //升级状态
//ADAS连接状态
private var adasConnectStatus: Boolean = false
//OBU连接状态
private var obuConnectStatus: Boolean = false
@@ -134,9 +122,9 @@ class DebugSettingView @JvmOverloads constructor(
private var onlineSelected: Boolean = true
private var qaSelected: Boolean = true
private var upgradeListAdapter: UpgradeListAdapter?=null
private var upgradeListAdapter: UpgradeListAdapter? = null
private val upgradeVersionList by lazy{
private val upgradeVersionList by lazy {
ArrayList<UpgradeVersionEntity>()
}
@@ -148,6 +136,9 @@ class DebugSettingView @JvmOverloads constructor(
private var clickListener: ClickListener? = null
//剪切板
private var clipboardManager: ClipboardManager ?= null
init {
LayoutInflater.from(context).inflate(R.layout.view_debug_setting, this, true)
initView()
@@ -182,7 +173,7 @@ class DebugSettingView @JvmOverloads constructor(
// 添加 工控机基础信息回调 监听
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
//添加 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.addListener(TAG,this)
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
if (logInfoView != null) {
logInfoView!!.onEnterForeground()
}
@@ -280,23 +271,41 @@ class DebugSettingView @JvmOverloads constructor(
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示控制中心
controlCenterLayout.visibility = View.VISIBLE
// controlCenterLayout.visibility = View.VISIBLE
commonLayout.visibility = View.VISIBLE
swDevelopMode.visibility = View.VISIBLE
swDevelopMode.isChecked = false
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏控制中心
controlCenterLayout.visibility = View.GONE
commonLayout.visibility = View.GONE
swDevelopMode.visibility = View.GONE
}
}
/**
* 开发者模式
*/
swDevelopMode.setOnCheckedChangeListener { _, isChecked ->
if(isChecked){
controlCenterLayout.visibility = View.VISIBLE
commonLayout.visibility = View.GONE
}else{
controlCenterLayout.visibility = View.GONE
commonLayout.visibility = View.VISIBLE
}
}
/**
* 鹰眼参数配置
*/
tbEagleEyeController.setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示参数配置
eagleEyeControllerLayout.visibility = View.VISIBLE
}else{
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏参数配置
eagleEyeControllerLayout.visibility = View.GONE
@@ -326,19 +335,21 @@ class DebugSettingView @JvmOverloads constructor(
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示OBU控制中心
obuControllerLayout.visibility = View.VISIBLE
tbVehicleStateController.isChecked = true
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏OBU控制中心
obuControllerLayout.visibility = View.GONE
tbVehicleStateController.isChecked = false
}
}
/**
* 车辆状态控制中心
*/
tbVehicleStateController.setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示车辆状态中心
vehicleStateLayout.visibility = View.VISIBLE
@@ -398,7 +409,7 @@ class DebugSettingView @JvmOverloads constructor(
* 应用包管理中心
*/
btnApkCenter.setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示应用包管理中心
apkCenterLayout.visibility = View.VISIBLE
@@ -491,6 +502,7 @@ class DebugSettingView @JvmOverloads constructor(
//工控机配置信息
tvAutopilotInfo.text =
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
tvIpcInfo.text = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
// 绘制应用基本信息
drawAppInfo()
@@ -598,7 +610,7 @@ class DebugSettingView @JvmOverloads constructor(
}
//初始化切换自车按钮文本Bus版本默认显示切换自车为出租车
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
tbChangeCurrentCarIcon.isChecked = true
}
@@ -610,32 +622,66 @@ class DebugSettingView @JvmOverloads constructor(
clickListener?.showReportListWindow(isChecked)
}
//SN复制按钮
tvPadSnClip.setOnClickListener {
if(clipboardManager==null){
//获取剪贴板管理器:
clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
}
// 创建普通字符型ClipData ,将ClipData内容放到系统剪贴板里
clipboardManager?.setPrimaryClip(ClipData.newPlainText("MoGoSN",AppConfigInfo.mogoSN))
ToastUtils.showLong("SN复制成功")
}
//工控机镜像复制按钮
tvIpcVersionInfoClip.setOnClickListener{
if(clipboardManager==null){
//获取剪贴板管理器:
clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
}
// 创建普通字符型ClipData ,将ClipData内容放到系统剪贴板里
clipboardManager?.setPrimaryClip(ClipData.newPlainText("DockVersion",mAutoPilotStatusInfo?.dockVersion))
ToastUtils.showLong("docker版本复制成功")
}
//经纬度复制按钮
tvCarInfoCopyClip.setOnClickListener{
if(clipboardManager==null){
//获取剪贴板管理器:
clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
}
// 创建普通字符型ClipData ,将ClipData内容放到系统剪贴板里
clipboardManager?.setPrimaryClip(ClipData.newPlainText("LonAndLat","${mGnssInfo?.longitude},${mGnssInfo?.latitude}"))
ToastUtils.showLong("经纬度复制成功")
}
}
/**
* 设置鹰眼本地参数配置监听
*/
private fun setEagleEyeConfigListener(){
private fun setEagleEyeConfigListener() {
//初始化刹车加速度阈值信息
val brakeThreshold = SharedPrefsMgr.getInstance(context)
.getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,-2.5F)
.getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F)
etInputBrakeThreshold.setText(brakeThreshold.toString())
etInputBrakeThreshold.text?.let { etInputBrakeThreshold.setSelection(brakeThreshold.toString().length) }
//设置刹车加速度阈值信息
btnBrakeThreshold.setOnClickListener {
val thresholdStr = etInputBrakeThreshold.text.toString()
if(thresholdStr.isEmpty()){
if (thresholdStr.isEmpty()) {
ToastUtils.showShort("请输入正确的判定刹车加速度阈值")
}else{
try{
} else {
try {
val thresholdStrFloat = thresholdStr.toFloat()
if(thresholdStrFloat<0){
SharedPrefsMgr.getInstance(context).putFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,thresholdStrFloat)
if (thresholdStrFloat < 0) {
SharedPrefsMgr.getInstance(context)
.putFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, thresholdStrFloat)
ToastUtils.showShort("刹车阈值设置成功")
}else{
} else {
ToastUtils.showShort("刹车阈值加速度值应小于0")
}
}catch (e: Exception){
} catch (e: Exception) {
ToastUtils.showShort("判定刹车加速度阈值格式设置不正确")
}
}
@@ -677,41 +723,6 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutoPilotManager.disconnectIpc()
}
updateSpeedSettingViews()
/**
* 设置最大速度
*/
btnSetAutopilotSpeed.onClick {
if (AppConfigInfo.isConnectAutopilot) {
val speedStr = etInputSpeed.text?.toString()
try {
if (speedStr.isNullOrEmpty()) {
ToastUtils.showShort("请输入最大车速")
}
val speed = speedStr?.toInt()
if (speed != null && speed > 0 && speed < 60) {
// 设置自动驾驶速度
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed)
when {
isSuccess -> {
ToastUtils.showShort("车速设置成功,立即生效")
}
else -> {
ToastUtils.showShort("设置车速失败,请启动域控制器")
}
}
} else {
ToastUtils.showShort("最大车速应大于0且小于60")
}
} catch (e: Exception) {
ToastUtils.showShort("车速设置失败,请正确设置车速")
}
} else {
ToastUtils.showShort("设置车速失败,请启动域控制器")
}
}
/**
* 录制Bag包
*/
@@ -731,152 +742,24 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutoPilotManager.recordPackage()
}
}
/**
* 工控机升级
*/
btnSystemUpgrade.onClick {
if (AppConfigInfo.isConnectAutopilot) {
Logger.i(
TAG,
"upgradeMode=" + upgradeMode + " downloadStatus=" + downloadStatus + " upgradeStatus=" + upgradeStatus
)
if (AdUpgradeStateHelper.isDownloading(downloadStatus)) {
//点击Toast提示下载剩余时间
ToastUtils.showShort(
"预计" + AdUpgradeStateHelper.getRemainingTime(
totalProgress,
previousProgress,
currentProgress
) + "下载完成"
)
} else if (AdUpgradeStateHelper.getUpgradeStatus()) {
//工控机状态为“升级中”
ToastUtils.showShort("新版本升级中预计5分钟升级完成")
} else if (AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)) {
//如果升级失败则Toast提示升级失败请联系运维人员
ToastUtils.showShort("升级失败,请联系运维人员")
} else if (AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish(
downloadStatus,
upgradeStatus
)
) {
//如果升级模式为“提示升级”,并且下载状态为已经下载完成,点击弹出升级确认弹窗
if (adUpgradeDialog == null) {
adUpgradeDialog = AdUpgradeDialog(context)
adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener {
override fun confirm() {
if (mAutoPilotStatusInfo?.state == 2) {
//当前处于自动驾驶状态不可进行升级Toast提示
ToastUtils.showShort("升级前请先退出自动驾驶模式")
} else {
//确认升级
Logger.i(TAG, "upgrade confirm")
//设置当前状态为“升级中”
AdUpgradeStateHelper.setUpgradeStatus(true)
CallerAutoPilotManager.setIPCUpgradeAffirm()
}
}
override fun cancel() {
//取消升级
Logger.i(TAG, "upgrade cancel")
//取消升级命令不下发
// CallerAutoPilotManager.setIPCUpgradeCancel()
}
})
}
adUpgradeDialog?.showUpgradeDialog()
btnRecordBag.onClick {
val recordTimeStr = etInputRecordBagTime.text?.toString()
try {
if (recordTimeStr.isNullOrEmpty()) {
CallerAutoPilotManager.recordPackage()
}
val recordTime = recordTimeStr?.toInt()
if (recordTime != null && recordTime > 0) {
CallerAutoPilotManager.recordPackage(recordTime)
} else {
ToastUtils.showShort("当前工控机处于最新版本状态,不可升级")
CallerAutoPilotManager.recordPackage()
}
} else {
ToastUtils.showShort("域控制器未连接")
}
}
/**
* 重启系统
*/
btnSystemRestart.onClick {
if (AppConfigInfo.isConnectAutopilot) {
if (dockerRebootDialog == null) {
dockerRebootDialog = DockerRebootDialog(context)
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener {
override fun confirm() {
if (mAutoPilotStatusInfo?.state == 2) {
//当前处于自动驾驶状态不可进行重启Toast提示
ToastUtils.showShort("请先退出自动驾驶状态")
} else if (AdUpgradeStateHelper.showCannotReboot(
downloadStatus,
upgradeStatus
)
) {
//当工控机处于下载或者升级状态,需要先进行升级
ToastUtils.showShort("请先完成新自动驾驶系统的下载/升级")
} else {
//确认重启
Logger.i(TAG, "reboot confirm")
CallerAutoPilotManager.setIPCReboot()
}
}
override fun cancel() {
//取消重启
Logger.i(TAG, "reboot cancel")
}
})
}
dockerRebootDialog?.showUpgradeDialog()
} else {
ToastUtils.showShort("域控制器未连接")
}
}
}
/**
* Bus不可设置自动驾驶速度而Taxi可以
*/
private fun updateSpeedSettingViews() {
when {
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) -> {
btnSetAutopilotSpeed.visibility = View.GONE
llSpeedLayout.visibility = View.GONE
}
else -> {
btnSetAutopilotSpeed.visibility = View.VISIBLE
llSpeedLayout.visibility = View.VISIBLE
} catch (e: Exception) {
CallerAutoPilotManager.recordPackage()
}
}
}
/**
* 设置工控机下载、升级状态信息
* @param upgradeMode 升级模式(提示升级、静默升级)
* @param downloadStatus 下载状态
* @param currentProgress 当前已经下载包体大小
* @param totalProgress 下载包体总大小
* @param downloadVersion 下载版本
* @param upgradeStatus 升级状态
*/
fun setAdUpgradeInfo(
upgradeMode: Int, downloadStatus: Int, currentProgress: Int, totalProgress: Int,
downloadVersion: String, upgradeStatus: Int
) {
this.upgradeMode = upgradeMode
this.downloadStatus = downloadStatus
this.previousProgress = this.currentProgress
this.currentProgress = currentProgress
this.totalProgress = totalProgress
this.downloadVersion = downloadVersion
this.upgradeStatus = upgradeStatus
}
/**
@@ -976,13 +859,13 @@ class DebugSettingView @JvmOverloads constructor(
* 实时加速度面板控制
*/
tbOpenAcceleration.setOnCheckedChangeListener { _, isChecked ->
if(isChecked){
if (isChecked) {
//打开实时加速度面板
accelerationFloatWindow = context?.let { AccelerationFloatWindow(it as Activity) }
accelerationFloatWindow?.showFloatWindow()
etThreshold.visibility = View.VISIBLE
btnThresholdDefine.visibility = View.VISIBLE
}else{
} else {
//关闭实时加速度面板
accelerationFloatWindow?.hideFloatWindow()
etThreshold.visibility = View.GONE
@@ -992,9 +875,9 @@ class DebugSettingView @JvmOverloads constructor(
}
btnThresholdDefine.setOnClickListener {
try{
try {
accelerationThresholdNum = etThreshold.text.toString().toDouble()
}catch(e:java.lang.Exception){
} catch (e: java.lang.Exception) {
ToastUtils.showShort("请输入正确的阈值")
}
}
@@ -1198,6 +1081,10 @@ class DebugSettingView @JvmOverloads constructor(
}
}
override fun fwThreadClose() {
refreshTraceInfo()
}
override fun moduleLogChanged(moduleTag: MutableMap<String, SceneModule>) {
//模块日志 tag 发生变化,需要更新对应 UI
setLogCheckedChangeListener()
@@ -1207,12 +1094,16 @@ class DebugSettingView @JvmOverloads constructor(
//版本信息更新
urls?.let {
upgradeVersionList.clear()
it.iterator().forEach {map ->
val name = if(map.key.contains("{")) map.key.replace("{","") else map.key
val url = if(map.value.contains("}")) map.value.replace("}","") else map.value
upgradeVersionList.add(UpgradeVersionEntity(name.trim(),url))
it.iterator().forEach { map ->
val name =
if (map.key.contains("{")) map.key.replace("{", "") else map.key
val url = if (map.value.contains("}")) map.value.replace(
"}",
""
) else map.value
upgradeVersionList.add(UpgradeVersionEntity(name.trim(), url))
}
upgradeVersionList.sortByDescending { upgradeVersionEntity ->upgradeVersionEntity.name }
upgradeVersionList.sortByDescending { upgradeVersionEntity -> upgradeVersionEntity.name }
upgradeListAdapter?.setDada(dataFilter(upgradeVersionList))
upgradeListAdapter?.notifyDataSetChanged()
}
@@ -1242,23 +1133,8 @@ class DebugSettingView @JvmOverloads constructor(
}
}
val traceInfoMap = CallerDevaToolsManager.getTraceInfo()
val autopilot = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT]
autopilot?.let{
cbAdasAutoPilot.isChecked = it.record
}
val dataTrack = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED]
dataTrack?.let {
cbAdasDataTrack.isChecked = it.record
}
val trajectory = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY]
trajectory?.let {
cbAdasTrajectory.isChecked = it.record
}
val vehicle = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE]
vehicle?.let {
cbAdasVehicle.isChecked = it.record
}
// 更新链路信息
refreshTraceInfo()
/**
* ADAS自动驾驶链路
@@ -1313,24 +1189,46 @@ class DebugSettingView @JvmOverloads constructor(
}
}
private fun refreshTraceInfo() {
val traceInfoMap = CallerDevaToolsManager.getTraceInfo()
val autopilot = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT]
autopilot?.let {
cbAdasAutoPilot.isChecked = it.record
}
val dataTrack = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED]
dataTrack?.let {
cbAdasDataTrack.isChecked = it.record
}
val trajectory = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY]
trajectory?.let {
cbAdasTrajectory.isChecked = it.record
}
val vehicle = traceInfoMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE]
vehicle?.let {
cbAdasVehicle.isChecked = it.record
}
}
/**
* APK包管理
*/
private fun setApkCenterListener(){
val layoutManager: LinearLayoutManager = object : LinearLayoutManager(context,
VERTICAL, false) {
private fun setApkCenterListener() {
val layoutManager: LinearLayoutManager = object : LinearLayoutManager(
context,
VERTICAL, false
) {
override fun canScrollVertically(): Boolean {
// 直接禁止垂直滑动
return false
}
}
rvUpgradeVersionList.layoutManager =layoutManager
rvUpgradeVersionList.layoutManager = layoutManager
upgradeListAdapter = UpgradeListAdapter(context,upgradeVersionList,
object:UpgradeListAdapter.ClickListener{
override fun downloadApk(name: String,url: String) {
upgradeListAdapter = UpgradeListAdapter(context, upgradeVersionList,
object : UpgradeListAdapter.ClickListener {
override fun downloadApk(name: String, url: String) {
//下载包
CallerDevaToolsManager.downLoadPackage(name,url)
CallerDevaToolsManager.downLoadPackage(name, url)
ToastUtils.showLong("开始下载APK,稍后可前往downloads文件夹查看")
}
@@ -1340,9 +1238,9 @@ class DebugSettingView @JvmOverloads constructor(
ivApkSearch.setOnClickListener {
val searchStr = etApkSearch.text.toString()
if(searchStr.isEmpty()){
if (searchStr.isEmpty()) {
ToastUtils.showShort("请输入正确的搜索关键字")
}else{
} else {
CallerDevaToolsManager.getUpgradeVersionUrls(searchStr)
}
@@ -1370,11 +1268,11 @@ class DebugSettingView @JvmOverloads constructor(
private fun dataFilter(list: ArrayList<UpgradeVersionEntity>): ArrayList<UpgradeVersionEntity> {
val tempList = ArrayList<UpgradeVersionEntity>()
list.let {
it.iterator().forEach { entity->
if(onlineSelected && entity.name.contains("online")){
it.iterator().forEach { entity ->
if (onlineSelected && entity.name.contains("online")) {
tempList.add(entity)
}
if(qaSelected && entity.name.contains("qa")){
if (qaSelected && entity.name.contains("qa")) {
tempList.add(entity)
}
}
@@ -1435,7 +1333,8 @@ class DebugSettingView @JvmOverloads constructor(
AppConfigInfo.isConnectedNetty = CallerTelematicManager.getClientConnStatus()
AppConfigInfo.serverIp = CallerTelematicManager.getServerIp()
}
else -> {}
else -> {
}
}
/**
@@ -1453,11 +1352,12 @@ class DebugSettingView @JvmOverloads constructor(
tvAppVersionName.text = "鹰眼版本名:${AppUtils.getAppVersionName()}"
tvAutopilotProtocolVersionInfo.text =
"Autopilot协议版本${CallerAutoPilotManager.getProtocolVersion()}"
if(AppConfigInfo.protocolVersionNumber==0){
tvIpcProtocolVersionInfo.text="工控机协议版本:未知"
}else{
if (AppConfigInfo.protocolVersionNumber == 0) {
tvIpcProtocolVersionInfo.text = "工控机协议版本:未知"
} else {
tvIpcProtocolVersionInfo.text = "工控机协议版本:${AppConfigInfo.protocolVersionNumber}"
}
tvIpcVersionInfo.text = "工控机镜像:${mAutoPilotStatusInfo?.dockVersion}"
tvMoGoMapVersion.text = "HD-Map版本${MogoMap.getInstance().mogoMap.mapVersion}"
tvGitBranchInfo.text = "Git分支${AppConfigInfo.workingBranchName}"
tvAppBuildTimeInfo.text = "版本构建时间:${AppConfigInfo.appBuildTime}"
@@ -1517,9 +1417,25 @@ class DebugSettingView @JvmOverloads constructor(
"<font color='blue'>正常"
} else {
"<font color='red'>异常 原因:${
if(AppConfigInfo.connectStatusDescribe.isNullOrEmpty()){
if (AppConfigInfo.connectStatusDescribe.isNullOrEmpty()) {
"主动断开连接"
}else{
} else {
AppConfigInfo.connectStatusDescribe
}
}"
}
}"
)
tvIpcConnectStatus.text = Html.fromHtml(
"工控机连接状态:${
if (AppConfigInfo.isConnectAutopilot) {
"<font color='blue'>正常"
} else {
"<font color='red'>异常 原因:${
if (AppConfigInfo.connectStatusDescribe.isNullOrEmpty()) {
"主动断开连接"
} else {
AppConfigInfo.connectStatusDescribe
}
}"
@@ -1562,7 +1478,7 @@ class DebugSettingView @JvmOverloads constructor(
)
tvLocationEnabled.text = Html.fromHtml(
"定位服务开启状态:${
"Pad定位服务开启状态:${
if (DeviceUtils.isLocationEnabled()) {
"<font color='blue'>正常"
} else {
@@ -1573,18 +1489,31 @@ class DebugSettingView @JvmOverloads constructor(
tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
tvIpcInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
tvCarInfo.text =
"GPS时间${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
"自车经纬度:\n${mGnssInfo?.longitude}\n${mGnssInfo?.latitude}\n"
tvCarInfoCopy.text =
"GPS时间${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
"自车经纬度:\n${mGnssInfo?.longitude}\n${mGnssInfo?.latitude}\n"
tvIdentifyInfo.text =
"「有效类型」感知数据个数:${mIdentifyDataSize}\n" +
"「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n"
tvIdentifyInfoCopy.text =
"「有效类型」感知数据个数:${mIdentifyDataSize}\n" +
"「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n"
tvTrajectoryInfoSize.text =
"引导线点个数:${mTrajectoryInfoSize}"
tvTrajectoryInfoSizeCopy.text =
"引导线点个数:${mTrajectoryInfoSize}"
tvRouteInfoSize.text =
"全局路径规划点个数:${mRouteInfoSize}"
tvRouteInfoSizeCopy.text =
"全局路径规划点个数:${mRouteInfoSize}"
// 用完之后重制为0防止节点回掉突然没数据导致页面显示还是之前的数据情况
@@ -1621,30 +1550,40 @@ class DebugSettingView @JvmOverloads constructor(
AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
AppConfigInfo.connectStatusDescribe = autoPilotStatusInfo.connectStatusDescribe
// if (autoPilotStatusInfo.connectStatus) {
// adasConnectStatus = true
// }
//ADAS断开连接提示异常
// if (adasConnectStatus && !autoPilotStatusInfo.connectStatus) {
// adasConnectStatus = false
// toastMsg("工控机连接断开")
// }
}
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
mGnssInfo = gnssInfo
//实时加速度列表
ThreadUtils.runOnUiThread{
if(accelerationIsShow){
if(accelerationList.size > 9){
ThreadUtils.runOnUiThread {
if (accelerationIsShow) {
if (accelerationList.size > 9) {
accelerationList.removeLast()
}
gnssInfo?.acceleration?.let {
if(accelerationList.isEmpty()){
accelerationList.add(AccelerationEntity(TimeUtils.millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat()),it.toString()))
if (accelerationList.isEmpty()) {
accelerationList.add(
AccelerationEntity(
TimeUtils.millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
), it.toString()
)
)
}
if(abs(it.minus(accelerationList.first().acceleration.toDouble())) > abs(accelerationThresholdNum)){
accelerationList.add(0, AccelerationEntity(TimeUtils.millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat()),it.toString()))
if (abs(it.minus(accelerationList.first().acceleration.toDouble())) > abs(
accelerationThresholdNum
)
) {
accelerationList.add(
0,
AccelerationEntity(
TimeUtils.millis2String(
System.currentTimeMillis(),
TimeUtils.getHourMinSecondFormat()
), it.toString()
)
)
}
accelerationFloatWindow?.refreshData(accelerationList)
@@ -1703,13 +1642,15 @@ class DebugSettingView @JvmOverloads constructor(
tvReportCode.text = "code:${it.code}"
var resultStr = "result:"
for (result in it.resultList) {
resultStr = "$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} "
resultStr =
"$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} "
}
tvReportResult.text = resultStr
var actionStr = "action:"
for (action in it.actionsList) {
actionStr = "$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} "
actionStr =
"$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} "
}
tvReportActions.text = actionStr
@@ -1749,7 +1690,7 @@ class DebugSettingView @JvmOverloads constructor(
* 时延显示
*/
override fun onObuV2iDelayTime(delayTime: Long) {
ThreadUtils.runOnUiThread{
ThreadUtils.runOnUiThread {
tvObuDelay.text = "obu时延" + delayTime.toString()
}
}
@@ -1775,7 +1716,7 @@ class DebugSettingView @JvmOverloads constructor(
* @param steering 方向盘转向角
*/
override fun onAutopilotSteeringData(steering: Float) {
ThreadUtils.runOnUiThread{
ThreadUtils.runOnUiThread {
tvSteeringInfo.text = "方向盘转向角:${steering}"
}
}
@@ -1785,7 +1726,7 @@ class DebugSettingView @JvmOverloads constructor(
* @param gear 档位
*/
override fun onAutopilotGearData(gear: Chassis.GearPosition) {
ThreadUtils.runOnUiThread{
ThreadUtils.runOnUiThread {
tvGearInfo.text = "挂挡档位:${gear}"
}
}
@@ -1804,7 +1745,7 @@ class DebugSettingView @JvmOverloads constructor(
this.clickListener = clickListener
}
interface ClickListener{
interface ClickListener {
fun showReportListWindow(show: Boolean)
}

View File

@@ -0,0 +1,60 @@
package com.mogo.eagle.core.function.hmi.ui.setting
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 工控机异常节点上报适配器
* @since: 2022/5/12
*/
class IPCReportAdapter: RecyclerView.Adapter<IPCReportAdapter.IPCReportHolder>(){
private var data:List<ReportEntity>? = null
fun setData( data: List<ReportEntity>?){
this.data = data
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): IPCReportHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_ipc_report, parent, false)
return IPCReportHolder(view)
}
override fun onBindViewHolder(holder: IPCReportHolder, position: Int) {
data?.let {it ->
val reportEntity = it[position]
reportEntity.let {
holder.tvReportTimeContent.text = it.time
var resultStr = "发生异常"
for (result in it.resultList){
resultStr = "${resultStr}-${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportResultContent.text = resultStr
holder.tvReportMsgContent.text = it.msg
var actionStr = ""
for (action in it.actionsList){
actionStr = "${actionStr}-${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionContent.text = actionStr
}
}
}
override fun getItemCount() = data?.size ?: 0
class IPCReportHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
var tvReportTimeContent: TextView = itemView.findViewById(R.id.tvReportTimeContent)
var tvReportResultContent: TextView = itemView.findViewById(R.id.tvReportResultContent)
var tvReportMsgContent: TextView = itemView.findViewById(R.id.tvReportMsgContent)
var tvReportActionContent: TextView = itemView.findViewById(R.id.tvReportActionContent)
}
}

View File

@@ -0,0 +1,126 @@
package com.mogo.eagle.core.function.hmi.ui.setting
import android.app.Activity
import android.graphics.PixelFormat
import android.util.DisplayMetrics
import android.view.*
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.hmi.R
import java.lang.reflect.Field
/**
* @author XuXinChao
* @description 工控机异常节点上报
* @since: 2022/5/12
*/
class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener{
private var mActivity: Activity = activity
private var mWindowParams: WindowManager.LayoutParams? = null
private var mWindowManager: WindowManager? = null
private lateinit var rvIPCReport: RecyclerView
private var ipcReportAdapter: IPCReportAdapter?=null
private lateinit var mFloatLayout: View
private var mInViewX = 0f
private var mInViewY = 0f
private var mDownInScreenX = 0f
private var mDownInScreenY = 0f
private var mInScreenX = 0f
private var mInScreenY = 0f
init {
initFloatWindow();
}
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_ipc_report, null) as View
mFloatLayout.setOnTouchListener(this)
rvIPCReport= mFloatLayout.findViewById(R.id.rv_ipc_report)
mWindowParams = WindowManager.LayoutParams()
mWindowManager = mActivity.windowManager
mWindowParams?.let {
it.format = PixelFormat.RGBA_8888
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
it.gravity = Gravity.START or Gravity.TOP
it.width = 800
it.height = 1000
it.alpha = 0.9f
}
ipcReportAdapter = IPCReportAdapter()
rvIPCReport.layoutManager = LinearLayoutManager(mActivity,
LinearLayoutManager.VERTICAL,false)
rvIPCReport.adapter = ipcReportAdapter
}
fun refreshData(data:List<ReportEntity>){
ipcReportAdapter?.setData(data)
ipcReportAdapter?.notifyDataSetChanged()
}
override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean {
when (motionEvent?.action) {
MotionEvent.ACTION_DOWN -> {
// 获取相对View的坐标即以此View左上角为原点
mInViewX = motionEvent.x
mInViewY = motionEvent.y
// 获取相对屏幕的坐标,即以屏幕左上角为原点
mDownInScreenX = motionEvent.rawX
mDownInScreenY = motionEvent.rawY - getSysBarHeight(mActivity)
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY - getSysBarHeight(mActivity)
}
MotionEvent.ACTION_MOVE -> {
// 更新浮动窗口位置参数
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY - getSysBarHeight(mActivity)
mWindowParams!!.x = (mInScreenX - mInViewX).toInt()
mWindowParams!!.y = (mInScreenY - mInViewY).toInt()
// 手指移动的时候更新小悬浮窗的位置
mWindowManager!!.updateViewLayout(mFloatLayout, mWindowParams)
}
// MotionEvent.ACTION_UP -> // 如果手指离开屏幕时xDownInScreen和xInScreen相等且yDownInScreen和yInScreen相等则视为触发了单击事件。
// if (mDownInScreenX === mInScreenX && mDownInScreenY === mInScreenY) {
// }
}
return true
}
fun showFloatWindow() {
if (mFloatLayout.parent == null) {
val metrics = DisplayMetrics()
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels
mWindowParams!!.y = metrics.heightPixels / 2 - getSysBarHeight(mActivity)
mWindowManager!!.addView(mFloatLayout, mWindowParams)
}
}
fun hideFloatWindow() {
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}
// 获取系统状态栏高度
private fun getSysBarHeight(activity: Activity): Int {
val c: Class<*>
val obj: Any
val field: Field
val x: Int
var sbar = 0
try {
c = Class.forName("com.android.internal.R\$dimen")
obj = c.newInstance()
field = c.getField("status_bar_height")
x = field.get(obj).toString().toInt()
sbar = activity.resources.getDimensionPixelSize(x)
} catch (e1: Exception) {
e1.printStackTrace()
}
return sbar
}
}

View File

@@ -56,6 +56,7 @@ class CircularProgressView @JvmOverloads constructor(
mProgPaint.isDither = true // 设置抖动
mProgPaint.strokeWidth = typedArray.getDimension(R.styleable.CircularProgressView_progWidth, 10.0f)
mProgPaint.color = typedArray.getColor(R.styleable.CircularProgressView_progColor, Color.BLUE)
// mProgPaint.setPathEffect()
// 初始化进度圆环渐变色
val startColor = typedArray.getColor(R.styleable.CircularProgressView_progStartColor, -1)
val firstColor = typedArray.getColor(R.styleable.CircularProgressView_progFirstColor, -1)
@@ -64,8 +65,6 @@ class CircularProgressView @JvmOverloads constructor(
} else {
mColorArray = null
}
typedArray.recycle();
}
@@ -102,6 +101,12 @@ class CircularProgressView @JvmOverloads constructor(
}
fun setBlurMaskFilter(blur: BlurMaskFilter.Blur, radius: Float) {
var blur: BlurMaskFilter = BlurMaskFilter(radius, blur)
mProgPaint.setMaskFilter(blur)
invalidate()
}
/**
* 获取当前进度
* @return 当前进度0-100

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
@@ -75,13 +76,14 @@ public class SteeringWheelView extends ConstraintLayout {
tapPositionView = findViewById(R.id.tap_position);
steeringCircularV = findViewById(R.id.steering_circular);
steeringCircularV.setBackWidth(8);
steeringCircularV.setBackColor(R.color.hmi_light_blue_00);
steeringCircularV.setBackColor(R.color.hmi_light_back_bg);
steeringCircularV.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue);
steeringCircularV.setProgress((int) (180 * 100) / 360, 1000);
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
steeringCircularVAlpha = findViewById(R.id.steering_circular_alpha);
steeringCircularVAlpha.setAlpha(0.4f);
steeringCircularVAlpha.setBackColor(R.color.hmi_light_blue_00);
steeringCircularVAlpha.setBackWidth(12);
steeringCircularVAlpha.setBlurMaskFilter(BlurMaskFilter.Blur.NORMAL, 12);
steeringCircularVAlpha.setBackColor(R.color.hmi_clear_00);
steeringCircularVAlpha.setProgColor(R.color.hmi_light_blue_alpha);
steeringCircularVAlpha.setProgress((int) (180 * 100) / 360, 1000);
}

View File

@@ -104,6 +104,7 @@ class SystemVersionView @JvmOverloads constructor(
CallerLogger.i("$M_HMI$$TAG", "upgrade confirm")
//设置当前状态为“升级中”
AdUpgradeStateHelper.setUpgradeStatus(true)
//TODO
CallerAutoPilotManager.setIPCUpgradeAffirm()
//将角标设为升级中
ivAdStatus?.setImageResource(R.drawable.icon_upgrading)

View File

@@ -91,6 +91,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@Override
@@ -372,22 +373,31 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
mConnectInfoRV.post(() -> updateConnectInfoView(autoPilotStatusInfo));
int status = autoPilotStatusInfo.getIpcConnStatus();
if (mLastStatus != status) {
AutopilotStatusInfo statusInfo = autoPilotStatusInfo.clone();
mConnectInfoRV.post(() -> updateConnectInfoView(statusInfo));
mLastStatus = status;
}
}
@Override
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {}
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {}
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotSNRequest() {}
public void onAutopilotSNRequest() {
}
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
mConnAdapter.updateData(autoPilotStatusInfo);
mConnectInfoRV.scrollToPosition(mConnAdapter.getItemCount() - 1);
mLastStatus = autoPilotStatusInfo.getIpcConnStatus();
} else {// 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
}

View File

@@ -17,20 +17,6 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--底层默认进度条,无进度值改变动作-->
<ProgressBar
android:id="@+id/blue_circle"
android:layout_width="@dimen/dp_260"
android:layout_height="@dimen/dp_260"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_85"
android:layout_marginTop="@dimen/dp_130"
android:layout_marginRight="@dimen/dp_85"
android:indeterminateDrawable="@drawable/bg_steering_outer_taxi"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/steering_tv_left"
android:layout_width="wrap_content"
@@ -61,12 +47,12 @@
<!--进度值改变状态进度条-->
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
android:id="@+id/steering_circular"
android:layout_width="@dimen/dp_260"
android:layout_height="@dimen/dp_260"
android:layout_width="@dimen/dp_278"
android:layout_height="@dimen/dp_278"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_130"
android:outlineAmbientShadowColor="#1EBBCFF6"
android:layout_marginTop="@dimen/dp_122"
android:padding="@dimen/dp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -76,15 +62,15 @@
<!--状态条阴影-->
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
android:id="@+id/steering_circular_alpha"
android:layout_width="@dimen/dp_274"
android:layout_height="@dimen/dp_274"
android:layout_width="@dimen/dp_280"
android:layout_height="@dimen/dp_280"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_122"
android:layout_marginTop="@dimen/dp_120"
android:padding="@dimen/dp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:progWidth="22px"
app:progress="0" />
<ImageView
@@ -104,6 +90,6 @@
android:layout_marginTop="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/blue_circle" />
app:layout_constraintTop_toBottomOf="@+id/steering_circular" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/tvReportTimeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<TextView
android:id="@+id/tvReportTimeContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/tvReportTimeTitle"
/>
<TextView
android:id="@+id/tvReportResultTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReportTimeTitle"
/>
<TextView
android:id="@+id/tvReportResultContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvReportResultTitle"
app:layout_constraintLeft_toRightOf="@id/tvReportResultTitle"
android:minLines="1"
/>
<TextView
android:id="@+id/tvReportMsgTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvReportResultContent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<TextView
android:id="@+id/tvReportMsgContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvReportMsgTitle"
app:layout_constraintLeft_toRightOf="@id/tvReportMsgTitle"
android:minLines="1"
/>
<TextView
android:id="@+id/tvReportActionTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReportMsgContent"
/>
<TextView
android:id="@+id/tvReportActionContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvReportActionTitle"
app:layout_constraintLeft_toRightOf="@id/tvReportActionTitle"
android:minLines="1"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/tvReportActionContent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -89,8 +89,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvConnectInfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="1200px"
android:layout_height="680px"
android:layout_gravity="bottom"
/>
</FrameLayout>

View File

@@ -166,6 +166,29 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tvIpcConnectStatus"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<ToggleButton
android:id="@+id/tbIsDemoMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:textColor="#000"
android:textOff="开启美化模式"
android:textOn="关闭美化模式"
android:textSize="@dimen/dp_24"
android:background="@drawable/radio_button_normal_background_right"/>
<ToggleButton
android:id="@+id/tbDeviceBind"
android:layout_width="match_parent"
@@ -184,11 +207,32 @@
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tvPadSn"
style="@style/DebugSettingText"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvPadSn"
style="@style/DebugSettingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvPadSnClip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="复制"
android:layout_margin="@dimen/dp_10"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textSize="14sp"
android:textColor="#0000FF"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
@@ -288,6 +332,35 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvIpcVersionInfo"
style="@style/DebugSettingText"
android:layout_width="@dimen/dp_600"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvIpcVersionInfoClip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="复制"
android:textSize="14sp"
android:textColor="#0000FF"
android:layout_gravity="center"
android:gravity="center"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
@@ -437,6 +510,135 @@
android:textOff="控制中心"
android:textOn="控制中心" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDevelopMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="开发者模式"
style="@style/DebugSettingText"
android:visibility="gone"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/commonLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tvIpcInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="7"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/tvIpcInfoDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/tvIpcInfo"
/>
<Button
android:id="@+id/btnRecordBag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="录制Bag包"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIpcInfoDivider"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/debug_setting_edit_bg"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/btnRecordBag"
app:layout_constraintLeft_toRightOf="@id/btnRecordBag"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/btnRecordBag">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etInputRecordBagTime"
style="@style/DebugSettingText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="90px"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
style="@style/DebugSettingText"
android:layout_width="93px"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="秒" />
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:id="@+id/recordBagDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnRecordBag" />
<TextView
android:id="@+id/tvCarInfoCopy"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/recordBagDivider" />
<TextView
android:id="@+id/tvCarInfoCopyClip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="复制经纬度"
android:layout_marginStart="@dimen/dp_10"
android:textSize="14sp"
android:textColor="#0000FF"
app:layout_constraintTop_toBottomOf="@id/tvCarInfoCopy"
/>
<TextView
android:id="@+id/tvIdentifyInfoCopy"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvCarInfoCopyClip" />
<TextView
android:id="@+id/tvTrajectoryInfoSizeCopy"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvIdentifyInfoCopy" />
<TextView
android:id="@+id/tvRouteInfoSizeCopy"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvTrajectoryInfoSizeCopy" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/controlCenterLayout"
android:layout_width="match_parent"
@@ -468,7 +670,7 @@
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="6"
android:minLines="7"
app:layout_constraintTop_toTopOf="parent" />
<View
@@ -528,61 +730,6 @@
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnSetAutopilotIP" />
<Button
android:id="@+id/btnSetAutopilotSpeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="设置最大速度"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/autopilotIPDivider" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llSpeedLayout"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/debug_setting_edit_bg"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/btnSetAutopilotSpeed"
app:layout_constraintLeft_toRightOf="@id/btnSetAutopilotSpeed"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/btnSetAutopilotSpeed">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etInputSpeed"
style="@style/DebugSettingText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="90px"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
style="@style/DebugSettingText"
android:layout_width="93px"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="km/h" />
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:id="@+id/autopilotSpeedDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnSetAutopilotSpeed" />
<Button
android:id="@+id/btnRecordPackage"
android:layout_width="wrap_content"
@@ -592,7 +739,7 @@
android:text="录制Bag包"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/autopilotSpeedDivider" />
app:layout_constraintTop_toBottomOf="@id/autopilotIPDivider" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="0dp"
@@ -636,36 +783,13 @@
android:layout_height="1dp"
android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnRecordPackage" />
<Button
android:id="@+id/btnSystemUpgrade"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="升级系统"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/btnSystemRestart"
app:layout_constraintTop_toBottomOf="@id/recordPackageDivider"
tools:visibility="visible" />
<Button
android:id="@+id/btnSystemRestart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="重启系统"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@id/btnSystemUpgrade"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/recordPackageDivider"
tools:visibility="visible" />
<TextView
android:id="@+id/tvCarInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/btnSystemUpgrade" />
app:layout_constraintTop_toBottomOf="@id/recordPackageDivider" />
<TextView
android:id="@+id/tvIdentifyInfo"
@@ -1304,20 +1428,6 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnOpenObuFusion" />
<ToggleButton
android:id="@+id/tbIsDemoMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:padding="@dimen/dp_10"
android:textColor="#000"
android:textOff="开启美化模式"
android:textOn="关闭美化模式"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawIdentifyData" />
<ToggleButton
android:id="@+id/tbIsDrawAutopilotTrajectoryData"
android:layout_width="0dp"
@@ -1328,9 +1438,9 @@
android:textOff="强制绘制引导线"
android:textOn="强制绘制引导线"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/tbIsDemoMode"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tbIsDemoMode" />
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawIdentifyData" />
<ToggleButton
android:layout_width="0dp"
@@ -1341,9 +1451,9 @@
android:textOff="强制绘制路径规划"
android:textOn="强制绘制路径规划"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="@id/tbIsDemoMode"
app:layout_constraintRight_toRightOf="@id/tbIsDemoMode"
app:layout_constraintTop_toBottomOf="@id/tbIsDemoMode" />
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawIdentifyData"/>
<ToggleButton
android:id="@+id/tbChangeAutoPilotStatus"
@@ -1354,9 +1464,9 @@
android:textOff="开启模拟自动驾驶中"
android:textOn="关闭模拟自动驾驶中"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/tbIsDemoMode"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbIsDemoMode" />
app:layout_constraintTop_toBottomOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintLeft_toLeftOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintRight_toRightOf="@id/tbIsDrawAutopilotTrajectoryData"/>
<RadioGroup
android:id="@+id/rgGpsProvider"

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="840px"
android:layout_height="584px"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/icon_drag"
android:padding="15dp"
android:layout_gravity="center_horizontal"
/>
<com.mogo.eagle.core.widget.RoundConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialog_bg_color"
app:roundLayoutRadius="10dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_ipc_report"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>
</LinearLayout>

View File

@@ -56,6 +56,7 @@
<color name="hmi_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="hmi_light_blue">#45D3FF</color>
<color name="hmi_dark_blue">#1B5BFF</color>
<color name="hmi_light_blue_00">#0045D3FF</color>
<color name="hmi_light_blue_alpha">#666C79C4</color>
<color name="hmi_light_back_bg">#1EBBCFF6</color>
<color name="hmi_light_blue_alpha">#6C79C4</color>
<color name="hmi_clear_00">#0045D3FF</color>
</resources>

View File

@@ -37,7 +37,7 @@
<string name="application_upgrade_confirm">是否将应用升级至最新版本?</string>
<string name="application_upgrade_tips">注意!升级时需退出自动驾驶,支持在人工驾驶时升级,升级时不可中途断电。</string>
<string name="confirm">确认</string>
<string name="cancel">取消</string>
<string name="cancel">稍后升级</string>
<!--绑定车机-->
<string name="bindingcar_title">绑定车机</string>

View File

@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightManager
import com.mogo.eagle.core.function.v2x.events.V2XEventManager
import com.mogo.eagle.core.function.v2x.redlightwarning.RedLightWarningManager
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDataManager
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightDispatcher
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -22,6 +23,7 @@ class V2XProvider : IMoGoFunctionServerProvider {
CallTrafficLightManager.getTrafficLightProvider().initTrafficLightServer(context)
VipCarManager.INSTANCE.initServer(context)
SpeedLimitDataManager.getInstance().start()
TrafficLightDispatcher.INSTANCE.initServer(context)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
//不处理
@@ -34,7 +36,7 @@ class V2XProvider : IMoGoFunctionServerProvider {
override fun onDestroy() {
VipCarManager.INSTANCE.destroy()
TrafficLightDispatcher.INSTANCE.destroy()
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
//不处理
} else {

View File

@@ -49,10 +49,10 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
mThreadHandler =
TrafficLightThreadHandler(Looper.getMainLooper(), {
//查询路口时,如果红绿灯显示,则隐藏掉
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallTrafficLightListenerManager.resetTrafficLightData()
}
// if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
// TrafficLightHMIManager.INSTANCE.hideTrafficLight()
// CallTrafficLightListenerManager.resetTrafficLightData()
// }
mLocation?.let { it ->
val tileId = CallerMapUIServiceManager.getMapUIController()?.getTileId(it.longitude, it.latitude) ?: 0
trafficLightNetWorkModel.requestRoadID(
@@ -78,7 +78,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
trafficLightNetWorkModel.requestTrafficLight(
it.latitude, it.longitude, it.bearing.toDouble(), road, { result ->
trafficLightResult = result
TrafficLightHMIManager.INSTANCE.updateTrafficLight(result)
// TrafficLightHMIManager.INSTANCE.updateTrafficLight(result)
CallTrafficLightListenerManager.invokeTrafficLightStatus(result)
},
{ errorMsg ->
@@ -99,6 +99,10 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
2_000L
)
}
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallTrafficLightListenerManager.resetTrafficLightData()
}
})
}
}, {

View File

@@ -0,0 +1,112 @@
package com.mogo.eagle.core.function.v2x.trafficlight.core
import android.content.Context
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
/**
* @author XuXinChao
* @description 对多个红绿灯信号来源进行统一调度AI云、工控机
* @since: 2022/4/28
*/
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLightListener {
companion object{
const val TAG = "TrafficLightDispatcher"
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
TrafficLightDispatcher()
}
}
private var mContext: Context? = null
//是否有AI获取红绿灯灯态
private var hasAiLightStatus: Boolean = false
fun initServer(context: Context){
mContext = context
//注册监听AI云获取红绿灯状态
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
//注册监听AI云进入路口
CallTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this)
//注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
}
/**
* 工控机感知红绿灯
* @param trafficLights 感知红绿灯
*/
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
if(!hasAiLightStatus){
trafficLights?.let { it ->
var light :TrafficLight?= null
if(it.hasStraight()){
light = it.straight
}else if(it.hasLeft()){
light = it.left
}else if(it.hasRight()){
light = it.right
}else if(it.hasUTurn()){
light = it.uTurn
}
if(light == null){
//隐藏红绿灯显示
CallerHmiManager.showWarningTrafficLight(0)
}else{
when (light.state) {
TrafficLightOuterClass.LightState.STATE_RED -> {
//红灯
CallerHmiManager.showWarningTrafficLight(1)
CallerHmiManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
//黄灯
CallerHmiManager.showWarningTrafficLight(2)
CallerHmiManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_GREEN -> {
//绿灯
CallerHmiManager.showWarningTrafficLight(3)
CallerHmiManager.changeCountdownGreen(0)
}
else -> {}
}
}
}
}
}
/**
* AI云获取红绿灯状态
*/
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult)
hasAiLightStatus = true
}
/**
* 车辆进入路口
*/
override fun onEnterCrossRoad(enter: Boolean) {
hasAiLightStatus = enter
}
fun destroy(){
//取消注册监听AI云获取红绿灯状态
CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
//取消注册监听AI云进入路口
CallTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG)
}
}