From 93d5e4396325487159c59c1439a9f35636d75268 Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Wed, 21 Jun 2023 14:03:50 +0800 Subject: [PATCH] =?UTF-8?q?[sweeper314]=E6=B7=BB=E5=8A=A0=E6=97=A0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=AF=E5=8A=A8=E8=87=AA=E9=A9=BE=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/MoGoAutopilotControlProvider.kt | 25 ++++++++++++++++--- .../IMoGoAutopilotControlProvider.kt | 2 +- .../CallerAutoPilotControlManager.kt | 4 --- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index 1c3b6cfcd4..f538aa58b0 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -322,10 +322,29 @@ class MoGoAutopilotControlProvider : startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.PAD) } - override fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters) { - startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.MO_FANG) + override fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) { + if (controlParameters==null){ + startAutoPilotWithNoParameter(Constants.AUTOPILOT_SOURCE.MO_FANG) + }else{ + startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.MO_FANG) + } + } + private fun startAutoPilotWithNoParameter(source: Int) { + if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + val invokeResult = AdasManager.getInstance() + .sendAutoPilotModeReq(1, source, null) + invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + } else { + if (AdasManager.getInstance().ipcConnectionStatus == IPC_CONNECTION_STATUS.CONNECTED) { + val invokeResult = AdasManager.getInstance() + .sendAutoPilotModeReq(1, source, null) + invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + } else { + invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶 无参") + CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法开启自动驾驶") + } + } } - private fun startAutoPilot(controlParameters: AutopilotControlParameters, source: Int) { if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { val invokeResult = AdasManager.getInstance() diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt index 3df523e14b..d4f979dc59 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt @@ -42,7 +42,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { * * @param controlParameters 开启自动驾驶的控制参数 */ - fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters) + fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) /** * 给工控机透出路口红绿灯信息 diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index c03f05bc0a..5bbca5918b 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -93,10 +93,6 @@ object CallerAutoPilotControlManager { clientPkFileName = "sn" ) fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) { - if (controlParameters == null) { - //LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息") - return - } providerApi?.startAutoPilotByMoFang(controlParameters) // 更新记录在全局的控制参数 CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)