Merge branch 'dev_robotaxi-d_241112_6.8.1_dev' into dev_robotaxi-d_241210_6.9.0
This commit is contained in:
@@ -73,6 +73,7 @@ import com.zhjt.mogo_core_function_devatools.mofang.MoGoMoFangProviderImpl
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.MonitorManager
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb
|
||||
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb.Companion.getDb
|
||||
import com.zhjt.mogo_core_function_devatools.ota.OTAUpgradeManager
|
||||
import com.zhjt.mogo_core_function_devatools.perf.MoGoCpuUsageProviderImpl
|
||||
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.iPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
|
||||
@@ -204,6 +205,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
// apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
BadCaseManager.init(mContext!!)
|
||||
ColdStartManager.init(mContext!!)
|
||||
OTAUpgradeManager.init(mContext!!)
|
||||
if (DebugConfig.isDebug()) {
|
||||
SdtManager.init(mContext!!, true, DetectResultImpl())
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Environment
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
@@ -42,6 +43,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
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.ICaptureImgListener
|
||||
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.call.autopilot.CallerAutoPilotControlManager
|
||||
@@ -52,6 +54,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
|
||||
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.CallerCaptureImgManager
|
||||
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
|
||||
@@ -72,6 +75,7 @@ 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 me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.io.File
|
||||
import java.util.Random
|
||||
@@ -81,7 +85,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener,
|
||||
IMogoStatusChangedListener, IMoGoMapScreenListener,
|
||||
IMoGoChassisStatesListener, IMoGoAutopilotStatusListener,
|
||||
IDataCenterBizListener, IMoGoTakeoverListener {
|
||||
IDataCenterBizListener, IMoGoTakeoverListener, ICaptureImgListener {
|
||||
|
||||
const val TAG = "BadCase"
|
||||
|
||||
@@ -91,6 +95,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
private var record: AutoPilotRecord? = null
|
||||
|
||||
private var recordKey: Long = 0 //主动录制bag包key
|
||||
private var takeOverBagId: Long = 0 //接管录包Bag Id(key)
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var reportTypeWindow: ReportTypeWindow ?= null
|
||||
|
||||
@@ -116,6 +121,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
//消息盒子监听,获取FM和Report信息
|
||||
CallerMsgBoxListenerManager.addListener(TAG,this)
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
//接管时前方和后方摄像头数据请求响应回调监听
|
||||
CallerCaptureImgManager.addListener(TAG, this)
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
@@ -297,8 +304,6 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
}else{
|
||||
//进行录包,但不展示录包弹窗
|
||||
BadCaseConfig.notDisplayBagWindow = true
|
||||
//高精地图屏幕截图
|
||||
CallerMapScreenListenerManager.addListener(TAG,this)
|
||||
val recordKey = Random(SystemClock.elapsedRealtime()).nextInt().toLong()
|
||||
CallerAutoPilotControlManager.recordPackage(BadCaseConfig.type,recordKey.toInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration)
|
||||
@@ -416,8 +421,6 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
//保存录包状态
|
||||
recordSet.add(recordPanel.key.toString())
|
||||
BadCaseConfig.setInitiativeRecordSet(recordSet)
|
||||
//开启高精地图截图
|
||||
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
//将当次主动录包设置标签还原
|
||||
BadCaseConfig.notDisplayBagWindow = false
|
||||
}
|
||||
@@ -457,6 +460,13 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude)
|
||||
val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP)
|
||||
geocodeSearch.getFromLocationAsyn(q)
|
||||
takeOverBagId = recordPanel.key
|
||||
//触发域控前后120度摄像头截图和高精地图截图
|
||||
CallerAutoPilotControlManager.sendCaptureImgReqOnTakeOver(recordPanel.key)
|
||||
//高精地图屏幕截图
|
||||
CallerMapScreenListenerManager.addListener(TAG,this)
|
||||
//开启高精地图截图
|
||||
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -578,42 +588,16 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
|
||||
override fun onMapScreen(bitmap: Bitmap) {
|
||||
super.onMapScreen(bitmap)
|
||||
//在截图上保存即时信息
|
||||
val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
|
||||
val state = when(CallerAutoPilotStatusListenerManager.getState()){
|
||||
0->"自驾状态:不可自驾"
|
||||
1->"自驾状态:可自驾"
|
||||
2->"自驾状态:自驾中"
|
||||
7->"自驾状态:平行驾驶中"
|
||||
else->"自驾状态:未知"
|
||||
}
|
||||
val speed = "当前车速:${BadCaseConfig.currentSpeed}"
|
||||
val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
|
||||
"路线起始点:无"
|
||||
}else{
|
||||
"路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
|
||||
}
|
||||
val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
|
||||
BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
|
||||
,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
|
||||
|
||||
//图片保存本地
|
||||
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
"MapScreen" + File.separator+ currentDay + File.separator
|
||||
val fileName = "$recordKey.png"
|
||||
val fileName = "$takeOverBagId.png"
|
||||
val path = fileDir + fileName
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
if(outBitmap != null){
|
||||
RecordBitmapUtils.bitmap2Path(outBitmap,path)
|
||||
}else{
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
}
|
||||
//遍历是否有非当日的文件并删除
|
||||
RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
//注销高精地图截图监听回调
|
||||
CallerMapScreenListenerManager.removeListener(TAG)
|
||||
}
|
||||
@@ -648,4 +632,30 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接管时前方和后方摄像头数据请求的响应
|
||||
* @param isFront true:前方摄像头 false:后方摄像头
|
||||
* @param data 数据
|
||||
*/
|
||||
override fun onCaptureImgOnTakeOver(isFront: Boolean, data: MessagePad.CaptureImgOnTakeOver) {
|
||||
super.onCaptureImgOnTakeOver(isFront, data)
|
||||
//将byte字节流转为Bitmap
|
||||
val bitmap = BitmapFactory.decodeByteArray(data.data.toByteArray(),0,data.toByteArray().size)
|
||||
//图片保存本地
|
||||
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
val imageName = if(isFront){
|
||||
"FrontCamera"
|
||||
}else{
|
||||
"RearCamera"
|
||||
}
|
||||
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
imageName + File.separator+ currentDay + File.separator
|
||||
val fileName = "$takeOverBagId.png"
|
||||
val path = fileDir + fileName
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.os.Handler
|
||||
import android.os.SystemClock
|
||||
import android.util.DisplayMetrics
|
||||
@@ -36,12 +35,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.devatools.badcase.BadCaseNetListener
|
||||
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.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsNetManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
@@ -75,7 +71,6 @@ import record_cache.RecordPanelOuterClass
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
|
||||
/**
|
||||
@@ -198,7 +193,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
BadCaseNetManager.badCaseNetManager.getRecordOption(1,AppConfigInfo.iPCMacAddress)
|
||||
// BadCaseNetManager.badCaseNetManager.getRecordOption(1,"48:b0:2d:3a:9c:8f")
|
||||
//高精地图屏幕截图
|
||||
CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
|
||||
// CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
|
||||
//主动录包采集原因回调监听
|
||||
@@ -561,7 +556,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
//注销采集原因回调监听
|
||||
CallerDevaToolsNetManager.removeListener(this.hashCode().toString())
|
||||
//注销高精地图截图监听回调
|
||||
CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
|
||||
// CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
|
||||
if (mFloatLayout.parent != null){
|
||||
mWindowManager!!.removeView(mFloatLayout)
|
||||
|
||||
@@ -580,8 +575,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
//保存录包状态
|
||||
recordSet.add(recordPanel.key.toString())
|
||||
BadCaseConfig.setInitiativeRecordSet(recordSet)
|
||||
//开启高精地图截图
|
||||
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
// //开启高精地图截图
|
||||
// CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
}
|
||||
if(recordFileName==null){
|
||||
recordFileName = recordPanel.filename
|
||||
@@ -702,44 +697,44 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
* 高精地图截图回调
|
||||
*/
|
||||
override fun onMapScreen(bitmap: Bitmap) {
|
||||
//在截图上保存即时信息
|
||||
val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
|
||||
val state = when(CallerAutoPilotStatusListenerManager.getState()){
|
||||
0->"自驾状态:不可自驾"
|
||||
1->"自驾状态:可自驾"
|
||||
2->"自驾状态:自驾中"
|
||||
7->"自驾状态:平行驾驶中"
|
||||
else->"自驾状态:未知"
|
||||
}
|
||||
val speed = "当前车速:${BadCaseConfig.currentSpeed}"
|
||||
val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
|
||||
"路线起始点:无"
|
||||
}else{
|
||||
"路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
|
||||
}
|
||||
|
||||
val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
|
||||
BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
|
||||
,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
|
||||
|
||||
//图片保存本地
|
||||
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
"MapScreen" + File.separator+ currentDay + File.separator
|
||||
val fileName = "$recordKey.png"
|
||||
val path = fileDir + fileName
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
if(outBitmap != null){
|
||||
RecordBitmapUtils.bitmap2Path(outBitmap,path)
|
||||
}else{
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
}
|
||||
screenSavePath = path
|
||||
//遍历是否有非当日的文件并删除
|
||||
RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
// //在截图上保存即时信息
|
||||
// val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
// val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
|
||||
// val state = when(CallerAutoPilotStatusListenerManager.getState()){
|
||||
// 0->"自驾状态:不可自驾"
|
||||
// 1->"自驾状态:可自驾"
|
||||
// 2->"自驾状态:自驾中"
|
||||
// 7->"自驾状态:平行驾驶中"
|
||||
// else->"自驾状态:未知"
|
||||
// }
|
||||
// val speed = "当前车速:${BadCaseConfig.currentSpeed}"
|
||||
// val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
|
||||
// "路线起始点:无"
|
||||
// }else{
|
||||
// "路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
|
||||
// }
|
||||
//
|
||||
// val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
|
||||
// BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
|
||||
// ,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
|
||||
//
|
||||
// //图片保存本地
|
||||
// val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
// val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
// "MapScreen" + File.separator+ currentDay + File.separator
|
||||
// val fileName = "$recordKey.png"
|
||||
// val path = fileDir + fileName
|
||||
// if (!File(fileDir).exists()) {
|
||||
// File(fileDir).mkdirs()
|
||||
// }
|
||||
// if(outBitmap != null){
|
||||
// RecordBitmapUtils.bitmap2Path(outBitmap,path)
|
||||
// }else{
|
||||
// RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
// }
|
||||
// screenSavePath = path
|
||||
// //遍历是否有非当日的文件并删除
|
||||
// RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,6 @@ 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.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsNetManager
|
||||
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.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -180,7 +179,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
BadCaseNetManager.badCaseNetManager.getRecordOption(2,AppConfigInfo.iPCMacAddress)
|
||||
// BadCaseNetManager.badCaseNetManager.getRecordOption(2,"48:b0:2d:3a:9c:8f")
|
||||
//高精地图屏幕截图
|
||||
CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
|
||||
// CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
|
||||
CallerDevaToolsNetManager.addListener(this.hashCode().toString(),this)
|
||||
if(BadCaseConfig.windowNum<1){
|
||||
BadCaseConfig.windowNum = 1
|
||||
@@ -530,7 +529,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
|
||||
fun hideFloatWindow() {
|
||||
//注销高精地图截图监听回调
|
||||
CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
|
||||
// CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
|
||||
//注销采集原因回调监听
|
||||
CallerDevaToolsNetManager.removeListener(this.hashCode().toString())
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
@@ -552,7 +551,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
receiveTime = msgBoxBean.timestamp.toString()
|
||||
stat = recordBagMsg.stat.toString()
|
||||
//获取高精地图截图
|
||||
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
// CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
@@ -589,42 +588,42 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
*/
|
||||
override fun onMapScreen(bitmap: Bitmap) {
|
||||
//在截图上保存即时信息
|
||||
val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
|
||||
val state = when(CallerAutoPilotStatusListenerManager.getState()){
|
||||
0->"自驾状态:不可自驾"
|
||||
1->"自驾状态:可自驾"
|
||||
2->"自驾状态:自驾中"
|
||||
7->"自驾状态:平行驾驶中"
|
||||
else->"自驾状态:未知"
|
||||
}
|
||||
val speed = "当前车速:${BadCaseConfig.currentSpeed}"
|
||||
val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
|
||||
"路线起始点:无"
|
||||
}else{
|
||||
"路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
|
||||
}
|
||||
|
||||
val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
|
||||
BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
|
||||
,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
|
||||
//图片保存本地
|
||||
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
"MapScreen" + File.separator+ currentDay + File.separator
|
||||
val fileName = "$recordKey.png"
|
||||
val path = fileDir + fileName
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
if(outBitmap != null){
|
||||
RecordBitmapUtils.bitmap2Path(outBitmap,path)
|
||||
}else{
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
}
|
||||
screenSavePath = path
|
||||
//遍历是否有非当日的文件并删除
|
||||
RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
// val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
// val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
|
||||
// val state = when(CallerAutoPilotStatusListenerManager.getState()){
|
||||
// 0->"自驾状态:不可自驾"
|
||||
// 1->"自驾状态:可自驾"
|
||||
// 2->"自驾状态:自驾中"
|
||||
// 7->"自驾状态:平行驾驶中"
|
||||
// else->"自驾状态:未知"
|
||||
// }
|
||||
// val speed = "当前车速:${BadCaseConfig.currentSpeed}"
|
||||
// val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
|
||||
// "路线起始点:无"
|
||||
// }else{
|
||||
// "路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
|
||||
// }
|
||||
//
|
||||
// val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
|
||||
// BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
|
||||
// ,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
|
||||
// //图片保存本地
|
||||
// val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
// val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
|
||||
// "MapScreen" + File.separator+ currentDay + File.separator
|
||||
// val fileName = "$recordKey.png"
|
||||
// val path = fileDir + fileName
|
||||
// if (!File(fileDir).exists()) {
|
||||
// File(fileDir).mkdirs()
|
||||
// }
|
||||
// if(outBitmap != null){
|
||||
// RecordBitmapUtils.bitmap2Path(outBitmap,path)
|
||||
// }else{
|
||||
// RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
// }
|
||||
// screenSavePath = path
|
||||
// //遍历是否有非当日的文件并删除
|
||||
// RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhjt.mogo_core_function_devatools.ota
|
||||
|
||||
/**
|
||||
* OTA升级配置
|
||||
*/
|
||||
object OTAUpgradeConfig {
|
||||
|
||||
@JvmField
|
||||
var otaToken: String = ""
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.zhjt.mogo_core_function_devatools.ota
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.deva.ota.OtaUpgradeInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IOTAListener
|
||||
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.datacenter.CallerDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import system_master.SsmInfo
|
||||
|
||||
/**
|
||||
* OTA升级管理类
|
||||
*/
|
||||
object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener, IOTAListener {
|
||||
|
||||
const val TAG = "OTAUpgradeManager"
|
||||
|
||||
fun init(context: Context){
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerDataCenterBizListener.addListener(TAG,this)
|
||||
CallerOTAManager.addListener(TAG,this)
|
||||
//查询OTA状态
|
||||
CallerAutoPilotControlManager.sendSsmFuncOtaStatusQuery(OTAUpgradeConfig.otaToken)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
* @param state 状态信息
|
||||
* 0-不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
* 1-可自动驾驶,目前处于人工干预状态
|
||||
* 2-自动驾驶中
|
||||
* 7-平行驾驶中
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有订单
|
||||
* @param inOrder true有订单 false没有订单
|
||||
*/
|
||||
override fun invokeOrderStatus(inOrder: Boolean) {
|
||||
super.invokeOrderStatus(inOrder)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SSM发送OTA升级提示请求,主动触发
|
||||
* @param request SSM发送OTA升级提示内容
|
||||
*/
|
||||
override fun onOtaDownloadRequest(request: SsmInfo.OtaDownloadRequest) {
|
||||
super.onOtaDownloadRequest(request)
|
||||
Log.i(TAG,"onOtaDownloadRequest otaToken"+request.otaToken)
|
||||
Log.i(TAG,"onOtaDownloadRequest productName"+request.productName)
|
||||
if(request.otaToken.isNotEmpty()){
|
||||
if(OTAUpgradeConfig.otaToken != request.otaToken){
|
||||
OTAUpgradeConfig.otaToken = request.otaToken
|
||||
//触发升级提示
|
||||
CallerHmiManager.showOTAUpgradeDialog()
|
||||
}else{
|
||||
//展示OTA升级提示
|
||||
CallerHmiManager.showOTAUpgradeTipView(true)
|
||||
}
|
||||
}else{
|
||||
//隐藏OTA升级提示
|
||||
CallerHmiManager.showOTAUpgradeTipView(false)
|
||||
}
|
||||
//解析JSON
|
||||
var upgradeComplete = true
|
||||
val otaUpgradeList = ArrayList<OtaUpgradeInfo>()
|
||||
val productArray = JSONArray(request.productName)
|
||||
if(productArray.length() > 0){
|
||||
for(index in 0 until productArray.length()){
|
||||
val productInfo = productArray[index] as JSONObject
|
||||
val token = productInfo.optString("token")
|
||||
val productStatus = productInfo.optInt("status")
|
||||
val failReason = productInfo.optString("fail_reason")
|
||||
val upgradeReason = productInfo.optString("upgrade_reason")
|
||||
val taskId = productInfo.optInt("task_id")
|
||||
val taskItemId = productInfo.optInt("task_item_id")
|
||||
val otaType = productInfo.optInt("ota_type")
|
||||
val productName = productInfo.optString("product_name")
|
||||
val needRestart = productInfo.optBoolean("need_restart")
|
||||
val isDelay = productInfo.optBoolean("is_delay")
|
||||
val curSize = productInfo.optDouble("cur_size")
|
||||
val totalSize = productInfo.optDouble("total_size")
|
||||
|
||||
Log.i(TAG, "index=$index")
|
||||
Log.i(TAG, "token=$token")
|
||||
Log.i(TAG, "status=$productStatus")
|
||||
Log.i(TAG, "fail_reason=$failReason")
|
||||
Log.i(TAG, "upgrade_reason=$upgradeReason")
|
||||
Log.i(TAG, "task_id=$taskId")
|
||||
Log.i(TAG, "task_item_id=$taskItemId")
|
||||
Log.i(TAG, "ota_type=$otaType")
|
||||
Log.i(TAG, "product_name=$productName")
|
||||
Log.i(TAG, "need_restart=$needRestart")
|
||||
Log.i(TAG, "is_delay=$isDelay")
|
||||
Log.i(TAG, "cur_size=$curSize")
|
||||
Log.i(TAG, "total_size=$totalSize")
|
||||
|
||||
//// 状态 0:默认(未开始), 1:下载中, 2:下载完成, 3:升级完成, 4:升级失败
|
||||
if(productStatus == 0 || productStatus == 1 || productStatus == 2){
|
||||
upgradeComplete = false
|
||||
}
|
||||
|
||||
val otaUpgradeInfo = OtaUpgradeInfo(token, productStatus,failReason,upgradeReason,
|
||||
taskId,taskItemId,otaType,productName,needRestart,isDelay,curSize,totalSize)
|
||||
otaUpgradeList.add(otaUpgradeInfo)
|
||||
}
|
||||
CallerHmiManager.showOTADownloadStatusDialog(otaUpgradeList)
|
||||
if(upgradeComplete){
|
||||
OTAUpgradeConfig.otaToken = ""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SSM上报OTA状态和查询OTA状态
|
||||
* 冷启动状态变更上报以及查询状态
|
||||
* 如果是查询到的结果,{@link SsmInfo.OtaStatus#getOtaInfo()}
|
||||
* 中的{@link SsmInfo.OtaDownloadRequest#getOtaToken()}==""表示不存在升级任务
|
||||
* @param status 冷启动状态变更上报以及查询状态
|
||||
*/
|
||||
override fun onOtaStatus(status: SsmInfo.OtaStatus) {
|
||||
super.onOtaStatus(status)
|
||||
Log.i(TAG,"onOtaStatus status.otaInfo.otaToken"+status.otaInfo.otaToken)
|
||||
Log.i(TAG,"onOtaStatus status.otaInfo.productName"+status.otaInfo.productName)
|
||||
|
||||
if(status.otaInfo.otaToken.isNotEmpty()){
|
||||
if(OTAUpgradeConfig.otaToken != status.otaInfo.otaToken){
|
||||
OTAUpgradeConfig.otaToken = status.otaInfo.otaToken
|
||||
//触发升级提示
|
||||
CallerHmiManager.showOTAUpgradeDialog()
|
||||
}else{
|
||||
//展示OTA升级提示
|
||||
CallerHmiManager.showOTAUpgradeTipView(true)
|
||||
}
|
||||
}else{
|
||||
//隐藏OTA升级提示
|
||||
CallerHmiManager.showOTAUpgradeTipView(false)
|
||||
}
|
||||
|
||||
//解析JSON
|
||||
val otaUpgradeList = ArrayList<OtaUpgradeInfo>()
|
||||
val productArray = JSONArray(status.otaInfo.productName)
|
||||
var upgradeComplete = true
|
||||
if(productArray.length() > 0){
|
||||
for(index in 0 until productArray.length()){
|
||||
val productInfo = productArray[index] as JSONObject
|
||||
val token = productInfo.optString("token")
|
||||
val productStatus = productInfo.optInt("status")
|
||||
val failReason = productInfo.optString("fail_reason")
|
||||
val upgradeReason = productInfo.optString("upgrade_reason")
|
||||
val taskId = productInfo.optInt("task_id")
|
||||
val taskItemId = productInfo.optInt("task_item_id")
|
||||
val otaType = productInfo.optInt("ota_type")
|
||||
val productName = productInfo.optString("product_name")
|
||||
val needRestart = productInfo.optBoolean("need_restart")
|
||||
val isDelay = productInfo.optBoolean("is_delay")
|
||||
val curSize = productInfo.optDouble("cur_size")
|
||||
val totalSize = productInfo.optDouble("total_size")
|
||||
|
||||
Log.i(TAG, "index=$index")
|
||||
Log.i(TAG, "token=$token")
|
||||
Log.i(TAG, "status=$productStatus")
|
||||
Log.i(TAG, "fail_reason=$failReason")
|
||||
Log.i(TAG, "upgrade_reason=$upgradeReason")
|
||||
Log.i(TAG, "task_id=$taskId")
|
||||
Log.i(TAG, "task_item_id=$taskItemId")
|
||||
Log.i(TAG, "ota_type=$otaType")
|
||||
Log.i(TAG, "product_name=$productName")
|
||||
Log.i(TAG, "need_restart=$needRestart")
|
||||
Log.i(TAG, "is_delay=$isDelay")
|
||||
Log.i(TAG, "cur_size=$curSize")
|
||||
Log.i(TAG, "total_size=$totalSize")
|
||||
//// 状态 0:默认(未开始), 1:下载中, 2:下载完成, 3:升级完成, 4:升级失败
|
||||
if(productStatus == 0 || productStatus == 1 || productStatus == 2){
|
||||
upgradeComplete = false
|
||||
}
|
||||
|
||||
val otaUpgradeInfo = OtaUpgradeInfo(token, productStatus,failReason,upgradeReason,
|
||||
taskId,taskItemId,otaType,productName,needRestart,isDelay,curSize,totalSize)
|
||||
otaUpgradeList.add(otaUpgradeInfo)
|
||||
}
|
||||
CallerHmiManager.showOTADownloadStatusDialog(otaUpgradeList)
|
||||
if(upgradeComplete){
|
||||
OTAUpgradeConfig.otaToken = ""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbDownloadProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDownloadStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/pbDownloadProgress"
|
||||
android:textSize="@dimen/sp_30"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user