[6.4.4] increase the autopilot statistics status notice in msgbox
This commit is contained in:
@@ -69,12 +69,19 @@ object DataManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* FSM消息(缓存数据库时使用)
|
||||
* FM消息(缓存数据库时使用)
|
||||
*/
|
||||
private val fmInfoList by lazy {
|
||||
mutableListOf<MsgBoxBean>()
|
||||
}
|
||||
|
||||
/**
|
||||
* FSM消息(缓存数据库时使用)
|
||||
*/
|
||||
private val fsmInfoList by lazy {
|
||||
mutableListOf<MsgBoxBean>()
|
||||
}
|
||||
|
||||
private val scope by lazy {
|
||||
Utils.getApp().lifeCycleScope
|
||||
}
|
||||
@@ -149,6 +156,13 @@ object DataManager {
|
||||
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
|
||||
}
|
||||
|
||||
MsgBoxType.FSM -> {
|
||||
synchronized(this) {
|
||||
fsmInfoList.add(msg)
|
||||
}
|
||||
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
|
||||
}
|
||||
|
||||
MsgBoxType.SSMINFO -> {// 不存数据库
|
||||
CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg)
|
||||
}
|
||||
@@ -346,6 +360,18 @@ object DataManager {
|
||||
}
|
||||
}
|
||||
|
||||
MsgBoxType.FSM.ordinal -> {
|
||||
return@map MsgBoxBean(
|
||||
MsgBoxType.FSM,
|
||||
GsonUtils.fromJson(json, FSMMsg::class.java)
|
||||
).apply {
|
||||
this.timestamp = msgInfo.timeStamp
|
||||
withContext(Dispatchers.Main) {
|
||||
cacheNotifyList.add(this@apply)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
return@map null
|
||||
}
|
||||
@@ -396,6 +422,13 @@ object DataManager {
|
||||
fmInfoList.clear()
|
||||
}
|
||||
|
||||
if (fsmInfoList.isNotEmpty()) {
|
||||
fsmInfoList.forEach {
|
||||
msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp))
|
||||
}
|
||||
fsmInfoList.clear()
|
||||
}
|
||||
|
||||
if (msgInfoList.isNotEmpty()) {
|
||||
MsgBoxDb.getDb(context)
|
||||
.monitorDao()
|
||||
|
||||
@@ -46,7 +46,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
|
||||
private val fm: Int = 6
|
||||
private val ssm: Int = 7
|
||||
private val autopilot: Int = 8
|
||||
private val none: Int = 9
|
||||
private val fsm: Int = 9
|
||||
private val none: Int = 10
|
||||
|
||||
private var changeViewListener: ChangeViewListener?=null
|
||||
|
||||
@@ -103,6 +104,10 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_autopilot,parent,false)
|
||||
return BubbleAutopilotHolder(view)
|
||||
}
|
||||
fsm -> {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_fsm,parent,false)
|
||||
return BubbleFSMHolder(view)
|
||||
}
|
||||
else -> {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
|
||||
return BubbleV2XHolder(view)
|
||||
@@ -308,6 +313,16 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
|
||||
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
|
||||
}
|
||||
}
|
||||
|
||||
//FSM消息
|
||||
is BubbleFSMHolder ->{
|
||||
data?.let {
|
||||
val fsmMsg = it[position].msgBoxBean.bean as FSMMsg
|
||||
holder.tvFSMTitle.text = fsmMsg.title
|
||||
holder.tvFSMContent.text = fsmMsg.content
|
||||
holder.tvFSMTime.text = TimeUtils.millis2String(fsmMsg.timestamp,getHourMinFormat())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val msgBoxBean: MsgBoxCountDownBean = data!![position]
|
||||
@@ -361,6 +376,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
|
||||
ssm
|
||||
}else if(data!![position].msgBoxBean.type == MsgBoxType.AUTOPILOT){
|
||||
autopilot
|
||||
}else if(data!![position].msgBoxBean.type == MsgBoxType.FSM){
|
||||
fsm
|
||||
} else {
|
||||
v2x
|
||||
}
|
||||
@@ -445,6 +462,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
|
||||
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
|
||||
}
|
||||
|
||||
//FSM状态消息(现阶段提示启动自驾失败消息,过渡阶段提示,未来展示fsm消息提醒)
|
||||
class BubbleFSMHolder(itemView: View): RecyclerView.ViewHolder(itemView){
|
||||
var ivFSMImage: ImageView = itemView.findViewById(R.id.ivFSMImage)
|
||||
var tvFSMTitle: TextView = itemView.findViewById(R.id.tvFSMTitle)
|
||||
var tvFSMTime: TextView = itemView.findViewById(R.id.tvFSMTime)
|
||||
var tvFSMContent: TextView = itemView.findViewById(R.id.tvFSMContent)
|
||||
}
|
||||
|
||||
fun setChangeListener(listener: ChangeViewListener){
|
||||
changeViewListener = listener
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
|
||||
private val summary: Int = 8 //汇总消息
|
||||
private val ssm: Int = 9 //SSM连接消息
|
||||
private val autopilot = 20 //工控机连接消息
|
||||
private val fsm = 21 //fsm消息
|
||||
|
||||
private val none = -1
|
||||
|
||||
@@ -131,6 +132,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
|
||||
.inflate(R.layout.item_msg_box_autopilot,parent,false)
|
||||
return MsgBoxAutopilot(view)
|
||||
}
|
||||
fsm -> {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_msg_box_fsm,parent,false)
|
||||
return MsgBoxFSM(view)
|
||||
}
|
||||
else -> {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_msg_box_v2x, parent, false)
|
||||
@@ -696,6 +702,15 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
|
||||
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
|
||||
}
|
||||
}
|
||||
//fsm消息
|
||||
is MsgBoxFSM ->{
|
||||
data?.let {
|
||||
val fsmMsg = it[position].bean as FSMMsg
|
||||
holder.tvFSMTitle.text = fsmMsg.title
|
||||
holder.tvFSMContent.text = fsmMsg.content
|
||||
holder.tvFSMTime.text = TimeUtils.millis2String(fsmMsg.timestamp,getHourMinFormat())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,6 +751,8 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
|
||||
ssm
|
||||
} else if(data!![position].type == MsgBoxType.AUTOPILOT){
|
||||
autopilot
|
||||
} else if(data!![position].type == MsgBoxType.FSM){
|
||||
fsm
|
||||
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
|
||||
v2x
|
||||
} else {
|
||||
@@ -852,4 +869,12 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
|
||||
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
|
||||
}
|
||||
|
||||
//fsm状态
|
||||
class MsgBoxFSM(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
var ivFSMImage: ImageView = itemView.findViewById(R.id.ivFSMImage)
|
||||
var tvFSMTitle: TextView = itemView.findViewById(R.id.tvFSMTitle)
|
||||
var tvFSMTime: TextView = itemView.findViewById(R.id.tvFSMTime)
|
||||
var tvFSMContent: TextView = itemView.findViewById(R.id.tvFSMContent)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_804"
|
||||
android:layout_height="@dimen/dp_160"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/bg_msg_box_v2x"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="7dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivFSMImage"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_margin="25dp"
|
||||
android:src="@drawable/icon_warning_take_over"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvFSMContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivFSMImage"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_32"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/tvFSMTitle"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvFSMTitle"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:textColor="#80FFFFFF"
|
||||
android:textSize="24dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFSMTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvFSMTitle"
|
||||
app:layout_constraintRight_toRightOf="@id/tvFSMTime"
|
||||
android:textColor="#B3FFFFFF"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/clFSMLayout"
|
||||
android:layout_width="@dimen/dp_804"
|
||||
android:layout_height="@dimen/dp_160"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/bg_msg_box_v2x"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="7dp"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivFSMImage"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_margin="25dp"
|
||||
android:src="@drawable/icon_warning_take_over"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvFSMContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivFSMImage"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_32"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/tvFSMTitle"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvFSMTitle"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:textColor="#80FFFFFF"
|
||||
android:textSize="24dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFSMContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFSMTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvFSMTitle"
|
||||
app:layout_constraintRight_toRightOf="@id/tvFSMTime"
|
||||
android:textColor="#B3FFFFFF"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.eagle.core.data.msgbox
|
||||
|
||||
/**
|
||||
* fsm相关的消息
|
||||
*/
|
||||
data class FSMMsg(
|
||||
val type: Int,
|
||||
val title: String?,
|
||||
val content: String?,
|
||||
val timestamp : Long
|
||||
)
|
||||
@@ -2,5 +2,5 @@ package com.mogo.eagle.core.data.msgbox
|
||||
|
||||
enum class MsgBoxType {
|
||||
// 按功能划分为几大类:运营、通知、V2X模块、OBU模块、工控机Report、录制、交通、FM、语音、SSM、工控机相关等
|
||||
OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT
|
||||
OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT, FSM
|
||||
}
|
||||
@@ -1,13 +1,45 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.FSMMsg
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.trace.CallerTrace
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
object CallerAutopilotStatisticsListenerManager : CallerBase<IMoGoAutopilotStatisticsListener>() {
|
||||
|
||||
private var autopilotStatistics: AutopilotStatistics? by Delegates.observable(null) { _, _, newV ->
|
||||
newV?.let {
|
||||
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isTakeoverRemind &&
|
||||
it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED) {
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.FSM,
|
||||
FSMMsg(
|
||||
0,
|
||||
"自动驾驶启动失败",
|
||||
it.failedMessage.msg,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
CallerTrace.write("AutopilotStatistics", mapOf("autopilotStatistics" to it,
|
||||
"isDemoMode" to FunctionBuildConfig.isDemoMode,
|
||||
"isTakeoverRemind" to FunctionBuildConfig.isTakeoverRemind))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Synchronized
|
||||
fun invokeAutopilotStatistics(statistics: AutopilotStatistics?) {
|
||||
autopilotStatistics = statistics
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotStatistics(statistics)
|
||||
|
||||
Reference in New Issue
Block a user