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

This commit is contained in:
donghongyu
2023-02-15 16:37:39 +08:00
95 changed files with 1149 additions and 1038 deletions

View File

@@ -4,15 +4,18 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.biz.IMoGoFuncBizProvider
import com.mogo.eagle.core.function.api.biz.IMoGoNoticeNetCallBack
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.dispatchAutoPilotManager
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.overview.OverViewDataManager
import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.road.LineUploadManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@@ -22,13 +25,19 @@ class FuncBizProvider : IMoGoFuncBizProvider {
override val functionName: String
get() = "FuncBiz"
private var mContext:Context? = null
override fun init(context: Context) {
mContext = context
noticeSocketManager.init(context)
dispatchAutoPilotManager.init(context)
cronTaskManager.startCronTask()
OverviewDb.getDb(context)
MogoTrafficLightManager.INSTANCE.initServer(context)
VipCarManager.INSTANCE.initServer(context)
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
LineUploadManager.getInstance(context)?.init()
}
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}
@@ -81,6 +90,11 @@ class FuncBizProvider : IMoGoFuncBizProvider {
cronTaskManager.release()
VipCarManager.INSTANCE.destroy()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
mContext?.let {
LineUploadManager.getInstance(it)?.onDestroy()
}
}
// RedLightWarningManager.INSTANCE.onDestroy()
}
}

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.function.biz.v2x.road
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.v2x.LineUploadData
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.Headers
import retrofit2.http.POST
interface ILineUploadApi {
@Headers("Content-type:application/json;charset=UTF-8" )
@POST( "" )
fun uploadLineId(@Body lineId: LineUploadData): Observable<BaseData>
}

View File

@@ -0,0 +1,75 @@
package com.mogo.eagle.function.biz.v2x.road
import android.content.Context
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.constants.HostConst.DATA_CENTER_HOST
import com.mogo.eagle.core.data.v2x.LineUploadData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
class LineUploadManager private constructor(context: Context) : IMoGoAutopilotStatusListener {
companion object {
private const val TAG = "LineUploadManager"
@Volatile
private var lineUploadManager: LineUploadManager? = null
@Synchronized
fun getInstance(context: Context): LineUploadManager? {
if (lineUploadManager == null) {
synchronized(LineUploadManager::class.java) {
if (lineUploadManager == null) {
lineUploadManager = LineUploadManager(context)
}
}
}
return lineUploadManager
}
}
private var mContext: Context? = null
private var disposable: Disposable? = null
init {
mContext = context
}
fun init() {
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
override fun onAutopilotRouteLineId(lineId: Long) {
super.onAutopilotRouteLineId(lineId)
if (lineId > 0) {
uploadLine(lineId)
}
}
private fun uploadLine(lineId: Long) {
val lineUploadData = LineUploadData(lineId, MoGoAiCloudClientConfig.getInstance().sn)
disposable = MoGoRetrofitFactory.getInstance(DATA_CENTER_HOST)
.create(ILineUploadApi::class.java)
.uploadLineId(lineUploadData)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ data ->
CallerLogger.d(TAG, " uploadLine : $data")
}, {
CallerLogger.d(TAG, "e : ${it.message}")
})
}
fun onDestroy() {
mContext = null
disposable?.dispose()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}

View File

@@ -137,13 +137,6 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
}
}
fun getTrafficLightCurrentState(): TrafficLightDetail? {
trafficLightResult?.let {
return it.laneList
}
return null
}
fun getRoadResult(): RoadIDResult? {
return roadIDResult
}

View File

@@ -58,7 +58,6 @@ dependencies {
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-data')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -3,13 +3,7 @@
package="com.mogo.eagle.core.function.datacenter">
<application>
<receiver android:name=".obu.receiver.ObuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestTriggerRecognizedReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger_recognized" />
@@ -18,13 +12,6 @@
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu" />

View File

@@ -4,6 +4,7 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.telematic.IMogoTelematicProvider
import com.mogo.telematic.MogoProtocolMsg
import com.mogo.telematic.NSDNettyManager
@Route(path = MogoServicePaths.PATH_TELEMATIC_PROVIDER)
@@ -26,4 +27,16 @@ class MoGoTelematicProvider: IMogoTelematicProvider {
override fun getServerToken(): String {
return NSDNettyManager.getInstance().serverSn
}
override fun sendMsgToAllClients(type: Int, byteArray: ByteArray) {
NSDNettyManager.getInstance().sendMsgToAllClients(
MogoProtocolMsg(type, byteArray.size, byteArray)
)
}
override fun sendMsgToServer(type: Int, byteArray: ByteArray) {
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
MogoProtocolMsg(type, byteArray.size, byteArray),
null)
}
}

View File

@@ -8,10 +8,12 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.telematic.TelematicConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -122,6 +124,9 @@ class TeleMsgHandler : IMsgHandler {
}
}
}
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
else -> {
}
}
@@ -166,6 +171,9 @@ class TeleMsgHandler : IMsgHandler {
invokeNettyConnResult("司机屏SN未获取到不发送给乘客屏")
}
}
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
else -> {
}
}

View File

