Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/build.gradle
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/SweeperProvider.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java
#	OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml
This commit is contained in:
donghongyu
2023-02-08 14:40:42 +08:00
314 changed files with 5403 additions and 6632 deletions

View File

@@ -57,6 +57,9 @@ dependencies {
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation project(':foudations:mogo-commons')
implementation project(':core:mogo-core-data')

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.function.biz
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.biz.IMoGoFuncBizProvider
@@ -10,9 +11,9 @@ import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.d
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDispatcher
import com.mogo.eagle.function.biz.v2x.overview.OverViewDataManager
import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightDispatcher
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@Route(path = MogoServicePaths.PATH_FUNC_BIZ)
@@ -28,8 +29,6 @@ class FuncBizProvider : IMoGoFuncBizProvider {
MogoTrafficLightManager.INSTANCE.initServer(context)
VipCarManager.INSTANCE.initServer(context)
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 宏宇 放入dataCenter
SpeedLimitDispatcher.INSTANCE.initLimit(context) //todo 宏宇放入dataCenter
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}
@@ -68,13 +67,24 @@ class FuncBizProvider : IMoGoFuncBizProvider {
cronTaskManager.clear()
}
override fun fetchInfStructures() {
OverViewDataManager.fetchInfStructures()
}
override fun getAllV2XEvents() {
OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn)
}
override fun initOverViewDb(context: Context) {
OverviewDb.getDb(context)
}
override fun onDestroy() {
noticeSocketManager.release()
dispatchAutoPilotManager.release()
cronTaskManager.release()
VipCarManager.INSTANCE.destroy()
TrafficLightDispatcher.INSTANCE.destroy()
// RedLightWarningManager.INSTANCE.onDestroy()
}
}

View File

@@ -13,7 +13,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
@@ -130,7 +130,7 @@ class DispatchAutoPilotManager private constructor() :
AutopilotControlParameters.AutoPilotLonLat(it.endLat, it.endLon)
currentAutopilot.vehicleType = 10
CallerLogger.d(SceneConstant.Companion.M_DISPATCH + TAG, "开启自动驾驶====$currentAutopilot")
CallerAutoPilotManager.startAutoPilot(currentAutopilot)
CallerAutoPilotControlManager.startAutoPilot(currentAutopilot)
}
}

View File

