[3.4.0-map-sdk] merge 6.1.0

This commit is contained in:
zhongchao
2023-09-25 09:55:35 +08:00
11 changed files with 94 additions and 72 deletions

View File

@@ -6,7 +6,6 @@ import androidx.annotation.Nullable;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoParallelDrivingActionsListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager;
@@ -24,7 +23,7 @@ import java.util.ArrayList;
* 工控机状态信息回调(判断是否能否启动自动驾驶的回调) * 工控机状态信息回调(判断是否能否启动自动驾驶的回调)
* 目前定的是3秒回调一次 * 目前定的是3秒回调一次
*/ */
public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMoGoAutopilotStatisticsListener, IMoGoParallelDrivingActionsListener { public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMoGoAutopilotStatisticsListener {
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName(); private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
@@ -89,8 +88,6 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
//2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次 //2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次
CallerAutopilotActionsListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotActionsListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotStatisticsListenerManager.INSTANCE.addListener(TAG,this); CallerAutopilotStatisticsListenerManager.INSTANCE.addListener(TAG,this);
//map3.6.0且是东风或者红旗的时候返回
CallerParallelDrivingActionsListenerManager.INSTANCE.addListener(TAG,this);
} }
private void releaseListeners() { private void releaseListeners() {
@@ -115,7 +112,6 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
} }
} }
@Override @Override
public void onAutopilotStatistics(@Nullable AutopilotStatistics statistics) { public void onAutopilotStatistics(@Nullable AutopilotStatistics statistics) {
if (statistics == null) return; if (statistics == null) return;
@@ -129,20 +125,6 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
} }
} }
@Override
public void onParallelDrivingAbility(boolean isParallelDrivingAbility, @Nullable ArrayList<UnableLaunchReason> unableParallelDrivingReasons) {
if (unableParallelDrivingReasons != null && getMapVersion() >= 30600) {
//刹车变化回调
Logger.d(TAG,"onParallelDrivingAbility = " + isParallelDrivingAbility +
" unableParallelDrivingReasons =" + unableParallelDrivingReasons.toString());
if (unableParallelDrivingReasons.toString().contains(UnableLaunchReason.SourceType.CHASSIS.name())
&& unableParallelDrivingReasons.toString().contains(UnableLaunchReason.UnableType.BRAKE.name())) {
failureCallback.brakeStatusChanged(isParallelDrivingAbility);
}
}
}
private int getMapVersion(){ private int getMapVersion(){
return ParseVersionUtils.parseVersion(true, CallerAutoPilotStatusListenerManager.INSTANCE.getDockerVersion()); return ParseVersionUtils.parseVersion(true, CallerAutoPilotStatusListenerManager.INSTANCE.getDockerVersion());
} }

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.datacenter.autopilot.adapter package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import android.util.Log
import bag_manager.BagManagerOuterClass import bag_manager.BagManagerOuterClass
import chassis.ChassisStatesOuterClass import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass import chassis.VehicleStateOuterClass
@@ -164,9 +163,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
vehicleState: VehicleStateOuterClass.VehicleState? vehicleState: VehicleStateOuterClass.VehicleState?
) { ) {
if (vehicleState != null) { if (vehicleState != null) {
Log.i(
"xfk",
"底盘 onVehicleState 刹车=${vehicleState.brake}")
//转向灯数据 //转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据 //刹车灯数据
@@ -256,9 +252,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerChassisThrottleStateListenerManager.invokeAutopilotThrottle(it.throttleResponsePosition) CallerChassisThrottleStateListenerManager.invokeAutopilotThrottle(it.throttleResponsePosition)
} }
chassisStates.brakeSystemStates?.let { chassisStates.brakeSystemStates?.let {
Log.i(
"xfk",
"底盘 onVehicleState 刹车=${it.brakePedalResponsePosition}")
//刹车 //刹车
CallerChassisBrakeStateListenerManager.invokeAutopilotBrake(it.brakePedalResponsePosition) CallerChassisBrakeStateListenerManager.invokeAutopilotBrake(it.brakePedalResponsePosition)
} }

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.datacenter.obu package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.CommunicationType import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.enums.DataSourceType
@@ -62,25 +63,25 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} }
override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) { override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcRsiWarning(rsiWarningData) onMogoObuDcRsiWarning(rsiWarningData)
} }
} }
override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) { override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcRsmWarning(rsmWarningData) onMogoObuDcRsmWarning(rsmWarningData)
} }
} }
override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) { override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcSpatWarning(spatWarningData) onMogoObuDcSpatWarning(spatWarningData)
} }
} }
override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) { override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
onMogoObuMapMath(mapMatchData) onMogoObuMapMath(mapMatchData)
} }
} }
@@ -561,7 +562,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} }
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if(HmiBuildConfig.isShowObuV2iView){ if(FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView){
if (HmiBuildConfig.isShowRunRedLightView) { if (HmiBuildConfig.isShowRunRedLightView) {
if (!isShowRunRedLight) { if (!isShowRunRedLight) {
isShowRunRedLight = true isShowRunRedLight = true
@@ -594,7 +595,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} }
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次
if (HmiBuildConfig.isShowGreenWaveView) { if (FunctionBuildConfig.v2xMainSwitch && FunctionBuildConfig.v2nMainSwitch && HmiBuildConfig.isShowGreenWaveView) {
if (!isShowGreenWave) { if (!isShowGreenWave) {
isShowGreenWave = true isShowGreenWave = true
CallerLogger.d( CallerLogger.d(
@@ -602,14 +603,14 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" "MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
) )
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6) var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6) val maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
if (minSpeedTemp == maxSpeedTemp) { if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5 minSpeedTemp -= 5
} }
val maxSpeed = currentLight.suggestMaxSpeed val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) { if (maxSpeed > 0) {
var currentSpeed = val currentSpeed =
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed.toDouble() CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed.toDouble()
if (currentSpeed > 0) { if (currentSpeed > 0) {
ttsContentNew = ttsContentNew =

View File

@@ -346,7 +346,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* 红绿灯预警信息 CvxIvpThreatIndInfo * 红绿灯预警信息 CvxIvpThreatIndInfo
*/ */
override fun onObuSpatWarning(data: ObuScene.SpatWarningData) { override fun onObuSpatWarning(data: ObuScene.SpatWarningData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
handlerTrafficLight( handlerTrafficLight(
data.warningType, data.warningType,
data.status, data.status,
@@ -359,7 +359,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* RSI预警信息 onMogoObuRsiWarning交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等 * RSI预警信息 onMogoObuRsiWarning交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/ */
override fun onObuRsiWarning(data: ObuScene.RsiWarningData) { override fun onObuRsiWarning(data: ObuScene.RsiWarningData) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
if (data.warningMsgList != null && data.warningMsgList.size > 0) { if (data.warningMsgList != null && data.warningMsgList.size > 0) {
var alertContent = "" var alertContent = ""
var ttsContent = "" var ttsContent = ""
@@ -632,7 +632,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRsmWarning ------> ${data?.toString()}" "onMogoObuRsmWarning ------> ${data?.toString()}"
) )
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) { if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (data != null && data.participant != null) { if (data != null && data.participant != null) {
@@ -725,7 +725,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道 * 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/ */
override fun onObuMapMath(data: ObuScene.MapMatchData?) { override fun onObuMapMath(data: ObuScene.MapMatchData?) {
if (HmiBuildConfig.isShowObuV2iView) { if (FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView) {
if (data != null) { if (data != null) {
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
@@ -1042,7 +1042,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
} }
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if(HmiBuildConfig.isShowObuV2iView){ if(FunctionBuildConfig.v2xMainSwitch && HmiBuildConfig.isShowObuV2iView){
if (HmiBuildConfig.isShowRunRedLightView) { if (HmiBuildConfig.isShowRunRedLightView) {
if (!isShowRunRedLight) { if (!isShowRunRedLight) {
isShowRunRedLight = true isShowRunRedLight = true

View File

@@ -96,10 +96,12 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
//已上报 //已上报
holder.tvBagReportStatus.text = "已上报" holder.tvBagReportStatus.text = "已上报"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg) holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg)
holder.tvBagReportStatus.isClickable = false
}else{ }else{
//未上报 //未上报
holder.tvBagReportStatus.text = "上报" holder.tvBagReportStatus.text = "上报"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg) holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg)
holder.tvBagReportStatus.isClickable = true
holder.tvBagReportStatus.setOnClickListener { holder.tvBagReportStatus.setOnClickListener {
bagClickListener?.uploadBI(bagInfoEntity) bagClickListener?.uploadBI(bagInfoEntity)
} }
@@ -127,11 +129,15 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
holder.tvBagSize.text = "${bagSize}G" holder.tvBagSize.text = "${bagSize}G"
//时间 //时间
bagInfoEntity.timestamp?.let { time-> bagInfoEntity.timestamp.let { time->
val hour = time.substring(8,10) try {
val min = time.substring(10,12) val hour = time.substring(8,10)
val second = time.substring(12,14) val min = time.substring(10,12)
holder.tvBagTime.text = "${hour}:${min}:${second}" val second = time.substring(12,14)
holder.tvBagTime.text = "${hour}:${min}:${second}"
}catch (e: Exception){
e.printStackTrace()
}
} }
} }
} }

View File

@@ -856,7 +856,22 @@ internal class DebugSettingView @JvmOverloads constructor(
//TODO //TODO
tbIsDrawPath.setOnCheckedChangeListener { _, isChecked -> tbIsDrawPath.setOnCheckedChangeListener { _, isChecked ->
ToastUtils.showShort("功能开发中")
}
if(FunctionBuildConfig.isDrawPointCloudData){
//如果点云效果是打开的,则自车光圈也跟随打开
tbCarAperture.isChecked = true
}else{
tbCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable
}
tbCarAperture.setOnCheckedChangeListener { compoundButton, isChecked ->
CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked)
CallerSopSettingManager.invokeCarApertureListener(isChecked)
if(!compoundButton.isPressed){
return@setOnCheckedChangeListener
}
FunctionBuildConfig.isDisplayAnimEnable = isChecked
} }
//初始化点云数据渲染情况 //初始化点云数据渲染情况
@@ -866,6 +881,12 @@ internal class DebugSettingView @JvmOverloads constructor(
if (!compoundButton.isPressed) { if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener return@setOnCheckedChangeListener
} }
//打开点云效果时,如果自车光圈是关闭状态,则自动打开自车光圈(点云是跟随光圈的 默认没有光圈就不显示点云的)
if(isChecked && !FunctionBuildConfig.isDisplayAnimEnable){
tbCarAperture.isChecked = true
}else{
tbCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable
}
CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked) CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked)
FunctionBuildConfig.isDrawPointCloudData = isChecked FunctionBuildConfig.isDrawPointCloudData = isChecked
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked) CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
@@ -2240,4 +2261,11 @@ internal class DebugSettingView @JvmOverloads constructor(
tbDrawPointCloudData.isChecked = status tbDrawPointCloudData.isChecked = status
} }
/**
* 自车光圈
*/
override fun onCarApertureClickEvent(status: Boolean) {
tbCarAperture.isChecked = status
}
} }

View File

@@ -390,6 +390,7 @@ internal class SOPSettingView @JvmOverloads constructor(
} }
scCarAperture.setOnCheckedChangeListener { compoundButton, isChecked -> scCarAperture.setOnCheckedChangeListener { compoundButton, isChecked ->
CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked) CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked)
CallerSopSettingManager.invokeCarApertureListener(isChecked)
hmiAction("SOP 是否展示自车光圈,",isChecked) hmiAction("SOP 是否展示自车光圈,",isChecked)
Log.i(TAG,"SOP 是否展示自车光圈,$isChecked") Log.i(TAG,"SOP 是否展示自车光圈,$isChecked")
if(!compoundButton.isPressed){ if(!compoundButton.isPressed){
@@ -768,6 +769,10 @@ internal class SOPSettingView @JvmOverloads constructor(
scDrawPointCloudData.isChecked = status scDrawPointCloudData.isChecked = status
} }
override fun onCarApertureClickEvent(status: Boolean) {
scCarAperture.isChecked = status
}
/** /**
* 工控机配置参数获取 * 工控机配置参数获取
*/ */

View File

@@ -1775,6 +1775,22 @@
app:layout_constraintRight_toRightOf="@id/tbIsDrawAutopilotTrajectoryData" app:layout_constraintRight_toRightOf="@id/tbIsDrawAutopilotTrajectoryData"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawAutopilotTrajectoryData" /> app:layout_constraintTop_toBottomOf="@id/tbIsDrawAutopilotTrajectoryData" />
<ToggleButton
android:id="@+id/tbCarAperture"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:padding="@dimen/dp_20"
android:textColor="#000"
android:textOff="开启自车光圈"
android:textOn="关闭自车光圈"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/tbChangeAutoPilotStatus"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawAutopilotTrajectoryData"
/>
<ToggleButton <ToggleButton
android:id="@+id/tbDrawPointCloudData" android:id="@+id/tbDrawPointCloudData"
android:layout_width="0dp" android:layout_width="0dp"
@@ -1785,9 +1801,10 @@
android:textOff="开启渲染点云数据" android:textOff="开启渲染点云数据"
android:textOn="关闭渲染点云数据" android:textOn="关闭渲染点云数据"
android:textSize="@dimen/dp_24" android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/tbChangeAutoPilotStatus" app:layout_constraintLeft_toLeftOf="@id/tbChangeAutoPilotStatus"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="@id/tbChangeAutoPilotStatus"
app:layout_constraintTop_toBottomOf="@id/tbIsDrawAutopilotTrajectoryData" /> app:layout_constraintTop_toBottomOf="@id/tbChangeAutoPilotStatus"
/>
<Button <Button
android:id="@+id/btnPointCloudSize" android:id="@+id/btnPointCloudSize"

View File

@@ -20,4 +20,9 @@ interface ISopSettingListener {
*/ */
fun onPointCloudClickEvent(status: Boolean){} fun onPointCloudClickEvent(status: Boolean){}
/**
* 自车光圈
*/
fun onCarApertureClickEvent(status: Boolean){}
} }

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.call.autopilot package com.mogo.eagle.core.function.call.autopilot
import android.util.Log
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
@@ -18,7 +17,6 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
init { init {
isAutopilotAbility = false isAutopilotAbility = false
unableAutopilotReasons = disconnectedReason() unableAutopilotReasons = disconnectedReason()
// printLog("初始化")
} }
private fun disconnectedReason(): ArrayList<UnableLaunchReason> { private fun disconnectedReason(): ArrayList<UnableLaunchReason> {
@@ -54,7 +52,6 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
this.isAutopilotAbility = isConnected this.isAutopilotAbility = isConnected
unableAutopilotReasons = if (isConnected) null else disconnectedReason() unableAutopilotReasons = if (isConnected) null else disconnectedReason()
notification() notification()
// printLog("更新数据 连接状态变更")
} }
} }
@@ -62,9 +59,6 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
fun invokeAutopilotAbility( fun invokeAutopilotAbility(
isAutopilotAbility: Boolean, unableAutopilotReasons: ArrayList<UnableLaunchReason>? isAutopilotAbility: Boolean, unableAutopilotReasons: ArrayList<UnableLaunchReason>?
) { ) {
Log.i(
"xfk",
"CallerAutopilotActionsListenerManager invokeAutopilotAbility=${CallerAutopilotActionsListenerManager.isAutopilotAbility} ${(if (CallerAutopilotActionsListenerManager.unableAutopilotReasons == null) null else CallerAutopilotActionsListenerManager.unableAutopilotReasons.toString())}")
if (isConnected) { if (isConnected) {
var isEquals: Boolean = true var isEquals: Boolean = true
if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) { if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) {
@@ -73,41 +67,22 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
this.unableAutopilotReasons?.let { old -> this.unableAutopilotReasons?.let { old ->
old.sortWith(compareBy(UnableLaunchReason::hashCode)); old.sortWith(compareBy(UnableLaunchReason::hashCode));
isEquals = onw.toTypedArray() contentEquals old.toTypedArray() isEquals = onw.toTypedArray() contentEquals old.toTypedArray()
// Log.i(
// "ddd",
// "都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}"
// )
} }
} }
} else isEquals = } else isEquals =
!(unableAutopilotReasons != null || this.unableAutopilotReasons != null) !(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
// Log.i(
// "ddd",
// " 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}"
// )
if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) { if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
this.isAutopilotAbility = isAutopilotAbility this.isAutopilotAbility = isAutopilotAbility
this.unableAutopilotReasons = unableAutopilotReasons this.unableAutopilotReasons = unableAutopilotReasons
notification() notification()
// printLog("更新数据")
} }
} }
} }
private fun notification() { private fun notification() {
Log.i(
"xfk",
"CallerAutopilotActionsListenerManager 通知=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}")
M_LISTENERS.forEach { M_LISTENERS.forEach {
val listener = it.value val listener = it.value
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons) listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons)
} }
} }
// fun printLog(tag: String) {
// Log.i(
// "xfk",
// "${tag}=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}"
// )
// }
} }

View File

@@ -38,4 +38,14 @@ object CallerSopSettingManager: CallerBase<ISopSettingListener>() {
} }
} }
/**
* 触发自车光圈事件监听
*/
fun invokeCarApertureListener(status: Boolean){
M_LISTENERS.forEach {
val listener = it.value
listener.onCarApertureClickEvent(status)
}
}
} }