@@ -223,14 +223,14 @@ object MoGoLocationDispatcher :
/**
* OBU定位回调监听
*/
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
override fun onObuLocationWGS84(data: MessagePad.GnssInfo) {
// 更新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.longitude = data.longitude
lastOBULocation.latitude = data.latitude
lastOBULocation.heading = data.heading
lastOBULocation.gnssSpeed = data.gnssSpeed.toFloat()
lastOBULocation.altitude = data.altitude
lastOBULocation.satelliteTime = (data.satelliteTime * 1000).toLong()
lastOBULocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等

View File

@@ -256,24 +256,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent, null, direction
)
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
@@ -342,25 +326,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent,
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,
null,
direction
)
saveObuToDcData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
@@ -459,27 +426,19 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
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.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
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_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_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
}
@@ -552,24 +511,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
"${M_OBU}${TAG}",
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
@@ -605,23 +548,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
}
@@ -666,4 +594,35 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
}
}
/**
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
}
/**
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
}
}

View File

@@ -29,7 +29,6 @@ import com.mogo.support.obu.constants.MogoObuComType
import com.mogo.support.obu.constants.MogoObuConstants
import com.mogo.support.obu.constants.MogoObuTopicId
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 com.zhidao.support.obu.ObuManager
@@ -72,7 +71,7 @@ class MogoPrivateObuNewManager private constructor() {
.registerTopic(MogoObuTopicId.MAP_MATCH)
.build()
//每次连接的时候如果连接连接了,先断开
//每次连接的时候如果连接连接了,先断开防止ip改变等导致的连接失败
if (ObuManager.getInstance().connectStatus == 1) {
try {
ObuManager.getInstance().disconnect()
@@ -80,7 +79,6 @@ class MogoPrivateObuNewManager private constructor() {
e.printStackTrace()
}
}
ObuManager.getInstance().connect(options)
}
@@ -92,7 +90,6 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().disconnect()
}
private val mogoObuListener: OnObuListener = object : OnObuListener {
/**
* 连接状态的改变
@@ -111,15 +108,15 @@ class MogoPrivateObuNewManager private constructor() {
* HV车辆基础信息 gnssInfo
*/
override fun onGnssInfo(gnssInfo: MessagePad.GnssInfo?) {
if (gnssInfo != null ) {
if (gnssInfo != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onGnssInfo lon = ${gnssInfo.longitude} --- lat = ${gnssInfo.latitude} ---speed = ${gnssInfo.gnssSpeed} ---heading = ${gnssInfo.heading} --acceleration = ${gnssInfo.acceleration} --yawRate = ${gnssInfo.yawRate}"
)
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
if (2 == FunctionBuildConfig.gpsProvider) {
// 同步给MAP地图 TODO
// CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步给MAP地图
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
System.currentTimeMillis() / 1000.0,
@@ -244,9 +241,6 @@ class MogoPrivateObuNewManager private constructor() {
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (data.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
@@ -296,11 +290,6 @@ class MogoPrivateObuNewManager private constructor() {
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
// }
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
@@ -365,30 +354,12 @@ class MogoPrivateObuNewManager private constructor() {
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
// CallerHmiManager.showWarning(direction)
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
null, direction
)
saveObuData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
@@ -472,19 +443,6 @@ class MogoPrivateObuNewManager private constructor() {
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
//处理删除逻辑,
// if (rsmPtcIdMap.containsKey(data.participant.ptcId.toString())) {
// var oldTime = rsmPtcIdMap[data.participant.ptcId.toString()]
// var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
// if (timeDiff > 3) { //超过3秒,删除对应弱势交通元素
// CallerMapUIServiceManager.getMarkerService()
// ?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
// }
// rsmPtcIdMap.remove(data.participant.ptcId.toString())
// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis()
// } else {
// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis()
// }
}
MogoObuConstants.STATUS.DELETE -> { // 删除
@@ -522,25 +480,8 @@ class MogoPrivateObuNewManager private constructor() {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
null, direction
)
saveObuData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
@@ -593,9 +534,8 @@ class MogoPrivateObuNewManager private constructor() {
}
}
}
}
}
}
}
}
/**
* 获取消息的方位 车辆相关
@@ -605,27 +545,19 @@ class MogoPrivateObuNewManager private constructor() {
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.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
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_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_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
}
@@ -633,10 +565,9 @@ class MogoPrivateObuNewManager private constructor() {
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截
*
* @see com.mogo.module.common.enums.EventTypeEnum
* @see com.mogo.module.common.enums.EventTypeEnumNew
* EventTypeEnumNew在定义的id为了防止重复和原始数据是不一样的有对应关系
*/
private fun handleSdkObu(
appId: String,
@@ -650,12 +581,14 @@ class MogoPrivateObuNewManager private constructor() {
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)
// ObuManager.getInstance().obuRvToTrackedObject(info) //todo emArrow
}
//交叉路口碰撞预警
@@ -766,9 +699,9 @@ class MogoPrivateObuNewManager private constructor() {
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> { //TODO
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
else -> {
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
@@ -782,18 +715,7 @@ class MogoPrivateObuNewManager private constructor() {
)
if (level == 2 || level == 3) {
//不显示弹框,其它保留
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
saveObuData(appId, alertContent, ttsContent)
CallerHmiManager.warningV2X(
appId,
alertContent,
@@ -837,7 +759,11 @@ class MogoPrivateObuNewManager private constructor() {
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: MutableList<ObuBase.SpatLight>) {
private fun handlerTrafficLight(
appId: Int,
status: Int,
lights: MutableList<ObuBase.SpatLight>
) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
@@ -845,8 +771,7 @@ class MogoPrivateObuNewManager private constructor() {
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
MogoObuConstants.STATUS.UPDATE -> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
@@ -857,9 +782,7 @@ class MogoPrivateObuNewManager private constructor() {
CallerTrafficLightListenerManager.disableTrafficLight()
isShowGreenWave = false
isShowRunRedLight = false
// lightCountDownRed = 1
// lightCountDownGreen = 1
// lightCountDownYellow = 1
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
}
}
}
@@ -867,7 +790,6 @@ class MogoPrivateObuNewManager private constructor() {
private var isShowGreenWave = false
private var isShowRunRedLight = false
/**
* 修改红绿灯
*/
@@ -893,31 +815,13 @@ class MogoPrivateObuNewManager private constructor() {
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
)
"$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,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
@@ -935,33 +839,16 @@ class MogoPrivateObuNewManager private constructor() {
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
adviceSpeedTts)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
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防止更新的时候不断的提醒
)
saveObuData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
}
@@ -1004,4 +891,39 @@ class MogoPrivateObuNewManager private constructor() {
)
}
}
}
}
/**
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.OBU
}
)
}
/**
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
}
}

View File

@@ -1,15 +1,17 @@
package com.mogo.eagle.core.function.datacenter.obu.adapter
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.support.obu.OnMogoObuListener
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.Define.ConnectStatus
import com.mogo.support.obu.model.*
import com.zhidao.support.obu.OnObuListener
import mogo.telematics.pad.MessagePad
/**
* 适配 OBU 回调监听分发,这里不做业务,只做数据包装及分发处理
* @author dong hong yu
*/
object MoGoObuListenerImpl : OnMogoObuListener() {
object MoGoObuListenerImpl : OnObuListener {
/**
* 连接状态
@@ -36,8 +38,10 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuHvBasics(data: MogoObuHvBasicsData) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(data)
override fun onGnssInfo(gnssInfo: MessagePad.GnssInfo?) {
if (gnssInfo != null) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
}
}
/**
@@ -46,8 +50,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
CallerObuWarningRvListenerManager.invokeObuRvWarning(data)
override fun onObuRvWarning(rvWarningData: ObuScene.RvWarningData?) {
}
/**
@@ -56,8 +59,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) {
override fun onObuSpatWarning(spatWarningData: ObuScene.SpatWarningData?) {
}
/**
@@ -66,8 +68,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
override fun onObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData?) {
}
/**
@@ -76,7 +77,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) {
override fun onObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData?) {
}
/**
@@ -85,6 +86,8 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData) {
override fun onObuMapMath(mapMatchData: ObuScene.MapMatchData?) {
}
}

View File

@@ -1,120 +0,0 @@
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants
//import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
//import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
//import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
//import com.zhidao.support.obu.model.CvxSlwThreatIndInfo
//import com.zhidao.support.obu.model.advance.*
/**
* @author lixiaopeng
* @date 2021/8/18
*
* OBU 测试使用
* 红绿灯
*/
class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuRsuTestTriggerReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
mContext = context
// val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
// val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
// val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
// val indicator = intent.getIntExtra(MogoObuConst.BROADCAST_LIGHT_LEVEL_EXTRA_KEY, 0)
// val pctType = intent.getIntExtra(MogoObuConst.BROADCAST_PTC_INFO_EXTRA_KEY, 0)
// val rtiType = intent.getIntExtra(MogoObuConst.BROADCAST_RTI_TYPE_EXTRA_KEY, 0)
//
// CallerLogger.d(
// "$M_OBU$TAG", "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
// )
//
// when (obuType) {
// ObuConstants.USE_CASE_ID.IVP -> { //构建红绿灯数据
// val cvxIvpThreatIndInfo = CvxIvpThreatIndInfo(1, 1, 1L)
//
// val ivpThreat = IvpThreat(1, obuType, null, 1000, obuLevel, 100)
//
// cvxIvpThreatIndInfo.threat_info = ivpThreat
//
// val lightList = listOf(
// Light(1, 0x0, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x1, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x2, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x3, 1000, 3000, 6000, 3000, 100, 1000)
// )
// val ivpThreatExt = IvpThreatExt(1, 1000, 1000, 0, indicator, lightList)
// cvxIvpThreatIndInfo.ext_info = ivpThreatExt
// cvxIvpThreatIndInfo.status = obuStatus
// cvxIvpThreatIndInfo.link_id = "1"
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxIvpThreatIndInfo(cvxIvpThreatIndInfo)
// }
//
// ObuConstants.USE_CASE_ID.SLW -> { //限速预警
// val cvxSlwThreatIndInfo = CvxSlwThreatIndInfo(1, 1, 1L)
// val slwThreatExt = SlwThreatExt(1, 2, 6000, 2000)
//
// cvxSlwThreatIndInfo.ext_info = slwThreatExt
// cvxSlwThreatIndInfo.status = obuStatus
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxSlwThreatIndInfo(cvxSlwThreatIndInfo)
// }
//
// //弱势交通参与者碰撞预警,行人/摩托车碰撞预警
// ObuConstants.USE_CASE_ID.VRUCW -> {
// val cvxPtcIndInfo = CvxPtcThreatIndInfo(1, 1, 1)
// val position = Position(1, 399739429, 1164115207, 20)
// cvxPtcIndInfo.ptc_pos = position
// cvxPtcIndInfo.ptc_id = "111"
// cvxPtcIndInfo.ptc_type = pctType
// cvxPtcIndInfo.status = obuStatus
//
// val v2vThreat = V2vThreat(1, obuType, null, 1000, obuLevel, 100)
// cvxPtcIndInfo.threat_info = v2vThreat
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxPtcThreatIndInfo(cvxPtcIndInfo)
// }
//
// //道路危险情况, 车内标牌, 前方拥堵提醒
// ObuConstants.USE_CASE_ID.HLW, ObuConstants.USE_CASE_ID.IVS, ObuConstants.USE_CASE_ID.TJW -> {
// val cvxRtiThreatIndInfo = CvxRtiThreatIndInfo(1, 1, 1L)
// val dateTime = DateTime(1, 1, 1, 1, 1, 1, 1, 1)
// val rtiThread = RtiThreat(1, obuType, dateTime, 100000, obuLevel, 100)
// val extInfo = RtiThreatExt(1, rtiType, 0x02, 100000, 100000)
// val position = Position(1, 399739429, 1164115207, 20)
//
// // 位置围栏
// val zonesInfo = listOf(
// ZoneInfo(1, 2000, 2000, listOf(position))
// )
//
// cvxRtiThreatIndInfo.rti_id = "123123"
// cvxRtiThreatIndInfo.zones_info = zonesInfo
// cvxRtiThreatIndInfo.threat_info = rtiThread
// cvxRtiThreatIndInfo.ext_info = extInfo
// cvxRtiThreatIndInfo.status = obuStatus
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxRtiThreatIndInfo(cvxRtiThreatIndInfo)
// }
// }
}
}