@@ -7,7 +7,7 @@ import com.mogo.commons.constants.HostConst
import com.mogo.commons.utils.RetryWithDelay
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.camera.ReqLiveCarBean
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -90,7 +90,7 @@ class CronTaskManager {
* 请求路口一定范围内的设备信息(包含:摄像头、灯)
*/
private fun requestDeviceList() {
CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()?.let { location ->
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.let { location ->
disposable = MoGoRetrofitFactory.getInstance(HostConst.getEagleHost())
.create(ICameraListServices::class.java)
.getDeviceList(location.longitude, location.latitude, 500)
@@ -124,7 +124,7 @@ class CronTaskManager {
}
private fun requestCarCameraList() {
CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()?.let { location ->
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.let { location ->
carDisposable = MoGoRetrofitFactory.getInstance(HostConst.getEagleHost())
.create(ICameraListServices::class.java)
.getCarCameraList(ReqLiveCarBean(location.longitude, location.latitude))

View File

@@ -1,21 +1,23 @@
package com.mogo.eagle.core.function.overview
package com.mogo.eagle.function.biz.v2x.overview
import androidx.lifecycle.*
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.overview.db.OverviewDb
import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi
import com.mogo.eagle.core.function.overview.remote.V2XEvent
import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.overview.remote.OverViewServiceApi
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.concurrent.TimeUnit
object OverViewDataManager {
@@ -26,37 +28,8 @@ object OverViewDataManager {
OverviewDb.getDb(AbsMogoApplication.getApp()).overviewDao()
}
private val _infStructures = MutableLiveData<List<Infrastructure>>()
private val _V2XEvents = MutableLiveData<List<V2XEvent>>()
private var disposable: Disposable? = null
val infStructures
get() = _infStructures
private val _infStructuresMap = _infStructures
.switchMap { infStructures ->
liveData {
val map = HashMap<String, ArrayList<Infrastructure>>()
infStructures.forEach {
val geoHash = it.geoHash
if (geoHash == null) {
return@forEach
} else {
if (!map.containsKey(geoHash)) {
val list = ArrayList<Infrastructure>()
list.add(it)
map[geoHash] = list
} else {
map[geoHash]?.add(it)
}
}
}
emit(map)
}
}
val infStructuresMap
get() = _infStructuresMap
fun fetchInfStructures() {
ProcessLifecycleOwner.get().lifecycleScope.launch {
val data = try {
@@ -67,8 +40,27 @@ object OverViewDataManager {
e.printStackTrace()
null
}
data?.let {
_infStructures.value = it
data?.let { infStructures ->
withContext(Dispatchers.Default) {
val map = HashMap<String, ArrayList<Infrastructure>>()
infStructures.forEach {
val geoHash = it.geoHash
if (geoHash == null) {
return@forEach
} else {
if (!map.containsKey(geoHash)) {
val list = ArrayList<Infrastructure>()
list.add(it)
map[geoHash] = list
} else {
map[geoHash]?.add(it)
}
}
}
withContext(Dispatchers.Main) {
CallerFuncBizListenerManager.invokeInfStructures(map)
}
}
}
}
}
@@ -113,13 +105,11 @@ object OverViewDataManager {
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
it?.apply {
_V2XEvents.value = this
CallerFuncBizListenerManager.invokeV2XEvents(this)
}
}
}
fun getV2XEventLiveData() = _V2XEvents
fun stopQueryV2XEvents() {
disposable?.dispose()
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.overview.db
package com.mogo.eagle.function.biz.v2x.overview.db
import androidx.room.Dao
import androidx.room.Query

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.overview.db
package com.mogo.eagle.function.biz.v2x.overview.db
import android.content.Context
import androidx.room.Database

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.overview.remote
package com.mogo.eagle.function.biz.v2x.overview.remote
import io.reactivex.Observable
import retrofit2.http.GET

View File

@@ -0,0 +1,20 @@
package com.mogo.eagle.function.biz.v2x.overview.remote
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.v2x.V2XEvent
@Keep
data class V2XEventResult (
@SerializedName("result")
var result: Result?
): BaseData()
@Keep
data class Result(
@SerializedName("eventList")
var v2XEventList: List<V2XEvent>?
)

View File

@@ -6,27 +6,27 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_G
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.IMoGoVipSetListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallVipSetListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.LocationUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.zhjt.service_biz.BizConfig
import mogo.telematics.pad.MessagePad
import kotlin.math.abs
import kotlin.math.ceil
import kotlin.math.floor
@@ -44,7 +44,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
// 是否已进入到路口(停止线处)
private var isEnter = false
private var mLocation: MessagePad.GnssInfo? = null
private var mLocation: MogoLocation? = null
companion object {
@@ -84,7 +84,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
fun listenTrafficLight() {
CallerTrafficLightListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
CallVipSetListenerManager.addListener(TAG, this)
}
@@ -100,7 +100,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
// 路口100m闯红灯预警
mLocation?.let {
// 单位m/s
val speed = it.vehicleSpeed
val speed = it.gnssSpeed
// 车停止或者速度非常慢,可能返回负数或者很小的值,需要过滤
CallerLogger.d("$M_V2X$TAG", "speed is:$speed")
if (speed <= 2.5f) return// 小于等于9km/h不处理
@@ -218,11 +218,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
null,
true,
5000L
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts
)
}
}
@@ -258,11 +254,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
null,
true,
5000L
tts
)
}
}
@@ -274,10 +266,10 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
fun onDestroy() {
CallVipSetListenerManager.removeListener(TAG)
CallerTrafficLightListenerManager.removeListener(TAG)
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
}
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
gnssInfo?.let {
mLocation = it
}

View File

@@ -3,11 +3,12 @@ package com.mogo.eagle.function.biz.v2x.trafficlight.core
import android.content.Context
import android.os.Handler
import android.os.Looper
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
@@ -15,7 +16,6 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel
import mogo.telematics.pad.MessagePad
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
@@ -30,7 +30,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
private var mContext: Context? = null
private val trafficLightNetWorkModel = TrafficLightNetWorkModel()
private var mLocation: MessagePad.GnssInfo? = null
private var mLocation: MogoLocation? = null
private var roadIDResult: RoadIDResult? = null
private var trafficLightResult: TrafficLightResult? = null
@@ -41,7 +41,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
fun initServer(context: Context) {
mContext = context
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
mThreadHandler =
TrafficLightThreadHandler(Looper.getMainLooper(), {
//第一次查询路口时,如果红绿灯显示,则隐藏掉
@@ -75,7 +75,6 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
trafficLightNetWorkModel.requestTrafficLight(
it.latitude, it.longitude, it.heading, road, { result ->
trafficLightResult = result
// TrafficLightHMIManager.INSTANCE.updateTrafficLight(result)
CallerTrafficLightListenerManager.invokeTrafficLightStatus(result)
},
{ errorMsg ->
@@ -174,7 +173,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
trafficLightResult = null
}
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
gnssInfo?.let {
mLocation = it
checkOutOfRange()

View File

@@ -19,13 +19,12 @@ import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight
import com.mogo.eagle.core.data.trafficlight.isGreen
import com.mogo.eagle.core.data.trafficlight.isRed
import com.mogo.eagle.core.data.v2x.VipMessage
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallVipSetListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -211,15 +210,13 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
showWarning(
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.tts
)
} else {
showWarning(
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.tts
)
}
return@turnLightToGreen
@@ -230,8 +227,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
showWarning(
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试",
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts
)
return@turnLightToGreen
}
@@ -251,8 +247,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
showWarning(
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts
)
} else {
CallerLogger.d(
@@ -272,7 +267,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
v2xType: String,
alertContent: CharSequence,
ttsContent: String,
tag: String
) {
if (alertContent.toString().isEmpty() || ttsContent.isEmpty()) {
Log.d("MsgBox-VipCarManager", "alertContent或ttsContent为空!")
@@ -280,15 +274,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent))
)
CallerHmiManager.warningV2X(
v2xType, alertContent, ttsContent, tag,
object : IMoGoWarningStatusListener {
override fun onShow() {}
override fun onDismiss() {}
},
true,
5000L
)
CallerHmiManager.warningV2X(v2xType, alertContent, ttsContent)
}
fun destroy() {

View File

@@ -15,7 +15,7 @@ import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_DEFAULT
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VEHICLE_TEAM
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE
import com.mogo.eagle.core.function.api.chat.biz.IMType.*
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.chat.facade.analytics.ChatAnalyticsFacade
import com.mogo.eagle.core.function.chat.facade.audio.AudioFocusFacade
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
@@ -581,7 +581,7 @@ object MoGoChatFacade: IMoGoChatFacade {
}
//告之服务器给发送方下发接收通话消息
try {
val location = CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VOICE.type).also {
it.nickName = mySelf.get().name
it.headImgUrl = mySelf.get().icon
@@ -812,7 +812,7 @@ object MoGoChatFacade: IMoGoChatFacade {
}
val response = serverApi.inviteJoinVehicleTeam(CallRequestParam().also {
val user = mySelf.get()
val location = CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
it.snSender = mySn
it.snReceiver = sn
it.nickName = user.name
@@ -958,7 +958,7 @@ object MoGoChatFacade: IMoGoChatFacade {
}
//告之服务器给发送方下发接收通话消息
try {
val location = CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM.type).also {
it.nickName = mySelf.get().name
it.headImgUrl = mySelf.get().icon

View File

@@ -8,7 +8,7 @@ import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.chat.UserInfo
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.chat.facade.net.bean.*
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
@@ -69,7 +69,7 @@ internal class ChatServiceModel {
val map = hashMapOf<String, String>()
val sn = MoGoAiCloudClientConfig.getInstance().sn
val location = CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (location != null) {
params.lon = location.longitude
params.lat = location.latitude
@@ -103,7 +103,7 @@ internal class ChatServiceModel {
suspend fun requestRoomInfo(param: CallRequestParam): BaseResponse<RoomInfo> {
val map = hashMapOf<String, String>()
val location = CallerChassisLocationGCJ20ListenerManager.getChassisLocationGCJ02()
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (location != null) {
param.lat = location.latitude
param.lon = location.longitude

View File

@@ -57,6 +57,7 @@ dependencies {
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
implementation rootProject.ext.dependencies.amapnavi3dmap
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data

View File

@@ -4,6 +4,9 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider
import com.mogo.eagle.core.function.datacenter.location.MoGoLocationDispatcher
import com.mogo.eagle.core.function.datacenter.v2x.SpeedLimitDispatcher
import com.mogo.eagle.core.function.datacenter.v2x.TrafficLightDispatcher
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
class DataCenterProvider: IDataCenterProvider {
@@ -12,10 +15,16 @@ class DataCenterProvider: IDataCenterProvider {
get() = "DataCenterProvider"
override fun init(context: Context?) {
MoGoLocationDispatcher.initListener()
context?.let {
TrafficLightDispatcher.INSTANCE.initServer(it)
SpeedLimitDispatcher.INSTANCE.initLimit(it)
}
}
override fun onDestroy() {
TrafficLightDispatcher.INSTANCE.destroy()
SpeedLimitDispatcher.INSTANCE.destroy()
}
}

View File

@@ -21,7 +21,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LO
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
import com.mogo.eagle.core.function.datacenter.autopilot.adapter.MoGoAdasListenerImpl
import com.mogo.eagle.core.function.datacenter.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
@@ -52,6 +52,7 @@ import com.zhidao.support.adas.high.OnMultiDeviceListener
import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS
import com.zhidao.support.adas.high.common.CupidLogUtils
import com.zhidao.support.adas.high.common.MessageType
import com.zhidao.support.adas.high.common.MogoReport
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
@@ -67,8 +68,9 @@ import java.util.concurrent.TimeUnit
* @date 2021/9/22 8:43 下午
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotProvider :
IMoGoAutopilotProvider, IMoGoMapDataCollectProvider.OnMapCollectCmdListener,
class MoGoAutopilotControlProvider :
IMoGoAutopilotControlProvider,
IMoGoMapDataCollectProvider.OnMapCollectCmdListener,
IMoGoAutopilotCarConfigListener {
private val TAG = "MoGoAutoPilotProvider"
private var mContext: Context? = null
@@ -104,6 +106,7 @@ class MoGoAutopilotProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build()
@@ -194,6 +197,7 @@ class MoGoAutopilotProvider :
val options = AdasOptions
.Builder()
.setClient(true)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.build()
AdasManager.getInstance()
.create(options, MoGoAdasMsgConnectStatusListenerImpl())
@@ -221,6 +225,7 @@ class MoGoAutopilotProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)// 乘客端直连工控机改为false
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.build()
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
@@ -716,7 +721,20 @@ class MoGoAutopilotProvider :
}
override fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) {
Log.d(TAG, "---- sendSweeperFuTianTaskCmd ----")
AdasManager.getInstance().sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd)
}
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
if (isDrawPointCloud) {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
} else {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
}
}

View File

@@ -45,8 +45,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager.invokeChassisLocationGCJ02
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager.invokePNCActions
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
@@ -61,7 +59,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AutopilotAbility
import com.zhidao.support.adas.high.bean.AutopilotStatistics
import com.zhidao.support.adas.high.common.ProtocolStatus
import com.zhjt.service.chain.ChainLog
@@ -135,10 +132,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
clientPkFileName = "sn"
)
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) {
// WGS84坐标系高精度位置信息
invokeChassisLocationWGS84(gnssInfo)
// GCJ02高德坐标系位置信息
invokeChassisLocationGCJ02(gnssInfo)
CallerChassisGnssListenerManager.invokeChassisGnssListener(gnssInfo)
if (gnssInfo != null) {
if (1 == FunctionBuildConfig.gpsProvider) {
// 同步给MAP地图
@@ -614,8 +609,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
* 是否可以启动自动驾驶
* 使用方法查看app_ipc_monitoring/uiMainActivity/onAutopilotAbility
*/
override fun onAutopilotAbility(ability: AutopilotAbility?) {
invokeAutopilotAbility(ability)
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableAutopilotReason: String?) {
invokeAutopilotAbility(isAutopilotAbility, unableAutopilotReason)
}
/**

View File

@@ -5,7 +5,7 @@ import com.mogo.commons.debug.DebugConfig.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -52,13 +52,13 @@ class MoGoAdasMsgConnectStatusListenerImpl :
// 同步SN给工控机
syncBasicInfoToAutopilot()
//每次工控机连接成功后,需同步当前设置的美化模式状态
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
//当连接状态是关闭美化模式时,同步给工控机
if (!FunctionBuildConfig.isDemoMode) {
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
//每次工控机连接成功后,需同步当前设置的雨天模式状态
CallerAutoPilotManager.setRainMode(FunctionBuildConfig.isRainMode)
CallerAutoPilotControlManager.setRainMode(FunctionBuildConfig.isRainMode)
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接失败 reason:$reason")
if (connectStatus) {

View File

@@ -1,9 +1,9 @@
package com.mogo.eagle.core.function.datacenter.autopilot.server
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
/**
* @author xiaoyuzhou
@@ -26,6 +26,6 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
}
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
CallerAutoPilotManager.sendTrafficLightData(trafficLightResult)
CallerAutoPilotControlManager.sendTrafficLightData(trafficLightResult)
}
}

View File

@@ -8,9 +8,9 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -174,7 +174,7 @@ class TeleMsgHandler : IMsgHandler {
private fun queryCarConfig() {
invokeNettyConnResult("乘客屏请求司机屏向工控机查询配置信息")
CallerAutoPilotManager.getCarConfig()
CallerAutoPilotControlManager.getCarConfig()
}
override fun handleClientConn2Server(channel: Channel?) {

View File

@@ -1,16 +0,0 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.eagle.core.data.enums.DataSourceType
import mogo.telematics.pad.MessagePad
/**
* 位置回调监听
*/
interface IMoGoLocationListener {
/**
* 位置改变回调用
* @param gnssInfo 位置信息
* @param sourceType 数据来源
*/
fun onLocationChanged(gnssInfo: MessagePad.GnssInfo, sourceType: DataSourceType)
}

View File

@@ -0,0 +1,263 @@
package com.mogo.eagle.core.function.datacenter.location
import com.amap.api.location.AMapLocation
import com.amap.api.location.AMapLocationClient
import com.amap.api.location.AMapLocationClientOption
import com.amap.api.location.AMapLocationListener
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
* 融合定位服务,这里同时监听多来源的位置信息,并支持修改频率
*
* @author donghongyu
*/
object MoGoLocationDispatcher :
IMoGoChassisGnssListener,
IMoGoObuLocationWGS84Listener,
AMapLocationListener {
private val TAG = "MoGoLocationManager"
private var mCityCode: String? = null
private var mapLocation: AMapLocation? = null
/**
* 最后一次工控机GNSS返回更新的位置
*/
private var lastGnssLocation: MogoLocation = MogoLocation()
/**
* 最后一次OBU GNSS 返回更新的位置
*/
private var lastOBULocation: MogoLocation = MogoLocation()
/**
* 最后一次高德定位返回的位置信息
*/
private var lastGaoDeLocation: MogoLocation = MogoLocation()
fun initListener() {
// 高德SDK隐私政策
AMapLocationClient.updatePrivacyShow(Utils.getApp(), true, true)
AMapLocationClient.updatePrivacyAgree(Utils.getApp(), true)
try {
val mLocationClient = AMapLocationClient(Utils.getApp())
//初始化定位参数
//声明mLocationOption对象
val mLocationOption = AMapLocationClientOption()
//设置定位监听
mLocationClient.setLocationListener(this)
//设置定位模式为高精度模式Battery_Saving为低功耗模式Device_Sensors是仅设备模式
mLocationOption.locationMode = AMapLocationClientOption.AMapLocationMode.Hight_Accuracy
//设置定位间隔,单位毫秒,默认为2000ms
mLocationOption.interval = 1000
//设置定位参数
mLocationClient.setLocationOption(mLocationOption)
// 启动定位监听
mLocationClient.startLocation()
} catch (e: Exception) {
e.printStackTrace()
}
// 初始化监听订阅工控机位置信息
CallerChassisGnssListenerManager.addListener(TAG, this)
CallerObuLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) {
// 更新GNSS 信息
lastGnssLocation.gnssInfo = gnssInfo
lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
lastGnssLocation.cityName = it.city
lastGnssLocation.cityCode = it.cityCode
lastGnssLocation.provider = it.provider
lastGnssLocation.address = it.address
lastGnssLocation.district = it.district
lastGnssLocation.province = it.province
lastGnssLocation.adCode = it.adCode
lastGnssLocation.locationDetail = it.locationDetail
lastGnssLocation.poiName = it.poiName
lastGnssLocation.aoiName = it.aoiName
lastGnssLocation.street = it.street
lastGnssLocation.streetNum = it.streetNum
lastGnssLocation.description = it.description
lastGnssLocation.buildingId = it.buildingId
lastGnssLocation.floor = it.floor
lastGnssLocation.errorCode = it.errorCode
lastGnssLocation.errorInfo = it.errorInfo
}
//FileUtils.writeToFile("/sdcard/Download/", "location_wgs84.txt", "${gnssInfo.longitude},${gnssInfo.latitude}\n")
if (1 == FunctionBuildConfig.gpsProvider) {
// WGS84坐标系高精度位置信息
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
lastGnssLocation,
DataSourceType.TELEMATIC
)
// GCJ02高德坐标系位置信息
CallerChassisLocationGCJ02ListenerManager.invokeChassisLocationGCJ02(
lastGnssLocation,
DataSourceType.TELEMATIC
)
}
}
/**
* 高德地图位置改变回调
* @param aMapLocation 位置信息
*/
override fun onLocationChanged(aMapLocation: AMapLocation) {
mapLocation = aMapLocation
// 更新GNSS 信息
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
// 转换 GCJ02-->WGS84 坐标
val wgs84Location =
CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude)
lastGaoDeLocation.longitude = wgs84Location[0]
lastGaoDeLocation.latitude = wgs84Location[1]
lastGaoDeLocation.heading = it.bearing.toDouble()
lastGaoDeLocation.gnssSpeed = it.speed
lastGaoDeLocation.altitude = it.altitude
lastGaoDeLocation.satelliteTime = it.time
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
lastGaoDeLocation.cityName = it.city
lastGaoDeLocation.cityCode = it.cityCode
lastGaoDeLocation.provider = it.provider
lastGaoDeLocation.address = it.address
lastGaoDeLocation.district = it.district
lastGaoDeLocation.province = it.province
lastGaoDeLocation.adCode = it.adCode
lastGaoDeLocation.locationDetail = it.locationDetail
lastGaoDeLocation.poiName = it.poiName
lastGaoDeLocation.aoiName = it.aoiName
lastGaoDeLocation.street = it.street
lastGaoDeLocation.streetNum = it.streetNum
lastGaoDeLocation.description = it.description
lastGaoDeLocation.buildingId = it.buildingId
lastGaoDeLocation.floor = it.floor
lastGaoDeLocation.errorCode = it.errorCode
lastGaoDeLocation.errorInfo = it.errorInfo
}
// 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换
if (1 == FunctionBuildConfig.gpsProvider) {
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 30000) {
syncGaoDeLocation()
}
} else if (2 == FunctionBuildConfig.gpsProvider) {
if (TimeUtils.getNowMills() - lastOBULocation.lastReceiveTime > 30000) {
syncGaoDeLocation()
}
}
// 本地SP缓存城市Code
val cityCode = aMapLocation.cityCode
if (cityCode != null && cityCode.isNotEmpty()) {
mCityCode = aMapLocation.cityCode
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LATITUDE,
aMapLocation.latitude.toString()
)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LONGITUDE,
aMapLocation.longitude.toString()
)
}
}
/**
* 对外同步高德回掉的定位数据
*/
private fun syncGaoDeLocation() {
// WGS84坐标系高精度位置信息
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
lastGaoDeLocation,
DataSourceType.MAP
)
// GCJ02高德坐标系位置信息
CallerChassisLocationGCJ02ListenerManager.invokeChassisLocationGCJ02(
lastGaoDeLocation,
DataSourceType.MAP
)
}
/**
* OBU定位回调监听
*/
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
// 更新GNSS 信息
lastOBULocation.longitude = data.vehBasicsMsg.longitude
lastOBULocation.latitude = data.vehBasicsMsg.latitude
lastOBULocation.heading = data.vehBasicsMsg.heading
lastOBULocation.gnssSpeed = data.vehBasicsMsg.speed.toFloat()
lastOBULocation.altitude = data.vehBasicsMsg.elevation
lastOBULocation.satelliteTime = data.vehBasicsMsg.secMark
lastOBULocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let {
lastOBULocation.cityName = it.city
lastOBULocation.cityCode = it.cityCode
lastOBULocation.provider = it.provider
lastOBULocation.address = it.address
lastOBULocation.district = it.district
lastOBULocation.province = it.province
lastOBULocation.adCode = it.adCode
lastOBULocation.locationDetail = it.locationDetail
lastOBULocation.poiName = it.poiName
lastOBULocation.aoiName = it.aoiName
lastOBULocation.street = it.street
lastOBULocation.streetNum = it.streetNum
lastOBULocation.description = it.description
lastOBULocation.buildingId = it.buildingId
lastOBULocation.floor = it.floor
lastOBULocation.errorCode = it.errorCode
lastOBULocation.errorInfo = it.errorInfo
}
if (2 == FunctionBuildConfig.gpsProvider) {
// WGS84坐标系高精度位置信息
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
lastOBULocation,
DataSourceType.OBU
)
// GCJ02高德坐标系位置信息
CallerChassisLocationGCJ02ListenerManager.invokeChassisLocationGCJ02(
lastOBULocation,
DataSourceType.OBU
)
}
}
}

View File

@@ -1,71 +0,0 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
* 融合定位服务,这里同时监听多来源的位置信息,并支持修改频率
*
* @author donghongyu
*/
object MoGoLocationManager :
CallerBase<IMoGoLocationListener>(),
IMoGoChassisLocationWGS84Listener,
IMoGoObuLocationWGS84Listener {
private val TAG = "MoGoLocationManager"
init {
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
M_LISTENERS.forEach {
val tag = it.key
// 获取数据监听需要的HZ
val hz = M_LISTENERS_HZ[tag]
if (hz != null && hz > 0) {
val hzTime = (1.0 / hz.toDouble()) * 1000
// 获取最后一次回调的时间
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
if (hzLastSendTime != null && hzLastSendTime > 0) {
// 计算是否进入下一次回调周期
val nowTime = TimeUtils.getNowMills()
if (nowTime - hzLastSendTime > hzTime) {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
} else {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
} else {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
}
}
/**
* 向订阅位置信息的发出定位信息
*/
private fun syncLocationCallback(
tag: String,
it: Map.Entry<String, IMoGoLocationListener>,
gnssInfo: MessagePad.GnssInfo,
sourceType: DataSourceType
) {
// 记录最后一次回调时间
M_LISTENERS_HZ_LAST_SEND_TIME[tag] = TimeUtils.getNowMills()
val listener = it.value
listener.onLocationChanged(gnssInfo, sourceType)
}
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
}
}

View File

@@ -3,15 +3,20 @@
##### 位置回调融合工控机、OBU、高德地图
```kotlin
// 注册监听位置变换
MoGoLocationManager.addListener(Companion.functionName, object : IMoGoLocationListener {
override fun onLocationChanged(
gnssInfo: MessagePad.GnssInfo,
sourceType: DataSourceType
) {
// 注册监听位置变换,唯一标记要接受数据的HZ回掉监听
CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, 20,object :IMoGoChassisLocationWGS84Listener{
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
TODO("Not yet implemented")
}
})
// 设置数据回调频率单位HZ1HZ的周期是1秒50HZ的周期是1/50=0.02秒10HZ的周期是1/10=0.1秒。
MoGoLocationManager.setListenerHz(Companion.functionName, 20)
CallerChassisLocationWGS84ListenerManager.setListenerHz(Companion.functionName, 20)
// 注册监听位置变换,唯一标记要接受数据的HZ回掉监听
CallerChassisLocationGCJ20ListenerManager.addListener(Companion.functionName, 20,object :IMoGoChassisLocationGCJ02Listener{
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation) {
TODO("Not yet implemented")
}
})
```

View File

@@ -36,6 +36,7 @@ class MoGoObuProvider : IMoGoObuProvider {
//obu融合数据
MogoObuDcCombineManager.INSTANCE.init(context)
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
//bus乘客版本obu功能去掉
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)

View File

@@ -2,26 +2,30 @@ package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
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.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuConstants
import mogo.v2x.ObuWarningEvent
import mogo.v2x.ObuWarningEvent.*
import kotlin.math.roundToInt
@@ -31,7 +35,8 @@ import kotlin.math.roundToInt
* @since 2021/11/30
* @description 工控机融合数据
*/
class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener {
class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener,
IMoGoObuWarningRsmListener, IMoGoObuWarningMapListener, IMoGoObuWarningSpatListener {
companion object {
val INSTANCE: MogoObuDcCombineManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MogoObuDcCombineManager()
@@ -44,49 +49,40 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
fun init(context: Context) {
mContext = context
CallerObuDcCombineListenerManager.addListener(TAG, this)
CallerObuWarningRsiListenerManager.addListener(TAG, this)
CallerObuWarningRsmListenerManager.addListener(TAG, this)
CallerObuMapMathListenerManager.addListener(TAG, this)
CallerObuWarningSpatListenerManager.addListener(TAG, this)
}
fun destoryListener() {
CallerObuDcCombineListenerManager.removeListener(TAG)
CallerObuWarningRsiListenerManager.removeListener(TAG)
CallerObuWarningRsmListenerManager.removeListener(TAG)
CallerObuMapMathListenerManager.removeListener(TAG)
CallerObuWarningSpatListenerManager.removeListener(TAG)
}
/**
* 通过工控机中转的obu数据,包括rsirsmspat
*
*/
override fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMoGoObuDcCombineData obuWarningData = ${obuWarningData.toString()} ---obuWarningData.msgDataType = ${obuWarningData?.msgDataType}"
)
obuWarningData?.let {
when (obuWarningData.msgDataType) {
1 -> { //rsiEvent
onMogoObuDcRsiWarning(obuWarningData.rsiEvent)
}
2 -> { //RsmEvent
onMogoObuDcRsmWarning(obuWarningData.rsmEvent)
}
3 -> { //SpatEvent
onMogoObuDcSpatWarning(obuWarningData.spatEvent)
}
4 -> { //map
onMogoObuMapMath(obuWarningData.mapMatchData)
}
}
}
override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) {
onMogoObuDcRsiWarning(rsiWarningData)
}
override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) {
onMogoObuDcRsmWarning(rsmWarningData)
}
override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) {
onMogoObuDcSpatWarning(spatWarningData)
}
override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) {
onMogoObuMapMath(mapMatchData)
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
fun onMogoObuDcRsiWarning(rsiWarningData: RsiWarningData?) {
private fun onMogoObuDcRsiWarning(rsiWarningData: ObuScene.RsiWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsiWarning ------> ${rsiWarningData.toString()}"
@@ -98,7 +94,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
val status = rsiWarningData.status
val level = rsiWarningData.warningMsgList[0].warningLevel
val direction = getMessageDirection(rsiWarningData.warningMsgList[0].targetPosition)
CallerLogger.d("${M_OBU}${TAG}",
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuDcRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${rsiWarningData.warningMsgList[0].eventSerialNum} ---signSerialNum = ${rsiWarningData.warningMsgList[0].signSerialNum} --- direction = $direction -- targetPosition = ${rsiWarningData.warningMsgList[0].targetPosition}"
)
@@ -259,8 +256,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -276,16 +271,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
ttsContent, null, direction
)
// 更新数据,是否需要
@@ -301,9 +287,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
CallerHmiManager.disableWarningV2X((appId + direction.direction))
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
@@ -320,22 +304,22 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
/**
* RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo主车与弱势交通参与者之间的预警弱势交通参与者碰撞预警
*/
fun onMogoObuDcRsmWarning(rsmWarningData: RsmWarningData?) {
fun onMogoObuDcRsmWarning(rsmWarningData: ObuScene.RsmWarningData?) {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ------> ${rsmWarningData.toString()}"
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participantOfOne != null) {
if (rsmWarningData != null && rsmWarningData.participant != null) {
var v2xType = ""
if (rsmWarningData.participantOfOne.ptcType == 1) { //机动车
if (rsmWarningData.participant.ptcType == 1) { //机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 2) { //非机动车
} else if (rsmWarningData.participant.ptcType == 2) { //非机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 3) { //行人
} else if (rsmWarningData.participant.ptcType == 3) { //行人
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
@@ -346,25 +330,25 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participantOfOne.targetPosition) //TODO 只有一个
getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${rsmWarningData.warningMsg.warningDataList.get(0).status} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
"ObuDcCombineManager onObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${
rsmWarningData.warningMsg.warningDataList[0].status
} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList.get(0).status) {
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent
ttsContent,
)
).apply {
sourceType = DataSourceType.TELEMATIC
@@ -373,18 +357,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
ttsContent,
null,
direction
)
// 更新数据 TODO
@@ -401,7 +376,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
@@ -412,7 +387,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
@@ -425,8 +400,11 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
/**
* 红绿灯预警信息
*/
fun onMogoObuDcSpatWarning(spatWarningData: SpatWarningData?) {
CallerLogger.d("${M_OBU}${TAG}", "onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}")
fun onMogoObuDcSpatWarning(spatWarningData: ObuScene.SpatWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}"
)
handlerTrafficLight(
spatWarningData!!.warningType,
spatWarningData?.status,
@@ -437,23 +415,37 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
/**
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: MapMatchData?) {
CallerLogger.d("${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView)
if(HmiBuildConfig.isShowObuLimitSpeedView) {
fun onMogoObuMapMath(data: ObuScene.MapMatchData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView
)
if (HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}")
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${
Math.round(
(data.speedMaxLimit * 0.02 * 3.6)
)
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),DataSourceType.OBU)
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
DataSourceType.OBU
)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1 ,DataSourceType.OBU)
CallerLimitingVelocityListenerManager.invokeUnion(
-1,
DataSourceType.OBU
)
}
}
}
@@ -496,7 +488,11 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<ObuWarningEvent.SpatLight>) {
private fun handlerTrafficLight(
appId: Int,
status: Int,
lights: List<com.mogo.support.obu.ObuBase.SpatLight>
) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
@@ -514,15 +510,12 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
}
}
}
private var isRedLight = false
private var isGreenLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
@@ -532,7 +525,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<ObuWarningEvent.SpatLight>
lights: List<com.mogo.support.obu.ObuBase.SpatLight>
) {
var ttsContent = ""
var alertContent = ""
@@ -551,10 +544,14 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerLogger.d("${M_OBU}${TAG}","MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent ")
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -569,22 +566,32 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, null, true, 5000L)
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}")
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
)
val adviceSpeed =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
"${Math.round(currentLight.suggestMinSpeed * 3.6 * 0.02)} - ${
Math.round(
currentLight.suggestMaxSpeed * 3.6 * 0.02
)
}"
val adviceSpeedTts =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
"${Math.round(currentLight.suggestMinSpeed * 3.6 * 0.02)} - ${
Math.round(
currentLight.suggestMaxSpeed * 3.6 * 0.02
)
}"
ttsContent =
String.format(
@@ -596,7 +603,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed*3.6
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
@@ -610,15 +617,10 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
}
}
@@ -628,39 +630,38 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.BLACK, DataSourceType.TELEMATIC)
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.BLACK,
-1,
DataSourceType.TELEMATIC
)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.TELEMATIC)
val red = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownRed(red)
val red = (currentLight.countDown / 10).toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.RED,
red,
DataSourceType.TELEMATIC
)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.TELEMATIC)
val green = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownGreen(green)
val green = (currentLight.countDown / 10).toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.GREEN,
green,
DataSourceType.TELEMATIC
)
}
// 黄灯
7, 8 -> {
CallerHmiManager.disableWarningV2X(appId.toString())
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.TELEMATIC)
val yellow = currentLight.countDown / 10
CallerTrafficLightListenerManager.changeCountdownYellow(yellow)
val yellow = (currentLight.countDown / 10).toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.YELLOW,
yellow,
DataSourceType.TELEMATIC
)
}
}
}

View File

@@ -16,8 +16,9 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Defa
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
@@ -31,7 +32,6 @@ import com.mogo.support.obu.model.*
import com.mogo.support.obu.model.advance.SpatLight
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuOptions
import org.json.JSONObject
import kotlin.math.roundToInt
/**
@@ -107,45 +107,22 @@ class MogoPrivateObuNewManager private constructor() {
/**
* HV车辆基础信息 CvxHvCarIndInfo CvxHvInfoIndInfo
*/
override fun onMogoObuHvBasics(p0: MogoObuHvBasicsData?) {
if (p0 != null && p0.vehBasicsMsg != null) {
override fun onMogoObuHvBasics(mogoObuHvBasicsData: MogoObuHvBasicsData?) {
if (mogoObuHvBasicsData != null && mogoObuHvBasicsData.vehBasicsMsg != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuHvBasics lon = ${p0.vehBasicsMsg.longitude} --- lat = ${p0.vehBasicsMsg.latitude} ---speed = ${p0.vehBasicsMsg.speed} ---heading = ${p0.vehBasicsMsg.heading} --acceleration = ${p0.vehBasicsMsg.accFourAxes.accLat} --yawRate = ${p0.vehBasicsMsg.accFourAxes.accYaw}"
"onMogoObuHvBasics lon = ${mogoObuHvBasicsData.vehBasicsMsg.longitude} --- lat = ${mogoObuHvBasicsData.vehBasicsMsg.latitude} ---speed = ${mogoObuHvBasicsData.vehBasicsMsg.speed} ---heading = ${mogoObuHvBasicsData.vehBasicsMsg.heading} --acceleration = ${mogoObuHvBasicsData.vehBasicsMsg.accFourAxes.accLat} --yawRate = ${mogoObuHvBasicsData.vehBasicsMsg.accFourAxes.accYaw}"
)
val data = JSONObject()
try {
data.putOpt("lon", p0.vehBasicsMsg.longitude)
data.putOpt("lat", p0.vehBasicsMsg.latitude)
data.putOpt("speed", p0.vehBasicsMsg.speed)
data.putOpt("heading", p0.vehBasicsMsg.heading)
data.putOpt("acceleration", p0.vehBasicsMsg.accFourAxes.accLat)
data.putOpt("yawRate", p0.vehBasicsMsg.accFourAxes.accYaw)
try {
data.putOpt("systemTime", System.currentTimeMillis())
} catch (e: Exception) {
e.printStackTrace()
}
try {
data.putOpt("satelliteTime", System.currentTimeMillis())
} catch (e: Exception) {
e.printStackTrace()
}
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
if (2 == FunctionBuildConfig.gpsProvider) {
// 同步给MAP地图
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(data)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
System.currentTimeMillis() / 1000.0,
p0.vehBasicsMsg.longitude,
p0.vehBasicsMsg.latitude
)
}
} catch (e: Exception) {
e.printStackTrace()
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
if (2 == FunctionBuildConfig.gpsProvider) {
// 同步给MAP地图
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(mogoObuHvBasicsData)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
System.currentTimeMillis() / 1000.0,
mogoObuHvBasicsData.vehBasicsMsg.longitude,
mogoObuHvBasicsData.vehBasicsMsg.latitude
)
}
}
}
@@ -410,15 +387,7 @@ class MogoPrivateObuNewManager private constructor() {
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
null, direction
)
// 更新数据
@@ -554,8 +523,6 @@ class MogoPrivateObuNewManager private constructor() {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -573,17 +540,7 @@ class MogoPrivateObuNewManager private constructor() {
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
null, direction
)
}
@@ -592,7 +549,7 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
@@ -618,7 +575,7 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.ADD -> { // 添加
UiThreadHandler.post {
if (data.speedMaxLimit > 0) {
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 3.6).roundToInt(), DataSourceType.OBU
)
}
@@ -630,7 +587,7 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
CallerLimitingVelocityListenerManager.invokeUnion(
-1,
DataSourceType.OBU
)
@@ -844,7 +801,6 @@ private fun handleSdkObu(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
@@ -854,18 +810,12 @@ private fun handleSdkObu(
}
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(Default())
}
}
},
true,
5000L
}, direction
)
//显示警告红边
CallerHmiManager.showWarning(direction)
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
@@ -876,9 +826,7 @@ private fun handleSdkObu(
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction))
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
it.threatLevel = 0x01
@@ -910,10 +858,8 @@ private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerTrafficLightListenerManager.disableTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
isYellowLight = false
// lightCountDownRed = 1
// lightCountDownGreen = 1
// lightCountDownYellow = 1
@@ -921,16 +867,9 @@ private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>
}
}
private var isRedLight = false
private var isGreenLight = false
private var isYellowLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
// private var lightCountDownRed : Int = 1
// private var lightCountDownGreen : Int = 1
// private var lightCountDownYellow : Int = 1
/**
* 修改红绿灯
@@ -956,7 +895,6 @@ private fun changeTrafficLightStatus(
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
@@ -981,11 +919,7 @@ private fun changeTrafficLightStatus(
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
null,
true,
5000L
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
}
}
@@ -993,7 +927,6 @@ private fun changeTrafficLightStatus(
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
@@ -1034,15 +967,10 @@ private fun changeTrafficLightStatus(
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
}
}
@@ -1052,42 +980,38 @@ private fun changeTrafficLightStatus(
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.BLACK)
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.BLACK,
-1,
DataSourceType.OBU
)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
isYellowLight = false
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.RED)
val red = currentLight.countDown.toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.RED,
red,
DataSourceType.OBU
)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
isYellowLight = false
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.GREEN)
val green = currentLight.countDown.toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.GREEN,
green,
DataSourceType.OBU
)
}
// 黄灯
7, 8 -> {
if (!isYellowLight) {
isYellowLight = true
}
isRedLight = false
isGreenLight = false
CallerHmiManager.disableWarningV2X(appId.toString())
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.YELLOW)
val yellow = currentLight.countDown.toInt()
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
TrafficLightEnum.YELLOW,
yellow,
DataSourceType.OBU
)
}
}
}

View File

@@ -1,12 +1,9 @@
package com.mogo.eagle.function.biz.v2x.speedlimit
package com.mogo.eagle.core.function.datacenter.v2x
import android.content.Context
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.zhjt.service_biz.BizConfig
/**
* @author lixiaopeng
@@ -35,11 +32,12 @@ class SpeedLimitDispatcher : ILimitingVelocityListener {
* 地图限速数据
*/
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo arrow 重新考虑放的位置
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
override fun onUnion(limitingVelocity: Int, sourceType: DataSourceType) {
super.onUnion(limitingVelocity, sourceType)
when (sourceType) { // obu 优先级高于 map体现链路能力
DataSourceType.OBU -> {
hasObuStatus = limitingVelocity > 0
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)
@@ -47,7 +45,7 @@ class SpeedLimitDispatcher : ILimitingVelocityListener {
}
DataSourceType.MAP -> {
if (!hasObuStatus) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.function.biz.v2x.trafficlight.core
package com.mogo.eagle.core.function.datacenter.v2x
import android.content.Context
import android.os.Handler
@@ -6,12 +6,31 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
fun TrafficLightStatus.convert(): TrafficLightEnum {
return when {
this.isGreen() || this.isFlashGreen() -> TrafficLightEnum.GREEN
this.isYellow() -> TrafficLightEnum.YELLOW
this.isRed() -> TrafficLightEnum.RED
else -> TrafficLightEnum.BLACK
}
}
fun TrafficLight.convert(): TrafficLightEnum {
return when (this.state) {
TrafficLightOuterClass.LightState.STATE_GREEN -> TrafficLightEnum.GREEN
TrafficLightOuterClass.LightState.STATE_YELLOW -> TrafficLightEnum.YELLOW
TrafficLightOuterClass.LightState.STATE_RED -> TrafficLightEnum.RED
TrafficLightOuterClass.LightState.STATE_OFF -> TrafficLightEnum.BLACK
else -> TrafficLightEnum.BLACK
}
}
/**
* @author XuXinChao
* @description 对多个红绿灯信号来源进行统一调度AI云工控机OBU
@@ -38,7 +57,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
fun initServer(context: Context) {
mContext = context
//注册监听AI云获取红绿灯状态
//注册监听AI云.OBU路侧获取红绿灯状态
CallerTrafficLightListenerManager.addListener(TAG, this)
//注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
@@ -66,39 +85,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
} else {
when (light.state) {
TrafficLightOuterClass.LightState.STATE_RED -> {
//红灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.RED,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownRed(0)
}
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
//黄灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.YELLOW,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownYellow(0)
}
TrafficLightOuterClass.LightState.STATE_GREEN -> {
//绿灯
CallerTrafficLightListenerManager.showTrafficLight(
TrafficLightEnum.GREEN,
DataSourceType.TELEMATIC
)
CallerTrafficLightListenerManager.changeCountdownGreen(0)
}
TrafficLightOuterClass.LightState.STATE_OFF -> {
//黑灯,隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
}
else -> {}
}
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
}
}
}
}
@@ -109,8 +97,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
if (!hasObuLightStatus) {
updateTrafficLight(trafficLightResult)
hasAiLightStatus = true
updateTrafficLight(trafficLightResult)
}
}
@@ -140,10 +128,38 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
/**
* obu 红绿灯数据
*/
override fun onObuTrafficLightStatus(light: TrafficLightEnum) {
super.onObuTrafficLightStatus(light)
hasObuLightStatus = true
CallerTrafficLightListenerManager.showTrafficLight(light, DataSourceType.OBU)
override fun onTrafficLightPlusSource(
light: TrafficLightEnum,
remain: Int,
lightSource: DataSourceType
) {
super.onTrafficLightPlusSource(light, remain, lightSource)
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true //todo 会存在优先级高的数据没有回调,导致没有数据出现
}
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)
if (remain == -1) {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
return
}
when (light) {
TrafficLightEnum.GREEN -> {
CallerTrafficLightListenerManager.changeCountdownGreen(remain)
}
TrafficLightEnum.RED -> {
CallerTrafficLightListenerManager.changeCountdownRed(remain)
}
TrafficLightEnum.YELLOW -> {
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
}
TrafficLightEnum.BLACK -> {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
}
}
}
private fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
@@ -154,25 +170,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
} else {
it.remain
}
when {
it.isGreen() || it.isFlashGreen() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownGreen(remain)
}
it.isYellow() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
}
it.isRed() -> {
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.AICLOUD)
CallerTrafficLightListenerManager.changeCountdownRed(remain)
}
}
onTrafficLightPlusSource(it.convert(), remain, DataSourceType.AICLOUD)
}
}
fun destroy() {
//取消注册监听AI云获取红绿灯状态
//取消注册监听AI云.OBU,路侧获取红绿灯状态
CallerTrafficLightListenerManager.removeListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)

