diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index 9673c91ce4..83491d952f 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -42,6 +42,8 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu private View mBus; + private OchBusStation startStation = null; + private OchBusStation endStation = null; @Override public String getTagName() { @@ -163,8 +165,8 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu // 获取当前站点的名称 currentStationName = stationList.get( currentStation ).getName(); - OchBusStation startStation = stationList.get(0); - OchBusStation endStation = stationList.get(stationList.size() - 1); + startStation = stationList.get(0); + endStation = stationList.get(stationList.size() - 1); // 是否到达起点 if ( currentStation == 0 ) { @@ -278,6 +280,16 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu tvOperationStatus.setText("出车"); hideSlidePanel(); hidPanel(); + + //移除起点终点 + if (null != startStation){ + setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat() + ,startStation.getLon(),R.drawable.icon_station_start_end); + } + if (null != endStation){ + setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() + ,endStation.getLon(),R.drawable.icon_station_start_end); + } } } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java index 79b073f95a..28ffdba68d 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java @@ -600,6 +600,7 @@ public class OchBusOrderModel { if (FunctionBuildConfig.isDemoMode && ((currentStationIndex > 0 && currentStationIndex < stationList.size()-1) || (stationList.get(0).isLeaving() || stationList.get(stationList.size() -1).isLeaving()))){//行驶过程中设置美化 FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true; + Logger.d(TAG, "美化模式-ignore:置为true(每次滑动出发)"); } if (refreshBusStationsCallback != null){ if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态,展示当前站需要+1 @@ -748,6 +749,7 @@ public class OchBusOrderModel { } if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1){//到达最后一站结束美化 FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; + Logger.d(TAG, "美化模式-ignore:置为false(到最后一站)"); } Logger.d( TAG, "到站====currentStationIndex=" + currentStationIndex); isGoingToNextStation = false; diff --git a/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1440/dimens.xml b/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1440/dimens.xml index b03ae16ab8..0a257a4014 100644 --- a/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -90,7 +90,7 @@ 414px - 44px + 36px 13px 12px 350px diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java index 76cb5313d4..807eedf07a 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java @@ -748,6 +748,7 @@ public class MogoOCHTaxiModelNew { && mCurrentOCHOrder.orderStatus == OrderStatusEnum.OnTheWayToEndStation.getCode()) { // 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true; + Logger.d(TAG, "美化模式-ignore:置为true(更新本地order信息)"); } } @@ -758,6 +759,7 @@ public class MogoOCHTaxiModelNew { if (FunctionBuildConfig.isDemoMode) { // 当美化模式(演示模式)开启时: 取消或订单已完成时,置false FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; + Logger.d(TAG, "美化模式-ignore:置为false(清除当前订单)"); } } @@ -986,6 +988,7 @@ public class MogoOCHTaxiModelNew { if (FunctionBuildConfig.isDemoMode) { // 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true; + Logger.d(TAG, "美化模式-ignore:置为true(到达出发点且已开启自动驾驶)"); } } } else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) { diff --git a/app/productFlavors/fPadLenovo.gradle b/app/productFlavors/fPadLenovo.gradle index ef235a9a35..b4415802eb 100644 --- a/app/productFlavors/fPadLenovo.gradle +++ b/app/productFlavors/fPadLenovo.gradle @@ -27,7 +27,7 @@ project.android.productFlavors { buildConfigField 'int', 'GPS_PROVIDER', "1" // 构建的应用身份类型,司机|乘客 - buildConfigField 'int', 'APP_IDENTITY_MODE', "0x00" + buildConfigField 'int', 'APP_IDENTITY_MODE', "0x02" // 构建的是否是演示(美化)模式 buildConfigField 'boolean', 'IS_DEMO_MODE', 'true' } 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 cc208948d1..3a82d2a7ca 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 @@ -97,8 +97,8 @@ class MoGoAutopilotProvider : 0x01 -> // 乘客 { // 乘客端默认接收绘制全局路径+引导线 - FunctionBuildConfig.isDemoMode = true - FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true + //FunctionBuildConfig.isDemoMode = true + //FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true // "192.168.1.102" val options = AdasOptions.Builder().build() AdasManager.getInstance().create(context, options) @@ -302,4 +302,17 @@ class MoGoAutopilotProvider : AdasManager.getInstance().disableDemoMode() } } + + /** + * 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1 + * isEnable = true 开启 + * isEnable = false 关闭 + */ + override fun setControlAutopilotCarAuto(isEnable: Boolean) { + if (isEnable) { + AdasManager.getInstance().controlAutopilotCarAuto() + } else { + AdasManager.getInstance().controlAutopilotCarHead() + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.java index 8e44cbd6b4..32ad3ca42c 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.java @@ -366,9 +366,16 @@ public class MoGoAdasListenerImpl implements OnAdasListener { } } - + /** + * 命令返回结果 + * @param info 结果返回实体 + */ @Override public void onSSHResult(SSHResult info) { - + if(info!=null && "docker restart autocar_default_1".equals(info.cmd)){ + CallerHmiManager.INSTANCE.showDockerRebootResult(info.code, info.msg); + }else{ + Logger.d(TAG,"onSSHResult : result info is null"); + } } } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index c365e23c55..91731111c7 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -1,8 +1,11 @@ package com.mogo.eagle.core.function.autopilot.adapter import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.commons.debug.DebugConfig +import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo +import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager @@ -78,7 +81,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasMsgConnectStatusListener, IMo private fun syncBasicInfoToAutopilot() { Logger.d(TAG, "同步PAD的SN给工控机……") val info = BasicInfo() + // 设置PAD-SN给工控 info.setSn(MoGoAiCloudClientConfig.getInstance().sn) + // 设置网络环境 + info.setNetEnvironment(DebugConfig.getNetMode()) AdasManager.getInstance().setBasicInfo(info) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 624f268187..add5b96c1a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -348,6 +348,25 @@ class MoGoHmiFragment : MvpFragment onBadCaseHide = onHide } + /** + * 工控机重启返回结果 + * @param code + * @param msg + */ + override fun showDockerRebootResult(code: Int, msg: String) { + ThreadUtils.runOnUiThread{ + if(code>=-1){ + //重启成功 + ToastUtils.showShort("重启成功") + }else{ + //重启失败 + msg?.let { + ToastUtils.showShort(it) + } + } + } + } + private fun showBadCasesFloat(dismiss: (() -> Unit)?) { Log.d("QQQ", "showBadCaseToolsFloat") context?.let { it -> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 8fc44ed188..1773a6acc2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -18,14 +18,12 @@ import com.mogo.eagle.core.data.obu.ObuStatusInfo import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager +import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager @@ -57,7 +55,8 @@ class DebugSettingView @JvmOverloads constructor( defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, - IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener { + IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener, + IMoGoAutopilotPlanningListener { private val TAG = "DebugSettingView" @@ -67,6 +66,15 @@ class DebugSettingView @JvmOverloads constructor( private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null private var mAutoPilotCarStateInfo: AutopilotCarStateInfo? = null + // 感知识别数据个数 + private var mIdentifyDataSize = 0 + + // 引导线点个数 + private var mTrajectoryInfoSize = 0 + + // 全局路径规划点个数 + private var mRouteInfoSize = 0 + init { LayoutInflater.from(context).inflate(R.layout.view_debug_setting, this, true) initView() @@ -96,6 +104,8 @@ class DebugSettingView @JvmOverloads constructor( CallerMapLocationListenerManager.addListener(TAG, this) // 添加 域控制器感知数据 监听 CallerAutopilotIdentifyListenerManager.addListener(TAG, this) + // 添加 规划路径相关回调 监听 + CallerAutopilotPlanningListenerManager.addListener(TAG, this) if (logInfoView != null) { logInfoView!!.onEnterForeground() } @@ -115,6 +125,8 @@ class DebugSettingView @JvmOverloads constructor( CallerMapLocationListenerManager.removeListener(TAG) // 移除 域控制器感知数据 监听 CallerAutopilotIdentifyListenerManager.removeListener(TAG) + // 移除 规划路径相关回调 监听 + CallerAutopilotPlanningListenerManager.removeListener(TAG) if (logInfoView != null) { logInfoView!!.onEnterBackground() } @@ -287,11 +299,16 @@ class DebugSettingView @JvmOverloads constructor( CallerAutoPilotManager.setDemoMode(isChecked) FunctionBuildConfig.isDemoMode = isChecked if (!FunctionBuildConfig.isDemoMode) { - FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false + cbIsDrawAutopilotTrajectoryData.isChecked = false } SharedPrefsMgr.getInstance(context).putBoolean(MoGoConfig.IS_DEMO_MODE, isChecked) } + // 模拟自动驾驶中 + tbChangeAutoPilotStatus.setOnCheckedChangeListener { buttonView, isChecked -> + CallerAutoPilotManager.setControlAutopilotCarAuto(isChecked) + } + tbSelfLog.setOnCheckedChangeListener { buttonView, isChecked -> if (isChecked) { LogUtils.getConfig().isLogSwitch = false @@ -403,6 +420,18 @@ class DebugSettingView @JvmOverloads constructor( tvCarInfo.text = "GPS时间:${mAutoPilotCarStateInfo?.values?.satelliteTime}\n" + "自车经纬度:\n${mAutoPilotCarStateInfo?.values?.lon}\n${mAutoPilotCarStateInfo?.values?.lat}\n" + + tvIdentifyInfo.text = + "感知数据个数:${mIdentifyDataSize}" + tvTrajectoryInfoSize.text = + "引导线点个数:${mTrajectoryInfoSize}" + tvRouteInfoSize.text = + "全局路径规划点个数:${mRouteInfoSize}" + + // 用完之后重制为0,防止节点回掉突然没数据,导致页面显示还是之前的数据情况 + mIdentifyDataSize = 0 + mTrajectoryInfoSize = 0 + mRouteInfoSize = 0 } /** @@ -447,12 +476,7 @@ class DebugSettingView @JvmOverloads constructor( } override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { - UiThreadHandler.post { - tvAutopilotInfo.post { - tvIdentifyInfo.text = - "感知数据个数:${trafficData?.size}\n" - } - } + mIdentifyDataSize = trafficData?.size ?: 0 } override fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) { @@ -462,4 +486,12 @@ class DebugSettingView @JvmOverloads constructor( override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) { } + + override fun onAutopilotTrajectory(trajectoryInfos: ArrayList) { + mTrajectoryInfoSize = trajectoryInfos.size + } + + override fun onAutopilotRotting(routeList: AutopilotRouteInfo?) { + mRouteInfoSize = routeList?.models?.size ?: 0 + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt index 3679c1788f..8f7d97bdf1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt @@ -124,6 +124,7 @@ class AutoPilotAndCheckView @JvmOverloads constructor( fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int ,downloadVersion : String,upgradeStatus : Int){ systemVersionView?.showAdUpgradeStatus(upgradeMode,downloadStatus,currentProgress, totalProgress, downloadVersion, upgradeStatus) + checkSystemView?.setAdUpgradeStatus(downloadStatus, upgradeStatus) } override fun onAttachedToWindow() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt new file mode 100644 index 0000000000..be94fe594c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt @@ -0,0 +1,60 @@ +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.utilcode.mogo.logger.Logger +import com.mogo.module.common.dialog.BaseFloatDialog + +/** + * @author XuXinChao + * @description 重启自动驾驶docker确认对话框 + * @since: 2022/2/17 + */ +class DockerRebootDialog(context: Context): BaseFloatDialog(context), LifecycleObserver { + + companion object { + const val TAG = "DockerRebootDialog" + } + + private var rebootConfirm : TextView? = null + private var rebootCancel : TextView? = null + + private var clickListener: ClickListener? = null + + init{ + setContentView(R.layout.dialog_docker_reboot) + setCanceledOnTouchOutside(true) + rebootConfirm=findViewById(R.id.tv_reboot_confirm) + rebootCancel=findViewById(R.id.tv_reboot_cancel) + + rebootConfirm?.setOnClickListener{ + Logger.i(TAG,"rebootConfirm click") + clickListener?.confirm() + dismiss() + } + rebootCancel?.setOnClickListener { + Logger.i(TAG,"rebootCancel click") + clickListener?.cancel() + dismiss() + } + } + + fun setClickListener(clickListener: ClickListener) { + this.clickListener = clickListener + } + + fun showUpgradeDialog(){ + if(isShowing){ + return + } + show() + } + + interface ClickListener{ + fun confirm() + fun cancel() + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt index e4d2d67e0a..fc1127e263 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt @@ -6,11 +6,16 @@ import android.view.Gravity import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.notification.WarningFloat +import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.util.ToastUtils import kotlinx.android.synthetic.main.view_check_system.view.* class CheckSystemView @JvmOverloads constructor( @@ -23,7 +28,12 @@ class CheckSystemView @JvmOverloads constructor( const val TAG = "CheckSystemView" } - private var connectStatus = false + private var connectStatus = false //是否连接工控机 + private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 + private var dockerRebootDialog: DockerRebootDialog? = null + + private var downloadStatus: Int=-1 //下载状态 + private var upgradeStatus: Int=-1 //升级状态 init { LayoutInflater.from(context).inflate(R.layout.view_check_system, this, true) @@ -31,17 +41,45 @@ class CheckSystemView @JvmOverloads constructor( } private fun initView() { - //todo view状态注意消息回执 viewCheckShutDown.setOnClickListener { //dialog // showSystemOperationWindow() } viewCheckReboot.setOnClickListener { //dialog -// showSystemOperationWindow() + if(dockerRebootDialog == null){ + dockerRebootDialog = DockerRebootDialog(context) + dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener{ + override fun confirm() { + if(autopilotStatus==2){ + //当前处于自动驾驶状态,不可进行重启,Toast提示 + ToastUtils.showShort("请先退出自动驾驶状态") + }else if(AdUpgradeStateHelper.showCannotReboot(downloadStatus, upgradeStatus)){ + //当工控机处于下载或者升级状态,需要先进行升级 + ToastUtils.showShort("请先完成新自动驾驶系统的下载/升级") + } else{ + //确认重启 + Logger.i(TAG,"reboot confirm") + CallerAutoPilotManager.setIPCReboot() + } + } + + override fun cancel() { + //取消重启 + Logger.i(TAG,"reboot cancel") + } + + }) + } + dockerRebootDialog?.showUpgradeDialog() } } + fun setAdUpgradeStatus(downloadStatus : Int,upgradeStatus : Int){ + this.downloadStatus=downloadStatus + this.upgradeStatus=upgradeStatus + } + private fun showSystemOperationWindow(view: View) { WarningFloat.with(context).setGravity(Gravity.CENTER).setLayout(view) .setImmersionStatusBar(true).show() @@ -59,6 +97,7 @@ class CheckSystemView @JvmOverloads constructor( override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { connectStatus = autoPilotStatusInfo.connectStatus + autopilotStatus = autoPilotStatusInfo.state setViewStatus() } @@ -72,6 +111,7 @@ class CheckSystemView @JvmOverloads constructor( viewCheckShutDown.isClickable = false viewCheckReboot.isClickable = false } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_ad_upgrade.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_ad_upgrade.xml index 817a11fdde..5dbf010e0e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_ad_upgrade.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_ad_upgrade.xml @@ -4,7 +4,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="840px" android:layout_height="584px" - android:background="@color/upgrade_dialog_bg_color" + android:background="@color/dialog_bg_color" app:roundLayoutRadius="32px" > diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_docker_reboot.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_docker_reboot.xml new file mode 100644 index 0000000000..2c4ecd7bca --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_docker_reboot.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml index 54641ba41e..6ccb53257a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml @@ -3,18 +3,20 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="960px" - android:layout_height="match_parent" + android:layout_height="2000px" android:background="@color/notice_check_dialog_bg_color"> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent"> + android:layout_height="match_parent"> + app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" + android:visibility="gone"/> + app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" + android:visibility="gone"/> + app:layout_constraintTop_toBottomOf="@id/tvSystemOperation" + android:visibility="gone"/> + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_system.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_system.xml index eaf152bbf6..f3e63fd01e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_system.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_system.xml @@ -14,7 +14,8 @@ android:src="@drawable/check_shut_down" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + android:visibility="gone"/> + app:layout_constraintTop_toBottomOf="@id/viewCheckShutDown" + android:visibility="gone"/> + app:layout_constraintLeft_toLeftOf="@id/viewCheckReboot" + app:layout_constraintRight_toRightOf="@id/viewCheckReboot" + app:layout_constraintTop_toBottomOf="@id/viewCheckReboot" /> + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 3c2f36e4ae..fae006ce57 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -35,8 +35,8 @@ android:id="@+id/tvAppInfo" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColor="#000" android:lineSpacingExtra="3dp" + android:textColor="#000" android:textSize="@dimen/dp_30" tools:text="应用基础信息" /> @@ -56,6 +56,22 @@ android:textSize="@dimen/dp_30" tools:text="感知信息" /> + + + + @@ -228,6 +244,16 @@ app:flexWrap="wrap" app:justifyContent="flex_start"> + + #029DFF #0056FF #3B4577 - #3B4577 + #3B4577 \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 1f76aa9980..69371132e5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -25,6 +25,9 @@ 系统运行 关机 重启 + 重启提示 + 是否重启自动驾驶系统? + 系统版本 diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt index a0c12bee4b..d8bfadb408 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/app/AppConfigInfo.kt @@ -105,6 +105,7 @@ object AppConfigInfo { } else { "" } - }${isConnectObu}
" + }${isConnectObu}
" + + "------------------工控机感知&规控数据---------------------
" } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AdUpgradeStateHelper.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AdUpgradeStateHelper.kt index cc1db61f69..0edea8699b 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AdUpgradeStateHelper.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AdUpgradeStateHelper.kt @@ -36,6 +36,15 @@ class AdUpgradeStateHelper { return isDownloading(downloadStatus) || isDownloadFinish(downloadStatus,upgradeStatus) || getUpgradeStatus() || isUpgradeFailed(upgradeStatus) } + /** + * 如果工控机处于升级、下载过程中,则不能进行重启 + * @param downloadStatus 下载状态 + * @param upgradeStatus 升级状态 + */ + fun showCannotReboot(downloadStatus: Int,upgradeStatus: Int): Boolean{ + return isDownloading(downloadStatus)|| isDownloadFinish(downloadStatus,upgradeStatus) || getUpgradeStatus() + } + /** * 工控机是否处于“下载中”状态 * @param downloadStatus 下载状态 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt index b3d0d87a23..22f824401e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt @@ -117,4 +117,12 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider { * isEnable = false 关闭 */ fun setDemoMode(isEnable: Boolean) + + /** + * 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1 + * isEnable = true 开启 + * isEnable = false 关闭 + */ + fun setControlAutopilotCarAuto(isEnable: Boolean) + } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index bf8cad29ac..ce74708a31 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -187,4 +187,11 @@ interface IMoGoWaringProvider { * [onHide]回调不用关心,可以不注册 */ fun registerBadCaseCallback(onShow:() -> View, onHide: (() -> Unit)?) + + /** + * 工控机重启返回结果 + * @param code + * @param msg + */ + fun showDockerRebootResult(code: Int,msg: String) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index 901c127c52..63df027469 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -5,7 +5,6 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import kotlin.random.Random /** @@ -120,4 +119,13 @@ object CallerAutoPilotManager { fun setDemoMode(isEnable: Boolean) { providerApi?.setDemoMode(isEnable) } + + /** + * 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1 + * isEnable = true 开启 + * isEnable = false 关闭 + */ + fun setControlAutopilotCarAuto(isEnable: Boolean) { + providerApi?.setControlAutopilotCarAuto(isEnable) + } } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 15f74ffd6e..ea0ee0f7fe 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -265,5 +265,14 @@ object CallerHmiManager : CallerBase() { fun registerBadCaseCallback(onShow:() -> View, onHide: (() -> Unit)?) { waringProviderApi?.registerBadCaseCallback(onShow, onHide) } - + + /** + * 工控机重启返回结果 + * @param code + * @param msg + */ + fun showDockerRebootResult(code: Int,msg: String){ + waringProviderApi?.showDockerRebootResult(code, msg) + } + } \ No newline at end of file