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:
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.eagle.core.function.datacenter.v2x
|
||||
|
||||
import android.content.Context
|
||||
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
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 对多个限速进行调度(map,rsu ...)
|
||||
* @since: 2023/1/12
|
||||
*/
|
||||
class SpeedLimitDispatcher : ILimitingVelocityListener {
|
||||
companion object {
|
||||
const val TAG = "SpeedLimitDispatcher"
|
||||
val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
SpeedLimitDispatcher()
|
||||
}
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
//obu限速状态
|
||||
private var hasObuStatus: Boolean = false
|
||||
|
||||
fun initLimit(context: Context) {
|
||||
mContext = context
|
||||
CallerLimitingVelocityListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图限速数据
|
||||
*/
|
||||
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo arrow 重新考虑放的位置
|
||||
override fun onUnion(limitingVelocity: Int, sourceType: DataSourceType) {
|
||||
super.onUnion(limitingVelocity, sourceType)
|
||||
when (sourceType) { // obu 优先级高于 map,体现链路能力
|
||||
DataSourceType.OBU -> {
|
||||
hasObuStatus = limitingVelocity > 0
|
||||
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
|
||||
limitingVelocity,
|
||||
sourceType
|
||||
)
|
||||
return
|
||||
}
|
||||
DataSourceType.MAP -> {
|
||||
if (!hasObuStatus) {
|
||||
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
|
||||
limitingVelocity,
|
||||
sourceType
|
||||
)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
CallerLimitingVelocityListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.mogo.eagle.core.function.datacenter.v2x
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
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.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
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)
|
||||
* @优先级:OBU,云,工控
|
||||
* @since: 2022/4/28
|
||||
*/
|
||||
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "TrafficLightDispatcher"
|
||||
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficLightDispatcher()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
//是否有AI获取红绿灯灯态
|
||||
private var hasAiLightStatus: Boolean = false
|
||||
|
||||
//obu数据
|
||||
private var hasObuLightStatus: Boolean = false
|
||||
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
//注册监听AI云.OBU,路侧获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机感知红绿灯
|
||||
* @param trafficLights 感知红绿灯
|
||||
*/
|
||||
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
trafficLights?.let { it ->
|
||||
var light: TrafficLight? = null
|
||||
if (it.hasStraight()) {
|
||||
light = it.straight
|
||||
} else if (it.hasLeft()) {
|
||||
light = it.left
|
||||
} else if (it.hasRight()) {
|
||||
light = it.right
|
||||
} else if (it.hasUTurn()) {
|
||||
light = it.uTurn
|
||||
}
|
||||
if (light == null) {
|
||||
//隐藏红绿灯显示
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
} else {
|
||||
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AI云获取红绿灯状态
|
||||
*/
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
if (!hasObuLightStatus) {
|
||||
hasAiLightStatus = true
|
||||
updateTrafficLight(trafficLightResult)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆进入路口回调
|
||||
* @param enter true:进入路口;false:离开路口
|
||||
*/
|
||||
override fun onEnterCrossRoad(enter: Boolean) {
|
||||
if (!enter) {
|
||||
Handler().postDelayed({
|
||||
hasAiLightStatus = false
|
||||
hasObuLightStatus = false
|
||||
}, 5000)
|
||||
//如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 红绿灯接口请求失败
|
||||
*/
|
||||
override fun onTrafficRequestError() {
|
||||
hasAiLightStatus = false
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
|
||||
currentTrafficLight?.let {
|
||||
val remain = if (it.remain > 99) {
|
||||
99
|
||||
} else {
|
||||
it.remain
|
||||
}
|
||||
onTrafficLightPlusSource(it.convert(), remain, DataSourceType.AICLOUD)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
//取消注册监听AI云.OBU,路侧获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
//取消注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user