View File

@@ -13,7 +13,9 @@ import com.mogo.eagle.core.data.deva.scene.SceneModule
import com.mogo.eagle.core.data.deva.scene.SceneTAG
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
@@ -21,6 +23,8 @@ import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager
import com.zhjt.mogo_core_function_devatools.mofang.MoFangManager.Companion.moFangManager
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.report.IPCReportManager.Companion.iPCReportManager
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
import com.zhjt.mogo_core_function_devatools.status.StatusManager
@@ -55,6 +59,27 @@ class DevaToolsProvider : IDevaToolsProvider {
bindingCarManager.init(mContext!!)
}
override fun checkMonitorDb() {
mContext?.let {
Thread {
val limitId: Long = 50001
val file = it.getDatabasePath(MonitorDb.INTERNAL_DB_NAME)
try {
if (file != null && file.exists()) {
val cpuList = getDb(it).monitorDao().getAllCPUById(limitId)
val memList = getDb(it).monitorDao().getAllMemById(limitId)
// 大于5w条清除
if (cpuList.isNotEmpty() || memList.isNotEmpty()) {
it.deleteDatabase(MonitorDb.INTERNAL_DB_NAME)
}
}
} catch (e: Exception) {
CallerLogger.e(TAG, e.message)
}
}.start()
}
}
override fun startLogCatch() {
MogoLogCatchManager.startCatchLog()
}
@@ -148,6 +173,26 @@ class DevaToolsProvider : IDevaToolsProvider {
return EnvChangeManager.getEnvConfig()
}
override fun getEnvCityName(): String {
return EnvChangeManager.getCityName()
}
override fun getEnvNetMode(): String {
return EnvChangeManager.getNetMode()
}
override fun envConfigReset() {
EnvChangeManager.reset()
}
override fun envConfigChange(cityCode: String, netMode: Int) {
EnvChangeManager.changeTo(cityCode, netMode)
}
override fun dockerVersion(dockerVersion: String?) {
BadCaseConfig.dockerVersion = dockerVersion
}
override fun modifyCarInfo(callBack: (ModifyBindingcarInfo) -> Unit) {
bindingCarManager.modifyCarInfo(callBack)
}

View File

@@ -10,11 +10,12 @@ import android.widget.RadioButton
import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
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
@@ -27,7 +28,6 @@ import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import record_cache.RecordPanelOuterClass
import java.util.*
@@ -119,7 +119,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
// 添加 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
//开始录制AI数据采集Bag包
CallerAutoPilotManager.recordPackage(
CallerAutoPilotControlManager.recordPackage(
99,
Random(SystemClock.elapsedRealtime()).nextInt(),
20,
@@ -353,7 +353,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
fun closeWindow()
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
latitude = gnssInfo.latitude
longitude = gnssInfo.longitude
}

View File

@@ -11,7 +11,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import com.mogo.eagle.core.data.badcase.RecordTypeEntity
import com.mogo.eagle.core.data.badcase.TopicEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -206,7 +206,7 @@ internal class BadCaseConfigView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerAutopilotRecordListenerManager.addListener(TAG, this)
//获取数据采集录制模式配置列表
CallerAutoPilotManager.getBadCaseConfig(0, 0, listOf())
CallerAutoPilotControlManager.getBadCaseConfig(0, 0, listOf())
recordTypesList.add(RecordTypeEntity(0,"自定义", arrayListOf()))
}

View File

@@ -11,7 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.data.badcase.RecordCaseEntity;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.zhjt.mogo_core_function_devatools.R;
@@ -77,7 +77,7 @@ public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListen
super.onAttachedToWindow();
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
//获取数据采集录制模式配置列表
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(0, 0,new ArrayList<>());
CallerAutoPilotControlManager.INSTANCE.getBadCaseConfig(0, 0,new ArrayList<>());
}
@Override

View File

