Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'

Dev arch opt 3.0

See merge request zhjt/AndroidApp/MoGoEagleEye!652
This commit is contained in:
wangmingjun
2023-03-03 15:05:33 +00:00
21 changed files with 255 additions and 292 deletions

View File

@@ -6,8 +6,6 @@ import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.obu.MogoObuConst import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuProvider import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuProvider
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CommonUtils import com.mogo.eagle.core.utilcode.util.CommonUtils
@@ -24,13 +22,12 @@ class MoGoObuProvider : IMoGoObuProvider {
get() = TAG get() = TAG
override fun onDestroy() { override fun onDestroy() {
MogoObuDcCombineManager.INSTANCE.destoryListener()
} }
override fun init(context: Context) { override fun init(context: Context) {
//obu融合数据 //obu融合数据
MogoObuDcCombineManager.INSTANCE.init(context) MogoObuDcCombineManager.INSTANCE.init(context)
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
//bus乘客版本obu功能去掉大理项目需要全部车辆接收不再限制 //bus乘客版本obu功能去掉大理项目需要全部车辆接收不再限制
mContext = context mContext = context

View File

@@ -56,19 +56,27 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} }
override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) { override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) {
onMogoObuDcRsiWarning(rsiWarningData) if (HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcRsiWarning(rsiWarningData)
}
} }
override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) { override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) {
onMogoObuDcRsmWarning(rsmWarningData) if (HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcRsmWarning(rsmWarningData)
}
} }
override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) { override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) {
onMogoObuDcSpatWarning(spatWarningData) if (HmiBuildConfig.isShowObuV2iView) {
onMogoObuDcSpatWarning(spatWarningData)
}
} }
override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) { override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) {
onMogoObuMapMath(mapMatchData) if (HmiBuildConfig.isShowObuV2iView) {
onMogoObuMapMath(mapMatchData)
}
} }
/** /**
@@ -237,8 +245,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
CallerLogger.d( CallerLogger.d(
"${M_OBU}${TAG}", "${M_OBU}${TAG}",
"MogoObuDcCombineManager ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${rsiWarningData.warningMsgList[0].distance} ---eventRadius = ${rsiWarningData.warningMsgList[0].eventRadius} --speedMaxLimit = ${rsiWarningData.warningMsgList[0].speedMaxLimit}" "MogoObuDcCombineManager ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${rsiWarningData.warningMsgList[0].distance} ---eventRadius = ${rsiWarningData.warningMsgList[0].eventRadius} --speedMaxLimit = ${rsiWarningData.warningMsgList[0].speedMaxLimit}")
)
when (status) { when (status) {
// 添加 // 添加
MogoObuConstants.STATUS.ADD -> { MogoObuConstants.STATUS.ADD -> {
@@ -380,33 +387,31 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道 * 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/ */
fun onMogoObuMapMath(data: ObuScene.MapMatchData?) { fun onMogoObuMapMath(data: ObuScene.MapMatchData?) {
if (HmiBuildConfig.isShowObuLimitSpeedView) { if (data != null) {
if (data != null) { CallerLogger.d(
CallerLogger.d( "${M_OBU}${TAG}",
"${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${ Math.round(
Math.round( (data.speedMaxLimit * 0.02 * 3.6)
(data.speedMaxLimit * 0.02 * 3.6) )
) } --- data.speedMaxLimit = ${data.speedMaxLimit}"
} --- data.speedMaxLimit = ${data.speedMaxLimit}" )
) when (data.status) {
when (data.status) { MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuConstants.STATUS.ADD -> { // 添加 CallerLimitingVelocityListenerManager.invokeUnion(
CallerLimitingVelocityListenerManager.invokeUnion( (data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(), DataSourceType.OBU
DataSourceType.OBU )
) }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新 MogoObuConstants.STATUS.UPDATE -> { // 更新
} }
MogoObuConstants.STATUS.DELETE -> { // 删除 MogoObuConstants.STATUS.DELETE -> { // 删除
CallerLimitingVelocityListenerManager.invokeUnion( CallerLimitingVelocityListenerManager.invokeUnion(
-1, -1,
DataSourceType.OBU DataSourceType.OBU
) )
}
} }
} }
} }

