Merge remote-tracking branch 'origin/dev_robotaxi-d_250804_8.2.0' into dev_robotaxi-d_250804_8.2.0

This commit is contained in:
xuxinchao
2025-08-13 16:27:45 +08:00
17 changed files with 417 additions and 125 deletions

View File

@@ -494,13 +494,11 @@ class MoGoHmiProvider : IMoGoHmiProvider {
if (target != null && target.visibility != View.VISIBLE) {
TransitionManager.beginDelayedTransition(target.parent as ViewGroup, Slide(Gravity.START).also { it.duration = 150; it.addTarget(target) })
target.visibility = View.VISIBLE
CallerHmiViewControlListenerManager.invokeOperatePanelDisplayStatus(true)
}
} else {
if (target != null && target.visibility == View.VISIBLE) {
TransitionManager.beginDelayedTransition(target.parent as ViewGroup, Slide(Gravity.START).also { it.duration = 150; it.addTarget(target) })
target.visibility = View.GONE
CallerHmiViewControlListenerManager.invokeOperatePanelDisplayStatus(false)
}
}
}

View File

@@ -332,7 +332,10 @@ class OperatePanelLayout : LinearLayout {
class V2XPreferenceFragmentCompat : OperatePanelDetailBase(), IV2XListener,
IMoGoAutopilotStatusListener,IViewControlListener {
private var v2xIsShow: Boolean = false
private var operatePaneIsShow = true
private var prevIpcConnectStatus = false
private var customToast: Toast? = null
companion object {
private const val TAG = "V2XPreferenceFragmentCompat"
private const val NDE_UPWARD_SWITCH = "nde_upward_switch" //NDE数据上车上行
@@ -347,6 +350,8 @@ class OperatePanelLayout : LinearLayout {
private const val V2I_WEAK_TRAFFIC_PARTICIPANT = "v2i_weak_traffic_participant" //弱势交通参与者
private const val V2I_PERCEPTION_DATA_TO_PNC = "v2i_perception_data_to_pnc" //感知数据进PNC应用
private const val V2V_DOWNWARD_SWITCH = "v2v_downward_switch" //V2V下行
private const val WHAT_UPDATE_ENABLE = 0x00//更新按钮状态
}
override fun onCreateView(inflater: LayoutInflater,
@@ -361,25 +366,31 @@ class OperatePanelLayout : LinearLayout {
//车辆图像上传行云大模型状态查询
CallerAutoPilotControlManager.sendImgUploadCloudStatusQuery()
}
prevIpcConnectStatus = AppConfigInfo.isConnectAutopilot
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(TAG,this)
return super.onCreateView(inflater, container, savedInstanceState)
}
override fun onDestroyView() {
super.onDestroyView()
CallerV2XManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
super.onDestroyView()
CallerHmiViewControlListenerManager.removeListener(TAG)
handler.removeCallbacksAndMessages(null)
}
override fun operatePanelDisplayStatus(isShow: Boolean) {
super.operatePanelDisplayStatus(isShow)
if(isShow){
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
FunctionBuildConfig.v2xIsShow = true
}else{
CallerAutoPilotStatusListenerManager.removeListener(TAG)
FunctionBuildConfig.v2xIsShow = false
operatePaneIsShow = isShow
if (isShow) {
if (v2xIsShow) {
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
} else {
handler.removeMessages(WHAT_UPDATE_ENABLE)
customToast?.cancel()
customToast = null
}
}
@@ -442,95 +453,70 @@ class OperatePanelLayout : LinearLayout {
}
override fun onResume() {
FunctionBuildConfig.v2xIsShow = true
if(AppConfigInfo.isConnectAutopilot){
FunctionBuildConfig.currentStatus = true
handler.removeMessages(2)
handler.sendEmptyMessage(1)
}else{
FunctionBuildConfig.currentStatus = false
handler.removeMessages(1)
handler.sendEmptyMessage(2)
}
super.onResume()
prevIpcConnectStatus = AppConfigInfo.isConnectAutopilot
v2xIsShow = true
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
override fun onPause() {
FunctionBuildConfig.v2xIsShow = false
handler.removeMessages(1)
handler.removeMessages(2)
super.onPause()
v2xIsShow = false
handler.removeMessages(WHAT_UPDATE_ENABLE)
customToast?.cancel()
customToast = null
}
private val handler =object : Handler(Looper.getMainLooper()){
override fun handleMessage(msg: Message){
private val handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
//与域控连接正常
if(msg.what == 1){
Log.i(TAG,"与域控连接正常 handler操作1")
setEnableStatus(true)
FunctionBuildConfig.currentStatus = true
this.removeMessages(2)
}
//与域控断连
else if(msg.what == 2){
Log.i(TAG,"与域控断连 handler操作2 ="+FunctionBuildConfig.v2xIsShow)
if(FunctionBuildConfig.v2xIsShow){
Log.i(TAG,"currentStatus = "+FunctionBuildConfig.currentStatus)
if(FunctionBuildConfig.currentStatus){
return
}
Log.i(TAG,"执行断连UI操作")
setEnableStatus(false)
if (msg.what == WHAT_UPDATE_ENABLE) {
if (this.hasMessages(WHAT_UPDATE_ENABLE)) {
this.removeMessages(WHAT_UPDATE_ENABLE)
}
setEnableStatus(AppConfigInfo.isConnectAutopilot)
if (AppConfigInfo.isConnectAutopilot) {
customToast?.cancel()
customToast = null
} else {
showConnectToast()
this.removeMessages(2)
this.sendEmptyMessageDelayed(2,5000)
this.sendEmptyMessageDelayed(WHAT_UPDATE_ENABLE, 5000)
}
}
}
}
private var lastToastTime: Long = 0L
private fun showConnectToast(){
if(System.currentTimeMillis() - lastToastTime > 4500){
try {
AppStateManager.currentActivity()?.let {
val customToastView = it.layoutInflater.inflate(R.layout.view_ipc_connect_status_toast,null)
val customToast = Toast(MainMoGoApplication.getApp().applicationContext)
customToast.duration = Toast.LENGTH_SHORT
customToast.view = customToastView
customToast.setGravity(Gravity.START,AutoSizeUtils.dp2px(MainMoGoApplication.getApp().applicationContext, 280f),0)
customToast.show()
}
}catch (_: Exception){}
lastToastTime = System.currentTimeMillis()
private fun showConnectToast() {
try {
AppStateManager.currentActivity()?.let {
val customToastView =
it.layoutInflater.inflate(R.layout.view_ipc_connect_status_toast, null)
customToast = Toast(MainMoGoApplication.getApp().applicationContext)
customToast!!.duration = Toast.LENGTH_SHORT
customToast!!.view = customToastView
customToast!!.setGravity(
Gravity.START,
AutoSizeUtils.dp2px(MainMoGoApplication.getApp().applicationContext, 280f),
0
)
customToast!!.show()
}
} catch (_: Exception) {
}
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
reason: String?
){
ThreadUtils.runOnUiThread{
if(status == AdasConstants.IpcConnectionStatus.CONNECTED){
//域控连接成功,恢复正常状态
Log.i(TAG,"域控连接成功")
// handler.sendEmptyMessage(1)
// handler.removeMessages(2)
// if(!currentStatus){
// currentStatus = true
// }
this.onResume()
}else{
//断连中,持续提示:请等待与域控恢复连接后操作;并且将所有开关置为不可用状态
Log.i(TAG,"请等待与域控恢复连接后操作"+FunctionBuildConfig.currentStatus)
FunctionBuildConfig.currentStatus = false
handler.removeMessages(1)
handler.sendEmptyMessage(2)
this.onResume()
) {
if (prevIpcConnectStatus != AppConfigInfo.isConnectAutopilot) {
if (operatePaneIsShow && v2xIsShow) {
handler.sendEmptyMessage(WHAT_UPDATE_ENABLE)
}
}
prevIpcConnectStatus = AppConfigInfo.isConnectAutopilot
}
private fun setEnableStatus(isEnable: Boolean){
@@ -1964,4 +1950,9 @@ class OperatePanelLayout : LinearLayout {
}
isClickable = true
}
override fun onVisibilityChanged(changedView: View, visibility: Int) {
super.onVisibilityChanged(changedView, visibility)
CallerHmiViewControlListenerManager.invokeOperatePanelDisplayStatus(visibility == View.VISIBLE)
}
}