add system operation view

This commit is contained in:
zhongchao
2022-01-11 19:41:59 +08:00
parent 552e0a5ee5
commit 0926a8b399
13 changed files with 353 additions and 155 deletions

View File

@@ -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())
}
}

View File

@@ -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?) {
}

View File

@@ -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?) {
}

View File

@@ -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
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -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">
<View
android:layout_width="14px"
android:layout_height="50px"
android:background="#FF2966EC"
android:layout_marginStart="80px"
android:layout_marginTop="158px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:layout_width="84px"
android:layout_height="86px"
android:text="检测"
android:textColor="#FFFFFFFF"
android:textSize="42px"
android:layout_marginStart="113px"
android:layout_marginTop="140px"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
android:id="@+id/viewCheckStatus"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginTop="266px"
android:layout_marginStart="113px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:id="@+id/tvCheck"
android:layout_width="128px"
android:layout_height="42px"
android:text="车辆检测"
android:textColor="#FFA7B6F0"
android:textSize="32px"
android:layout_marginStart="124px"
android:layout_marginTop="23px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckStatus"
/>
<View
android:layout_width="14px"
android:layout_height="50px"
android:background="#FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck"
android:layout_marginTop="94px"
android:layout_marginStart="80px"
/>
<TextView
android:id="@+id/tvSpeedTitle"
android:layout_width="168px"
android:layout_height="86px"
android:text="车速设置"
android:textColor="#FFFFFFFF"
android:textSize="42px"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck"
android:layout_marginStart="113px"
android:layout_marginTop="76px"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="390px"
android:layout_height="140px"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
android:background="@drawable/pilot_speed_bg"
android:layout_marginTop="40px"
android:layout_marginStart="113px"
android:focusable="true"
android:focusableInTouchMode="true"
>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etInputSpeed"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="92px"
android:textColor="#FFFFFFFF"
android:textSize="80px"
android:background="@null"
android:gravity="center"
/>
<TextView
android:layout_width="93px"
android:layout_height="53px"
android:text="km/h"
android:textColor="#B3FFFFFF"
android:textSize="38px"
android:layout_marginEnd="28px"
android:layout_gravity="center_vertical"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<com.mogo.eagle.core.function.hmi.ui.tools.SpeedKeyboardView
android:id="@+id/sKeyBoardView"
<ScrollView
android:layout_width="match_parent"
android:layout_height="500px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:background="#5375D6"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone"
/>
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="14px"
android:layout_height="50px"
android:layout_marginStart="80px"
android:layout_marginTop="158px"
android:background="@color/color_FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="84px"
android:layout_height="86px"
android:layout_marginStart="113px"
android:layout_marginTop="140px"
android:gravity="center"
android:text="检测"
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
android:id="@+id/viewCheckStatus"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginStart="113px"
android:layout_marginTop="266px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCheck"
android:layout_width="128px"
android:layout_height="42px"
android:layout_marginStart="124px"
android:layout_marginTop="23px"
android:text="@string/check_vehicle_detection"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckStatus" />
<View
android:layout_width="14px"
android:layout_height="50px"
android:layout_marginStart="80px"
android:layout_marginTop="94px"
android:background="@color/color_FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck" />
<TextView
android:id="@+id/tvSpeedTitle"
android:layout_width="168px"
android:layout_height="86px"
android:layout_marginStart="113px"
android:layout_marginTop="76px"
android:gravity="center"
android:text="@string/check_vehicle_speed_setting"
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llSpeedPosition"
android:layout_width="390px"
android:layout_height="140px"
android:layout_marginStart="113px"
android:layout_marginTop="40px"
android:background="@drawable/pilot_speed_bg"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etInputSpeed"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="92px"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
android:textColor="#FFFFFFFF"
android:textSize="80px"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
android:layout_width="93px"
android:layout_height="53px"
android:layout_gravity="center_vertical"
android:layout_marginEnd="28px"
android:text="km/h"
android:textColor="@color/color_B3FFFFFF"
android:textSize="38px" />
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="14px"
android:layout_height="50px"
android:layout_marginStart="80px"
android:layout_marginTop="94px"
android:background="@color/color_FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
<TextView
android:id="@+id/tvSystemOperation"
android:layout_width="168px"
android:layout_height="86px"
android:layout_marginStart="113px"
android:layout_marginTop="76px"
android:gravity="center"
android:text="@string/check_system_operation"
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckSystemView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSystemOperation" />
<com.mogo.eagle.core.function.hmi.ui.tools.SpeedKeyboardView
android:id="@+id/sKeyBoardView"
android:layout_width="match_parent"
android:layout_height="500px"
android:background="#5375D6"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<ImageView
android:id="@+id/ivCloseIcon"
@@ -135,5 +167,4 @@
android:background="@drawable/icon_close_nor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/clCheckSystem"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/viewCheckShutDown"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginStart="113px"
android:clickable="true"
android:src="@drawable/check_shut_down"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCheckShutDown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="156px"
android:layout_marginTop="23px"
android:gravity="center"
android:text="@string/check_system_shut_down"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckShutDown" />
<ImageView
android:id="@+id/viewCheckReboot"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginStart="405px"
android:clickable="true"
android:src="@drawable/check_reboot"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCheckReboot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="448px"
android:layout_marginTop="23px"
android:gravity="center"
android:text="@string/check_system_reboot"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckShutDown" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -30,4 +30,8 @@
<color name="foreground_debug">#FF333333</color>
<color name="foreground_info">#FF333333</color>
<color name="foreground_warn">#FFCCCCCC</color>
<color name="color_FF2966EC">#FF2966EC</color>
<color name="color_FFA7B6F0">#FFA7B6F0</color>
<color name="color_B3FFFFFF">#B3FFFFFF</color>
</resources>

View File

@@ -18,4 +18,10 @@
<string name="log_btn_back_top">回到顶部</string>
<string name="log_btn_to_bottom">滚至底部</string>
<string name="log_text_loading">日志加载中...</string>
<string name="check_vehicle_detection">车辆检测</string>
<string name="check_vehicle_speed_setting">车速设置</string>
<string name="check_system_operation">系统运行</string>
<string name="check_system_shut_down">关机</string>
<string name="check_system_reboot">重启</string>
</resources>