IPC Report
异常上报弹窗改版,根据Result区分出Error和Warning
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,24 +281,28 @@ import java.util.*
|
||||
|
||||
/**
|
||||
* 展示工控机监控上报数据
|
||||
* @param reportList 上报数据列表
|
||||
* @param errorReportList 错误级别上报数据列表
|
||||
* @param warningReportList 提醒级别上报数据列表
|
||||
* @param reportLevel 1:error级别 2:warning级别
|
||||
*/
|
||||
override fun showIPCReportWindow(reportList: ArrayList<ReportEntity>) {
|
||||
override fun showIPCReportWindow(errorReportList: ArrayList<ReportEntity>,warningReportList: ArrayList<ReportEntity>,reportLevel: Int) {
|
||||
ThreadUtils.runOnUiThread{
|
||||
if(ipcReportWindow==null){
|
||||
ipcReportWindow= activity?.let { IPCReportWindow(it) }
|
||||
ipcReportWindow?.setClickListener(object: IPCReportWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
ipcReportWindow?.hideFloatWindow()
|
||||
ipcReportWindow =null
|
||||
if(reportLevel == 1){
|
||||
if(ipcReportWindow==null){
|
||||
ipcReportWindow= activity?.let { IPCReportWindow(it) }
|
||||
ipcReportWindow?.setClickListener(object: IPCReportWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
ipcReportWindow?.hideFloatWindow()
|
||||
ipcReportWindow =null
|
||||
}
|
||||
})
|
||||
ipcReportWindow?.let {
|
||||
SoundUtils.playRing(requireContext())
|
||||
}
|
||||
})
|
||||
ipcReportWindow?.let {
|
||||
SoundUtils.playRing(requireContext())
|
||||
}
|
||||
ipcReportWindow?.showFloatWindow()
|
||||
}
|
||||
ipcReportWindow?.showFloatWindow()
|
||||
ipcReportWindow?.refreshData(reportList)
|
||||
ipcReportWindow?.refreshData(errorReportList,warningReportList,reportLevel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.PixelFormat
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
@@ -23,6 +24,8 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
private var mWindowManager: WindowManager? = null
|
||||
private lateinit var rvIPCReport: RecyclerView
|
||||
private lateinit var ivIpcClose: ImageView
|
||||
private lateinit var tvIpcErrorTab: TextView
|
||||
private lateinit var tvIpcWarningTab: TextView
|
||||
private var ipcReportAdapter: IPCReportAdapter?=null
|
||||
|
||||
private lateinit var mFloatLayout: View
|
||||
@@ -35,6 +38,9 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
private var ipcErrorReportList: List<ReportEntity>? = null //错误上报列表
|
||||
private var ipcWarningReportList: List<ReportEntity>? = null//警告上报列表
|
||||
|
||||
init {
|
||||
initFloatWindow();
|
||||
}
|
||||
@@ -44,28 +50,47 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
mFloatLayout.setOnTouchListener(this)
|
||||
rvIPCReport= mFloatLayout.findViewById(R.id.rv_ipc_report)
|
||||
ivIpcClose = mFloatLayout.findViewById(R.id.iv_ipc_close)
|
||||
tvIpcErrorTab = mFloatLayout.findViewById(R.id.tv_ipc_error_tab)
|
||||
tvIpcWarningTab = mFloatLayout.findViewById(R.id.tv_ipc_warning_tab)
|
||||
mWindowParams = WindowManager.LayoutParams()
|
||||
mWindowManager = mActivity.windowManager
|
||||
mWindowParams?.let {
|
||||
it.format = PixelFormat.RGBA_8888
|
||||
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
it.gravity = Gravity.START or Gravity.TOP
|
||||
it.width = 600
|
||||
it.height = 800
|
||||
it.alpha = 0.9f
|
||||
it.width = 924
|
||||
it.height = 444
|
||||
it.alpha = 1.0f
|
||||
}
|
||||
ipcReportAdapter = IPCReportAdapter()
|
||||
rvIPCReport.layoutManager = WrapContentLinearLayoutManager(mActivity,
|
||||
LinearLayoutManager.VERTICAL,false)
|
||||
rvIPCReport.adapter = ipcReportAdapter
|
||||
|
||||
//关闭按钮
|
||||
ivIpcClose.setOnClickListener {
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
//错误列表
|
||||
tvIpcErrorTab.setOnClickListener {
|
||||
ipcReportAdapter?.setData(ipcErrorReportList)
|
||||
ipcReportAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
//预警列表
|
||||
tvIpcWarningTab.setOnClickListener {
|
||||
ipcReportAdapter?.setData(ipcWarningReportList)
|
||||
ipcReportAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun refreshData(data:List<ReportEntity>){
|
||||
ipcReportAdapter?.setData(data)
|
||||
fun refreshData(errorReportList:List<ReportEntity>,warningReportList:List<ReportEntity>,reportLevel: Int){
|
||||
if(reportLevel == 1){
|
||||
ipcReportAdapter?.setData(errorReportList)
|
||||
ipcErrorReportList = errorReportList
|
||||
}else{
|
||||
ipcReportAdapter?.setData(warningReportList)
|
||||
ipcWarningReportList = warningReportList
|
||||
}
|
||||
ipcReportAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@@ -103,7 +128,8 @@ class IPCReportWindow constructor(activity: Activity) : View.OnTouchListener{
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels / 2 - getSysBarHeight(mActivity)
|
||||
// mWindowParams!!.y = metrics.heightPixels / 2 - getSysBarHeight(mActivity)
|
||||
mWindowParams!!.y = metrics.heightPixels - getSysBarHeight(mActivity)-100
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#029DFF"
|
||||
android:endColor="#0056FF"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:topLeftRadius="40px" />
|
||||
</shape>
|
||||
@@ -11,7 +11,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/ipc_report_time"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -24,7 +24,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvReportTimeTitle"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
@@ -36,7 +36,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReportTimeTitle"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/ipc_report_type"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -49,8 +49,8 @@
|
||||
app:layout_constraintTop_toTopOf="@id/tvReportResultTitle"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvReportResultTitle"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textColor="@color/color_FF0006"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="16sp"
|
||||
android:minLines="1"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
@@ -62,7 +62,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReportResultContent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/ipc_report_msg"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -76,8 +76,8 @@
|
||||
app:layout_constraintLeft_toRightOf="@id/tvReportMsgTitle"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:minLines="1"
|
||||
android:textColor="@color/color_FF0006"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReportMsgContent"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/ipc_report_action"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -103,7 +103,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:minLines="1"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
@@ -113,8 +113,10 @@
|
||||
android:background="#F0F0F0"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReportActionContent"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,49 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="500px"
|
||||
android:layout_height="350px"
|
||||
android:layout_width="924px"
|
||||
android:layout_height="444px"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ipc_drag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_drag"
|
||||
android:padding="10dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ipc_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_report_close"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_ipc_drag"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_ipc_drag"
|
||||
android:padding="10dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dialog_bg_color"
|
||||
app:roundLayoutRadius="10dp">
|
||||
app:roundLayoutRadius="40px">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ipc_error_tab"
|
||||
android:layout_width="412px"
|
||||
android:layout_height="90px"
|
||||
android:text="Error"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/ipc_error_tab_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ipc_warning_tab"
|
||||
android:layout_width="412px"
|
||||
android:layout_height="90px"
|
||||
android:text="Warning"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tv_ipc_error_tab"
|
||||
android:background="#3A57C5"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ipc_close"
|
||||
android:layout_width="100px"
|
||||
android:layout_height="90px"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@drawable/icon_ipc_close"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_ipc_report"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_ipc_error_tab"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
|
||||
|
||||
@@ -243,9 +243,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy {
|
||||
|
||||
/**
|
||||
* 展示工控机监控上报数据
|
||||
* @param reportList 上报数据列表
|
||||
* @param errorReportList 错误级别上报数据列表
|
||||
* @param warningReportList 提醒级别上报数据列表
|
||||
* @param reportLevel 1:error级别 2:warning级别
|
||||
*/
|
||||
fun showIPCReportWindow(reportList: ArrayList<ReportEntity>)
|
||||
fun showIPCReportWindow(errorReportList: ArrayList<ReportEntity>,warningReportList: ArrayList<ReportEntity>,reportLevel: Int)
|
||||
|
||||
fun showVideoDialog(url: String, isFlvUrl: Boolean)
|
||||
}
|
||||
@@ -352,10 +352,12 @@ object CallerHmiManager : CallerBase() {
|
||||
|
||||
/**
|
||||
* 展示工控机监控上报数据
|
||||
* @param reportList 上报数据列表
|
||||
* @param errorReportList 错误级别上报数据列表
|
||||
* @param warningReportList 提醒级别上报数据列表
|
||||
* @param reportLevel 1:error级别 2:warning级别
|
||||
*/
|
||||
fun showIPCReportWindow(reportList: ArrayList<ReportEntity>){
|
||||
waringProviderApi?.showIPCReportWindow(reportList)
|
||||
fun showIPCReportWindow(errorReportList: ArrayList<ReportEntity>,warningReportList: ArrayList<ReportEntity>,reportLevel: Int){
|
||||
waringProviderApi?.showIPCReportWindow(errorReportList,warningReportList,reportLevel)
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
|
||||
Reference in New Issue
Block a user