Merge branch 'dev_robotaxi-d_240401_6.4.0' into dev_robotaxi-d_240401_6.4.0_yyk

# Conflicts:
#	app/script/vehicleFlavors/C1.gradle
This commit is contained in:
yangyakun
2024-04-15 14:54:13 +08:00
82 changed files with 1803 additions and 968 deletions

View File

@@ -129,10 +129,10 @@ class MoGoAutopilotControlProvider :
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF())
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build()
@@ -228,7 +228,7 @@ class MoGoAutopilotControlProvider :
val options = AdasOptions
.newBuilder()
.setPassenger(true)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build()
AdasManager.getInstance()
.create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl())
@@ -260,10 +260,10 @@ class MoGoAutopilotControlProvider :
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)// 乘客端直连工控机改为false
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF())
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build()
AdasManager.getInstance().create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
@@ -321,9 +321,9 @@ class MoGoAutopilotControlProvider :
// 设置IP地址
val options = AdasOptions.newBuilder()
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF())
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED)
.setSpecifiedAddress(autoPilotIp)
.build()
@@ -988,7 +988,7 @@ class MoGoAutopilotControlProvider :
* @param resultCode 上报字段code
*/
override fun getReportResultDesc(resultCode: String): String {
return MogoReport.Result.getDesc(resultCode)
return MogoReport.ResultDesc.getDesc(resultCode)
}
/**
@@ -996,7 +996,7 @@ class MoGoAutopilotControlProvider :
* @param actionCode 上报字段code
*/
override fun getReportActionDesc(actionCode: String): String {
return MogoReport.Action.getDesc(actionCode)
return MogoReport.ActionDesc.getDesc(actionCode)
}
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import bag_manager.BagManagerOuterClass
import chassis.Chassis
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.data.app.AppConfigInfo
@@ -169,7 +170,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
) {
if (vehicleState != null) {
//转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
// CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
@@ -231,10 +232,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
) {
if (chassisStates != null) {
chassisStates.bcmSystemStates?.let { bcmSystemStates ->
bcmSystemStates.turnLightState?.let {
//转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(it)
}
// bcmSystemStates.turnLightState?.let {
// //转向灯数据
// CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(it)
// }
//刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0)
}
@@ -277,6 +278,19 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
}
/**
* 底盘车灯状态 转换过的可以直接使用
* 例如:
* 原始右转数据: 0 2 0 2 0 2。。。
* 转换之后数据: 2 2 2 2 2 2。。。
*
* @param light 车灯 目前域控发送车灯有 左传{@link Chassis.LightSwitch#LIGHT_LEFT} 右转{@link Chassis.LightSwitch#LIGHT_RIGHT} 危险报警灯{@link Chassis.LightSwitch#LIGHT_FLASH}
*/
override fun onLightSwitch(light: Chassis.LightSwitch) {
//转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(light)
}
//自动驾驶状态
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
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.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -59,13 +60,14 @@ class MoGoAdasMsgConnectStatusListenerImpl :
private val isSentBasicInfoReq = AtomicBoolean(false)//是否已回复域控基础信息请求
@Volatile
private var certificationResult = ""
private var certificationResult = "未开启认证"
init {
CallerCloudListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED)
CallerParallelDrivingActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED)
CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult)
}
private fun connectToast(reason: String) {
@@ -249,7 +251,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
*/
override fun onCertification(status: AdasConstants.CertificationStatus) {
if (status == AdasConstants.CertificationStatus.TIMEOUT) {
certificationResult = ":认证超时";
certificationResult = "证书认证超时"
CallerLogger.d(
"$M_D_C$TAG",
"域控证书认证超时表示域控未发送BasicInfoReq接口的数据【这种情况可能是连接出现了问题】"
@@ -257,24 +259,25 @@ class MoGoAdasMsgConnectStatusListenerImpl :
} else {
if (status != AdasConstants.CertificationStatus.NOT_ENABLED) {
if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_SUCCESS) {
certificationResult = ":成功校验域控证书"
CallerLogger.d(
"$M_D_C$TAG",
"域控证书链校验成功"
"成功校验域控证书"
)
} else if (status == AdasConstants.CertificationStatus.ROOT_CRT_ERROR) {
certificationResult = "ROOT证书异常";
certificationResult = "获取ROOT证书异常"
CallerLogger.d(
"$M_D_C$TAG",
"ROOT证书异常表示未传递证书没有拿到ROOT证书"
)
} else if (status == AdasConstants.CertificationStatus.IPC_CRT_ERROR) {
certificationResult = ":域控证书异常";
certificationResult = "获取域控证书异常"
CallerLogger.d(
"$M_D_C$TAG",
"域控证书异常表示域控发送了BasicInfoReq接口的数据但是未传递证书或证书解码失败【失败的可能性很低】"
)
} else if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_FAILED) {
certificationResult = ":证书校验失败";
certificationResult = "域控证书校验失败"
CallerLogger.d(
"$M_D_C$TAG",
"域控证书链校验失败(表示证书链未验证通过。证书不匹配、证书格式不正确)"
@@ -282,6 +285,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
}
}
}
CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult)
}
private fun saveIntoMsgBox(
@@ -341,7 +345,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
* 工控机获取SN
*/
override fun onAutopilotSNRequest(basicInfoReq: MessagePad.BasicInfoReq) {
CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求");
CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求")
isReceivedBasicInfoReq.set(true)
if (!TextUtils.isEmpty(SharedPrefsMgr.getInstance().sn)) {
syncBasicInfoToAutopilot()
@@ -396,7 +400,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
}
override fun tokenGot(token: String, sn: String) {
CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn");
CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn")
if (isReceivedBasicInfoReq.get() && !isSentBasicInfoReq.get()) {//已收到域控基础信息请求但是之前SN没有所以还未回复现在获取到SN后再进行回复
syncBasicInfoToAutopilot()
}

View File

@@ -130,6 +130,9 @@ object DataManager {
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
}
MsgBoxType.FMINFO -> {
synchronized(this) {
fmInfoList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.FM_INFO, msg)
}
MsgBoxType.VOICE -> {
@@ -250,7 +253,7 @@ object DataManager {
}
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> =
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean?> =
withContext(Dispatchers.IO) {
delay(2000)
return@withContext MsgBoxDb.getDb(context)
@@ -326,7 +329,7 @@ object DataManager {
}
}
else -> {
return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg())
return@map null
}
}
}
@@ -368,6 +371,13 @@ object DataManager {
recordBagList.clear()
}
if (fmInfoList.isNotEmpty()) {
fmInfoList.forEach {
msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp))
}
fmInfoList.clear()
}
if (msgInfoList.isNotEmpty()) {
MsgBoxDb.getDb(context)
.monitorDao()
@@ -387,4 +397,14 @@ object DataManager {
}
}
}
fun queryFMInfoList(context: Context, startTime: Long, endTime: Long): List<MsgBoxBean> {
return MsgBoxDb.getDb(context).monitorDao()
.getFMInfoList(MsgBoxType.FMINFO.ordinal, startTime, endTime)
.map { boxInfo ->
MsgBoxBean(MsgBoxType.FMINFO, GsonUtils.fromJson(boxInfo.bean2Json, FMInfoMsg::class.java)).apply {
timestamp = boxInfo.timeStamp
}
}
}
}