View File

@@ -14,7 +14,7 @@ import com.mogo.support.obu.model.advance.WarningData
* @author lixiaopeng
* @date 2022/9/8 10:50 上午
*
* 自研OBU 模拟场景
* 自研OBU 模拟场景 HV
*/
class ObuTestNewObuReceiver : BroadcastReceiver() {
private var mContext: Context? = null
@@ -49,6 +49,8 @@ class ObuTestNewObuReceiver : BroadcastReceiver() {
// val cvxHvInfoIndInfo = MogoRvWarningData(0, vehBasicsMsg, warningMsg)
// val gnssInfo = MessagePad.GnssInfo()
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onGnssInfo(cvxHvInfoIndInfo)

View File

@@ -1,89 +0,0 @@
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants
//import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
//import com.zhidao.support.obu.model.advance.MovingObjectInfo
//import com.zhidao.support.obu.model.advance.Position
//import com.zhidao.support.obu.model.advance.V2vThreat
//import com.zhidao.support.obu.model.advance.V2vThreatExt
//import kotlin.random.Random
/**
* @author xiaoyuzhou
* @date 2021/8/11 10:50 上午
*
* OBU 测试使用
*/
class ObuTestTriggerReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuTestTriggerReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
// mContext = context
// /**
// * OBU 场景类型
// * @see com.zhidao.support.obu.constants.ObuConstants.USE_CASE_ID
// */
// val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
// val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
// val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
// val obuDirection =
// intent.getIntExtra(MogoObuConst.BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY, 0x11)
// CallerLogger.d(
// "$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection"
// )
//
// when (obuType) {
// ObuConstants.USE_CASE_ID.EBW, ObuConstants.USE_CASE_ID.FCW, ObuConstants.USE_CASE_ID.ICW,
// ObuConstants.USE_CASE_ID.CLW, ObuConstants.USE_CASE_ID.DNPW, ObuConstants.USE_CASE_ID.AVW,
// ObuConstants.USE_CASE_ID.BSW, ObuConstants.USE_CASE_ID.LCW, ObuConstants.USE_CASE_ID.EVW, ObuConstants.USE_CASE_ID.VRUCW,
// ObuConstants.USE_CASE_ID.SLW, ObuConstants.USE_CASE_ID.LTA, ObuConstants.USE_CASE_ID.HLW, ObuConstants.USE_CASE_ID.IVS,
// ObuConstants.USE_CASE_ID.TJW, ObuConstants.USE_CASE_ID.IVP, ObuConstants.USE_CASE_ID.COC -> {
//
// // 构建测试数据
// val cvxV2vThreatIndInfo = CvxV2vThreatIndInfo(1, 1, 1L)
//
// val v2vThreat = V2vThreat(1, obuType, null, 1000, obuLevel, 100)
// cvxV2vThreatIndInfo.threat_info = v2vThreat
//
// val v2vThreatExt =
// V2vThreatExt(
// 1, 1, obuDirection, 1, 1
// )
// cvxV2vThreatIndInfo.ext_info = v2vThreatExt
// cvxV2vThreatIndInfo.status = obuStatus
// cvxV2vThreatIndInfo.vehicle_id = "123321"
//
//
// // 设置位置
// val randomLocation = Random.nextInt(100, 2000)
//
// val position = Position(
// 0, (399739429 + randomLocation).toLong(),
// (1164115207 + randomLocation).toLong(), 20
// )
// val movingObjectInfo = MovingObjectInfo(
// 0,
// position,
// 1800 +randomLocation,
// 6000 +randomLocation
// )
// cvxV2vThreatIndInfo.basic_info = movingObjectInfo
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxV2vThreatIndInfo(cvxV2vThreatIndInfo)
// }
// }
}
}

View File

@@ -125,6 +125,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
}
/**
* obu数据消失
*/
override fun onObuTrafficLightDisapper() {
hasObuLightStatus = false
}
/**
* obu 红绿灯数据
*/

View File

@@ -101,7 +101,7 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
}
fun modifyCarInfo(callBack: (ModifyBindingcarInfo) -> Unit) {
BindingCarNetWorkManager.instance.modifyBindingcar(mAddress, mWidevineIDWithMd5, callBack, screenType)
BindingCarNetWorkManager.instance.modifyBindingCar(mContext!!, mAddress, mWidevineIDWithMd5, callBack, screenType)
}
private fun driverScreen(macAddress: String, widevineIDWithMd5: String) {
@@ -115,7 +115,7 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
SharedPrefsMgr.getInstance(mContext!!)
.putLong("typeDriver", System.currentTimeMillis() / (1000 * 60))
BindingCarNetWorkManager.instance
.getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, screenType)
.getBindingCarInfo(mContext!!, macAddress, widevineIDWithMd5, screenType)
}
}
}
@@ -131,7 +131,7 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
SharedPrefsMgr.getInstance(mContext!!)
.putLong("typePassenger", System.currentTimeMillis() / (1000 * 60))
BindingCarNetWorkManager.instance
.getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, screenType)
.getBindingCarInfo(mContext!!, macAddress, widevineIDWithMd5, screenType)
}
}
}//乘客屏//司机屏

View File

@@ -3,6 +3,7 @@ package com.zhjt.mogo_core_function_devatools.binding
import android.content.Context
import com.mogo.commons.constants.HostConst
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.bindingcar.BindingCarInfo
import com.mogo.eagle.core.data.bindingcar.BindingCarRequest
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
@@ -40,16 +41,17 @@ class BindingCarNetWorkManager private constructor() {
}
}
private val mBindingCarApiService: BindingCarApiService = MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(BindingCarApiService::class.java)
private val mBindingCarApiService: BindingCarApiService =
MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(BindingCarApiService::class.java)
/**
* 获取绑定的车辆信息
*
* @param macAddress mac地址
*/
fun getBindingcarInfo(
context: Context?,
fun getBindingCarInfo(
context: Context,
macAddress: String?,
widevineIDWithMd5: String?,
screenType: Int
@@ -72,28 +74,24 @@ class BindingCarNetWorkManager private constructor() {
override fun onSubscribe(d: Disposable) {}
override fun onNext(info: BindingCarInfo) {
if (info != null && info.getData() != null) {
d(
SceneConstant.M_BINDING + TAG,
"getBindingcarInfo onNext info.getData() =" + info.getData().toString()
)
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
updateCarVrIconRes(info.getData().brandId)
d(SceneConstant.M_BINDING + TAG, "getBindingCarInfo data =" + info.getData().toString())
if (!SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.MAC_ADDRESS).equals(macAddress) && DebugConfig.isCarModelChange()) {
updateCarVrIconRes(info.getData().brandId);
}
when (info.getData().compare) {
"0" -> showBindingCarDialog()
"3" -> showModifyBindingCarDialog()
"null" -> TipToast.shortTip("当前工控机没有入库")
}
SharedPrefsMgr.getInstance(context!!).putString(
SharedPrefsConstants.CAR_INFO,
GsonUtils.toJson(info.getData())
)
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.getData()))
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.MAC_ADDRESS, macAddress)
}
}
override fun onError(e: Throwable) {
e(
SceneConstant.M_BINDING + TAG,
"getBindingcarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message
"getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message
)
}
@@ -105,7 +103,8 @@ class BindingCarNetWorkManager private constructor() {
* 绑定和修改绑定车辆
* mac: 48:b0:2d:3a:9c:19
*/
fun modifyBindingcar(
fun modifyBindingCar(
context: Context,
macAddress: String?,
widevineIDWithMd5: String?,
callBack: (ModifyBindingcarInfo) -> Unit,
@@ -132,16 +131,19 @@ class BindingCarNetWorkManager private constructor() {
callBack.invoke(info)
d(
SceneConstant.M_BINDING + TAG,
"modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString()
"modifyBindingCar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString()
)
updateCarVrIconRes(info.data.brandId)
if (!SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.MAC_ADDRESS).equals(macAddress) && DebugConfig.isCarModelChange()) {
updateCarVrIconRes(info.data.brandId);
}
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.MAC_ADDRESS, macAddress)
}
}
override fun onError(e: Throwable) {
e(
SceneConstant.M_BINDING + TAG,
"modifyBindingcar onError e = " + e.toString() + "---e.getMessage = " + e.message
"modifyBindingCar onError e = " + e.toString() + "---e.getMessage = " + e.message
)
}

View File

@@ -0,0 +1,79 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
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.MBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_m_box_bubble.view.*
class MBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxBean> = ArrayList()
private var mBoxBubbleAdapter: MBoxBubbleAdapter?= null
private var isShowData = true
init {
LayoutInflater.from(context).inflate(R.layout.layout_m_box_bubble, this, true)
initView()
}
private fun initView(){
val linearLayoutManager = LinearLayoutManager(context)
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
mBoxBubbleAdapter = MBoxBubbleAdapter(context as Activity)
rvMBoxBubbleList.adapter = mBoxBubbleAdapter
rvMBoxBubbleList.layoutManager = linearLayoutManager
}
/**
* 是否展示接收消息,消息盒子打开状态下不再展示气泡消息
* @param show true 展示false 不展示
*/
fun isShowData(show: Boolean){
isShowData = show
}
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
UiThreadHandler.post {
if(category == MsgCategory.NOTICE){
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|| msgBoxList.type == MsgBoxType.OBU){
MsgBoxConfig.noticeList.add(msgBoxList)
if(isShowData){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
dataList.add(msgBoxList)
mBoxBubbleAdapter?.setData(dataList)
}
}
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
}
}

View File

@@ -0,0 +1,119 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.app.Activity
import android.os.CountDownTimer
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<RecyclerView.ViewHolder>(){
private var data: ArrayList<MsgBoxBean> ?= null
private val notice: Int = 1
private val v2x: Int = 2
var countDownTimer: CountDownTimer?=null
fun setData(data: ArrayList<MsgBoxBean>){
this.data = data
if(data.size>3){
data.removeAt(0)
}
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_notice,parent,false)
BubbleNoticeHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_v2x,parent,false)
BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeNormalData?.content
}else {
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content
}
}
}
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvMV2XContent.text = v2XMsg.content
holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
}
override fun onFinish() {
data?.remove(msgBoxBean)
notifyDataSetChanged()
// notifyItemRemoved(index)
// notifyItemRangeChanged(index,recordTypeEntity.size-index)
}
}
countDownTimer?.start()
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else{
v2x
}
}
//Notice
class BubbleNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivMNoticeImage: ImageView = itemView.findViewById(R.id.ivMNoticeImage)
var tvMNoticeTitle: TextView = itemView.findViewById(R.id.tvMNoticeTitle)
var tvMNoticeContent: TextView = itemView.findViewById(R.id.tvMNoticeContent)
var tvMNoticeTime: TextView = itemView.findViewById(R.id.tvMNoticeTime)
}
//OBU、V2X
class BubbleV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivMV2XImage: ImageView = itemView.findViewById(R.id.ivMV2XImage)
var tvMV2XTime: TextView = itemView.findViewById(R.id.tvMV2XTime)
var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent)
}
}

View File

