[dev_robotaxi-d_230412_2.15.0]同步调整消息盒子队列处理方式+接管

This commit is contained in:
xuxinchao
2023-04-19 14:43:26 +08:00
parent 44560f8978
commit 7785fff66d
8 changed files with 60 additions and 38 deletions

View File

@@ -52,7 +52,7 @@ class BusPassengerMsgBoxBubbleView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean){
UiThreadHandler.post{
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
@@ -65,7 +65,7 @@ class BusPassengerMsgBoxBubbleView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -171,7 +171,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post{
UiThreadHandler.post({
when (category) {
MsgCategory.NOTICE -> {
noticeList?.add(0,msgBoxList)
@@ -192,7 +192,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -55,7 +55,7 @@ class MBoxBubbleView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post {
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
@@ -68,7 +68,7 @@ class MBoxBubbleView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -49,14 +49,14 @@ class MMsgBoxBubbleView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post {
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
update(msgBoxList)
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
private fun update(msgBoxList: MsgBoxBean){

View File

@@ -56,7 +56,7 @@ class MMsgBoxListView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post{
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
@@ -66,7 +66,7 @@ class MMsgBoxListView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -57,7 +57,7 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post {
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
@@ -70,7 +70,7 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -60,7 +60,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post{
UiThreadHandler.post({
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
@@ -70,7 +70,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
}
}
}
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
@@ -31,6 +32,10 @@ class TakeOverView @JvmOverloads constructor(
const val TAG = "TakeOverView"
}
private var autopilotStatus: Int = 0 //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中,7:平行驾驶中
private var isParallel: Boolean = false //是否是平行驾驶
init {
LayoutInflater.from(context).inflate(R.layout.view_take_over, this, true)
}
@@ -42,6 +47,20 @@ class TakeOverView @JvmOverloads constructor(
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
/**
* 自动驾驶状态信息
*
* @param autoPilotStatusInfo 状态信息
*/
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
autopilotStatus = autoPilotStatusInfo.state
if(autoPilotStatusInfo.state == 7){
isParallel = true
}else if(autoPilotStatusInfo.state == 0 || autoPilotStatusInfo.state == 1){
isParallel = false
}
}
/**
* 工控机监控节点上报
*/
@@ -84,38 +103,41 @@ class TakeOverView @JvmOverloads constructor(
takeOver = false
visibility = View.GONE
}
},isFromObu = false
)
}
,isFromObu = false)
}
//弱网
MogoReport.Code.Error.EMAP.EPARALLEL_AICLOUD_NETWORK_WEAK,
MogoReport.Code.Error.EMAP.EPARALLEL_AICLOUD_CONNECTION_ERROR -> {
CallerHmiManager.warningV2X(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
//加入消息盒子
saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X, V2XMsg(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts
//如果是平行驾驶状态下,提示弱网接管
if(isParallel){
CallerHmiManager.warningV2X(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
//加入消息盒子
saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X, V2XMsg(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts
)
)
)
)
}
}
override fun onDismiss() {
takeOver = false
visibility = View.GONE
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
}
},isFromObu = false
)
,isFromObu = false)
}
}
}
}