@@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.data.badcase.RecordTypeEntity;
import com.mogo.eagle.core.data.badcase.TopicEntity;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -69,7 +69,7 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
init();
initEvent();
//获取所有Topic
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(1, 0, new ArrayList<>());
CallerAutoPilotControlManager.INSTANCE.getBadCaseConfig(1, 0, new ArrayList<>());
if (recordType != null) {
tvCaseName.setText(recordType.getDesc());
if (recordType.getTopicsList().size() > 0) {
@@ -160,7 +160,7 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
});
tvSave.setOnClickListener(v -> {
if (recordType != null) {
Boolean success = CallerAutoPilotManager.INSTANCE.getBadCaseConfig(2, recordType.getId(), addTopicList);
Boolean success = CallerAutoPilotControlManager.INSTANCE.getBadCaseConfig(2, recordType.getId(), addTopicList);
if (Boolean.TRUE.equals(success)) {
ToastUtils.showShort("Topic设置成功");
if (recordType.getId() == 0) {

View File

@@ -14,11 +14,12 @@ import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
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
@@ -35,7 +36,6 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import record_cache.RecordPanelOuterClass
import java.io.File
import java.util.*
@@ -347,7 +347,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
mWindowManager!!.addView(mFloatLayout, mWindowParams)
//开启录包
if (recordCaseEntity != null) {
CallerAutoPilotManager.recordPackage(
CallerAutoPilotControlManager.recordPackage(
recordCaseEntity.caseId,
Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration,
@@ -355,7 +355,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
recordCaseEntity.topicList
)
} else {
CallerAutoPilotManager.recordPackage(
CallerAutoPilotControlManager.recordPackage(
BadCaseConfig.type, Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration
)
@@ -394,7 +394,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
fun closeWindow()
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
latitude = gnssInfo.latitude
longitude = gnssInfo.longitude
}

View File

@@ -15,6 +15,7 @@ import android.widget.TextView
import com.google.android.flexbox.FlexboxLayout
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
@@ -34,7 +35,6 @@ import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import me.jessyan.autosize.utils.AutoSizeUtils
import mogo.telematics.pad.MessagePad
import org.greenrobot.eventbus.EventBus
import java.io.File
@@ -380,9 +380,9 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
fun closeWindow()
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
latitude = gnssInfo?.latitude
longitude = gnssInfo?.longitude
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
latitude = gnssInfo.latitude
longitude = gnssInfo.longitude
}
}

View File

@@ -7,9 +7,9 @@ import com.mogo.eagle.core.data.bindingcar.BindingCarInfo
import com.mogo.eagle.core.data.bindingcar.BindingCarRequest
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingcarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingcarDialog
import com.mogo.eagle.core.function.call.map.CallerHDMapManager.changeCurrentIcon
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -79,8 +79,8 @@ class BindingCarNetWorkManager private constructor() {
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
updateCarVrIconRes(info.getData().brandId)
when (info.getData().compare) {
"0" -> showBindingcarDialog()
"3" -> showModifyBindingcarDialog()
"0" -> showBindingCarDialog()
"3" -> showModifyBindingCarDialog()
"null" -> TipToast.shortTip("当前工控机没有入库")
}
SharedPrefsMgr.getInstance(context!!).putString(
@@ -156,19 +156,19 @@ class BindingCarNetWorkManager private constructor() {
d(SceneConstant.M_BINDING + TAG, "updateCarVrIconRes : $brandId")
when (brandId) {
"1" -> {
changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
}
"2" -> {
changeCurrentIcon(R.raw.hq_h9)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.hq_h9)
HdMapBuildConfig.currentCarVrIconRes = R.raw.hq_h9
}
"3" -> {
changeCurrentIcon(R.raw.xiaobache)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
}
else -> {
changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
}
}

View File

@@ -2,12 +2,12 @@ package com.zhjt.mogo_core_function_devatools.env
import android.content.Context.MODE_PRIVATE
import android.os.Process
import com.mogo.commons.constants.*
import com.mogo.commons.debug.*
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.utilcode.mogo.storage.*
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.Utils
object EnvChangeManager {
@@ -34,7 +34,7 @@ object EnvChangeManager {
fun getCityName(): String {
val cache = getConfig()
return if (cache == null) {
when(CallerMapLocationListenerManager.getCurrentLocation()?.cityCode ?: SharedPrefsMgr.getInstance(Utils.getApp()).getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010") {
when(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.cityCode ?: SharedPrefsMgr.getInstance(Utils.getApp()).getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010") {
"010" -> "北京"
"0734" -> "衡阳"
else -> "未知"

View File

@@ -15,7 +15,7 @@ import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FULL_LOG
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapDevaProvider
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -220,7 +220,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
Logger.init(LogLevel.DEBUG)
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowNetDebugLog = true
CallerAutoPilotManager.setEnableLog(true)
CallerAutoPilotControlManager.setEnableLog(true)
}
/**
@@ -230,7 +230,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF)
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowNetDebugLog = false
CallerAutoPilotManager.setEnableLog(false)
CallerAutoPilotControlManager.setEnableLog(false)
}
override fun onError(errorCount: Int) {

View File

@@ -42,7 +42,7 @@ internal class CanImpl(ctx: Context) :
private val state: AtomicInteger by lazy { AtomicInteger(Int.MIN_VALUE) }
override fun onCreate() {
send(CanStatus(CallerAutoPilotManager.isConnected()))
send(CanStatus(CallerAutoPilotControlManager.isConnected()))
CallerChassisAccStateListenerManager.addListener(TAG, this)
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
@@ -61,7 +61,7 @@ internal class CanImpl(ctx: Context) :
private fun isCanEnabled(): Boolean {
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
return CallerAutoPilotManager.isConnected() && code != "EHW_CAN" && (state.get() == Int.MIN_VALUE || state.get() == 0)
return CallerAutoPilotControlManager.isConnected() && code != "EHW_CAN" && (state.get() == Int.MIN_VALUE || state.get() == 0)
}

View File

@@ -28,7 +28,7 @@ internal class IpcImpl(ctx: Context): IFlow<IpcStatus>(ctx), IMoGoAutopilotStatu
}
private fun checkAndSend() {
send(IpcStatus(CallerAutoPilotManager.isConnected()))
send(IpcStatus(CallerAutoPilotControlManager.isConnected()))
}
override fun onDestroy() {

View File

@@ -2,9 +2,10 @@ package com.zhjt.mogo_core_function_devatools.status.flow.rtk
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.utilcode.mogo.logger.CallerLogger
@@ -15,7 +16,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad.GnssInfo
import system_master.SystemStatusInfo.HealthInfo
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.AtomicBoolean
@@ -42,7 +42,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
CallerLogger.d("$M_DEVA$TAG", "-- onCreate --")
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
if (CallerAutoPilotManager.isConnected()) {
if (CallerAutoPilotControlManager.isConnected()) {
check()
}
}
@@ -53,7 +53,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
}
check?.takeIf { it.isActive }?.cancel()
launch(Dispatchers.Unconfined) {
CallerAutoPilotManager.sendStatusQueryReq()
CallerAutoPilotControlManager.sendStatusQueryReq()
delay(5000)
isOldVersion.set(true)
}.also {
@@ -74,18 +74,18 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
super.onAutopilotIpcConnectStatusChanged(status, reason)
if (!CallerAutoPilotManager.isConnected()) {
if (!CallerAutoPilotControlManager.isConnected()) {
CallerLogger.d("$M_DEVA$TAG", "工控机断开了....")
healthInfo.set(null)
send(RTKStatus("", -1))
}
if (CallerAutoPilotManager.isConnected() && check == null && !isOldVersion.get()) {
if (CallerAutoPilotControlManager.isConnected() && check == null && !isOldVersion.get()) {
check()
}
}
override fun onChassisLocationWGS84(gnssInfo: GnssInfo) {
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (isOldVersion.get()) {
if (isRTKEnabled()) {
send(RTKStatus("RTK", 0))
@@ -103,7 +103,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
private fun isRTKEnabled(): Boolean {
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
val gnssInfo = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
return CallerAutoPilotManager.isConnected() && (
return CallerAutoPilotControlManager.isConnected() && (
code != "EHW_RTK" &&
code != "EHW_GNSS" &&
code != "ESYS_RTK_STATUS_FAULT" &&

View File

@@ -40,7 +40,7 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
super.onAutopilotIpcConnectStatusChanged(status, reason)
if (!CallerAutoPilotManager.isConnected()) {
if (!CallerAutoPilotControlManager.isConnected()) {
old = UNKNOWN
send(TracingStatus(UNKNOWN))
}

View File

@@ -19,7 +19,7 @@ internal class StatusModel : ViewModel() {
const val TAG = "StatusModel"
val DEFAULTS = Pair(null, ArrayList<Status>().also {
it += IpcStatus(CallerAutoPilotManager.isConnected())
it += IpcStatus(CallerAutoPilotControlManager.isConnected())
it += CanStatus(false)
it += TracingStatus(UNKNOWN)
it += RTKStatus("", -1)

View File

@@ -7,7 +7,7 @@ import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -51,7 +51,7 @@ object SyncConfig {
else -> {
}
}
AppConfigInfo.teleTimeStamp = CallerAutoPilotManager.getTeleTimeStamp()
AppConfigInfo.teleTimeStamp = CallerAutoPilotControlManager.getTeleTimeStamp()
logOutConfig(AppConfigInfo)
}

View File

@@ -78,39 +78,25 @@ dependencies {
implementation rootProject.ext.dependencies.koomnative
implementation rootProject.ext.dependencies.koomxhook
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.mogoaicloudservicesdk
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.crashreportupgrade
api rootProject.ext.dependencies.mogo_core_res
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_utils
api rootProject.ext.dependencies.mogo_core_network
api rootProject.ext.dependencies.mogo_core_function_map
api rootProject.ext.dependencies.mogo_core_function_v2x
api rootProject.ext.dependencies.mogo_core_function_devatools
api rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:map-usbcamera')
compileOnly rootProject.ext.dependencies.mogocommons
compileOnly rootProject.ext.dependencies.mogo_core_res
compileOnly rootProject.ext.dependencies.mogo_core_utils
compileOnly rootProject.ext.dependencies.mogo_core_function_map
compileOnly rootProject.ext.dependencies.mogo_core_function_devatools
compileOnly rootProject.ext.dependencies.mogo_core_function_datacenter
compileOnly rootProject.ext.dependencies.mogo_core_function_call
compileOnly project(':libraries:mogo-adas')
} else {
api project(':foudations:mogo-aicloud-services-sdk')
api project(':foudations:mogo-commons')
api project(':test:crashreport-upgrade')
api project(':test:crashreport-apmbyte')
api project(':core:mogo-core-res')
api project(':core:mogo-core-data')
api project(':core:mogo-core-utils')
api project(':core:function-impl:mogo-core-function-map')
api project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-devatools')
api project(':core:function-impl:mogo-core-function-chat')
api project(':core:function-impl:mogo-core-function-datacenter')
api project(':core:function-impl:mogo-core-function-biz')
api project(':core:mogo-core-function-call')
api project(':libraries:mogo-adas')
api project(':libraries:map-usbcamera')
compileOnly project(':core:function-impl:mogo-core-function-datacenter')
compileOnly project(':foudations:mogo-commons')
compileOnly project(':core:mogo-core-res')
compileOnly project(':core:mogo-core-utils')
compileOnly project(':core:mogo-core-function-call')
compileOnly project(':libraries:mogo-adas')
}
}

View File

@@ -157,14 +157,6 @@
</intent-filter>
</receiver>
<!--转向灯和刹车-->
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.TurnLightBroadcastReceiver">
<intent-filter>
<action android:name="com.hmi.turnlight" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!--绑定车辆-->
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.BindingcarBroadcastReceiver">
<intent-filter>

View File

@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingcarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingcarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
/**
* 绑定车辆
@@ -31,9 +31,9 @@ class BindingcarBroadcastReceiver : BroadcastReceiver() {
type: Int
) {
if (type == 1) {
showBindingcarDialog()
showBindingCarDialog()
} else if (type == 2) {
showModifyBindingcarDialog()
showModifyBindingCarDialog()
}
}
}

View File

@@ -1,41 +0,0 @@
package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight
/**
* 转向灯,刹车
*
* @author lixiaopeng
*/
class TurnLightBroadcastReceiver : BroadcastReceiver() {
companion object {
private const val TAG = "TurnLightBroadcastReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
try {
val type = intent.getIntExtra("type", 0)
val lightInt = intent.getIntExtra("light", 0)
showTurnLight(type, lightInt)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun showTurnLight( //type 1,转向灯2刹车
type: Int,
lightInt: Int
) {
if (type == 1) {
showTurnLight(lightInt) //设置转向灯
} else if (type == 2) {
showBrakeLight(lightInt) //设置刹车信息
}
}
}

View File

@@ -7,7 +7,7 @@ import android.view.View
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
@@ -61,7 +61,7 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
* @param limitingVelocitySpeed 限速速度
*/
private fun dispatchShowWaring(limitingVelocitySpeed: Int) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(limitingVelocitySpeed,DataSourceType.MAP)
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(limitingVelocitySpeed,DataSourceType.MAP)
}
/**

View File

@@ -5,7 +5,7 @@ import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.WaringConst
/**

View File

@@ -14,7 +14,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
/**
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框
@@ -47,7 +47,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
)
if (v2xIsShow) {
// 分发场景
dispatchShowWaring(v2xType, alertContent, ttsContent, tag)
dispatchShowWaring(v2xType, alertContent, ttsContent)
} else {
dispatchCloseWaring(tag)
}
@@ -75,10 +75,9 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
v2xType: Int,
alertContent: String?,
ttsContent: String?,
tag: String?
) {
if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(1,DataSourceType.MAP)
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(1,DataSourceType.MAP)
}
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-V2XWarningBR", "alertContent或ttsContent为空!")
@@ -90,7 +89,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
)
)
//预留调试入口
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent,
tag, null, true, 5000L)
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent)
}
}

View File

@@ -1,13 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui
import com.mogo.commons.mvp.Presenter
/**
* @author xiaoyuzhou
* @date 2021/8/3 3:55 下午
*/
class HmiPresenter(view: MoGoHmiContract.View?) :
Presenter<MoGoHmiContract.View?>(view) {
}

View File

@@ -1,19 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui
import com.mogo.commons.mvp.IView
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
/**
*@author xiaoyuzhou
*@date 2021/8/4 3:38 下午
*/
interface MoGoHmiContract {
interface View : IView {
}
}

View File

@@ -1,641 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.commons.mvp.BaseFragment
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ToBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.bindingcar.UpgradeAppDialog
import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog
import com.mogo.eagle.core.function.hmi.ui.dispatch.DispatchDialogManager
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.main.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
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.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.service_biz.BizConfig
import kotlinx.android.synthetic.main.fragment_hmi.*
import kotlinx.coroutines.*
import java.util.concurrent.atomic.AtomicReference
/**
* @author xiaoyuzhou
* @date 2021/8/3 2:40 下午
* 预警图层
*/
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
IMoGoHmiProvider,
MoGoHmiContract.View {
companion object {
private const val TAG = "MoGoHmiFragment"
}
private val lastSpeakJob by lazy { AtomicReference<Job>() }
private var lastShowV2XJob: Job? = null
private var showingV2XTip: IReminder? = null
override fun initViews() {
}
/**
* ok
* 工控机重启返回结果
* @param code
* @param msg
*/
override fun showDockerRebootResult(code: Int, msg: String) {
ThreadUtils.runOnUiThread {
if (code >= -1) {
//重启成功
ToastUtils.showShort("重启成功")
} else {
//重启失败
msg.let {
ToastUtils.showShort(it)
}
}
}
}
/**
* ok
* 展示工控机监控上报数据
* @param errorReportList 错误级别上报数据列表
* @param warningReportList 提醒级别上报数据列表
* @param reportLevel 1:error级别 2:warning级别
*/
override fun showIPCReportWindow(
errorReportList: ArrayList<ReportEntity>,
warningReportList: ArrayList<ReportEntity>,
reportLevel: Int
) {
ThreadUtils.runOnUiThread {
if (reportLevel == 1) {
IPCReportWindow.show(
requireContext(),
errorReportList,
warningReportList,
reportLevel
)
}
}
}
override fun setStatusBarDarkOrLight(light: Boolean) {
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG, light)
}
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarRightView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarLeftView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(
StatusBarView.TAG,
insert,
tag,
progress
)
}
override fun updateMfStatus(tag: String, status: Boolean) {
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
}
override fun getLayoutId(): Int {
return R.layout.fragment_hmi
}
override fun getTagName(): String {
return TAG
}
override fun createPresenter(): HmiPresenter {
return HmiPresenter(this)
}
override fun displayEffects() {
DisplayEffectsHelper.getInstance().display()
}
/** todo----------------------------------------------- **/
/**
* 不展示顶部弹窗,其它保留
*/
@Synchronized
override fun warningV2X(
v2xType: String,
alertContent: CharSequence?,
ttsContent: String?,
tag: String?,
listener: IMoGoWarningStatusListener?,
playTts: Boolean,
expireTime: Long
) {
val playTTS =
playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
activity?.let {
val warningContent = alertContent
?: EventTypeEnumNew.getWarningContent(v2xType)
//占道施工预警
if (v2xType == "10006" || v2xType == "100061") {
val currentTime = System.currentTimeMillis() / 1000
val oldTime =
context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) }
if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒
context?.let { it ->
SharedPrefsMgr.getInstance(it)
.putLong("roadwork", System.currentTimeMillis() / 1000)
}
CallerAutoPilotManager.sendTripInfo(5, "", "", "", false)
}
}
if (warningContent.isEmpty()) {
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
return
}
listener?.onShow()
CallerLogger.d(
"$M_HMI$TAG",
"--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime"
)
lastShowV2XJob?.safeCancel()
lifecycleScope.launch {
delay(expireTime)
}.also { itx ->
lastShowV2XJob = itx
}.invokeOnCompletion { _ ->
listener?.onDismiss()
showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
val last = lastSpeakJob.get()
Log.d("CODE", "---- 0 ------: last: $last")
if (last != null && !last.isCompleted) {
Log.d("CODE", "---- 1 ------")
return
}
lifecycleScope.launch(Dispatchers.Default) {
Log.d("CODE", "---- 2 ------")
speak(it, ttsContent)
Log.d("CODE", "---- 3 ------")
}.also { itx ->
lastSpeakJob.set(itx)
}
}
}
}
private suspend fun speak(ctx: Context, text: String) = suspendCancellableCoroutine<Unit> {
try {
val voiceCallback = object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
super.onSpeakEnd(speakText)
it.resumeWith(Result.success(Unit))
}
override fun onSpeakError(speakText: String?, errorMsg: String?) {
super.onSpeakError(speakText, errorMsg)
it.resumeWith(Result.success(Unit))
}
}
it.invokeOnCancellation {
AIAssist.getInstance(ctx).stopSpeakTts(text)
}
AIAssist.getInstance(ctx).speakTTSVoiceWithLevel(text, AIAssist.LEVEL2, voiceCallback)
} catch (t: Throwable) {
it.resumeWith(Result.success(Unit))
CallerLogger.d("$M_HMI$TAG", t.message)
}
}
/**
* 关闭指定floatTag 的 VR下V2X预警弹窗
* @param tag 弹窗标识
*/
override fun disableWarningV2X(tag: String?) {
activity?.let {
WarningFloat.dismiss(tag)
}
CallerLogger.d("$M_HMI$TAG", "--- disableWarningV2X ---")
lifecycleScope.launch {
showingV2XTip?.takeIf { it.isShowing() }?.also { it.hide() }
}
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
*/
override fun showWarning(direction: WarningDirectionEnum) {
CallerLogger.d(TAG, "showWarning====")
flV2XWarningView?.showWarning(direction)
if (flV2XWarningView != null) {
flicker(flV2XWarningView)
}
}
/**
* 闪动动画
*/
fun flicker(view: View) {
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
view.startAnimation(alphaAnimation)
}
fun clearAnimation(view: View) {
view.clearAnimation()
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
* @param closeTime 倒计时
*/
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
flV2XWarningView?.showWarning(direction, closeTime)
flicker(flV2XWarningView)
}
override fun dismissWarning(direction: WarningDirectionEnum) {
flV2XWarningView?.dismissWarning(direction)
clearAnimation(flV2XWarningView)
}
/** todo----------------------------------------------- **/
/**
* ok
*/
override fun showDispatchDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
context?.let {
DispatchDialogManager.getInstance(it).showDialog(msgData)
}
}
/**
* ok
*/
override fun dismissDispatchDialog() {
context?.let {
DispatchDialogManager.getInstance(it).releaseDialog()
}
}
/**
* ok
* 展示云公告交警详情
* @param trafficStylePushData
*/
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) {
if (trafficStylePushData == null) {
return
}
ThreadUtils.runOnUiThread {
context?.let {
NoticeTrafficDialog.show(it, trafficStylePushData)
}
}
}
/**
* ok
* 展示云公告详情
*/
override fun showNoticeNormalData(normalData: NoticeNormalData?) {
if (normalData == null) {
return
}
ThreadUtils.runOnUiThread {
context?.let {
NoticeCheckDialog.show(it, normalData)
}
}
}
/**
* ok
*/
override fun startRoadCameraLive(flvUrl: String) {
cameraLiveView.startRoadCameraLive(flvUrl)
}
/**
* ok
*/
override fun showNoSignView() {
cameraLiveView.showNoSignView()
}
/**
* ok
*/
override fun showToolsView() {
toolsView.showToolsFloat(context)
}
/**
* ok
*/
override fun hideToolsView() {
toolsView.dismiss()
}
/**
* ok
*/
@BizConfig(V2I, "", BIZ_RTS)
override fun showVideoDialog(infList: List<Infrastructure>) {
ThreadUtils.runOnUiThread {
context?.let {
RoadVideoDialog.show(it, infList)
}
}
}
/** todo----------------------------------------------- **/
private var isLeftLight: Boolean = false
private var isRightLight: Boolean = false
private var isDisappare: Boolean = false
@Volatile
private var isVisualAngleChanged = false
/**
* 显示转向灯效果 if (HmiBuildConfig.isShowBadCaseView) {
*/
override fun showTurnLight(light: Int) {
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight"
)
ThreadUtils.runOnUiThread {
if (light == 1 || light == 2) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
CallerVisualAngleManager.changeVisualAngle(Turning(true))
}
} else {
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
}
if (light == 1) { //左转灯
if (!isLeftLight) {
isLeftLight = true
isRightLight = false
isDisappare = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light = 1"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
}
} else if (light == 2) { //右转灯
if (!isRightLight) {
isRightLight = true
isLeftLight = false
isDisappare = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light = 2"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
} else {
if (!isDisappare) { //默认 不亮灯
isDisappare = true
isLeftLight = false
isRightLight = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"TurnLight"}",
"---showTurnLight ---light other"
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
}
}
private var isBrake: Boolean = false
/**
* 显示刹车效果
*/
override fun showBrakeLight(light: Int) {
ThreadUtils.runOnUiThread {
if (light == 1) { //刹车灯亮
if (!isBrake) {
isBrake = true
CallerLogger.d(
"${SceneConstant.M_DEVA}${"BrakeLight"}",
" showBrakeLight light = 1 "
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(0, 500)
}
} else {
if (isBrake) {//默认 不亮灯
isBrake = false
CallerLogger.d(
"${SceneConstant.M_DEVA}${"BrakeLight"}",
" showBrakeLight light != 1 "
)
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
//brakeView.setBrakeLight(light)
}
}
/** todo----------------------------------------------- **/
/**
* ok
*/
override fun showToBindingcarDialog() {
if (ContextHolderUtil.getContext() != null) {
ToBindingCarDialog.show(ContextHolderUtil.getContext())
}
}
/**
* ok
*/
override fun showModifyBindingcarDialog() {
if (ContextHolderUtil.getContext() != null) {
ModifyBindingCarDialog.show(ContextHolderUtil.getContext())
}
}
/**
* ok
* 升级app弹框
*/
override fun showUpgradeDialog(
name: String,
url: String,
title: String,
content: String,
installType: String
) {
if (ContextHolderUtil.getContext() != null) {
UpgradeAppDialog.show(
ContextHolderUtil.getContext(),
name,
url,
title,
content,
installType
)
}
}
/**
* ok
* 工控机镜像升级确认窗
* @param images 镜像列表
* @param padSn SN
* @param releaseId 任务ID
*/
override fun showAdUpgradeDialog(images: List<String>, padSn: String, releaseId: String) {
ThreadUtils.runOnUiThread {
if (ContextHolderUtil.getContext() != null) {
AdUpgradeDialog.show(ContextHolderUtil.getContext(), images, padSn, releaseId)
}
}
}
/**
* ok
*/
override fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
ThreadUtils.runOnUiThread {
toolsView.showAdUpgradeStatus(ipcUpgradeStateInfo)
}
}
override fun setSnBinding(isOpen: Boolean) {
HmiBuildConfig.isShowSnBindingView = isOpen
}
override fun setObuWeaknessTraffic(isOpen: Boolean) {
HmiBuildConfig.isShowObuWeaknessTrafficView = isOpen
}
override fun setCloudWeaknessTraffic(isOpen: Boolean) {
HmiBuildConfig.isShowCloudWeaknessTrafficView = isOpen
}
override fun showSmallFragment() {
// 加载全览模式图层
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
.navigation() as BaseFragment
activity?.supportFragmentManager?.beginTransaction()
?.setCustomAnimations(R.anim.slide_in, R.anim.fade_out)?.apply {
if (!fragmentOverview.isAdded) {
add(
R.id.module_main_id_smp_fragment,
fragmentOverview,
fragmentOverview.tagName
)
} else {
show(fragmentOverview)
}.commitAllowingStateLoss()
}
CallerDevaToolsManager.hideStatusBar()
}
override fun hideSmallFragment() {
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
.navigation() as BaseFragment
activity?.supportFragmentManager?.beginTransaction()
?.setCustomAnimations(R.anim.slide_in, R.anim.fade_out)?.apply {
if (fragmentOverview.isVisible) {
hide(fragmentOverview)
}
}
?.commitAllowingStateLoss()
}
override fun onDestroy() {
super.onDestroy()
CallerLogger.d("$M_HMI$TAG", "onDestroy")
}
}

View File

@@ -0,0 +1,290 @@
package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.text.TextUtils
import android.view.ViewGroup
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_FRAGMENT_HMI
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager
import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog
import com.mogo.eagle.core.function.hmi.ui.notice.DispatchDialogManager
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
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.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.zhjt.service_biz.BizConfig
import kotlinx.coroutines.*
import java.util.concurrent.atomic.AtomicReference
/**
* @author xiaoyuzhou
* @date 2021/8/3 2:40 下午
* 预警图层
*/
@Route(path = PATH_FRAGMENT_HMI)
class MoGoHmiProvider : IMoGoHmiProvider {
companion object {
private const val TAG = "MoGoHmiProvider"
}
private val lastSpeakJob by lazy { AtomicReference<Job>() }
private var lastShowV2XJob: Job? = null
private var context: Context? = null
override fun init(context: Context?) {
this.context = context
}
override fun setStatusBarDarkOrLight(light: Boolean) {
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG, light)
}
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarRightView(
StatusBarView.TAG, insert, tag, viewGroup
)
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarLeftView(
StatusBarView.TAG, insert, tag, viewGroup
)
}
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(
StatusBarView.TAG, insert, tag, progress
)
}
override fun updateMfStatus(tag: String, status: Boolean) {
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
}
/**
* 不展示顶部弹窗,其它保留
*/
@Synchronized
override fun warningV2X(
v2xType: String,
alertContent: CharSequence?,
ttsContent: String?,
listener: IMoGoWarningStatusListener?,
direction: WarningDirectionEnum,
expireTime: Long
) {
val playTTS = !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
context?.let {
val warningContent = alertContent ?: EventTypeEnumNew.getWarningContent(v2xType)
if (warningContent.isEmpty()) {
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
return
}
listener?.onShow()
CallerV2XWarningListenerManager.show(v2xType, direction, expireTime)
CallerLogger.d(
"$M_HMI$TAG",
"--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime"
)
lastShowV2XJob?.safeCancel()
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
delay(expireTime)
}.also { itx ->
lastShowV2XJob = itx
}.invokeOnCompletion {
listener?.onDismiss()
CallerV2XWarningListenerManager.dismiss()
}
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
val last = lastSpeakJob.get()
if (last != null && !last.isCompleted) {
return
}
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
speak(it, ttsContent)
}.also { itx ->
lastSpeakJob.set(itx)
}
}
}
}
private suspend fun speak(ctx: Context, text: String) = suspendCancellableCoroutine<Unit> {
try {
val voiceCallback = object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
super.onSpeakEnd(speakText)
it.resumeWith(Result.success(Unit))
}
override fun onSpeakError(speakText: String?, errorMsg: String?) {
super.onSpeakError(speakText, errorMsg)
it.resumeWith(Result.success(Unit))
}
}
it.invokeOnCancellation {
AIAssist.getInstance(ctx).stopSpeakTts(text)
}
AIAssist.getInstance(ctx).speakTTSVoiceWithLevel(text, AIAssist.LEVEL2, voiceCallback)
} catch (t: Throwable) {
it.resumeWith(Result.success(Unit))
CallerLogger.w("$M_HMI$TAG", t.message)
}
}
override fun showWarning(v2xType: String, direction: WarningDirectionEnum, expireTime: Long) {
CallerV2XWarningListenerManager.show(v2xType, direction, expireTime)
}
override fun dismissWarning(direction: WarningDirectionEnum) {
CallerV2XWarningListenerManager.dismiss(direction)
}
override fun showDispatchDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
ThreadUtils.runOnUiThread {
context?.let {
DispatchDialogManager.getInstance(it).showDialog(msgData)
}
}
}
override fun dismissDispatchDialog() {
ThreadUtils.runOnUiThread {
context?.let {
DispatchDialogManager.getInstance(it).releaseDialog()
}
}
}
override fun showNoticeForTrafficWithData(pushData: NoticeTrafficStylePushData?) {
pushData?.let {
ThreadUtils.runOnUiThread {
context?.let { it ->
NoticeTrafficDialog.show(it, pushData)
}
}
}
}
override fun showNoticeNormalData(normalData: NoticeNormalData?) {
normalData?.let {
ThreadUtils.runOnUiThread {
context?.let { it ->
NoticeCheckDialog.show(it, normalData)
}
}
}
}
override fun startRoadCameraLive(flvUrl: String) {
cameraLiveView.startRoadCameraLive(flvUrl)
}
override fun showNoSignView() {
cameraLiveView.showNoSignView()
}
override fun showToolsView() {
toolsView.showToolsFloat(context)
}
override fun hideToolsView() {
toolsView.dismiss()
}
@BizConfig(V2I, "", BIZ_RTS)
override fun showVideoDialog(infList: List<Infrastructure>) {
ThreadUtils.runOnUiThread {
context?.let {
RoadVideoDialog.show(it, infList)
}
}
}
override fun showToBindingCarDialog() {
if (context != null) {
ToBindingCarDialog.show(context)
}
}
override fun showModifyBindingCarDialog() {
if (context != null) {
ModifyBindingCarDialog.show(context)
}
}
override fun showIPCReportWindow(
errorReportList: ArrayList<ReportEntity>,
warningReportList: ArrayList<ReportEntity>,
reportLevel: Int
) {
ThreadUtils.runOnUiThread {
context?.let {
if (reportLevel == 1) {
IPCReportWindow.show(it, errorReportList, warningReportList, reportLevel)
}
}
}
}
override fun showUpgradeDialog(
name: String,
url: String,
title: String,
content: String,
installType: String
) {
if (context != null) {
UpgradeAppDialog.show(
context, name, url, title, content, installType
)
}
}
override fun showAdUpgradeDialog(images: List<String>, padSn: String, releaseId: String) {
ThreadUtils.runOnUiThread {
if (context != null) {
AdUpgradeDialog.show(context, images, padSn, releaseId)
}
}
}
override fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
ThreadUtils.runOnUiThread {
toolsView.showAdUpgradeStatus(ipcUpgradeStateInfo)
}
}
}

