修改工控机异常回调显示

修改工控机异常回调显示
This commit is contained in:
xuxinchao
2022-03-21 11:28:09 +08:00
parent a79e7e6ee4
commit 2b83ad28d9

View File

@@ -1149,33 +1149,44 @@ class DebugSettingView @JvmOverloads constructor(
* 工控机异常回调
*/
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
guardianInfo?.let {
reportMsgLayout.visibility = View.VISIBLE
tvReportSrc.text = it.src
tvReportLevel.text = it.level
tvReportMsg.text = it.msg
tvReportCode.text = it.code
tvReportResult.text = it.getResult(0)
tvReportActions.text = it.getActions(0)
ThreadUtils.runOnUiThread{
guardianInfo?.let {
reportMsgLayout.visibility = View.VISIBLE
tvReportSrc.text = "src:${it.src}"
tvReportLevel.text = "level:${it.level}"
tvReportMsg.text = "msg:${it.msg}"
tvReportCode.text = "code:${it.code}"
var resultStr="result:"
for(result in it.resultList){
resultStr = "$resultStr$result "
}
tvReportResult.text = resultStr
if("error".equals(it.level)){
//字体为红色,吐司提示
tvReportSrc.setTextColor(Color.RED)
tvReportLevel.setTextColor(Color.RED)
tvReportMsg.setTextColor(Color.RED)
tvReportCode.setTextColor(Color.RED)
tvReportResult.setTextColor(Color.RED)
tvReportActions.setTextColor(Color.RED)
ToastUtils.showShort(it.msg)
}else{
tvReportSrc.setTextColor(Color.BLACK)
tvReportLevel.setTextColor(Color.BLACK)
tvReportMsg.setTextColor(Color.BLACK)
tvReportCode.setTextColor(Color.BLACK)
tvReportResult.setTextColor(Color.BLACK)
tvReportActions.setTextColor(Color.BLACK)
var actionStr="action:"
for(action in it.actionsList){
actionStr = "$actionStr$action "
}
tvReportActions.text = actionStr
if("error".equals(it.level)){
//字体为红色,吐司提示
tvReportSrc.setTextColor(Color.RED)
tvReportLevel.setTextColor(Color.RED)
tvReportMsg.setTextColor(Color.RED)
tvReportCode.setTextColor(Color.RED)
tvReportResult.setTextColor(Color.RED)
tvReportActions.setTextColor(Color.RED)
ToastUtils.showShort(it.msg)
}else{
tvReportSrc.setTextColor(Color.BLACK)
tvReportLevel.setTextColor(Color.BLACK)
tvReportMsg.setTextColor(Color.BLACK)
tvReportCode.setTextColor(Color.BLACK)
tvReportResult.setTextColor(Color.BLACK)
tvReportActions.setTextColor(Color.BLACK)
}
}
}
}