diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 1368eae5ec..02e192cb3c 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -496,6 +496,29 @@ class MoGoAutopilotProvider : } } + /** + * 绕障类功能开关 + * isEnable = true 开启 + * isEnable = false 关闭 + * @return boolean + */ + override fun sendDetouring(isEnable: Boolean): Boolean { + return if(isEnable){ + AdasManager.getInstance().sendDetouring(1) + }else{ + AdasManager.getInstance().sendDetouring(0) + } + } + + /** + * 变道绕障的目标障碍物速度阈值 + * @param speed 速度阈值 m/s + * @return boolean + */ + override fun sendDetouringSpeed(speed: Double): Boolean { + return AdasManager.getInstance().sendDetouringSpeed(speed) + } + /** * 获取数据采集录制模式配置列表 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt new file mode 100644 index 0000000000..a9cb80c07c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -0,0 +1,159 @@ +package com.mogo.eagle.core.function.hmi.ui.setting + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.config.HmiBuildConfig +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.obu.CallerOBUManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.module.service.routeoverlay.RouteStrategy +import kotlinx.android.synthetic.main.view_sop_setting.view.* + +/** + * SOP设置窗口 + */ +class SOPSettingView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr){ + + init { + LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true) + initView() + } + + private fun initView() { + //绕障类功能开关 + tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring + tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.sendDetouring(isChecked) + FunctionBuildConfig.isDetouring = isChecked + } + + //危险障碍物颜色标记开关 + tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked -> + + } + + //引导线动态效果 + tbRouteDynamicEffect.isChecked = + AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus( + FunctionBuildConfig.appIdentityMode + ) + tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked -> + if (isChecked) { + RouteStrategy.enable(true) + } else { + RouteStrategy.enable(false) + } + } + + //红绿灯标识 + tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView + tbTrafficLight.setOnCheckedChangeListener { _, isChecked -> + if(!isChecked){ + HmiBuildConfig.isShowTrafficLightView = false + }else{ + HmiBuildConfig.isShowTrafficLightView = true + CallerHmiManager.disableWarningTrafficLight() + } + } + + //限速标识 + tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView + tbSpeedLimit.setOnCheckedChangeListener { _, isChecked -> + if(isChecked){ + HmiBuildConfig.isShowLimitingVelocityView = true + }else{ + HmiBuildConfig.isShowLimitingVelocityView = false + CallerHmiManager.disableLimitingVelocity() + } + } + + //自车感知到的他车碰撞预警 + tbCollisionWarning.setOnCheckedChangeListener { buttonView, isChecked -> + + } + + // 演示模式,上一次勾选的数据 + tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode + // 演示模式 + tbDemoMode.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.setDemoMode(isChecked) + if (!isChecked) { + //关闭美化模式时,通知工控机 + CallerAutoPilotManager.setIPCDemoMode(isChecked) + } + FunctionBuildConfig.isDemoMode = isChecked + } + //只在司机端设置美化模式开关功能 + if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + tbDemoMode.visibility = View.GONE + } + + + // 雨天模式,上一次勾选的数据 + tbRainMode.isChecked = FunctionBuildConfig.isRainMode + //雨天模式 + tbRainMode.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.setRainMode(isChecked) + FunctionBuildConfig.isRainMode = isChecked + } + //雨天模式按钮只在司机屏生效,乘客屏不显示 + if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + tbRainMode.visibility = View.GONE + } + + //OBU控制总开关 + tbObu.isChecked = CallerOBUManager.isConnected() + tbObu.setOnCheckedChangeListener { _, isChecked -> + if(!isChecked){ + if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ + CallerOBUManager.resetObuIpAddress("192.168.1.199") + }else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){ + CallerOBUManager.resetObuIpAddress("192.168.8.199") + } + }else{ + //断开链接 + CallerOBUManager.disConnectObu() + } + } + + //变道绕障的目标障碍物速度阈值 + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + ivSpeedReduce.setOnClickListener { + if(FunctionBuildConfig.detouringSpeed<=0){ + ToastUtils.showShort("阈值小可为0 m/s") + }else{ + FunctionBuildConfig.detouringSpeed-- + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + } + } + ivSpeedAdd.setOnClickListener { + if(FunctionBuildConfig.detouringSpeed>=7){ + ToastUtils.showShort("阈值最大可为7 m/s") + }else{ + FunctionBuildConfig.detouringSpeed++ + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + } + } + btnSpeedSet.setOnClickListener { + val isSuccess = CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble()) + if(isSuccess == true){ + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功") + }else{ + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败") + } + } + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png new file mode 100644 index 0000000000..429d1196be Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png new file mode 100644 index 0000000000..aa10f4b5de Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml new file mode 100644 index 0000000000..105f81a5cd --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +