From 38cd6c92af63eec5cd97a9d2579cd0a9c1311749 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Tue, 27 Aug 2024 15:03:28 +0800 Subject: [PATCH] =?UTF-8?q?[6.6.0]=E6=8E=A5=E7=AE=A1=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E4=BB=A5=E5=8F=8A=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badcase/BadCaseManager.kt | 85 ++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) 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 c4b7866d2e..048c4bf586 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 @@ -7,6 +7,7 @@ import android.content.Context import android.graphics.Bitmap import android.os.Environment import android.os.SystemClock +import android.util.Log import android.view.View import android.view.WindowManager import androidx.appcompat.app.AppCompatActivity @@ -14,6 +15,11 @@ import androidx.fragment.app.FragmentActivity import androidx.lifecycle.Lifecycle.Event import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner +import com.amap.api.services.core.LatLonPoint +import com.amap.api.services.geocoder.GeocodeResult +import com.amap.api.services.geocoder.GeocodeSearch +import com.amap.api.services.geocoder.RegeocodeQuery +import com.amap.api.services.geocoder.RegeocodeResult import com.mogo.commons.env.ProjectUtils import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.MogoStatusManager @@ -22,6 +28,7 @@ import com.mogo.commons.storage.SharedPrefsMgr import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.deva.report.ReportEntity +import com.mogo.eagle.core.data.deva.report.TakeOverRecordInfo import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.msgbox.FMInfoMsg import com.mogo.eagle.core.data.msgbox.MsgBoxBean @@ -30,23 +37,28 @@ import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.data.msgbox.RecordBagMsg import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener +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.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener +import com.mogo.eagle.core.function.api.order.IOrderListener 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.CallerFsm2024ListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager import com.mogo.eagle.core.function.call.takeover.CallerTakeOverManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -73,7 +85,8 @@ import kotlin.math.abs internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener, IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener, IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener, - IMoGoAutopilotStatisticsListener { + IMoGoAutopilotStatisticsListener, IMoGoChassisStatesListener, IMoGoAutopilotStatusListener, + IOrderListener { const val TAG = "BadCase" @@ -90,6 +103,16 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis private var xPosition: Int = 0 private var yPosition: Int = 0 + private var shouldRecord: Boolean = false //是否需要记录接管 + + private var address: String = "" //故障地点 + private var level1Id: Int = 0 //一级分类ID + private var level2Id: Int = 0 //二级分类ID + private var level3Id: Int = 0 //三级分类ID + private var lineName: String = "" //行驶路线 + private var reportNote: String = "" //上报描述 + + fun init(context: Context) { CallerAutopilotRecordListenerManager.addListener(TAG, this) SpeechUtils.init(context) @@ -104,6 +127,9 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis if(ProjectUtils.isSaas()){ CallerFsm2024ListenerManager.addListener(TAG,this) CallerAutopilotStatisticsListenerManager.addListener(TAG,this) + CallerOrderListenerManager.addListener(TAG,this) + CallerAutoPilotStatusListenerManager.addListener(TAG,this) + CallerChassisStatesListenerManager.addListener(TAG,this) } checkDelete(context) } @@ -545,6 +571,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis * 新版FSM消息上报 */ override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) { + Log.i(TAG,"onFSM2024State fsmState.pilotStandbyFlag="+fsmState.pilotStandbyFlag+" pilotNotStandbyReason="+ fsmState.pilotNotStandbyReason) if(!fsmState.pilotStandbyFlag){ //pilotStandbyFlag == false代表自动驾驶无法启动 if(!BadCaseConfig.alreadyShowOneReport){ @@ -576,6 +603,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis */ override fun onAutopilotStatistics(statistics: AutopilotStatistics?) { statistics?.let { + Log.i(TAG,"onAutopilotStatistics status = "+ it.status) if(it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED){ //触发一键上报 ThreadUtils.runOnUiThread{ @@ -594,5 +622,60 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis } } + /** + * 刹车 + */ + 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 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,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 onOrderLineUpdate(lineName: String) { + this.lineName = lineName + } }