View File

@@ -7,18 +7,15 @@ import android.view.LayoutInflater
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.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_bubble.view.*

View File

@@ -12,7 +12,7 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -95,7 +95,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
resultStr = "${resultStr}${CallerAutoPilotControlManager.getReportResultDesc(result)}"
}
holder.tvBubbleReportType.text = resultStr
holder.clReportLayout.setOnClickListener {

View File

@@ -13,7 +13,7 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.R
@@ -133,7 +133,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var resultStr = "类型:"
for (result in reportEntity.resultList) {
resultStr =
"${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
"${resultStr}${CallerAutoPilotControlManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
@@ -141,7 +141,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var actionStr = ""
for (action in reportEntity.actionsList) {
actionStr =
"${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
"${actionStr}${CallerAutoPilotControlManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.content.Context;
import android.text.TextUtils;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.app.Dialog;
import android.content.Context;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import android.content.Context;
import android.os.Handler;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.dispatch;
package com.mogo.eagle.core.function.hmi.ui.notice;
import static com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU;
import static com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG;

View File

@@ -19,7 +19,7 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo.NoticeTrafficAccountInfo
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.notice.NoticeValue
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.startAutoPilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lat
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager.bizProvider

View File

@@ -38,21 +38,19 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.scene.SceneModule
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.gnss.AccelerationEntity
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
@@ -77,7 +75,6 @@ import com.mogo.map.uicontroller.VisualAngleMode.*
import com.mogo.support.obu.MogoObuManager
import com.mogo.support.obu.constants.MogoObuLogLevel
import com.mogo.support.obu.option.MogoObuLog
import com.zhjt.mogo_core_function_devatools.env.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
@@ -126,7 +123,7 @@ internal class DebugSettingView @JvmOverloads constructor(
private var logViewAttach = false
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
private var mGnssInfo: MessagePad.GnssInfo? = null
private var mGnssInfo: MogoLocation? = null
private var accelerationFloatWindow: AccelerationFloatWindow? = null
private var accelerationList = arrayListOf<AccelerationEntity>()
@@ -226,7 +223,7 @@ internal class DebugSettingView @JvmOverloads constructor(
Timer().schedule(timerTaskRefresh, Date(), 300)
if (AppConfigInfo.isConnectAutopilot && (AppConfigInfo.plateNumber.isNullOrEmpty() || AppConfigInfo.iPCMacAddress.isNullOrEmpty())) {
//查询工控机基础配置信息
CallerAutoPilotManager.getCarConfig()
CallerAutoPilotControlManager.getCarConfig()
}
}
@@ -239,7 +236,7 @@ internal class DebugSettingView @JvmOverloads constructor(
// 移除 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
// 移除 地图样式改变 监听
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
// 移除 域控制器感知数据 监听
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
// 移除 规划路径相关回调 监听
@@ -529,10 +526,10 @@ internal class DebugSettingView @JvmOverloads constructor(
tbChangeCurrentCarIcon.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
// 替换为出租车图标
CallerHDMapManager.changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
} else {
// 替换为小巴车图标
CallerHDMapManager.changeCurrentIcon(R.raw.xiaobache)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
}
}
@@ -544,7 +541,7 @@ internal class DebugSettingView @JvmOverloads constructor(
if (isChecked) {
CallerMoGoUiSettingManager.stepInDayMode()
} else {
CallerMoGoUiSettingManager.stepOutDayMode()
CallerMoGoUiSettingManager.stepInNightMode()
}
}
@@ -600,10 +597,10 @@ internal class DebugSettingView @JvmOverloads constructor(
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
tbIsDrawAutopilotTrajectoryData.isEnabled = !FunctionBuildConfig.isDemoMode
if (!FunctionBuildConfig.isDemoMode) {
@@ -621,7 +618,7 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式
tbIsRainMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setRainMode(isChecked)
CallerAutoPilotControlManager.setRainMode(isChecked)
FunctionBuildConfig.isRainMode = isChecked
}
//雨天模式按钮只在司机屏生效,乘客屏不显示
@@ -640,7 +637,7 @@ internal class DebugSettingView @JvmOverloads constructor(
//重启工控机所有节点
btnIpcReboot.onClick {
CallerAutoPilotManager.sendIpcReboot()
CallerAutoPilotControlManager.sendIpcReboot()
ToastUtils.showLong("重启命令已发送")
}
//只在司机端设置工控机节点重启功能
@@ -746,7 +743,9 @@ internal class DebugSettingView @JvmOverloads constructor(
tbDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData
//是否渲染点云数据
tbDrawPointCloudData.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.setIsDrawPointCloud(isChecked)
CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked)
FunctionBuildConfig.isDrawPointCloudData = isChecked
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
}
//设置点云大小
@@ -757,7 +756,7 @@ internal class DebugSettingView @JvmOverloads constructor(
} else {
try {
val cloudSizeFloat = cloudSize.toFloat()
CallerHDMapManager.setPointCloudSize(cloudSizeFloat)
CallerMapUIServiceManager.getMapUIController()?.setPointCloudSize(cloudSizeFloat)
} catch (e: Exception) {
ToastUtils.showShort("点云大小格式输入不正确")
}
@@ -770,7 +769,7 @@ internal class DebugSettingView @JvmOverloads constructor(
ToastUtils.showShort("请输入正确的点云颜色")
} else {
try {
CallerHDMapManager.setPointCloudColor(cloudColor)
CallerMapUIServiceManager.getMapUIController()?.setPointCloudColor(cloudColor)
} catch (e: Exception) {
ToastUtils.showShort("点云大小颜色输入不正确")
}
@@ -779,7 +778,7 @@ internal class DebugSettingView @JvmOverloads constructor(
// 模拟自动驾驶中
tbChangeAutoPilotStatus.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setControlAutopilotCarAuto(isChecked)
CallerAutoPilotControlManager.setControlAutopilotCarAuto(isChecked)
}
when {
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) -> {
@@ -800,7 +799,7 @@ internal class DebugSettingView @JvmOverloads constructor(
}
//初始化ADAS日志开关状态
tbADASLog.isChecked = CallerAutoPilotManager.isEnableLog()
tbADASLog.isChecked = CallerAutoPilotControlManager.isEnableLog()
//查看上报历史列表
tbReportMore.setOnCheckedChangeListener { _, isChecked ->
@@ -921,7 +920,7 @@ internal class DebugSettingView @JvmOverloads constructor(
btnConnectServerIp.setOnClickListener {
val ip = etConnectServerIp.text.toString()
if (!ip.isNullOrEmpty()) {
CallerAutoPilotManager.connectSpecifiedServer(ip)
CallerAutoPilotControlManager.connectSpecifiedServer(ip)
}
}
@@ -936,7 +935,7 @@ internal class DebugSettingView @JvmOverloads constructor(
}
//切换环境
tvCurEnv.text = "当前环境:${EnvChangeManager.getCityName()}${EnvChangeManager.getNetMode()}"
tvCurEnv.text = "当前环境:${CallerDevaToolsManager.getEnvCityName()}${CallerDevaToolsManager.getEnvNetMode()}"
btChangeEnv.onClick {
PopupMenu(context, btChangeEnv).also { p ->
p.menuInflater.inflate(R.menu.menu_env_pop, p.menu)
@@ -950,19 +949,19 @@ internal class DebugSettingView @JvmOverloads constructor(
return@setOnMenuItemClickListener false
}
R.id.env_reset ->
EnvChangeManager.reset()
CallerDevaToolsManager.envConfigReset()
R.id.hy_product ->
EnvChangeManager.changeTo("0734", DebugConfig.NET_MODE_RELEASE)
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_RELEASE)
R.id.hy_qa ->
EnvChangeManager.changeTo("0734", DebugConfig.NET_MODE_QA)
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_QA)
R.id.hy_demo ->
EnvChangeManager.changeTo("0734", DebugConfig.NET_MODE_DEMO)
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_DEMO)
R.id.bj_product ->
EnvChangeManager.changeTo("010", DebugConfig.NET_MODE_RELEASE)
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_RELEASE)
R.id.bj_qa ->
EnvChangeManager.changeTo("010", DebugConfig.NET_MODE_QA)
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_QA)
R.id.bj_demo ->
EnvChangeManager.changeTo("010", DebugConfig.NET_MODE_DEMO)
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_DEMO)
else ->
throw AssertionError("invalid item: $item")
}
@@ -988,7 +987,7 @@ internal class DebugSettingView @JvmOverloads constructor(
btnSetAutopilotIP.setOnClickListener {
val autoPilotIp = etAutopilotIP.text.toString()
if (autoPilotIp.isNotEmpty()) {
CallerAutoPilotManager.resetIpAddress(autoPilotIp)
CallerAutoPilotControlManager.resetIpAddress(autoPilotIp)
} else {
ToastUtils.showShort("请输入正确的IP地址")
}
@@ -996,7 +995,7 @@ internal class DebugSettingView @JvmOverloads constructor(
//断开与工控机的连接
btnDisconnectIpc.setOnClickListener {
CallerAutoPilotManager.disconnectIpc()
CallerAutoPilotControlManager.disconnectIpc()
}
/**
@@ -1006,32 +1005,32 @@ internal class DebugSettingView @JvmOverloads constructor(
val recordTimeStr = etInputRecordTime.text?.toString()
try {
if (recordTimeStr.isNullOrEmpty()) {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
val recordTime = recordTimeStr?.toInt()
if (recordTime != null && recordTime > 0) {
CallerAutoPilotManager.recordPackage(recordTime)
CallerAutoPilotControlManager.recordPackage(recordTime)
} else {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
} catch (e: Exception) {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
}
btnRecordBag.onClick {
val recordTimeStr = etInputRecordBagTime.text?.toString()
try {
if (recordTimeStr.isNullOrEmpty()) {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
val recordTime = recordTimeStr?.toInt()
if (recordTime != null && recordTime > 0) {
CallerAutoPilotManager.recordPackage(recordTime)
CallerAutoPilotControlManager.recordPackage(recordTime)
} else {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
} catch (e: Exception) {
CallerAutoPilotManager.recordPackage()
CallerAutoPilotControlManager.recordPackage()
}
}
@@ -1047,44 +1046,34 @@ internal class DebugSettingView @JvmOverloads constructor(
* 隐藏、显示小地图
*/
tbControlView.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerSmpManager.hidePanel()
} else {
CallerSmpManager.showPanel()
}
// if (isChecked) {
// CallerSmpManager.hidePanel()
// } else {
// CallerSmpManager.showPanel()
// }
}
/**
* sn绑定控制
*/
tbOpenSnBinding.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setSnBinding(true)
} else {
CallerHmiManager.setSnBinding(false)
}
HmiBuildConfig.isShowSnBindingView = !isChecked
}
/**
* obu弱势交通控制
*/
tbObuWeaknessTraffic.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) { //默认开启
CallerHmiManager.setObuWeaknessTraffic(true)
} else {
CallerHmiManager.setObuWeaknessTraffic(false)
}
// 默认开启
HmiBuildConfig.isShowObuWeaknessTrafficView = !isChecked
}
/**
* 云端弱势交通控制
*/
tbCloudWeaknessTraffic.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { //默认关闭
CallerHmiManager.setCloudWeaknessTraffic(true)
} else {
CallerHmiManager.setCloudWeaknessTraffic(false)
}
// 默认关闭
HmiBuildConfig.isShowObuWeaknessTrafficView = isChecked
}
/**
@@ -1113,17 +1102,9 @@ internal class DebugSettingView @JvmOverloads constructor(
accelerationIsShow = isChecked
}
tbRouteDynamicEffect.isChecked =
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
FunctionBuildConfig.appIdentityMode
)
tbRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
RouteStrategy.enable(true)
} else {
RouteStrategy.enable(false)
}
HmiBuildConfig.isShowRouteStrategy = isChecked
}
btnThresholdDefine.setOnClickListener {
@@ -1199,9 +1180,9 @@ internal class DebugSettingView @JvmOverloads constructor(
*/
tbADASLog.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerAutoPilotManager.setEnableLog(true)
CallerAutoPilotControlManager.setEnableLog(true)
} else {
CallerAutoPilotManager.setEnableLog(false)
CallerAutoPilotControlManager.setEnableLog(false)
}
}
@@ -1230,7 +1211,7 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置是否输出高精地图日志 true-打印日志false-不打印日志
*/
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.setDebugMode(isChecked)
CallerMapUIServiceManager.getMapUIController()?.setDebugMode(isChecked)
}
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()
@@ -1525,7 +1506,7 @@ internal class DebugSettingView @JvmOverloads constructor(
tvAppVersionNameKey.text = "鹰眼版本名:${AppUtils.getAppVersionName()}"
tvAutopilotProtocolVersionInfo.text =
"Autopilot协议版本${CallerAutoPilotManager.getProtocolVersion()}"
"Autopilot协议版本${CallerAutoPilotControlManager.getProtocolVersion()}"
if (AppConfigInfo.protocolVersionNumber == 0) {
tvIpcProtocolVersionInfo.text = "工控机协议版本:未知"
} else {
@@ -1831,7 +1812,7 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
mGnssInfo = gnssInfo
//实时加速度列表
ThreadUtils.runOnUiThread {
@@ -1910,14 +1891,14 @@ internal class DebugSettingView @JvmOverloads constructor(
var resultStr = "result:"
for (result in it.resultList) {
resultStr =
"$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} "
"$resultStr$result${CallerAutoPilotControlManager.getReportResultDesc(result)} "
}
tvReportResult.text = resultStr
var actionStr = "action:"
for (action in it.actionsList) {
actionStr =
"$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} "
"$actionStr$action${CallerAutoPilotControlManager.getReportActionDesc(action)} "
}
tvReportActions.text = actionStr
@@ -2018,14 +1999,14 @@ internal class DebugSettingView @JvmOverloads constructor(
var resultStr = "result:"
for (result in it.resultList) {
resultStr =
"$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} "
"$resultStr$result${CallerAutoPilotControlManager.getReportResultDesc(result)} "
}
tvReportResult.text = resultStr
var actionStr = "action:"
for (action in it.actionsList) {
actionStr =
"$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} "
"$actionStr$action${CallerAutoPilotControlManager.getReportActionDesc(action)} "
}
tvReportActions.text = actionStr
if ("error" == it.level) {

View File

@@ -6,7 +6,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.hmi.R
import me.jessyan.autosize.AutoSizeCompat
@@ -37,13 +37,13 @@ class IPCReportAdapter: RecyclerView.Adapter<IPCReportAdapter.IPCReportHolder>()
holder.tvReportTimeContent.text = it.time
var resultStr = "发生异常"
for (result in it.resultList){
resultStr = "${resultStr}-${CallerAutoPilotManager.getReportResultDesc(result)}"
resultStr = "${resultStr}-${CallerAutoPilotControlManager.getReportResultDesc(result)}"
}
holder.tvReportResultContent.text = resultStr
holder.tvReportMsgContent.text = it.msg
var actionStr = ""
for (action in it.actionsList){
actionStr = "${actionStr}-${CallerAutoPilotManager.getReportActionDesc(action)}"
actionStr = "${actionStr}-${CallerAutoPilotControlManager.getReportActionDesc(action)}"
}
holder.tvReportActionContent.text = actionStr
}

View File

@@ -9,7 +9,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.hmi.R
/**
@@ -45,12 +45,12 @@ class ReportListAdapter(context: Context) :
holder.tvReportCode.text = "code:${it.code}"
var resultStr = "result:"
for (result in it.resultList) {
resultStr = "$resultStr$result${CallerAutoPilotManager.getReportResultDesc(result)} "
resultStr = "$resultStr$result${CallerAutoPilotControlManager.getReportResultDesc(result)} "
}
holder.tvReportResult.text = resultStr
var actionStr = "action:"
for (action in it.actionsList) {
actionStr = "$actionStr$action${CallerAutoPilotManager.getReportActionDesc(action)} "
actionStr = "$actionStr$action${CallerAutoPilotControlManager.getReportActionDesc(action)} "
}
holder.tvReportActions.text = actionStr

View File

@@ -10,7 +10,7 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
@@ -18,9 +18,8 @@ import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_sop_setting.view.*
@@ -49,7 +48,7 @@ internal class SOPSettingView @JvmOverloads constructor(
//绕障类功能开关
tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.sendDetouring(isChecked)
CallerAutoPilotControlManager.sendDetouring(isChecked)
FunctionBuildConfig.isDetouring = isChecked
}
@@ -64,16 +63,9 @@ internal class SOPSettingView @JvmOverloads constructor(
}
//引导线动态效果
tbRouteDynamicEffect.isChecked =
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
FunctionBuildConfig.appIdentityMode
)
tbRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
RouteStrategy.enable(true)
} else {
RouteStrategy.enable(false)
}
HmiBuildConfig.isShowRouteStrategy = isChecked
}
/**
@@ -81,11 +73,8 @@ internal class SOPSettingView @JvmOverloads constructor(
*/
tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView
tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) { //默认开启
CallerHmiManager.setObuWeaknessTraffic(true)
} else {
CallerHmiManager.setObuWeaknessTraffic(false)
}
// 默认开启
HmiBuildConfig.isShowObuWeaknessTrafficView = !isChecked
}
/**
@@ -93,18 +82,15 @@ internal class SOPSettingView @JvmOverloads constructor(
*/
tbCloudWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowCloudWeaknessTrafficView
tbCloudWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { //默认关闭
CallerHmiManager.setCloudWeaknessTraffic(true)
} else {
CallerHmiManager.setCloudWeaknessTraffic(false)
}
// 默认关闭
HmiBuildConfig.isShowCloudWeaknessTrafficView = isChecked
}
/**
* 限速数据来源开关
*/
tbRoadLimitSpeedSop.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
// 默认关闭
HmiBuildConfig.isShowObuLimitSpeedView = isChecked
}
@@ -112,7 +98,7 @@ internal class SOPSettingView @JvmOverloads constructor(
* obu V2V开关
*/
tbObuV2vView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
// 默认关闭
HmiBuildConfig.isShowObuV2vView = isChecked
}
@@ -120,7 +106,7 @@ internal class SOPSettingView @JvmOverloads constructor(
* obu V2i开关
*/
tbObuV2iView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
// 默认关闭
HmiBuildConfig.isShowObuV2iView = isChecked
}
@@ -128,7 +114,7 @@ internal class SOPSettingView @JvmOverloads constructor(
* obu 数据通过dc 传输V2i事件 开关 TODO pm确定下开关功能 HmiBuildConfig.isShowObuToDcV2iView
*/
tbObuToDcView.setOnCheckedChangeListener { _, isChecked ->
//默认开启
// 默认开启
HmiBuildConfig.isShowObuToDcV2iView = !isChecked
// Log.d("liyz", "HmiBuildConfig.isShowObuToDcV2iView = " + HmiBuildConfig.isShowObuToDcV2iView)
}
@@ -161,10 +147,10 @@ internal class SOPSettingView @JvmOverloads constructor(
tbDemoMode.setOnCheckedChangeListener { _, _ ->
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
}
//只在司机端设置美化模式开关功能
@@ -177,7 +163,7 @@ internal class SOPSettingView @JvmOverloads constructor(
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式
tbRainMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setRainMode(isChecked)
CallerAutoPilotControlManager.setRainMode(isChecked)
FunctionBuildConfig.isRainMode = isChecked
}
//雨天模式按钮只在司机屏生效,乘客屏不显示
@@ -227,7 +213,7 @@ internal class SOPSettingView @JvmOverloads constructor(
}
btnSpeedSet.setOnClickListener {
val isSuccess =
CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
if (isSuccess == true) {
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功")
} else {

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.View
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
@@ -25,10 +25,10 @@ class DemoModeHiddenSwitch(context: Context, attrs: AttributeSet?) : View(contex
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
CallerAutoPilotControlManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
}
}

View File

@@ -7,7 +7,6 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Process
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
@@ -18,10 +17,9 @@ import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.utils.KeyBoardUtil
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -77,7 +75,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
}
else -> {
// 设置自动驾驶速度
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed)
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(speed)
when {
isSuccess -> {
ToastUtils.showShort("车速设置成功,立即生效")
@@ -110,7 +108,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
}
if (AppConfigInfo.isConnectAutopilot) {
CallerAutoPilotManager.getCarConfig()
CallerAutoPilotControlManager.getCarConfig()
}
// if (maxAcceleration > 0) {
// tvAcceleration.text = "加速度 $maxAcceleration m/s²"
@@ -142,7 +140,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
//速度确认
tvSureModify.setOnClickListener {
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit)
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(speedLimit)
when {
isSuccess -> {
//速度显示

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.widget.TextView

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.view.View

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.turnlight
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
@@ -11,6 +11,7 @@ import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import kotlinx.android.synthetic.main.view_brake_light_status.view.*
@@ -47,6 +48,7 @@ class BrakeViewStatus @JvmOverloads constructor(
if (brakeLight == 1) { //刹车灯亮
if (!isBrake) {
isBrake = true
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(0, 500)
GlobalScope.launch(Dispatchers.Main) {
var appearAnimation = AlphaAnimation(0f, 1f)
appearAnimation.duration = 300
@@ -61,6 +63,7 @@ class BrakeViewStatus @JvmOverloads constructor(
} else { //不踩刹车,就消失
if (isBrake) {
isBrake = false
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
GlobalScope.launch(Dispatchers.Main) {
// scaleImageAndTv()
var disappearAnimation = AlphaAnimation(1f, 0f)

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.pnc
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
@@ -15,10 +15,10 @@ import com.mogo.eagle.core.data.trafficlight.isRed
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion.STATUS_AUTOPILOT_RUNNING
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.service_biz.BizConfig

View File

@@ -0,0 +1,100 @@
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.android.synthetic.main.view_steering_brake.view.*
/**
* 现阶段模型支持刹车与转向同时触发,现有逻辑中还存在两者优先级状态。后续通过各自实现,将去除优先级
* 刹车调用模型的逻辑暂时放入view。 转向不受影响
*/
class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs),
IMoGoChassisLamplightListener, IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "SteeringBrakeView"
}
private var isShowTurnLight = false
private var brakeLight = -1
init {
LayoutInflater.from(context).inflate(R.layout.view_steering_brake, this, true)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SteeringBrakeView)
val dayLight = typedArray.getBoolean(R.styleable.SteeringBrakeView_day_light_mode, false)
turnLightView.dayLightMode(dayLight)
typedArray.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerChassisLamplightListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车
brakeLight =
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f
)
) {
1
} else {
0
}
CallerLogger.d(
"$M_HMI$TAG",
"---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight
)
if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(brakeLight)
} else {
brakeView.visibility = View.GONE
}
}
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
CallerLogger.d("$M_HMI$TAG", "---lightSwitch.getNumber() = " + lightSwitch.number)
if (lightSwitch.number == 1 || lightSwitch.number == 2) {
isShowTurnLight = true
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(0)
} else {
brakeView.visibility = View.GONE
isShowTurnLight = false
}
turnLightView.visibility = View.VISIBLE
turnLightView.setTurnLight(lightSwitch)
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLamplightListenerManager.removeListener(TAG)
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.takeover
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
@@ -59,7 +59,6 @@ class TakeOverView @JvmOverloads constructor(
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts,
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
@@ -70,9 +69,7 @@ class TakeOverView @JvmOverloads constructor(
takeOver = false
visibility = View.GONE
}
},
true,
6000L
}
)
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.hmi.ui.turnlight
package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
@@ -10,12 +10,10 @@ import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import chassis.Chassis
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -28,82 +26,52 @@ import kotlinx.coroutines.launch
* @since 2022/1/10
*/
class TurnLightViewStatus @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status_daytime, this, true)
private var init: Boolean = false
fun dayLightMode(dayLight: Boolean) {
if (dayLight) {
LayoutInflater.from(context)
.inflate(R.layout.view_turn_light_status_daytime, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
}
invalidate()
init = true
}
private var isShowNormalBg :Boolean = false
private var isLeftLight :Boolean = false
private var isRightLight :Boolean = false
private var isDisappare :Boolean = false
@Volatile
private var isVisualAngleChanged = false
/**
* 转向灯动画
*/
fun setTurnLight(directionLight: Int) {
if (!isShowNormalBg && (directionLight == 1 || directionLight == 2)) {
isShowNormalBg = true
GlobalScope.launch(Dispatchers.Main) {
showNormalAnimation()
fun setTurnLight(directionLight: Chassis.LightSwitch) {
GlobalScope.launch(Dispatchers.Main) {
if (!init) {
return@launch
}
}
if (directionLight == 1 || directionLight == 2) {
if (!isVisualAngleChanged) {
isVisualAngleChanged = true
CallerVisualAngleManager.changeVisualAngle(Turning(true))
}
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
if (directionLight == 1) { //左转向
if (!isLeftLight) {
isLeftLight = true
isRightLight = false
isDisappare = false
GlobalScope.launch(Dispatchers.Main) {
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
right_select_image.clearAnimation()
setAnimation(left_select_image)
}
}
} else if (directionLight == 2) { //右转向
if (!isRightLight) {
isRightLight = true
isLeftLight = false
isDisappare = false
GlobalScope.launch(Dispatchers.Main) {
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
left_select_image.clearAnimation()
setAnimation(right_select_image)
}
}
} else { //消失
if (isVisualAngleChanged) {
isVisualAngleChanged = false
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
if (!isDisappare) {
isDisappare = true
isShowNormalBg = false
isLeftLight = false
isRightLight = false
GlobalScope.launch(Dispatchers.Main) {
else -> { //消失
CallerVisualAngleManager.changeVisualAngle(Turning(false))
animationDisappear()
}
}
@@ -168,7 +136,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
override fun onAnimationEnd(p0: Animation?) {
turn_light_layout.visibility = View.GONE
// stopAnimate()
stopAnimate()
}
})
}
@@ -176,18 +144,14 @@ class TurnLightViewStatus @JvmOverloads constructor(
//实现图片闪烁效果
private fun setAnimation(imageView: ImageView) {
val animationSet = AnimatorSet()
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha",0f, 1.0f)
val valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha",1.0f, 0f)
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1.0f)
val valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha", 1.0f, 0f)
valueAnimator.duration = 1000
valueAnimatorDisappare.duration = 800
valueAnimator.repeatCount = -1
valueAnimatorDisappare.repeatCount = -1
animationSet.playTogether(valueAnimatorDisappare, valueAnimator)
animationSet.start()
}
private fun stopAnimate() {

View File

@@ -8,7 +8,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
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.CallerAutoPilotStatusListenerManager.getCurWgs84Lat
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon
@@ -85,7 +85,7 @@ class AutoPilotStatusView constructor(
AutopilotControlParameters.AutoPilotLonLat(26.819716071924688, 112.57715442110867)
currentAutopilot.vehicleType = 10
CallerAutoPilotManager.startAutoPilot(currentAutopilot)
CallerAutoPilotControlManager.startAutoPilot(currentAutopilot)
}
/**

View File

@@ -76,8 +76,8 @@ class BatteryGroupView : LinearLayout, IMoGoSkinModeChangeListener {
if (isCharging) {
it.ivBatteryCharge.visibility = View.VISIBLE
when(it.mSkinMode){
0 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_light)
1 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_dark)
0 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_dark)
1 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_light)
}
} else {
it.ivBatteryCharge.visibility = View.GONE

View File

@@ -9,7 +9,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.hmi.R
@@ -68,7 +68,7 @@ class CheckSystemView @JvmOverloads constructor(
else {
//确认重启
CallerLogger.d("$M_HMI$TAG", "reboot confirm")
CallerAutoPilotManager.setIPCReboot()
CallerAutoPilotControlManager.setIPCReboot()
}
}

View File

@@ -10,7 +10,7 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_limiting_speed_vr.view.*
@@ -32,7 +32,7 @@ class LimitingVelocityView constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerViewLimitingVelocityListenerManager.addListener(TAG, this)
CallerLimitingVelocityListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(LimitingVelocityView_TAG, this)
}
@@ -54,7 +54,7 @@ class LimitingVelocityView constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerViewLimitingVelocityListenerManager.removeListener(TAG)
CallerLimitingVelocityListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(LimitingVelocityView_TAG)
}

View File

@@ -13,9 +13,9 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.TrafficLightView_TAG
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler

View File

@@ -5,12 +5,12 @@ import android.graphics.Color
import android.util.AttributeSet
import android.view.Gravity
import android.widget.FrameLayout
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import mogo.telematics.pad.MessagePad
import java.util.*
/**
@@ -29,7 +29,7 @@ class SpeedPanelView @JvmOverloads constructor(
var mContext: Context
var mSpeedChartView: SpeedChartView
var mLatLng: MessagePad.GnssInfo? = null
var mLatLng: MogoLocation? = null
var mSpeedLimit = 60
private val timer by lazy {
@@ -55,7 +55,7 @@ class SpeedPanelView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 注册位置回调
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
// 开启定时查询速度
timerTask?.cancel()
val task = object : TimerTask() {
@@ -77,7 +77,7 @@ class SpeedPanelView @JvmOverloads constructor(
timer.schedule(task, Date(), 200)
}
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
gnssInfo?.let {
mLatLng = gnssInfo
}
@@ -86,7 +86,7 @@ class SpeedPanelView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 解除注册
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
try {
timerTask?.cancel()
} catch (e: Exception) {

View File

@@ -0,0 +1,92 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.animation.Animator
import android.animation.Animator.AnimatorListener
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.v2x.IV2XEventListener
import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlinx.android.synthetic.main.view_v2x_warning_fog.view.*
class V2XFogEventView(context: Context, attrs: AttributeSet) :
ConstraintLayout(context, attrs), IV2XEventListener {
companion object {
private const val TAG = "V2XFogEventView"
}
private val animatorSet = AnimatorSet()
init {
LayoutInflater.from(context).inflate(R.layout.view_v2x_warning_fog, this, true)
val animator1 = ObjectAnimator.ofFloat(iv_wu1, "alpha", 0f, 1f, 0f)
val animator2 = ObjectAnimator.ofFloat(iv_wu1, "translationX", -500f, 100f, 300f)
val animator3 = ObjectAnimator.ofFloat(iv_wu1, "scaleX", 1f, 1.5f, 2f)
val animator4 = ObjectAnimator.ofFloat(iv_wu1, "scaleY", 1f, 1.5f, 2f)
val animator5 = ObjectAnimator.ofFloat(iv_wu2, "alpha", 0f, 1f, 0f)
val animator6 = ObjectAnimator.ofFloat(iv_wu2, "translationX", 500f, -100f, -300f)
val animator7 = ObjectAnimator.ofFloat(iv_wu2, "scaleX", 1f, 1.5f, 2f)
val animator8 = ObjectAnimator.ofFloat(iv_wu2, "scaleY", 1f, 1.5f, 2f)
animatorSet.playTogether(
animator1,
animator2,
animator3,
animator4,
animator5,
animator6,
animator7,
animator8
)
animatorSet.duration = 5000
animatorSet.addListener(object : AnimatorListener{
override fun onAnimationStart(animation: Animator?) {
visibility = View.VISIBLE
}
override fun onAnimationEnd(animation: Animator?) {
visibility = View.GONE
}
override fun onAnimationCancel(animation: Animator?) {
visibility = View.GONE
}
override fun onAnimationRepeat(animation: Animator?) {
}
})
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerV2XWarningListenerManager.addListener(TAG, this)
}
override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) {
ThreadUtils.runOnUiThread {
if(v2xType == EventTypeEnumNew.FOURS_FOG.poiType){
animatorSet.start()
}
}
}
override fun dismiss(direction: WarningDirectionEnum) {
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerV2XWarningListenerManager.removeListener(TAG)
}
}

View File

@@ -4,27 +4,30 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.widget.RelativeLayout
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.*
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.api.v2x.IV2XEventListener
import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.module_hmi_warning_v2x.view.*
import kotlinx.android.synthetic.main.view_v2x_warning.view.*
/**
*@author xiaoyuzhou
*@date 2021/9/10 7:44 下午
*/
class V2XWarningView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr) {
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr), IV2XEventListener {
companion object {
private const val ALL_CLOSE_TIMER = 10000L
private const val ALL_CLOSE_TIMER = 5000L
private const val TAG = "V2XWarningView"
}
@@ -33,7 +36,27 @@ class V2XWarningView @JvmOverloads constructor(
}
init {
LayoutInflater.from(context).inflate(R.layout.module_hmi_warning_v2x, this, true)
LayoutInflater.from(context).inflate(R.layout.view_v2x_warning, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerV2XWarningListenerManager.addListener(TAG, this)
}
override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) {
ThreadUtils.runOnUiThread {
if (direction != ALERT_WARNING_NON) {
showWarning(direction)
}
}
}
override fun dismiss(direction: WarningDirectionEnum) {
ThreadUtils.runOnUiThread {
dismissWarning(direction)
}
}
/**
@@ -41,34 +64,16 @@ class V2XWarningView @JvmOverloads constructor(
* @param direction
* @see WarningDirectionEnum
*/
fun showWarning(direction: WarningDirectionEnum) {
showWarning(direction, ALL_CLOSE_TIMER)
}
/**
* 展示指定方位上的红框预警
* @param direction
* @see WarningDirectionEnum
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
private fun showWarning(direction: WarningDirectionEnum, time: Long = ALL_CLOSE_TIMER) {
UiThreadHandler.post {
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
if (direction != ALERT_WARNING_NON) {
removeCallbacks(closeWarningTask)
postDelayed(closeWarningTask, closeTime)
postDelayed(closeWarningTask, time)
}
when (direction) {
ALERT_WARNING_NON -> {
removeCallbacks(closeWarningTask)
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
// nothing
}
ALERT_WARNING_TOP -> {
hmiWarningTopImg.visibility = View.VISIBLE
@@ -150,7 +155,7 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
ALERT_WARNING_ALL -> { //todo problem
hmiWarningTopImg.visibility = View.VISIBLE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
@@ -161,21 +166,23 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningRightBottomImg.visibility = View.GONE
}
}
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
startAnimation(alphaAnimation)
}
}
fun dismissWarning(direction: WarningDirectionEnum) {
private fun dismissWarning(direction: WarningDirectionEnum) {
if (direction == ALERT_WARNING_NON) {
return
}
removeCallbacks(closeWarningTask)
when (direction) {
ALERT_WARNING_TOP -> {
// hmiWarningTopImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
// hmiWarningLeftTopImg.visibility = View.GONE
// hmiWarningLeftBottomImg.visibility = View.GONE
// hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_RIGHT -> {
hmiWarningRightImg.visibility = View.GONE
@@ -199,6 +206,10 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningLeftTopImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
@@ -208,5 +219,12 @@ class V2XWarningView @JvmOverloads constructor(
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
}
}
clearAnimation()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerV2XWarningListenerManager.removeListener(TAG)
}
}

View File

@@ -9,11 +9,11 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import kotlinx.android.synthetic.main.view_version_name.view.*
/**
@@ -90,7 +90,7 @@ class VersionNameView @JvmOverloads constructor(
dockerVersion = autoPilotStatusInfo.dockVersion
showCurrentMapVersion()
//将工控机版本赋值给BadCase配置常量
BadCaseConfig.dockerVersion = autoPilotStatusInfo.dockVersion
CallerDevaToolsManager.dockerVersion(autoPilotStatusInfo.dockVersion)
}
}

View File

@@ -5,8 +5,8 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
import com.mogo.eagle.core.function.api.v2x.IMoGoVipSetListener
import com.mogo.eagle.core.function.call.v2x.CallVipSetListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils

View File

@@ -1,484 +0,0 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LEAK;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_NATIVE_LEAK;
import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.kwai.koom.base.MonitorManager;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig;
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
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.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView;
import com.mogo.eagle.core.function.main.modules.MogoModulesManager;
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述:加载各个模块
*/
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
IMoGoAutopilotStatusListener {
protected static final String TAG = "MainActivity";
private static final int REQUEST_CODE_DIALOG = 100;
protected FrameLayout mFloatingLayout;
protected View mCoverUpLayout;
protected ConstraintLayout clSpecialEffect;
private boolean isFirst = false;
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private final List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@Override
protected int getLayoutId() {
return R.layout.module_main_activity_main;
}
@Override
protected void initViews() {
injectStatusBar();
getWindow().setBackgroundDrawable(null);
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
clSpecialEffect = findViewById(R.id.cl_special_effect);
mConnectInfoRV = findViewById(R.id.rvConnectInfo);
initConnectInfoRV();
FloatingViewHandler.init(mFloatingLayout);
//申请悬浮窗权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 检查是否有悬浮窗权限
if (Settings.canDrawOverlays(this)) {
return;
}
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
}
}
private void injectStatusBar() {
FrameLayout decorView = (FrameLayout) this.getWindow().getDecorView();
View contentView = ((ViewGroup) decorView.findViewById(android.R.id.content)).getChildAt(0);
contentView.setFitsSystemWindows(false);
decorView.setClipToPadding(false);
View statusBarView = decorView.findViewWithTag("status_bar");
if (statusBarView == null) {
statusBarView = getStatusBarView();
statusBarView.setTag("status_bar");
}
FrameLayout.LayoutParams statusBarLP =
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, BarUtils.getStatusBarHeight());
statusBarLP.topMargin = 0;
statusBarLP.gravity = Gravity.TOP;
decorView.addView(statusBarView, statusBarLP);
}
/**
* 修改statusBar 重写实现,需要继承 StatusBarViewxml中基础系统控件不要修改其id拿来即用
* @return StatusBarView
*/
protected StatusBarView getStatusBarView(){
return new StatusBarView(this);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
calculateStartTime();
ContextHolderUtil.holdContext(this);
// 监听工控机连接信息
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerStartUpManager.initStageTwo();
// 加载模块
mPresenter.postLoadModuleMsg();
// 监听网络状态
NetworkUtils.listenNetStrength(this);
// 浓雾预警
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
mPresenter.checkPermission(this);
// 同步AppInfo Config信息
CallerDevaToolsManager.INSTANCE.syncConfig();
}
private void calculateStartTime() {
long coldStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.COLD_START);
// 这里记录的TimeUtils.coldStartTime是指Application启动的时间最终的冷启动时间等于Application启动时间+热启动时间
AppLaunchTimeUtils.sColdStartTime = coldStartTime > 0 ? coldStartTime : 0;
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.HOT_START);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
// 统计代码
final Map<String, Object> properties = new HashMap<>();
long hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START);
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
// 真正的冷启动时间 = Application启动时间 + 热启动时间
long coldStartTime = AppLaunchTimeUtils.sColdStartTime + hotStartTime;
// 过滤掉异常启动时间
if (coldStartTime < 50000) {
// 上传冷启动时间coldStartTime
CallerLogger.INSTANCE.i(M_HMI + TAG, "coldStartTime:" + coldStartTime);
properties.put("app_launch_coldStartTime", coldStartTime);
}
} else if (hotStartTime > 0) {
// 过滤掉异常启动时间
if (hotStartTime < 30000) {
// 上传热启动时间hotStartTime
CallerLogger.INSTANCE.i(M_HMI + TAG, "hotStartTime:" + hotStartTime);
properties.put("app_launch_hotStartTime", hotStartTime);
}
}
AnalyticsUtils.track("app_launch_time", properties);
}
}
private void initConnectInfoRV() {
mConnAdapter = new ConnInfoAdapter(this, dataList);
mConnectInfoRV.setLayoutManager(new LinearLayoutManager(this));
mConnectInfoRV.setAdapter(mConnAdapter);
}
@Override
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulesManager.getInstance().init(this);
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, new IMogoMapListener() {
@Override
public void onMapLoaded() {
// 延时加载其他模块
getWindow().getDecorView().post(() -> {
HdMapBuildConfig.isMapLoaded = true;
loadOthersModules();
loadFunctionFragment();
// TODO 这里临时兼容进入VR模式标记状态机。有些业务OCH会根据状态判断加载
MogoStatusManager.getInstance().setVrMode(TAG, true);
// 设置地图样式
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
});
CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
}
});
// 加载地图
loadFunctionMapView();
}
/**
* 加载其它模块
*/
protected void loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
MogoModulesManager.getInstance().loadFunctionModules();
mPresenter.delayOperations();
MogoModulesManager.getInstance().loadFunctionModulesServer();
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.d(M_HMI + TAG, "5秒已过启动基础服务……");
MogoModulesManager.getInstance().loadBaseModule();
}, 5_000L);
if (DebugConfig.isDebug()) {
// 启动Native内存泄漏监测
startLeakMonitor();
}
checkMonitorDb();
}
private void startLeakMonitor() {
LeakMonitorConfig leakMonitorConfig = new LeakMonitorConfig.Builder()
.setLoopInterval(50000)
.setMonitorThreshold(16)
.setNativeHeapAllocatedThreshold(0)
.setSelectedSoList(new String[]{"libhdmap", "libmap",
"libAMapSDK_NAVI_v8_0_1", "libZegoExpressEngine",
"libcntts"
})
.setEnableLocalSymbolic(DebugConfig.isDebug())
.setLeakListener(leaks -> {
StringBuilder stringBuilder = new StringBuilder();
if (!leaks.isEmpty()) {
for (LeakRecord leakRecord : leaks) {
stringBuilder.append(leakRecord.toString());
}
printLeakMsg(stringBuilder.toString());
}
})
.build();
MonitorManager.addMonitorConfig(leakMonitorConfig);
LeakMonitor.INSTANCE.start();
}
private void checkMonitorDb() {
new Thread(() -> {
long limitId = 50001;
File file = this.getDatabasePath(MonitorDb.INTERNAL_DB_NAME);
try {
if (file != null && file.exists()) {
List<CpuInfo> cpuList = MonitorDb.getDb(this).monitorDao().getAllCPUById(limitId);
List<MemInfo> memList = MonitorDb.getDb(this).monitorDao().getAllMemById(limitId);
// 大于5w条清除
if (cpuList.size() > 0 || memList.size() > 0) {
this.deleteDatabase(MonitorDb.INTERNAL_DB_NAME);
}
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_NATIVE_LEAK,
linkCode = CHAIN_LINK_LEAK,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK,
paramIndexes = {0},
clientPkFileName = "sn"
)
private void printLeakMsg(String leakRecord) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "内存泄漏日志如下:\n" + leakRecord);
}
@Override
public void hideCoverUpLayout() {
mConnectInfoRV.setVisibility(View.GONE);
getWindow().setBackgroundDrawable(null);
mCoverUpLayout.setVisibility(View.GONE);
isFloatingLayerHidden = true;
}
@Override
public void loadFunctionFragment() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "loadFunctionFragment……");
// 加载 HMI 图层
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
// 加载 小地图 图层
BaseFragment fragmentSmpMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP).navigation();
addFragment(fragmentSmpMap, fragmentSmpMap.getTagName(), R.id.module_main_id_smp_fragment);
}
/**
* 加载地图视图
*/
private void loadFunctionMapView() {
MvpFragment fragmentHdMap = (MvpFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_MAP).navigation();
if (fragmentHdMap != null) {
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_map_fragment_container);
}
}
@NonNull
@Override
protected MainPresenter createPresenter() {
return new MainPresenter(this);
}
@Override
protected void onResume() {
super.onResume();
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
}
@Override
protected void onPause() {
super.onPause();
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false);
}
@Override
protected void onStop() {
super.onStop();
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
int status = autoPilotStatusInfo.getIpcConnStatus();
if (mLastStatus != status) {
AutopilotStatusInfo statusInfo = autoPilotStatusInfo.clone();
mConnectInfoRV.post(() -> updateConnectInfoView(statusInfo));
mLastStatus = status;
}
}
@Override
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
mConnAdapter.updateData(autoPilotStatusInfo);
mConnectInfoRV.scrollToPosition(mConnAdapter.getItemCount() - 1);
mLastStatus = autoPilotStatusInfo.getIpcConnStatus();
} else {// 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(TAG);
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (mapUIController != null) {
mapUIController.destroy();
}
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy.");
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();
FloatingViewHandler.clear();
ProcessUtils.killAllBackgroundProcesses();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == MOGO_PERMISSION_REQUEST_CODE) {
boolean isAllGranted = true;
// 判断是否所有的权限都已经授予了
for (int grant : grantResults) {
if (grant != PackageManager.PERMISSION_GRANTED) {
isAllGranted = false;
break;
}
}
if (isAllGranted) {
isFirst = false;
} else {
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
if (!isFirst) {
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG);
isFirst = true;
}
}
}
}
/**
* 由于应用是单页面的所以采用Fragment将各模块的UI进行分割解耦合
*
* @param newFragment 功能UI
* @param tagName UI绑定的Tag
* @param containerId 要加入的资源ID
*/
private void addFragment(Fragment newFragment, String tagName, int containerId) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tagName);
if (fragment == null) {
fragment = newFragment;
}
if (fragment == null) {
CallerLogger.INSTANCE.e(M_HMI + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
getSupportFragmentManager().beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss();
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
super.onPointerCaptureChanged(hasCapture);
}
}

