Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0
Conflicts: app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java
This commit is contained in:
@@ -62,7 +62,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
|
||||
@@ -13,9 +13,7 @@ import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSo
|
||||
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
|
||||
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.speedlimit.SpeedLimitDispatcher
|
||||
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)
|
||||
@@ -31,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()
|
||||
}
|
||||
|
||||
@@ -89,7 +85,6 @@ class FuncBizProvider : IMoGoFuncBizProvider {
|
||||
cronTaskManager.release()
|
||||
|
||||
VipCarManager.INSTANCE.destroy()
|
||||
TrafficLightDispatcher.INSTANCE.destroy()
|
||||
// RedLightWarningManager.INSTANCE.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -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))
|
||||
|
||||
@@ -13,14 +13,14 @@ 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
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
fun onDestroy() {
|
||||
CallVipSetListenerManager.removeListener(TAG)
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
|
||||
|
||||
@@ -6,9 +6,9 @@ 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
|
||||
@@ -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 ->
|
||||
|
||||
@@ -12,17 +12,17 @@ interface TrafficLightApiService {
|
||||
|
||||
//获取前方路口RoadID
|
||||
@FormUrlEncoded
|
||||
@POST("ai-roadInfo-service/cross/near")
|
||||
@POST("eagle-eye-dns/ai-roadInfo-service/cross/near")
|
||||
suspend fun getFrontRoadID(@FieldMap roadID: Map<String, String>): BaseResponse<RoadIDResult>
|
||||
|
||||
//获取前方红绿灯状态
|
||||
@FormUrlEncoded
|
||||
@POST("mec-etl-server/light/bgd/channel/realTime")
|
||||
@POST("eagle-eye-dns/mec-etl-server/light/bgd/channel/realTime")
|
||||
suspend fun getTrafficLight(@FieldMap status: Map<String, String>): BaseResponse<TrafficLightResult>
|
||||
|
||||
//变灯
|
||||
@FormUrlEncoded
|
||||
@POST("mec-etl-server/light/bdg/newTask")
|
||||
@POST("eagle-eye-dns/mec-etl-server/light/bdg/newTask")
|
||||
suspend fun changeLight(@FieldMap turnLight: Map<String, String>): BaseResponse<TrafficLightControl>
|
||||
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.mogo.eagle.function.biz.v2x.trafficlight.network
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.cancel
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.commons.constants.HostConst.CITY_HOST
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
|
||||
class TrafficLightNetWorkModel {
|
||||
|
||||
private fun getNetWorkApi(baseUrl: String = CITY_HOST): TrafficLightApiService {
|
||||
private fun getNetWorkApi(baseUrl: String = HostConst.getEagleHost()): TrafficLightApiService {
|
||||
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
|
||||
.create(TrafficLightApiService::class.java)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@ import retrofit2.http.*
|
||||
interface VipApiService {
|
||||
|
||||
//查询是否为VIP车辆
|
||||
@GET("/dataService/carUser/getVipStatusBySn")
|
||||
@GET("eagle-eye-dns/dataService/carUser/getVipStatusBySn")
|
||||
suspend fun requestVip(@Query("sn") sn: String): BaseResponse<VipRequest>
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.mogo.eagle.function.biz.v2x.vip.network
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.v2x.VipRequest
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.commons.constants.HostConst.DATA_SERVICE_HOST
|
||||
|
||||
|
||||
class VipNetWorkModel {
|
||||
|
||||
private fun getNetWorkApi(baseUrl: String = DATA_SERVICE_HOST): VipApiService {
|
||||
private fun getNetWorkApi(baseUrl: String = HostConst.getEagleHost()): VipApiService {
|
||||
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
|
||||
.create(VipApiService::class.java)
|
||||
}
|
||||
|
||||
@@ -61,13 +61,11 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:mogo-core-res')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -44,7 +44,7 @@ MogoObuManager.getInstance().init(Context context);
|
||||
```
|
||||
## 连接
|
||||
```java
|
||||
//默认192.168.8.199
|
||||
//默认192.168.1.199
|
||||
MogoObuManager.getInstance().connect();
|
||||
//自定义 IP
|
||||
MogoObuManager.getInstance().connect(String ip);
|
||||
|
||||
@@ -60,17 +60,14 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
} else {
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ 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 {
|
||||
@@ -14,9 +16,15 @@ class DataCenterProvider: IDataCenterProvider {
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -720,7 +721,20 @@ class MoGoAutopilotControlProvider :
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -526,16 +526,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU预警事件
|
||||
*
|
||||
* @param header 头
|
||||
* @param obuWarningData 数据
|
||||
*/
|
||||
override fun onObuWarningData(header: MessagePad.Header?, obuWarningData: ObuWarningEvent.ObuWarningData?) {
|
||||
CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData)
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU 红绿灯预警信息
|
||||
*
|
||||
|
||||
@@ -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.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
|
||||
@@ -6,16 +6,20 @@ 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.CallerChassisLocationGCJ20ListenerManager
|
||||
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.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.support.obu.model.MogoObuHvBasicsData
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
@@ -25,6 +29,7 @@ import mogo.telematics.pad.MessagePad
|
||||
*/
|
||||
object MoGoLocationDispatcher :
|
||||
IMoGoChassisGnssListener,
|
||||
IMoGoObuLocationWGS84Listener,
|
||||
AMapLocationListener {
|
||||
|
||||
private val TAG = "MoGoLocationManager"
|
||||
@@ -37,6 +42,11 @@ object MoGoLocationDispatcher :
|
||||
*/
|
||||
private var lastGnssLocation: MogoLocation = MogoLocation()
|
||||
|
||||
/**
|
||||
* 最后一次OBU GNSS 返回更新的位置
|
||||
*/
|
||||
private var lastOBULocation: MogoLocation = MogoLocation()
|
||||
|
||||
/**
|
||||
* 最后一次高德定位返回的位置信息
|
||||
*/
|
||||
@@ -69,6 +79,7 @@ object MoGoLocationDispatcher :
|
||||
|
||||
// 初始化监听订阅工控机位置信息
|
||||
CallerChassisGnssListenerManager.addListener(TAG, this)
|
||||
CallerObuLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) {
|
||||
@@ -77,6 +88,11 @@ object MoGoLocationDispatcher :
|
||||
lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
// 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等
|
||||
mapLocation?.let {
|
||||
//agps 高德
|
||||
//agps_rtk 高德-高精
|
||||
lastGnssLocation.locType = 1000 // 定位类型为WGS84进行转译的坐标
|
||||
lastGnssLocation.satellite = 4
|
||||
|
||||
lastGnssLocation.cityName = it.city
|
||||
lastGnssLocation.cityCode = it.cityCode
|
||||
lastGnssLocation.provider = it.provider
|
||||
@@ -95,17 +111,19 @@ object MoGoLocationDispatcher :
|
||||
lastGnssLocation.errorCode = it.errorCode
|
||||
lastGnssLocation.errorInfo = it.errorInfo
|
||||
}
|
||||
|
||||
// WGS84坐标系高精度位置信息
|
||||
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
|
||||
lastGnssLocation,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
// GCJ02高德坐标系位置信息
|
||||
CallerChassisLocationGCJ20ListenerManager.invokeChassisLocationGCJ02(
|
||||
lastGnssLocation,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
//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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +133,7 @@ object MoGoLocationDispatcher :
|
||||
override fun onLocationChanged(aMapLocation: AMapLocation) {
|
||||
mapLocation = aMapLocation
|
||||
// 更新GNSS 信息
|
||||
|
||||
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
|
||||
// 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等
|
||||
mapLocation?.let {
|
||||
@@ -131,6 +149,9 @@ object MoGoLocationDispatcher :
|
||||
lastGaoDeLocation.satelliteTime = it.time
|
||||
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
|
||||
lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位)
|
||||
lastGaoDeLocation.satellite = 4
|
||||
|
||||
lastGaoDeLocation.cityName = it.city
|
||||
lastGaoDeLocation.cityCode = it.cityCode
|
||||
lastGaoDeLocation.provider = it.provider
|
||||
@@ -151,26 +172,104 @@ object MoGoLocationDispatcher :
|
||||
}
|
||||
|
||||
// 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换
|
||||
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 30000) {
|
||||
// WGS84坐标系高精度位置信息
|
||||
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
|
||||
lastGaoDeLocation,
|
||||
DataSourceType.MAP
|
||||
)
|
||||
// GCJ02高德坐标系位置信息
|
||||
CallerChassisLocationGCJ20ListenerManager.invokeChassisLocationGCJ02(
|
||||
lastGaoDeLocation,
|
||||
DataSourceType.MAP
|
||||
)
|
||||
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 {
|
||||
//agps 高德
|
||||
//agps_rtk 高德-高精
|
||||
lastOBULocation.locType = 1000 // 定位类型为WGS84进行转译的坐标
|
||||
lastOBULocation.satellite = 4
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,7 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
private val TAG = "MoGoObuProvider"
|
||||
|
||||
private var mContext: Context? = null
|
||||
private val busObuIp = "192.168.8.199"
|
||||
private val taxiObuIp = "192.168.1.199"
|
||||
private val taxiObuIp = "192.168.1.199" //obu的taxi和bus的ip已经全部统一成1网段ip
|
||||
|
||||
override val functionName: String
|
||||
get() = TAG
|
||||
@@ -37,35 +36,16 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
MogoObuDcCombineManager.INSTANCE.init(context)
|
||||
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
|
||||
|
||||
//bus乘客版本obu功能去掉
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
//不处理
|
||||
} else {
|
||||
mContext = context
|
||||
mContext?.let {
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //bus 司机端
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, busObuIp)
|
||||
|
||||
//mogo obu
|
||||
MogoPrivateObuNewManager.INSTANCE.connectObu(
|
||||
it,
|
||||
ipAddress,
|
||||
CommonUtils.getIpAddressString()
|
||||
)
|
||||
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
|
||||
//mogo obu
|
||||
MogoPrivateObuNewManager.INSTANCE.connectObu(
|
||||
it,
|
||||
ipAddress,
|
||||
CommonUtils.getIpAddressString()
|
||||
)
|
||||
}
|
||||
}
|
||||
//bus乘客版本obu功能去掉,大理项目需要全部车辆接收,不在限制
|
||||
mContext = context
|
||||
mContext?.let {
|
||||
val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
|
||||
//mogo obu
|
||||
MogoPrivateObuNewManager.INSTANCE.connectObu(
|
||||
it,
|
||||
ipAddress,
|
||||
CommonUtils.getIpAddressString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ 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.obu.IMoGoObuWarningMapListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener
|
||||
@@ -21,13 +20,12 @@ 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.trafficlight.CallerTrafficLightListenerManager
|
||||
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 kotlin.math.roundToInt
|
||||
|
||||
|
||||
@@ -258,8 +256,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
when (status) {
|
||||
// 添加
|
||||
MogoObuConstants.STATUS.ADD -> {
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
@@ -275,13 +271,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
CallerHmiManager.warningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
}
|
||||
}
|
||||
ttsContent, null, direction
|
||||
)
|
||||
|
||||
// 更新数据,是否需要
|
||||
@@ -297,7 +287,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 更新数据,删除标牌?
|
||||
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
|
||||
// ?.let {
|
||||
@@ -345,24 +335,20 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
|
||||
CallerLogger.d(
|
||||
"${M_OBU}${TAG}",
|
||||
"MogoObuDcCombineManager onMogoObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${
|
||||
rsmWarningData.warningMsg.warningDataList.get(
|
||||
0
|
||||
).status
|
||||
"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
|
||||
@@ -371,15 +357,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
CallerHmiManager.warningV2X(
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(
|
||||
WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
)
|
||||
}
|
||||
}
|
||||
ttsContent,
|
||||
null,
|
||||
direction
|
||||
)
|
||||
|
||||
// 更新数据 TODO
|
||||
@@ -396,7 +376,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
// 更新数据 TODO 由于obu通过域控需要转换单位,这里临时转换,后面3.0不需要转换
|
||||
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
|
||||
// // 事件结束,还原交通参与者颜色
|
||||
@@ -451,8 +431,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
|
||||
)
|
||||
when (data.status) {
|
||||
MogoObuConstants.STATUS.ADD -> { // 添加
|
||||
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
|
||||
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
|
||||
CallerLimitingVelocityListenerManager.invokeUnion(
|
||||
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
|
||||
DataSourceType.OBU
|
||||
)
|
||||
@@ -462,7 +442,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
}
|
||||
|
||||
MogoObuConstants.STATUS.DELETE -> { // 删除
|
||||
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
|
||||
CallerLimitingVelocityListenerManager.invokeUnion(
|
||||
-1,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
@@ -637,7 +617,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
sourceType = DataSourceType.TELEMATIC
|
||||
}
|
||||
)
|
||||
|
||||
CallerHmiManager.warningV2X(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
alertContent,
|
||||
@@ -651,40 +630,38 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
when (currentLight.light) {
|
||||
// 灯光不可用
|
||||
0 -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.BLACK,
|
||||
-1,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
}
|
||||
|
||||
// 红灯
|
||||
2, 3 -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
val red = (currentLight.countDown / 10).toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.RED,
|
||||
red,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
val red = currentLight.countDown / 10
|
||||
CallerTrafficLightListenerManager.changeCountdownRed(red.toInt())
|
||||
}
|
||||
|
||||
// 绿灯
|
||||
4, 5, 6 -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
val green = (currentLight.countDown / 10).toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.GREEN,
|
||||
green,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
val green = currentLight.countDown / 10
|
||||
CallerTrafficLightListenerManager.changeCountdownGreen(green.toInt())
|
||||
}
|
||||
|
||||
// 黄灯
|
||||
7, 8 -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
val yellow = (currentLight.countDown / 10).toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.YELLOW,
|
||||
yellow,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
val yellow = currentLight.countDown / 10
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(yellow.toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,12 +387,7 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
}
|
||||
}
|
||||
null, direction
|
||||
)
|
||||
|
||||
// 更新数据
|
||||
@@ -551,8 +523,6 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
|
||||
return
|
||||
}
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
@@ -570,14 +540,7 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(
|
||||
WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
)
|
||||
}
|
||||
}
|
||||
null, direction
|
||||
)
|
||||
}
|
||||
|
||||
@@ -586,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())
|
||||
@@ -612,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
|
||||
)
|
||||
}
|
||||
@@ -624,7 +587,7 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
|
||||
MogoObuConstants.STATUS.DELETE -> { // 删除
|
||||
UiThreadHandler.post {
|
||||
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
|
||||
CallerLimitingVelocityListenerManager.invokeUnion(
|
||||
-1,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
@@ -635,198 +598,368 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消息的方位 车辆相关
|
||||
*/
|
||||
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
|
||||
// CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification")
|
||||
return when (targetClassification) {
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
|
||||
/**
|
||||
* 获取消息的方位 车辆相关
|
||||
*/
|
||||
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
|
||||
// CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification")
|
||||
return when (targetClassification) {
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
|
||||
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
|
||||
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
|
||||
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
|
||||
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
|
||||
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
|
||||
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
|
||||
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
|
||||
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
|
||||
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
|
||||
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
|
||||
|
||||
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
|
||||
else -> WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
|
||||
else -> WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示
|
||||
*
|
||||
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截
|
||||
*
|
||||
* @see com.mogo.module.common.enums.EventTypeEnum
|
||||
*/
|
||||
private fun handleSdkObu(
|
||||
appId: String,
|
||||
direction: WarningDirectionEnum,
|
||||
status: Int,
|
||||
level: Int,
|
||||
info: MogoObuRvWarningData
|
||||
) {
|
||||
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的
|
||||
var alertContent: String = ""
|
||||
var ttsContent: String = ""
|
||||
var changeVisualAngle = false
|
||||
when (appId) {
|
||||
//交叉路口碰撞预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
|
||||
}
|
||||
|
||||
//交叉路口碰撞预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
|
||||
}
|
||||
|
||||
//左转辅助预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
|
||||
}
|
||||
|
||||
//盲区预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> {
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
|
||||
if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
) { //左后
|
||||
changeVisualAngle = true
|
||||
ttsContent = String.format(ttsContent, "左")
|
||||
alertContent = String.format(alertContent, "左")
|
||||
} else if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
) { //右后
|
||||
changeVisualAngle = true
|
||||
ttsContent = String.format(ttsContent, "右")
|
||||
alertContent = String.format(alertContent, "右")
|
||||
}
|
||||
}
|
||||
|
||||
// 变道预警,注意左后车辆/注意右后车辆
|
||||
MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
|
||||
if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "左")
|
||||
alertContent = String.format(alertContent, "左")
|
||||
} else if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "右")
|
||||
alertContent = String.format(alertContent, "右")
|
||||
}
|
||||
}
|
||||
|
||||
//逆向超车预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
|
||||
}
|
||||
|
||||
//紧急制动预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
|
||||
}
|
||||
|
||||
//异常车辆提醒
|
||||
MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
|
||||
alertContent = String.format(alertContent, direction.desc)
|
||||
ttsContent = String.format(ttsContent, direction.desc)
|
||||
}
|
||||
|
||||
//车辆失控预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
|
||||
alertContent = String.format(alertContent, direction.desc)
|
||||
ttsContent = String.format(ttsContent, direction.desc)
|
||||
}
|
||||
//车辆失控预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
|
||||
}
|
||||
|
||||
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
|
||||
else -> { //TODO
|
||||
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
|
||||
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示
|
||||
*
|
||||
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截
|
||||
*
|
||||
* @see com.mogo.module.common.enums.EventTypeEnum
|
||||
*/
|
||||
private fun handleSdkObu(
|
||||
appId: String,
|
||||
direction: WarningDirectionEnum,
|
||||
status: Int,
|
||||
level: Int,
|
||||
info: MogoObuRvWarningData
|
||||
) {
|
||||
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的
|
||||
var alertContent: String = ""
|
||||
var ttsContent: String = ""
|
||||
var changeVisualAngle = false
|
||||
when (appId) {
|
||||
//交叉路口碰撞预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
|
||||
}
|
||||
when (status) {
|
||||
// 添加,更新 add的时候,可能级别是2,
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE -> {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
//不显示弹框,其它保留
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent
|
||||
)
|
||||
).apply {
|
||||
sourceType = DataSourceType.OBU
|
||||
}
|
||||
)
|
||||
CallerHmiManager.warningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
super.onShow()
|
||||
if (changeVisualAngle) {
|
||||
CallerVisualAngleManager.changeVisualAngle(TooClose)
|
||||
}
|
||||
}
|
||||
|
||||
//交叉路口碰撞预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
|
||||
override fun onDismiss() {
|
||||
if (changeVisualAngle) {
|
||||
CallerVisualAngleManager.changeVisualAngle(Default())
|
||||
}
|
||||
}
|
||||
}, direction
|
||||
)
|
||||
}
|
||||
|
||||
//左转辅助预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
|
||||
}
|
||||
|
||||
//盲区预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> {
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
|
||||
if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
) { //左后
|
||||
changeVisualAngle = true
|
||||
ttsContent = String.format(ttsContent, "左")
|
||||
alertContent = String.format(alertContent, "左")
|
||||
} else if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
) { //右后
|
||||
changeVisualAngle = true
|
||||
ttsContent = String.format(ttsContent, "右")
|
||||
alertContent = String.format(alertContent, "右")
|
||||
}
|
||||
}
|
||||
|
||||
// 变道预警,注意左后车辆/注意右后车辆
|
||||
MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
|
||||
if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "左")
|
||||
alertContent = String.format(alertContent, "左")
|
||||
} else if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "右")
|
||||
alertContent = String.format(alertContent, "右")
|
||||
}
|
||||
}
|
||||
|
||||
//逆向超车预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
|
||||
}
|
||||
|
||||
//紧急制动预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
|
||||
}
|
||||
|
||||
//异常车辆提醒
|
||||
MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
|
||||
alertContent = String.format(alertContent, direction.desc)
|
||||
ttsContent = String.format(ttsContent, direction.desc)
|
||||
}
|
||||
|
||||
//车辆失控预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
|
||||
alertContent = String.format(alertContent, direction.desc)
|
||||
ttsContent = String.format(ttsContent, direction.desc)
|
||||
}
|
||||
//车辆失控预警
|
||||
MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> {
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
|
||||
}
|
||||
|
||||
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
|
||||
else -> { //TODO
|
||||
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
|
||||
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了
|
||||
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
it.threatLevel = 0x01
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when (status) {
|
||||
// 添加,更新 add的时候,可能级别是2,
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE -> {
|
||||
/**
|
||||
* 处理红绿灯
|
||||
*/
|
||||
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>) {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
|
||||
)
|
||||
when (status) {
|
||||
// 添加
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE
|
||||
-> {
|
||||
if (lights != null && lights.isNotEmpty()) {
|
||||
changeTrafficLightStatus(appId, lights)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
isShowGreenWave = false
|
||||
isShowRunRedLight = false
|
||||
// lightCountDownRed = 1
|
||||
// lightCountDownGreen = 1
|
||||
// lightCountDownYellow = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var isShowGreenWave = false
|
||||
private var isShowRunRedLight = false
|
||||
|
||||
|
||||
/**
|
||||
* 修改红绿灯
|
||||
*/
|
||||
@Synchronized
|
||||
private fun changeTrafficLightStatus(
|
||||
appId: Int,
|
||||
lights: List<SpatLight>
|
||||
) {
|
||||
var ttsContent = ""
|
||||
var alertContent = ""
|
||||
//这里需要根据真实数据确定 index 取值方式
|
||||
val currentLight = lights[0]
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}"
|
||||
)
|
||||
// 闯红灯预警,绿波通行和闯红灯是互斥的
|
||||
when (appId) {
|
||||
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
|
||||
|
||||
}
|
||||
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
"changeTrafficLightStatus 闯红灯 --------> "
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
//不显示弹框,其它保留
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent
|
||||
)
|
||||
).apply {
|
||||
sourceType = DataSourceType.OBU
|
||||
}
|
||||
)
|
||||
|
||||
CallerHmiManager.warningV2X(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
|
||||
if (!isShowGreenWave) {
|
||||
isShowGreenWave = true
|
||||
|
||||
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
|
||||
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
|
||||
if (minSpeedTemp == maxSpeedTemp) {
|
||||
minSpeedTemp -= 5
|
||||
}
|
||||
|
||||
val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
|
||||
val adviceSpeedTts = "$minSpeedTemp 到 $maxSpeedTemp"
|
||||
|
||||
// val adviceSpeed =
|
||||
// "${Math.round(currentLight.suggestMinSpeed*3.6)} - ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
|
||||
// val adviceSpeedTts =
|
||||
// "${Math.round(currentLight.suggestMinSpeed*3.6)} 到 ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
|
||||
|
||||
ttsContent =
|
||||
String.format(
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
|
||||
adviceSpeedTts
|
||||
)
|
||||
alertContent =
|
||||
String.format(
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
|
||||
adviceSpeed
|
||||
)
|
||||
|
||||
val maxSpeed = currentLight.suggestMaxSpeed
|
||||
if (maxSpeed > 0) {
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
appId,
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
alertContent,
|
||||
ttsContent
|
||||
)
|
||||
@@ -835,205 +968,50 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
}
|
||||
)
|
||||
CallerHmiManager.warningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
super.onShow()
|
||||
if (changeVisualAngle) {
|
||||
CallerVisualAngleManager.changeVisualAngle(TooClose)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
if (changeVisualAngle) {
|
||||
CallerVisualAngleManager.changeVisualAngle(Default())
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
}
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了
|
||||
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 移除顶部弹窗
|
||||
// CallerHmiManager.disableWarningV2X((appId + direction.direction))
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
it.threatLevel = 0x01
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理红绿灯
|
||||
*/
|
||||
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>) {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
|
||||
)
|
||||
when (status) {
|
||||
// 添加
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE
|
||||
-> {
|
||||
if (lights != null && lights.isNotEmpty()) {
|
||||
changeTrafficLightStatus(appId, lights)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
isShowGreenWave = false
|
||||
isShowRunRedLight = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var isYellowLight = false
|
||||
private var isShowGreenWave = false
|
||||
private var isShowRunRedLight = false
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改红绿灯
|
||||
*/
|
||||
@Synchronized
|
||||
private fun changeTrafficLightStatus(
|
||||
appId: Int,
|
||||
lights: List<SpatLight>
|
||||
) {
|
||||
var ttsContent = ""
|
||||
var alertContent = ""
|
||||
//这里需要根据真实数据确定 index 取值方式
|
||||
val currentLight = lights[0]
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}"
|
||||
)
|
||||
// 闯红灯预警,绿波通行和闯红灯是互斥的
|
||||
when (appId) {
|
||||
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
|
||||
|
||||
}
|
||||
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"changeTrafficLightStatus 闯红灯 --------> "
|
||||
)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
alertContent,
|
||||
ttsContent
|
||||
)
|
||||
).apply {
|
||||
sourceType = DataSourceType.OBU
|
||||
}
|
||||
)
|
||||
|
||||
CallerHmiManager.warningV2X(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
alertContent,
|
||||
ttsContent// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
|
||||
if (!isShowGreenWave) {
|
||||
isShowGreenWave = true
|
||||
|
||||
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
|
||||
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
|
||||
if (minSpeedTemp == maxSpeedTemp) {
|
||||
minSpeedTemp -= 5
|
||||
}
|
||||
|
||||
val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
|
||||
val adviceSpeedTts = "$minSpeedTemp 到 $maxSpeedTemp"
|
||||
|
||||
ttsContent =
|
||||
String.format(
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
|
||||
adviceSpeedTts
|
||||
)
|
||||
alertContent =
|
||||
String.format(
|
||||
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
|
||||
adviceSpeed
|
||||
)
|
||||
|
||||
val maxSpeed = currentLight.suggestMaxSpeed
|
||||
if (maxSpeed > 0) {
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
alertContent,
|
||||
ttsContent
|
||||
)
|
||||
).apply {
|
||||
sourceType = DataSourceType.OBU
|
||||
}
|
||||
)
|
||||
|
||||
CallerHmiManager.warningV2X(
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
|
||||
alertContent,
|
||||
ttsContent// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when (currentLight.light) {
|
||||
// 灯光不可用
|
||||
0 -> {
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.BLACK)
|
||||
}
|
||||
// 红灯
|
||||
2, 3 -> {
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.RED)
|
||||
}
|
||||
|
||||
// 绿灯
|
||||
4, 5, 6 -> {
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.GREEN)
|
||||
}
|
||||
|
||||
// 黄灯
|
||||
7, 8 -> {
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.YELLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when (currentLight.light) {
|
||||
// 灯光不可用
|
||||
0 -> {
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.BLACK,
|
||||
-1,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
}
|
||||
// 红灯
|
||||
2, 3 -> {
|
||||
val red = currentLight.countDown.toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.RED,
|
||||
red,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
}
|
||||
// 绿灯
|
||||
4, 5, 6 -> {
|
||||
val green = currentLight.countDown.toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.GREEN,
|
||||
green,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
}
|
||||
// 黄灯
|
||||
7, 8 -> {
|
||||
val yellow = currentLight.countDown.toInt()
|
||||
CallerTrafficLightListenerManager.invokeTrafficLightPlusSource(
|
||||
TrafficLightEnum.YELLOW,
|
||||
yellow,
|
||||
DataSourceType.OBU
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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)
|
||||
@@ -88,14 +88,11 @@ dependencies {
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
}else {
|
||||
implementation project(':foudations:mogo-aicloud-services-sdk')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-res')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
@@ -123,6 +148,10 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
upgradeManager.downLoadPackage(mContext!!, downloadKey, downloadUrl)
|
||||
}
|
||||
|
||||
override fun updateUpgradeProgress() {
|
||||
upgradeManager.updateUpgradeProgress(mContext!!)
|
||||
}
|
||||
|
||||
override fun showStatusBar(ctx: Context, container: ViewGroup) {
|
||||
StatusManager.init(ctx)
|
||||
StatusManager.show(container)
|
||||
@@ -148,6 +177,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)
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import retrofit2.http.*
|
||||
internal interface BadCaseApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-vehicle-management-service/tool/badcase/add/v2")
|
||||
@POST("eagle-eye-dns/yycp-vehicle-management-service/tool/badcase/add/v2")
|
||||
suspend fun post(@FieldMap map: Map<String, String>): Response<UploadResult>
|
||||
|
||||
@GET("/yycp-vehicle-management-service/tool/badcase/reasons")
|
||||
@GET("eagle-eye-dns/yycp-vehicle-management-service/tool/badcase/reasons")
|
||||
suspend fun get(@Query("channel", encoded = true) channel: String, @Query("pageNo") pageNo: Int): Response<BadCaseResponse>
|
||||
}
|
||||
@@ -17,6 +17,7 @@ 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.storage.SharedPrefsMgr
|
||||
import com.zhjt.mogo_core_function_devatools.upgrade.IPCUpgradeManager.Companion.ipcUpgradeManager
|
||||
import com.zhjt.mogo_core_function_devatools.upgrade.ObuUpgradeAppNetWorkManager
|
||||
import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeAppNetWorkManager
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
@@ -160,4 +161,13 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
.getAppUpgradeInfo(mContext, mAddress, role.toString() + "")
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 司机屏 处理obu升级即可,乘客屏不需要处理 TODO OBU的角色
|
||||
*
|
||||
*/
|
||||
fun queryObuUpgrade() {
|
||||
ObuUpgradeAppNetWorkManager.getInstance().getObuUpgradeInfo(mContext, mAddress, role.toString() + "")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ 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.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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 -> "未知"
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.updateMfStatusView
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager.invokeMoFangStatus
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_F
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
@@ -96,7 +96,7 @@ class MoFangManager private constructor() {
|
||||
BluetoothDevice.ACTION_ACL_CONNECTED -> { //蓝牙设备已连接
|
||||
if (!isMfConnect) {
|
||||
// showBondedDevice(mBluetoothAdapter)
|
||||
updateMfStatusView(TAG, true)
|
||||
invokeMoFangStatus(true)
|
||||
isMfConnect = true
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean(MfConstants.BLUETOOTH_STATUS, true) }
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class MoFangManager private constructor() {
|
||||
BluetoothDevice.ACTION_ACL_DISCONNECTED -> { //蓝牙设备已断开 主动更新
|
||||
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_ACL_DISCONNECTED ----- isMfConnect = $isMfConnect ")
|
||||
if (isMfConnect) {
|
||||
updateMfStatusView(TAG, false)
|
||||
invokeMoFangStatus(false)
|
||||
isMfConnect = false
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean(MfConstants.BLUETOOTH_STATUS, false) }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.zhjt.mogo_core_function_devatools.upgrade;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BINDING;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.constants.HostConst;
|
||||
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 获取obu升级信息
|
||||
* @since: 3/25/22
|
||||
*/
|
||||
public class ObuUpgradeAppNetWorkManager {
|
||||
private static volatile ObuUpgradeAppNetWorkManager requestNoticeManager;
|
||||
private final UpgradeApiService mUpgradeApiService;
|
||||
private static final String TAG = "ObuUpgrade";
|
||||
|
||||
private ObuUpgradeAppNetWorkManager() {
|
||||
mUpgradeApiService = MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(UpgradeApiService.class);
|
||||
}
|
||||
|
||||
public static ObuUpgradeAppNetWorkManager getInstance() {
|
||||
if (requestNoticeManager == null) {
|
||||
synchronized (ObuUpgradeAppNetWorkManager.class) {
|
||||
if (requestNoticeManager == null) {
|
||||
requestNoticeManager = new ObuUpgradeAppNetWorkManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return requestNoticeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取obu升级信息
|
||||
* mac :工控机mac地址
|
||||
* screenType : 类型
|
||||
*/
|
||||
public void getObuUpgradeInfo(Context context, String mac, String screenType) {
|
||||
// String sn = "X20202203105S688HZ";
|
||||
// String mac = "48:b0:2d:3a:bc:78";
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
int versionCode = AppUtils.getAppVersionCode();
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mUpgradeApiService.getUpgradeInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UpgradeAppInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull UpgradeAppInfo info) {
|
||||
if (info != null && info.result != null) {
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode() + "--versionCode =" + versionCode + "--info.result = " + info.result);
|
||||
if (info.result.getVersionCode() > versionCode) {
|
||||
CallerHmiManager.INSTANCE.showUpgradeDialog(info.result.getAppUrl().substring(info.result.getAppUrl().lastIndexOf("/")+1), info.result.getAppUrl(), info.result.getInstallTitle(), info.result.getInstallContent(), info.result.getInstallType());
|
||||
}
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo onNext info == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.zhjt.mogo_core_function_devatools.upgrade
|
||||
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.updateStatusBarDownloadView
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.Config
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
|
||||
@@ -110,4 +115,36 @@ class UpgradeManager : IDownload {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateUpgradeProgress(context: Context) {
|
||||
val builder = NotificationCompat.Builder(context)
|
||||
// builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系
|
||||
builder.setContentTitle("下载")
|
||||
builder.setContentText("正在下载")
|
||||
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
CallerDevaToolsUpgradeListenerManager.addListener(
|
||||
TAG,
|
||||
object : IMogoDevaToolsUpgradeListener {
|
||||
override fun onStart(url: String?) {}
|
||||
override fun onPause(url: String?) {}
|
||||
override fun onProgress(url: String?, length: Int) {
|
||||
builder.setProgress(100, length, false)
|
||||
manager.notify(0x3, builder.build())
|
||||
//下载进度提示
|
||||
builder.setContentText("已下载$length%")
|
||||
updateStatusBarDownloadView(true, "download", length)
|
||||
}
|
||||
|
||||
override fun onFinished(url: String?) {
|
||||
builder.setContentText("已下载" + 100 + "%")
|
||||
UiThreadHandler.postDelayed({
|
||||
manager.cancel(0x3)
|
||||
updateStatusBarDownloadView(false, "download", 100)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun onError(url: String?, errorMsg: String?) {}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,39 +78,22 @@ 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
|
||||
|
||||
compileOnly rootProject.ext.dependencies.mogocommons
|
||||
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.mogo_core_utils
|
||||
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')
|
||||
|
||||
compileOnly project(':core:function-impl:mogo-core-function-datacenter')
|
||||
compileOnly project(':foudations:mogo-commons')
|
||||
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:mogo-core-utils')
|
||||
compileOnly project(':core:mogo-core-function-call')
|
||||
compileOnly project(':libraries:mogo-adas')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.eagle.core.function.hmi">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
|
||||
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
|
||||
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
@@ -39,10 +56,11 @@
|
||||
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
|
||||
android:enabled="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTop"
|
||||
android:resizeableActivity="false"
|
||||
android:resumeWhilePausing="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:screenOrientation="${SCREEN_ORIENTATION}"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/Main"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden">
|
||||
@@ -67,7 +85,6 @@
|
||||
|
||||
<activity
|
||||
android:name="com.mogo.eagle.core.function.main.PassengerLauncherActivity"
|
||||
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
@@ -99,7 +116,6 @@
|
||||
|
||||
<activity
|
||||
android:name="com.mogo.eagle.core.function.main.VideoAdAtc"
|
||||
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
@@ -121,6 +137,16 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mogo.eagle.core.function.main.AppListActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask">
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN"/>-->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER"/>-->
|
||||
<!-- </intent-filter>-->
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="MAP_SDK_VERSION111111"
|
||||
android:value="${MAP_SDK_VERSION}" />
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框
|
||||
@@ -77,7 +77,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
|
||||
ttsContent: 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为空!")
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,14 @@ 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.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.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
|
||||
@@ -26,10 +22,8 @@ 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.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
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
|
||||
@@ -42,15 +36,12 @@ 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.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.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.android.synthetic.main.fragment_hmi.*
|
||||
import kotlinx.coroutines.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
@@ -59,36 +50,19 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
* @date 2021/8/3 2:40 下午
|
||||
* 预警图层
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
|
||||
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
IMoGoHmiProvider,
|
||||
MoGoHmiContract.View {
|
||||
@Route(path = PATH_FRAGMENT_HMI)
|
||||
class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MoGoHmiFragment"
|
||||
private const val TAG = "MoGoHmiProvider"
|
||||
}
|
||||
|
||||
private val lastSpeakJob by lazy { AtomicReference<Job>() }
|
||||
private var lastShowV2XJob: Job? = null
|
||||
private var context: Context? = null
|
||||
|
||||
override fun initViews() {
|
||||
}
|
||||
|
||||
override fun showIPCReportWindow(
|
||||
errorReportList: ArrayList<ReportEntity>,
|
||||
warningReportList: ArrayList<ReportEntity>,
|
||||
reportLevel: Int
|
||||
) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (reportLevel == 1) {
|
||||
IPCReportWindow.show(
|
||||
requireContext(),
|
||||
errorReportList,
|
||||
warningReportList,
|
||||
reportLevel
|
||||
)
|
||||
}
|
||||
}
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
override fun setStatusBarDarkOrLight(light: Boolean) {
|
||||
@@ -97,52 +71,22 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
|
||||
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
CallerHmiViewControlListenerManager.updateStatusBarRightView(
|
||||
StatusBarView.TAG,
|
||||
insert,
|
||||
tag,
|
||||
viewGroup
|
||||
StatusBarView.TAG, insert, tag, viewGroup
|
||||
)
|
||||
}
|
||||
|
||||
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
CallerHmiViewControlListenerManager.updateStatusBarLeftView(
|
||||
StatusBarView.TAG,
|
||||
insert,
|
||||
tag,
|
||||
viewGroup
|
||||
StatusBarView.TAG, insert, tag, viewGroup
|
||||
)
|
||||
}
|
||||
|
||||
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
|
||||
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(
|
||||
StatusBarView.TAG,
|
||||
insert,
|
||||
tag,
|
||||
progress
|
||||
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----------------------------------------------- **/
|
||||
/**
|
||||
* 不展示顶部弹窗,其它保留
|
||||
*/
|
||||
@@ -152,32 +96,31 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
alertContent: CharSequence?,
|
||||
ttsContent: String?,
|
||||
listener: IMoGoWarningStatusListener?,
|
||||
playTts: Boolean,
|
||||
direction: WarningDirectionEnum,
|
||||
expireTime: Long
|
||||
) {
|
||||
val playTTS =
|
||||
playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
activity?.let {
|
||||
val warningContent = alertContent
|
||||
?: EventTypeEnumNew.getWarningContent(v2xType)
|
||||
|
||||
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()
|
||||
lifecycleScope.launch {
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
|
||||
delay(expireTime)
|
||||
}.also { itx ->
|
||||
lastShowV2XJob = itx
|
||||
}.invokeOnCompletion {
|
||||
listener?.onDismiss()
|
||||
dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
CallerV2XWarningListenerManager.dismiss()
|
||||
}
|
||||
|
||||
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
|
||||
@@ -185,7 +128,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
if (last != null && !last.isCompleted) {
|
||||
return
|
||||
}
|
||||
lifecycleScope.launch(Dispatchers.Default) {
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
|
||||
speak(it, ttsContent)
|
||||
}.also { itx ->
|
||||
lastSpeakJob.set(itx)
|
||||
@@ -217,38 +160,35 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun showWarning(direction: WarningDirectionEnum) {
|
||||
CallerLogger.d(TAG, "showWarning====")
|
||||
flV2XWarningView?.showWarning(direction)
|
||||
}
|
||||
|
||||
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
flV2XWarningView?.showWarning(direction, closeTime)
|
||||
override fun showWarning(v2xType: String, direction: WarningDirectionEnum, expireTime: Long) {
|
||||
CallerV2XWarningListenerManager.show(v2xType, direction, expireTime)
|
||||
}
|
||||
|
||||
override fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
flV2XWarningView?.dismissWarning(direction)
|
||||
CallerV2XWarningListenerManager.dismiss(direction)
|
||||
}
|
||||
|
||||
/** todo----------------------------------------------- **/
|
||||
|
||||
override fun showDispatchDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
|
||||
context?.let {
|
||||
DispatchDialogManager.getInstance(it).showDialog(msgData)
|
||||
ThreadUtils.runOnUiThread {
|
||||
context?.let {
|
||||
DispatchDialogManager.getInstance(it).showDialog(msgData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismissDispatchDialog() {
|
||||
context?.let {
|
||||
DispatchDialogManager.getInstance(it).releaseDialog()
|
||||
ThreadUtils.runOnUiThread {
|
||||
context?.let {
|
||||
DispatchDialogManager.getInstance(it).releaseDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) {
|
||||
trafficStylePushData?.let {
|
||||
override fun showNoticeForTrafficWithData(pushData: NoticeTrafficStylePushData?) {
|
||||
pushData?.let {
|
||||
ThreadUtils.runOnUiThread {
|
||||
context?.let { it ->
|
||||
NoticeTrafficDialog.show(it, trafficStylePushData)
|
||||
NoticeTrafficDialog.show(it, pushData)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,15 +229,29 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun showToBindingcarDialog() {
|
||||
if (ContextHolderUtil.getContext() != null) {
|
||||
ToBindingCarDialog.show(ContextHolderUtil.getContext())
|
||||
override fun showToBindingCarDialog() {
|
||||
if (context != null) {
|
||||
ToBindingCarDialog.show(context)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showModifyBindingcarDialog() {
|
||||
if (ContextHolderUtil.getContext() != null) {
|
||||
ModifyBindingCarDialog.show(ContextHolderUtil.getContext())
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,18 +262,17 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
content: String,
|
||||
installType: String
|
||||
) {
|
||||
if (ContextHolderUtil.getContext() != null) {
|
||||
if (context != null) {
|
||||
UpgradeAppDialog.show(
|
||||
ContextHolderUtil.getContext(),
|
||||
name, url, title, content, installType
|
||||
context, name, url, title, content, installType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showAdUpgradeDialog(images: List<String>, padSn: String, releaseId: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (ContextHolderUtil.getContext() != null) {
|
||||
AdUpgradeDialog.show(ContextHolderUtil.getContext(), images, padSn, releaseId)
|
||||
if (context != null) {
|
||||
AdUpgradeDialog.show(context, images, padSn, releaseId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,47 +283,4 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.*
|
||||
|
||||
|
||||
@@ -45,15 +45,12 @@ 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
|
||||
@@ -78,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
|
||||
@@ -234,7 +230,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
// 移除 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
// 移除 规划路径相关回调 监听
|
||||
@@ -524,10 +520,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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +535,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
if (isChecked) {
|
||||
CallerMoGoUiSettingManager.stepInDayMode()
|
||||
} else {
|
||||
CallerMoGoUiSettingManager.stepOutDayMode()
|
||||
CallerMoGoUiSettingManager.stepInNightMode()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,6 +629,33 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
tbV2NFromCar.isChecked = FunctionBuildConfig.isV2NFromCar
|
||||
//v2n车端预警
|
||||
tbV2NFromCar.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isV2NFromCar = isChecked
|
||||
if (!FunctionBuildConfig.isV2NFromCar) {
|
||||
tbV2NFromCar.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
tbDrawAiCloudFusion.isChecked = FunctionBuildConfig.isDrawAiCloudFusion
|
||||
//云端感知绘制
|
||||
tbDrawAiCloudFusion.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isDrawAiCloudFusion = isChecked
|
||||
if (!FunctionBuildConfig.isDrawAiCloudFusion) {
|
||||
tbDrawAiCloudFusion.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
tbDrawRomaMode.isChecked = FunctionBuildConfig.isRomaMode
|
||||
//roma
|
||||
tbDrawRomaMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isRomaMode = isChecked
|
||||
if (!FunctionBuildConfig.isRomaMode) {
|
||||
tbDrawRomaMode.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
//重启工控机所有节点
|
||||
btnIpcReboot.onClick {
|
||||
CallerAutoPilotControlManager.sendIpcReboot()
|
||||
@@ -741,7 +764,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)
|
||||
}
|
||||
|
||||
//设置点云大小
|
||||
@@ -752,7 +777,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
} else {
|
||||
try {
|
||||
val cloudSizeFloat = cloudSize.toFloat()
|
||||
CallerHDMapManager.setPointCloudSize(cloudSizeFloat)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setPointCloudSize(cloudSizeFloat)
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.showShort("点云大小格式输入不正确")
|
||||
}
|
||||
@@ -765,7 +790,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
ToastUtils.showShort("请输入正确的点云颜色")
|
||||
} else {
|
||||
try {
|
||||
CallerHDMapManager.setPointCloudColor(cloudColor)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setPointCloudColor(cloudColor)
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.showShort("点云大小颜色输入不正确")
|
||||
}
|
||||
@@ -931,7 +956,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)
|
||||
@@ -945,19 +970,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")
|
||||
}
|
||||
@@ -1042,44 +1067,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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1108,17 +1123,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 {
|
||||
@@ -1225,7 +1232,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
* 设置是否输出高精地图日志 true-打印日志,false-不打印日志
|
||||
*/
|
||||
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerHDMapManager.setDebugMode(isChecked)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setDebugMode(isChecked)
|
||||
}
|
||||
|
||||
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()
|
||||
|
||||
@@ -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.*
|
||||
@@ -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)
|
||||
}
|
||||
@@ -189,11 +175,7 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
tbObu.isChecked = CallerObuApiManager.isConnected()
|
||||
tbObu.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.1.199")
|
||||
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.8.199")
|
||||
}
|
||||
CallerObuApiManager.resetObuIpAddress("192.168.1.199")
|
||||
} else {
|
||||
//断开链接
|
||||
CallerObuApiManager.disConnectObu()
|
||||
|
||||
@@ -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
|
||||
@@ -77,8 +77,11 @@ class PncActionsView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
var actions: String? = null
|
||||
planningActionMsg.actionMsg?.let { it ->
|
||||
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
|
||||
|
||||
try {
|
||||
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
|
||||
} catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
|
||||
&& mTrafficLightResult != null
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,13 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
|
||||
/**
|
||||
* 魔戒蓝牙控件
|
||||
@@ -14,10 +20,38 @@ class BlueToothView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr) {
|
||||
) : RelativeLayout(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
|
||||
|
||||
companion object{
|
||||
private const val TAG = "BlueToothView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_blue_tooth, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val isBluetoothConnect =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
|
||||
if (isBluetoothConnect) {
|
||||
mofangStatus(true)
|
||||
}
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun mofangStatus(status: Boolean) {
|
||||
super.mofangStatus(status)
|
||||
if (status) {
|
||||
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
|
||||
} else {
|
||||
mofangView.setImageResource(R.drawable.blue_tooth)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@ 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
|
||||
@@ -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() {
|
||||
@@ -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) {
|
||||
|
||||
@@ -7,14 +7,13 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
@@ -38,12 +37,12 @@ class StatusBarView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewStatusBarRight.addView(BatteryGroupView(this.context))
|
||||
val isBluetoothConnect =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
|
||||
if (isBluetoothConnect) {
|
||||
updateMfStatus("MoFangManager", true)
|
||||
post {
|
||||
val params: ViewGroup.LayoutParams = getLayoutParams()
|
||||
params.height = BarUtils.getStatusBarHeight()
|
||||
layoutParams = params
|
||||
}
|
||||
viewStatusBarRight.addView(BatteryGroupView(this.context))
|
||||
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
@@ -106,14 +105,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateMfStatus(tag: String, status: Boolean) {
|
||||
if (status) {
|
||||
viewMofangStatus.setImageResource(R.drawable.icon_bluetooth_p)
|
||||
} else {
|
||||
viewMofangStatus.setImageResource(R.drawable.blue_tooth)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
viewStatusBarTag.setTextColor(color)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,26 +8,26 @@ 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"
|
||||
}
|
||||
|
||||
@@ -36,24 +36,43 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
* @see WarningDirectionEnum
|
||||
* @param closeTime 倒计时
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long = ALL_CLOSE_TIMER) {
|
||||
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 ->{
|
||||
ALERT_WARNING_NON -> {
|
||||
// nothing
|
||||
}
|
||||
ALERT_WARNING_TOP -> {
|
||||
@@ -156,7 +175,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
private fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
if (direction == ALERT_WARNING_NON) {
|
||||
return
|
||||
}
|
||||
@@ -202,4 +221,10 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
}
|
||||
clearAnimation()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerV2XWarningListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,13 @@ 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.function.main.AppListActivity
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
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.*
|
||||
|
||||
/**
|
||||
@@ -44,6 +46,12 @@ class VersionNameView @JvmOverloads constructor(
|
||||
showCurrentPadVersion()
|
||||
showCurrentMapVersion()
|
||||
}
|
||||
|
||||
// 调试入口,应对M1、M2没有安装Launcher的情况
|
||||
setOnLongClickListener {
|
||||
ActivityUtils.startActivity(AppListActivity::class.java)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +98,7 @@ class VersionNameView @JvmOverloads constructor(
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
showCurrentMapVersion()
|
||||
//将工控机版本赋值给BadCase配置常量
|
||||
BadCaseConfig.dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
CallerDevaToolsManager.dockerVersion(autoPilotStatusInfo.dockVersion)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.eagle.core.function.main
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.main.adapter.AppListAdapter
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import kotlinx.android.synthetic.main.activity_app_list.*
|
||||
|
||||
|
||||
/**
|
||||
* 系统应用列表,调试使用,暂不对外显示开放,只通过隐藏后门进入
|
||||
*/
|
||||
class AppListActivity : AppCompatActivity(), AppListAdapter.OnItemClickedListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
BarUtils.hideStatusBarAndSticky(this.window)
|
||||
window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
||||
)
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_app_list)
|
||||
|
||||
val linearLayoutManager = GridLayoutManager(this, 6) //第二个参数为网格的列数
|
||||
recyclerViewAppList.layoutManager = linearLayoutManager
|
||||
|
||||
recyclerViewAppList.itemAnimator = DefaultItemAnimator()
|
||||
val appListAdapter =
|
||||
AppListAdapter(this)
|
||||
recyclerViewAppList.adapter = appListAdapter
|
||||
}
|
||||
|
||||
override fun onItemClicked(appListAdapter: AppListAdapter, position: Int) {
|
||||
ActivityUtils.startLauncherActivity(appListAdapter.getItem(position).packageName)
|
||||
}
|
||||
}
|
||||
@@ -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 重写实现,需要继承 StatusBarView,xml中基础系统控件不要修改其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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
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.recyclerview.widget.LinearLayoutManager
|
||||
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.MvpActivity
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
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.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.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 = statusBar
|
||||
statusBarView.setTag("status_bar")
|
||||
}
|
||||
val statusBarLP = FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
)
|
||||
statusBarLP.topMargin = 0
|
||||
statusBarLP.gravity = Gravity.TOP
|
||||
decorView.addView(statusBarView, statusBarLP)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改statusBar重新赋值
|
||||
* @return StatusBarView
|
||||
*/
|
||||
protected var statusBar: View?=null
|
||||
get() {
|
||||
return if (field == null) {
|
||||
StatusBarView(this)
|
||||
}else{
|
||||
field
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -12,7 +13,6 @@ import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.hmi.R;
|
||||
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.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -45,8 +46,6 @@ import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
*
|
||||
@@ -77,6 +76,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
private long pressEDownTime = 0;
|
||||
private long pressEUpTime = 0;
|
||||
|
||||
private int clickTime = 300; //单击
|
||||
private int clickTimeInterval = 330;
|
||||
private int longPressTime = 670;
|
||||
private int longPressTimeInterval = 700;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -88,18 +92,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ActivityUtils.setDefaultL(this);
|
||||
}
|
||||
|
||||
@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 +132,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();
|
||||
}
|
||||
|
||||
@@ -257,7 +255,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressADownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressADownTime - startPressTime) > 360 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
|
||||
if ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 A 按AB组合 +1 ");
|
||||
}
|
||||
@@ -266,7 +264,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
}
|
||||
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if ((pressADownTime - startPressTime) > 1320) {
|
||||
if ((pressADownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按A -2 ");
|
||||
}
|
||||
@@ -277,7 +275,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressAUpTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressAUpTime - startPressTime) < 350 && isCombinationKey != 3) {
|
||||
if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||
isCombinationKey = 1;
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击A -1 ");
|
||||
@@ -298,7 +296,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressBDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBDownTime - startPressTime) > 360 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
|
||||
if ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 B 按AB组合 +1 ");
|
||||
}
|
||||
@@ -306,7 +304,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
isCombinationKey = 3;
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if ((pressBDownTime - startPressTime) > 1320) {
|
||||
if ((pressBDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按B 无操作 ");
|
||||
}
|
||||
@@ -316,7 +314,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressBUpTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBUpTime - startPressTime) < 350 && isCombinationKey != 3) {
|
||||
if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击B 0 ");
|
||||
}
|
||||
@@ -338,7 +336,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressCDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
|
||||
if ((pressCDownTime - startPressTime) > 1320) {
|
||||
if ((pressCDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按C 无操作 ");
|
||||
}
|
||||
@@ -347,7 +345,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
pressCUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
|
||||
if ((pressCUpTime - startPressTime) < 350) {
|
||||
if ((pressCUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||
}
|
||||
@@ -359,7 +357,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressDDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
|
||||
if ((pressDDownTime - startPressTime) > 1320) {
|
||||
if ((pressDDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按D 无操作 ");
|
||||
}
|
||||
@@ -368,7 +366,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
pressDUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
|
||||
if ((pressDUpTime - startPressTime) < 350) {
|
||||
if ((pressDUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||
}
|
||||
@@ -380,7 +378,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressEDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
|
||||
if ((pressEDownTime - startPressTime) > 1320) {
|
||||
if ((pressEDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||
}
|
||||
@@ -400,7 +398,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
pressEUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
|
||||
if ((pressEUpTime - startPressTime) < 350) {
|
||||
if ((pressEUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||
}
|
||||
|
||||
@@ -55,14 +55,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
return;
|
||||
}
|
||||
start = System.currentTimeMillis();
|
||||
connectAmiIp();
|
||||
// Crash 日志收集
|
||||
initCrashConfig();
|
||||
initLogConfig();
|
||||
initTipToast();
|
||||
initModules();
|
||||
//查询是否有版本的更新
|
||||
queryAppUpgrade();
|
||||
if (ProcessUtils.isMainProcess(this)) {
|
||||
initOverviewDb();
|
||||
if (DebugConfig.isDebug()) {
|
||||
@@ -71,7 +68,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
clearMessageBoxTable();
|
||||
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
|
||||
}
|
||||
upgradeProgressListener();
|
||||
CallerDevaToolsManager.INSTANCE.updateUpgradeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,15 +77,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void queryAppUpgrade() {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerDevaToolsManager.INSTANCE.queryAppUpgrade();
|
||||
}
|
||||
},9000);
|
||||
}
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private void clearMessageBoxTable() {
|
||||
new Thread(() -> {
|
||||
@@ -121,52 +109,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void upgradeProgressListener() {
|
||||
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
// builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系
|
||||
builder.setContentTitle("下载");
|
||||
builder.setContentText("正在下载");
|
||||
final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
CallerDevaToolsUpgradeListenerManager.INSTANCE.addListener(TAG, new IMogoDevaToolsUpgradeListener() {
|
||||
@Override
|
||||
public void onStart(@Nullable String url) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause(@Nullable String url) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(@Nullable String url, int length) {
|
||||
builder.setProgress(100, length,false);
|
||||
manager.notify(0x3, builder.build());
|
||||
//下载进度提示
|
||||
builder.setContentText("已下载" + length + "%");
|
||||
CallerHmiManager.INSTANCE.updateStatusBarDownloadView(true, "download", length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished(@Nullable String url) {
|
||||
builder.setContentText("已下载" + 100 + "%");
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
manager.cancel(0x3);
|
||||
CallerHmiManager.INSTANCE.updateStatusBarDownloadView(false, "download", 100);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@Nullable String url, @Nullable String errorMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initKoom() {
|
||||
KoomInitTask.INSTANCE.init(this);
|
||||
}
|
||||
@@ -197,14 +139,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接ami
|
||||
*/
|
||||
private void connectAmiIp() {
|
||||
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
|
||||
// AmiClientManager.getInstance().setObuIp(ipAddress);
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
|
||||
// OBU 模块
|
||||
|
||||
@@ -15,14 +15,12 @@ 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.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.CallerAutoPilotControlManager;
|
||||
@@ -30,7 +28,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
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;
|
||||
@@ -47,10 +44,8 @@ import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
* 针对作为Launcher的情况,做个性化操作 TODO 测试用的,可删除
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@@ -91,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
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.widget.TextureVideoView
|
||||
|
||||
/**
|
||||
* 视频广告
|
||||
* 视频广告 TODO 测试用的,可删除
|
||||
*/
|
||||
class VideoAdAtc : AppCompatActivity() {
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.mogo.eagle.core.function.main.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AppListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private OnItemClickedListener mOnItemClickedListener;
|
||||
|
||||
public interface OnItemClickedListener {
|
||||
void onItemClicked(AppListAdapter appListAdapter, int position);
|
||||
}
|
||||
|
||||
public static class AppViewHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView iconIv;
|
||||
public TextView nameTv;
|
||||
|
||||
public AppViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
iconIv = (ImageView) itemView.findViewById(R.id.list_item_app_icon_iv);
|
||||
nameTv = (TextView) itemView.findViewById(R.id.list_item_app_name_tv);
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> showApps = new ArrayList<>();
|
||||
|
||||
public AppListAdapter(OnItemClickedListener onItemClickedListener) {
|
||||
// 设置被允许展示的APP
|
||||
showApps.add("com.android.settings");
|
||||
|
||||
mOnItemClickedListener = onItemClickedListener;
|
||||
mApps = new ArrayList<>();
|
||||
for (AppUtils.AppInfo appInfo : AppUtils.getAppsInfo()) {
|
||||
if (!appInfo.isSystem()) {
|
||||
mApps.add(appInfo);
|
||||
} else {
|
||||
if (showApps.contains(appInfo.getPackageName())) {
|
||||
mApps.add(appInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<AppUtils.AppInfo> mApps;
|
||||
|
||||
public AppUtils.AppInfo getItem(int position) {
|
||||
return mApps.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mApps.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_app_list, parent, false);
|
||||
return new AppViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
AppViewHolder itemViewHolder = (AppViewHolder) holder;
|
||||
itemViewHolder.iconIv.setImageDrawable(mApps.get(position).getIcon());
|
||||
itemViewHolder.nameTv.setText(mApps.get(position).getName());
|
||||
itemViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickedListener != null) {
|
||||
mOnItemClickedListener.onItemClicked(AppListAdapter.this, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView 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/recyclerViewAppList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/main_splash_bg"
|
||||
android:clipToPadding="false"
|
||||
android:padding="20dp"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:spanCount="6"
|
||||
tools:itemCount="11"
|
||||
tools:listitem="@layout/item_app_list" />
|
||||
@@ -1,19 +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>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_item_app_icon_iv"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:src="@drawable/icon_ad" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_app_name_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:singleLine="true"
|
||||
android:text="应用名称"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="30dp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -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-->
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
android:layout_height="@dimen/dp_54">
|
||||
|
||||
<ImageView
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/blue_tooth"
|
||||
android:id="@+id/mofangView"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/blue_tooth"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -242,6 +242,42 @@
|
||||
android:textOn="关闭感知优化模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbV2NFromCar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启车端V2N预警"
|
||||
android:textOn="关闭车端V2N预警"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDrawAiCloudFusion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启云端感知绘制"
|
||||
android:textOn="关闭云端感知绘制"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDrawRomaMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启漫游模式"
|
||||
android:textOn="关闭漫游模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbMojie"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_35" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
@@ -36,8 +37,7 @@
|
||||
android:layout_marginStart="@dimen/dp_18" />
|
||||
|
||||
<!--魔方连接状态-->
|
||||
<ImageView
|
||||
android:id="@+id/viewMofangStatus"
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/blue_tooth"
|
||||
|
||||
@@ -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>
|
||||
@@ -75,13 +75,10 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
|
||||
implementation rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-res')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:function-impl:mogo-core-function-datacenter')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(":libraries:mogo-map")
|
||||
}
|
||||
|
||||
@@ -2,4 +2,13 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.map">
|
||||
|
||||
<application>
|
||||
|
||||
<receiver android:name="com.mogo.eagle.core.function.business.ai.AiCloudRangeBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.map.aiCloud.notification" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.eagle.core.function
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_MAP_BIZ)
|
||||
class MapBizProvider :IMoGoFunctionServerProvider{
|
||||
|
||||
override val functionName: String
|
||||
get() = "MapBizProvider"
|
||||
|
||||
override fun init(context: Context?) {
|
||||
MapIdentifySubscriber.instance
|
||||
MogoRouteOverlayManager.getInstance().init()
|
||||
MapPointCloudSubscriber.instance
|
||||
SpeedLimitDataManager.getInstance().start()
|
||||
aiCloudIdentifyDataManager.init(AbsMogoApplication.getApp())
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType;
|
||||
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.call.v2x.CallerLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -58,14 +58,14 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener
|
||||
int speedLimit = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMapUIController()).getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
|
||||
UiThreadHandler.post(() -> {
|
||||
if (speedLimit > 0) {
|
||||
CallerLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit, DataSourceType.MAP);
|
||||
CallerLimitingVelocityListenerManager.INSTANCE.invokeUnion(speedLimit, DataSourceType.MAP);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new SpeedTimerTask(), 3000, 1000);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.mogo.eagle.core.function.business.ai
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.business.ai.net.AiCloudIdentifyNetWorkModel
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
class AiCloudIdentifyDataManager : IMogoMapListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AiCloudIdentifyData"
|
||||
|
||||
var START_METRE = 200
|
||||
var END_METRE = 2000
|
||||
|
||||
@JvmStatic
|
||||
val aiCloudIdentifyDataManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
AiCloudIdentifyDataManager()
|
||||
}
|
||||
}
|
||||
|
||||
private val aiCloudIdentifyNetWorkModel = AiCloudIdentifyNetWorkModel()
|
||||
private var showAiCloud = false
|
||||
|
||||
fun init(mContext: Context) {
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.registerOnMessageListener(
|
||||
0x040003, //低频数据
|
||||
object : IMogoOnMessageListener<SocketDownData.SocketDownDataProto> {
|
||||
override fun target(): Class<SocketDownData.SocketDownDataProto> {
|
||||
return SocketDownData.SocketDownDataProto::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: SocketDownData.SocketDownDataProto?) {
|
||||
if (!FunctionBuildConfig.isDrawAiCloudFusion) {
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
return
|
||||
}
|
||||
obj?.let {
|
||||
obj.data?.let {
|
||||
if (showAiCloud) {
|
||||
if (it.allListList == null || it.allListList.size == 0) {
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
return
|
||||
}
|
||||
MapIdentifySubscriber.instance.renderAiCloudResult(it.allListList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
requestRangeOfIdentify()
|
||||
}
|
||||
|
||||
fun requestRangeOfIdentify() {
|
||||
aiCloudIdentifyNetWorkModel.requestIdentifyRange({
|
||||
CallerLogger.d(
|
||||
M_MAP + TAG,
|
||||
"requestIdentifyRange ok startRange:$START_METRE, endRange:$END_METRE"
|
||||
)
|
||||
}, {
|
||||
CallerLogger.d(
|
||||
M_MAP + TAG,
|
||||
"requestIdentifyRange error : $it , startRange:$START_METRE, endRange:$END_METRE"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode) {
|
||||
super.onMapVisualAngleChanged(visualAngleMode)
|
||||
when {
|
||||
visualAngleMode.isRoma -> {
|
||||
showAiCloud = true
|
||||
FunctionBuildConfig.isDrawIdentifyData = false
|
||||
}
|
||||
else -> {
|
||||
showAiCloud = false
|
||||
FunctionBuildConfig.isDrawIdentifyData = true
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.eagle.core.function.business.ai
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.END_METRE
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.START_METRE
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
|
||||
class AiCloudRangeBroadcastReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AiCloudRangeBroadcastReceiver"
|
||||
private const val START_RANGE = "startRange"
|
||||
private const val END_RANGE = "endRange"
|
||||
|
||||
// adb shell am broadcast -a com.map.aiCloud.notification --ei startRange 140 --ei endRange 2000
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val startRange = intent.getIntExtra(START_RANGE, START_METRE)
|
||||
val endRange = intent.getIntExtra(END_RANGE, END_METRE)
|
||||
START_METRE = startRange
|
||||
END_METRE = endRange
|
||||
CallerLogger.d("$M_MAP$TAG", "startRange:$startRange, endRange:$endRange")
|
||||
aiCloudIdentifyDataManager.requestRangeOfIdentify()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.eagle.core.function.business.ai.net
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.END_METRE
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.START_METRE
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.zhjt.service_biz.FuncConfig
|
||||
|
||||
class AiCloudIdentifyNetWorkModel {
|
||||
|
||||
companion object {
|
||||
val aiCloudIdentifyNetWorkModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
AiCloudIdentifyNetWorkModel()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getHost(): String {
|
||||
var host = "http://dzt-city.zhidaozhixing.com"
|
||||
when (DebugConfig.getNetMode()) {
|
||||
DebugConfig.NET_MODE_DEV,
|
||||
DebugConfig.NET_MODE_QA -> host = "http://dzt-qa-city.zhidaozhixing.com"
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
private fun getNetWorkApi(baseUrl: String = getHost()): IAiCloudIdentifyApiService {
|
||||
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
|
||||
.create(IAiCloudIdentifyApiService::class.java)
|
||||
}
|
||||
|
||||
fun requestIdentifyRange(
|
||||
onSuccess: (() -> Unit),
|
||||
onError: ((String) -> Unit)
|
||||
) {
|
||||
request<BaseResponse<Any>> {
|
||||
val map = mutableMapOf<String, Any>()
|
||||
start {
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["status"] = true
|
||||
map["startMetre"] = START_METRE
|
||||
map["endMetre"] = END_METRE
|
||||
map["type"] = 1
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
getNetWorkApi().identifyRange(map)
|
||||
}
|
||||
}
|
||||
onSuccess {
|
||||
onSuccess.invoke()
|
||||
}
|
||||
onError {
|
||||
it.message?.let { errorMsg ->
|
||||
onError.invoke(errorMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.eagle.core.function.business.ai.net
|
||||
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface IAiCloudIdentifyApiService {
|
||||
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("yycp-c-v2x-service/dataFusion/remoteDrivingSet")
|
||||
suspend fun identifyRange(@Body map: MutableMap<String, Any>): BaseResponse<Any>
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.zhidaoauto.map.operational.open.GatherApi
|
||||
@@ -26,7 +25,8 @@ import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER)
|
||||
class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
IMoGoAutopilotRecordListener {
|
||||
|
||||
companion object {
|
||||
@@ -52,16 +52,19 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
|
||||
executor.set(context?.let {
|
||||
GatherApi.also { itx ->
|
||||
itx.init(it,
|
||||
GatherParams.init()
|
||||
.setDebugMode(false)
|
||||
.setCoordinateType(GatherParams.COORDINATETYPE_GCJ02))
|
||||
} })
|
||||
itx.init(
|
||||
it,
|
||||
GatherParams.init()
|
||||
.setDebugMode(false)
|
||||
.setCoordinateType(GatherParams.COORDINATETYPE_GCJ02)
|
||||
)
|
||||
}
|
||||
})
|
||||
executor.get()?.setOnTaskListener(this)
|
||||
val carSn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
if (!TextUtils.isEmpty(carSn)) {
|
||||
@@ -69,12 +72,12 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${executor.get()?.hashCode() ?: 0}")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
|
||||
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
executor.get()?.setOnTaskListener(null)
|
||||
listeners.clear()
|
||||
@@ -90,7 +93,13 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
recordPanel.stat == 102 || //工控机达到最大采集时长
|
||||
recordPanel.stat == 103) //工控机磁盘满了
|
||||
) {
|
||||
finish(recordPanel.id, recordPanel.stat, "", recordPanel.filename ?: "", recordPanel.note ?: "")
|
||||
finish(
|
||||
recordPanel.id,
|
||||
recordPanel.stat,
|
||||
"",
|
||||
recordPanel.filename ?: "",
|
||||
recordPanel.note ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +140,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish: 结束任务[$id]")
|
||||
executor.get()?.finishTask(id, state, gpsPath, videoPath, reason)
|
||||
} catch (e : Throwable) {
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.e("$M_MAP$TAG", "-- finish:\n$e")
|
||||
} finally {
|
||||
@@ -171,14 +180,16 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation() ?: return
|
||||
executor.get()?.updateLocation(
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.altitude,
|
||||
location.heading.toFloat(),
|
||||
location.gnssSpeed,
|
||||
false)
|
||||
if (gnssInfo != null) {
|
||||
executor.get()?.updateLocation(
|
||||
gnssInfo.longitude,
|
||||
gnssInfo.latitude,
|
||||
gnssInfo.altitude,
|
||||
gnssInfo.heading.toFloat(),
|
||||
gnssInfo.gnssSpeed,
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInValidStatus(): Boolean {
|
||||
|
||||
@@ -3,16 +3,35 @@ package com.mogo.eagle.core.function.business.identify
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
interface Identify {
|
||||
|
||||
fun renderAdasRecognizedResult(resultList: List<TrackedObject>?)
|
||||
fun renderAdasRecognizedResult(resultList: List<TrackedObject>?) {
|
||||
|
||||
fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?)
|
||||
}
|
||||
|
||||
fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>) {
|
||||
|
||||
}
|
||||
|
||||
fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
|
||||
}
|
||||
|
||||
fun renderOBUWarningObj(exist: Boolean, obuTrafficData: TrafficData) {
|
||||
|
||||
}
|
||||
|
||||
fun clearOldMarker()
|
||||
fun clearOldMarker() {
|
||||
|
||||
}
|
||||
|
||||
fun clearAiMarker() {
|
||||
|
||||
}
|
||||
|
||||
fun getIdentifyObj(uuid: String): TrackedObject? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.collection.ArraySet
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class IdentifyAiCloudDataDrawer : Identify {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "IdentifyDataDrawer"
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
private val mMarkersCaches = ConcurrentHashMap<String, SocketDownData.CloudRoadDataProto>()
|
||||
|
||||
/**
|
||||
* 记录每次实际绘制的交通元素UUID
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private val trafficDataUuidList = ArraySet<String>()
|
||||
|
||||
/**
|
||||
* 过滤后的数据集合
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private val mFilterTrafficData = HashMap<String, SocketDownData.CloudRoadDataProto>()
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>) {
|
||||
if (resultList.isEmpty()) {
|
||||
clearOldMarker()
|
||||
w(TAG, "感知数据为空无需渲染……")
|
||||
return
|
||||
}
|
||||
if (!MogoStatusManager.getInstance().isVrMode) {
|
||||
clearOldMarker()
|
||||
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
|
||||
return
|
||||
}
|
||||
|
||||
//清除缓存
|
||||
for (data in resultList) {
|
||||
if (trafficDataUuidList.size > 0 && trafficDataUuidList.contains("" + data.uuid)) {
|
||||
trafficDataUuidList.remove("" + data.uuid)
|
||||
}
|
||||
}
|
||||
|
||||
//清除缓存,删除marker
|
||||
val it: MutableIterator<*> = trafficDataUuidList.iterator()
|
||||
while (it.hasNext()) {
|
||||
val key = it.next() as String
|
||||
it.remove()
|
||||
mMarkersCaches.remove(key)
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key.hashCode().toString())
|
||||
}
|
||||
|
||||
val filterList = filterTrafficData(resultList)
|
||||
if (filterList.size > 0) {
|
||||
// 绘制新数据
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.updateBatchAiMarkerPosition(filterList)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据过滤器
|
||||
*
|
||||
* @return 过滤后的数据集合
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private fun filterTrafficData(trafficData: List<SocketDownData.CloudRoadDataProto>): HashMap<String, SocketDownData.CloudRoadDataProto> {
|
||||
mFilterTrafficData.clear()
|
||||
trafficDataUuidList.clear()
|
||||
for (data in trafficData) {
|
||||
val uuid = "" + data.uuid
|
||||
mMarkersCaches[uuid] = data
|
||||
trafficDataUuidList.add(uuid)
|
||||
mFilterTrafficData[uuid] = data
|
||||
}
|
||||
return mFilterTrafficData
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun clearAiMarker() {
|
||||
trafficDataUuidList.clear()
|
||||
mMarkersCaches.forEach { (uuid, _) ->
|
||||
mMarkersCaches.remove(uuid)
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid.hashCode().toString())
|
||||
}
|
||||
mFilterTrafficData.clear()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
|
||||
@@ -22,7 +23,12 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
internal val beautifyDataDrawer = IdentifyBeautifyDataDrawer()
|
||||
}
|
||||
|
||||
object AiIdentify {
|
||||
internal val aiCloudDataDrawer = IdentifyAiCloudDataDrawer()
|
||||
}
|
||||
|
||||
private var identify: Identify? = null
|
||||
private var aiCloudIdentify: Identify? = null
|
||||
|
||||
init {
|
||||
identify = if (FunctionBuildConfig.isBeautyMode) {
|
||||
@@ -30,14 +36,17 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
} else {
|
||||
DriverIdentify.originDataDrawer
|
||||
}
|
||||
aiCloudIdentify = AiIdentify.aiCloudDataDrawer
|
||||
CallerObuWarningListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private const val MSG_DATA_TRACK = 0
|
||||
private const val MSG_DATA_WARNING = 1
|
||||
private const val MSG_DATA_OBU_WARNING_UPDATE = 2
|
||||
private const val MSG_DATA_OBU_WARNING_REMOVE = 3
|
||||
private const val MSG_DATA_CLEAR = 4
|
||||
private const val MSG_DATA_AI_TRACK = 1
|
||||
private const val MSG_DATA_WARNING = 2
|
||||
private const val MSG_DATA_OBU_WARNING_UPDATE = 3
|
||||
private const val MSG_DATA_OBU_WARNING_REMOVE = 4
|
||||
private const val MSG_DATA_CLEAR = 5
|
||||
private const val MSG_DATA_AI_CLEAR = 6
|
||||
|
||||
// 维护一个线程定时轮询数据进行地图绘制
|
||||
private val mDrawerHandler: Handler =
|
||||
@@ -63,6 +72,11 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
identify!!.renderAdasRecognizedResult(msg.obj as List<TrackedObject>?)
|
||||
}
|
||||
}
|
||||
MSG_DATA_AI_TRACK -> {
|
||||
if (msg.obj is List<*>) {
|
||||
aiCloudIdentify!!.renderAiCloudResult(msg.obj as List<SocketDownData.CloudRoadDataProto>)
|
||||
}
|
||||
}
|
||||
MSG_DATA_WARNING -> {
|
||||
if (msg.obj is List<*>) {
|
||||
identify!!.renderPlanningWarningObj(msg.obj as List<MessagePad.PlanningObject>?)
|
||||
@@ -81,6 +95,9 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
MSG_DATA_CLEAR -> {
|
||||
identify!!.clearOldMarker()
|
||||
}
|
||||
MSG_DATA_AI_CLEAR -> {
|
||||
aiCloudIdentify!!.clearAiMarker()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +109,13 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
mDrawerHandler.sendMessage(message)
|
||||
}
|
||||
|
||||
override fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>) {
|
||||
val message = Message.obtain()
|
||||
message.what = MSG_DATA_AI_TRACK
|
||||
message.obj = resultList
|
||||
mDrawerHandler.sendMessage(message)
|
||||
}
|
||||
|
||||
override fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
val message = Message.obtain()
|
||||
message.what = MSG_DATA_WARNING
|
||||
@@ -105,6 +129,16 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
mDrawerHandler.sendMessage(message)
|
||||
}
|
||||
|
||||
override fun clearAiMarker() {
|
||||
val message = Message.obtain()
|
||||
message.what = MSG_DATA_AI_CLEAR
|
||||
mDrawerHandler.sendMessage(message)
|
||||
}
|
||||
|
||||
override fun getIdentifyObj(uuid: String): TrackedObject? {
|
||||
return identify?.getIdentifyObj(uuid)
|
||||
}
|
||||
|
||||
override fun updateTrackerWarningInfo(trafficData: TrafficData) {
|
||||
super.updateTrackerWarningInfo(trafficData)
|
||||
val message = Message.obtain()
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_IDENTIFY
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMoGoIdentifyListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
/**
|
||||
* 订阅感知数据的订阅者
|
||||
@@ -14,7 +19,8 @@ import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
class MapIdentifySubscriber private constructor() : IMoGoSubscriber,
|
||||
@Route(path = PATH_IDENTIFY)
|
||||
class MapIdentifySubscriber private constructor() : IMoGoIdentifyListener, IMoGoSubscriber,
|
||||
IMoGoAutopilotIdentifyListener {
|
||||
|
||||
private val TAG = "MapIdentifySubscriber"
|
||||
@@ -36,7 +42,6 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber,
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrackedObject>?) {
|
||||
@@ -53,6 +58,26 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber,
|
||||
}
|
||||
}
|
||||
|
||||
fun renderAiCloudResult(cloudData: List<SocketDownData.CloudRoadDataProto>) {
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawAiCloudFusion) {
|
||||
ThreadUtils.getSinglePool().execute {
|
||||
// aiCloudDataDrawer.renderAiCloudResult(cloudData)
|
||||
IdentifyFactory.renderAiCloudResult(cloudData)
|
||||
}
|
||||
} else {
|
||||
clearAiCloudRoma()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun clearAiCloudRoma() {
|
||||
// aiCloudDataDrawer.clearAiMarker()
|
||||
IdentifyFactory.clearAiMarker()
|
||||
}
|
||||
|
||||
override fun onAutopilotIdentifyPlanningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData && FunctionBuildConfig.debugTrackerProvider == 0) {
|
||||
@@ -67,7 +92,12 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber,
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotWarnMessage(warn: MessagePad.Warn?) {
|
||||
override fun getIdentifyObj(uuid: String): TrackedObject? {
|
||||
return IdentifyFactory.getIdentifyObj(uuid)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import android.annotation.SuppressLint;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TrackObj {
|
||||
lon = data.getLongitude();
|
||||
s2LatLng = S2LatLng.fromDegrees(data.getLatitude(), data.getLongitude());
|
||||
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22); //需要验证22前后
|
||||
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, -1);
|
||||
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(lon, lat, -1);
|
||||
if (centerLine != null && centerLine.getAngle() != 0) {
|
||||
roadAngle = centerLine.getAngle();
|
||||
}
|
||||
@@ -107,18 +107,18 @@ public class TrackObj {
|
||||
|
||||
private void calHeading() {
|
||||
//更正数据,速度小于LIMIT_SPEED使用上一帧数据
|
||||
if (relativeStatic()) {
|
||||
if (roadAngle != 0.0) {
|
||||
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, -1);
|
||||
if (centerLine != null && centerLine.getAngle() != 0) {
|
||||
cacheData = cacheData.toBuilder().setHeading(centerLine.getAngle()).build();
|
||||
} else {
|
||||
cacheData = cacheData.toBuilder().setHeading(circleQueue.getLastFrame().getHeading()).build();
|
||||
}
|
||||
} else {
|
||||
cacheData = cacheData.toBuilder().setHeading(circleQueue.getLastFrame().getHeading()).build();
|
||||
}
|
||||
}
|
||||
// if (relativeStatic()) {
|
||||
// if (roadAngle != 0.0) {
|
||||
// CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, -1);
|
||||
// if (centerLine != null && centerLine.getAngle() != 0) {
|
||||
// cacheData = cacheData.toBuilder().setHeading(centerLine.getAngle()).build();
|
||||
// } else {
|
||||
// cacheData = cacheData.toBuilder().setHeading(circleQueue.getLastFrame().getHeading()).build();
|
||||
// }
|
||||
// } else {
|
||||
// cacheData = cacheData.toBuilder().setHeading(circleQueue.getLastFrame().getHeading()).build();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public double getRecentlyTime() {
|
||||
|
||||
@@ -9,9 +9,8 @@ object TrackerSourceColorHelper {
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
fun filterData(data: TrackedObject): Boolean {
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|
||||
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type
|
||||
) {
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|
||||
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type)) {
|
||||
return true
|
||||
}
|
||||
var trackIPCFilter = true
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningTrajectoryListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
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.autopilot.CallerPlanningTrajectoryListenerManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,7 +43,7 @@ public class MogoRouteOverlayManager implements
|
||||
public void init() {
|
||||
CallerPlanningTrajectoryListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static MogoRouteOverlayManager getInstance() {
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.mogo.eagle.core.function.business.routeoverlay
|
||||
|
||||
import android.animation.*
|
||||
import android.graphics.*
|
||||
import android.view.animation.*
|
||||
import com.mogo.eagle.core.data.config.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.*
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.graphics.Color
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE_DARK
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_RED_DARK
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_TRANSPARENT
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
interface IStrategy {
|
||||
@@ -22,26 +23,31 @@ class Colors {
|
||||
companion object {
|
||||
val COLOR_BLUE = Color.parseColor("#FF2ABAD9")
|
||||
val COLOR_BLUE_DARK = Color.parseColor("#FF074EFF")
|
||||
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
|
||||
val COLOR_TRANSPARENT = Color.parseColor("#002ABAD9")
|
||||
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
|
||||
val COLOR_TRANSPARENT = Color.parseColor("#002ABAD9")
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Strategy: IStrategy
|
||||
sealed class Strategy : IStrategy
|
||||
|
||||
class DefaultStrategy(private val colors: List<Int>? = null): Strategy() {
|
||||
class DefaultStrategy(private val colors: List<Int>? = null) : Strategy() {
|
||||
|
||||
override fun getColors(): List<Int> = colors ?: listOf(COLOR_BLUE, COLOR_TRANSPARENT)
|
||||
}
|
||||
|
||||
class ColorfulStrategy(private val colors: List<Int> = emptyList(), var isLightOn: Boolean): Strategy() {
|
||||
class ColorfulStrategy(private val colors: List<Int> = emptyList(), var isLightOn: Boolean) :
|
||||
Strategy() {
|
||||
override fun getColors(): List<Int> = colors
|
||||
}
|
||||
|
||||
object RouteStrategy {
|
||||
|
||||
@Volatile
|
||||
private var isEnable = !AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
private var isEnable by Delegates.observable(HmiBuildConfig.isShowRouteStrategy) { _, _, newValue ->
|
||||
if (!newValue) {
|
||||
strategy = null
|
||||
colors.clear()
|
||||
}
|
||||
}
|
||||
|
||||
private var strategy: Strategy? = null
|
||||
|
||||
@@ -57,14 +63,6 @@ object RouteStrategy {
|
||||
|
||||
private var hasLessThan0 = false
|
||||
|
||||
fun enable(enable: Boolean) {
|
||||
isEnable = enable
|
||||
if (!enable) {
|
||||
strategy = null
|
||||
colors.clear()
|
||||
}
|
||||
}
|
||||
|
||||
fun start() {
|
||||
if (sorted.isEmpty()) {
|
||||
fill()
|
||||
@@ -89,7 +87,7 @@ object RouteStrategy {
|
||||
}
|
||||
|
||||
fun check(speed: Double, acc: Double, total: Int) {
|
||||
if (!isEnable){
|
||||
if (!isEnable) {
|
||||
return
|
||||
}
|
||||
if (sorted.isEmpty()) {
|
||||
@@ -112,7 +110,11 @@ object RouteStrategy {
|
||||
} else {
|
||||
if (endEvaluator != null) {
|
||||
val fraction = (index - last) * 1.0f / delta
|
||||
colors += endEvaluator!!.evaluate(fraction, startColor, COLOR_TRANSPARENT) as Int
|
||||
colors += endEvaluator!!.evaluate(
|
||||
fraction,
|
||||
startColor,
|
||||
COLOR_TRANSPARENT
|
||||
) as Int
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -156,11 +158,14 @@ object RouteStrategy {
|
||||
total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = (current - startValue) / total
|
||||
val colorValue = evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
|
||||
val colorValue =
|
||||
evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
|
||||
sorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
}
|
||||
|
||||
fun getStrategy(): Strategy = if (isEnable) { (strategy ?: DefaultStrategy()) } else DefaultStrategy()
|
||||
fun getStrategy(): Strategy = if (isEnable) {
|
||||
(strategy ?: DefaultStrategy())
|
||||
} else DefaultStrategy()
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class MogoMapService implements IMogoMapService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoOverlayManager getOverlayManager(Context context) {
|
||||
public IMogoOverlayManager getOverlayManager() {
|
||||
return MogoOverlayManager.getInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mogo.eagle.core.function.map
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import chassis.Chassis
|
||||
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.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.map.MogoMapView
|
||||
|
||||
class MapBizView(context: Context?) : MogoMapView(context), IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener {
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
super.onCreate(bundle)
|
||||
map.uiController.showMyLocation(true)
|
||||
|
||||
CallerSkinModeListenerManager.addListener(MapFragment.functionName, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(MapFragment.functionName, this)
|
||||
CallerChassisLamplightListenerManager.addListener(MapFragment.functionName, this)
|
||||
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
super.onAutopilotLightSwitchData(lightSwitch)
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(MapFragment.functionName)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(MapFragment.functionName)
|
||||
CallerChassisLamplightListenerManager.removeListener(MapFragment.functionName)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
package com.mogo.eagle.core.function.map
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import chassis.Chassis
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.map.CenterLine
|
||||
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.api.map.hd.IMoGoMapFragmentProvider
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
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.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.map.IMogoMap
|
||||
import com.mogo.map.MogoMapView
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2021-11-09
|
||||
* 高精度地图层UI
|
||||
* 地图图层,地图操作都在这个图层完成 //todo 以view方式进行提供
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
|
||||
class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
MapView,
|
||||
IMoGoMapFragmentProvider,
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoChassisLamplightListener {
|
||||
|
||||
private var mMogoMapView: MogoMapView? = null
|
||||
private var mMogoMap: IMogoMap? = null
|
||||
|
||||
companion object {
|
||||
const val functionName = "MapFragment"
|
||||
|
||||
/**
|
||||
* sight mode
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
const val SIGHT_MODE_NORMAL = 0
|
||||
const val SIGHT_MODE_TOP = 1
|
||||
const val SIGHT_MODE_BACK = 2
|
||||
const val SIGHT_MODE_CROSS = 3
|
||||
const val SIGHT_MODE_FAR = 4
|
||||
}
|
||||
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_map_fragment_map
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return Companion.functionName
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
override fun stepInVrMode(isDayMode: Boolean) {
|
||||
try {
|
||||
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
|
||||
mMogoMapView!!.map.uiController.stepInVrMode(isDayMode)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
// do not implement
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mMogoMapView = findViewById(R.id.module_map_id_map)
|
||||
mMogoMapView!!.onCreate(savedInstanceState)
|
||||
mMogoMap = mMogoMapView!!.map
|
||||
if (mMogoMap != null) {
|
||||
mMogoMap!!.uiController.showMyLocation(true)
|
||||
}
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLamplightListenerManager.addListener(Companion.functionName, this)
|
||||
}
|
||||
|
||||
override fun createPresenter(): MapPresenter {
|
||||
return MapPresenter(this)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initMapView()
|
||||
initMapBiz()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
if (mMogoMapView != null) {
|
||||
mMogoMapView!!.onSaveInstanceState(outState)
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (mMogoMapView != null) {
|
||||
mMogoMapView!!.onPause()
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mMogoMapView != null) {
|
||||
mMogoMapView!!.onResume()
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
if (mMogoMapView != null) {
|
||||
mMogoMapView!!.onLowMemory()
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
private fun initMapView() {
|
||||
mMogoMap = mMogoMapView!!.map
|
||||
if (mMogoMap == null) {
|
||||
return
|
||||
}
|
||||
val uiSettings = mMogoMap!!.uiSettings
|
||||
if (uiSettings != null) {
|
||||
//设置所有手势是否可用
|
||||
uiSettings.setAllGesturesEnabled(true)
|
||||
//设置指南针是否可见。
|
||||
uiSettings.setCompassEnabled(false)
|
||||
//设置室内地图楼层切换控件是否可见。
|
||||
uiSettings.setIndoorSwitchEnabled(true)
|
||||
//设置定位按钮是否可见。
|
||||
uiSettings.setMyLocationButtonEnabled(false)
|
||||
//设置旋转手势是否可用。
|
||||
uiSettings.setRotateGesturesEnabled(false)
|
||||
//设置比例尺控件是否可见
|
||||
uiSettings.setScaleControlsEnabled(true)
|
||||
//设置拖拽手势是否可用。
|
||||
uiSettings.setScrollGesturesEnabled(true)
|
||||
//设置倾斜手势是否可用。
|
||||
uiSettings.setTiltGesturesEnabled(true)
|
||||
//设置缩放按钮是否可见。
|
||||
uiSettings.setZoomControlsEnabled(false)
|
||||
//设置双指缩放手势是否可用。
|
||||
uiSettings.setZoomGesturesEnabled(true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initMapBiz() {
|
||||
// TODO 临时初始化地图监听工控机、OBU等数据监听器,用于感知元素绘制
|
||||
MapIdentifySubscriber.instance
|
||||
MogoRouteOverlayManager.getInstance().init()
|
||||
MapPointCloudSubscriber.instance
|
||||
SpeedLimitDataManager.getInstance().start()
|
||||
}
|
||||
|
||||
override fun getUIController(): IMogoMapUIController {
|
||||
return mMogoMap!!.uiController
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
CallerSkinModeListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisLamplightListenerManager.removeListener(Companion.functionName)
|
||||
|
||||
if (mMogoMapView != null) {
|
||||
mMogoMapView!!.onDestroy()
|
||||
mMogoMapView = null
|
||||
mMogoMap = null
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun changeMaoViewAngle(type: Int) {
|
||||
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
|
||||
mMogoMapView!!.map.uiController.changeMapViewAngle(type)
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCurrentIcon(iconId: Int) {
|
||||
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
|
||||
mMogoMapView!!.map.uiController.changeCurrentIcon(iconId)
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun setMapDAngle(mode: Int) {
|
||||
val angle = getSightModeAngle(mode)
|
||||
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
|
||||
mMogoMapView!!.map.uiController.setMapDAngle(angle)
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSightModeAngle(mode: Int): Float { //todo 宏宇
|
||||
var angle = 0.0f
|
||||
when (mode) {
|
||||
SIGHT_MODE_NORMAL -> {
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
}
|
||||
SIGHT_MODE_TOP -> {
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
}
|
||||
SIGHT_MODE_BACK -> {
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
}
|
||||
SIGHT_MODE_CROSS -> {
|
||||
angle = 16.5f
|
||||
angle = 16.5f
|
||||
}
|
||||
SIGHT_MODE_FAR -> angle = 16.5f
|
||||
}
|
||||
return angle
|
||||
}
|
||||
|
||||
override fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine? {
|
||||
return if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
|
||||
mMogoMapView!!.map.uiController.getCenterLineInfo(lon, lat, angle)
|
||||
} else {
|
||||
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
|
||||
null //上层使用应该判空
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
if (skinMode == 0) {
|
||||
CallerHDMapManager.stepInVrMode(false)
|
||||
} else if (skinMode == 1) {
|
||||
CallerHDMapManager.stepInVrMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setPointCloudSize(pointCloudSize: Float) {
|
||||
//设置点云大小
|
||||
PointCloudHelper.setPointCloudSize(pointCloudSize)
|
||||
}
|
||||
|
||||
override fun setPointCloudColor(color: String) {
|
||||
// 设置点云颜色
|
||||
PointCloudHelper.setPointCloudColor(color)
|
||||
}
|
||||
|
||||
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
|
||||
try {
|
||||
// 是否绘制点云
|
||||
PointCloudHelper.setIsDrawPointCloud(isDrawPointCloud)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图是否是Debug模式
|
||||
*
|
||||
* @param debugMode 是否开启Debug模式
|
||||
*/
|
||||
override fun setDebugMode(debugMode: Boolean) {
|
||||
MapAutoApi.setDebugMode(debugMode)
|
||||
}
|
||||
|
||||
override val functionName: String
|
||||
get() = functionName
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
// 跟新地图控件
|
||||
mMogoMapView?.setExtraGPSData(gnssInfo)
|
||||
}
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
lightSwitch?.let {
|
||||
when (it.number) {
|
||||
1 -> { //左转灯
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
|
||||
}
|
||||
2 -> { //右转灯
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
|
||||
}
|
||||
else -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.eagle.core.function.map;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MapPresenter extends Presenter<MapView> {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
|
||||
public MapPresenter(MapView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.eagle.core.function.map;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 地图view
|
||||
*/
|
||||
public interface MapView extends IView {
|
||||
|
||||
/**
|
||||
* 地图控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapUIController getUIController();
|
||||
}
|
||||
@@ -13,13 +13,10 @@ import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.autonavi.amap.mapcore.IPoint;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 包名: com.amap.api.navi.core
|
||||
|
||||
@@ -1,368 +0,0 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
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.map.R;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.widget.RoundLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 小地图的方向View
|
||||
*
|
||||
* @author donghongyu
|
||||
* @date 12/14/20 4:40 PM
|
||||
*/
|
||||
public class SmallMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMoGoChassisLocationGCJ02Listener, ISmallMapDirectionView {
|
||||
|
||||
//小地图名称
|
||||
public static final String TAG = "SmallMapDirectionView";
|
||||
|
||||
private RoundLayout rlSmallMapBorder;
|
||||
private TextureMapView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 15;
|
||||
private final List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private final List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
private MogoLocation mLocation;
|
||||
|
||||
public SmallMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
try {
|
||||
initView(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
mContext = context;
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = smpView.findViewById(R.id.aMapNaviView);
|
||||
// rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
// rlSmallMapBorder.addView(mAMapNaviView);
|
||||
|
||||
initAMapView();
|
||||
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
startTask();
|
||||
}
|
||||
|
||||
private void startTask() {
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new UpdateLocationTask(), 1000, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ20ListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 关闭地图文字标注
|
||||
mAMap.showMapText(false);
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
// 设置 锚点 图标
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon))
|
||||
.anchor(0.5f, 0.5f));
|
||||
} else {
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon))
|
||||
.anchor(0.5f, 0.5f));
|
||||
}
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)));
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
// 设置地图的样式
|
||||
UiSettings uiSettings = mAMap.getUiSettings();
|
||||
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
mAMap.setOnMapLoadedListener(() -> {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions1 = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions1);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
if (gnssInfo == null) {
|
||||
return;
|
||||
}
|
||||
mLocation = gnssInfo;
|
||||
}
|
||||
|
||||
private class UpdateLocationTask extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLocation != null) {
|
||||
if (mCarMarker == null) {
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
.anchor(0.5f, 0.5f));
|
||||
}
|
||||
if (mCarMarker == null) {
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(mLocation.getLatitude(), mLocation.getLongitude());
|
||||
float bearing = (float) Math.floor(mLocation.getHeading());
|
||||
//更新车辆位置
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
|
||||
CameraPosition cameraPosition;
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
// 结束位置
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
|
||||
float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
);
|
||||
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "calculateDistance=" + calculateDistance);
|
||||
if (calculateDistance <= 5) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
}
|
||||
}
|
||||
cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).tilt(0).bearing(bearing).zoom(zoomLevel).build();
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLocation(Location latLng) {
|
||||
for (LatLng l : mCoordinatesLatLng) {
|
||||
if (!isPointOnCarFront(latLng, l)) {
|
||||
mCoordinatesLatLng.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPointOnCarFront(Location carLocal, LatLng pointLocal) {
|
||||
double carLon = carLocal.getLongitude();
|
||||
double carLat = carLocal.getLatitude();
|
||||
double poiLon = pointLocal.longitude;
|
||||
double poiLat = pointLocal.latitude;
|
||||
float carAngle = carLocal.getBearing();
|
||||
|
||||
// 计算车辆与点之间的夹角
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
|
||||
return diffAngle <= 90;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawablePolyline() {
|
||||
clearPolyline();
|
||||
// mCoordinatesLatLng.clear();
|
||||
// List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext,coordinates);
|
||||
// mCoordinatesLatLng.addAll(latLngs);
|
||||
// for (LatLng coordinate : mCoordinatesLatLng) {
|
||||
// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
// }
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
mStartMarker.setPosition(mCoordinatesLatLng.get(0));
|
||||
mEndMarker.setPosition(mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1));
|
||||
mStartMarker.setToTop();
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
mEndMarker.setToTop();
|
||||
|
||||
|
||||
//存放所有点的经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
|
||||
//把所有点都include进去(LatLng类型)
|
||||
boundsBuilder.include(mCoordinatesLatLng.get(i));
|
||||
}
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(), 30));
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(
|
||||
new PolylineOptions()
|
||||
.addAll(mCoordinatesLatLng)
|
||||
.color(Color.argb(255, 31, 127, 255))
|
||||
.width(12));
|
||||
|
||||
}
|
||||
// else {
|
||||
// //设置希望展示的地图缩放级别
|
||||
// mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mCoordinatesLatLng.get(0), zoomLevel));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
return mCoordinateConverter.convert();
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MogoLatLng m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
// mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyLine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.BaseFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
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.map.smp.IMogoSmallMapProvider;
|
||||
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.CallerPlanningRottingListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2021/5/19 10:50 上午
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_SMP)
|
||||
public class SmallMapFragment extends BaseFragment
|
||||
implements IMogoSmallMapProvider,
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
protected SmallMapDirectionView mSmallMapDirectionView;
|
||||
private int autoPilotStatus = 0;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_small_map_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG,this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.convert(coordinates);
|
||||
mSmallMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
UiThreadHandler.post(() -> mSmallMapDirectionView.clearPolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.onDestroy();
|
||||
}
|
||||
CallerPlanningRottingListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int tempStatus = autoPilotStatusInfo.getPilotmode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:"+tempStatus+" autoPilotStatus:"+autoPilotStatus);
|
||||
if (tempStatus != 1) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:"+tempStatus+" clearPolyline");
|
||||
clearPolyline();
|
||||
}else if (tempStatus == 1 && autoPilotStatus == 0){
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:getGlobalPath");
|
||||
CallerAutoPilotControlManager.INSTANCE.getGlobalPath();
|
||||
}
|
||||
autoPilotStatus = tempStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting");
|
||||
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+globalPathResp.getWayPointsList().size());
|
||||
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
||||
}
|
||||
if (latLngList.size() > 0) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+"drawablePolyline");
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+"clearPolyline");
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.annotation.UiThread
|
||||
import com.amap.api.maps.*
|
||||
@@ -19,7 +20,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.getGlobalPath
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
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.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
@@ -28,7 +29,6 @@ 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.util.UiThreadHandler
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.*
|
||||
import kotlin.math.floor
|
||||
|
||||
class SmallMapView @JvmOverloads constructor(
|
||||
@@ -44,7 +44,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
private var mCarMarker: Marker? = null
|
||||
private var mStartMarker: Marker? = null
|
||||
private var mEndMarker: Marker? = null
|
||||
private val zoomLevel = 15
|
||||
private val zoomLevel = 17
|
||||
private val mCoordinatesLatLng: MutableList<LatLng> = ArrayList()
|
||||
private var mPolyline: Polyline? = null
|
||||
private var mCameraUpdate: CameraUpdate? = null
|
||||
@@ -155,10 +155,9 @@ class SmallMapView @JvmOverloads constructor(
|
||||
initAMapView()
|
||||
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, this)
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
startTask()
|
||||
}
|
||||
|
||||
private fun initAMapView() {
|
||||
@@ -236,52 +235,6 @@ class SmallMapView @JvmOverloads constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun startTask() {
|
||||
val mTimer = Timer()
|
||||
mTimer.schedule(UpdateLocationTask(), 1000, 200)
|
||||
}
|
||||
|
||||
private inner class UpdateLocationTask : TimerTask() {
|
||||
override fun run() {
|
||||
if (mLocation != null) {
|
||||
if (mCarMarker == null) {
|
||||
mCarMarker = mAMap!!.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
.anchor(0.5f, 0.5f)
|
||||
)
|
||||
}
|
||||
if (mCarMarker == null) {
|
||||
return
|
||||
}
|
||||
val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude)
|
||||
val bearing = floor(mLocation!!.heading).toFloat()
|
||||
//更新车辆位置
|
||||
mCarMarker!!.position = currentLatLng
|
||||
if (mCoordinatesLatLng.size > 1) {
|
||||
// 结束位置
|
||||
val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
|
||||
val calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG,
|
||||
"calculateDistance=$calculateDistance"
|
||||
)
|
||||
if (calculateDistance <= 5) {
|
||||
clearPolyline()
|
||||
mCoordinatesLatLng.clear()
|
||||
}
|
||||
}
|
||||
val cameraPosition: CameraPosition =
|
||||
CameraPosition.Builder().target(mCarMarker!!.position).tilt(0f).bearing(bearing)
|
||||
.zoom(zoomLevel.toFloat()).build()
|
||||
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun coordinateConverterFrom84(mContext: Context?, mogoLatLng: MogoLatLng): LatLng {
|
||||
val mCoordinateConverter = CoordinateConverter(mContext)
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS)
|
||||
@@ -306,6 +259,53 @@ class SmallMapView @JvmOverloads constructor(
|
||||
return
|
||||
}
|
||||
mLocation = mogoLocation
|
||||
if (mCarMarker == null) {
|
||||
mCarMarker =
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
mAMap?.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon))
|
||||
.anchor(0.5f, 0.5f)
|
||||
)
|
||||
} else {
|
||||
mAMap?.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon))
|
||||
.anchor(0.5f, 0.5f)
|
||||
)
|
||||
}
|
||||
}
|
||||
if (mCarMarker == null) {
|
||||
return
|
||||
}
|
||||
val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude)
|
||||
val bearing = floor(mLocation!!.heading).toFloat()
|
||||
//更新车辆位置
|
||||
mCarMarker!!.position = currentLatLng
|
||||
if (mCoordinatesLatLng.size > 1) {
|
||||
// 结束位置
|
||||
val endLatLng = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
|
||||
val calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG,
|
||||
"calculateDistance=$calculateDistance"
|
||||
)
|
||||
if (calculateDistance <= 5) {
|
||||
clearPolyline()
|
||||
mCoordinatesLatLng.clear()
|
||||
}
|
||||
}
|
||||
val cameraPosition: CameraPosition =
|
||||
CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position)
|
||||
.tilt(0f)
|
||||
.bearing(bearing)
|
||||
.zoom(zoomLevel.toFloat())
|
||||
.build()
|
||||
mAMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
@@ -340,10 +340,14 @@ class SmallMapView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user