From 09cb96d14c9c31e62f204ca700a05e09b6305a87 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Sun, 29 Sep 2024 15:41:37 +0800 Subject: [PATCH] =?UTF-8?q?[6.7.0]=E8=B0=83=E6=95=B4=E6=8E=A5=E7=AE=A1?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A7=A6=E5=8F=91=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E7=94=B1=E6=8E=A5=E7=AE=A1=E8=A7=A6=E5=8F=91=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badcase/BadCaseManager.kt | 148 ++++++------------ 1 file changed, 44 insertions(+), 104 deletions(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index f84134d115..9dd21d2b12 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -39,7 +39,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoTakeoverListener import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener @@ -47,10 +47,10 @@ import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerTakeoverListenerManager import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager @@ -65,15 +65,12 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast import com.mogo.eagle.core.utilcode.util.* import com.mogo.eagle.core.utilcode.util.FileUtils.millis2String import com.mogo.tts.base.SpeechUtils -import com.zhjt.mogo.adas.data.bean.AutopilotStatistics import com.zhjt.mogo_core_function_devatools.badcase.biz.* import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils import com.zhjt.mogo_core_function_devatools.ext.enqueuePop import com.zhjt.mogo_core_function_devatools.workorder.ReportTypeWindow -import com.zhjt.mogo_core_function_devatools.workorder.WorkOrderWindow -import fsm.Fsm2024 import me.jessyan.autosize.utils.AutoSizeUtils import record_cache.RecordPanelOuterClass import java.io.File @@ -82,9 +79,9 @@ import kotlin.math.abs internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener, IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener, - IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener, + IMogoStatusChangedListener, IMoGoMapScreenListener, IMoGoChassisStatesListener, IMoGoAutopilotStatusListener, - IDataCenterBizListener { + IDataCenterBizListener, IMoGoTakeoverListener { const val TAG = "BadCase" @@ -125,10 +122,10 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis MogoStatusManager.getInstance() .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) if(ProjectUtils.isSaas()){ -// CallerFsm2024ListenerManager.addListener(TAG,this) CallerDataCenterBizListener.addListener(TAG,this) CallerAutoPilotStatusListenerManager.addListener("RecordViewManager",this) CallerChassisStatesListenerManager.addListener(TAG,this) + CallerTakeoverListenerManager.addListener(TAG,this) } checkDelete(context) } @@ -562,102 +559,6 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis CallerMapScreenListenerManager.removeListener(TAG) } - /** - * 新版FSM消息上报 - */ - override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) { - Log.i(TAG,"onFSM2024State fsmState.pilotStandbyFlag="+fsmState.pilotStandbyFlag+" pilotNotStandbyReason="+ fsmState.pilotNotStandbyReason) -// if(fsmState.pilotStandbyFlag){ -// BadCaseConfig.fsmAlreadyStandby = true -// } -// if(BadCaseConfig.fsmAlreadyStandby){ -// if(!fsmState.pilotStandbyFlag){ -// //pilotStandbyFlag == false代表自动驾驶无法启动 -// if(!BadCaseConfig.alreadyShowOneReport){ -// //触发一键上报 -// ThreadUtils.runOnUiThread { -// val activity = AppStateManager.currentActivity() -// if (activity !is AppCompatActivity) { -// return@runOnUiThread -// } -// if(reportTypeWindow == null){ -// reportTypeWindow = ReportTypeWindow(activity) -// reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{ -// override fun closeWindow() { -// reportTypeWindow?.hideFloatWindow() -// reportTypeWindow = null -// } -// }) -// } -// reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition) -// BadCaseConfig.alreadyShowOneReport = true -// } -// } -// }else{ -// BadCaseConfig.alreadyShowOneReport = false -// } -// } - } - - - /** - * 刹车 - */ - override fun onAutopilotBrake(brake: Float) { - Log.i(TAG, "onAutopilotBrake brake = $brake") - } - - /** - * 车辆方向盘转向角回调 - * @param steering 方向盘转向角 - */ - override fun onAutopilotSteeringData(steering: Float) { - Log.i(TAG, "onAutopilotSteeringData steering = $steering") - } - - /** - * 自动驾驶状态信息 - * @param state 状态信息 - */ - override fun onAutopilotStatusResponse(state: Int){ - Log.i(TAG, "onAutopilotStatusResponse state = $state") - if(state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ - shouldRecord = true - }else if(state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE || - state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){ - if(shouldRecord){ - val activity = AppStateManager.currentActivity() - if (activity !is AppCompatActivity) { - return - } - val geocodeSearch = GeocodeSearch(activity) - geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener { - override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { - regeocodeResult?.regeocodeAddress?.formatAddress?.let { - address = it - } - val takeOverRecordInfo = TakeOverRecordInfo(System.currentTimeMillis(), - address,level1Id,level2Id,level3Id, - level1Name, level2Name, level3Name, - BadCaseConfig.lineName,reportNote, - reportStatus = false, - selectStatus = false - ) - CallerTakeOverManager.insertRecord(activity,takeOverRecordInfo) - shouldRecord = false - } - - override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { - - } - }) - val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude) - val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP) - geocodeSearch.getFromLocationAsyn(q) - } - } - } - override fun invokeOrderLine(lineName: String) { BadCaseConfig.lineName = lineName } @@ -679,4 +580,43 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis } } + /** + * 接管状态回调 + * @param state 0:未接管,1:油门接管,2:刹车接管,3:方向盘接管,4:遥控器接管,5:远程人工接管, + * 6:硬件开关接管,7:软件接管,8:云端计算机接管,9:其他接管方式,255:缺省(鹰眼中表示数据异常) + */ + override fun onTakeoverState(state: Int) { + Log.i(TAG, "onTakeoverState state=$state") + if(state == 1 || state == 2 || state == 3){ + val activity = AppStateManager.currentActivity() + if (activity !is AppCompatActivity) { + return + } + val geocodeSearch = GeocodeSearch(activity) + geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener { + override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { + regeocodeResult?.regeocodeAddress?.formatAddress?.let { + address = it + } + val takeOverRecordInfo = TakeOverRecordInfo(System.currentTimeMillis(), + address,level1Id,level2Id,level3Id, + level1Name, level2Name, level3Name, + BadCaseConfig.lineName,reportNote, + reportStatus = false, + selectStatus = false + ) + CallerTakeOverManager.insertRecord(activity,takeOverRecordInfo) + shouldRecord = false + } + + override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { + + } + }) + val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude) + val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP) + geocodeSearch.getFromLocationAsyn(q) + } + } + }