[6.6.0]一键上报
This commit is contained in:
@@ -29,15 +29,19 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
@@ -51,6 +55,7 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.eagle.core.utilcode.util.FileUtils.millis2String
|
||||
import com.mogo.tts.base.SpeechUtils
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.*
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
@@ -58,6 +63,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils
|
||||
import com.zhjt.mogo_core_function_devatools.ext.enqueuePop
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.ReportTypeWindow
|
||||
import com.zhjt.mogo_core_function_devatools.workorder.WorkOrderWindow
|
||||
import fsm.Fsm2024
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.io.File
|
||||
@@ -66,7 +72,8 @@ import kotlin.math.abs
|
||||
|
||||
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener,
|
||||
IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener,
|
||||
IMogoStatusChangedListener, IMoGoMapScreenListener {
|
||||
IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener,
|
||||
IMoGoAutopilotStatisticsListener {
|
||||
|
||||
const val TAG = "BadCase"
|
||||
|
||||
@@ -79,6 +86,10 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var reportTypeWindow: ReportTypeWindow ?= null
|
||||
|
||||
private lateinit var activity: FragmentActivity
|
||||
private var xPosition: Int = 0
|
||||
private var yPosition: Int = 0
|
||||
|
||||
fun init(context: Context) {
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
SpeechUtils.init(context)
|
||||
@@ -90,6 +101,10 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
if(ProjectUtils.isSaas()){
|
||||
CallerFsm2024ListenerManager.addListener(TAG,this)
|
||||
CallerAutopilotStatisticsListenerManager.addListener(TAG,this)
|
||||
}
|
||||
checkDelete(context)
|
||||
}
|
||||
|
||||
@@ -192,8 +207,13 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
* 开启工单上报弹窗
|
||||
*/
|
||||
fun reportWorkOrder(view: View){
|
||||
val activity = view.context as? FragmentActivity
|
||||
activity = view.context as? FragmentActivity
|
||||
?: throw IllegalStateException("please ensure context is FragmentActivity.")
|
||||
view.post {
|
||||
xPosition = (view.left+view.right)/2 - 228
|
||||
yPosition = view.top - 250
|
||||
}
|
||||
|
||||
view.setOnClickListener{
|
||||
if (ClickUtils.isFastClick()){
|
||||
if (NetworkUtils.isConnected()){
|
||||
@@ -208,10 +228,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
reportTypeWindow = null
|
||||
}
|
||||
})
|
||||
val xPosition: Int = (view.left+view.right)/2 - 228
|
||||
val yPosition: Int = view.top - 250
|
||||
reportTypeWindow?.showFloatWindow(xPosition,yPosition)
|
||||
}
|
||||
reportTypeWindow?.showFloatWindow(xPosition,yPosition)
|
||||
}else{
|
||||
//展示工单上报弹窗
|
||||
val workOrderWindow = WorkOrderWindow(activity)
|
||||
@@ -523,5 +541,58 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
CallerMapScreenListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新版FSM消息上报
|
||||
*/
|
||||
override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
|
||||
if(!fsmState.pilotStandbyFlag){
|
||||
//pilotStandbyFlag == false代表自动驾驶无法启动
|
||||
if(!BadCaseConfig.alreadyShowOneReport){
|
||||
//触发一键上报
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(reportTypeWindow == null){
|
||||
reportTypeWindow = ReportTypeWindow(activity)
|
||||
reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
reportTypeWindow?.hideFloatWindow()
|
||||
reportTypeWindow = null
|
||||
}
|
||||
})
|
||||
}
|
||||
reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition)
|
||||
BadCaseConfig.alreadyShowOneReport = true
|
||||
}
|
||||
}
|
||||
}else{
|
||||
BadCaseConfig.alreadyShowOneReport = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动驾驶状态统计
|
||||
* 触发机制:下发启动自动驾驶命令,根据MAP返回状态判断成功或失败
|
||||
* 统计四种状态:成功 失败 取消 超时
|
||||
* @param statistics 统计数据
|
||||
*/
|
||||
override fun onAutopilotStatistics(statistics: AutopilotStatistics?) {
|
||||
statistics?.let {
|
||||
if(it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED){
|
||||
//触发一键上报
|
||||
ThreadUtils.runOnUiThread{
|
||||
if(reportTypeWindow == null){
|
||||
reportTypeWindow = ReportTypeWindow(activity)
|
||||
reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
reportTypeWindow?.hideFloatWindow()
|
||||
reportTypeWindow = null
|
||||
}
|
||||
})
|
||||
}
|
||||
reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ object BadCaseConfig {
|
||||
var bagManagerList: ArrayList<BagInfoEntity> = ArrayList()
|
||||
|
||||
var notDisplayBagWindow: Boolean = false //主动录包不能展示弹窗
|
||||
//本次问题是否已经触发一键上报
|
||||
@JvmField
|
||||
var alreadyShowOneReport: Boolean = false
|
||||
|
||||
private const val resourceInitiative = "RESOURCE_INITIATIVE" //录包来源为主动录包
|
||||
private const val resourceAiData = "RESOURCE_AI_DATA" //录包来源为AI数据采集
|
||||
|
||||
@@ -54,6 +54,8 @@ class ReportTypeWindow constructor(activity: Activity): IMoGoDevaToolsListener {
|
||||
private var isOneClickType: Boolean = false //是否是一键上报类型
|
||||
private var hasReportOperate: Boolean = false //是否点击了一键上报按钮
|
||||
|
||||
private var oneClickTimer: CountDownTimer ?= null
|
||||
|
||||
init {
|
||||
initFloatWindow()
|
||||
}
|
||||
@@ -88,29 +90,9 @@ class ReportTypeWindow constructor(activity: Activity): IMoGoDevaToolsListener {
|
||||
private fun initEvent(){
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
if(isOneClickType){
|
||||
oneClickGroup.visibility = View.VISIBLE
|
||||
reportTypeGroup.visibility = View.GONE
|
||||
tvReportSuccess.visibility = View.GONE
|
||||
tvOneClickReportTitle.text = String.format(mActivity.resources.getString(R.string.identified_vehicle_malfunction),5)
|
||||
val oneClickTimer = object : CountDownTimer(5000, 1000) {
|
||||
override fun onTick(count: Long) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
tvOneClickReportTitle.text = String.format(mActivity.resources.getString(R.string.identified_vehicle_malfunction),round((count.toDouble()/1000)).toInt())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//如果有页面操作,则不自动关闭窗口
|
||||
if(!hasReportOperate){
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
oneClickTimer.start()
|
||||
showOneCLickReportView()
|
||||
}else{
|
||||
oneClickGroup.visibility = View.GONE
|
||||
reportTypeGroup.visibility = View.VISIBLE
|
||||
tvReportSuccess.visibility = View.GONE
|
||||
showTypeSelectView()
|
||||
}
|
||||
//一键上报
|
||||
ivOneClickReport.setOnClickListener {
|
||||
@@ -144,7 +126,40 @@ class ReportTypeWindow constructor(activity: Activity): IMoGoDevaToolsListener {
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示一键上报视图
|
||||
*/
|
||||
private fun showOneCLickReportView(){
|
||||
oneClickGroup.visibility = View.VISIBLE
|
||||
reportTypeGroup.visibility = View.GONE
|
||||
tvReportSuccess.visibility = View.GONE
|
||||
tvOneClickReportTitle.text = String.format(mActivity.resources.getString(R.string.identified_vehicle_malfunction),5)
|
||||
oneClickTimer = object : CountDownTimer(5000, 1000) {
|
||||
override fun onTick(count: Long) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
tvOneClickReportTitle.text = String.format(mActivity.resources.getString(R.string.identified_vehicle_malfunction),round((count.toDouble()/1000)).toInt())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//如果有页面操作,则不自动关闭窗口
|
||||
if(!hasReportOperate){
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
oneClickTimer?.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示类型选择视图
|
||||
*/
|
||||
private fun showTypeSelectView(){
|
||||
oneClickGroup.visibility = View.GONE
|
||||
reportTypeGroup.visibility = View.VISIBLE
|
||||
tvReportSuccess.visibility = View.GONE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,11 +170,33 @@ class ReportTypeWindow constructor(activity: Activity): IMoGoDevaToolsListener {
|
||||
fun showFloatWindow(xPosition: Int,yPosition: Int) {
|
||||
if (mFloatLayout.parent == null) {
|
||||
val metrics = DisplayMetrics()
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = xPosition
|
||||
mWindowParams!!.y = yPosition
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}else{
|
||||
//弹窗已存在,并且是一键上报弹窗,则将一键上报视图改为上报类型选择视图
|
||||
if(isOneClickType){
|
||||
oneClickTimer?.cancel()
|
||||
showTypeSelectView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示一键上报弹窗
|
||||
* @param xPosition X轴坐标
|
||||
* @param yPosition Y轴坐标
|
||||
*/
|
||||
fun showOneClickReportWindow(xPosition: Int,yPosition: Int){
|
||||
if(mFloatLayout.parent == null){
|
||||
isOneClickType = true
|
||||
val metrics = DisplayMetrics()
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = xPosition
|
||||
mWindowParams!!.y = yPosition
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
showOneCLickReportView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user