View File

@@ -50,6 +50,14 @@ class MsgBoxProvider : IMsgBoxProvider {
return DataManager.getRecordBagData()
}
override fun queryFMInfoList(
context: Context,
startTime: Long,
endTime: Long
): List<MsgBoxBean> {
return DataManager.queryFMInfoList(context, startTime, endTime)
}
override fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String) {
DataManager.removeRecordInfo(key, key)
DataManager.delMsgBoxBean(context, msgBoxBean)

View File

@@ -16,6 +16,9 @@ interface MsgBoxDao {
@Query("SELECT * FROM t_msg_box")
fun getAllCachedMessages(): List<MsgBoxInfo>
@Query("SELECT * FROM t_msg_box WHERE json_obj_type == (:fmType) AND time_stamp >= (:startTime) AND time_stamp <= (:endTime)")
fun getFMInfoList(fmType: Int, startTime: Long, endTime: Long): List<MsgBoxInfo>
@Query("DELETE FROM t_msg_box")
fun deleteMsgTable()
}

View File

@@ -4,6 +4,7 @@ import android.Manifest
import android.content.*
import android.content.pm.PackageManager.PERMISSION_GRANTED
import android.os.Build
import android.os.Environment
import android.os.Process
import android.os.SystemClock
import android.util.Log
@@ -14,10 +15,13 @@ import com.mogo.commons.AbsMogoApplication
import com.mogo.core.log.record.*
import com.mogo.core.log.record.config.*
import com.mogo.core.log.record.config.crash.CrashConfig
import com.mogo.core.log.record.config.extra.IExtraFileToUpload
import com.mogo.core.log.record.config.extra.ToUploadFile
import com.mogo.core.log.record.config.state.IStateProvider
import com.mogo.core.log.record.model.UploadError
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.devatools.logcat.*
import com.mogo.eagle.core.utilcode.download.DownloadUtils
import com.zhidao.loglib.bean.RemoteLogPushContent
import com.zhjt.mogo_core_function_devatools.BuildConfig
import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker
@@ -25,6 +29,7 @@ import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
import kotlinx.coroutines.*
import java.io.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeUnit.MINUTES
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicLong
@@ -45,13 +50,12 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
private val lastUploadTime by lazy { AtomicLong(0) }
override fun init(context: Context) {
val zip = File(context.getExternalFilesDir(null), "logcat/zip")
val builder = LogcatConfig.Builder().context(context)
.recordPeriod(MINUTES.toMillis(5)) // 5分钟一个文件
.maxSizeInLogDir((512 * 1024 * 1024).toLong()) // 512M最大容量
.recordDir(File(context.getExternalFilesDir(null), "logcat"))
.pid(Process.myPid())
.generateZipDir(zip.absolutePath)
.generateZipDir(File(context.getExternalFilesDir(null), "logcat/zip").absolutePath)
.stateProvider(object : IStateProvider {
override fun provide(divider: String?): Map<String, Any?> {
return mutableMapOf<String, Any?>().also { itx ->
@@ -104,6 +108,18 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
itx["协议版本号"] = AppConfigInfo.protocolVersionNumber
itx["${divider}-7"] = divider
itx["角色"] = AppConfigInfo.role
val downloads = try {
DownloadUtils.getAllDownloadRecords()
} catch (t: Throwable) {
emptyList()
}
if (downloads.isNotEmpty()) {
itx["${divider}-8"] = divider
itx["下载汇总"] = "(${downloads.size})"
downloads.forEach {
itx[it.first] = "\n\r----------------------------------------------------------${it.second}\n\r"
}
}
}
}
})
@@ -114,26 +130,26 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
.systemTags("ActivityManager")
.checker(AnrLogChecker())
}
// if (BuildConfig.DEBUG) {
// builder.crashConfig(
// CrashConfig.Builder()
// .enabled(true)
// .crashDir(File(context.getExternalFilesDir(null), "logcat/crash"))
// .nativeCrash(true)
// .anr(true)
// .javaCrash(true)
// .build()
// )
// }
LogcatManager.init(builder)
scope.launch {
try {
zip.takeIf { it.exists() }?.deleteRecursively()
} catch (t: Throwable) {
t.printStackTrace()
}
if (BuildConfig.DEBUG) {
builder.crashConfig(
CrashConfig.Builder()
.enabled(true)
.crashDir(File(context.getExternalFilesDir(null), "crash"))
.expireDuration(TimeUnit.DAYS.toMillis(3))
.javaCrash(true)
.nativeCrash(true)
.anr(true)
.build()
)
}
builder.extraFilesToUpload(object : IExtraFileToUpload {
override fun filesToUpload(): List<ToUploadFile> {
return ArrayList<ToUploadFile>().also {
it.add(ToUploadFile(File(Environment.getExternalStorageDirectory(), "MLog")))
}
}
})
LogcatManager.init(builder)
}
override fun target(): Class<RemoteLogPushContent> {
@@ -195,8 +211,8 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
return LogcatManager.export()
}
override fun upload(): Unit = runBlocking {
val state = LogcatManager.upload(0, System.currentTimeMillis())
override fun upload(startTime: Long, endTime: Long): Unit = runBlocking {
val state = LogcatManager.upload(startTime, endTime)
if (state is UploadError) {
throw AssertionError(state.toString())
}

View File

@@ -8,13 +8,20 @@ import android.content.IntentFilter
import android.location.LocationManager
import android.util.Log
import androidx.core.location.LocationManagerCompat
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
import com.mogo.eagle.core.utilcode.util.AppStateManager
@@ -30,7 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean
internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener,
IConnectStatusListener, IMogoStatusChangedListener {
IConnectStatusListener, IMogoStatusChangedListener, IMoGoAutopilotCarConfigListener,
IMoGoCloudListener {
companion object {
const val TAG = "OverViewImpl"
@@ -56,6 +64,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
@Volatile
private var isAutopilotException = false
@Volatile
private var isAuthCrtException = false
@Volatile
private var isFirst = true
@@ -125,6 +136,8 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
val isGranted = checkIsGpsException()
if (!isGranted) {
@@ -268,11 +281,41 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
}
private fun checkIfNotException() {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException) {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException && !isAuthCrtException) {
send(OverViewStatus(false))
}
}
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
isAuthCrtException = false
checkIfNotException()
}
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
isAuthCrtException = true
send(OverViewStatus(true))
}
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
return
}
if(msg.contains("成功校验")){
isAuthCrtException = false
checkIfNotException()
}else{
isAuthCrtException = true
send(OverViewStatus(true))
}
}
override fun onDestroy() {
super.onDestroy()
// CallerDevaToolsListenerManager.removeListener(TAG)
@@ -280,6 +323,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
try {
if (registered.compareAndSet(true, false) && receiver != null) {
ctx.unregisterReceiver(receiver)

View File

@@ -1,34 +0,0 @@
package com.zhjt.mogo_core_function_devatools.status.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.zhjt.mogo_core_function_devatools.R
/**
* 状态汇总View控件
*/
class StatusSummaryView@JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(
context,
attrs,
defStyleAttr
), IMoGoAutopilotStatusListener {
companion object{
private const val TAG = "SummaryStatusView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_initiative_bad_case, this, true)
initView()
}
private fun initView() {
}
}

View File

@@ -8,13 +8,17 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
@@ -97,23 +101,53 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
}
} else if(category == MsgCategory.SYS_INFO){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
isShowReport = true
}
}
}
if(isShowReport){
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
if(fmInfoMsg.policyCode == "FM_DP_PNC_CHOOSE_STOP" //择机靠边停车
|| fmInfoMsg.policyCode == "FM_DP_COMFORTABLE_STOP" //立刻舒适停车
|| fmInfoMsg.policyCode == "FM_DP_EMERGENCY_STOP" //就地紧急停车
){
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
e.printStackTrace()
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmInfoMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
}
//展示消息
showData(msgBoxBean)
}
}
} else{

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
@@ -242,7 +243,6 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
is BubbleFmHolder ->{
data?.let {
val fmMsg = it[position].msgBoxBean.bean as FMInfoMsg
holder.tvBubbleFmFault.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
if(fmMsg.policyTime == null){
holder.tvBubbleFmTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}else{
@@ -250,26 +250,43 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
if(fmMsg.fmInfoList?.size == 0){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
holder.tvBubbleFmFault.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
}else{
var curFaultLevel = 0 //默认级别遍历数组找出级别最高的level数越小,级别越高)
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) > curFaultLevel){
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
val faultAction = MsgFmData.FaultAction.getFaultAction(curFaultLevel)
holder.tvBubbleFmFault.text = faultAction
//当出现多个建议操作时,按照整车下电重启、请求人工驾驶接管、请求平行驾驶接管、系统重启、联系硬件工程师、
// 联系运维工程师、联系软件工程师优先级递减的顺序,只展示最高优先级的内容
if(curFaultLevel == 0){
if(curFaultLevel == 5){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
}else{
holder.tvBubbleFmFaultAction.text = "${faultAction}(${MsgFmData.FaultAction.getFaultActionCode(curFaultLevel)})"
}
//不同级别的Icon显示
when(curFaultLevel){
0->{
//重度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
}
1,2,3->{
//中度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
}
4,5->{
//轻度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
}
}
}
}
}
@@ -409,6 +426,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvBubbleFmFault: TextView = itemView.findViewById(R.id.tvBubbleFmFault)
var tvBubbleFmFaultAction: TextView = itemView.findViewById(R.id.tvBubbleFmFaultAction)
var tvBubbleFmTime: TextView = itemView.findViewById(R.id.tvBubbleFmTime)
var ivBubbleFmImage: ImageView = itemView.findViewById(R.id.ivBubbleFmImage)
}
//SSM连接消息

View File

@@ -173,39 +173,21 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
"时间:${fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1) }}"
holder.tvFmTime.text =
fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1,getHourMinFormat()) }
//不同级别的Icon显示
if(fmInfoMsg.policyCode == "FM_DP_ONLY_WARNING"){
//警示
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
}else if(fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT1"
|| fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT2"
|| fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT3"){
//降速行驶
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_open))
}else if(fmInfoMsg.policyCode == "FM_DP_PNC_CHOOSE_STOP"
|| fmInfoMsg.policyCode == "FM_DP_COMFORTABLE_STOP"
|| fmInfoMsg.policyCode == "FM_DP_EMERGENCY_STOP"){
//安全停车
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_open))
}
//Title
holder.tvFmTitleNormal.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
holder.tvFmTitleOpen.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
//建议操作
if(fmInfoMsg.fmInfoList.isNullOrEmpty()){
//建议操作暂无
holder.tvFmActionOpen.text = "建议操作:暂无"
holder.tvFmActionNormal.text = "建议操作:暂无"
//Title
holder.tvFmTitleNormal.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
holder.tvFmTitleOpen.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
}else{
val receiveFaultLevel = ArrayList<Int>()
fmInfoMsg.fmInfoList!!.forEach { info ->
if(info.faultActionCount != 0){
info.faultActionList.forEach { action ->
//如果不包含此故障Level则进行添加
if(!receiveFaultLevel.contains(MsgFmData.FaultAction.getFaultLevel(action)) && MsgFmData.FaultAction.getFaultLevel(action)!=0){
if(!receiveFaultLevel.contains(MsgFmData.FaultAction.getFaultLevel(action))){
receiveFaultLevel.add(MsgFmData.FaultAction.getFaultLevel(action))
}
}
@@ -216,7 +198,28 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
val faultActionStr: StringBuilder = StringBuilder()
faultActionStr.append("建议操作:")
receiveFaultLevel.sort()
receiveFaultLevel.reverse()
// receiveFaultLevel.reverse()
//Title
holder.tvFmTitleNormal.text = MsgFmData.FaultAction.getFaultAction(receiveFaultLevel[0])
holder.tvFmTitleOpen.text = MsgFmData.FaultAction.getFaultAction(receiveFaultLevel[0])
//不同级别的Icon显示
when(receiveFaultLevel[0]){
0->{
//重度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_open))
}
1,2,3->{
//中度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_open))
}
4,5->{
//轻度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
}
}
receiveFaultLevel.forEach {level->
if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank()){
faultActionStr.append(MsgFmData.FaultAction.getFaultAction(level))
@@ -227,11 +230,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
faultActionStr.append(")")
}
if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank() || MsgFmData.FaultAction.getFaultActionCode(level).isNotBlank()){
faultActionStr.append("/")
faultActionStr.append(";")
}
}
if(faultActionStr.length > 5){
if(faultActionStr.endsWith("/")){
if(faultActionStr.endsWith(";")){
faultActionStr.deleteCharAt(faultActionStr.lastIndex)
}
holder.tvFmActionOpen.text = faultActionStr.toString()
@@ -243,6 +246,9 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
}else{
holder.tvFmActionOpen.text = "建议操作:暂无"
holder.tvFmActionNormal.text = "建议操作:暂无"
//轻度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
}
}
//故障策略

View File

@@ -12,7 +12,6 @@ import android.os.Build
import android.os.Process
import android.text.Html
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -89,6 +88,7 @@ import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.kotlin.scope
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -204,7 +204,8 @@ internal class DebugSettingView @JvmOverloads constructor(
// 高精地图是否已缓存
private var isHDCached = false
private var isClickCheckedCbSsl = false//是否已经点击且选中证书认证按钮
//是否已经点击且选中证书认证按钮
private var isCertCheck = false
private var isFirstDownLoadCertHint = false
init {
@@ -1293,14 +1294,13 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
//是否启用证书认证
cbSsl.isChecked =
SharedPrefsMgr.getInstance().getBoolean(
MoGoConfig.AUTOPILOT_CERTIFICATION,
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
val check = SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
isCertCheck = check
cbSsl.isChecked = check
cbSsl.setOnCheckedChangeListener { _, isChecked ->
isClickCheckedCbSsl = isChecked
// 下载证书
if (isChecked) {
if (CallerCloudCertManager.getRootCrtF().isNullOrEmpty()) {
if (!isFirstDownLoadCertHint) {
@@ -1308,25 +1308,31 @@ internal class DebugSettingView @JvmOverloads constructor(
ToastUtils.showShort("证书文件不存在,正在下载")
}
cbSsl.isChecked = false
//下载证书
CallerCloudCertManager.certFileDownLoad { errorMsg ->
ThreadUtils.runOnUiThread {
isCertCheck = false
ToastUtils.showShort(errorMsg)
}
}
}else{
isCertCheck = true
}
}else{
isCertCheck = false
}
SharedPrefsMgr.getInstance()
.putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, cbSsl.isChecked)
.putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", cbSsl.isChecked)
}
}
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
ThreadUtils.runOnUiThread {
if (isClickCheckedCbSsl) {
if (isCertCheck) {
cbSsl.isChecked = true
SharedPrefsMgr.getInstance()
.putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, true)
.putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", true)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
tvCertFile.text = Html.fromHtml(
@@ -1576,26 +1582,48 @@ internal class DebugSettingView @JvmOverloads constructor(
//上传全量日志
exportAllLogs?.onClick { v ->
v.visibility = View.INVISIBLE
logLoadingView?.visibility = View.VISIBLE
v.scope.launch(Dispatchers.IO) {
var isUploadSuccess = false
try {
CallerDevaToolsManager.logcat()?.upload()
isUploadSuccess = true
} catch (t: Throwable) {
t.printStackTrace()
}
withContext(Dispatchers.Main) {
if (isUploadSuccess) {
ToastUtils.showShort("上传成功")
} else {
ToastUtils.showShort("上传失败")
ListPopupWindow(v.context).also { p ->
val items = LogcatUploadDuration.values()
p.setAdapter(LogcatUploadAdapter(v.context, items))
p.anchorView = v
p.isModal = true
p.setBackgroundDrawable(ColorDrawable(Color.WHITE))
p.setOnItemClickListener { _, _, position, _ ->
val item = items[position]
v.visibility = View.INVISIBLE
logLoadingView?.visibility = View.VISIBLE
p.dismiss()
v.scope.launch(Dispatchers.IO) {
val endTime = System.currentTimeMillis()
val startTime = when(item) {
LogcatUploadDuration.IN_15M -> endTime - TimeUnit.MINUTES.toMillis(15)
LogcatUploadDuration.IN_45M -> endTime - TimeUnit.MINUTES.toMillis(45)
LogcatUploadDuration.IN_1H -> endTime - TimeUnit.HOURS.toMillis(1)
LogcatUploadDuration.IN_2H -> endTime - TimeUnit.HOURS.toMillis(2)
LogcatUploadDuration.IN_3H -> endTime - TimeUnit.HOURS.toMillis(3)
LogcatUploadDuration.IN_6H -> endTime - TimeUnit.HOURS.toMillis(6)
LogcatUploadDuration.IN_1D -> endTime - TimeUnit.DAYS.toMillis(1)
LogcatUploadDuration.ALL -> 0
}
var isUploadSuccess = false
try {
CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
isUploadSuccess = true
} catch (t: Throwable) {
t.printStackTrace()
}
withContext(Dispatchers.Main) {
if (isUploadSuccess) {
ToastUtils.showShort("上传成功")
} else {
ToastUtils.showShort("上传失败")
}
logLoadingView?.visibility = View.INVISIBLE
exportAllLogs?.visibility = View.VISIBLE
}
}
logLoadingView?.visibility = View.INVISIBLE
exportAllLogs?.visibility = View.VISIBLE
}
}
}.show()
}
if (JunkConfig.isSupportJunkDetect) {
@@ -1731,6 +1759,54 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
private enum class LogcatUploadDuration(val text: String) {
IN_15M("15分钟内"),
IN_45M("45分钟内"),
IN_1H("1小时内"),
IN_2H("2小时内"),
IN_3H("3小时内"),
IN_6H("6小时内"),
IN_1D("一天内"),
ALL("上传所有")
}
private class LogcatUploadAdapter(private val ctx: Context, private val items: Array<LogcatUploadDuration>): BaseAdapter() {
override fun getCount(): Int {
return items.size
}
override fun getItem(position: Int): Any {
return items[position]
}
override fun getItemId(position: Int): Long {
return items[position].ordinal.toLong()
}
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
var result = convertView
val duration = items[position]
if (result == null) {
val temp = View.inflate(ctx, android.R.layout.simple_list_item_1, null)
temp.tag = Holder(temp.findViewById(android.R.id.text1))
result = temp
}
val holder = result?.tag as? Holder
if (holder != null) {
holder.text?.setTextColor(Color.BLACK)
holder.text?.text = duration.text
} else {
val text = result?.findViewById<TextView>(android.R.id.text1)
text?.setTextColor(Color.BLACK)
text?.text = duration.text
result?.tag = Holder(text)
}
return result!!
}
private inner class Holder(val text: TextView? = null)
}
private enum class ApmVLogUploadDuration(val text: String) {
IN_15M("15分钟内"),
IN_45M("45分钟内"),
@@ -2504,6 +2580,6 @@ internal class DebugSettingView @JvmOverloads constructor(
paramIndexes = [0]
)
private fun invokeCronetResult(json: String) {
Log.d("CronetNetwork", json)
CallerLogger.d(SceneConstant.M_HMI + "CronetNetwork", json)
}
}

View File

@@ -48,6 +48,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusS
4 -> {
ivFuncView.setImageResource(R.drawable.controller)
}
5 -> {
ivFuncView.setImageResource(R.drawable.ssl_check)
}
}
if (entity.isException) {
tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))

View File

@@ -2,19 +2,26 @@ package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.widget.FrameLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.status.StatusSummaryEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
import com.mogo.eagle.core.function.hmi.R
@@ -26,7 +33,7 @@ import com.zhjt.mogo.adas.data.AdasConstants
/**
* 状态汇总View控件
*/
class StatusSummaryView@JvmOverloads constructor(
class StatusSummaryView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
@@ -35,8 +42,9 @@ class StatusSummaryView@JvmOverloads constructor(
attrs,
defStyleAttr
), IConnectStatusListener, IMogoStatusChangedListener,
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener {
companion object{
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarConfigListener,
IMoGoCloudListener {
companion object {
private const val TAG = "SummaryStatusView"
}
@@ -50,6 +58,13 @@ class StatusSummaryView@JvmOverloads constructor(
it.add(StatusSummaryEntity(2))
it.add(StatusSummaryEntity(3))
it.add(StatusSummaryEntity(4, "域控未连接", true))
it.add(
StatusSummaryEntity(
5,
CallerAutopilotCarConfigListenerManager.getCertFileResult(),
CallerCloudCertManager.getRootCrtF().isNullOrEmpty()
)
)
}
}
@@ -67,6 +82,8 @@ class StatusSummaryView@JvmOverloads constructor(
MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
}
private fun initView() {
@@ -81,9 +98,10 @@ class StatusSummaryView@JvmOverloads constructor(
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
it.addItemDecoration(
CommonDividerItemDecoration.Builder()
.spanCountTBCare(false)
.horizontalInnerSpace(10.PX)
.build())
.spanCountTBCare(false)
.horizontalInnerSpace(10.PX)
.build()
)
StatusSummaryAdapter(context, data).apply {
adapter = this
it.adapter = this
@@ -108,6 +126,8 @@ class StatusSummaryView@JvmOverloads constructor(
MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
}
/**
@@ -168,30 +188,39 @@ class StatusSummaryView@JvmOverloads constructor(
AdasConstants.IpcConnectionStatus.DISCONNECTED -> {
pair = Pair("域控未连接", true)
}
AdasConstants.IpcConnectionStatus.CONNECTED -> {
pair = Pair("域控已连接", false)
}
AdasConstants.IpcConnectionStatus.CONNECTING -> {
pair = Pair("域控连接中", true)
}
AdasConstants.IpcConnectionStatus.RECONNECTING_TIMER, AdasConstants.IpcConnectionStatus.RECONNECTING_NETWORK -> {
pair = Pair("域控重连中", true)
}
AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> {
pair = Pair("域控连接异常", true)
}
AdasConstants.IpcConnectionStatus.ILLEGAL_ADDRESS -> {
pair = Pair("非法域控地址", true)
}
AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS -> {
pair = Pair("正在搜索域控地址", true)
}
AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> {
pair = Pair("找不到可用的域控地址", true)
}
AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT -> {
pair = Pair("域控心跳超时", true)
}
AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED -> {
pair = Pair("域控主动断开连接", true)
}
@@ -203,4 +232,41 @@ class StatusSummaryView@JvmOverloads constructor(
adapter?.notifyItemChanged(4)
}
}
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = "本机证书已下载"
data[5].isException = false
adapter?.notifyItemChanged(5)
}
}
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = "本机证书下载异常:$errorMsg"
data[5].isException = true
adapter?.notifyItemChanged(5)
}
}
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
return
}
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = msg
data[5].isException = !msg.contains("成功校验")
adapter?.notifyItemChanged(5)
}
}
}

View File

@@ -119,7 +119,6 @@ class StatusBarView @JvmOverloads constructor(
private fun setTextColor(color: Int) {
viewTextClock.setTextColor(color)
viewStatusBarTag.setTextColor(color)
}
override fun onDetachedFromWindow() {

View File

@@ -8,19 +8,27 @@ import android.net.wifi.WifiManager
import android.os.Handler
import android.os.Message
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_wifi_state.view.viewStatusBarTag
import kotlinx.android.synthetic.main.view_wifi_state.view.viewWifiStateBg
import me.jessyan.autosize.utils.AutoSizeUtils
import java.lang.ref.WeakReference
import kotlin.properties.Delegates
class WifiStateView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : AppCompatImageView(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
context: Context, attrs: AttributeSet? = null,defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs), IMoGoSkinModeChangeListener {
companion object {
const val TAG = "WifiStateView"
@@ -37,20 +45,46 @@ class WifiStateView @JvmOverloads constructor(
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
val view = stateViewWeakReference?.get()
view?.updateView(msg.what) {
view.setImageResource(it)
view?.updateLevel(msg.what)
}
}
}
private var wifiManager: WifiManager? = null
private var wifiHandler: WifiHandler? = null
private var level: Int by Delegates.observable(0) { _, o, n ->
if (o != n) {
UiThreadHandler.post {
updateView(n){
viewWifiStateBg.setImageResource(it)
}
}
}
}
private var wifiManager: WifiManager? = null
private var wifiHandler: WifiHandler? = null
private var wifiName: String by Delegates.observable("") { _, o, n ->
if (o != n) {
UiThreadHandler.post {
if(n.contains("unknow")){
viewStatusBarTag.text = ""
}else{
viewStatusBarTag.text = n
}
}
}
}
@Volatile
private var level: Int = 0
private val txtSize: Float
init {
LayoutInflater.from(context).inflate(R.layout.view_wifi_state, this, true)
val a = context.obtainStyledAttributes(attrs, R.styleable.WifiStateView, defStyleAttr, 0)
txtSize = a.getDimension(
R.styleable.WifiStateView_wifi_size,
resources.getDimension(R.dimen.dp_35)
)
a.recycle()
viewStatusBarTag.setTextSize(TypedValue.COMPLEX_UNIT_PX,AutoSizeUtils.dp2px(context,txtSize).toFloat())
wifiManager =
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
wifiHandler = WifiHandler(this)
@@ -67,6 +101,8 @@ class WifiStateView @JvmOverloads constructor(
return
}
val wifiInfo = wifiManager!!.connectionInfo
wifiName = wifiInfo.ssid.replace("\"","")
Log.i("emArrow", "wifiName: $wifiName")
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
wifiHandler?.sendEmptyMessage(level)
}
@@ -95,9 +131,25 @@ class WifiStateView @JvmOverloads constructor(
override fun onSkinModeChange(skinMode: Int) {
wifiHandler?.sendEmptyMessage(level)
UiThreadHandler.post {
when (skinMode) {
0 -> setStatusBarDarkOrLight(false)
1 -> setStatusBarDarkOrLight(true)
}
}
}
fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
private fun setStatusBarDarkOrLight(light: Boolean) = if (light) {
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_2C2E30))
} else {
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_FFFFFF))
}
fun updateLevel(wifiState: Int){
level = wifiState
}
private fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
when (FunctionBuildConfig.skinMode) {
0 -> {
when (wifiState) {
@@ -109,6 +161,7 @@ class WifiStateView @JvmOverloads constructor(
4 -> resId.invoke(R.drawable.wifi_light_state_five)
}
}
1 -> {
when (wifiState) {
-1 -> resId.invoke(R.drawable.wifi_dark_state_one)

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@@ -18,20 +18,9 @@
android:textSize="@dimen/dp_45"
android:textStyle="bold" />
<TextView
android:id="@+id/viewStatusBarTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_27"
android:gravity="center"
android:text="@string/status_bar_tag"
android:textColor="@color/color_2C2E30"
android:textSize="@dimen/dp_35" />
<!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:layout_width="@dimen/dp_54"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_54"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_18" />

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/viewStatusBarTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_27"
android:gravity="center_vertical"
android:maxLength="15"
android:textColor="@color/color_2C2E30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/viewWifiStateBg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/viewStatusBarTag"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -89,6 +89,10 @@
<attr name="pnc_txt_style" format="reference"/>
</declare-styleable>
<declare-styleable name="WifiStateView">
<attr name="wifi_size" format="dimension"/>
</declare-styleable>
<style name="AudioFileInfoOverlayText">
<item name="android:shadowColor">#80000000</item>
<item name="android:shadowRadius">11</item>

View File

@@ -8,6 +8,7 @@ import androidx.annotation.RequiresApi;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
@@ -103,7 +104,7 @@ public class TrackManager {
MessagePad.TrackedObject cache = cacheTrack.getCache();
if (cache != null) {
//相对静止物体 感知融合同位置物体,使用缓存数据做覆盖
if (cacheTrack.relativeStatic()) {
if (cacheTrack.relativeStatic() && data.getType() != TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.getType()) {
if (data.getColor() != null && !data.getColor().isEmpty()) {
cache = cache.toBuilder().setColor(data.getColor()).build();
}

View File

@@ -13,7 +13,7 @@ object TrackerSourceFilterHelper {
@SuppressLint("NewApi")
fun filterData(data: TrackedObject): Boolean {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type)
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GU.type)
) {
return true
}
@@ -55,6 +55,10 @@ object TrackerSourceFilterHelper {
return ""
}
if(data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type){
return ""
}
if(FunctionBuildConfig.isFusionColor){
if(isFusion(data)){
color = "#982FFFFF"

View File

@@ -30,6 +30,9 @@ class CertFileManager : IMoGoCertProvider {
@Volatile
private var rootCrtFile: String? = null
@Volatile
private var crtFileErrorMsg: String? = null
companion object {
private const val TAG = "CertFileManager"
}
@@ -72,6 +75,7 @@ class CertFileManager : IMoGoCertProvider {
"onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}"
)
certStatus.set(false)
crtFileErrorMsg = null
deviceCrtFile = securityKey
rootCrtFile = rootKey
SharedPrefsMgr.getInstance().putString(securityKeyTAG, securityKey)
@@ -92,6 +96,8 @@ class CertFileManager : IMoGoCertProvider {
override fun onFailed(errorCode: Int, errorMsg: String) {
CallerLogger.d("${SceneConstant.M_D_C}$TAG", "onFailed code:$errorCode, msg:$errorMsg")
certStatus.set(false)
crtFileErrorMsg = "$errorCode - $errorMsg"
CallerCloudListenerManager.invokeCloudCrtError(errorMsg)
onError?.invoke("证书下载失败, code:$errorCode, msg:$errorMsg")
}
})
@@ -112,4 +118,8 @@ class CertFileManager : IMoGoCertProvider {
override fun getRootCrtF(): String? {
return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, null)
}
override fun getCrtFileErrorMsg(): String? {
return crtFileErrorMsg
}
}

View File

@@ -32,10 +32,9 @@ public class PassPortSecret {
private IPassportSecret secretCB;
public void init(String deviceId, String path, IPassportSecret secretCB) {
if (this.secretCB != null) {
return;
if (this.secretCB == null) {
this.secretCB = secretCB;
}
this.secretCB = secretCB;
PassportService passportService = new PassportService();
passportService.setEnableLog(DebugConfig.isDebug());
domain.R<Passport> r = initLow(passportService, deviceId, path);