View File

@@ -661,7 +661,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
/** /**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示 * 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截 * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容
* @see com.mogo.module.common.enums.EventTypeEnumNew * @see com.mogo.module.common.enums.EventTypeEnumNew
* EventTypeEnumNew在定义的id为了防止重复和原始数据是不一样的有对应关系 * EventTypeEnumNew在定义的id为了防止重复和原始数据是不一样的有对应关系
*/ */
@@ -806,7 +806,6 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType
} }
} }
when (status) { when (status) {

View File

@@ -1,26 +1,35 @@
package com.mogo.eagle.core.function.msgbox package com.mogo.eagle.core.function.msgbox
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.os.Looper import android.os.Looper
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb
import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.eagle.core.utilcode.util.SPUtils
import com.mogo.eagle.core.utilcode.util.Utils import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
object DataManager { object DataManager {
// private val msgBoxMap: EnumMap<MsgBoxType, MutableList<MsgBoxBean>> = EnumMap(MsgBoxType::class.java) // private val msgBoxMap: EnumMap<MsgBoxType, MutableList<MsgBoxBean>> = EnumMap(MsgBoxType::class.java)
const val TAG = "DataManager"
// 消失时间5000ms // 消失时间5000ms
const val DISMISS_TIME = 5000L const val DISMISS_TIME = 5000L
@@ -148,6 +157,10 @@ object DataManager {
* 从本地数据库中查询数据 * 从本地数据库中查询数据
*/ */
fun queryAllMessages(context: Context) { fun queryAllMessages(context: Context) {
if (!ProcessUtils.isMainProcess(context)) {
return
}
clearMessageBoxTable(context)
scope.launch { scope.launch {
initCache() initCache()
try { try {
@@ -158,6 +171,38 @@ object DataManager {
} }
} }
@SuppressLint("SimpleDateFormat")
private fun clearMessageBoxTable(context: Context) {
Thread {
val lastLaunchTimeStr = SPUtils.getInstance().getString("last_launch", "")
val format = SimpleDateFormat("yyyy-MM-dd")
val currDate = Date(System.currentTimeMillis())
val currTimeStr = format.format(currDate)
try {
if (lastLaunchTimeStr != null && lastLaunchTimeStr.isNotEmpty()) {
val isSameDay = currTimeStr == lastLaunchTimeStr
// 超过一天需要清除消息盒子中的数据并把时间戳存入SP
if (!isSameDay) {
val file: File = context.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME)
if (file != null && file.exists()) {
context.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME)
}
SPUtils.getInstance().put("last_launch", currTimeStr)
}
} else {
// 首次使用App或中途仅删除sp文件
val file: File = context.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME)
if (file != null && file.exists()) {
context.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME)
}
SPUtils.getInstance().put("last_launch", currTimeStr)
}
} catch (e: Exception) {
e(TAG, e.message)
}
}.start()
}
private fun initCache() { private fun initCache() {
if (cacheNotifyList.isNotEmpty()) { if (cacheNotifyList.isNotEmpty()) {
cacheNotifyList.clear() cacheNotifyList.clear()
@@ -170,86 +215,87 @@ object DataManager {
} }
} }
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) { private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> =
delay(2000) withContext(Dispatchers.IO) {
return@withContext MsgBoxDb.getDb(context) delay(2000)
.monitorDao() return@withContext MsgBoxDb.getDb(context)
.getAllCachedMessages() .monitorDao()
.map { msgInfo -> .getAllCachedMessages()
val json = msgInfo.bean2Json .map { msgInfo ->
when (msgInfo.obj2JsonType) { val json = msgInfo.bean2Json
MsgBoxType.V2X.ordinal -> { when (msgInfo.obj2JsonType) {
return@map MsgBoxBean( MsgBoxType.V2X.ordinal -> {
MsgBoxType.V2X, return@map MsgBoxBean(
GsonUtils.fromJson(json, V2XMsg::class.java) MsgBoxType.V2X,
).apply { GsonUtils.fromJson(json, V2XMsg::class.java)
this.timestamp = msgInfo.timeStamp ).apply {
withContext(Dispatchers.Main) { this.timestamp = msgInfo.timeStamp
cacheNotifyList.add(this@apply) withContext(Dispatchers.Main) {
cacheNotifyList.add(this@apply)
}
} }
} }
} MsgBoxType.OBU.ordinal -> {
MsgBoxType.OBU.ordinal -> { return@map MsgBoxBean(
return@map MsgBoxBean( MsgBoxType.OBU,
MsgBoxType.OBU, GsonUtils.fromJson(json, V2XMsg::class.java)
GsonUtils.fromJson(json, V2XMsg::class.java) ).apply {
).apply { this.timestamp = msgInfo.timeStamp
this.timestamp = msgInfo.timeStamp withContext(Dispatchers.Main) {
withContext(Dispatchers.Main) { cacheNotifyList.add(this@apply)
cacheNotifyList.add(this@apply) }
} }
} }
} MsgBoxType.OPERATION.ordinal -> {
MsgBoxType.OPERATION.ordinal -> { return@map MsgBoxBean(
return@map MsgBoxBean( MsgBoxType.OPERATION,
MsgBoxType.OPERATION, GsonUtils.fromJson(json, OperationMsg::class.java)
GsonUtils.fromJson(json, OperationMsg::class.java) ).apply {
).apply { this.timestamp = msgInfo.timeStamp
this.timestamp = msgInfo.timeStamp withContext(Dispatchers.Main) {
withContext(Dispatchers.Main) { cacheNotifyList.add(this@apply)
cacheNotifyList.add(this@apply) }
} }
} }
} MsgBoxType.REPORT.ordinal -> {
MsgBoxType.REPORT.ordinal -> { return@map MsgBoxBean(
return@map MsgBoxBean( MsgBoxType.REPORT,
MsgBoxType.REPORT, GsonUtils.fromJson(json, ReportEntity::class.java)
GsonUtils.fromJson(json, ReportEntity::class.java) ).apply {
).apply { this.timestamp = msgInfo.timeStamp
this.timestamp = msgInfo.timeStamp withContext(Dispatchers.Main) {
withContext(Dispatchers.Main) { cacheSysInfoList.add(this@apply)
cacheSysInfoList.add(this@apply) }
} }
} }
} MsgBoxType.RECORD.ordinal -> {
MsgBoxType.RECORD.ordinal -> { return@map MsgBoxBean(
return@map MsgBoxBean( MsgBoxType.RECORD,
MsgBoxType.RECORD, GsonUtils.fromJson(json, RecordBagMsg::class.java)
GsonUtils.fromJson(json, RecordBagMsg::class.java) ).apply {
).apply { this.timestamp = msgInfo.timeStamp
this.timestamp = msgInfo.timeStamp withContext(Dispatchers.Main) {
withContext(Dispatchers.Main) { cacheRecordList.add(this@apply)
cacheRecordList.add(this@apply) }
} }
} }
} MsgBoxType.NOTICE.ordinal -> {
MsgBoxType.NOTICE.ordinal -> { return@map MsgBoxBean(
return@map MsgBoxBean( MsgBoxType.NOTICE,
MsgBoxType.NOTICE, GsonUtils.fromJson(json, NoticeFrCloudMsg::class.java)
GsonUtils.fromJson(json, NoticeFrCloudMsg::class.java) ).apply {
).apply { this.timestamp = msgInfo.timeStamp
this.timestamp = msgInfo.timeStamp withContext(Dispatchers.Main) {
withContext(Dispatchers.Main) { cacheNotifyList.add(this@apply)
cacheNotifyList.add(this@apply) }
} }
} }
} else -> {
else -> { return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg())
return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg()) }
} }
} }
} }
}
/** /**
* 存储到本地数据库 * 存储到本地数据库
@@ -298,7 +344,8 @@ object DataManager {
fun delMsgBoxBean(context: Context, msgBoxBean: MsgBoxBean) { fun delMsgBoxBean(context: Context, msgBoxBean: MsgBoxBean) {
scope.launch { scope.launch {
withContext(Dispatchers.Default) { withContext(Dispatchers.Default) {
val msgBoxInfo = MsgBoxInfo(msgBoxBean.bean2Json, msgBoxBean.type.ordinal, msgBoxBean.timestamp) val msgBoxInfo =
MsgBoxInfo(msgBoxBean.bean2Json, msgBoxBean.type.ordinal, msgBoxBean.timestamp)
MsgBoxDb.getDb(context) MsgBoxDb.getDb(context)
.monitorDao() .monitorDao()
.deleteMsg(msgBoxInfo) .deleteMsg(msgBoxInfo)

View File

@@ -173,9 +173,6 @@ class DevaToolsProvider : IDevaToolsProvider {
override fun updateUpgradeProgress() { override fun updateUpgradeProgress() {
upgradeManager.updateUpgradeProgress(mContext!!) upgradeManager.updateUpgradeProgress(mContext!!)
}
override fun updateObuUpgradeStatus() {
upgradeManager.updateObuUpgradeStatus(mContext!!) upgradeManager.updateObuUpgradeStatus(mContext!!)
} }

View File

@@ -73,11 +73,11 @@ internal class SOPSettingView @JvmOverloads constructor(
/** /**
* obu弱势交通控制 * obu弱势交通控制
*/ */
tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView // tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked -> // tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
// 默认开启 // // 默认开启
HmiBuildConfig.isShowObuWeaknessTrafficView = !isChecked // HmiBuildConfig.isShowObuWeaknessTrafficView = !isChecked
} // }
/** /**
* 云端弱势交通控制 * 云端弱势交通控制
@@ -88,14 +88,6 @@ internal class SOPSettingView @JvmOverloads constructor(
HmiBuildConfig.isShowCloudWeaknessTrafficView = isChecked HmiBuildConfig.isShowCloudWeaknessTrafficView = isChecked
} }
/**
* 限速数据来源开关
*/
tbRoadLimitSpeedSop.setOnCheckedChangeListener { _, isChecked ->
// 默认关闭
HmiBuildConfig.isShowObuLimitSpeedView = isChecked
}
/** /**
* obu V2V开关默认打开 * obu V2V开关默认打开
*/ */

View File

@@ -1,36 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context
import android.util.AttributeSet
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
/**
* @author XuXinChao
* @description fix java.lang.IndexOutOfBoundsException检测到不一致。视图持有者适配器positionViewHolder无效
* @since: 2022/6/7
*/
class WrapContentLinearLayoutManager : LinearLayoutManager {
constructor(context: Context?) : super(context) {}
constructor(context: Context?, orientation: Int, reverseLayout: Boolean) : super(
context,
orientation,
reverseLayout
) {}
constructor(
context: Context?,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) {}
override fun onLayoutChildren(recycler: RecyclerView.Recycler?, state: RecyclerView.State?) {
try {
super.onLayoutChildren(recycler, state)
} catch (e: IndexOutOfBoundsException) {
e.printStackTrace()
}
}
}

View File

@@ -51,6 +51,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
private var clickListener: ClickListener? = null private var clickListener: ClickListener? = null
private var keyBoardUtil: KeyBoardUtil? = null private var keyBoardUtil: KeyBoardUtil? = null
@Volatile
private var connectStatus = false private var connectStatus = false
private var lastTime = 0L private var lastTime = 0L

View File

@@ -40,6 +40,7 @@ class PncActionsView @JvmOverloads constructor(
@Volatile @Volatile
private var mTrafficLightResult: TrafficLightResult? = null private var mTrafficLightResult: TrafficLightResult? = null
@Volatile
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
private val bgResources: Int private val bgResources: Int

View File

@@ -11,6 +11,7 @@ import android.view.View
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlin.math.abs import kotlin.math.abs
@@ -139,17 +140,19 @@ class BatteryView : View , IMoGoSkinModeChangeListener {
} }
override fun onSkinModeChange(skinMode: Int) { override fun onSkinModeChange(skinMode: Int) {
when (skinMode) { ThreadUtils.runOnUiThread {
0 -> { when (skinMode) {
batteryColor = resources.getColor(R.color.color_27FFFFFF) 0 -> {
powerColor = Color.WHITE batteryColor = resources.getColor(R.color.color_27FFFFFF)
} powerColor = Color.WHITE
1 -> { }
batteryColor = resources.getColor(R.color.color_1E111111) 1 -> {
powerColor = resources.getColor(R.color.color_2C2E30) batteryColor = resources.getColor(R.color.color_1E111111)
powerColor = resources.getColor(R.color.color_2C2E30)
}
} }
invalidate()
} }
invalidate()
} }
override fun onAttachedToWindow() { override fun onAttachedToWindow() {

View File

@@ -29,7 +29,9 @@ class CheckSystemView @JvmOverloads constructor(
const val TAG = "CheckSystemView" const val TAG = "CheckSystemView"
} }
@Volatile
private var connectStatus = false //是否连接工控机 private var connectStatus = false //是否连接工控机
@Volatile
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
private var dockerRebootDialog: DockerRebootDialog? = null private var dockerRebootDialog: DockerRebootDialog? = null

View File

@@ -14,6 +14,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.BarUtils import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlinx.android.synthetic.main.view_status_bar.view.* import kotlinx.android.synthetic.main.view_status_bar.view.*
import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CopyOnWriteArrayList
@@ -55,9 +56,11 @@ class StatusBarView @JvmOverloads constructor(
} }
override fun onSkinModeChange(skinMode: Int) { override fun onSkinModeChange(skinMode: Int) {
when (skinMode) { ThreadUtils.runOnUiThread {
0 -> setStatusBarDarkOrLight(false) when (skinMode) {
1 -> setStatusBarDarkOrLight(true) 0 -> setStatusBarDarkOrLight(false)
1 -> setStatusBarDarkOrLight(true)
}
} }
} }

View File

@@ -31,6 +31,7 @@ class VersionNameView @JvmOverloads constructor(
const val TAG = "VersionNameView" const val TAG = "VersionNameView"
} }
@Volatile
private var dockerVersion: String? = null //工控机版本 private var dockerVersion: String? = null //工控机版本
init{ init{

View File

@@ -282,11 +282,13 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
} }
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val status = autoPilotStatusInfo.ipcConnStatus UiThreadHandler.post {
if (mLastStatus != status) { val status = autoPilotStatusInfo.ipcConnStatus
val statusInfo = autoPilotStatusInfo.clone() if (mLastStatus != status) {
rvConnectInfo.post { updateConnectInfoView(statusInfo) } val statusInfo = autoPilotStatusInfo.clone()
mLastStatus = status rvConnectInfo.post { updateConnectInfoView(statusInfo) }
mLastStatus = status
}
} }
} }

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Process; import android.os.Process;
@@ -18,20 +17,15 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ProcessUtils; import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.SPUtils;
import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.Date;
/** /**
* 默认初始化一些基础服务配置 todo 分离 msgBox去自己的模块中 --- 扶风 * 默认初始化一些基础服务配置
*/ */
public abstract class MainMoGoApplication extends AbsMogoApplication { public abstract class MainMoGoApplication extends AbsMogoApplication {
@@ -50,12 +44,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
initLogConfig(); initLogConfig();
initTipToast(); initTipToast();
initModules(); initModules();
if (ProcessUtils.isMainProcess(this)) { CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
clearMessageBoxTable();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
CallerDevaToolsManager.INSTANCE.updateUpgradeProgress(); CallerDevaToolsManager.INSTANCE.updateUpgradeProgress();
CallerDevaToolsManager.INSTANCE.updateObuUpgradeStatus();
} }
@Override @Override
@@ -64,38 +54,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
return true; return true;
} }
@SuppressLint("SimpleDateFormat")
private void clearMessageBoxTable() {
new Thread(() -> {
String lastLaunchTimeStr = SPUtils.getInstance().getString("last_launch", "");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date currDate = new Date(System.currentTimeMillis());
String currTimeStr = format.format(currDate);
try {
if (lastLaunchTimeStr != null && !lastLaunchTimeStr.isEmpty()) {
boolean isSameDay = currTimeStr.equals(lastLaunchTimeStr);
// 超过一天需要清除消息盒子中的数据并把时间戳存入SP
if (!isSameDay) {
File file = this.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME);
if (file != null && file.exists()) {
this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME);
}
SPUtils.getInstance().put("last_launch", currTimeStr);
}
} else {
// 首次使用App或中途仅删除sp文件
File file = this.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME);
if (file != null && file.exists()) {
this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME);
}
SPUtils.getInstance().put("last_launch", currTimeStr);
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}
/** /**
* 初始化异常采集配置 * 初始化异常采集配置
*/ */
@@ -126,11 +84,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider")); MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
// BIZ // BIZ
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_FUNC_BIZ, "IMoGoNoticeProvider")); MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_FUNC_BIZ, "IMoGoNoticeProvider"));
// todo 后置 车聊聊IM // 后置 车聊聊IM
MogoModulePaths.addModuleFunctionServer(new MogoModule(ChatConsts.CHAT_PROVIDER_PATH, ChatConsts.CHAT_MODULE_NAME)); MogoModulePaths.addModuleFunctionServer(new MogoModule(ChatConsts.CHAT_PROVIDER_PATH, ChatConsts.CHAT_MODULE_NAME));
// 司机身份专属 // 司机身份专属
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// todo 后置 地图数据收集模块 // 后置 地图数据收集模块
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector")); MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector"));
} }
CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"); CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
@@ -141,7 +99,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
super.attachBaseContext(base); super.attachBaseContext(base);
/*如果是主进程**/ /*如果是主进程**/
// if (ProcessUtils.isMainProcess(this)) { // if (ProcessUtils.isMainProcess(this)) {
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.COLD_START); AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.COLD_START);
// } // }
BoostMultiDex.install(base); BoostMultiDex.install(base);
AbsMogoApplication.sApp = this; AbsMogoApplication.sApp = this;

View File

@@ -163,11 +163,13 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
/> />
<!--这个后面产品会统一去掉-->
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/tbObuToDcView" android:id="@+id/tbObuToDcView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="OBU到工控机V2I显示" android:text="OBU到工控机V2I显示"
android:visibility="gone"
android:paddingTop="25dp" android:paddingTop="25dp"
android:paddingBottom="25dp" android:paddingBottom="25dp"
android:scaleY="1.2" android:scaleY="1.2"
@@ -200,7 +202,7 @@
android:paddingBottom="25dp" android:paddingBottom="25dp"
android:scaleY="1.2" android:scaleY="1.2"
android:scaleX="1.2" android:scaleX="1.2"
app:layout_constraintTop_toBottomOf="@id/tbObuToDcView" app:layout_constraintTop_toBottomOf="@id/tbObuV2vView"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/verticalGuideLine" app:layout_constraintRight_toLeftOf="@id/verticalGuideLine"
/> />
@@ -214,31 +216,17 @@
android:paddingBottom="25dp" android:paddingBottom="25dp"
android:scaleY="1.2" android:scaleY="1.2"
android:scaleX="1.2" android:scaleX="1.2"
app:layout_constraintTop_toBottomOf="@id/tbObuToDcView" app:layout_constraintTop_toBottomOf="@id/tbObuWeaknessTrafficSop"
app:layout_constraintLeft_toRightOf="@id/verticalGuideLine" app:layout_constraintLeft_toRightOf="@id/verticalGuideLine"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
/> />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/tbRoadLimitSpeedSop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="路侧限速提醒"
android:paddingTop="25dp"
android:paddingBottom="25dp"
android:scaleY="1.2"
android:scaleX="1.2"
app:layout_constraintTop_toBottomOf="@id/tbCloudWeaknessTrafficSop"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/verticalGuideLine"
/>
<TextView <TextView
android:id="@+id/tvSpeedThresholdTitle" android:id="@+id/tvSpeedThresholdTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbRoadLimitSpeedSop" app:layout_constraintTop_toBottomOf="@id/tbCloudWeaknessTrafficSop"
android:text="变道速度阈值:" android:text="变道速度阈值:"
android:textSize="@dimen/dp_36" android:textSize="@dimen/dp_36"
android:textColor="#1A1A1A" android:textColor="#1A1A1A"

