IPC Report

异常上报弹窗改版,根据Result区分出Error和Warning
This commit is contained in:
xuxinchao
2022-07-25 18:08:24 +08:00
parent d4371e3d1a
commit 4bf8e21544
9 changed files with 159 additions and 75 deletions

View File

@@ -16,13 +16,23 @@ import mogo_msg.MogoReportMsg
*/
class IPCReportManager : IMoGoAutopilotStatusListener {
private var ipcReportList = arrayListOf<ReportEntity>()
private var ipcErrorReportList = arrayListOf<ReportEntity>() //错误上报列表
private var ipcWarningReportList = arrayListOf<ReportEntity>() //警告上报列表
companion object{
const val TAG ="IPCReportManager"
val INSTANCE: IPCReportManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
IPCReportManager()
}
//Warning
const val RESULT_AUTOPILOT_INFERIOR = "RESULT_AUTOPILOT_INFERIOR"
const val RESULT_SHOW_WARNING = "RESULT_SHOW_WARNING"
const val RESULT_REMOTEPILOT_INFERIOR = "RESULT_REMOTEPILOT_INFERIOR"
//Error
const val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
const val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
const val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
}
fun initServer(){
@@ -38,17 +48,38 @@ class IPCReportManager : IMoGoAutopilotStatusListener {
*/
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
guardianInfo?.let{
if(it.level=="error"){
if(ipcReportList.size>19){
ipcReportList.removeLast()
//Error 弹窗并有提示音
if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| it.resultList.contains(RESULT_REMOTEPILOT_DISABLE)){
if(ipcErrorReportList.size>19){
ipcErrorReportList.removeLast()
}
ipcReportList.add(0,
ipcErrorReportList.add(0,
ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()),
it.src,it.level,it.msg,it.code,it.resultList,it.actionsList))
//当前不处于美化模式时,展示监控节点上报
if(!FunctionBuildConfig.isDemoMode){
if(FunctionBuildConfig.isReportWarning){
CallerHmiManager.showIPCReportWindow(ipcReportList)
CallerHmiManager.showIPCReportWindow(ipcErrorReportList,ipcWarningReportList,1)
}
}
}
//Warning 不弹窗也不会有提示音
else if(it.resultList.contains(RESULT_AUTOPILOT_INFERIOR)
|| it.resultList.contains(RESULT_SHOW_WARNING)
|| it.resultList.contains(RESULT_REMOTEPILOT_INFERIOR)){
if(ipcWarningReportList.size>19){
ipcWarningReportList.removeLast()
}
ipcWarningReportList.add(0,
ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()),
it.src,it.level,it.msg,it.code,it.resultList,it.actionsList))
//当前不处于美化模式时,展示监控节点上报
if(!FunctionBuildConfig.isDemoMode){
if(FunctionBuildConfig.isReportWarning){
CallerHmiManager.showIPCReportWindow(ipcErrorReportList,ipcWarningReportList,2)
}
}
}