[6.3.0]一键停服

This commit is contained in:
xuxinchao
2024-03-06 19:24:47 +08:00
parent 0c11577ca0
commit 29913b6eee
20 changed files with 816 additions and 96 deletions

View File

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

View File

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