View File

@@ -0,0 +1,382 @@
package com.mogo.eagle.core.function.main
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.launcher.ARouter
import com.kwai.koom.base.MonitorManager.addMonitorConfig
import com.kwai.koom.nativeoom.leakmonitor.LeakListener
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor.start
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord
import com.mogo.commons.analytics.AnalyticsUtils
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.mvp.BaseFragment
import com.mogo.commons.mvp.MvpActivity
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
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.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager.initStageTwo
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.main.modules.MogoModulesManager
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
import com.mogo.map.uicontroller.EnumMapUI
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import kotlinx.android.synthetic.main.module_main_activity_main.*
/**
* @author congtaowang
* @since 2019-12-23
*
*
* 描述:加载各个模块
*/
open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
IMoGoAutopilotStatusListener {
companion object {
protected const val TAG = "MainActivity"
private const val REQUEST_CODE_DIALOG = 100
}
private var isFirst = false
private var mConnAdapter: ConnInfoAdapter? = null
private val dataList: List<AutopilotStatusInfo> = ArrayList()
private var mLastStatus = 0x00
private var isFloatingLayerHidden = false
override fun getLayoutId(): Int {
return R.layout.module_main_activity_main
}
override fun initViews() {
injectStatusBar()
window.setBackgroundDrawable(null)
initConnectInfoRV()
FloatingViewHandler.init(module_main_id_floating_view)
CallerHmiManager.init(this)
//申请悬浮窗权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 检查是否有悬浮窗权限
if (Settings.canDrawOverlays(this)) {
return
}
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG)
}
}
private fun injectStatusBar() {
val decorView = this.window.decorView as FrameLayout
val contentView =
(decorView.findViewById<View>(android.R.id.content) as ViewGroup).getChildAt(0)
contentView.fitsSystemWindows = false
decorView.clipToPadding = false
var statusBarView = decorView.findViewWithTag<View>("status_bar")
if (statusBarView == null) {
statusBarView = StatusBarView(this)
statusBarView.setTag("status_bar")
}
val statusBarLP = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
BarUtils.getStatusBarHeight()
)
statusBarLP.topMargin = 0
statusBarLP.gravity = Gravity.TOP
decorView.addView(statusBarView, statusBarLP)
}
/**
* 修改statusBar 重写实现,需要继承 StatusBarViewxml中基础系统控件不要修改其id拿来即用
* @return StatusBarView
*/
protected val statusBarView: StatusBarView
get() = StatusBarView(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
calculateStartTime()
ContextHolderUtil.holdContext(this)
// 监听工控机连接信息
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
initStageTwo()
// 加载模块
mPresenter!!.postLoadModuleMsg()
// 监听网络状态
NetworkUtils.listenNetStrength(this)
mPresenter!!.checkPermission(this)
// 同步AppInfo Config信息
CallerDevaToolsManager.syncConfig()
}
private fun calculateStartTime() {
val coldStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.COLD_START)
// 这里记录的TimeUtils.coldStartTime是指Application启动的时间最终的冷启动时间等于Application启动时间+热启动时间
AppLaunchTimeUtils.sColdStartTime = if (coldStartTime > 0) coldStartTime else 0
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.HOT_START)
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
// 统计代码
val properties: MutableMap<String, Any> = HashMap()
val hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START)
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
// 真正的冷启动时间 = Application启动时间 + 热启动时间
val coldStartTime = AppLaunchTimeUtils.sColdStartTime + hotStartTime
// 过滤掉异常启动时间
if (coldStartTime < 50000) {
// 上传冷启动时间coldStartTime
i(SceneConstant.M_HMI + TAG, "coldStartTime:$coldStartTime")
properties["app_launch_coldStartTime"] = coldStartTime
}
} else if (hotStartTime > 0) {
// 过滤掉异常启动时间
if (hotStartTime < 30000) {
// 上传热启动时间hotStartTime
i(SceneConstant.M_HMI + TAG, "hotStartTime:$hotStartTime")
properties["app_launch_hotStartTime"] = hotStartTime
}
}
AnalyticsUtils.track("app_launch_time", properties)
}
}
private fun initConnectInfoRV() {
mConnAdapter = ConnInfoAdapter(this, dataList)
rvConnectInfo.layoutManager = LinearLayoutManager(this)
rvConnectInfo.adapter = mConnAdapter
}
override fun loadModules() {
val start = System.currentTimeMillis()
MogoStatusManager.getInstance().setVrMode(TAG, true)
MogoModulesManager.getInstance().init(this)
loadOthersModules()
mogoMapListenerHandler.registerHostMapListener(TAG, object : IMogoMapListener {
override fun onMapLoaded() {
// 延时加载其他模块
window.decorView.post {
HdMapBuildConfig.isMapLoaded = true
mPresenter!!.delayOperations()
loadFunctionFragment()
// 设置地图样式
mogoMapListenerHandler.onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR)
}
i(
SceneConstant.M_HMI + TAG,
"App launch timer cost " + (System.currentTimeMillis() - start) + "ms"
)
}
})
}
/**
* 加载其它模块
*/
protected open fun loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
MogoModulesManager.getInstance().loadFunctionModules()
MogoModulesManager.getInstance().loadFunctionModulesServer()
UiThreadHandler.postDelayed({
d(SceneConstant.M_HMI + TAG, "5秒已过启动基础服务……")
MogoModulesManager.getInstance().loadBaseModule()
}, 5000L)
if (DebugConfig.isDebug()) {
// 启动Native内存泄漏监测
startLeakMonitor()
}
CallerDevaToolsManager.checkMonitorDb()
}
private fun startLeakMonitor() {
val leakMonitorConfig: LeakMonitorConfig = LeakMonitorConfig.Builder()
.setLoopInterval(50000)
.setMonitorThreshold(16)
.setNativeHeapAllocatedThreshold(0)
.setSelectedSoList(
arrayOf(
"libhdmap", "libmap",
"libAMapSDK_NAVI_v8_0_1", "libZegoExpressEngine",
"libcntts"
)
)
.setEnableLocalSymbolic(DebugConfig.isDebug())
.setLeakListener(object : LeakListener {
override fun onLeak(leaks: MutableCollection<LeakRecord>) {
val stringBuilder = StringBuilder()
if (!leaks.isEmpty()) {
for (leakRecord in leaks) {
stringBuilder.append(leakRecord.toString())
}
printLeakMsg(stringBuilder.toString())
}
}
})
.build()
addMonitorConfig(leakMonitorConfig)
start()
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_NATIVE_LEAK,
linkCode = ChainConstant.CHAIN_LINK_LEAK,
endpoint = PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK,
paramIndexes = [0],
clientPkFileName = "sn"
)
private fun printLeakMsg(leakRecord: String) {
d(SceneConstant.M_HMI + TAG, "内存泄漏日志如下:\n$leakRecord")
}
override fun hideCoverUpLayout() {
rvConnectInfo.visibility = View.GONE
window.setBackgroundDrawable(null)
module_main_id_cover_up!!.visibility = View.GONE
isFloatingLayerHidden = true
}
override fun loadFunctionFragment() {
d(SceneConstant.M_HMI + TAG, "loadFunctionFragment……")
}
override fun createPresenter(): MainPresenter {
return MainPresenter(this)
}
override fun onResume() {
super.onResume()
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true)
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false)
}
override fun onPause() {
super.onPause()
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false)
}
override fun onStop() {
super.onStop()
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true)
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val status = autoPilotStatusInfo.ipcConnStatus
if (mLastStatus != status) {
val statusInfo = autoPilotStatusInfo.clone()
rvConnectInfo.post { updateConnectInfoView(statusInfo) }
mLastStatus = status
}
}
private fun updateConnectInfoView(autoPilotStatusInfo: AutopilotStatusInfo) {
if (!isFloatingLayerHidden) { // 遮罩层显示的时候
mConnAdapter!!.updateData(autoPilotStatusInfo)
rvConnectInfo.scrollToPosition(mConnAdapter!!.itemCount - 1)
mLastStatus = autoPilotStatusInfo.ipcConnStatus
} else { // 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}
override fun onDestroy() {
super.onDestroy()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
mogoMapListenerHandler.unregisterHostMapListener(TAG)
val mapUIController = getMapUIController()
mapUIController?.destroy()
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false)
d(SceneConstant.M_HMI + TAG, "destroy.")
ContextHolderUtil.releaseContext()
MogoModulesManager.getInstance().onDestroy()
FloatingViewHandler.clear()
ProcessUtils.killAllBackgroundProcesses()
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == MainPresenter.MOGO_PERMISSION_REQUEST_CODE) {
var isAllGranted = true
// 判断是否所有的权限都已经授予了
for (grant in grantResults) {
if (grant != PackageManager.PERMISSION_GRANTED) {
isAllGranted = false
break
}
}
if (isAllGranted) {
isFirst = false
} else {
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
if (!isFirst) {
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG)
isFirst = true
}
}
}
}
/**
* 由于应用是单页面的所以采用Fragment将各模块的UI进行分割解耦合
*
* @param newFragment 功能UI
* @param tagName UI绑定的Tag
* @param containerId 要加入的资源ID
*/
private fun addFragment(newFragment: Fragment, tagName: String, containerId: Int) {
var fragment = supportFragmentManager.findFragmentByTag(tagName)
if (fragment == null) {
fragment = newFragment
}
if (fragment == null) {
e(
SceneConstant.M_HMI + TAG,
"add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(
applicationContext, containerId
)
)
return
}
supportFragmentManager.beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss()
}
}

