[sweeper运营&云控合并]feat: 增加运营面板的控制开关以及业务模式切换逻辑;feat:修改版本号V6.1.0;feat:增加业务模式切换的埋点;

This commit is contained in:
aibingbing
2023-10-30 20:38:35 +08:00
parent 65a9d7cdb5
commit 6aa424c34e
16 changed files with 568 additions and 184 deletions

View File

@@ -1,49 +1,67 @@
package com.mogo.och.sweeper;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
import android.annotation.SuppressLint;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.vehicle.IMoGoSweeperModeListener;
import com.mogo.eagle.core.function.call.vehicle.CallerSweeperModeListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils;
import com.mogo.eagle.core.utilcode.util.AppUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.sweeper.cloud.fragment.SweeperCloudFragment;
import com.mogo.och.sweeper.common.constant.SweeperConst;
import com.mogo.och.sweeper.common.database.MyDataBase;
import com.mogo.och.sweeper.common.util.SweeperAnalyticsManager;
import com.mogo.och.sweeper.operate.fragment.SweeperOperateFragment;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/**
* 清扫车业务实现入口
*
* @author tongchenfei
*/
@Route(path = SweeperConst.PATH)
public class SweeperProvider implements IMogoOCH {
public class SweeperProvider implements IMogoOCH, IMoGoSweeperModeListener {
private static final String TAG = "SweeperProvider";
private SweeperOperateFragment sweeperOperateFragment;
private SweeperCloudFragment sweeperCloudFragment;
private int containerId;
private FragmentActivity activity;
@Override
public void init(Context context) {
}
private void showFragment() {
private void showOperateFragment() {
FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
if (sweeperOperateFragment == null) {
CallerLogger.d(TAG, "准备add fragment======");
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(sweeperOperateFragment.TAG);
if (fragmentByTag instanceof SweeperCloudFragment) {
if (fragmentByTag instanceof SweeperOperateFragment) {
sweeperOperateFragment = (SweeperOperateFragment) fragmentByTag;
} else {
sweeperOperateFragment = new SweeperOperateFragment();
}
if(!sweeperOperateFragment.isAdded()) {
if (!sweeperOperateFragment.isAdded()) {
supportFragmentManager.beginTransaction().add(containerId, sweeperOperateFragment, sweeperOperateFragment.TAG).commitAllowingStateLoss();
}
return;
@@ -51,17 +69,39 @@ public class SweeperProvider implements IMogoOCH {
CallerLogger.d(TAG, "准备show fragment");
supportFragmentManager.beginTransaction().show(sweeperOperateFragment).commitAllowingStateLoss();
}
private void showCloudFragment() {
FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
if (sweeperCloudFragment == null) {
CallerLogger.d(TAG, "准备add fragment======");
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(sweeperCloudFragment.TAG);
if (fragmentByTag instanceof SweeperCloudFragment) {
sweeperCloudFragment = (SweeperCloudFragment) fragmentByTag;
} else {
sweeperCloudFragment = new SweeperCloudFragment();
}
if (!sweeperCloudFragment.isAdded()) {
supportFragmentManager.beginTransaction().add(containerId, sweeperCloudFragment, sweeperCloudFragment.TAG).commitAllowingStateLoss();
}
return;
}
CallerLogger.d(TAG, "准备show fragment");
supportFragmentManager.beginTransaction().show(sweeperCloudFragment).commitAllowingStateLoss();
}
private void hideFragment() {
if (sweeperOperateFragment != null) {
CallerLogger.d(TAG, "准备hide fragment");
CallerLogger.d(TAG, "准备hide operate fragment");
activity.getSupportFragmentManager().beginTransaction().hide(sweeperOperateFragment).commitAllowingStateLoss();
} else if (sweeperCloudFragment != null) {
CallerLogger.d(TAG, "准备hide cloud fragment");
activity.getSupportFragmentManager().beginTransaction().hide(sweeperCloudFragment).commitAllowingStateLoss();
}
CallerSweeperModeListenerManager.INSTANCE.removeListener(TAG);
}
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
}
@NotNull
@@ -75,14 +115,61 @@ public class SweeperProvider implements IMogoOCH {
public Fragment createCoverage(@Nullable FragmentActivity fragmentActivity, @Nullable Integer integer) {
this.containerId = integer;
this.activity = fragmentActivity;
showFragment();
// 第一优先级SP中缓存的当前模式用户切换后会在SP中写入当前模式切换完后清除因为现在产品确认还不需要每次启动时首先使用用户上次选择的模式目前优先还是使用gradle中默认配置的模式打开
// 第二优先级gradle中默认配置的当前模式用户不进行切换时SP中没有配置默认使用的gradle中默认当前模式
CallerLogger.i(M_SWEEPER + TAG, "清扫车启动当前业务模式isSPCurrentSweeperOperateMode="
+ SweeperVehicleConfigUtils.isSPCurrentSweeperOperateMode()
+ ", isSPCurrentSweeperCloudMode=" + SweeperVehicleConfigUtils.isSPCurrentSweeperCloudMode());
if (SweeperVehicleConfigUtils.isSPCurrentSweeperOperateMode()) {
showOperateFragment();
} else if (SweeperVehicleConfigUtils.isSPCurrentSweeperCloudMode()) {
showCloudFragment();
} else if (SweeperVehicleConfigUtils.isDefaultSweeperOperateMode(FunctionBuildConfig.sweeperDefaultMode)) {
showOperateFragment();
} else if (SweeperVehicleConfigUtils.isDefaultSweeperCloudMode(FunctionBuildConfig.sweeperDefaultMode)) {
showCloudFragment();
} else {
// 默认云控模式
showCloudFragment();
}
CallerSweeperModeListenerManager.INSTANCE.addListener(TAG, this);
return null;
}
@Override
public void onDestroy() {
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
if (activity == null) return;
activity.finish();
}
@SuppressLint("CheckResult")
@Override
public void onSweeperCurrentModeChanged(@NonNull String currentMode) {
// 日志、埋点
CallerLogger.i(M_SWEEPER + TAG, "切换清扫车业务模式,当前切换的模式:" + currentMode);
SweeperAnalyticsManager.getInstance().trackSweeperModeChangeEvent(currentMode);
Observable.just(currentMode)
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
// 写入SP当前模式
SweeperVehicleConfigUtils.setSPCurrentSweeperMode(currentMode);
// 清除本地业务缓存数据
MyDataBase.getInstance().getWeltDataDao().deleteAllWeltData();
// 等清除完数据库数据后重启App
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
AppUtils.relaunchApp(true);
}
}, 1000L);
}
});
}
}

