diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt index 4cdacb92d6..f0dd46a78b 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt @@ -85,12 +85,17 @@ open class AutopilotStatusInfo : Serializable, Cloneable { // 默认未连接 var ipcConnStatus = 0x01 + /** + * 记录最后一次启动自动驾驶需要的参数,结束自动驾驶后设置为null + */ + var autopilotControlParameters: AutopilotControlParameters? = null + override fun toString(): String { return "connectIP=$connectIP, connectPort=$connectPort, " + "connectStatus=$connectStatus, connectDescribe=$connectStatusDescribe, version=$version, dockVersion=$dockVersion," + " locationStatus=$locationStatus), locationLat=$locationLat, locationLon=$locationLon," + " satelliteTime=$satelliteTime, speed=$speed, state=$state, reason=$reason, camera=$camera," + - " radar=$radar, rtk=$rtk, pilotmode=$pilotmode, ipcConnStatus=$ipcConnStatus" + " radar=$radar, rtk=$rtk, pilotmode=$pilotmode, ipcConnStatus=$ipcConnStatus, autopilotControlParameters=$autopilotControlParameters" } public override fun clone(): AutopilotStatusInfo { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index 56bb110906..a941d04ea8 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -67,6 +67,8 @@ object CallerAutoPilotManager { return } providerApi?.startAutoPilot(controlParameters) + // 更新记录在全局的控制参数 + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters) } /** @@ -94,6 +96,8 @@ object CallerAutoPilotManager { // 司机屏才能取消自动驾驶 if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { providerApi?.cancelAutoPilot() + // 更新记录在全局的控制参数 + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index 5f0625073a..061c1347ca 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot import android.util.* import androidx.annotation.Nullable +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.base.CallerBase @@ -24,7 +25,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() + ConcurrentHashMap() @Volatile private var autoPilotMessageCode: String = "" @@ -93,8 +94,8 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * @param listener 监听回调 */ fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotStatusListener + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotStatusListener ) { if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { return @@ -201,10 +202,18 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ fun invokeAutopilotStatusRespByQuery(statusInfo: SystemStatusInfo.StatusInfo?) { statusInfo?.also { - M_AUTOPILOT_STATUS_LISTENERS.forEach{ itx -> + M_AUTOPILOT_STATUS_LISTENERS.forEach { itx -> val listener = itx.value listener.onAutopilotStatusRespByQuery(it) } } } + + /** + * 更新自动驾驶控制参数,结束自动驾驶时候需要更新为null,且更新时候同时触发onAutopilotStatusResponse回调 + */ + fun updateAutopilotControlParameters(autopilotControlParameters: AutopilotControlParameters? = null) { + mAutopilotStatusInfo.autopilotControlParameters = autopilotControlParameters + invokeAutoPilotStatus(mAutopilotStatusInfo) + } } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md new file mode 100644 index 0000000000..6d3fa01f95 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md @@ -0,0 +1,6 @@ +#### CallerAutoPilotStatusListenerManager 管理自动驾驶中的状态及参数信息 + +AutopilotStatusInfo: +连接信息 +实时经纬度、速度、车辆硬件状态 +最后一次启动自动驾驶时候的启动参数 AutopilotControlParameters