[Change]
A、增加最后一次启动自动驾驶参数记录,注意,实时回调和主动查询出来对可能为null即没有行程信息,需要做好容错,使用方法: 1、实时监听:实现监听接口,IMoGoAutopilotStatusListener::onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo),注册变化监听CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this); 2、单次查询: CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters() 3、TODO @文君需要在Taxi行程结束和Bus跑完最后一站后对数据进行清空操作。 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String, IMoGoAutopilotStatusListener> =
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#### CallerAutoPilotStatusListenerManager 管理自动驾驶中的状态及参数信息
|
||||
|
||||
AutopilotStatusInfo:
|
||||
连接信息
|
||||
实时经纬度、速度、车辆硬件状态
|
||||
最后一次启动自动驾驶时候的启动参数 AutopilotControlParameters
|
||||
Reference in New Issue
Block a user