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 0a59085289..0b9dccb483 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 @@ -13,6 +13,7 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.zhidao.support.adas.high.AdasManager +import com.zhidao.support.adas.high.bean.IPCPowerInfo import com.zhidao.support.adas.high.common.CupidLogUtils import java.util.concurrent.TimeUnit @@ -23,7 +24,7 @@ import java.util.concurrent.TimeUnit */ @Route(path = MogoServicePaths.PATH_AUTO_PILOT) class MoGoAutopilotProvider : - IMoGoAutopilotProvider { + IMoGoAutopilotProvider { private val TAG = "MoGoAutoPilotProvider" override val functionName: String @@ -82,7 +83,8 @@ class MoGoAutopilotProvider : } override fun recordPackage(): Boolean { - return AdasManager.getInstance().recordPackage(1, (System.currentTimeMillis() / 1000).toInt()) + return AdasManager.getInstance() + .recordPackage(1, (System.currentTimeMillis() / 1000).toInt()) } override fun setEnableLog(isEnableLog: Boolean) { @@ -100,4 +102,12 @@ class MoGoAutopilotProvider : override fun setAutoPilotSpeed(speed: Int): Boolean { return AdasManager.getInstance().setSpeed(speed) } + + override fun setIPCShutDown() { + AdasManager.getInstance().sendBaseInfo(IPCPowerInfo.shutdown()) + } + + override fun setIPCReboot() { + AdasManager.getInstance().sendBaseInfo(IPCPowerInfo.reboot()) + } } \ 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 5ed91e256f..0ae3ac68c7 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 @@ -7,22 +7,29 @@ import android.view.LayoutInflater import android.view.View import android.widget.FrameLayout import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo 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.call.check.CallerCheckManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.utils.KeyBoardUtil import com.mogo.eagle.core.utilcode.util.ToastUtils import kotlinx.android.synthetic.main.view_auto_pilot_check.view.* +import kotlinx.android.synthetic.main.view_check_system.view.* /** * @author ChenFufeng * 设置自动驾驶速度和检测页入口 */ -class AutoPilotAndCheckView : FrameLayout, IMoGoAutopilotStatusListener { +class AutoPilotAndCheckView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : FrameLayout( + context, + attrs, + defStyleAttr +), IMoGoAutopilotStatusListener { private val TAG = "AutoPilotAndCheckView" @@ -30,13 +37,6 @@ class AutoPilotAndCheckView : FrameLayout, IMoGoAutopilotStatusListener { private var keyBoardUtil: KeyBoardUtil? = null private var connectStatus = false - @JvmOverloads - constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super( - context, - attrs, - defStyleAttr - ) - init { LayoutInflater.from(context).inflate(R.layout.view_auto_pilot_check, this, true) initView() @@ -61,7 +61,7 @@ class AutoPilotAndCheckView : FrameLayout, IMoGoAutopilotStatusListener { else -> { keyBoardUtil?.hideKeyboard() // 设置自动驾驶速度 - var isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed) + val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed) when { isSuccess -> { ToastUtils.showShort("车速设置成功,立即生效") @@ -117,10 +117,6 @@ class AutoPilotAndCheckView : FrameLayout, IMoGoAutopilotStatusListener { connectStatus = autoPilotStatusInfo.connectStatus } - override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) { - - } - override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt index 8172c25a74..f7605c169a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -7,7 +7,6 @@ import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo 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 @@ -26,11 +25,11 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.* * 自动驾驶状态按钮 */ class AutoPilotStatusView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet + context: Context, + attrs: AttributeSet ) : ConstraintLayout(context, attrs), - View.OnClickListener, - IMoGoAutopilotStatusListener { + View.OnClickListener, + IMoGoAutopilotStatusListener { private val TAG = "AutopilotStatusView" @@ -80,14 +79,17 @@ class AutoPilotStatusView @JvmOverloads constructor( private fun startAutoPilot() { // TODO 测试数据,真实情况需要业务自己传入控制数据 val currentAutopilot = - AutopilotControlParameters() + AutopilotControlParameters() currentAutopilot.startName = "HYKXC" currentAutopilot.endName = "HYJC" currentAutopilot.isSpeakVoice = false currentAutopilot.startLatLon = - AutopilotControlParameters.AutoPilotLonLat(MogoApisHandler.getInstance().apis.adasControllerApi.lastLat, MogoApisHandler.getInstance().apis.adasControllerApi.lastLon) + AutopilotControlParameters.AutoPilotLonLat( + MogoApisHandler.getInstance().apis.adasControllerApi.lastLat, + MogoApisHandler.getInstance().apis.adasControllerApi.lastLon + ) currentAutopilot.endLatLon = - AutopilotControlParameters.AutoPilotLonLat(26.819716071924688, 112.57715442110867) + AutopilotControlParameters.AutoPilotLonLat(26.819716071924688, 112.57715442110867) currentAutopilot.vehicleType = 10 CallerAutoPilotManager.startAutoPilot(currentAutopilot) @@ -126,11 +128,6 @@ class AutoPilotStatusView @JvmOverloads constructor( setAutoPilotStatus(autoPilotStatusInfo.state) } - override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) { - - } - - override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { } 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 new file mode 100644 index 0000000000..e4d2d67e0a --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt @@ -0,0 +1,77 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.Gravity +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +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.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.notification.WarningFloat +import kotlinx.android.synthetic.main.view_check_system.view.* + +class CheckSystemView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener { + + companion object { + const val TAG = "CheckSystemView" + } + + private var connectStatus = false + + init { + LayoutInflater.from(context).inflate(R.layout.view_check_system, this, true) + initView() + } + + private fun initView() { + //todo view状态注意消息回执 + viewCheckShutDown.setOnClickListener { + //dialog +// showSystemOperationWindow() + } + viewCheckReboot.setOnClickListener { + //dialog +// showSystemOperationWindow() + } + } + + private fun showSystemOperationWindow(view: View) { + WarningFloat.with(context).setGravity(Gravity.CENTER).setLayout(view) + .setImmersionStatusBar(true).show() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerAutoPilotStatusListenerManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerAutoPilotStatusListenerManager.removeListener(TAG) + } + + override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { + connectStatus = autoPilotStatusInfo.connectStatus + setViewStatus() + } + + private fun setViewStatus() { + if (connectStatus) { + viewCheckShutDown.requestFocus() + viewCheckShutDown.isClickable = true + viewCheckReboot.requestFocus() + viewCheckReboot.isClickable = true + } else { + 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/drawable-xxhdpi/check_reboot.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/check_reboot.png new file mode 100644 index 0000000000..1dc23567a1 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/check_reboot.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/check_shut_down.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/check_shut_down.png new file mode 100644 index 0000000000..b4f0fcb27c Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/check_shut_down.png differ 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 2f5e86ca4b..81e5c20fad 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,128 +3,160 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="960px" - android:layout_height="1528px" - android:background="@color/notice_check_dialog_bg_color" - > + android:layout_height="match_parent" + android:background="@color/notice_check_dialog_bg_color"> - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ 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 new file mode 100644 index 0000000000..eaf152bbf6 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_system.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index bdcbb6aca3..89090b898b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -30,4 +30,8 @@ #FF333333 #FF333333 #FFCCCCCC + + #FF2966EC + #FFA7B6F0 + #B3FFFFFF \ 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 6cf7c2999a..7b65371b3c 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 @@ -18,4 +18,10 @@ 回到顶部 滚至底部 日志加载中... + + 车辆检测 + 车速设置 + 系统运行 + 关机 + 重启 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java index fd06f73831..d0e3859817 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java @@ -59,4 +59,14 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider { void setIsWriteLog(boolean isWriteLog); Boolean setAutoPilotSpeed(int speed); + + /** + * 关机 + */ + void setIPCShutDown(); + + /** + * 重启 + */ + void setIPCReboot(); } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt index aa2be2e665..8b09cbb008 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt @@ -23,7 +23,9 @@ interface IMoGoAutopilotStatusListener { * * @param autopilotWayArrive 所到车站的简单信息 */ - fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) + fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?){ + + } /** * 工控机获取SN @@ -33,7 +35,9 @@ interface IMoGoAutopilotStatusListener { /** * 工控机监控节点 */ - fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) + fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?){ + + } companion object { 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 312a36957d..6be446c1e9 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 @@ -15,8 +15,8 @@ object CallerAutoPilotManager { private val providerApi: IMoGoAutopilotProvider get() = CallerBase.getApiInstance( - IMoGoAutopilotProvider::class.java, - MogoServicePaths.PATH_AUTO_PILOT + IMoGoAutopilotProvider::class.java, + MogoServicePaths.PATH_AUTO_PILOT ) /** @@ -74,4 +74,12 @@ object CallerAutoPilotManager { fun setAutoPilotSpeed(speed: Int): Boolean { return providerApi.setAutoPilotSpeed(speed) } + + fun setIPCShutDown() { + providerApi.setIPCShutDown() + } + + fun setIPCReboot() { + providerApi.setIPCReboot() + } } \ No newline at end of file