@@ -9,6 +9,7 @@ import android.graphics.Color
import android.os.Build
import android.text.Html
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.annotation.RequiresApi
@@ -613,7 +614,6 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode.visibility = View.GONE
}
// 雨天模式,上一次勾选的数据
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式
@@ -630,36 +630,30 @@ internal class DebugSettingView @JvmOverloads constructor(
//感知优化模式
tbBeautyMode.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isBeautyMode = isChecked
if (!FunctionBuildConfig.isBeautyMode) {
tbBeautyMode.isChecked = false
}
}
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
}
}
tbObuWarningFusionUnion.isChecked = FunctionBuildConfig.isObuWarningFusionUnion
//ObuWarningFusionUnion
tbObuWarningFusionUnion.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isObuWarningFusionUnion = isChecked
}
//重启工控机所有节点
@@ -755,12 +749,6 @@ internal class DebugSettingView @JvmOverloads constructor(
FunctionBuildConfig.isDrawUnknownIdentifyData = isChecked
}
// // 初始化 OBU感知数据是否绘制 选择情况
// tbIsDrawOBUIdentifyData.isChecked = FunctionBuildConfig.isDrawObuIdentifyData
// tbIsDrawOBUIdentifyData.setOnCheckedChangeListener { buttonView, isChecked ->
// FunctionBuildConfig.isDrawObuIdentifyData = isChecked
// }
//TODO
tbIsDrawPath.setOnCheckedChangeListener { _, isChecked ->
@@ -1068,18 +1056,6 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置Hmi点击监听
*/
private fun setHmiCheckedChangeListener() {
/**
* 隐藏、显示小地图
*/
tbControlView.setOnCheckedChangeListener { _, isChecked ->
// if (isChecked) {
// CallerSmpManager.hidePanel()
// } else {
// CallerSmpManager.showPanel()
// }
}
/**
* sn绑定控制
*/

View File

@@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.hmi.ui.vehicle
import android.content.Context
import android.util.AttributeSet
import android.util.TypedValue.COMPLEX_UNIT_PX
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
@@ -23,6 +25,8 @@ import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.service_biz.BizConfig
import kotlinx.android.synthetic.main.view_pnc_actions.view.*
import me.jessyan.autosize.AutoSize
import me.jessyan.autosize.utils.AutoSizeUtils
import mogo.telematics.pad.MessagePad
class PncActionsView @JvmOverloads constructor(
@@ -41,12 +45,24 @@ class PncActionsView @JvmOverloads constructor(
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
private val bgResources: Int
private val topMargin: Int
private val txtSize: Int
init {
LayoutInflater.from(context).inflate(R.layout.view_pnc_actions, this, true)
val a = context.obtainStyledAttributes(attrs, R.styleable.PncActionsView, defStyleAttr, 0)
bgResources = a.getResourceId(R.styleable.PncActionsView_background_resource, R.drawable.pnc_actions_bg)
topMargin = a.getResourceId(R.styleable.PncActionsView_pnc_top_margin,resources.getDimension(R.dimen.dp_30).toInt())
txtSize = a.getResourceId(R.styleable.PncActionsView_pnc_size,resources.getDimension(R.dimen.dp_34).toInt())
a.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
(tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX,txtSize.toFloat())
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerPlanningActionsListenerManager.addListener(TAG, this)
CallerTrafficLightListenerManager.addListener(TAG, this)
@@ -78,14 +94,21 @@ class PncActionsView @JvmOverloads constructor(
var actions: String? = null
planningActionMsg.actionMsg?.let { it ->
try {
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
} catch (e:Exception){
actions = PncActionsHelper.getAction(
it.drivingState.number,
it.drivingAction.number
)
} catch (e: Exception) {
e.printStackTrace()
}
//如果是存在云端红绿灯数据条件下,设置云端数据
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
if (PncActionsHelper.isWaitingTrafficlight(
it.drivingState.number,
it.drivingAction.number
)
&& mTrafficLightResult != null
&& getWaitTrafficLightTime().isNotBlank()) {
&& getWaitTrafficLightTime().isNotBlank()
) {
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
} else {
mTrafficLightResult = null
@@ -96,7 +119,8 @@ class PncActionsView @JvmOverloads constructor(
this.background = null
tvHmiPncActions.text = ""
} else {
this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg)
this.background =
AppCompatResources.getDrawable(context, bgResources)
tvHmiPncActions.text = actions
}
}

View File

@@ -35,10 +35,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
init {
LayoutInflater.from(context).inflate(R.layout.view_steering_brake, this, true)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SteeringBrakeView)
val dayLight = typedArray.getBoolean(R.styleable.SteeringBrakeView_day_light_mode, false)
turnLightView.dayLightMode(dayLight)
typedArray.recycle()
}
override fun onAttachedToWindow() {
@@ -47,7 +43,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车
@@ -86,8 +81,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
brakeView.visibility = View.GONE
isShowTurnLight = false
}
turnLightView.visibility = View.VISIBLE
turnLightView.setTurnLight(lightSwitch)
}
}

View File

@@ -11,9 +11,12 @@ import android.view.animation.Animation
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.map.angle.Turning
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_steering_brake.view.*
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -25,33 +28,62 @@ import kotlinx.coroutines.launch
* @author lixiaopeng
* @since 2022/1/10
*/
class TurnLightViewStatus @JvmOverloads constructor(
open class TurnLightViewStatus @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener {
private var init: Boolean = false
companion object {
private const val TAG = "TurnLightViewStatus"
}
fun dayLightMode(dayLight: Boolean) {
private val visible: Boolean
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TurnLightView)
val dayLight = typedArray.getBoolean(R.styleable.TurnLightView_day_light_mode, false)
if (dayLight) {
LayoutInflater.from(context)
.inflate(R.layout.view_turn_light_status_daytime, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
}
invalidate()
init = true
visible = typedArray.getBoolean(R.styleable.TurnLightView_visible, false)
if (visible) {
turn_light_layout.visibility = View.VISIBLE
} else {
turn_light_layout.visibility = View.GONE
}
typedArray.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerChassisLamplightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLamplightListenerManager.removeListener(TAG)
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
lightSwitch?.let {
turnLightView.visibility = View.VISIBLE
setTurnLight(it)
}
}
/**
* 转向灯动画
*/
fun setTurnLight(directionLight: Chassis.LightSwitch) {
private fun setTurnLight(directionLight: Chassis.LightSwitch) {
if (!isAttachedToWindow) {
return
}
GlobalScope.launch(Dispatchers.Main) {
if (!init) {
return@launch
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
@@ -135,7 +167,9 @@ class TurnLightViewStatus @JvmOverloads constructor(
}
override fun onAnimationEnd(p0: Animation?) {
turn_light_layout.visibility = View.GONE
if (visible) {
turn_light_layout.visibility = View.GONE
}
stopAnimate()
}
})

View File

@@ -5,23 +5,22 @@ import android.graphics.Color
import android.util.AttributeSet
import android.view.Gravity
import android.widget.FrameLayout
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.api.v2x.ILimitingVelocityListener
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.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import java.util.*
/**
* @author xiaoyuzhou
* @date 2021/8/25 8:25 下午
*/
class SpeedPanelView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
ILimitingVelocityListener {
companion object {
const val TAG = "SpeedPanelView"
@@ -30,11 +29,6 @@ class SpeedPanelView @JvmOverloads constructor(
var mContext: Context
var mSpeedChartView: SpeedChartView
var mLatLng: MogoLocation? = null
var mSpeedLimit = 60
private val timer by lazy {
Timer()
}
init {
setBackgroundResource(R.drawable.yi_biao_pan_bg_nor)
@@ -50,49 +44,34 @@ class SpeedPanelView @JvmOverloads constructor(
addView(mSpeedChartView)
}
private var timerTask: TimerTask? = null
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 注册位置回调
CallerLimitingVelocityListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
// 开启定时查询速度
timerTask?.cancel()
val task = object : TimerTask() {
override fun run() {
mLatLng?.let {
mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude,
it.heading.toFloat()
)
UiThreadHandler.post {
val speed = (it.gnssSpeed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimit) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > mSpeedLimit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
}
}
this.timerTask = task
timer.schedule(task, Date(), 200)
}
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
gnssInfo?.let {
mLatLng = gnssInfo
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
mogoLocation?.let {
mLatLng = mogoLocation
}
}
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
super.onLimitingVelocityChange(limitingVelocity, sourceType)
mLatLng?.let {
UiThreadHandler.post {
val speed = (it.gnssSpeed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > limitingVelocity) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > limitingVelocity) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 解除注册
CallerLimitingVelocityListenerManager.removeListener(TAG)
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
try {
timerTask?.cancel()
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -105,6 +105,11 @@ public class SteeringWheelView extends ConstraintLayout implements
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_291"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#CCFFFFFF"
app:roundLayoutRadius="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12"
>
<ImageView
android:id="@+id/ivMNoticeImage"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_passenger_operation"
/>
<TextView
android:id="@+id/tvMNoticeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="官方公告"
android:textColor="#FF203555"
android:textSize="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_10"
app:layout_constraintLeft_toRightOf="@id/ivMNoticeImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvMNoticeContent"
/>
<TextView
android:id="@+id/tvMNoticeTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#B31A273F"
android:textSize="@dimen/dp_18"
app:layout_constraintTop_toTopOf="@id/tvMNoticeTitle"
app:layout_constraintBottom_toBottomOf="@id/tvMNoticeTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="@dimen/dp_10"
/>
<TextView
android:id="@+id/tvMNoticeContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#CC203555"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvMNoticeTitle"
app:layout_constraintTop_toBottomOf="@id/tvMNoticeTitle"
app:layout_constraintRight_toRightOf="@id/tvMNoticeTime"
android:gravity="start"
android:maxLines="1"
android:ellipsize="end"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_291"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#CCFFFFFF"
app:roundLayoutRadius="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12">
<ImageView
android:id="@+id/ivMV2XImage"
android:layout_width="@dimen/dp_54"
android:layout_height="@dimen/dp_54"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="@dimen/dp_13"
/>
<TextView
android:id="@+id/tvMV2XTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:textColor="#991A273F"
android:textSize="@dimen/dp_18"
android:layout_marginEnd="@dimen/dp_13"
/>
<TextView
android:id="@+id/tvMV2XContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/ivMV2XImage"
app:layout_constraintRight_toLeftOf="@id/tvMV2XTime"
android:gravity="start"
android:maxLines="1"
android:ellipsize="end"
android:textColor="#FF203555"
android:textSize="@dimen/dp_18"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_18"
/>
</com.mogo.eagle.core.widget.RoundCanClickConstraintLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rvMBoxBubbleList"
android:layout_width="@dimen/dp_291"
android:layout_height="wrap_content"
>
</androidx.recyclerview.widget.RecyclerView>

View File

@@ -278,6 +278,18 @@
android:textOn="关闭漫游模式"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbObuWarningFusionUnion"
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="开启obu预警融合"
android:textOn="关闭obu预警融合"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbMojie"
android:layout_width="match_parent"
@@ -1310,18 +1322,6 @@
app:layout_constraintLeft_toRightOf="@+id/tbChangeCurrentCarIcon"
app:layout_constraintTop_toTopOf="@id/tbChangeCurrentCarIcon" />
<ToggleButton
android:id="@+id/tbControlView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="隐藏「小地图」"
android:textOn="显示「小地图」"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbOpenSnBinding"
android:layout_width="wrap_content"

View File

@@ -9,10 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="@dimen/dp_68"
android:paddingEnd="@dimen/dp_68"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_34"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@@ -69,8 +69,15 @@
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<declare-styleable name="SteeringBrakeView">
<declare-styleable name="TurnLightView">
<attr name="day_light_mode" format="boolean"/>
<attr name="visible" format="boolean"/>
</declare-styleable>
<declare-styleable name="PncActionsView">
<attr name="background_resource" format="reference"/>
<attr name="pnc_top_margin" format="reference"/>
<attr name="pnc_size" format="reference"/>
</declare-styleable>
</resources>

View File

@@ -28,11 +28,8 @@ import java.util.concurrent.atomic.*
@Route(path = MogoServicePaths.PATH_VISUAL_ANGLE)
class MoGoVisualAngleChangeProvider: IMoGoVisualAngleChangeProvider {
override val functionName: String
get() = "VisualAngleChange"
companion object {
const val TAG = "VisualAngleChange"
private const val TAG = "VisualAngleChange"
}
private val triggerLocation = AtomicReference<MogoLocation>()
@@ -147,11 +144,6 @@ class MoGoVisualAngleChangeProvider: IMoGoVisualAngleChangeProvider {
return CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher("change-visual-angle") + SupervisorJob())
}
override fun onDestroy() {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
@Volatile
private var mLevel:Boolean = false

View File

@@ -67,6 +67,11 @@ object TrackerSourceColorHelper {
color = "#9900ffFF"
}
//僵尸车
if(data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE){
color = "#D1E5FDFF"
}
// pnc预警
WarningHelper.getPncColor(data.uuid.toString()) {
if (it.isNotBlank()) {

View File

@@ -126,4 +126,9 @@ public class MogoRouteOverlayManager implements
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
}

View File

@@ -11,6 +11,7 @@ import android.view.MotionEvent
import android.view.View
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.annotation.MainThread
import ch.hsr.geohash.GeoHash
import com.amap.api.maps.AMap
import com.amap.api.maps.CameraUpdate
@@ -71,7 +72,7 @@ class OverMapView @JvmOverloads constructor(
private val zoomLevel = 15
private var mCameraUpdate: CameraUpdate? = null
private var mContext: Context? = null
private val mTilt = 60f
private var mTilt = 0f
private var overLayerView: TextView? = null
// 全局路径规划中的GeoHash网格
@@ -99,6 +100,7 @@ class OverMapView @JvmOverloads constructor(
private var isFirstLocation = true
var mCustomMapStyleOptions: CustomMapStyleOptions? = null
var currMarkerList: ArrayList<Marker>? = null
var siteMarkerList: ArrayList<Marker>? = null
companion object {
const val TAG = "OverMapView"
@@ -155,18 +157,56 @@ class OverMapView @JvmOverloads constructor(
}
// =================必须通知高德地图生命周期的变化=================
/**
* 隐藏右下角的重置View
*/
fun hideResetView() {
overLayerView?.visibility = View.GONE
}
/**
* siteLatLngs: 高德坐标集合
* bitmap: Marker对应的图片
* (anchorX,anchorY)为锚点坐标,各自取值范围为[0,1],默认值为(0.5,1)
*/
@MainThread
fun drawSiteMarkers(siteLatLngs: List<LatLng>?, bitmap: Bitmap, anchorX: Float, anchorY: Float) {
if (siteLatLngs.isNullOrEmpty()) return
clearSiteMarkers()
val markerOptionsList = ArrayList<MarkerOptions>()
for (latLng in siteLatLngs) {
val markerOption = MarkerOptions()
markerOption.position(latLng)
markerOption.anchor(anchorX, anchorY)
markerOption.icon(
BitmapDescriptorFactory.fromBitmap(bitmap)
)
markerOptionsList.add(markerOption)
}
siteMarkerList = mAMap!!.addMarkers(markerOptionsList, false)
}
@MainThread
fun clearSiteMarkers() {
if (siteMarkerList != null) {
for (marker in siteMarkerList!!) {
marker.destroy()
}
siteMarkerList = null
}
}
private fun initView(context: Context) {
mContext = context
val smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this)
mMapView = smpView.findViewById(R.id.aMapView)
overLayerView = findViewById(R.id.overLayer)
overLayerView?.background = resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
arrivedBitmap = BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived)
unArrivedBitmap = BitmapDescriptorFactory.fromResource(if (unArrivedDrawable != -1) unArrivedDrawable else R.drawable.taxi_map_arrow_un_arrive)
overLayerView?.background =
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
arrivedBitmap =
BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived)
unArrivedBitmap =
BitmapDescriptorFactory.fromResource(if (unArrivedDrawable != -1) unArrivedDrawable else R.drawable.taxi_map_arrow_un_arrive)
CallerPlanningRottingListenerManager.addListener(TAG, this)
initAMapView(context)
// 注册定位监听
@@ -177,6 +217,7 @@ class OverMapView @JvmOverloads constructor(
private fun initAMapView(context: Context) {
Log.d(TAG, "initAMapView")
mTilt = 30f
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel.toFloat())
mAMap = mMapView!!.map
mCustomMapStyleOptions = CustomMapStyleOptions()
@@ -197,6 +238,8 @@ class OverMapView @JvmOverloads constructor(
}
// 实时路况图层关闭必须添加在loaded结束之后,其他位置不生效
mAMap?.isTrafficEnabled = false
mAMap?.showBuildings(true)
mAMap?.animateCamera(CameraUpdateFactory.changeTilt(mTilt))
}
setUpMap()
customOptions()
@@ -350,7 +393,7 @@ class OverMapView @JvmOverloads constructor(
return bitmap
}
fun clearV2XMarkers() {
private fun clearV2XMarkers() {
if (currMarkerList != null) {
for (marker in currMarkerList!!) {
marker.destroy()
@@ -428,6 +471,7 @@ class OverMapView @JvmOverloads constructor(
bitmap
)
)
markerOption.anchor(0.18f, 0.98f)
markerOption.zIndex(2f)
posInfMap[latLng] = structureList
markerOptionsList.add(markerOption)
@@ -448,8 +492,8 @@ class OverMapView @JvmOverloads constructor(
val marker = MakerWithCount(context)
marker.setCount(count)
marker.measure(
MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(116, MeasureSpec.EXACTLY)
MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 116f), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 116f), MeasureSpec.EXACTLY)
)
marker.layout(0, 0, marker.measuredWidth, marker.measuredHeight)
val bitmap = Bitmap.createBitmap(marker.width, marker.height, Bitmap.Config.ARGB_8888)
@@ -486,7 +530,7 @@ class OverMapView @JvmOverloads constructor(
} else {
//设置希望展示的地图缩放级别
val cameraPosition = CameraPosition.Builder()
.target(mCarMarker!!.position).tilt(0f).zoom(zoomLevel.toFloat()).build()
.target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
}
}

View File

@@ -1,31 +1,24 @@
package com.mogo.eagle.core.function.startup.stageone
import android.content.Context
import com.mogo.aicloud.services.httpdns.HttpDnsConst
import com.mogo.aicloud.services.httpdns.IMogoHttpDns
import com.mogo.aicloud.services.httpdns.MogoHttpDnsHandler
import com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices
import com.mogo.aicloud.services.socket.IMogoLifecycleListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.httpdns.MogoHttpDnsConfig
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation
import com.mogo.cloud.httpdns.listener.OnAddressChangedListener
import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.HostConst
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.network.NetConfigUtils
import com.mogo.commons.network.Utils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.map.MogoLocation
@@ -38,10 +31,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.eagle.core.utilcode.util.ThreadPoolService
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.*
import com.rousetime.android_startup.AndroidStartup
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
@@ -58,8 +48,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// 缓存IP地址
private var cacheIp: String? = null
private lateinit var mogoHttpDns: IMogoHttpDns
private var context: Context? = null
private var gotToken = false
@@ -77,7 +65,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean {
this.context = context
initGDLoc()
initHttpDns()
preparePassportEnvironment()
return true
}
@@ -85,15 +73,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
CallerMapUIServiceManager.getGDLocationServer(context!!)?.start()
}
/**
* 初始化 HttpDNS ,这里会通过一个接口获取所有鹰眼中使用的微服务域名以及端口号
* 后续的网络请求会通过 HttpDnsInterceptor 进行拦截替换
*/
private fun initHttpDns() {
mogoHttpDns = MogoHttpDnsHandler.getHttpDnsApi()
preparePassportEnvironment()
}
private fun preparePassportEnvironment() {
// 设置网络环境HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
when (DebugConfig.getNetMode()) {
@@ -131,9 +110,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// TODO 现在这块逻辑因为网约车业务那后台的限制,还没有更换,条件成熟后替换为 DeviceIdUtils.getWidevineIDWithMd5(context)
// 这里影响当前Activity的身份信息多进程先保持与原来一样主进程为司机端:passenger 进程为乘客端
if (ProcessUtils.getCurrentProcessName().contains(":passenger")) {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId() + "_passenger"
clientConfig.thirdPartyDeviceId = DeviceUtils.getDeviceSN() + "_passenger"
} else {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId()
clientConfig.thirdPartyDeviceId = DeviceUtils.getDeviceSN()
}
//设置长链接的secretKey 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
@@ -145,7 +124,8 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
}
var mogoLocation: MogoLocation? = null
val locationClient = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
val locationClient =
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (locationClient != null) {
mogoLocation = locationClient
}
@@ -213,8 +193,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
CallerCloudListenerManager.invokeCloudTokenGot(token, sn)
// 异步初始化NetConfig
asyncInit()
// HttpDns ttl回调 --- socketTTL
// registerSocketHttpDnsTTL()
startSocketService()
// 开启每5s/次定位上报
uploadLocPerFiveSecond()
@@ -251,35 +229,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
}
}
/**
* 请求获取最新的 DNS 微服务 域名信息
*/
private fun registerSocketHttpDnsTTL() {
mogoHttpDns.addressChangedListener(object : OnAddressChangedListener {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
override fun onAddressChanged(cityCode: String, address: Map<String, String>?) {
val dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(
HostConst.SOCKET_CENTER_DOMAIN,
HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP
) ?: return
if (dnsCacheIp != cacheIp) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"获取缓存Dns IP : $dnsCacheIp , 原缓存 IP $cacheIp"
)
cacheIp = dnsCacheIp
}
}
})
}
/**
* 上传自车位置信息到云端
*/

View File

@@ -10,7 +10,6 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.data.v2x.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import java.util.List;

View File

@@ -12,7 +12,7 @@ import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse
import com.mogo.eagle.core.function.v2x.internal.http.api.V2XApiService
import com.mogo.eagle.core.function.v2x.internal.http.body.V2XRefreshEntity
import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback
import com.mogo.eagle.core.function.v2x.internal.utils.DeviceUtils
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
@@ -64,7 +64,7 @@ internal class V2XRefreshModel {
handled
})
this["netType"] = CommonUtils.getNetworkType(config.context)
this["cellId"] = DeviceUtils.getCellId(config.context) ?: ""
this["cellId"] = DeviceUtils.getCellId() ?: ""
this["sn"] = config.aiCloudConfig.sn
this["ticket"] = config.aiCloudConfig.token
this["sig"] = SignUtil.createSign(this, "JGjZx6")

View File

@@ -1,46 +0,0 @@
package com.mogo.eagle.core.function.v2x.internal.utils
import android.Manifest
import android.annotation.SuppressLint
import android.content.Context
import android.content.pm.PackageManager
import android.telephony.CellLocation
import android.telephony.TelephonyManager
import android.telephony.cdma.CdmaCellLocation
import android.telephony.gsm.GsmCellLocation
import java.lang.Exception
internal class DeviceUtils {
companion object {
@SuppressLint("MissingPermission")
@JvmStatic
fun getCellId(context: Context): String? {
val tm = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
val pm = context.packageManager
val accessCoarseLocationPermission = PackageManager.PERMISSION_GRANTED ==
pm.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION, context.packageName)
val accessFineLocationPermission = PackageManager.PERMISSION_GRANTED ==
pm.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, context.packageName)
if (!accessCoarseLocationPermission || !accessFineLocationPermission) return "noPermission"
var location: CellLocation? = null
try {
location = tm.cellLocation
} catch (e: Exception) {
e.printStackTrace()
}
if (location != null) {
// Gsm网络 , 联通移动的网络属于这一套
if (location is GsmCellLocation) {
val cellid = location.cid
return cellid.toString()
// Cdma网络 , 电信网络属于这一种
} else if (location is CdmaCellLocation) {
return location.baseStationId.toString()
}
}
return null
}
}
}