View File

@@ -53,7 +53,7 @@ import kotlinx.coroutines.launch
class SweeperCloudFragment : BaseSweeperCloudTabFragment<SweeperCloudFragment?, SweeperCloudPresenter?>() {
companion object {
const val TAG = "SweeperFragment"
const val TAG = "SweeperCloudFragment"
}
private var mSubMutableList: MutableList<SubTaskInfo>? = null

View File

@@ -54,6 +54,10 @@ class SweeperConst {
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_bus_ap_unable_start_reason"
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
// 埋点Key: 切换清扫业务模式
const val EVENT_KEY_CHANGE_CURRENT_SWEEPER_MODE = "event_key_och_change_current_sweeper_mode"
const val EVENT_PARAM_CHANGE_CURRENT_SWEEPER_MODE_CURRENT_MODE = "event_param_och_change_current_sweeper_mode_current_mode"
/**
* 子任务起终点Marker类型
*/

View File

@@ -146,4 +146,10 @@ public class SweeperAnalyticsManager {
params.put(SweeperConst.EVENT_PARAM_UNABLE_START_REASON, reason);
MogoAnalyticUtils.INSTANCE.track(SweeperConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
}
public void trackSweeperModeChangeEvent(String currentMode) {
HashMap<String, Object> params = new HashMap<>();
params.put(SweeperConst.EVENT_PARAM_CHANGE_CURRENT_SWEEPER_MODE_CURRENT_MODE, currentMode);
MogoAnalyticUtils.INSTANCE.track(SweeperConst.EVENT_KEY_CHANGE_CURRENT_SWEEPER_MODE, params);
}
}

View File

@@ -42,7 +42,7 @@ import kotlin.math.roundToInt
class SweeperOperateFragment : BaseSweeperOperateTabFragment<SweeperOperateFragment?, SweeperOperatePresenter?>(), MenuPopWindow.OnMenuItemOnClickListener {
companion object {
const val TAG = "SweeperFragment"
const val TAG = "SweeperOperateFragment"
}
private var mAdapter: TaskListAdapter? = null

View File

@@ -30,7 +30,7 @@ project.dependencies {
} else if (isCurrentDriver("sweeperOperate")) {
implementation project.project(':OCH:sweeper:driver')
} else if (isCurrentDriver("sweeperCloud")) {
implementation project.project('OCH:sweeper:driver')
implementation project.project(':OCH:sweeper:driver')
} else if (isCurrentDriver("taxiunmanned")) {
implementation project.project(':OCH:taxi:unmanned-driver')
} else if (isCurrentPassenger("taxiunmanned")) {

View File

@@ -14,40 +14,79 @@ import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.autopilot.IMoGoGetParamResponseListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.mofang.*
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN
import com.mogo.eagle.core.function.api.setting.ISopSettingListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotGetParamResponseDispatcher
import com.mogo.eagle.core.function.call.devatools.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.vehicle.CallerSweeperModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog
import com.mogo.eagle.core.function.hmi.ui.tools.SweeperModeChangedConfirmDialog
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo.adas.data.bean.AdasParam
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.btnSpeedSet
import kotlinx.android.synthetic.main.view_sop_setting.view.ivSpeedAdd
import kotlinx.android.synthetic.main.view_sop_setting.view.ivSpeedReduce
import kotlinx.android.synthetic.main.view_sop_setting.view.mfStatusLayout
import kotlinx.android.synthetic.main.view_sop_setting.view.mfTest
import kotlinx.android.synthetic.main.view_sop_setting.view.rgFusionMode
import kotlinx.android.synthetic.main.view_sop_setting.view.scCarAperture
import kotlinx.android.synthetic.main.view_sop_setting.view.scDemoMode
import kotlinx.android.synthetic.main.view_sop_setting.view.scDrawPointCloudData
import kotlinx.android.synthetic.main.view_sop_setting.view.scFaultSlowDown
import kotlinx.android.synthetic.main.view_sop_setting.view.scGreenWaveSop
import kotlinx.android.synthetic.main.view_sop_setting.view.scIPCReport
import kotlinx.android.synthetic.main.view_sop_setting.view.scMarkingObstacles
import kotlinx.android.synthetic.main.view_sop_setting.view.scNew360LookAround
import kotlinx.android.synthetic.main.view_sop_setting.view.scNewV2NData
import kotlinx.android.synthetic.main.view_sop_setting.view.scObstacleAvoidance
import kotlinx.android.synthetic.main.view_sop_setting.view.scObu
import kotlinx.android.synthetic.main.view_sop_setting.view.scObuV2vView
import kotlinx.android.synthetic.main.view_sop_setting.view.scObuWeaknessTrafficSop
import kotlinx.android.synthetic.main.view_sop_setting.view.scRainMode
import kotlinx.android.synthetic.main.view_sop_setting.view.scRouteDynamicEffect
import kotlinx.android.synthetic.main.view_sop_setting.view.scRunRedLightSop
import kotlinx.android.synthetic.main.view_sop_setting.view.scShowBagRecordWindow
import kotlinx.android.synthetic.main.view_sop_setting.view.scSpeedLimit
import kotlinx.android.synthetic.main.view_sop_setting.view.scSweeperModeSwitch
import kotlinx.android.synthetic.main.view_sop_setting.view.scTrafficLight
import kotlinx.android.synthetic.main.view_sop_setting.view.scV2ISwitch
import kotlinx.android.synthetic.main.view_sop_setting.view.scV2NSwitch
import kotlinx.android.synthetic.main.view_sop_setting.view.scV2XSwitch
import kotlinx.android.synthetic.main.view_sop_setting.view.scV2iPnc
import kotlinx.android.synthetic.main.view_sop_setting.view.scV2nPnc
import kotlinx.android.synthetic.main.view_sop_setting.view.scWeakNetSlowDown
import kotlinx.android.synthetic.main.view_sop_setting.view.sopLayout
import kotlinx.android.synthetic.main.view_sop_setting.view.tvSpeed
import kotlinx.android.synthetic.main.view_sop_setting.view.tvSpeedThresholdTitle
import mogo.telematics.pad.MessagePad
/**
* SOP设置窗口
*/
internal class SOPSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsFuncConfigListener,
IViewControlListener, IMoGoMoFangProvider.OnMoFangStatusListener,
IMoGoGetParamResponseListener, ISopSettingListener {
IViewControlListener, IMoGoMoFangProvider.OnMoFangStatusListener,
IMoGoGetParamResponseListener, ISopSettingListener {
companion object {
const val TAG = "SOPSettingView"
@@ -64,7 +103,7 @@ internal class SOPSettingView @JvmOverloads constructor(
}
private fun initView() {
sopLayout.setOnClickListener { }
sopLayout.setOnClickListener { }
//V2X消息设置
v2xSetting()
//地图效果类设置
@@ -78,50 +117,50 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* V2X消息设置
*/
private fun v2xSetting(){
private fun v2xSetting() {
//V2X总开关
scV2XSwitch.isChecked = FunctionBuildConfig.v2xMainSwitch
scV2XSwitch.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.v2xMainSwitch = isChecked
hmiAction("SOP V2X总开关, ",isChecked)
Log.i(TAG,"SOP V2X总开关,$isChecked")
if(isChecked){
hmiAction("SOP V2X总开关, ", isChecked)
Log.i(TAG, "SOP V2X总开关,$isChecked")
if (isChecked) {
//V2N总开关
scV2NSwitch.isChecked = FunctionBuildConfig.v2nMainSwitch
hmiAction("SOP V2N总开关, ",FunctionBuildConfig.v2nMainSwitch)
Log.i(TAG,"SOP V2N总开关, ${FunctionBuildConfig.v2nMainSwitch}")
hmiAction("SOP V2N总开关, ", FunctionBuildConfig.v2nMainSwitch)
Log.i(TAG, "SOP V2N总开关, ${FunctionBuildConfig.v2nMainSwitch}")
//V2I总开关
scV2ISwitch.isChecked = HmiBuildConfig.isShowObuV2iView
hmiAction("SOP V2I总开关, ",HmiBuildConfig.isShowObuV2iView)
Log.i(TAG,"SOP V2I总开关, ${HmiBuildConfig.isShowObuV2iView}")
hmiAction("SOP V2I总开关, ", HmiBuildConfig.isShowObuV2iView)
Log.i(TAG, "SOP V2I总开关, ${HmiBuildConfig.isShowObuV2iView}")
//V2V总开关
scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView
hmiAction("SOP V2V总开关, ",HmiBuildConfig.isShowObuV2vView)
Log.i(TAG,"SOP V2V总开关, ${HmiBuildConfig.isShowObuV2vView}")
hmiAction("SOP V2V总开关, ", HmiBuildConfig.isShowObuV2vView)
Log.i(TAG, "SOP V2V总开关, ${HmiBuildConfig.isShowObuV2vView}")
//obu总开关
scObu.isChecked = obuConnectStatus
hmiAction("SOP obu总开关, ",obuConnectStatus)
Log.i(TAG,"SOP obu总开关, $obuConnectStatus")
if(obuConnectStatus){
hmiAction("SOP obu总开关, ", obuConnectStatus)
Log.i(TAG, "SOP obu总开关, $obuConnectStatus")
if (obuConnectStatus) {
CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP)
}
}else{
} else {
//V2N总开关
scV2NSwitch.isChecked = false
hmiAction("SOP V2N总开关, ",false)
Log.i(TAG,"SOP V2N总开关, false")
hmiAction("SOP V2N总开关, ", false)
Log.i(TAG, "SOP V2N总开关, false")
//V2I总开关
scV2ISwitch.isChecked = false
hmiAction("SOP V2I总开关, ",false)
Log.i(TAG,"SOP V2I总开关, false")
hmiAction("SOP V2I总开关, ", false)
Log.i(TAG, "SOP V2I总开关, false")
//V2V总开关
scObuV2vView.isChecked = false
hmiAction("SOP V2V总开关, ",false)
Log.i(TAG,"SOP V2V总开关, false")
hmiAction("SOP V2V总开关, ", false)
Log.i(TAG, "SOP V2V总开关, false")
//obu总开关
scObu.isChecked = false
hmiAction("SOP OBU控制总开关, ",false)
Log.i(TAG,"SOP OBU控制总开关, false")
hmiAction("SOP OBU控制总开关, ", false)
Log.i(TAG, "SOP OBU控制总开关, false")
//断开链接
CallerObuApiManager.disConnectObu()
}
@@ -141,41 +180,41 @@ internal class SOPSettingView @JvmOverloads constructor(
//绿波通行(默认关闭)
scGreenWaveSop.isEnabled = FunctionBuildConfig.v2nMainSwitch
scV2NSwitch.setOnCheckedChangeListener { compoundButton, isChecked ->
if(isChecked){
if (isChecked) {
//V2N新链路
scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",FunctionBuildConfig.isNewV2NData)
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App), ${FunctionBuildConfig.isNewV2NData}")
hmiAction("SOP 是否是V2N新链路(云->工控机->App)", FunctionBuildConfig.isNewV2NData)
Log.i(TAG, "SOP 是否是V2N新链路(云->工控机->App), ${FunctionBuildConfig.isNewV2NData}")
//V2N场景进PNC
scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc
hmiAction("SOP V2N场景进PNC, ",FunctionBuildConfig.isV2NPnc)
Log.i(TAG,"SOP V2N场景进PNC, ${FunctionBuildConfig.isV2NPnc}")
hmiAction("SOP V2N场景进PNC, ", FunctionBuildConfig.isV2NPnc)
Log.i(TAG, "SOP V2N场景进PNC, ${FunctionBuildConfig.isV2NPnc}")
CallerAutoPilotControlManager.sendV2nToPncCmd(FunctionBuildConfig.isV2NPnc)
//绿波通行
scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView
hmiAction("SOP obu绿波通行, ",HmiBuildConfig.isShowGreenWaveView)
Log.i(TAG,"SOP obu绿波通行, ${HmiBuildConfig.isShowGreenWaveView}")
hmiAction("SOP obu绿波通行, ", HmiBuildConfig.isShowGreenWaveView)
Log.i(TAG, "SOP obu绿波通行, ${HmiBuildConfig.isShowGreenWaveView}")
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray())
}else{
} else {
//V2N新链路
scNewV2NData.isChecked = false
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",false)
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App), false")
hmiAction("SOP 是否是V2N新链路(云->工控机->App)", false)
Log.i(TAG, "SOP 是否是V2N新链路(云->工控机->App), false")
//V2N场景进PNC
scV2nPnc.isChecked = false
hmiAction("SOP V2N场景进PNC, ",false)
Log.i(TAG,"SOP V2N场景进PNC, false")
hmiAction("SOP V2N场景进PNC, ", false)
Log.i(TAG, "SOP V2N场景进PNC, false")
CallerAutoPilotControlManager.sendV2nToPncCmd(false)
//绿波通行
scGreenWaveSop.isChecked = false
hmiAction("SOP obu绿波通行, ",false)
Log.i(TAG,"SOP obu绿波通行, false")
hmiAction("SOP obu绿波通行, ", false)
Log.i(TAG, "SOP obu绿波通行, false")
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "0".toByteArray())
}
scNewV2NData.isEnabled = isChecked
scV2nPnc.isEnabled = isChecked
scGreenWaveSop.isEnabled = isChecked
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
FunctionBuildConfig.v2nMainSwitch = isChecked
@@ -188,41 +227,41 @@ internal class SOPSettingView @JvmOverloads constructor(
scRunRedLightSop.isEnabled = HmiBuildConfig.isShowObuV2iView
scObuWeaknessTrafficSop.isEnabled = HmiBuildConfig.isShowObuV2iView
scV2ISwitch.setOnCheckedChangeListener { compoundButton, isChecked ->
if(isChecked){
if (isChecked) {
//V2I场景进PNC
scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc
hmiAction("SOP V2I场景进PNC, ",FunctionBuildConfig.isV2IPnc)
Log.i(TAG,"SOP V2I场景进PNC,${FunctionBuildConfig.isV2IPnc}")
hmiAction("SOP V2I场景进PNC, ", FunctionBuildConfig.isV2IPnc)
Log.i(TAG, "SOP V2I场景进PNC,${FunctionBuildConfig.isV2IPnc}")
CallerAutoPilotControlManager.sendV2iToPncCmd(FunctionBuildConfig.isV2IPnc)
//闯红灯预警
scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView
hmiAction("SOP obu闯红灯预警, ",HmiBuildConfig.isShowRunRedLightView)
Log.i(TAG,"SOP obu闯红灯预警, ${HmiBuildConfig.isShowRunRedLightView}")
hmiAction("SOP obu闯红灯预警, ", HmiBuildConfig.isShowRunRedLightView)
Log.i(TAG, "SOP obu闯红灯预警, ${HmiBuildConfig.isShowRunRedLightView}")
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray())
//路侧弱势交通参与者
scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
hmiAction("SOP obu弱势交通控制, ",HmiBuildConfig.isShowObuWeaknessTrafficView)
Log.i(TAG,"SOP obu弱势交通控制, ${HmiBuildConfig.isShowObuWeaknessTrafficView}")
}else{
hmiAction("SOP obu弱势交通控制, ", HmiBuildConfig.isShowObuWeaknessTrafficView)
Log.i(TAG, "SOP obu弱势交通控制, ${HmiBuildConfig.isShowObuWeaknessTrafficView}")
} else {
//V2I场景进PNC
scV2iPnc.isChecked = false
CallerAutoPilotControlManager.sendV2iToPncCmd(false)
hmiAction("SOP V2I场景进PNC, ",false)
Log.i(TAG,"SOP V2I场景进PNC, false")
hmiAction("SOP V2I场景进PNC, ", false)
Log.i(TAG, "SOP V2I场景进PNC, false")
//闯红灯预警
scRunRedLightSop.isChecked = false
hmiAction("SOP obu闯红灯预警, ",false)
Log.i(TAG,"SOP obu闯红灯预警, false")
hmiAction("SOP obu闯红灯预警, ", false)
Log.i(TAG, "SOP obu闯红灯预警, false")
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray())
//路侧弱势交通参与者
scObuWeaknessTrafficSop.isChecked = false
hmiAction("SOP obu弱势交通控制, ",false)
Log.i(TAG,"SOP obu弱势交通控制, false")
hmiAction("SOP obu弱势交通控制, ", false)
Log.i(TAG, "SOP obu弱势交通控制, false")
}
scV2iPnc.isEnabled = isChecked
scRunRedLightSop.isEnabled = isChecked
scObuWeaknessTrafficSop.isEnabled = isChecked
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
HmiBuildConfig.isShowObuV2iView = isChecked
@@ -231,22 +270,22 @@ internal class SOPSettingView @JvmOverloads constructor(
//V2N新链路
scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData
scNewV2NData.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP 是否是V2N新链路(云->工控机->App)",isChecked)
Log.i(TAG,"SOP 是否是V2N新链路(云->工控机->App) ${isChecked}")
hmiAction("SOP 是否是V2N新链路(云->工控机->App)", isChecked)
Log.i(TAG, "SOP 是否是V2N新链路(云->工控机->App) ${isChecked}")
FunctionBuildConfig.isNewV2NData = isChecked
}
//V2N场景进PNC
scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc
scV2nPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
if(!compoundButton.isPressed){
scV2nPnc.setOnCheckedChangeListener { compoundButton, isChecked ->
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP V2N场景进PNC, ",isChecked)
Log.i(TAG,"SOP V2N场景进PNC, $isChecked")
hmiAction("SOP V2N场景进PNC, ", isChecked)
Log.i(TAG, "SOP V2N场景进PNC, $isChecked")
CallerAutoPilotControlManager.sendV2nToPncCmd(isChecked)
FunctionBuildConfig.isV2NPnc = isChecked
}
@@ -254,11 +293,11 @@ internal class SOPSettingView @JvmOverloads constructor(
//绿波通行(默认关闭)
scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView
scGreenWaveSop.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP obu绿波通行, ",isChecked)
Log.i(TAG,"SOP obu绿波通行, $isChecked")
hmiAction("SOP obu绿波通行, ", isChecked)
Log.i(TAG, "SOP obu绿波通行, $isChecked")
HmiBuildConfig.isShowGreenWaveView = isChecked
if (HmiBuildConfig.isShowGreenWaveView) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray())
@@ -269,12 +308,12 @@ internal class SOPSettingView @JvmOverloads constructor(
//V2I场景进PNC
scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc
scV2iPnc.setOnCheckedChangeListener{ compoundButton, isChecked ->
if(!compoundButton.isPressed){
scV2iPnc.setOnCheckedChangeListener { compoundButton, isChecked ->
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP V2I场景进PNC, ",isChecked)
Log.i(TAG,"SOP V2I场景进PNC, $isChecked")
hmiAction("SOP V2I场景进PNC, ", isChecked)
Log.i(TAG, "SOP V2I场景进PNC, $isChecked")
CallerAutoPilotControlManager.sendV2iToPncCmd(isChecked)
FunctionBuildConfig.isV2IPnc = isChecked
}
@@ -282,11 +321,11 @@ internal class SOPSettingView @JvmOverloads constructor(
//闯红灯预警(默认关闭)
scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView
scRunRedLightSop.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP obu闯红灯预警, ",isChecked)
Log.i(TAG,"SOP obu闯红灯预警, $isChecked")
hmiAction("SOP obu闯红灯预警, ", isChecked)
Log.i(TAG, "SOP obu闯红灯预警, $isChecked")
HmiBuildConfig.isShowRunRedLightView = isChecked
if (HmiBuildConfig.isShowRunRedLightView) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray())
@@ -298,22 +337,22 @@ internal class SOPSettingView @JvmOverloads constructor(
//路侧弱势交通参与者(默认开启)
scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
scObuWeaknessTrafficSop.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP obu弱势交通控制, ",isChecked)
Log.i(TAG,"SOP obu弱势交通控制, $isChecked")
hmiAction("SOP obu弱势交通控制, ", isChecked)
Log.i(TAG, "SOP obu弱势交通控制, $isChecked")
HmiBuildConfig.isShowObuWeaknessTrafficView = isChecked
}
//V2V总开关(默认关闭)
scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView
scObuV2vView.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP obuV2V开关, ",isChecked)
Log.i(TAG,"SOP obuV2V开关, $isChecked")
hmiAction("SOP obuV2V开关, ", isChecked)
Log.i(TAG, "SOP obuV2V开关, $isChecked")
HmiBuildConfig.isShowObuV2vView = isChecked
}
@@ -321,11 +360,11 @@ internal class SOPSettingView @JvmOverloads constructor(
obuConnectStatus = CallerObuApiManager.isConnected()
scObu.isChecked = obuConnectStatus
scObu.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP OBU控制总开关, ",isChecked)
Log.i(TAG,"SOP OBU控制总开关, $isChecked")
hmiAction("SOP OBU控制总开关, ", isChecked)
Log.i(TAG, "SOP OBU控制总开关, $isChecked")
if (isChecked) {
CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP)
} else {
@@ -339,12 +378,12 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* 地图效果类设置
*/
private fun mapSetting(){
private fun mapSetting() {
//危险障碍物颜色标记开关
scMarkingObstacles.isChecked = FunctionBuildConfig.isPNCWarning
scMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 危险障碍物颜色标记开关, ",isChecked)
Log.i(TAG,"SOP 危险障碍物颜色标记开关, $isChecked")
hmiAction("SOP 危险障碍物颜色标记开关, ", isChecked)
Log.i(TAG, "SOP 危险障碍物颜色标记开关, $isChecked")
FunctionBuildConfig.isPNCWarning = isChecked
}
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
@@ -354,8 +393,8 @@ internal class SOPSettingView @JvmOverloads constructor(
//引导线动态效果
scRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy
scRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 引导线动态效果, ",isChecked)
Log.i(TAG,"SOP 引导线动态效果, $isChecked")
hmiAction("SOP 引导线动态效果, ", isChecked)
Log.i(TAG, "SOP 引导线动态效果, $isChecked")
HmiBuildConfig.isShowRouteStrategy = isChecked
}
@@ -364,40 +403,40 @@ internal class SOPSettingView @JvmOverloads constructor(
scDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData
//是否渲染点云数据
scDrawPointCloudData.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
//打开点云效果时,如果自车光圈是关闭状态,则自动打开自车光圈(点云是跟随光圈的 默认没有光圈就不显示点云的)
if(isChecked && !FunctionBuildConfig.isDisplayAnimEnable){
if (isChecked && !FunctionBuildConfig.isDisplayAnimEnable) {
scCarAperture.isChecked = true
}else{
} else {
scCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable
}
CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked)
FunctionBuildConfig.isDrawPointCloudData = isChecked
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
CallerSopSettingManager.invokePointCloudListener(isChecked)
hmiAction("SOP 是否渲染点云数据, ",isChecked)
Log.i(TAG,"SOP 是否渲染点云数据, $isChecked")
hmiAction("SOP 是否渲染点云数据, ", isChecked)
Log.i(TAG, "SOP 是否渲染点云数据, $isChecked")
}
//自车光圈
if(FunctionBuildConfig.isDrawPointCloudData){
if (FunctionBuildConfig.isDrawPointCloudData) {
//如果点云效果是打开的,则自车光圈也跟随打开
FunctionBuildConfig.isDisplayAnimEnable = true
scCarAperture.isChecked = true
CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(true)
hmiAction("SOP 是否展示自车光圈,",FunctionBuildConfig.isDisplayAnimEnable)
Log.i(TAG,"SOP 是否展示自车光圈,${FunctionBuildConfig.isDisplayAnimEnable}")
}else{
hmiAction("SOP 是否展示自车光圈,", FunctionBuildConfig.isDisplayAnimEnable)
Log.i(TAG, "SOP 是否展示自车光圈,${FunctionBuildConfig.isDisplayAnimEnable}")
} else {
scCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable
}
scCarAperture.setOnCheckedChangeListener { compoundButton, isChecked ->
CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked)
CallerSopSettingManager.invokeCarApertureListener(isChecked)
hmiAction("SOP 是否展示自车光圈,",isChecked)
Log.i(TAG,"SOP 是否展示自车光圈,$isChecked")
if(!compoundButton.isPressed){
hmiAction("SOP 是否展示自车光圈,", isChecked)
Log.i(TAG, "SOP 是否展示自车光圈,$isChecked")
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
FunctionBuildConfig.isDisplayAnimEnable = isChecked
@@ -407,12 +446,12 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* 与车相关类设置
*/
private fun vehicleSetting(){
private fun vehicleSetting() {
//绕障类功能
scObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
scObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 绕障类功能开关, ",isChecked)
Log.i(TAG,"SOP 绕障类功能开关, $isChecked")
hmiAction("SOP 绕障类功能开关, ", isChecked)
Log.i(TAG, "SOP 绕障类功能开关, $isChecked")
CallerAutoPilotControlManager.sendDetouring(isChecked)
FunctionBuildConfig.isDetouring = isChecked
}
@@ -420,11 +459,11 @@ internal class SOPSettingView @JvmOverloads constructor(
// 演示模式,上一次勾选的数据
scDemoMode.isChecked = FunctionBuildConfig.isDemoMode
scDemoMode.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP 演示模式开关, ",!FunctionBuildConfig.isDemoMode)
Log.i(TAG,"SOP 演示模式开关, ${!FunctionBuildConfig.isDemoMode}")
hmiAction("SOP 演示模式开关, ", !FunctionBuildConfig.isDemoMode)
Log.i(TAG, "SOP 演示模式开关, ${!FunctionBuildConfig.isDemoMode}")
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_DEMO, FunctionBuildConfig.isDemoMode)
@@ -442,11 +481,11 @@ internal class SOPSettingView @JvmOverloads constructor(
// 雨天模式,上一次勾选的数据
scRainMode.isChecked = FunctionBuildConfig.isRainMode
scRainMode.setOnCheckedChangeListener { compoundButton, isChecked ->
if(!compoundButton.isPressed){
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
hmiAction("SOP 雨天模式开关, ",isChecked)
Log.i(TAG,"SOP 雨天模式开关, $isChecked")
hmiAction("SOP 雨天模式开关, ", isChecked)
Log.i(TAG, "SOP 雨天模式开关, $isChecked")
FunctionBuildConfig.isRainMode = isChecked
CallerAutoPilotControlManager.setRainMode(isChecked)
CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_RAIN, isChecked)
@@ -459,47 +498,47 @@ internal class SOPSettingView @JvmOverloads constructor(
//弱网减速停车
scWeakNetSlowDown.isChecked = FunctionBuildConfig.isWeakNetSlowDown
scWeakNetSlowDown.setOnCheckedChangeListener{_, isChecked ->
scWeakNetSlowDown.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isWeakNetSlowDown = isChecked
CallerAutoPilotControlManager.sendWeakNetSlowDown(isChecked)
hmiAction("SOP 弱网减速停车, ",isChecked)
Log.i(TAG,"SOP 弱网减速停车, $isChecked")
hmiAction("SOP 弱网减速停车, ", isChecked)
Log.i(TAG, "SOP 弱网减速停车, $isChecked")
}
//故障减速停车
scFaultSlowDown.isChecked = FunctionBuildConfig.isFaultSlowDown
scFaultSlowDown.setOnCheckedChangeListener{_, isChecked ->
scFaultSlowDown.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isFaultSlowDown = isChecked
CallerAutoPilotControlManager.sendBreakdownSlowDown(isChecked)
hmiAction("SOP 故障减速停车, ",isChecked)
Log.i(TAG,"SOP 故障减速停车, $isChecked")
hmiAction("SOP 故障减速停车, ", isChecked)
Log.i(TAG, "SOP 故障减速停车, $isChecked")
}
//融合模式
rgFusionMode.setOnCheckedChangeListener { _, p1 ->
when(p1){
when (p1) {
//全融合模式
R.id.rbFullIntegration ->{
R.id.rbFullIntegration -> {
FunctionBuildConfig.fusionMode = 1
}
//盲区模式
R.id.rbBlind ->{
R.id.rbBlind -> {
FunctionBuildConfig.fusionMode = 2
}
//超视距模式
R.id.rbBeyondSight ->{
R.id.rbBeyondSight -> {
FunctionBuildConfig.fusionMode = 3
}
//透传模式
R.id.rbTransparent ->{
R.id.rbTransparent -> {
FunctionBuildConfig.fusionMode = 4
}
//纯路侧模式
R.id.rbPureRoad ->{
R.id.rbPureRoad -> {
FunctionBuildConfig.fusionMode = 5
}
}
hmiAction("SOP 融合模式, ",FunctionBuildConfig.fusionMode)
Log.i(TAG,"SOP 融合模式, ${FunctionBuildConfig.fusionMode}")
hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode)
Log.i(TAG, "SOP 融合模式, ${FunctionBuildConfig.fusionMode}")
CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode)
}
}
@@ -507,12 +546,12 @@ internal class SOPSettingView @JvmOverloads constructor(
/**
* 其他类别开关设置
*/
private fun otherSetting(){
private fun otherSetting() {
//红绿灯标识开关
scTrafficLight.isChecked = !HmiBuildConfig.isShowTrafficLightView
scTrafficLight.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 红绿灯标识开关, ",isChecked)
Log.i(TAG,"SOP 红绿灯标识开关, $isChecked")
hmiAction("SOP 红绿灯标识开关, ", isChecked)
Log.i(TAG, "SOP 红绿灯标识开关, $isChecked")
if (isChecked) {
CallerHmiManager.showTrafficLightView()
} else {
@@ -523,22 +562,22 @@ internal class SOPSettingView @JvmOverloads constructor(
//限速标识
scSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
scSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 限速标识开关, ",isChecked)
Log.i(TAG,"SOP 限速标识开关, $isChecked")
hmiAction("SOP 限速标识开关, ", isChecked)
Log.i(TAG, "SOP 限速标识开关, $isChecked")
if (isChecked) {
HmiBuildConfig.isShowLimitingVelocityView = true
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.VISIBLE)
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG, View.VISIBLE)
} else {
HmiBuildConfig.isShowLimitingVelocityView = false
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE)
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG, View.GONE)
}
}
//异常上报提示
scIPCReport.isChecked = FunctionBuildConfig.isReportWarning
scIPCReport.setOnCheckedChangeListener { _, isChecked ->
hmiAction("SOP 是否开启异常上报, ",isChecked)
Log.i(TAG,"SOP 是否开启异常上报, $isChecked")
hmiAction("SOP 是否开启异常上报, ", isChecked)
Log.i(TAG, "SOP 是否开启异常上报, $isChecked")
FunctionBuildConfig.isReportWarning = isChecked
}
@@ -561,10 +600,52 @@ internal class SOPSettingView @JvmOverloads constructor(
//是否展示被动触发的录包弹窗(自动驾驶下出现问题触发的录包)
scShowBagRecordWindow.isChecked = FunctionBuildConfig.isShowBagRecordWindow
scShowBagRecordWindow.setOnCheckedChangeListener{_, isChecked ->
scShowBagRecordWindow.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isShowBagRecordWindow = isChecked
hmiAction("SOP 是否展示被动触发的录包弹窗, ",isChecked)
Log.i(TAG,"SOP 是否展示被动触发的录包弹窗, $isChecked")
hmiAction("SOP 是否展示被动触发的录包弹窗, ", isChecked)
Log.i(TAG, "SOP 是否展示被动触发的录包弹窗, $isChecked")
}
// 清扫车业务模式切换
scSweeperModeSwitch?.also { switchView ->
switchView.isChecked =
if (SweeperVehicleConfigUtils.isSPExistCurrentSweeperModeConfig())
SweeperVehicleConfigUtils.isSPCurrentSweeperCloudMode()
else
SweeperVehicleConfigUtils.isDefaultSweeperCloudMode(FunctionBuildConfig.sweeperDefaultMode)
if (!AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)) {
switchView.visibility = GONE
} else {
if (SweeperVehicleConfigUtils.isDefaultSweeperCanSwitchMode(FunctionBuildConfig.sweeperCanSwitchMode)) {
switchView.isEnabled = true
switchView.visibility = VISIBLE
switchView.setOnCheckedChangeListener { buttonView, isChecked ->
// isChecked==true 云控模式isChecked==false 运营模式
// 先弹框确认
if(!buttonView.isPressed) return@setOnCheckedChangeListener
context?.also { cxt ->
val confirmDialog = SweeperModeChangedConfirmDialog(cxt)
confirmDialog.setClickListener(object: SweeperModeChangedConfirmDialog.ClickListener {
override fun confirm() {
CallerSweeperModeListenerManager.invokeSweeperModeListeners(
if (isChecked) SweeperVehicleConfigUtils.BUSINESS_MODE_CLOUD
else SweeperVehicleConfigUtils.BUSINESS_MODE_OPERATE
)
}
override fun cancel() {
buttonView.isChecked = !isChecked
}
})
confirmDialog.showSweeperModeChangeConfirmDialog()
}
}
} else {
switchView.isEnabled = false
switchView.visibility = GONE
}
}
}
//变道绕障的目标障碍物速度阈值
@@ -576,7 +657,7 @@ internal class SOPSettingView @JvmOverloads constructor(
FunctionBuildConfig.detouringSpeed--
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
}
hmiAction("SOP 变道绕障的目标障碍物速度阈值",FunctionBuildConfig.detouringSpeed)
hmiAction("SOP 变道绕障的目标障碍物速度阈值", FunctionBuildConfig.detouringSpeed)
}
ivSpeedAdd.setOnClickListener {
if (FunctionBuildConfig.detouringSpeed >= 7) {
@@ -585,17 +666,17 @@ internal class SOPSettingView @JvmOverloads constructor(
FunctionBuildConfig.detouringSpeed++
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
}
hmiAction("SOP 变道绕障的目标障碍物速度阈值",FunctionBuildConfig.detouringSpeed)
hmiAction("SOP 变道绕障的目标障碍物速度阈值", FunctionBuildConfig.detouringSpeed)
}
btnSpeedSet.setOnClickListener {
val isSuccess =
CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
if (isSuccess == true) {
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功")
hmiAction("SOP 变道绕障的目标障碍物速度阈值设置","成功")
hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "成功")
} else {
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败")
hmiAction("SOP 变道绕障的目标障碍物速度阈值设置","失败")
hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "失败")
}
}
@@ -614,7 +695,7 @@ internal class SOPSettingView @JvmOverloads constructor(
val mf = CallerDevaToolsManager.mofang()
if (mf != null) {
mfStatusLayout.setClickEnabled(true)
mfStatusLayout.setClickedTextAndTag(if (mf.isConnected()) "断开魔方连接" else "开始连接魔方", if (mf.isConnected()) 0 else 1)
mfStatusLayout.setClickedTextAndTag(if (mf.isConnected()) "断开魔方连接" else "开始连接魔方", if (mf.isConnected()) 0 else 1)
mf.registerMoFangStatusListener(TAG, this)
mfStatusLayout.setOnClickCallback {
val tag = it.tag as? Int
@@ -659,22 +740,22 @@ internal class SOPSettingView @JvmOverloads constructor(
super.onAttachedToWindow()
//添加 业务配置监听
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(
FuncBizConfig.FOUNDATION, TAG, true, this
FuncBizConfig.FOUNDATION, TAG, true, this
)
CallerHmiViewControlListenerManager.addListener(TAG,this)
CallerHmiViewControlListenerManager.addListener(TAG, this)
CallerAutopilotGetParamResponseDispatcher.addListener(TAG, this)
//查询融合模式
CallerAutoPilotControlManager.sendGetParamReq(AdasConstants.MapSystemParamType.FUSION_MODE)
//雨天、美化、点云设置同步
CallerSopSettingManager.addListener(TAG,this)
CallerSopSettingManager.addListener(TAG, this)
}
override fun updateFuncMode(tag: String, boolean: Boolean) {
super.updateFuncMode(tag, boolean)
if(tag == FUNC_MODE_DEMO){
if (tag == FUNC_MODE_DEMO) {
scDemoMode.isChecked = FunctionBuildConfig.isDemoMode
}
if(tag == FUNC_MODE_RAIN){
if (tag == FUNC_MODE_RAIN) {
scRainMode.isChecked = FunctionBuildConfig.isRainMode
}
}
@@ -696,9 +777,9 @@ internal class SOPSettingView @JvmOverloads constructor(
//美化模式
FuncBizConfig.BIZ_BEAUTY_MODE -> {
scDemoMode.isClickable = !lock
if(lock){
if (lock) {
scDemoMode.visibility = View.INVISIBLE
}else{
} else {
scDemoMode.visibility = View.VISIBLE
}
}
@@ -781,31 +862,35 @@ internal class SOPSettingView @JvmOverloads constructor(
* 工控机配置参数获取
*/
override fun onGetParamResp(
header: MessagePad.Header,
getParamResp: MessagePad.SetParamReq,
adasParam: AdasParam
header: MessagePad.Header,
getParamResp: MessagePad.SetParamReq,
adasParam: AdasParam
) {
//融合模式
ThreadUtils.runOnUiThread {
FunctionBuildConfig.fusionMode = adasParam.fusionMode
when(FunctionBuildConfig.fusionMode){
1->{
when (FunctionBuildConfig.fusionMode) {
1 -> {
//全融合模式
rgFusionMode.check(R.id.rbFullIntegration)
}
2->{
2 -> {
//盲区模式
rgFusionMode.check(R.id.rbBlind)
}
3->{
3 -> {
//超视距模式
rgFusionMode.check(R.id.rbBeyondSight)
}
4->{
4 -> {
//透传模式
rgFusionMode.check(R.id.rbTransparent)
}
5->{
5 -> {
//纯路侧模式
rgFusionMode.check(R.id.rbPureRoad)
}

View File

@@ -0,0 +1,51 @@
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @author aibingbing
* @description 切换清扫车模式确认对话框
* @since: 2023/10/30
*/
class SweeperModeChangedConfirmDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
private var modeChangeBtnConfirm: TextView? = null
private var modeChangeBtnCancel: TextView? = null
private var clickListener: ClickListener? = null
init {
setContentView(R.layout.dialog_sweeper_mode_change)
setCanceledOnTouchOutside(true)
modeChangeBtnConfirm = findViewById(R.id.tv_sweeper_mode_change_confirm)
modeChangeBtnCancel = findViewById(R.id.tv_sweeper_mode_change_cancel)
modeChangeBtnConfirm?.setOnClickListener {
clickListener?.confirm()
dismiss()
}
modeChangeBtnCancel?.setOnClickListener {
clickListener?.cancel()
dismiss()
}
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
fun showSweeperModeChangeConfirmDialog() {
if (isShowing) {
return
}
show()
}
interface ClickListener {
fun confirm()
fun cancel()
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="840dp"
android:layout_height="470dp"
android:background="@color/dialog_bg_color"
app:roundLayoutRadius="32dp"
>
<TextView
android:id="@+id/tv_sweeper_mode_change_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/sweeper_mode_change_title"
android:textSize="56dp"
android:textColor="#FFFFFFFF"
android:layout_marginTop="50dp"
/>
<TextView
android:id="@+id/tv_sweeper_mode_change_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_sweeper_mode_change_title"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10"
android:text="@string/sweeper_mode_change_tips"
android:textColor="#FFFFFFFF"
android:textSize="43dp"
android:layout_marginTop="50dp"
/>
<View
android:id="@+id/view_horizontal_line"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_sweeper_mode_change_tips"
android:layout_marginTop="80dp"
/>
<View
android:id="@+id/view_vertical_line"
android:layout_width="3dp"
android:layout_height="0dp"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="@+id/tv_sweeper_mode_change_confirm"
android:layout_width="400dp"
android:layout_height="100dp"
android:text="@string/confirm"
android:textColor="#FFFFFFFF"
android:textSize="46dp"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/view_vertical_line"
/>
<TextView
android:id="@+id/tv_sweeper_mode_change_cancel"
android:layout_width="400dp"
android:layout_height="100dp"
android:text="@string/cancel"
android:textColor="#FFFFFFFF"
android:textSize="46dp"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/view_vertical_line"
app:layout_constraintRight_toRightOf="parent"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -588,6 +588,20 @@
android:layout_marginTop="@dimen/dp_25"
android:layout_marginBottom="@dimen/dp_10"
/>
<!--清扫和业务模式切换开关(开-云控,关-运营)-->
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/scSweeperModeSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/otherGuideLine"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/scNew360LookAround"
app:layout_constraintBottom_toBottomOf="parent"
android:text="清扫云控业务"
android:scaleY="1.2"
android:scaleX="1.2"
android:layout_marginTop="@dimen/dp_25"
android:layout_marginBottom="@dimen/dp_10"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -91,4 +91,7 @@
<string name="parallel_drive_synchronizing">同步中...</string>
<string name="parallel_drive_failure">请求失败</string>
<string name="parallel_drive_exception">异常</string>
<!--清扫车模式切换-->
<string name="sweeper_mode_change_title">清扫业务模式切换提示</string>
<string name="sweeper_mode_change_tips">请确认是否要切换清扫业务切换将自动重启APP?</string>
</resources>

View File

@@ -325,6 +325,6 @@ object FunctionBuildConfig {
*/
@Volatile
@JvmField
var sweeperCanSwitchMode = "true"
var sweeperCanSwitchMode = true
}

View File

@@ -0,0 +1,9 @@
package com.mogo.eagle.core.function.api.vehicle
/**
* 清扫车业务模式
*/
interface IMoGoSweeperModeListener {
fun onSweeperCurrentModeChanged(currentMode: String)
}

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.core.function.call.vehicle
import com.mogo.eagle.core.function.api.vehicle.IMoGoSweeperModeListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 清扫车业务模式 模式变化 监听管理类
*/
object CallerSweeperModeListenerManager : CallerBase<IMoGoSweeperModeListener>() {
fun invokeSweeperModeListeners(currentMode: String) {
CallerSweeperModeListenerManager.M_LISTENERS.forEach {
val listener = it.value
listener.onSweeperCurrentModeChanged(currentMode)
}
}
}

View File

@@ -7,14 +7,24 @@ import com.mogo.eagle.core.utilcode.util.SPUtils
*/
object SweeperVehicleConfigUtils {
// 业务模式(云控/运营)
private const val BUSINESS_MODE_OPERATE = "Operate"
private const val BUSINESS_MODE_CLOUD = "Cloud"
const val BUSINESS_MODE_OPERATE = "Operate"
const val BUSINESS_MODE_CLOUD = "Cloud"
// 本地存储SP key
private const val SP_KEY_SWEEPER_CURRENT_MODE = "key_sweeper_current_mode"
/**
* 是否 默认清扫车营运模式
* 是否 能切换清扫车业务模式
*
* @param sweeperCanSwitchMode productFlavors 配置的默认值
*/
@JvmStatic
fun isDefaultSweeperCanSwitchMode(sweeperCanSwitchMode: Boolean): Boolean {
return sweeperCanSwitchMode
}
/**
* 是否 默认清扫车运营模式
*
* @param sweeperDefaultMode productFlavors 配置的默认值
* @return true - 是默认清扫车运营模式 false - 不是默认清扫车运营模式
@@ -36,7 +46,7 @@ object SweeperVehicleConfigUtils {
}
/**
* 保存 当前清扫业务模式到SP
* 保存 当前用户选择的清扫业务模式到SP
*/
@JvmStatic
fun setSPCurrentSweeperMode(sweeperCurrentMode: String) {
@@ -44,7 +54,15 @@ object SweeperVehicleConfigUtils {
}
/**
* 是否SP中存在 当前清扫业务模式的配置
* 移除 当前用户选择的清扫业务模式到SP
*/
@JvmStatic
fun removeSPCurrentSweeperMode() {
SPUtils.getInstance().remove(SP_KEY_SWEEPER_CURRENT_MODE)
}
/**
* 是否SP中存在 当前用户选择的清扫业务模式的配置
*/
@JvmStatic
fun isSPExistCurrentSweeperModeConfig(): Boolean {
@@ -52,7 +70,7 @@ object SweeperVehicleConfigUtils {
}
/**
* 是否SP中 当前是运营业务模式
* 是否SP中 当前是用户选择的运营业务模式
*/
@JvmStatic
fun isSPCurrentSweeperOperateMode(): Boolean {
@@ -62,7 +80,7 @@ object SweeperVehicleConfigUtils {
}
/**
* 是否SP中 当前是云控业务模式
* 是否SP中 当前是用户选择的云控业务模式
*/
@JvmStatic
fun isSPCurrentSweeperCloudMode(): Boolean {

View File

@@ -173,6 +173,6 @@ CHARTER_DRIVER_VERSION=6.1.0
# 包车模式乘客端端版本号
CHARTER_PASSENGER_VERSION=5.1.0
# 支持云控清扫车模式司机端版本号
SWEEPERCLOUD_DRIVER_VERSION=3.2.0
SWEEPERCLOUD_DRIVER_VERSION=6.1.0
# 清扫车模式司机端版本号
SWEEPEROPERATE_DRIVER_VERSION=3.1.0
SWEEPEROPERATE_DRIVER_VERSION=6.1.0