[code_opt_3.3.0] code opt

This commit is contained in:
zhongchao
2023-06-09 11:05:53 +08:00
parent 00a999c777
commit ad73ccf819
58 changed files with 293 additions and 712 deletions

View File

@@ -7,10 +7,8 @@ import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.GsonUtils
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.properties.Delegates
import system_master.SystemStatusInfo
import kotlin.properties.Delegates
/**
* 域控制器相关的回调监听
@@ -24,7 +22,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
private var lineId: Long? by Delegates.observable(0) { _, _, newValue ->
if(newValue == null){
if (newValue == null) {
return@observable
}
M_LISTENERS.forEach {
@@ -33,6 +31,15 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
}
}
private var status: Int by Delegates.observable(0){_, oldValue, newValue ->
if(oldValue != newValue){
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatusResponse(newValue)
}
}
}
@Volatile
private var autoPilotMessageCode: String = ""
@@ -46,6 +53,18 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
return mAutopilotStatusInfo
}
fun getState(): Int {
return mAutopilotStatusInfo.state
}
fun getLineId(): Long {
return lineId ?: 0L
}
fun getDockerInfo(): String? {
return mAutopilotStatusInfo.dockVersion
}
/**
* 查询AutoPilot状态
*/
@@ -60,7 +79,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
/**
* 通过Gnss定位更新来同步更新自动驾驶状态
*/
fun updateAutoPilotLatLon(satelliteTime: Double, lon: Double, lat: Double) {
fun updateAutoPilotLocAndTime(satelliteTime: Double, lon: Double, lat: Double) {
mAutopilotStatusInfo.locationLat = lat
mAutopilotStatusInfo.locationLon = lon
mAutopilotStatusInfo.satelliteTime = satelliteTime
@@ -68,18 +87,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
invokeAutoPilotStatus()
}
/**
* 获取当前时刻WGS84 lat
*/
fun getCurWgs84Lat(): Double {
return mAutopilotStatusInfo.locationLat
}
/**
* 获取当前时刻WGS84 lon
*/
fun getCurWgs84Lon(): Double {
return mAutopilotStatusInfo.locationLon
fun updateAutoPilotStatus(state: Int, autopilotMode: Int) {
mAutopilotStatusInfo.state = state
mAutopilotStatusInfo.pilotmode = autopilotMode
invokeAutoPilotStatus()
}
/**
@@ -180,7 +191,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
*/
fun updateAutopilotControlParameters(autopilotControlParameters: AutopilotControlParameters? = null) {
mAutopilotStatusInfo.autopilotControlParameters = autopilotControlParameters
lineId = autopilotControlParameters?.autoPilotLine?.lineId?:0
lineId = autopilotControlParameters?.autoPilotLine?.lineId ?: 0
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
}

View File

@@ -9,7 +9,6 @@ import kotlin.properties.Delegates
*/
object CallerChassisSteeringStateListenerManager : CallerBase<IMoGoChassisSteeringStateListener>() {
//todo emArrow 总结
private var steering: Float? by Delegates.observable(0.0f) { _, oldValue, newValue ->
if (newValue == null) {
return@observable

View File

@@ -19,6 +19,13 @@ object CallerPlanningRottingListenerManager : CallerBase<IMoGoPlanningRottingLis
}
}
/**
* 获取global path cache
*/
fun getGlobalPathCache(): MessagePad.GlobalPathResp? {
return globalPathResp
}
/**
* 路径规划 回调
* @param globalPathResp 自动驾驶网约车回调数据
@@ -33,4 +40,5 @@ object CallerPlanningRottingListenerManager : CallerBase<IMoGoPlanningRottingLis
}
}
}