View File

@@ -4,7 +4,6 @@ import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MotionEvent import android.view.MotionEvent
import android.widget.RelativeLayout import android.widget.RelativeLayout
@@ -52,6 +51,7 @@ class SmallMapView @JvmOverloads constructor(
private var mContext: Context? = null private var mContext: Context? = null
private var mLocation: MogoLocation? = null private var mLocation: MogoLocation? = null
@Volatile
private var autoPilotStatus = 0 private var autoPilotStatus = 0
companion object { companion object {
@@ -216,7 +216,7 @@ class SmallMapView @JvmOverloads constructor(
uiSettings?.setAllGesturesEnabled(false) // 所有手势 uiSettings?.setAllGesturesEnabled(false) // 所有手势
uiSettings?.isMyLocationButtonEnabled = false // 显示默认的定位按钮 uiSettings?.isMyLocationButtonEnabled = false // 显示默认的定位按钮
uiSettings?.setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可 uiSettings?.setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可
mAMap?.setOnMapLoadedListener(AMap.OnMapLoadedListener { mAMap?.setOnMapLoadedListener {
CallerLogger.d( CallerLogger.d(
SceneConstant.M_MAP + TAG, SceneConstant.M_MAP + TAG,
"smp---onMapLoaded" "smp---onMapLoaded"
@@ -237,7 +237,7 @@ class SmallMapView @JvmOverloads constructor(
mAMapNaviView!!.width / 2, mAMapNaviView!!.width / 2,
mAMapNaviView!!.height / 2 mAMapNaviView!!.height / 2
) )
}) }
} }
private fun coordinateConverterFrom84(mContext: Context?, mogoLatLng: MogoLatLng): LatLng { private fun coordinateConverterFrom84(mContext: Context?, mogoLatLng: MogoLatLng): LatLng {
@@ -283,36 +283,39 @@ class SmallMapView @JvmOverloads constructor(
if (mCarMarker == null) { if (mCarMarker == null) {
return return
} }
val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) UiThreadHandler.post {
val bearing = floor(mLocation!!.heading).toFloat() val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude)
//更新车辆位置 val bearing = floor(mLocation!!.heading).toFloat()
mCarMarker!!.position = currentLatLng //更新车辆位置
if (mCoordinatesLatLng.size > 1) { mCarMarker!!.position = currentLatLng
// 结束位置 if (mCoordinatesLatLng.size > 1) {
val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1] // 结束位置
val calculateDistance = CoordinateUtils.calculateLineDistance( val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
endLatLng.latitude, endLatLng.longitude, val calculateDistance = CoordinateUtils.calculateLineDistance(
currentLatLng.latitude, currentLatLng.longitude endLatLng.latitude, endLatLng.longitude,
) currentLatLng.latitude, currentLatLng.longitude
CallerLogger.d( )
SceneConstant.M_MAP + TAG,
"calculateDistance=$calculateDistance"
)
if (calculateDistance <= 5) {
CallerLogger.d( CallerLogger.d(
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ") SceneConstant.M_MAP + TAG,
clearPolyline() "calculateDistance=$calculateDistance"
mCoordinatesLatLng.clear() )
if (calculateDistance <= 5) {
CallerLogger.d(
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ")
clearPolyline()
mCoordinatesLatLng.clear()
}
} }
val cameraPosition: CameraPosition =
CameraPosition.Builder()
.target(mCarMarker!!.position)
.tilt(0f)
.bearing(bearing)
.zoom(zoomLevel.toFloat())
.build()
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
} }
val cameraPosition: CameraPosition =
CameraPosition.Builder()
.target(mCarMarker!!.position)
.tilt(0f)
.bearing(bearing)
.zoom(zoomLevel.toFloat())
.build()
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
} }
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {

View File

@@ -125,11 +125,6 @@ interface IDevaToolsProvider : IProvider {
*/ */
fun updateUpgradeProgress() fun updateUpgradeProgress()
/**
* obu下载进度
*/
fun updateObuUpgradeStatus()
/** /**
* 展示状态栏 * 展示状态栏
*/ */

View File

@@ -169,13 +169,6 @@ object CallerDevaToolsManager {
devaToolsProviderApi?.updateUpgradeProgress() devaToolsProviderApi?.updateUpgradeProgress()
} }
/**
* obu下载状态
*/
fun updateObuUpgradeStatus() {
devaToolsProviderApi?.updateObuUpgradeStatus()
}
/** /**
* 展示状态栏 * 展示状态栏
*/ */

View File

@@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4
LOGLIB_VERSION=1.5.11 LOGLIB_VERSION=1.5.11
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION # 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.5.6 MOGO_NETWORK_VERSION=1.4.5.7
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.4.5.6 MOGO_PASSPORT_VERSION=1.4.5.7
# 常链接 # 常链接
MOGO_SOCKET_VERSION=1.4.5.6 MOGO_SOCKET_VERSION=1.4.5.7
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.4.5.6 MOGO_REALTIME_VERSION=1.4.5.7
# 探路,道路事件发布,获取 # 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.5.6 MOGO_TANLU_VERSION=1.4.5.7
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.4.5.6 MOGO_LIVE_VERSION=1.4.5.7
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.5.6 MOGO_TRAFFICLIVE_VERSION=1.4.5.7
# 定位服务 # 定位服务
MOGO_LOCATION_VERSION=1.4.5.6 MOGO_LOCATION_VERSION=1.4.5.7
# 远程通讯模块 # 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.5.6 MOGO_TELEMATIC_VERSION=1.4.5.7
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 自研地图 # 自研地图
MAP_SDK_VERSION=2.10.0.9 MAP_SDK_VERSION=2.10.0.9

View File

@@ -29,6 +29,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.tts.base.IMogoTTS; import com.mogo.tts.base.IMogoTTS;
import com.mogo.tts.base.IMogoTTSCallback; import com.mogo.tts.base.IMogoTTSCallback;
import com.mogo.tts.base.LangTtsEntity;
import com.mogo.tts.base.LanguageType;
import com.mogo.tts.base.MultiLangTtsEntity; import com.mogo.tts.base.MultiLangTtsEntity;
import com.mogo.tts.base.PreemptType; import com.mogo.tts.base.PreemptType;
import com.zhidao.auto.platform.voice.VoiceClient; import com.zhidao.auto.platform.voice.VoiceClient;
@@ -443,9 +445,11 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@MainThread @MainThread
public void speakTTSVoiceWithLevel(String text, int ttsLevel, IMogoTTSCallback callBack) { public void speakTTSVoiceWithLevel(String text, int ttsLevel, IMogoTTSCallback callBack) {
if (mHasAuth && mEngine != null) { if (mHasAuth && mEngine != null) {
mSpeakVoiceMap.put(text, callBack); if (callBack != null) {
mSpeakVoiceMap.put(text, callBack);
}
speakTTSVoiceWithLevel(text, ttsLevel);
} }
speakTTSVoiceWithLevel(text, ttsLevel);
} }
// 降序插入Tts(目前Level0、1可排队) // 降序插入Tts(目前Level0、1可排队)
@@ -508,7 +512,15 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@Override @Override
public void speakMultiLangTTSWithLevel(MultiLangTtsEntity ttsEntity, int level, IMogoTTSCallback callback) { public void speakMultiLangTTSWithLevel(MultiLangTtsEntity ttsEntity, int level, IMogoTTSCallback callback) {
if (mHasAuth && mEngine != null) {
LangTtsEntity entity;
if ((entity = ttsEntity.ttsNext()) != null && entity.getLanguage() == LanguageType.CHINESE) {
if (callback != null) {
mSpeakVoiceMap.put(entity.getTtsContent(), callback);
}
speakTTSVoiceWithLevel(entity.getTtsContent(), level);
}
}
} }
/** /**