View File

@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_F;
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_MAIN;
import android.content.Intent;
import android.os.Bundle;
@@ -24,7 +25,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.mofang.MfConstants;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
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.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
@@ -93,13 +94,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void initViews() {
super.initViews();
// 这里在初始化完GUI后做一些个性化的定制
// 小巴车的乘客屏幕
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
FrameLayout frameLayout = findViewById(R.id.module_main_id_map_fragment_container);
frameLayout.setPadding(0, 0, AutoSizeUtils.dp2px(getContext(), 700), 0);
}
}
@Override
@@ -134,7 +128,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void loadOthersModules() {
super.loadOthersModules();
CallerLogger.INSTANCE.d(M_HMI + TAG, "loadOthersModules");
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules");
loadOCHModule();
}
@@ -351,7 +345,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
}
}
return true;
@@ -372,7 +366,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
return true;
@@ -384,14 +378,14 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
}
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
@@ -404,7 +398,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}
return true;
@@ -425,7 +419,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
timerAcc.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
}
}, 0, 500);
}
@@ -434,7 +428,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
timerAcc.cancel();
timerAcc = null;
}
CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
}
}

View File

@@ -22,12 +22,12 @@ import com.mogo.eagle.core.data.constants.MoGoConfig;
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.devatools.IMogoDevaToolsUpgradeListener;
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.function.overview.db.OverviewDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -194,7 +194,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}
private void initOverviewDb() {
OverviewDb.Companion.getDb(this);
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
}
/**

View File

@@ -15,23 +15,19 @@ import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
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.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -48,8 +44,6 @@ import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import me.jessyan.autosize.utils.AutoSizeUtils;
/**
* 针对作为Launcher的情况做个性化操作
*
@@ -92,13 +86,6 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
@Override
protected void initViews() {
super.initViews();
// 这里在初始化完GUI后做一些个性化的定制
// 小巴车的乘客屏幕
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
FrameLayout frameLayout = findViewById(R.id.module_main_id_map_fragment_container);
frameLayout.setPadding(0, 0, AutoSizeUtils.dp2px(getContext(),700), 0);
}
}
@Override
@@ -300,7 +287,7 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
isCombinationKey = false;
if ((pressCUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
}
}
return true;
@@ -318,7 +305,7 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
isCombinationKey = false;
if ((pressDUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
@@ -329,14 +316,14 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
if (!isCombinationKey) {
if ((pressEDownTime - startPressTime) > 1900) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
@@ -348,7 +335,7 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
isCombinationKey = false;
if ((pressEUpTime - startPressTime) < 300) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}
@@ -372,7 +359,7 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
timerAcc.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
}
}, 0, 500);
}
@@ -381,7 +368,7 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
timerAcc.cancel();
timerAcc = null;
}
CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.main.modules;
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_MAIN;
import android.app.Application;
import android.content.Context;
@@ -82,7 +83,7 @@ public class MogoModulesManager implements MogoModulesHandler {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMoGoFunctionProvider provider = loadFunction(module.getPath());
if (provider != null) {
mModuleFunctionProviders.put(module, provider);
@@ -97,7 +98,7 @@ public class MogoModulesManager implements MogoModulesHandler {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctionServers();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMoGoFunctionServerProvider provider = loadFunctionServer(module.getPath());
if (provider != null) {
mModuleFunctionServerProviders.put(module, provider);
@@ -114,7 +115,7 @@ public class MogoModulesManager implements MogoModulesHandler {
if (baseModule == null) {
continue;
}
CallerLogger.INSTANCE.d(M_HMI + TAG, "加载基本模块 : " + baseModule.getPath());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath());
loadBaseProvider(baseModule.getPath());
}
}

View File

@@ -1,46 +0,0 @@
<?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:id="@+id/clHmiContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--V2X预警红色边框-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
android:id="@+id/flV2XWarningView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--左右转向灯-->
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
android:id="@+id/turnLightView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车ui-->
<com.mogo.eagle.core.function.hmi.ui.turnlight.BrakeViewStatus
android:id="@+id/brakeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,48 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:background="@drawable/main_splash_bg"
android:orientation="vertical">
<!-- 地图 -->
<FrameLayout
android:id="@+id/module_main_id_map_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--浓雾预警动画-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_special_effect"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_wu1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu1"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/iv_wu2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu2"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--HMI 预警视图 OBU、云端下发、自车感知、自车策略-->
<FrameLayout
android:id="@+id/module_main_id_waring_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -59,12 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--小地图视图-->
<FrameLayout
android:id="@+id/module_main_id_smp_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<!--冷启动过渡Logo-->
@@ -74,7 +31,6 @@
android:layout_height="match_parent"
android:background="@drawable/main_splash_bg">
<ImageView
android:layout_width="@dimen/dp_157"
android:layout_height="@dimen/dp_255"
@@ -91,8 +47,6 @@
android:id="@+id/rvConnectInfo"
android:layout_width="1200dp"
android:layout_height="680dp"
android:layout_gravity="bottom"
/>
android:layout_gravity="bottom" />
</FrameLayout>

View File

@@ -0,0 +1,31 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--左右转向灯-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
android:id="@+id/turnLightView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--刹车ui-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.BrakeViewStatus
android:id="@+id/brakeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

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"
android:visibility="gone">
<ImageView
android:id="@+id/iv_wu1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_wu2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>

Some files were not shown because too many files have changed in this diff Show More