diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt index 1e158f6777..899ee755a8 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt @@ -16,13 +16,23 @@ import mogo_msg.MogoReportMsg */ class IPCReportManager : IMoGoAutopilotStatusListener { - private var ipcReportList = arrayListOf() + private var ipcErrorReportList = arrayListOf() //错误上报列表 + private var ipcWarningReportList = arrayListOf() //警告上报列表 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) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 8d0f923de7..22497d9f1a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -281,24 +281,28 @@ import java.util.* /** * 展示工控机监控上报数据 - * @param reportList 上报数据列表 + * @param errorReportList 错误级别上报数据列表 + * @param warningReportList 提醒级别上报数据列表 + * @param reportLevel 1:error级别 2:warning级别 */ - override fun showIPCReportWindow(reportList: ArrayList) { + override fun showIPCReportWindow(errorReportList: ArrayList,warningReportList: ArrayList,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) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/IPCReportWindow.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/IPCReportWindow.kt index aa4f8277a3..1c74fbaf9d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/IPCReportWindow.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/IPCReportWindow.kt @@ -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? = null //错误上报列表 + private var ipcWarningReportList: List? = 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){ - ipcReportAdapter?.setData(data) + fun refreshData(errorReportList:List,warningReportList:List,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) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_ipc_close.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_ipc_close.png new file mode 100644 index 0000000000..99ed84f464 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_ipc_close.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/ipc_error_tab_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/ipc_error_tab_bg.xml new file mode 100644 index 0000000000..58a14ac5c7 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/ipc_error_tab_bg.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_ipc_report.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_ipc_report.xml index b055c72d90..1710d1291f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_ipc_report.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_ipc_report.xml @@ -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" /> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_ipc_report.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_ipc_report.xml index 066d30f6db..101153a73c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_ipc_report.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_ipc_report.xml @@ -1,49 +1,57 @@ - - - - - - - - + app:roundLayoutRadius="40px"> + + + + + + + android:layout_height="0dp" + app:layout_constraintTop_toBottomOf="@id/tv_ipc_error_tab" + app:layout_constraintBottom_toBottomOf="parent" + /> diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index c766cc953d..319355e34a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -243,9 +243,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy { /** * 展示工控机监控上报数据 - * @param reportList 上报数据列表 + * @param errorReportList 错误级别上报数据列表 + * @param warningReportList 提醒级别上报数据列表 + * @param reportLevel 1:error级别 2:warning级别 */ - fun showIPCReportWindow(reportList: ArrayList) + fun showIPCReportWindow(errorReportList: ArrayList,warningReportList: ArrayList,reportLevel: Int) fun showVideoDialog(url: String, isFlvUrl: Boolean) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 6efce9500d..5079e905b4 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -352,10 +352,12 @@ object CallerHmiManager : CallerBase() { /** * 展示工控机监控上报数据 - * @param reportList 上报数据列表 + * @param errorReportList 错误级别上报数据列表 + * @param warningReportList 提醒级别上报数据列表 + * @param reportLevel 1:error级别 2:warning级别 */ - fun showIPCReportWindow(reportList: ArrayList){ - waringProviderApi?.showIPCReportWindow(reportList) + fun showIPCReportWindow(errorReportList: ArrayList,warningReportList: ArrayList,reportLevel: Int){ + waringProviderApi?.showIPCReportWindow(errorReportList,warningReportList,reportLevel) } @JvmOverloads