[6.3.0]一键停服
@@ -39,6 +39,7 @@ import com.tencent.matrix.trace.config.TraceConfig
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.upgrade.*
|
||||
import com.mogo.weak.network.SdtManager
|
||||
import com.zhjt.mogo_core_function_devatools.adas.PowerOffManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.binding.*
|
||||
@@ -305,6 +306,63 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
BadCaseManager.showBadCaseManagerWindow(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动调用SSM停服命令超时检测
|
||||
*/
|
||||
override fun startCommandWaitCountDown() {
|
||||
PowerOffManager.startCommandWaitCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止调用SSM停服命令超时检测
|
||||
*/
|
||||
override fun stopCommandWaitCountDown() {
|
||||
PowerOffManager.stopCommandWaitCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始车辆下电等待倒计时
|
||||
*/
|
||||
override fun startPowerDownCountDown() {
|
||||
PowerOffManager.startPowerDownCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束车辆下电等待倒计时
|
||||
*/
|
||||
override fun stopPowerDownCountDown() {
|
||||
PowerOffManager.stopPowerDownCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态按钮变更倒计时
|
||||
*/
|
||||
override fun statusChangeCountDown(isSuccess: Boolean) {
|
||||
PowerOffManager.statusChangeCountDown(isSuccess)
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束状态按钮变更倒计时
|
||||
*/
|
||||
override fun stopStatusCountDown() {
|
||||
PowerOffManager.stopStatusCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置停服状态
|
||||
*/
|
||||
override fun setPowerOffStatus(status: Int) {
|
||||
PowerOffManager.setPowerOffStatus(status)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取停服状态
|
||||
*/
|
||||
override fun getPowerOffStatus(): Int {
|
||||
return PowerOffManager.getPowerOffStatus()
|
||||
}
|
||||
|
||||
|
||||
override fun showReportListWindow(context: Context, isShow: Boolean) {
|
||||
iPCReportManager.showReportListWindow(context, isShow)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zhjt.mogo_core_function_devatools.adas
|
||||
|
||||
import android.os.CountDownTimer
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerPowerOffManager
|
||||
|
||||
/**
|
||||
* 停止域控服务管理类
|
||||
*/
|
||||
object PowerOffManager {
|
||||
|
||||
private var commandWaitCountDownTimer: CountDownTimer ?= null
|
||||
private var powerDownCountDownTimer: CountDownTimer ?= null
|
||||
private var statusChangeCountDownTimer: CountDownTimer ?= null
|
||||
private var powerDownNum = 60
|
||||
/**
|
||||
* 停止域控服务状态
|
||||
* 0:准备停服 1:停服命令下发成功 2:停服命令下发失败 3:停服命令下发超时
|
||||
* 4:停服中 5:停服成功 6:停服成功不可点击
|
||||
*/
|
||||
private var powerOffStatus: Int = 0
|
||||
|
||||
/**
|
||||
* 启动调用SSM停服命令超时检测
|
||||
*/
|
||||
fun startCommandWaitCountDown(){
|
||||
commandWaitCountDownTimer = object: CountDownTimer(10000,10000){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
CallerPowerOffManager.invokeCommandTimeout()
|
||||
}
|
||||
}
|
||||
commandWaitCountDownTimer?.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止调用SSM停服命令超时检测
|
||||
*/
|
||||
fun stopCommandWaitCountDown(){
|
||||
if(commandWaitCountDownTimer != null){
|
||||
commandWaitCountDownTimer?.cancel()
|
||||
commandWaitCountDownTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始车辆下电等待倒计时
|
||||
*/
|
||||
fun startPowerDownCountDown(){
|
||||
powerDownNum = 60
|
||||
powerDownCountDownTimer = object: CountDownTimer(60000,1000){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
if(powerDownNum > 0){
|
||||
CallerPowerOffManager.invokePowerDownTick(powerDownNum--)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
powerDownNum = 0
|
||||
CallerPowerOffManager.invokePowerDownFinish()
|
||||
}
|
||||
}
|
||||
powerDownCountDownTimer?.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束车辆下电等待倒计时
|
||||
*/
|
||||
fun stopPowerDownCountDown(){
|
||||
if(powerDownCountDownTimer != null){
|
||||
powerDownCountDownTimer?.cancel()
|
||||
powerDownCountDownTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态按钮变更倒计时
|
||||
*/
|
||||
fun statusChangeCountDown(isSuccess: Boolean){
|
||||
statusChangeCountDownTimer = object: CountDownTimer(1000,1000){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
CallerPowerOffManager.invokeStatusChange(isSuccess)
|
||||
}
|
||||
}
|
||||
statusChangeCountDownTimer?.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束状态按钮变更倒计时
|
||||
*/
|
||||
fun stopStatusCountDown(){
|
||||
if(statusChangeCountDownTimer != null){
|
||||
statusChangeCountDownTimer?.cancel()
|
||||
statusChangeCountDownTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置停服状态
|
||||
*/
|
||||
fun setPowerOffStatus(status: Int){
|
||||
powerOffStatus = status
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取停服状态
|
||||
*/
|
||||
fun getPowerOffStatus(): Int{
|
||||
return powerOffStatus
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +1,64 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoReceiveReceivedAckListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IPowerOffListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerPowerOffManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
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.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.common.MessageType
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
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 {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
|
||||
IPowerOffListener, IMoGoReceiveReceivedAckListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "CheckSystemView"
|
||||
}
|
||||
|
||||
//重启系统对话框
|
||||
private var dockerRebootDialog: DockerRebootDialog? = null
|
||||
private var downloadStatus: String = "" //下载状态
|
||||
private var upgradeStatus: String = "" //升级状态
|
||||
private var connectStatus: Boolean = false //与工控机的连接状态
|
||||
private var isExecutingPowerOff: Boolean = false //是否正在下发一键停服命令
|
||||
private var isPowerOffCountDown: Boolean = false //一键停服是否处于1分钟倒计时
|
||||
private var powerOffMsgId: Long = -1 //一键停服命令下发Id
|
||||
private var progressAnimator: ObjectAnimator ?= null //一键停服命令倒计时
|
||||
/**
|
||||
* 停止域控服务状态
|
||||
* 0:准备停服 1:停服命令下发中 2:停服命令下发成功 3:停服命令下发失败
|
||||
* 4:停服命令下发超时 5:停服中 6:停服成功 7:停服成功不可点击
|
||||
*/
|
||||
private var powerOffStatus: Int = 0
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_check_system, this, true)
|
||||
@@ -39,85 +66,386 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
//一键停服
|
||||
viewCheckShutDown.setOnClickListener {
|
||||
//dialog
|
||||
// showSystemOperationWindow()
|
||||
powerOff()
|
||||
}
|
||||
tvCheckShutDown.setOnClickListener {
|
||||
powerOff()
|
||||
}
|
||||
//重启系统
|
||||
viewCheckReboot.setOnClickListener {
|
||||
//dialog
|
||||
if (dockerRebootDialog == null) {
|
||||
dockerRebootDialog = DockerRebootDialog(context)
|
||||
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == 2) {
|
||||
//当前处于自动驾驶状态,不可进行重启,Toast提示
|
||||
ToastUtils.showShort("请先退出自动驾驶状态")
|
||||
}
|
||||
|
||||
// else if (AdUpgradeStateHelper.showCannotReboot(
|
||||
// downloadStatus,
|
||||
// upgradeStatus
|
||||
// )
|
||||
// ) {
|
||||
// //当工控机处于下载或者升级状态,需要先进行升级
|
||||
// ToastUtils.showShort("请先完成新自动驾驶系统的下载/升级")
|
||||
// }
|
||||
|
||||
else {
|
||||
//确认重启
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot confirm")
|
||||
CallerAutoPilotControlManager.sendIpcReboot()
|
||||
ToastUtils.showLong("重启命令已发送")
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
//取消重启
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot cancel")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
dockerRebootDialog?.showUpgradeDialog()
|
||||
showRebootDialog()
|
||||
}
|
||||
tvCheckReboot.setOnClickListener {
|
||||
showRebootDialog()
|
||||
}
|
||||
CallerDevaToolsManager.getPowerOffStatus()?.let {
|
||||
powerOffStatus = it
|
||||
}
|
||||
when(powerOffStatus){
|
||||
//准备停服
|
||||
0->{
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down
|
||||
)
|
||||
)
|
||||
viewCheckShutDown.isClickable = true
|
||||
}
|
||||
//停服命令下发中
|
||||
1->{
|
||||
isExecutingPowerOff = true
|
||||
}
|
||||
//停服命令下发成功
|
||||
2->{
|
||||
viewProgressBackground.visibility = View.VISIBLE
|
||||
viewProgress.visibility = View.VISIBLE
|
||||
tvCountDown.visibility = View.VISIBLE
|
||||
tvCountDownUnit.visibility = View.VISIBLE
|
||||
//开始旋转动画
|
||||
if(progressAnimator == null){
|
||||
progressAnimator = ObjectAnimator.ofFloat(viewProgress,"rotation", 0f, 360f)
|
||||
}
|
||||
progressAnimator?.interpolator = LinearInterpolator()
|
||||
progressAnimator?.repeatCount = ValueAnimator.INFINITE //无限循环
|
||||
progressAnimator?.duration = 6000 //设置持续时间
|
||||
progressAnimator?.startDelay = 0
|
||||
progressAnimator?.start()
|
||||
//一键停服倒计时中
|
||||
isPowerOffCountDown = true
|
||||
}
|
||||
//停服命令下发失败
|
||||
3->{
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_fail
|
||||
)
|
||||
)
|
||||
}
|
||||
//停服命令下发超时
|
||||
4->{
|
||||
//将图标改为失败
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_fail
|
||||
)
|
||||
)
|
||||
}
|
||||
//停服中
|
||||
5->{
|
||||
isPowerOffCountDown = true
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_background
|
||||
)
|
||||
)
|
||||
viewProgressBackground.visibility = View.VISIBLE
|
||||
viewProgress.visibility = View.VISIBLE
|
||||
tvCountDown.visibility = View.VISIBLE
|
||||
tvCountDownUnit.visibility = View.VISIBLE
|
||||
//开始旋转动画
|
||||
if(progressAnimator == null){
|
||||
progressAnimator = ObjectAnimator.ofFloat(viewProgress,"rotation", 0f, 360f)
|
||||
}
|
||||
progressAnimator?.interpolator = LinearInterpolator()
|
||||
progressAnimator?.repeatCount = ValueAnimator.INFINITE //无限循环
|
||||
progressAnimator?.duration = 6000 //设置持续时间
|
||||
progressAnimator?.startDelay = 0
|
||||
progressAnimator?.start()
|
||||
}
|
||||
//停服成功
|
||||
6->{
|
||||
//停止一键停服进度属性动画
|
||||
progressAnimator?.cancel()
|
||||
//隐藏一键停服进度视图
|
||||
viewProgressBackground.visibility = View.GONE
|
||||
viewProgress.visibility = View.GONE
|
||||
tvCountDown.visibility = View.GONE
|
||||
tvCountDownUnit.visibility = View.GONE
|
||||
//一键停服命令倒计时结束,变为成功状态,并且发送1s倒计时
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_success
|
||||
)
|
||||
)
|
||||
isPowerOffCountDown = false
|
||||
}
|
||||
//停服成功不可点击
|
||||
7->{
|
||||
//将倒计时内容隐藏
|
||||
viewProgressBackground.visibility = View.GONE
|
||||
viewProgress.visibility = View.GONE
|
||||
tvCountDown.visibility = View.GONE
|
||||
tvCountDownUnit.visibility = View.GONE
|
||||
//停服成功,将按钮置为不可点击状态
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_complete
|
||||
)
|
||||
)
|
||||
viewCheckShutDown.isClickable = false
|
||||
isPowerOffCountDown = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setAdUpgradeStatus(downloadStatus: String, upgradeStatus: String) {
|
||||
this.downloadStatus = downloadStatus
|
||||
this.upgradeStatus = upgradeStatus
|
||||
/**
|
||||
* 一键停服
|
||||
*/
|
||||
private fun powerOff() {
|
||||
if (!connectStatus) {
|
||||
ToastUtils.showShort("尚未连接工控机,无法下发一键停服命令")
|
||||
return
|
||||
}
|
||||
if (isExecutingPowerOff) {
|
||||
//一键停服命令下发执行中
|
||||
ToastUtils.showShort("一键停服命令下发中,请勿重复点击")
|
||||
return
|
||||
}
|
||||
if (isPowerOffCountDown) {
|
||||
//系统停服中
|
||||
ToastUtils.showShort("系统停服中,请勿重复点击")
|
||||
return
|
||||
}
|
||||
//将是否正在下发一键停服命令标签改为true
|
||||
isExecutingPowerOff = true
|
||||
CallerDevaToolsManager.setPowerOffStatus(1)
|
||||
//系统命令请求 关机
|
||||
powerOffMsgId = CallerAutoPilotControlManager.sendIpcPowerOff()
|
||||
//开始执行10秒等待倒计时
|
||||
CallerDevaToolsManager.startCommandWaitCountDown()
|
||||
}
|
||||
|
||||
private fun showSystemOperationWindow(view: View) {
|
||||
WarningFloat.with(context).setGravity(Gravity.CENTER).setLayout(view)
|
||||
.setImmersionStatusBar(true).show()
|
||||
/**
|
||||
* 展示系统重启确认窗
|
||||
*/
|
||||
private fun showRebootDialog() {
|
||||
if (!connectStatus) {
|
||||
ToastUtils.showShort("尚未连接工控机,无法重启系统")
|
||||
return
|
||||
}
|
||||
//dialog
|
||||
if (dockerRebootDialog == null) {
|
||||
dockerRebootDialog = DockerRebootDialog(context)
|
||||
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == 2) {
|
||||
//当前处于自动驾驶状态,不可进行重启,Toast提示
|
||||
ToastUtils.showShort("请先退出自动驾驶状态")
|
||||
} else {
|
||||
//确认重启
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot confirm")
|
||||
CallerAutoPilotControlManager.sendIpcReboot()
|
||||
ToastUtils.showLong("重启命令已发送")
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
//取消重启
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot cancel")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
dockerRebootDialog?.showUpgradeDialog()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerPowerOffManager.addListener(TAG, this)
|
||||
CallerReceiveReceivedAckListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerPowerOffManager.removeListener(TAG)
|
||||
CallerReceiveReceivedAckListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) {
|
||||
override fun onAutopilotIpcConnectStatusChanged(
|
||||
status: AdasConstants.IpcConnectionStatus,
|
||||
reason: String?
|
||||
) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
ThreadUtils.runOnUiThread {
|
||||
setViewStatus(status == AdasConstants.IpcConnectionStatus.CONNECTED)
|
||||
setViewStatus(status == AdasConstants.IpcConnectionStatus.CONNECTED)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setViewStatus(connectInfo:Boolean) {
|
||||
if (connectInfo) {
|
||||
viewCheckShutDown.requestFocus()
|
||||
private fun setViewStatus(connectInfo: Boolean) {
|
||||
connectStatus = connectInfo
|
||||
//下发一键停服命令后又和域控重新连接
|
||||
if((powerOffStatus == 6 || powerOffStatus == 7) && connectStatus){
|
||||
CallerDevaToolsManager.setPowerOffStatus(0)
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down
|
||||
)
|
||||
)
|
||||
viewCheckShutDown.isClickable = true
|
||||
viewCheckReboot.requestFocus()
|
||||
viewCheckReboot.isClickable = true
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服调用SSM停服命令超时
|
||||
*/
|
||||
override fun commandTimeout() {
|
||||
//停止命令超时倒计时
|
||||
CallerDevaToolsManager.stopCommandWaitCountDown()
|
||||
/**
|
||||
* 如果点击一键停服按钮10秒后,是否正在执行命令的标签仍为true,代表域控未返回执行结果
|
||||
* 此时应该将按钮状态短暂置为失败,之后再置为常态,并将此标签置为false
|
||||
*/
|
||||
if (isExecutingPowerOff) {
|
||||
//更改标签状态
|
||||
isExecutingPowerOff = false
|
||||
CallerDevaToolsManager.setPowerOffStatus(4)
|
||||
//将图标改为失败
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_fail
|
||||
)
|
||||
)
|
||||
//执行1秒倒计时命令
|
||||
CallerDevaToolsManager.statusChangeCountDown(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服车辆下电等待倒计时
|
||||
*/
|
||||
override fun powerDownTick(second: Int) {
|
||||
tvCountDown.text = second.toString()
|
||||
CallerDevaToolsManager.setPowerOffStatus(5)
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服车辆下电等待倒计时结束
|
||||
*/
|
||||
override fun powerDownFinish() {
|
||||
CallerDevaToolsManager.setPowerOffStatus(6)
|
||||
//停止一键停服进度属性动画
|
||||
progressAnimator?.cancel()
|
||||
//隐藏一键停服进度视图
|
||||
viewProgressBackground.visibility = View.GONE
|
||||
viewProgress.visibility = View.GONE
|
||||
tvCountDown.visibility = View.GONE
|
||||
tvCountDownUnit.visibility = View.GONE
|
||||
//一键停服命令倒计时结束,变为成功状态,并且发送1s倒计时
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_success
|
||||
)
|
||||
)
|
||||
isPowerOffCountDown = false
|
||||
//执行1秒倒计时命令
|
||||
CallerDevaToolsManager.statusChangeCountDown(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服状态按钮变更通知
|
||||
*/
|
||||
override fun statusChange(isSuccess: Boolean) {
|
||||
CallerDevaToolsManager.stopStatusCountDown()
|
||||
if (isSuccess) {
|
||||
//将倒计时内容隐藏
|
||||
viewProgressBackground.visibility = View.GONE
|
||||
viewProgress.visibility = View.GONE
|
||||
tvCountDown.visibility = View.GONE
|
||||
tvCountDownUnit.visibility = View.GONE
|
||||
//停服成功,将按钮置为不可点击状态
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_complete
|
||||
)
|
||||
)
|
||||
viewCheckShutDown.isClickable = false
|
||||
viewCheckReboot.isClickable = false
|
||||
CallerDevaToolsManager.setPowerOffStatus(7)
|
||||
} else {
|
||||
//停服命令下发失败,将按钮置为常态,可点击
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down
|
||||
)
|
||||
)
|
||||
viewCheckShutDown.isClickable = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令下发回执
|
||||
*/
|
||||
override fun onReceiveReceivedAck(receivedAck: ReceivedAck) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (receivedAck.messageType == MessageType.TYPE_SEND_SYSTEM_CMD_REQ && receivedAck.msgId == powerOffMsgId) {
|
||||
isExecutingPowerOff = false
|
||||
//停止命令超时倒计时
|
||||
CallerDevaToolsManager.stopCommandWaitCountDown()
|
||||
if ( receivedAck.status == ReceivedAck.Status.NORMAL) {
|
||||
//一键停服命令回执成功,则正常进入停服阶段中,1分钟倒计时,并且TTS和消息盒子提示
|
||||
CallerDevaToolsManager.setPowerOffStatus(2)
|
||||
AIAssist.getInstance(context).speakTTSVoice("请等待1分钟再执行车辆下电")
|
||||
saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X, V2XMsg(
|
||||
EventTypeEnumNew.TYPE_POWER_OFF_TIP.poiType,
|
||||
EventTypeEnumNew.TYPE_POWER_OFF_TIP.content,
|
||||
EventTypeEnumNew.TYPE_POWER_OFF_TIP.tts
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_background
|
||||
)
|
||||
)
|
||||
viewProgressBackground.visibility = View.VISIBLE
|
||||
viewProgress.visibility = View.VISIBLE
|
||||
tvCountDown.visibility = View.VISIBLE
|
||||
tvCountDownUnit.visibility = View.VISIBLE
|
||||
//开始旋转动画
|
||||
if(progressAnimator == null){
|
||||
progressAnimator = ObjectAnimator.ofFloat(viewProgress,"rotation", 0f, 360f)
|
||||
}
|
||||
progressAnimator?.interpolator = LinearInterpolator()
|
||||
progressAnimator?.repeatCount = ValueAnimator.INFINITE //无限循环
|
||||
progressAnimator?.duration = 6000 //设置持续时间
|
||||
progressAnimator?.startDelay = 0
|
||||
progressAnimator?.start()
|
||||
//开始60S倒计时
|
||||
CallerDevaToolsManager.startPowerDownCountDown()
|
||||
//一键停服倒计时中
|
||||
isPowerOffCountDown = true
|
||||
} else {
|
||||
//一键停服命令回执失败,则走失败流程
|
||||
CallerDevaToolsManager.setPowerOffStatus(3)
|
||||
viewCheckShutDown.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_shut_down_fail
|
||||
)
|
||||
)
|
||||
//执行1秒倒计时命令
|
||||
CallerDevaToolsManager.statusChangeCountDown(false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -7,50 +7,96 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewCheckShutDown"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="113dp"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/check_shut_down"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_marginStart="@dimen/dp_142"
|
||||
android:src="@drawable/icon_shut_down"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
android:contentDescription="@string/check_system_shut_down" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewProgressBackground"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_84"
|
||||
app:layout_constraintTop_toTopOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintStart_toStartOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintEnd_toEndOf="@id/viewCheckShutDown"
|
||||
android:src="@drawable/icon_shut_down_progress_background"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewProgress"
|
||||
android:layout_width="@dimen/dp_84"
|
||||
android:layout_height="@dimen/dp_84"
|
||||
app:layout_constraintTop_toTopOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintStart_toStartOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintEnd_toEndOf="@id/viewCheckShutDown"
|
||||
android:src="@drawable/icon_shut_down_progress"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCountDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintStart_toStartOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintEnd_toEndOf="@id/viewCheckShutDown"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_28"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCountDownUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvCountDown"
|
||||
app:layout_constraintStart_toEndOf="@id/tvCountDown"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textColor="#B2FFFFFF"
|
||||
android:text="s"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCheckShutDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="156dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_marginTop="@dimen/dp_23"
|
||||
android:gravity="center"
|
||||
android:text="@string/check_system_shut_down"
|
||||
android:textColor="@color/color_FFA7B6F0"
|
||||
android:textSize="32dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:textSize="@dimen/sp_32"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewCheckShutDown"
|
||||
android:visibility="gone"/>
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewCheckShutDown"
|
||||
app:layout_constraintRight_toRightOf="@id/viewCheckShutDown"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewCheckReboot"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_marginStart="@dimen/dp_142"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/check_reboot"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewCheckShutDown"
|
||||
android:contentDescription="@string/check_system_reboot" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCheckReboot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_marginTop="@dimen/dp_23"
|
||||
android:gravity="center"
|
||||
android:text="@string/check_system_reboot"
|
||||
android:textColor="@color/color_FFA7B6F0"
|
||||
android:textSize="32dp"
|
||||
android:textSize="@dimen/sp_32"
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewCheckReboot"
|
||||
app:layout_constraintRight_toRightOf="@id/viewCheckReboot"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewCheckReboot" />
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<string name="check_vehicle_speed_setting">车速设置</string>
|
||||
<string name="bus_operation_title">账户信息</string>
|
||||
<string name="check_system_operation">系统运行</string>
|
||||
<string name="check_system_shut_down">关机</string>
|
||||
<string name="check_system_shut_down">一键停服</string>
|
||||
<string name="check_system_reboot">重启系统</string>
|
||||
<string name="check_system_reboot_title">重启提示</string>
|
||||
<string name="check_system_reboot_content">是否重启自动驾驶系统?</string>
|
||||
|
||||
@@ -590,6 +590,13 @@ enum class EventTypeEnumNew(
|
||||
"详情%s"
|
||||
),
|
||||
|
||||
TYPE_POWER_OFF_TIP("POWER_OFF_TIP",
|
||||
"一键停服",
|
||||
"请等待1分钟再执行车辆下电",
|
||||
R.drawable.icon_warning_take_over,
|
||||
"请等待1分钟再执行车辆下电",
|
||||
"请等待1分钟再执行车辆下电"),
|
||||
|
||||
TYPE_VIP_IDENTIFICATION_PASS("20022", "VIP通行", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行,已为您变为绿灯", "VIP车辆优先通行,已为您变为绿灯"),
|
||||
TYPE_VIP_IDENTIFICATION_EXTEND("20023", "VIP通行", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行,已为您延长绿灯", "VIP车辆优先通行,已为您延长绿灯"),
|
||||
TYPE_VIP_ERROR_IDENTIFICATION("20024", "VIP通行", "", R.drawable.icon_warning_v2x_vip_turn_light, "请求失败,", "请求失败,稍后重试"),
|
||||
@@ -947,6 +954,10 @@ enum class EventTypeEnumNew(
|
||||
TYPE_DEVICE_STATUS_ABNORMAL.poiType ->{
|
||||
TYPE_DEVICE_STATUS_ABNORMAL.poiTypeStr
|
||||
}
|
||||
//一键停服
|
||||
TYPE_POWER_OFF_TIP.poiType ->{
|
||||
TYPE_POWER_OFF_TIP.poiTypeStr
|
||||
}
|
||||
//机动车
|
||||
TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType ->{
|
||||
TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiTypeStr
|
||||
@@ -1266,6 +1277,10 @@ enum class EventTypeEnumNew(
|
||||
TYPE_DEVICE_STATUS_ABNORMAL.poiType->{
|
||||
R.drawable.icon_default
|
||||
}
|
||||
//一键停服
|
||||
TYPE_POWER_OFF_TIP.poiType->{
|
||||
R.drawable.icon_warning_take_over
|
||||
}
|
||||
//机动车
|
||||
TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> {
|
||||
R.drawable.icon_warning_v2x_motorcycle_collision
|
||||
|
||||
@@ -128,6 +128,46 @@ interface IDevaToolsProvider : IProvider {
|
||||
*/
|
||||
fun showBadCaseManagerView(context: Context)
|
||||
|
||||
/**
|
||||
* 启动调用SSM停服命令超时检测
|
||||
*/
|
||||
fun startCommandWaitCountDown()
|
||||
|
||||
/**
|
||||
* 停止调用SSM停服命令超时检测
|
||||
*/
|
||||
fun stopCommandWaitCountDown()
|
||||
|
||||
/**
|
||||
* 开始车辆下电等待倒计时
|
||||
*/
|
||||
fun startPowerDownCountDown()
|
||||
|
||||
/**
|
||||
* 结束车辆下电等待倒计时
|
||||
*/
|
||||
fun stopPowerDownCountDown()
|
||||
|
||||
/**
|
||||
* 状态按钮变更倒计时
|
||||
*/
|
||||
fun statusChangeCountDown(isSuccess: Boolean)
|
||||
|
||||
/**
|
||||
* 结束状态按钮变更倒计时
|
||||
*/
|
||||
fun stopStatusCountDown()
|
||||
|
||||
/**
|
||||
* 设置停服状态
|
||||
*/
|
||||
fun setPowerOffStatus(status: Int)
|
||||
|
||||
/**
|
||||
* 获取停服状态
|
||||
*/
|
||||
fun getPowerOffStatus(): Int
|
||||
|
||||
/**
|
||||
* 工控机异常上报列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.eagle.core.function.api.devatools
|
||||
|
||||
interface IPowerOffListener {
|
||||
|
||||
/**
|
||||
* 调用SSM停服命令超时
|
||||
*/
|
||||
fun commandTimeout()
|
||||
|
||||
/**
|
||||
* 车辆下电等待倒计时
|
||||
*/
|
||||
fun powerDownTick(second: Int)
|
||||
|
||||
/**
|
||||
* 车辆下电等待倒计时结束
|
||||
*/
|
||||
fun powerDownFinish()
|
||||
|
||||
/**
|
||||
* 状态按钮变更通知
|
||||
*/
|
||||
fun statusChange(isSuccess: Boolean)
|
||||
|
||||
}
|
||||
@@ -10,9 +10,6 @@ import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
*/
|
||||
object CallerReceiveReceivedAckListenerManager : CallerBase<IMoGoReceiveReceivedAckListener>() {
|
||||
|
||||
/**
|
||||
* 金旅M1
|
||||
*/
|
||||
fun invokeReceiveReceivedAck(receivedAck: ReceivedAck) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
|
||||
@@ -170,6 +170,62 @@ object CallerDevaToolsManager {
|
||||
devaToolsProviderApi?.showBadCaseManagerView(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动调用SSM停服命令超时检测
|
||||
*/
|
||||
fun startCommandWaitCountDown(){
|
||||
devaToolsProviderApi?.startCommandWaitCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止调用SSM停服命令超时检测
|
||||
*/
|
||||
fun stopCommandWaitCountDown(){
|
||||
devaToolsProviderApi?.stopCommandWaitCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始车辆下电等待倒计时
|
||||
*/
|
||||
fun startPowerDownCountDown(){
|
||||
devaToolsProviderApi?.startPowerDownCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束车辆下电等待倒计时
|
||||
*/
|
||||
fun stopPowerDownCountDown(){
|
||||
devaToolsProviderApi?.stopPowerDownCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态按钮变更倒计时
|
||||
*/
|
||||
fun statusChangeCountDown(isSuccess: Boolean){
|
||||
devaToolsProviderApi?.statusChangeCountDown(isSuccess)
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束状态按钮变更倒计时
|
||||
*/
|
||||
fun stopStatusCountDown(){
|
||||
devaToolsProviderApi?.stopStatusCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置停服状态
|
||||
*/
|
||||
fun setPowerOffStatus(status: Int){
|
||||
devaToolsProviderApi?.setPowerOffStatus(status)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取停服状态
|
||||
*/
|
||||
fun getPowerOffStatus(): Int? {
|
||||
return devaToolsProviderApi?.getPowerOffStatus()
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机异常上报列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.mogo.eagle.core.function.call.devatools
|
||||
|
||||
import com.mogo.eagle.core.function.api.devatools.IPowerOffListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerPowerOffManager : CallerBase<IPowerOffListener>() {
|
||||
|
||||
/**
|
||||
* 一键停服调用SSM停服命令超时
|
||||
*/
|
||||
fun invokeCommandTimeout(){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.commandTimeout()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服车辆下电等待倒计时
|
||||
*/
|
||||
fun invokePowerDownTick(second: Int){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.powerDownTick(second)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服车辆下电等待倒计时结束
|
||||
*/
|
||||
fun invokePowerDownFinish(){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.powerDownFinish()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键停服状态按钮变更通知
|
||||
*/
|
||||
fun invokeStatusChange(isSuccess: Boolean){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.statusChange(isSuccess)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,19 +125,7 @@ public class ReceivedAck {
|
||||
this.receivedAck = receivedAck;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认是否收到回执
|
||||
*
|
||||
* @param msgId 下发的消息id
|
||||
* @return 是否收到回执
|
||||
*/
|
||||
public boolean isReceiptReceived(long msgId) {
|
||||
Log.i("ReceivedAck", "消息=" + msgId + " 结果=" + toString());
|
||||
if (status == Status.NORMAL) {
|
||||
return this.msgId == msgId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||