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

This commit is contained in:
yangyakun
2023-02-13 18:54:18 +08:00
55 changed files with 2091 additions and 1309 deletions

View File

@@ -51,7 +51,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -63,7 +63,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -251,7 +251,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -58,7 +58,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -49,7 +49,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -120,7 +120,7 @@
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_100"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -19,7 +19,6 @@ import com.zhidao.adas.client.bean.ObuMap;
import com.zhidao.adas.client.bean.ObuRsi;
import com.zhidao.adas.client.bean.ObuRsm;
import com.zhidao.adas.client.bean.ObuSpat;
import com.zhidao.adas.client.bean.ObuWarningData;
import com.zhidao.adas.client.bean.OriginalPointCloudData;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PlanningDecisionState;
@@ -131,7 +130,6 @@ public class DataDistribution {
public final List<DataShow> listFSMFunctionStates = new ArrayList<>();
public final List<DataShow> listRoboSweeperTaskIndex = new ArrayList<>();
public final List<DataShow> listBagManagerCmd = new ArrayList<>();
public final List<DataShow> listObuWarningData = new ArrayList<>();
public final List<DataShow> listObuSpat = new ArrayList<>();
public final List<DataShow> listObuRsi = new ArrayList<>();
public final List<DataShow> listObuRsm = new ArrayList<>();
@@ -159,7 +157,6 @@ public class DataDistribution {
private long listFSMFunctionStatesSize = 0;
private long listRoboSweeperTaskIndexSize = 0;
private long listBagManagerCmdSize = 0;
private long listObuWarningDataSize = 0;
private long listObuSpatSize = 0;
private long listObuRsiSize = 0;
private long listObuRsmSize = 0;
@@ -189,7 +186,6 @@ public class DataDistribution {
listFSMFunctionStatesSize = 1;
listRoboSweeperTaskIndexSize = 1;
listBagManagerCmdSize = 1;
listObuWarningDataSize = 1;
listObuSpatSize = 1;
listObuRsiSize = 1;
listObuRsmSize = 1;
@@ -246,14 +242,6 @@ public class DataDistribution {
if (listener != null && Constants.TITLE.RECEIVE_PLANNING_DECISION_STATE.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof ObuWarningData) {
listObuWarningData.add(0, new DataShow(listObuWarningDataSize++, time + str));
if (listObuWarningData.size() > LIST_SIZE) {
listObuWarningData.remove(listObuWarningData.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_OBU_WARNING_DATA.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof ObuSpat) {
listObuSpat.add(0, new DataShow(listObuSpatSize++, time + str));
if (listObuSpat.size() > LIST_SIZE) {

View File

@@ -134,9 +134,7 @@ public class InfoFragment extends BaseFragment {
adapter.setData(DataDistribution.getInstance().listArrivalNotification);
} else if (Constants.TITLE.RECEIVE_STATUS_QUERY_RESP.equals(title)) {
adapter.setData(DataDistribution.getInstance().listStatusInfo);
} else if (Constants.TITLE.RECEIVE_OBU_WARNING_DATA.equals(title)) {
adapter.setData(DataDistribution.getInstance().listObuWarningData);
}else if (Constants.TITLE.RECEIVE_OBU_SPAT.equals(title)) {
} else if (Constants.TITLE.RECEIVE_OBU_SPAT.equals(title)) {
adapter.setData(DataDistribution.getInstance().listObuSpat);
} else if (Constants.TITLE.RECEIVE_OBU_RSI.equals(title)) {
adapter.setData(DataDistribution.getInstance().listObuRsi);
@@ -144,7 +142,7 @@ public class InfoFragment extends BaseFragment {
adapter.setData(DataDistribution.getInstance().listObuRsm);
} else if (Constants.TITLE.RECEIVE_OBU_MAP.equals(title)) {
adapter.setData(DataDistribution.getInstance().listObuMap);
} else if (Constants.TITLE.RECEIVE_RECORD_DATA_CONFIG_RESP.equals(title)) {
} else if (Constants.TITLE.RECEIVE_RECORD_DATA_CONFIG_RESP.equals(title)) {
adapter.setData(DataDistribution.getInstance().listRecordDataConfig);
} else if (Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP.equals(title)) {
adapter.setData(DataDistribution.getInstance().listGlobalPathResp);

View File

@@ -73,7 +73,6 @@ import com.zhidao.adas.client.bean.ObuMap;
import com.zhidao.adas.client.bean.ObuRsi;
import com.zhidao.adas.client.bean.ObuRsm;
import com.zhidao.adas.client.bean.ObuSpat;
import com.zhidao.adas.client.bean.ObuWarningData;
import com.zhidao.adas.client.bean.OriginalPointCloudData;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PlanningDecisionState;
@@ -128,7 +127,6 @@ import chassis.VehicleStateOuterClass;
import function_state_management.FunctionStates;
import io.netty.channel.Channel;
import mogo.telematics.pad.MessagePad;
import mogo.v2x.ObuWarningEvent;
import mogo_msg.MogoReportMsg;
import perception.TrafficLightOuterClass;
import planning.RoboSweeperTaskIndexOuterClass;
@@ -668,7 +666,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
titleFragmentData.add(Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP);
titleFragmentData.add(Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION);
titleFragmentData.add(Constants.TITLE.RECEIVE_STATUS_QUERY_RESP);
titleFragmentData.add(Constants.TITLE.RECEIVE_OBU_WARNING_DATA);
titleFragmentData.add(Constants.TITLE.RECEIVE_OBU_SPAT);
titleFragmentData.add(Constants.TITLE.RECEIVE_OBU_RSI);
titleFragmentData.add(Constants.TITLE.RECEIVE_OBU_RSM);
@@ -1038,11 +1035,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
DataDistribution.getInstance().addData(base);
}
@Override
public void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData) {
ObuWarningData base = new ObuWarningData(header, obuWarningData, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onObuSpatWarning(MessagePad.Header header, ObuScene.SpatWarningData spatWarningData) {

View File

@@ -172,7 +172,6 @@ public class Constants {
String RECEIVE_WARN = MessageType.TYPE_RECEIVE_WARN.desc;
String RECEIVE_ARRIVAL_NOTIFICATION = MessageType.TYPE_RECEIVE_ARRIVAL_NOTIFICATION.desc;
String RECEIVE_STATUS_QUERY_RESP = MessageType.TYPE_RECEIVE_STATUS_QUERY_RESP.desc;
String RECEIVE_OBU_WARNING_DATA = MessageType.TYPE_RECEIVE_OBU_WARNING_DATA.desc;
String RECEIVE_OBU_SPAT = "OBU SPAT信息";
String RECEIVE_OBU_RSI = "OBU RSI信息";
String RECEIVE_OBU_RSM = "OBU RSM信息";

View File

@@ -69,7 +69,6 @@ import chassis.ChassisStatesOuterClass;
import chassis.VehicleStateOuterClass;
import function_state_management.FunctionStates;
import mogo.telematics.pad.MessagePad;
import mogo.v2x.ObuWarningEvent;
import mogo_msg.MogoReportMsg;
import perception.TrafficLightOuterClass;
import planning.RoboSweeperTaskIndexOuterClass;
@@ -546,10 +545,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
@Override
public void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData) {
}
@Override
public void onObuSpatWarning(MessagePad.Header header, ObuScene.SpatWarningData spatWarningData) {

View File

@@ -35,7 +35,7 @@ buildscript {
classpath 'com.mogo.cloud:systrace:1.0.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
classpath 'com.mogo.sticky:service:1.0.8'
classpath 'io.github.knight-zxw:lancet-plugin:0.0.4'
classpath 'io.github.knight-zxw:lancet-plugin:0.0.4_mogo'
// classpath ("com.tencent.matrix:matrix-gradle-plugin:0.6.6") { changing = true }
}

View File

@@ -93,7 +93,7 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta0',
mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta1',
// google
googlezxing : "com.google.zxing:core:3.3.3",
@@ -126,9 +126,6 @@ ext {
mogocustommapoperational : "com.zhidaoauto.map:operational:${MAP_SDK_OPERATION_VERSION}",
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
chat : "com.mogo.module.carchatim:module-chat:${MOGO_MODULE_CHAT_VERSION}",
callchat : "com.mogo.module.carchatim:module-carchatting:${MOGO_MODULE_CARCHATTING_VERSION}",
callchatprovider : "com.mogo.module.carchatim:module-carchatting-provider:${MOGO_MODULE_CARCHATTINGPROVIDER_VERSION}",
// V2X
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
@@ -220,7 +217,7 @@ ext {
//========================= LancetX ===================
lancetx_runtime : "io.github.knight-zxw:lancet-runtime:0.0.4",
lancetx_runtime : "io.github.knight-zxw:lancet-runtime:0.0.4_mogo",
//========================= autosize ======================
androidautoSize : 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1',

View File

@@ -26,7 +26,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
noticeSocketManager.init(context)
dispatchAutoPilotManager.init(context)
cronTaskManager.startCronTask()
OverviewDb.getDb(context)
MogoTrafficLightManager.INSTANCE.initServer(context)
VipCarManager.INSTANCE.initServer(context)
// RedLightWarningManager.INSTANCE.listenTrafficLight()
@@ -75,10 +75,6 @@ class FuncBizProvider : IMoGoFuncBizProvider {
OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn)
}
override fun initOverViewDb(context: Context) {
OverviewDb.getDb(context)
}
override fun onDestroy() {
noticeSocketManager.release()
dispatchAutoPilotManager.release()

View File

@@ -55,20 +55,18 @@ dependencies {
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
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
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-call')
implementation project(':libraries:mogo-adas')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -47,11 +47,11 @@ class ObuTestNewObuReceiver : BroadcastReceiver() {
val warningList = listOf(warningData1)
warningMsg.warningData = warningList
val cvxHvInfoIndInfo = MogoObuRvWarningData(0, vehBasicsMsg, warningMsg)
// val cvxHvInfoIndInfo = MogoRvWarningData(0, vehBasicsMsg, warningMsg)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRvWarning(cvxHvInfoIndInfo)
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onGnssInfo(cvxHvInfoIndInfo)
}

View File

@@ -41,11 +41,11 @@ class ObuTestNewObuRsiReceiver : BroadcastReceiver() {
val rsiWarningList = listOf(rsiWarning) //TODO
val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRsiWarning(cvxObuRsiInfo)
// val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList)
//
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onObuRsiWarning(cvxObuRsiInfo)
}

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
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.ObuBase
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRsmWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
@@ -20,18 +22,18 @@ object TrafficDataConvertUtilsNew {
/**
* OBU 远车 转换交通元素数据,是否需要
*/
fun cvxRvInfoIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info.vehBasicsMsg == null) {
fun cvxRvInfoIndInfo2TrafficData(info: ObuBase.VehicleBasics): TrafficData? {
if (info == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.vehBasicsMsg.id
trafficData.lat = info.vehBasicsMsg.latitude
trafficData.lon = info.vehBasicsMsg.longitude
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
trafficData.uuid = info.id
trafficData.lat = info.latitude
trafficData.lon = info.longitude
trafficData.heading = info.heading
trafficData.speed = info.speed
return trafficData
}
@@ -39,25 +41,25 @@ object TrafficDataConvertUtilsNew {
/**
* OBU RSU道路事件预警信息 转换交通元素数据 标牌 为何要显示level
*/
fun cvxRtiThreatIndInfo2TrafficData(info: MogoObuRsiWarningData): TrafficData? {
if (info.warningMsg == null || info.warningMsg.size < 1 || info.warningMsg[0].position == null) {
fun cvxRtiThreatIndInfo2TrafficData(info: ObuScene.RsiWarningData): TrafficData? {
if (info.warningMsgList == null || info.warningMsgList.size < 1 || info.warningMsgList[0].position == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG
trafficData.uuid = info.warningMsg[0].signSerialNum.toString()
trafficData.lat = info.warningMsg[0].position.latitude
trafficData.lon = info.warningMsg[0].position.longitude
trafficData.threatLevel = info.warningMsg[0].warningLevel
trafficData.uuid = info.warningMsgList[0].signSerialNum.toString()
trafficData.lat = info.warningMsgList[0].position.position.positionLatLon.latitude
trafficData.lon = info.warningMsgList[0].position.position.positionLatLon.longitude
trafficData.threatLevel = info.warningMsgList[0].warningLevel
return trafficData
}
/**
* OBU 预警事件 转换交通元素数据 他车预警
*/
fun cvxV2vThreatIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info == null || info.vehBasicsMsg == null || info.warningMsg == null) {
fun cvxV2vThreatIndInfo2TrafficData(info: ObuScene.RvWarningData): TrafficData? {
if (info?.vehBasicsMsg == null || info.warningMsg == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
@@ -68,8 +70,8 @@ object TrafficDataConvertUtilsNew {
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
if (info.warningMsg.warningDataList != null) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
}
@@ -81,7 +83,7 @@ object TrafficDataConvertUtilsNew {
/**
* OBU 弱势交通参与者信息 转换交通元素数据
*/
fun cvxPtcThreatIndInfo2TrafficData(info: MogoObuRsmWarningData): TrafficData? {
fun cvxPtcThreatIndInfo2TrafficData(info: ObuScene.RsmWarningData): TrafficData? {
if (info.participant == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
@@ -121,8 +123,8 @@ object TrafficDataConvertUtilsNew {
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
if (info.warningMsg != null && info.warningMsg.warningDataList != null) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
}

View File

@@ -136,7 +136,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
super.onTrafficLightPlusSource(light, remain, lightSource)
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true //todo 会存在优先级高的数据没有回调,导致没有数据出现
hasObuLightStatus = true
}
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)

View File

@@ -84,6 +84,8 @@ dependencies {
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.flexbox
implementation rootProject.ext.dependencies.androidautoSize
implementation rootProject.ext.dependencies.koomnative
implementation rootProject.ext.dependencies.koomxhook
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -5,6 +5,8 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.constants.MogoServicePaths
@@ -16,10 +18,11 @@ import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
import com.zhjt.mogo_core_function_devatools.koom.KoomInitTask
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager
import com.zhjt.mogo_core_function_devatools.mofang.MoFangManager.Companion.moFangManager
import com.zhjt.mogo_core_function_devatools.monitor.MonitorManager
@@ -46,6 +49,9 @@ class DevaToolsProvider : IDevaToolsProvider {
}
override fun initBiz() {
if (DebugConfig.isDebug()) {
KoomInitTask.init(AbsMogoApplication.getApp())
}
ttsManager.initTts(mContext!!) //todo
//链路相关
traceManager.init(mContext!!)

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.main
package com.zhjt.mogo_core_function_devatools.koom
import android.app.Application
import android.os.Build

View File

@@ -68,8 +68,7 @@ dependencies {
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.mogoobu
implementation project(':libraries:mogo-obu')
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler

View File

@@ -11,8 +11,8 @@ 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.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
@@ -55,7 +55,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
CallerVisualAngleManager.changeAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
@@ -63,7 +63,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
setAnimation(left_select_image)
}
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
CallerVisualAngleManager.changeAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
@@ -71,7 +71,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
setAnimation(right_select_image)
}
else -> { //消失
CallerVisualAngleManager.changeVisualAngle(Turning(false))
CallerVisualAngleManager.changeAngle(Turning(false))
animationDisappear()
}
}

View File

@@ -3,35 +3,23 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Process;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.elegant.utils.UiThreadHandler;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.MogoModule;
import com.mogo.commons.module.MogoModulePaths;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener;
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.SPUtils;
@@ -41,7 +29,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 默认初始化一些基础服务配置 todo 分离 overView业务 和 msgBox去自模块中 --- 扶风
* 默认初始化一些基础服务配置 todo 分离 msgBox去自己的模块中 --- 扶风
*/
public abstract class MainMoGoApplication extends AbsMogoApplication {
@@ -61,10 +49,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
initTipToast();
initModules();
if (ProcessUtils.isMainProcess(this)) {
initOverviewDb();
if (DebugConfig.isDebug()) {
initKoom();
}
clearMessageBoxTable();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
@@ -109,10 +93,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}).start();
}
private void initKoom() {
KoomInitTask.INSTANCE.init(this);
}
/**
* 初始化异常采集配置
*/
@@ -135,10 +115,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
CallerDevaToolsManager.INSTANCE.init();
}
private void initOverviewDb() {
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
}
private void initModules() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
// OBU 模块

View File

@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_100">
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvHmiPncActions"

View File

@@ -0,0 +1,306 @@
package com.mogo.eagle.core.function.angle
import android.content.*
import android.os.*
import android.util.*
import androidx.lifecycle.*
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.api.map.angle.Scene
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.zhidaoauto.map.sdk.open.tools.*
import kotlinx.coroutines.*
import kotlinx.coroutines.android.*
import java.util.*
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 val triggerLocation = AtomicReference<MogoLocation>()
private val distanceOfCarToStopLine = AtomicReference(0.0)
private val travelled by lazy { AtomicReference(0.0) }
/**
* 业务实体,不对外暴露
* @param target: 目标场景
* @param isDisplay: 是否正在展示
* @param triggerTime: 触发时间
*/
private data class Record(val target: Scene, var isDisplay: Boolean = false, var triggerTime: Long): Comparable<Record> {
override fun compareTo(other: Record): Int {
//如果时间一样,优先级越高,越靠近堆顶
return other.target.priority - target.priority
}
}
private val queue by lazy {
PriorityQueue<Record>()
}
private val listener = object : OnRoadListener {
private val roadId = AtomicReference<String>()
private val triggerRoadId = AtomicReference<String>()
override fun onRoadIdInfo(roadId: String) {
this.roadId.set(roadId)
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.triggerRoadId.get()} -> curr: $roadId")
val loc = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
var triggerClose = false
val distance = distanceOfCarToStopLine.get() + 5
if (hasCrossRoad && distance > 0) {
val prev = triggerLocation.get()
if (prev != null && loc != null) {
travelled.set(MapTools.distance(loc.longitude, loc.latitude, prev.longitude, prev.latitude) + travelled.get())
triggerLocation.set(loc)
}
val oldRoadId = triggerRoadId.get()
Log.d(TAG, "-- onRoadIdInfo --: travelled --: ${travelled.get()}")
if ((travelled.get() > distance) && oldRoadId != null && oldRoadId != roadId) {
distanceOfCarToStopLine.set(0.0)
hasCrossRoad = false
triggerRoadId.set(null)
travelled.set(0.0)
triggerLocation.set(null)
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
triggerClose = true
}
}
if (triggerClose) {
changeAngle(CrossRoad(false))
}
}
override fun onStopLineInfo(info: StopLine) {
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
hasCrossRoad = true
triggerRoadId.set(this.roadId.get())
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
triggerLocation.set(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02())
changeAngle(CrossRoad(true))
}
}
}
override fun init(context: Context?) {
if (Thread.currentThread() != Looper.getMainLooper().thread) {
scope.launch {
initListen(context)
}
} else {
initListen(context)
}
}
private fun initListen(ctx: Context?) {
ctx ?: return
ctx.lifeCycleOwner.lifecycle.addObserver(object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Event) {
if (event == ON_DESTROY) {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
}
})
CallerMapRoadListenerManager.registerRoadListener("VisualAngleChange", listener)
}
@Volatile
private var hasCrossRoad = false
private var scope: CoroutineScope = acquireScope()
@Synchronized
get() {
if (field.isActive) {
return field
}
val scope = acquireScope()
field = scope
return field
}
private var defaultDelayJob: Job? = null
private fun acquireScope(): CoroutineScope {
return CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher("change-visual-angle") + SupervisorJob())
}
override fun onDestroy() {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
@Volatile
private var mLevel:Boolean = false
override fun updateLongSightLevel(level:Boolean){
mLevel = level
}
override fun changeAngle(scene: Scene) {
val appIdentityMode = FunctionBuildConfig.appIdentityMode
if (AppIdentityModeUtils.isBus(appIdentityMode) && AppIdentityModeUtils.isPassenger(appIdentityMode)) {
return
}
if(mLevel){
return
}
val triggerTime = SystemClock.elapsedRealtime()
scope.launch {
Log.d(TAG, "--- 1 ---")
val displayed = getDisplayed()
if (displayed == null) {
Log.d(TAG, "--- 2 ---")
if (scene is Turning) {
if (!scene.open) {
changeAngle(Default())
return@launch
}
}
if (scene is CrossRoad) {
if (!scene.open) {
changeAngle(Default())
return@launch
}
}
doRealVisualAngleChange(triggerTime, scene, null)
} else {
val prev = displayed.target
Log.d(TAG, "--- 3 --- old: $prev -> cur: $scene")
val prevTriggerTime = displayed.triggerTime
if (scene !is Default && prev.priority > scene.priority && (prev is RoadEvent || prev is TooClose)) {
val displayDuration = triggerTime - prevTriggerTime
Log.d(TAG, "--- 4 ---:场景[$prev], 已展示时长: duration: $displayDuration")
if (displayDuration < prev.displayThreshold) {
Log.d(TAG, "--- 5 --- 场景[$prev]:仍在保护展示时长内直接return")
return@launch
} else {
Log.d(TAG, "--- 6 --- 场景[$prev]:已过保护展示时长,从展示的队列中移除,显示默认视角")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev is Turning && scene is Turning) {
val isOpen = scene.open
if (!isOpen) {
Log.d(TAG, "--- 7 --- 场景[$scene], 收到关闭通知")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev is CrossRoad && scene is CrossRoad) {
val isOpen = scene.open
if (!isOpen) {
Log.d(TAG, "--- 8 --- old: $prev -> cur: $scene")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev.priority == scene.priority) {
Log.d(TAG, "--- 9 --- 场景[$prev]正在展示尚未收到关闭优先级一致直接return")
return@launch
}
if (prev.priority > scene.priority && prev.displayThreshold < 0) {
Log.d(TAG, "--- 10 --- 场景[$prev]正在展示尚未收到关闭场景依然展示当前场景直接return")
return@launch
}
doRealVisualAngleChange(triggerTime, scene, displayed)
}
}
}
private fun CoroutineScope.doRealVisualAngleChange(triggerTime: Long, target: Scene, displayed: Record? = null) {
if (target is Default) {
Log.d(TAG, "--- doRealVisualAngleChange --- 1 ---")
displayed?.also {
queue -= it
}
defaultDelayJob?.safeCancel()
launch {
val delay = target.unit.toMillis(target.delay)
Log.d(TAG, "--- doRealVisualAngleChange --- 2 ---")
delay(delay)
Log.d(TAG, "--- doRealVisualAngleChange --- 3 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}.also { itx ->
itx.invokeOnCompletion {
if (it is CancellationException) {
Log.d(TAG, "--- doRealVisualAngleChange --- 4 ---")
}
}
defaultDelayJob = itx
}
} else {
Log.d(TAG, "--- doRealVisualAngleChange --- 5 ---")
defaultDelayJob?.safeCancel()
if (displayed == null || displayed.target.priority <= target.priority) {
Log.d(TAG, "--- doRealVisualAngleChange --- 6 ---")
displayed?.also {
queue -= it
}
if (target is Turning) {
if (!target.open) {
Log.d(TAG, "--- doRealVisualAngleChange --- 7 ---")
changeAngle(Default())
return
}
}
if (target is CrossRoad) {
if (!target.open) {
Log.d(TAG, "--- doRealVisualAngleChange --- 8 ---")
changeAngle(Default())
return
}
}
Log.d(TAG, "--- doRealVisualAngleChange --- 10 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}
}
}
@OptIn(InternalCoroutinesApi::class)
private fun doChangeAngle(record: Record) {
val angle = record.target.angle
CallerMapUIServiceManager.getMapUIController()?.also {
Log.d(TAG, "--- doChangeAngle --- ${record.target}")
if (record.target !is Default) {
record.isDisplay = true
kotlinx.coroutines.internal.synchronized(queue) {
queue += record
}
}
it.changeMapVisualAngle(angle, null)
}
}
/**
* 是否有正在展示的
*/
@Synchronized
private fun getDisplayed() = queue.firstOrNull()
}

View File

@@ -52,6 +52,5 @@ public class MogoMapService implements IMogoMapService {
@Override
public void init(Context context) {
CallerVisualAngleManager.INSTANCE.init(context);
}
}

View File

@@ -52,7 +52,8 @@ class OverMapView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
IMoGoPlanningRottingListener {
// =============自定义属性相关=============
private var mapStylePath: String? = null
@@ -166,7 +167,7 @@ class OverMapView @JvmOverloads constructor(
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, moGoAutopilotPlanningListener)
CallerPlanningRottingListenerManager.addListener(TAG, this)
initAMapView(context)
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
@@ -262,20 +263,6 @@ class OverMapView @JvmOverloads constructor(
)
}
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
object : IMoGoPlanningRottingListener {
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
}
}
}
fun handlePlanningData(locationList: List<MessagePad.Location>?) {
if (locationList.isNullOrEmpty()) return
val list: List<MessagePad.Location> = locationList
@@ -600,4 +587,15 @@ class OverMapView @JvmOverloads constructor(
}
}
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
}
}
}

View File

@@ -111,6 +111,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
// clientConfig.passportUrl //todo yakun
// clientConfig.socketBaseUrl
// clientConfig.socketTechUrl
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
@@ -132,7 +135,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
} else {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId()
}
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
//设置长链接的secretKey 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation {

View File

@@ -31,6 +31,7 @@ import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
@@ -38,8 +39,6 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
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.v2x.events.alarm.V2XAlarmServer
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
@@ -52,13 +51,12 @@ import com.mogo.eagle.core.function.v2x.events.utils.toV2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.internal.V2XManager
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
import com.mogo.eagle.core.function.v2x.internal.data.V2XAdvanceWarning
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget
import com.mogo.eagle.core.function.v2x.internal.data.*
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
import com.mogo.eagle.core.function.v2x.road.V2XEventServiceApi
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -209,6 +207,13 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
}
handleRoadMarkerEvent(event.data.toRoadMarker())
}
is V2XEvent.RoadEventX -> {
handleRoadMarkerEvent(event.data.toRoadMarker())
}
else -> {
Logger.e(TAG, "onAck other event: $event")
}
}
}
@@ -367,13 +372,13 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
val change = changeVisualAngle
override fun onShow() {
if (change) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
CallerVisualAngleManager.changeAngle(TooClose)
}
}
override fun onDismiss() {
if (change) {
CallerVisualAngleManager.changeVisualAngle(Default())
CallerVisualAngleManager.changeAngle(Default())
}
}
}

View File

@@ -90,18 +90,18 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
// 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常
mV2XRoadEventEntityArrayList.clear();
// 获取探路以及新鲜事儿
List<V2XMarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
if (exploreWayList != null) {
for (V2XMarkerExploreWay markerExploreWay : exploreWayList) {
for (MarkerExploreWay markerExploreWay : exploreWayList) {
if (EventTypeEnumNew.isRoadEvent(markerExploreWay.getPoiType())) {
V2XMarkerLocation markerLocation = markerExploreWay.getLocation();
MarkerLocation markerLocation = markerExploreWay.getLocation();
// 记录道路事件
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
v2XRoadEventEntity.setLocation(markerLocation);
// 探路目前只有上报拥堵
String poi = markerExploreWay.getPoiType();
v2XRoadEventEntity.setPoiType(poi);
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay, markerCardResult.getExtras()));
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
v2XRoadEventEntity.setExpireTime(20000);
mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity);
}

View File

@@ -7,7 +7,6 @@ import android.os.Looper
import android.view.animation.DecelerateInterpolator
import androidx.core.util.Pair
import com.mogo.cloud.commons.utils.*
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.call.autopilot.*

View File

@@ -18,63 +18,39 @@ class V2XAiRoadEventMarker {
private val current = AtomicReference<Pair<IMogoPolyline?, List<IMogoMarker>?>>()
private val v2xLocation = AtomicReference<MogoLocation>()
private val overlayManager by lazy { CallerMapUIServiceManager.getOverlayManager() }
fun drawMarkers(entity: V2XRoadEventEntity, wrapper: MarkerWrapper) {
val extra = entity.noveltyInfo.extras["polygon"]
val polygon = entity.noveltyInfo.polygon
v2xMarker()?.drawableAlarmPOI(context(), entity, null)?.also {
wrapper.addMarker(it)
}
if (extra is List<*> && entity.poiType != EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.poiType) {
if (extra.size > 0) {
val polygons: MutableList<androidx.core.util.Pair<Double, Double>> = ArrayList()
for (i in extra.indices) {
val o = extra[i]!! as? androidx.core.util.Pair<*, *> ?: continue
val first = o.first
val second = o.second
if (first == null || second == null) {
continue
}
if (first !is Double || second !is Double) {
continue
}
polygons.add(androidx.core.util.Pair.create(second, first))
}
if (polygons.size > 0) {
val l2 = entity.noveltyInfo?.location ?: return
v2xLocation.set(MogoLocation().also {
it.longitude = l2.lon; it.latitude = l2.lat; it.heading = l2.angle
})
if (polygon != null && polygon.isNotEmpty() && entity.poiType != EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.poiType) {
val options = MogoPolylineOptions()
val colors = ArrayList<Int>()
colors.add(Color.argb(204, 237, 172, 21))
colors.add(Color.argb(0, 255, 255, 255))
options.colorValues(colors)
val points = ArrayList<MogoLatLng>()
val options = MogoPolylineOptions()
val colors = ArrayList<Int>()
colors.add(Color.argb(204, 237, 172, 21))
colors.add(Color.argb(0, 255, 255, 255))
options.colorValues(colors)
val points = ArrayList<MogoLatLng>()
for (p in polygons) {
points.add(MogoLatLng(p.first, p.second))
}
if (points.size > 2) {
points.add(points[0])
}
options.points(points)
options.useGradient(true)
options.useFacade(true)
options.setGps(true)
options.width(5f)
options.zIndex(75000f)
options.maxIndex(800000f)
val line = overlayManager?.addPolyline(options)
line?.let {
current.set(Pair(line, wrapper.markers))
line.isVisible = true
wrapper.addLine(line)
}
}
for (p in polygon) {
points.add(MogoLatLng(p.first, p.second))
}
if (points.size > 2) {
points.add(points[0])
}
options.points(points)
options.useGradient(true)
options.useFacade(true)
options.setGps(true)
options.width(5f)
options.zIndex(75000f)
options.maxIndex(800000f)
val line = overlayManager?.addPolyline(options)
line?.let {
current.set(Pair(line, wrapper.markers))
line.isVisible = true
wrapper.addLine(line)
}
}
}

View File

@@ -1,9 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
import android.util.Log;
import androidx.core.util.Pair;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
@@ -15,7 +13,6 @@ import com.mogo.eagle.core.function.v2x.events.remove.MarkerRemoveManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.map.marker.IMogoMarker;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -34,10 +31,21 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
if (marker != null) {
if (entity != null) {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType());
if (!Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType())) {
if (isAiRoadEvent(entity.getPoiType())) {
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
Log.d("RWJ", "V2XRoadEventMarker -> noveltyInfo:" + noveltyInfo);
if (noveltyInfo != null) {
Pair<Double, Double> gpsLocation = noveltyInfo.getGpsLocation();
List<Pair<Double, Double>> polygons = noveltyInfo.getPolygon();
if (gpsLocation != null && polygons != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
AiRoadMarker aiMarker = new AiRoadMarker();
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()));
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);
}
}
} else {
IMogoMarker iMarker = marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
if (iMarker != null) {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType() + "--- add Marker");
@@ -48,48 +56,6 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
} else {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType() + "--- return empty marker");
}
} else {
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
Log.d("RWJ", "V2XRoadEventMarker -> noveltyInfo:" + noveltyInfo);
if (noveltyInfo != null && noveltyInfo.extras != null) {
List<Pair<Double, Double>> polygons = new ArrayList<>();
Pair<Double, Double> gpsLocation = null;
if (noveltyInfo.extras.containsKey("polygon")) {
Object extra = noveltyInfo.extras.get("polygon");
if (extra instanceof List) {
List l = (List) extra;
if (l.size() > 0) {
for (int i = 0; i < l.size(); i++) {
Object o = l.get(i);
if (!(o instanceof Pair)) {
continue;
}
Pair p = (Pair) o;
Object first = p.first;
Object second = p.second;
if (first == null || second == null) {
continue;
}
if (!(first instanceof Double) || !(second instanceof Double)) {
continue;
}
polygons.add(Pair.create((Double) first, (Double) second));
}
}
}
}
if (noveltyInfo.extras.containsKey("gps_location")) {
gpsLocation = (Pair<Double, Double>) ((List)(noveltyInfo.extras.get("gps_location"))).get(0);
}
if (!polygons.isEmpty() && gpsLocation != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
AiRoadMarker aiMarker = new AiRoadMarker();
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()));
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);
}
}
}
}
}
@@ -98,6 +64,13 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
}
}
private boolean isAiRoadEvent(String poiType) {
return Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType());
}
private boolean isDrawRoadLine(String poiType) {
return EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType);
}

View File

@@ -11,6 +11,8 @@ 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.map.angle.Default;
import com.mogo.eagle.core.function.api.map.angle.RoadEvent;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
@@ -151,7 +153,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onShow() {
if (isNeedChangeAngle()) {
CallerVisualAngleManager.INSTANCE.changeVisualAngle(CallerVisualAngleManager.Scene.RoadEvent.INSTANCE);
CallerVisualAngleManager.INSTANCE.changeAngle(RoadEvent.INSTANCE);
}
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
if (entity != null) {
@@ -177,7 +179,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
public void onDismiss() {
CallerHmiManager.INSTANCE.dismissWarning(WarningDirectionEnum.ALERT_WARNING_TOP);
if (isNeedChangeAngle()) {
CallerVisualAngleManager.INSTANCE.changeVisualAngle(new CallerVisualAngleManager.Scene.Default(3, TimeUnit.SECONDS));
CallerVisualAngleManager.INSTANCE.changeAngle(new Default(3, TimeUnit.SECONDS));
}
release();
}

View File

@@ -4,7 +4,6 @@ import androidx.core.util.Pair
import com.mogo.eagle.core.data.enums.EventTypeEnumNew.Companion.isRoadEvent
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerLocation
import com.mogo.eagle.core.data.map.entity.MarkerUserInfo
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker
import com.mogo.eagle.core.function.v2x.internal.data.*
@@ -13,85 +12,24 @@ import mogo.telematics.pad.MessagePad
import roadwork.Road
fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? =
if (this == null) null else MarkerLocation().also {
it.lon = this.lon
it.lat = this.lat
it.address = this.address
it.angle = this.angle
}
fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem? =
if (this == null) null else com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem().also {
it.illegalCount = this.illegalCount
it.content = this.content
it.url = this.url
it.thumbnail = this.thumbnail
}
fun V2XMarkerUserInfo?.toMarkerUserInfo(): MarkerUserInfo? =
if (this == null) null else MarkerUserInfo().also {
it.safeLabelType = this.safeLabelType
it.safeLabel = this.safeLabel
it.lastActiveweekAvgscore = this.lastActiveweekAvgscore
it.gender = this.gender
it.userHead = this.userHead
it.userName = this.userName
it.setAge(this.age)
}
fun V2XMarkerExploreWay.toMarkExploreWay(extras: Map<String, Any>? = null): MarkerExploreWay =
MarkerExploreWay().also {
it.items = this.items?.map { itx -> itx.toMarkerExploreWayItem() }
it.userInfo = this.userInfo?.toMarkerUserInfo()
it.distance = this.distance
it.cityName = this.cityName
it.setGenerateTime(this.generateTime)
it.infoId = this.infoId
it.setFileType(this.fileType)
it.setDirection(this.direction)
it.location = this.location?.toMarkerLocation()
it.sn = this.sn
it.canLive = this.canLive != "0"
it.poiType = this.poiType
it.type = this.type
it.infoCheckNode = this.infoCheckNode
it.isFabulous = this.isFabulous
it.uploadType = this.uploadType
it.isCanLive = this.canLive != "0"
it.extras = extras
}
fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
Pair(d.lon, d.lat)
}
extra["gps_location"] = listOf(
Pair(
this.roadwork?.center?.point?.lon ?: 0.0,
this.roadwork?.center?.point?.lat ?: 0.0
)
)
}
}
val centerX = this.roadwork?.center?.point?.lon ?: 0.0
val centerY = this.roadwork?.center?.point?.lat ?: 0.0
val id = "${centerX}_${centerY}"
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = this.roadwork?.poiType?.toString()
l3.generateTime = this.roadwork?.detectTime ?: 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(this.roadwork?.detectTime ?: 0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
}
l3.infoId = id
l3.gpsLocation = Pair(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0)
l3.polygon = this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { Pair(it.lon, it.lat) }
})
}
AiRoadMarker.aiMakers[id]?.receive()
@@ -99,52 +37,41 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult =
fun V2XRoadXData.toRoadMarker(): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.polygon?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
Pair(d.lon, d.lat)
}
extra["gps_location"] = listOf(Pair(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0))
}
}
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = this.poiType
l3.generateTime = this.detectTime ?: 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(this.detectTime ?: 0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.centerRoad?.bearing ?: 0.0
}
l3.infoId = this.index
l3.gpsLocation = Pair(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0)
l3.polygon = this.polygon?.takeIf { it.isNotEmpty() }?.map { Pair(it.lon, it.lat) }
})
}
AiRoadMarker.aiMakers[this.index]?.receive()
}
fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d -> Pair(d.longitude, d.latitude) }
extra["gps_location"] = listOf(Pair(this.longitude, this.latitude))
}
}
val id = "${this.longitude}_${this.latitude}"
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = poiType
l3.generateTime = 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.longitude, this.latitude)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.heading
}
l3.infoId = id
l3.gpsLocation = Pair(this.longitude, this.latitude)
l3.polygon = this.polygonList?.takeIf { it.isNotEmpty() }?.map { Pair(it.longitude, it.latitude) }
})
}
AiRoadMarker.aiMakers[id]?.receive()
@@ -152,14 +79,14 @@ fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult
fun V2XMarkerCardResult.toV2XRoadEventEntity(): V2XRoadEventEntity =
V2XRoadEventEntity().also { l1 ->
val exploreWayList: List<V2XMarkerExploreWay>? = this.exploreWay
val exploreWayList: List<MarkerExploreWay>? = this.exploreWay
if (!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()) {
for (markerExploreWay in exploreWayList) {
if (isRoadEvent(markerExploreWay.poiType)) {
val markerLocation = markerExploreWay.location
l1.location = markerLocation.toMarkerLocation()
l1.location = markerLocation
l1.poiType = markerExploreWay.poiType
l1.noveltyInfo = markerExploreWay.toMarkExploreWay(this.extras)
l1.noveltyInfo = markerExploreWay
l1.expireTime = 20000
}
}

View File

@@ -1,6 +1,8 @@
package com.mogo.eagle.core.function.v2x.internal.data
import androidx.annotation.Keep
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerLocation
import java.io.Serializable
@Keep
@@ -41,20 +43,15 @@ class V2XMarkerCardResult: V2XBaseData(), Serializable {
/**
* 探路数据集合
*/
var exploreWay: List<V2XMarkerExploreWay>? = null
var exploreWay: List<MarkerExploreWay>? = null
/**
* 服务端下发消息时间
*/
var messageTime: Long = 0
/**
* 额外信息
*/
var extras: Map<String, Any>? = null
override fun toString(): String {
return "MarkerCardResult(dataType=$dataType, carChat=$carChat, shareMusic=$shareMusic, noveltyInfo=$noveltyInfo, onlineCar=$onlineCar, exploreWay=$exploreWay, messageTime=$messageTime, extras=$extras)"
return "MarkerCardResult(dataType=$dataType, carChat=$carChat, shareMusic=$shareMusic, noveltyInfo=$noveltyInfo, onlineCar=$onlineCar, exploreWay=$exploreWay, messageTime=$messageTime)"
}
}
@@ -369,7 +366,7 @@ class V2XMarkerExploreWay: Serializable {
/**
* 位置信息
*/
var location: V2XMarkerLocation? = null
var location: MarkerLocation? = null
/**
* 车辆方位

View File

@@ -96,4 +96,7 @@ public class MogoServicePaths {
@Keep
public static final String PATH_IDENTIFY = "/map/identify";
@Keep
public static final String PATH_VISUAL_ANGLE = "/map/angle_change";
}

View File

@@ -4,6 +4,8 @@ package com.mogo.eagle.core.data.map.entity;
import android.text.TextUtils;
import androidx.core.util.Pair;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -35,7 +37,10 @@ public class MarkerExploreWay implements Serializable {
// 1 需要用户判断是否拥堵 进行UGC问答
private int infoCheckNode;
public Map<String, Object> extras = null;
private Pair<Double, Double> gpsLocation;
private List<Pair<Double, Double>> polygon;
public String getAddr() {
if (TextUtils.isEmpty(addr)) {
@@ -170,6 +175,22 @@ public class MarkerExploreWay implements Serializable {
this.uploadType = uploadType;
}
public Pair<Double, Double> getGpsLocation() {
return gpsLocation;
}
public void setGpsLocation(Pair<Double, Double> gpsLocation) {
this.gpsLocation = gpsLocation;
}
public List<Pair<Double, Double>> getPolygon() {
return polygon;
}
public void setPolygon(List<Pair<Double, Double>> polygon) {
this.polygon = polygon;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@@ -47,7 +47,7 @@ dependencies {
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.mogoobu
implementation project(':libraries:mogo-obu')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data

View File

@@ -56,6 +56,4 @@ interface IMoGoFuncBizProvider : IMoGoFunctionServerProvider {
fun fetchInfStructures()
fun getAllV2XEvents()
fun initOverViewDb(context: Context)
}

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.map.angle
import com.mogo.eagle.core.function.api.base.*
interface IMoGoVisualAngleChangeProvider: IMoGoFunctionServerProvider {
fun updateLongSightLevel(level: Boolean)
fun changeAngle(scene: Scene)
}

View File

@@ -0,0 +1,104 @@
package com.mogo.eagle.core.function.api.map.angle
import com.mogo.map.uicontroller.*
import java.util.concurrent.*
import java.util.concurrent.TimeUnit.SECONDS
private interface IAttach {
val angle: VisualAngleMode
val priority: Int
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
}
sealed class Scene: IAttach
/**
* 默认视图
* @param delay: 表示多少稍后默认值为2
* @param unit: 时间单位,默认为秒
*/
class Default(val delay: Long = 2, val unit: TimeUnit = SECONDS): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MODE_MEDIUM_SIGHT
override val priority: Int = 1
override val displayThreshold: Long
get() = 0
override fun toString(): String {
return "Default(delay=$delay, unit=$unit, angle=$angle, priority=$priority)"
}
}
/**
* 变道-接收到转向灯信息号
*/
class Turning(var open: Boolean = false): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP
override val priority: Int = 3
override val displayThreshold: Long
get() = -1
override fun toString(): String {
return "Turning(open: ${open}, priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
}
}
/**
* 后方车辆离自车过近
*/
object TooClose: Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_300
override val priority: Int = 2
override val displayThreshold: Long
get() = SECONDS.toMillis(8)
override fun toString(): String {
return "TooClose(priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
}
}
/**
* 道路事件
*/
object RoadEvent: Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MODE_LONG_SIGHT
override val priority: Int = 5
override val displayThreshold: Long
get() = SECONDS.toMillis(8)
override fun toString(): String {
return "RoadEvent(priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
}
}
/**
* 十字路口
*/
class CrossRoad(var open: Boolean = false): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS
override val priority: Int = 4
override val displayThreshold: Long
get() = -1
override fun toString(): String {
return "CrossRoad(open: ${open}, priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
}
}

View File

@@ -11,7 +11,7 @@ interface IMoGoObuLocationWGS84Listener {
/**
* HV车辆基础信息
*
s
* @param data 数据
* @since 1.0.0
*/

View File

@@ -50,9 +50,7 @@ dependencies {
// MoGo 数据埋点工具
implementation rootProject.ext.dependencies.analytics
compileOnly rootProject.ext.dependencies.mogocustommap
implementation rootProject.ext.dependencies.mogoobu
implementation project(':libraries:mogo-obu')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data

View File

@@ -1,398 +1,24 @@
package com.mogo.eagle.core.function.call.map
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.SystemClock
import android.util.*
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.*
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleOwner
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.map.uicontroller.VisualAngleMode
import com.zhidaoauto.map.sdk.open.tools.MapTools
import kotlinx.coroutines.*
import kotlinx.coroutines.android.asCoroutineDispatcher
import kotlinx.coroutines.internal.synchronized
import java.util.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeUnit.SECONDS
import java.util.concurrent.atomic.*
import kotlin.math.*
import com.alibaba.android.arouter.launcher.*
import com.mogo.eagle.core.data.constants.*
import com.mogo.eagle.core.function.api.map.angle.*
/**
* 高精地图视角管理类
*/
object CallerVisualAngleManager {
private const val TAG = "VisualAngle"
@Volatile
private var hasCrossRoad = false
private var scope: CoroutineScope = acquireScope()
@Synchronized
get() {
if (field.isActive) {
return field
}
val scope = acquireScope()
field = scope
return field
}
private var defaultDelayJob: Job? = null
private fun acquireScope(): CoroutineScope {
return CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher("change-visual-angle") + SupervisorJob())
private val provider by lazy { ARouter.getInstance().build(MogoServicePaths.PATH_VISUAL_ANGLE)
.navigation() as? IMoGoVisualAngleChangeProvider
}
private interface IAttach {
val angle: VisualAngleMode
val priority: Int
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
fun changeAngle(scene: Scene) {
provider?.changeAngle(scene)
}
private val triggerLocation = AtomicReference<MogoLocation>()
private val distanceOfCarToStopLine = AtomicReference(0.0)
private val travelled by lazy { AtomicReference(0.0) }
private val listener = object : OnRoadListener {
private val roadId = AtomicReference<String>()
private val triggerRoadId = AtomicReference<String>()
override fun onRoadIdInfo(roadId: String) {
this.roadId.set(roadId)
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.triggerRoadId.get()} -> curr: $roadId")
val loc = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
var triggerClose = false
val distance = distanceOfCarToStopLine.get() + 5
if (hasCrossRoad && distance > 0) {
val prev = triggerLocation.get()
if (prev != null && loc != null) {
travelled.set(MapTools.distance(loc.longitude, loc.latitude, prev.longitude, prev.latitude) + travelled.get())
triggerLocation.set(loc)
}
val oldRoadId = triggerRoadId.get()
Log.d(TAG, "-- onRoadIdInfo --: travelled --: ${travelled.get()}")
if ((travelled.get() > distance) && oldRoadId != null && oldRoadId != roadId) {
distanceOfCarToStopLine.set(0.0)
hasCrossRoad = false
triggerRoadId.set(null)
travelled.set(0.0)
triggerLocation.set(null)
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
triggerClose = true
}
}
if (triggerClose) {
changeVisualAngle(CrossRoad(false))
}
}
override fun onStopLineInfo(info: StopLine) {
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
hasCrossRoad = true
triggerRoadId.set(this.roadId.get())
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
triggerLocation.set(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02())
changeVisualAngle(CrossRoad(true))
}
}
fun updateLongSightLevel(level: Boolean) {
provider?.updateLongSightLevel(level)
}
fun init(ctx: Context) {
if (Thread.currentThread() != Looper.getMainLooper().thread) {
scope.launch {
initListen(ctx)
}
} else {
initListen(ctx)
}
}
private fun initListen(ctx: Context) {
ctx.lifeCycleOwner.lifecycle.addObserver(object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Event) {
if (event == ON_DESTROY) {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
}
})
CallerMapRoadListenerManager.registerRoadListener("VisualAngleChange", listener)
}
sealed class Scene private constructor(): IAttach {
/**
* 默认视图
* @param delay: 表示多少稍后默认值为2
* @param unit: 时间单位,默认为秒
*/
class Default(val delay: Long = 2, val unit: TimeUnit = SECONDS): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MODE_MEDIUM_SIGHT
override val priority: Int = 1
override val displayThreshold: Long
get() = 0
override fun toString(): String {
return "Default(delay=$delay, unit=$unit, angle=$angle, priority=$priority)"
}
}
/**
* 变道-接收到转向灯信息号
*/
class Turning(var open: Boolean = false): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP
override val priority: Int = 3
override val displayThreshold: Long
get() = -1
override fun toString(): String {
return "Turning(open: ${open}, priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
}
}
/**
* 后方车辆离自车过近
*/
object TooClose: Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_300
override val priority: Int = 2
override val displayThreshold: Long
get() = SECONDS.toMillis(8)
override fun toString(): String {
return "TooClose(priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
}
}
/**
* 道路事件
*/
object RoadEvent: Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MODE_LONG_SIGHT
override val priority: Int = 5
override val displayThreshold: Long
get() = SECONDS.toMillis(8)
override fun toString(): String {
return "RoadEvent(priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
}
}
/**
* 十字路口
*/
class CrossRoad(var open: Boolean = false): Scene() {
override val angle: VisualAngleMode = VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS
override val priority: Int = 4
override val displayThreshold: Long
get() = -1
override fun toString(): String {
return "CrossRoad(open: ${open}, priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
}
}
}
/**
* 业务实体,不对外暴露
* @param target: 目标场景
* @param isDisplay: 是否正在展示
* @param triggerTime: 触发时间
*/
private data class Record(val target: Scene, var isDisplay: Boolean = false, var triggerTime: Long): Comparable<Record> {
override fun compareTo(other: Record): Int {
//如果时间一样,优先级越高,越靠近堆顶
return other.target.priority - target.priority
}
}
private val queue by lazy {
PriorityQueue<Record>()
}
@Volatile
private var mLevel:Boolean = false
fun updateLongSightLevel(level:Boolean){
mLevel = level
}
fun changeVisualAngle(current: Scene) {
val appIdentityMode = FunctionBuildConfig.appIdentityMode
if (AppIdentityModeUtils.isBus(appIdentityMode) && AppIdentityModeUtils.isPassenger(appIdentityMode)) {
return
}
if(mLevel){
return
}
val triggerTime = SystemClock.elapsedRealtime()
scope.launch {
Log.d("${M_DEVA}${TAG}", "--- 1 ---")
val displayed = getDisplayed()
if (displayed == null) {
Log.d("${M_DEVA}${TAG}", "--- 2 ---")
if (current is Turning) {
if (!current.open) {
changeVisualAngle(Default())
return@launch
}
}
if (current is CrossRoad) {
if (!current.open) {
changeVisualAngle(Default())
return@launch
}
}
doRealVisualAngleChange(triggerTime, current, null)
} else {
val prev = displayed.target
Log.d("${M_DEVA}${TAG}", "--- 3 --- old: $prev -> cur: $current")
val prevTriggerTime = displayed.triggerTime
if (current !is Default && prev.priority > current.priority && (prev is RoadEvent || prev is TooClose)) {
val displayDuration = triggerTime - prevTriggerTime
Log.d("${M_DEVA}${TAG}", "--- 4 ---:场景[$prev], 已展示时长: duration: $displayDuration")
if (displayDuration < prev.displayThreshold) {
Log.d("${M_DEVA}${TAG}", "--- 5 --- 场景[$prev]:仍在保护展示时长内直接return")
return@launch
} else {
Log.d("${M_DEVA}${TAG}", "--- 6 --- 场景[$prev]:已过保护展示时长,从展示的队列中移除,显示默认视角")
queue -= displayed
changeVisualAngle(Default())
return@launch
}
}
if (prev is Turning && current is Turning) {
val isOpen = current.open
if (!isOpen) {
Log.d("${M_DEVA}${TAG}", "--- 7 --- 场景[$current], 收到关闭通知")
queue -= displayed
changeVisualAngle(Default())
return@launch
}
}
if (prev is CrossRoad && current is CrossRoad) {
val isOpen = current.open
if (!isOpen) {
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $current")
queue -= displayed
changeVisualAngle(Default())
return@launch
}
}
if (prev.priority == current.priority) {
Log.d("${M_DEVA}${TAG}", "--- 9 --- 场景[$prev]正在展示尚未收到关闭优先级一致直接return")
return@launch
}
if (prev.priority > current.priority && prev.displayThreshold < 0) {
Log.d("${M_DEVA}${TAG}", "--- 10 --- 场景[$prev]正在展示尚未收到关闭场景依然展示当前场景直接return")
return@launch
}
doRealVisualAngleChange(triggerTime, current, displayed)
}
}
}
private fun CoroutineScope.doRealVisualAngleChange(triggerTime: Long, target: Scene, displayed: Record? = null) {
if (target is Default) {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 1 ---")
displayed?.also {
queue -= it
}
defaultDelayJob?.safeCancel()
launch {
val delay = target.unit.toMillis(target.delay)
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 2 ---")
delay(delay)
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 3 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}.also { itx ->
itx.invokeOnCompletion {
if (it is CancellationException) {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 4 ---")
}
}
defaultDelayJob = itx
}
} else {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 5 ---")
defaultDelayJob?.safeCancel()
if (displayed == null || displayed.target.priority <= target.priority) {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 6 ---")
displayed?.also {
queue -= it
}
if (target is Turning) {
if (!target.open) {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 7 ---")
changeVisualAngle(Default())
return
}
}
if (target is CrossRoad) {
if (!target.open) {
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 8 ---")
changeVisualAngle(Default())
return
}
}
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 10 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}
}
}
@OptIn(InternalCoroutinesApi::class)
private fun doChangeAngle(record: Record) {
val angle = record.target.angle
CallerMapUIServiceManager.getMapUIController()?.also {
Log.d("${M_DEVA}${TAG}", "--- doChangeAngle --- ${record.target}")
if (record.target !is Default) {
record.isDisplay = true
synchronized(queue) {
queue += record
}
}
it.changeMapVisualAngle(angle, null)
}
}
/**
* 是否有正在展示的
*/
@Synchronized
private fun getDisplayed() = queue.firstOrNull()
}

View File

@@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4
LOGLIB_VERSION=1.5.10
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.3.32-beta3
MOGO_NETWORK_VERSION=1.4.4.1
# 鉴权
MOGO_PASSPORT_VERSION=1.4.3.32-beta3
MOGO_PASSPORT_VERSION=1.4.4.1
# 常链接
MOGO_SOCKET_VERSION=1.4.3.32-beta3
MOGO_SOCKET_VERSION=1.4.4.1
# 数据采集
MOGO_REALTIME_VERSION=1.4.3.32-beta3
MOGO_REALTIME_VERSION=1.4.4.1
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.3.32-beta3
MOGO_TANLU_VERSION=1.4.4.1
# 直播推流
MOGO_LIVE_VERSION=1.4.3.32-beta3
MOGO_LIVE_VERSION=1.4.4.1
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.3.32-beta3
MOGO_TRAFFICLIVE_VERSION=1.4.4.1
# 定位服务
MOGO_LOCATION_VERSION=1.4.3.32-beta3
MOGO_LOCATION_VERSION=1.4.4.1
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.3.32-beta2
MOGO_TELEMATIC_VERSION=1.4.4.1
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.10.0.2_test_01
@@ -130,12 +130,6 @@ TTS_NOOP_VERSION=2.1.16.10
# 自研地图
MAP_CUSTOM_VERSION=2.1.16.10
# 车聊聊
MOGO_MODULE_CHAT_VERSION=2.1.16.10
MOGO_MODULE_CARCHATTING_VERSION=2.1.16.10
# 车聊聊接口
MOGO_MODULE_CARCHATTINGPROVIDER_VERSION=2.1.16.10
# OCH
MOGO_OCH_VERSION=2.1.16.10-test
MOGO_OCH_BUS_VERSION=2.0.66

View File

@@ -135,6 +135,8 @@ message TrackedObject
repeated Location polygon = 15;
geometry.Point center = 16;
AdditionalAttribute add_attribute = 17; // 事件类型
reserved 18 to 100;
string strUuid = 101;//String类型车辆ID
}
message TrackedObjects
@@ -188,7 +190,7 @@ message AutopilotState
message PlanningObject
{
uint32 uuid = 1;
uint32 type = 2; //影响自车决策的类型, 和感知的障碍物类型不是一回事
uint32 type = 2; //影响自车决策的类型, 和感知的障碍物类型不是一回事 0是leading障碍物1是避障和择机的障碍物
}
message PlanningObjects

View File

@@ -5,13 +5,13 @@ package com.mogo.support.obu;
//垂直方向偏差 目前OBU发送的数据未偏移使用的是elevation
message VerticalLLV{
oneof present{
double offset1 = 1;//海拔,单位(m)
double offset2 = 2;//海拔,单位(m)
double offset3 = 3;//海拔,单位(m)
double offset4 = 4;//海拔,单位(m)
double offset5 = 5;//海拔,单位(m)
double offset6 = 6;//海拔,单位(m)
double elevation = 7;//海拔,单位(m)
double offset1 = 1; //海拔,单位(m)
double offset2 = 2; //海拔,单位(m)
double offset3 = 3; //海拔,单位(m)
double offset4 = 4; //海拔,单位(m)
double offset5 = 5; //海拔,单位(m)
double offset6 = 6; //海拔,单位(m)
double elevation = 7; //海拔,单位(m)
}
}
@@ -33,135 +33,158 @@ message PositionOffset{
}
message PositionLL1{
// (-2048..2047)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLL2{
// (-8192..8191)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLL3{
// (-32768..32767)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLL4{
// (-131072..131071)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLL5{
// (-2097152..2097151)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLL6{
// (-8388608..8388607)
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
message PositionLatLon{
// 定义经度数值。东经为正,西经为负。
//分辨率为1e-7°。
double longitude = 1;//经度,单位(°)
double latitude = 2;//维度,单位(°)
double longitude = 1; //经度,单位(°)
double latitude = 2; //维度,单位(°)
}
//////////////////////////////////////////////////////////////////
//交通标志/事件位置信息
message PositionLLV{
PositionOffset position = 1;//经纬度
VerticalLLV vertical = 2;//垂直方向偏差
PositionOffset position = 1; //经纬度
VerticalLLV vertical = 2; //垂直方向偏差
}
//交通参与者尺寸信息
message VehicleSize {
int32 width = 1;//宽度,单位(cm)
int32 length = 2;//长度,单位(cm)
int32 height = 3;//高度,单位(cm)
int32 width = 1; //宽度,单位(cm)
int32 length = 2; //长度,单位(cm)
int32 height = 3; //高度,单位(cm)
}
//四轴加速度
message AccFourAxes {
double accLng = 1;//纵向加速度,单位(m/s2)
double accLat = 2;//横向加速度,单位(m/s2)
double accVert = 3;//垂直加速度,单位(G)
double accYaw = 4;//横摆角加速度,单位(°/s)
double accLng = 1; //纵向加速度,单位(m/s2)
double accLat = 2; //横向加速度,单位(m/s2)
double accVert = 3; //垂直加速度,单位(G)
double accYaw = 4; //横摆角加速度,单位(°/s)
}
//节点信息
message NodeId{
int32 region = 1;/* 定义地图中划分区域的ID号 */
int32 id = 2; /* 定义地图节点ID */
int32 region = 1; /* 定义地图中划分区域的ID号 */
int32 id = 2; /* 定义地图节点ID */
}
//灯色信息
message SpatLight{
int32 phaseID = 1; /* 信号灯相位ID */
int32 maneuvers = 2; /* 允许转向关系bit0直行bit1左转bit2右转bit3掉头 */
int32 light = 3; /* 灯色0不可用1黑色2红闪3红色4绿闪5permissive_green6protected_green7黄色8黄闪 */
double countDown = 4; /* 灯色倒计时,单位(s) */
int32 phaseID = 1; /* 信号灯相位ID */
int32 maneuvers = 2; /* 允许转向关系bit0直行bit1左转bit2右转bit3掉头 */
int32 light = 3; /* 灯色0不可用1黑色2红闪3红色4绿闪5permissive_green6protected_green7黄色8黄闪 */
double countDown = 4; /* 灯色倒计时,单位(s) */
double suggestMaxSpeed = 5; /* 建议最大车速,单位(m/s) */
double suggestMinSpeed = 6; /* 建议最小车速,单位(m/s) */
}
//时间
message DateTime{
int32 year = 1; /* 年份 */
int32 year = 1; /* 年份 */
int32 month = 2; /* 月份 */
int32 day = 3; /* 日期 */
int32 hour = 4; /* 小时 */
int32 minute = 5; /* 分钟 */
int32 millisecond = 6; /* 毫秒 */
int32 millisecond = 6; /* 毫秒 */
int32 offset = 7; /* 定义与UTC时间的分钟差 */
}
//预警数据
message WarningData{
int32 unitMask = 1; /* 描述所属字段有效性 */
int32 status = 2; /* 状态信息0更新1添加2删除 */
int32 warningType = 3; /* 预警类型0前向碰撞预警1交叉路口碰撞预警2左转辅助预警3盲区预警4变道预警
5逆向超车预警6紧急制动预警7异常车辆提醒8失控车辆预警9紧急车辆预警10弱势交通参与者碰撞预警 */
int32 unitMask = 1; /* 描述所属字段有效性 */
int32 status = 2; /* 状态信息0更新1添加2删除 */
int32 warningType = 3; /* 预警类型0前向碰撞预警1交叉路口碰撞预警2左转辅助预警3盲区预警4变道预警
5逆向超车预警6紧急制动预警7异常车辆提醒8失控车辆预警9紧急车辆预警10弱势交通参与者碰撞预警 */
int32 warningLevel = 4; /* 预警等级0无效1DETECTED2INFORM3WARNING */
int32 warningPriority = 5; /* 预警优先级默认为0预留 */
int32 warningPriority = 5; /* 预警优先级默认为0预留 */
}
//弱势交通参与者预警信息
message V2xWarning{
int32 unitMask = 1; /* 描述所属字段有效性 */
repeated WarningData warningData = 2;
DateTime warningTime = 3; /* 预警触发时间 */
double distance = 4; /* 预警触发时与自车之间的距离,单位(m) */
int32 unitMask = 1; /* 描述所属字段有效性 */
repeated WarningData warningData = 2; /*预警数据*/
DateTime warningTime = 3; /* 预警触发时间 */
double distance = 4; /* 预警触发时与自车之间的距离,单位(m) */
}
//弱势交通参与者信息
message Participant{
int32 ptcType = 1; /* 交通参与者类型0未知1机动车2非机动车3行人4OBU自身 */
int32 ptcId = 2; /* 临时ID取值范围(1..255) */
int32 source = 3; /* 监测信息来源0未知1RSU自身2V2X广播3视频传感器4微波雷达5地磁线圈传感器6激光雷达传感器7两类或以上感知数据融合 */
int64 secMark = 4; /* UTC时间单位(ms) */
int32 ptcType = 1; /* 交通参与者类型0未知1机动车2非机动车3行人4OBU自身 */
int32 ptcId = 2; /* 临时ID取值范围(1..255) */
int32 source = 3; /* 监测信息来源0未知1RSU自身2V2X广播3视频传感器4微波雷达5地磁线圈传感器6激光雷达传感器7两类或以上感知数据融合 */
int64 secMark = 4; /* UTC时间单位(ms) */
double latitude = 5; /* 维度,单位(°) */
double longitude = 6; /* 经度,单位(°) */
double elevation = 7; /* 海拔,单位(m) */
double speed = 8; /* 速度,单位(m/s) */
double heading = 9; /* 航向角,单位(°) */
double heading = 9; /* 航向角,单位(°) */
AccFourAxes accFourAxes = 10; /* 四轴加速度 */
VehicleSize ptcSize = 11; /* 交通参与者尺寸信息 */
int32 vehicleClass = 12; /* 车辆类型参考《OBU软件SDK使用文档》附录A中的表1 */
int32 targetPosition = 13; /* 目标方位参考mg_veh_target_position_t */
VehicleSize ptcSize = 11; /* 交通参与者尺寸信息 */
int32 vehicleClass = 12; /* 车辆类型参考《OBU软件SDK使用文档》附录A中的表1 */
int32 targetPosition = 13; /* 目标方位参考mg_veh_target_position_t */
}
message RsiWarning {
int32 unitMask = 1; /* 描述所属字段有效性 */
int32 unitMask = 1; /* 描述所属字段有效性 */
int32 sceneType = 2; /* 预警类型0无效1限速信息2道路危险3车内标牌4前方拥堵 */
PositionLLV position = 3; /* 交通标志/事件位置信息 */
int32 signSerialNum = 4; /* 交通标志类型序号根据预警类型匹配0无效参照国标《GB 5768.2-2009中“交通标志中文名称索引》表序号 */
int32 eventSerialNum = 5; /* 交通事件类型序号根据预警类型匹配0无效参考国标《GB/T 29100-2012》中定义的事件分类代码 */
double speedMaxLimit = 6; /* 建议最大车速,单位(0.02m/s) */
double speedMinLimit = 7; /* 建议最小车速,单位(0.02m/s) */
PositionLLV position = 3; /* 交通标志/事件位置信息 */
int32 signSerialNum = 4; /* 交通标志类型序号根据预警类型匹配0无效参照国标《GB 5768.2-2009中“交通标志中文名称索引》表序号 */
int32 eventSerialNum = 5; /* 交通事件类型序号根据预警类型匹配0无效参考国标《GB/T 29100-2012》中定义的事件分类代码 */
double speedMaxLimit = 6; /* 建议最大车速,单位(0.02m/s) */
double speedMinLimit = 7; /* 建议最小车速,单位(0.02m/s) */
double eventRadius = 8; /* 交通事件触发半径根据预警类型匹配0无效单位(0.1m) */
int32 warningLevel = 9; /* 预警等级0无效1DETECTED2INFORM3WARNING */
int32 targetPosition = 10; /* 目标方位参考mg_rti_target_position_t */
double distance = 11; /* 预警触发时与自车之间的距离,单位(0.01m) */
int32 targetPosition = 10; /* 目标方位参考mg_rti_target_position_t */
double distance = 11; /* 预警触发时与自车之间的距离,单位(0.01m) */
}
message VehicleControl{
int32 unitMask = 1; /* 描述所属字段有效性 */
int32 brakePedalStatus = 2; /* 刹车踏板状态0未装备/未知/不可用1刹车踏板未踩下2刹车踏板已踩下 */
int32 transmissionStatus = 3; /* 车辆档位状态0空挡1停止档2前进挡3倒挡7无效值 */
int32 exteriorLights = 4; /* 车灯状态0近光灯1远光灯2左转信号灯3右转信号灯4危险信号灯5自动大灯6日间行车灯7雾灯8停车灯 */
}
message VehicleBasics{
int32 unitMask = 1; /* 描述所属字段有效性 */
string id = 2; /* OBU ID */
int64 secMark = 3; /* UTC时间单位(ms) */
double latitude = 4; /* 维度,单位(°) */
double longitude = 5; /* 经度,单位(°) */
double elevation = 6; /* 海拔,单位(m) */
double speed = 7; /* 速度,单位(m/s) */
double heading = 8; /* 航向角,单位(°) */
AccFourAxes accFourAxes = 9; /* 四轴加速度 */
VehicleSize vehSize = 10; /* 车辆尺寸 */
int32 vehClass = 11; /* 车辆类型参考《OBU软件SDK使用文档》附录A中的表1 */
VehicleControl vehControlMsg = 12; /* 车辆系统控制信息 */
int32 targetPosition = 13; /* 目标方位参考mg_veh_target_position_t */
}

View File

@@ -2,35 +2,47 @@ syntax = "proto3";
package com.mogo.support.obu;
import "personal/obu_base.proto";
//场景PB 目前只有V2IRsi、Rsm、Spat、Map相关场景后期会添加V2V相关场景
//场景PB:包括 RV HV(V2V) V2IRsi、Rsm、Spat、Map相关场景
//预警事件 RSI Warning event
message RsiWarningData {
int32 status = 1; /* 状态信息0更新1添加2删除 */
//int32 warning_num = 2; /* 预警信息数量 */
int32 status = 1; /* 状态信息0更新1添加2删除 */
repeated RsiWarning warningMsg = 2; /* 预警信息集合 */
}
//RSM Warning Msg
message RsmWarningData{
int32 status = 1; /* 状态信息0更新1添加2删除 */
Participant participant = 2; /* 弱势交通参与者信息 */
V2xWarning warningMsg = 3; /* 弱势交通参与者预警信息 */
int32 status = 1; /* 状态信息0更新1添加2删除 */
Participant participant = 2; /* 弱势交通参与者信息 */
V2xWarning warningMsg = 3; /* 弱势交通参与者预警信息 */
}
//SPAT Msg
message SpatWarningData{
int32 status = 1; /* 状态信息0更新1添加2删除 */
int32 warningType = 2; /* 预警类型信息 */
repeated SpatLight lights = 3; /* 灯色信息集合 */
int32 status = 1; /* 状态信息0更新1添加2删除 */
int32 warningType = 2; /* 预警类型信息 */
repeated SpatLight lights = 3; /* 灯色信息集合 */
}
message MapMatchData{
int32 status = 1;/* 状态信息0更新1添加2删除 */
int32 unitMask = 2;/* 描述所属字段有效性 */
NodeId currentNodeID = 3;/* 前方节点信息 */
NodeId upstreamNodeID = 4;/* 上游节点信息 */
int32 matchingLaneID = 5;/* 匹配车道ID0无效 */
double speedMaxLimit = 6;/* 建议最大车速,单位(m/s) */
double speedMinLimit = 7;/* 建议最小车速,单位(m/s) */
int32 status = 1; /* 状态信息0更新1添加2删除 */
int32 unitMask = 2; /* 描述所属字段有效性 */
NodeId currentNodeID = 3; /* 前方节点信息 */
NodeId upstreamNodeID = 4; /* 上游节点信息 */
int32 matchingLaneID = 5; /* 匹配车道ID0无效 */
double speedMaxLimit = 6; /* 建议最大车速,单位(m/s) */
double speedMinLimit = 7; /* 建议最小车速,单位(m/s) */
}
//自车信息
message HvBasicsData{
int32 status = 1; /* 状态信息0更新1添加2删除 */
VehicleBasics vehBasicsMsg = 2; /* 自车基础运行信息 */
}
//他车数据包括 V2V预警信息
message RvWarningData{
int32 status = 1; /* 状态信息0更新1添加2删除 */
VehicleBasics vehBasicsMsg = 2; /* 临车基础运行信息 */
V2xWarning warningMsg = 3; /* V2V预警信息 */
}

View File

@@ -1,6 +1,5 @@
plugins {
id 'com.android.library'
id 'com.google.protobuf'
}
android {
@@ -21,31 +20,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
proto {
srcDir 'src/main/proto'
include '**/*.proto'
}
}
}
protobuf {
protoc {
artifact = rootProject.ext.dependencies.protoc
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.builtins {
java {}
}
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -54,8 +28,7 @@ android {
}
dependencies {
api project(':libraries:mogo-adas-data')
api rootProject.ext.dependencies.protobuf_java
api rootProject.ext.dependencies.protobuf_java_util
implementation project(':libraries:mogo-adas-data')
implementation rootProject.ext.dependencies.androidxappcompat
api rootProject.ext.dependencies.mogoobu
}

View File

@@ -0,0 +1,825 @@
package com.zhidao.support.obu;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.support.obu.MogoObuManager;
import com.mogo.support.obu.ObuBase;
import com.mogo.support.obu.ObuScene;
import com.mogo.support.obu.OnMogoObuListener;
import com.mogo.support.obu.constants.MogoObuConstants;
import com.mogo.support.obu.constants.MogoObuTopicId;
import com.mogo.support.obu.model.MogoObuHvBasicsData;
import com.mogo.support.obu.model.MogoObuMapMathData;
import com.mogo.support.obu.model.MogoObuRsiWarningData;
import com.mogo.support.obu.model.MogoObuRsmWarningData;
import com.mogo.support.obu.model.MogoObuRvWarningData;
import com.mogo.support.obu.model.MogoObuSpatWarningData;
import com.mogo.support.obu.model.advance.AccFourAxes;
import com.mogo.support.obu.model.advance.DateTime;
import com.mogo.support.obu.model.advance.NodeId;
import com.mogo.support.obu.model.advance.Participant;
import com.mogo.support.obu.model.advance.PositionLLV;
import com.mogo.support.obu.model.advance.RsiWarning;
import com.mogo.support.obu.model.advance.SpatLight;
import com.mogo.support.obu.model.advance.V2xWarning;
import com.mogo.support.obu.model.advance.VehBasics;
import com.mogo.support.obu.model.advance.VehControl;
import com.mogo.support.obu.model.advance.VehSize;
import com.mogo.support.obu.model.advance.VerticalLLV;
import com.mogo.support.obu.model.advance.WarningData;
import com.mogo.support.obu.option.MogoObuLog;
import com.mogo.support.obu.option.MogoObuOptions;
import com.mogo.support.obu.upgrade.OnUpgradeListener;
import java.util.List;
import java.util.Set;
import mogo.telematics.pad.MessagePad;
public class ObuManager {
private static final String TAG = ObuManager.class.getSimpleName();
private static volatile ObuManager INSTANCE;
private OnObuListener listener;
public static ObuManager getInstance() {
if (INSTANCE == null) {
synchronized (ObuManager.class) {
if (INSTANCE == null) {
INSTANCE = new ObuManager();
}
}
}
return INSTANCE;
}
/**
* 获取当前连接状态
*
* @return 连接状态
* @since 1.0.0
*/
public int getConnectStatus() {
return MogoObuManager.getInstance().getConnectStatus();
}
/**
* 获取已连接的OBU IP 断开连接会置null
*
* @return IP
* @since 1.0.0
*/
public String getConnectedIp() {
return MogoObuManager.getInstance().getConnectedIp();
}
/**
* 获取已连接的OBU 端口 断开连接会置null
*
* @return 端口
* @since 1.0.0
*/
public int getConnectedPort() {
return MogoObuManager.getInstance().getConnectedPort();
}
/**
* 获取当前SDK版本
*
* @return 版本
* @since 1.0.0
*/
public String getVersion() {
return MogoObuManager.getInstance().getVersion();
}
/**
* 获取当前SO版本号
*
* @return 版本 未连接为null
* @since 1.0.0
*/
public String getSoVersion() {
return MogoObuManager.getInstance().getSoVersion();
}
/**
* 获取当前OBU软件版本
* 需主动调用获取{@link MogoObuManager#getObuVersion(Context, String, OnUpgradeListener)}
*
* @return 版本 null表示 无法连接OBU无法获取版本
* @since 1.1.0
*/
@Nullable
public String getObuVersion() {
return MogoObuManager.getInstance().getObuVersion();
}
/**
* 获取已注册的 Topic ID
*
* @return Topic ID
* @since 1.0.0
*/
public List<MogoObuTopicId> getRegisteredTopicId() {
return MogoObuManager.getInstance().getRegisteredTopicId();
}
/**
* 获取未注册的 Topic ID
*
* @return Topic ID
* @since 1.0.0
*/
public List<MogoObuTopicId> getUnregisteredTopicId() {
return MogoObuManager.getInstance().getUnregisteredTopicId();
}
/**
* 注册回调 包括连接状态以及数据回调
*
* @param obuListener 数据回调接口
* @since 1.0.0
*/
public void registerObuListener(OnObuListener obuListener) {
this.listener = obuListener;
MogoObuManager.getInstance().registerMogoObuListener(mogoObuListener);
}
/**
* 取消注册
*
* @since 1.0.0
*/
public void unregisterObuListener() {
MogoObuManager.getInstance().unregisterMogoObuListener();
listener = null;
}
/**
* 连接
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
* 异步结果回调回调顺序 每次一种类型
* 1.result.function == MogoObuConstants.CALL_FUNCTION.CONFIG onMogoObuCallResult(MogoObuCallConfigResult result) 连接配置或日志配置(如果有配置)
* 2.result.function == MogoObuConstants.CALL_FUNCTION.INIT onMogoObuCallResult(MogoObuCallResult result) 初始化,进行连接操作
* 3.result.function == MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST onMogoObuCallResult(MogoObuCallRegisterResult result) 注册Topic ID如果有配置
*
* @param options 参数
* @since 1.0.0
*/
public void connect(MogoObuOptions options) {
MogoObuManager.getInstance().connect(options);
}
/**
* 断开连接
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
*
* @since 1.0.1
*/
public void disconnect() {
MogoObuManager.getInstance().disconnect();
}
/**
* 注册Topic
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
* result.function == MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST onMogoObuCallResult(MogoObuCallRegisterResult result)
* 此版本支持的Topic ID
* MogoObuTopicId.HV_BASIC
* MogoObuTopicId.RV_WARNING
* MogoObuTopicId.SPAT_WARNING
* MogoObuTopicId.RSI_WARNING
* MogoObuTopicId.RSM_WARNING
* MogoObuTopicId.MAP_MATCH
*
* @param topicId id
* @since 1.0.0
*/
public void registerTopic(MogoObuTopicId topicId) {
MogoObuManager.getInstance().registerTopic(topicId);
}
/**
* 注册多个Topic
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
* result.function == MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST onMogoObuCallResult(MogoObuCallRegisterResult result)
* 此版本支持的Topic ID
* MogoObuTopicId.HV_BASIC
* MogoObuTopicId.RV_WARNING
* MogoObuTopicId.SPAT_WARNING
* MogoObuTopicId.RSI_WARNING
* MogoObuTopicId.RSM_WARNING
* MogoObuTopicId.MAP_MATCH
*
* @param topicIds ids
* @since 1.0.0
*/
public void registerTopic(Set<MogoObuTopicId> topicIds) {
MogoObuManager.getInstance().registerTopic(topicIds);
}
/**
* 取消注册Topic
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
*
* @param topicId id
* @since @since 1.0.1
*/
public void unregisterTopic(MogoObuTopicId topicId) {
MogoObuManager.getInstance().unregisterTopic(topicId);
}
/**
* 取消注册多个Topic
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
*
* @param topicIds ids
* @since 1.0.1
*/
public void unregisterTopic(Set<MogoObuTopicId> topicIds) {
MogoObuManager.getInstance().unregisterTopic(topicIds);
}
/**
* OBU SDK 日志配置
* 支持日志输出至LogCat和写入文件
* 调用结果异步返回 listener.onMogoObuCallResult(BaseResult result)
* result.function == MogoObuConstants.CALL_FUNCTION.CONFIG onMogoObuCallResult(MogoObuCallConfigResult result) 日志配置
*
* @param log 日志配置
* @since 1.0.0
*/
public void logConfig(MogoObuLog log) {
MogoObuManager.getInstance().logConfig(log);
}
/**
* 配置Android日志
*
* @param isEnableLog 是否开启日志输出
* @since 1.0.0
*/
public void setEnableLog(boolean isEnableLog) {
MogoObuManager.getInstance().setEnableLog(isEnableLog);
}
/**
* 检查更新
*
* @param obuIp OBU IP
* @param listener 升级回调
* @since 1.1.0
*/
public boolean checkObuUpgrade(@NonNull Context context, @NonNull String obuIp, OnUpgradeListener listener) {
return MogoObuManager.getInstance().checkObuUpgrade(context, obuIp, listener);
}
/**
* 检查更新
*
* @param context 上下文
* @param obuIp OBU IP
* @param isUpgradeNow 是否立即升级
* falseOBU设备下次上电时执行升级程序
* ture: OBU设备立即执行升级程序 TODO 警告:执行立即升级时请确保车辆是静止状态。车辆在运行过程中升级设备可能会影响驾驶,严重时可能造成安全隐患!!!
* @param listener 升级回调
* @return 是否调用成功
* @since 1.1.0
*/
public boolean checkObuUpgrade(@NonNull Context context, @NonNull String obuIp, boolean isUpgradeNow, OnUpgradeListener listener) {
return MogoObuManager.getInstance().checkObuUpgrade(context, obuIp, isUpgradeNow, listener);
}
/**
* 获取当前连接OBU的版本号
* 如果调用 {@link MogoObuManager#checkObuUpgrade(Context, String, OnUpgradeListener)}方法可以不用调用此方法,检查更新会获取版本号
*
* @param context 上下文
* @param obuIp OBU IP
* @param listener 升级回调
* @return 是否调用成功
* @since 1.1.0
*/
public boolean getObuVersion(@NonNull Context context, @NonNull String obuIp, OnUpgradeListener listener) {
return MogoObuManager.getInstance().getObuVersion(context, obuIp, listener);
}
/**
* 传入升级包版本
*
* @param newVersion 升级包版本
* @since 1.1.0
*/
public void setObuUpgradePackageVersion(@NonNull String newVersion) {
MogoObuManager.getInstance().setObuUpgradePackageVersion(newVersion);
}
/**
* 传入升级包
*
* @param newUpgradePackage 升级包文件绝对路径 只能包含 升级包MD5文件和升级包文件
* @since 1.1.0
*/
public void setObuUpgradePackage(@NonNull String[] newUpgradePackage) {
MogoObuManager.getInstance().setObuUpgradePackage(newUpgradePackage);
}
/**
* 停止升级或停止版本查询
*
* @since 1.1.0
*/
public void stopObuUpgrade() {
MogoObuManager.getInstance().stopObuUpgrade();
}
private final OnMogoObuListener mogoObuListener = new OnMogoObuListener() {
@Override
public void onConnectStatus(int connectStatus) {
if (listener != null) {
listener.onConnectStatus(connectStatus);
}
}
@Override
public void onMogoObuHvBasics(MogoObuHvBasicsData data) {
if (listener != null) {
// ObuScene.HvBasicsData.Builder builder = ObuScene.HvBasicsData.newBuilder();
// builder.setStatus(data.getStatus());
VehBasics vehBasics = data.getVehBasicsMsg();
// if (vehBasics != null) {
// builder.setVehBasicsMsg(getVehBasics(vehBasics));
// }
// listener.onObuHvBasics(builder.build());
//转工控机PB 赋值的包括 satelliteTime systemTime latitude longitude altitude heading gnssSpeed acceleration vehicleSpeed 未赋值yawRate
if (vehBasics != null) {
MessagePad.GnssInfo.Builder gnssInfoBuilder = MessagePad.GnssInfo.newBuilder();
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.SEC_MARK)) {
double time = vehBasics.getSecMark() / 1000.0D;
gnssInfoBuilder.setSatelliteTime(time);
gnssInfoBuilder.setSystemTime(time);
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.LATITUDE)) {
gnssInfoBuilder.setLatitude(vehBasics.getLatitude());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.LONGITUDE)) {
gnssInfoBuilder.setLongitude(vehBasics.getLongitude());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.ELEVATION)) {
gnssInfoBuilder.setAltitude(vehBasics.getElevation());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.SPEED)) {
gnssInfoBuilder.setGnssSpeed(vehBasics.getSpeed());
gnssInfoBuilder.setVehicleSpeed(vehBasics.getSpeed());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.HEADING)) {
gnssInfoBuilder.setHeading(vehBasics.getHeading());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.ACC_FOUR_AXES)) {
AccFourAxes accFourAxes = vehBasics.getAccFourAxes();
if (accFourAxes != null) {
gnssInfoBuilder.setAcceleration(accFourAxes.getAccLng());
}
}
listener.onGnssInfo(gnssInfoBuilder.build());
}
}
}
@Override
public void onMogoObuRvWarning(MogoObuRvWarningData data) {
super.onMogoObuRvWarning(data);
if (listener != null) {
ObuScene.RvWarningData.Builder builder = ObuScene.RvWarningData.newBuilder();
builder.setStatus(data.getStatus());
VehBasics vehBasics = data.getVehBasicsMsg();
if (vehBasics != null) {
builder.setVehBasicsMsg(getVehBasics(vehBasics));
}
V2xWarning v2xWarning = data.getWarningMsg();
if (v2xWarning != null) {
builder.setWarningMsg(getV2xWarning(v2xWarning));
}
listener.onObuRvWarning(builder.build());
}
}
@Override
public void onMogoObuSpatWarning(MogoObuSpatWarningData data) {
super.onMogoObuSpatWarning(data);
if (listener != null) {
ObuScene.SpatWarningData.Builder builder = ObuScene.SpatWarningData.newBuilder();
builder.setStatus(data.getStatus()).setWarningType(data.getWarningType());
List<SpatLight> lights = data.getLights();
if (lights != null && !lights.isEmpty()) {
for (SpatLight light : lights) {
builder.addLights(ObuBase.SpatLight.newBuilder()
.setPhaseID(light.getPhaseId())
.setManeuvers(light.getManeuvers())
.setLight(light.getLight())
.setCountDown(light.getCountDown())
.setSuggestMaxSpeed(light.getSuggestMaxSpeed())
.setSuggestMinSpeed(light.getSuggestMinSpeed()));
}
}
listener.onObuSpatWarning(builder.build());
}
}
@Override
public void onMogoObuRsiWarning(MogoObuRsiWarningData data) {
super.onMogoObuRsiWarning(data);
if (listener != null) {
ObuScene.RsiWarningData.Builder builder = ObuScene.RsiWarningData.newBuilder();
builder.setStatus(data.getStatus());
List<RsiWarning> list = data.getWarningMsg();
if (list != null && !list.isEmpty()) {
for (RsiWarning warning : list) {
ObuBase.RsiWarning.Builder rsiBuilder = ObuBase.RsiWarning.newBuilder();
rsiBuilder.setUnitMask(warning.getUnitMask());
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.SCENE_TYPE)) {
rsiBuilder.setSceneType(warning.getSceneType());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.POSITION)) {
PositionLLV positionLLV = warning.getPosition();
int present = positionLLV.getPresent();//由于OBU数据没有给偏移量默认使用的是7
double longitude = positionLLV.getLongitude();
double latitude = positionLLV.getLatitude();
ObuBase.PositionOffset.Builder positionOffsetBuilder = ObuBase.PositionOffset.newBuilder();
if (present == 1) {
positionOffsetBuilder.setPositionLL1(ObuBase.PositionLL1.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else if (present == 2) {
positionOffsetBuilder.setPositionLL2(ObuBase.PositionLL2.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else if (present == 3) {
positionOffsetBuilder.setPositionLL3(ObuBase.PositionLL3.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else if (present == 4) {
positionOffsetBuilder.setPositionLL4(ObuBase.PositionLL4.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else if (present == 5) {
positionOffsetBuilder.setPositionLL5(ObuBase.PositionLL5.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else if (present == 6) {
positionOffsetBuilder.setPositionLL6(ObuBase.PositionLL6.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
} else {
positionOffsetBuilder.setPositionLatLon(ObuBase.PositionLatLon.newBuilder()
.setLongitude(longitude)
.setLatitude(latitude));
}
VerticalLLV verticalLLV = positionLLV.getVertical();
present = verticalLLV.getPresent();//由于OBU数据没有给偏移量默认使用的是7
double elevation = verticalLLV.getElevation();
ObuBase.VerticalLLV.Builder verticalLLVBuilder = ObuBase.VerticalLLV.newBuilder();
if (present == 1) {
verticalLLVBuilder.setOffset1(elevation);
} else if (present == 2) {
verticalLLVBuilder.setOffset2(elevation);
} else if (present == 3) {
verticalLLVBuilder.setOffset3(elevation);
} else if (present == 4) {
verticalLLVBuilder.setOffset4(elevation);
} else if (present == 5) {
verticalLLVBuilder.setOffset5(elevation);
} else if (present == 6) {
verticalLLVBuilder.setOffset6(elevation);
} else {
verticalLLVBuilder.setElevation(elevation);
}
rsiBuilder.setPosition(ObuBase.PositionLLV.newBuilder()
.setPosition(positionOffsetBuilder)
.setVertical(verticalLLVBuilder));
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.SIGN_SERIAL_NUM)) {
rsiBuilder.setSignSerialNum(warning.getSignSerialNum());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.EVENT_SERIAL_NUM)) {
rsiBuilder.setEventSerialNum(warning.getEventSerialNum());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.SPEED_MAX_LIMIT)) {
rsiBuilder.setSpeedMaxLimit(warning.getSpeedMaxLimit());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.SPEED_MIN_LIMIT)) {
rsiBuilder.setSpeedMinLimit(warning.getSpeedMinLimit());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.EVENT_RADIUS)) {
rsiBuilder.setEventRadius(warning.getEventRadius());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.WARNING_LEVEL)) {
rsiBuilder.setWarningLevel(warning.getWarningLevel());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.TARGET_POSITION)) {
rsiBuilder.setTargetPosition(warning.getTargetPosition());
}
if (warning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_RSI_WARNING.DISTANCE)) {
rsiBuilder.setDistance(warning.getDistance());
}
builder.addWarningMsg(rsiBuilder);
}
}
listener.onObuRsiWarning(builder.build());
}
}
@Override
public void onMogoObuRsmWarning(MogoObuRsmWarningData data) {
super.onMogoObuRsmWarning(data);
if (listener != null) {
ObuScene.RsmWarningData.Builder builder = ObuScene.RsmWarningData.newBuilder();
builder.setStatus(data.getStatus());
Participant participant = data.getParticipant();
if (participant != null) {
ObuBase.Participant.Builder participantBuilder = ObuBase.Participant.newBuilder();
participantBuilder.setPtcType(participant.getPtcType())
.setPtcId(participant.getPtcId())
.setSource(participant.getSource())
.setSecMark(participant.getSecMark())
.setLatitude(participant.getLatitude())
.setLongitude(participant.getLongitude())
.setSpeed(participant.getSpeed())
.setHeading(participant.getHeading());
AccFourAxes accFourAxes = participant.getAccFourAxes();
if (accFourAxes != null) {
participantBuilder.setAccFourAxes(getAccFourAxes(accFourAxes));
}
VehSize vehicleSize = participant.getPtcSize();
if (vehicleSize != null) {
participantBuilder.setPtcSize(getVehSize(vehicleSize));
}
participantBuilder.setVehicleClass(participant.getVehicleClass())
.setTargetPosition(participant.getTargetPosition());
builder.setParticipant(participantBuilder);
}
V2xWarning v2xWarning = data.getWarningMsg();
if (v2xWarning != null) {
builder.setWarningMsg(getV2xWarning(v2xWarning));
}
listener.onObuRsmWarning(builder.build());
}
}
@Override
public void onMogoObuMapMath(MogoObuMapMathData data) {
super.onMogoObuMapMath(data);
if (listener != null) {
ObuScene.MapMatchData.Builder builder = ObuScene.MapMatchData.newBuilder();
builder.setStatus(data.getStatus()).setUnitMask(data.getUnitMask());
if (data.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_MAP_MATH.CURRENT_NODE_ID)) {
NodeId nodeId = data.getCurrentNodeId();
if (nodeId != null) {
builder.setCurrentNodeID(ObuBase.NodeId.newBuilder()
.setRegion(nodeId.getRegion())
.setId(nodeId.getId()));
}
}
if (data.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_MAP_MATH.UPSTREAM_NODE_ID)) {
NodeId nodeId = data.getUpstreamNodeId();
if (nodeId != null) {
builder.setUpstreamNodeID(ObuBase.NodeId.newBuilder()
.setRegion(nodeId.getRegion())
.setId(nodeId.getId()));
}
}
if (data.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_MAP_MATH.MATCHING_LANE_ID)) {
builder.setMatchingLaneID(data.getMatchingLaneId());
}
if (data.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_MAP_MATH.SPEED_MAX_LIMIT)) {
builder.setSpeedMaxLimit(data.getSpeedMaxLimit());
}
if (data.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_MAP_MATH.SPEED_MIN_LIMIT)) {
builder.setSpeedMinLimit(data.getSpeedMinLimit());
}
listener.onObuMapMath(builder.build());
}
}
};
private ObuBase.AccFourAxes.Builder getAccFourAxes(AccFourAxes accFourAxes) {
return ObuBase.AccFourAxes.newBuilder()
.setAccLng(accFourAxes.getAccLng())
.setAccLat(accFourAxes.getAccLat())
.setAccVert(accFourAxes.getAccVert())
.setAccYaw(accFourAxes.getAccYaw());
}
private ObuBase.VehicleSize.Builder getVehSize(VehSize vehSize) {
return ObuBase.VehicleSize.newBuilder()
.setWidth(vehSize.getWidth())
.setLength(vehSize.getLength())
.setHeight(vehSize.getHeight());
}
private ObuBase.VehicleBasics.Builder getVehBasics(VehBasics vehBasics) {
ObuBase.VehicleBasics.Builder builder = ObuBase.VehicleBasics.newBuilder();
builder.setUnitMask(vehBasics.getUnitMask());
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.ID)) {
builder.setId(vehBasics.getId());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.SEC_MARK)) {
builder.setSecMark(vehBasics.getSecMark());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.LATITUDE)) {
builder.setLatitude(vehBasics.getLatitude());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.LONGITUDE)) {
builder.setLongitude(vehBasics.getLongitude());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.ELEVATION)) {
builder.setElevation(vehBasics.getElevation());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.SPEED)) {
builder.setSpeed(vehBasics.getSpeed());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.HEADING)) {
builder.setHeading(vehBasics.getHeading());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.ACC_FOUR_AXES)) {
AccFourAxes accFourAxes = vehBasics.getAccFourAxes();
if (accFourAxes != null) {
builder.setAccFourAxes(getAccFourAxes(accFourAxes));
}
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.VEH_SIZE)) {
VehSize vehicleSize = vehBasics.getVehSize();
if (vehicleSize != null) {
builder.setVehSize(getVehSize(vehicleSize));
}
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.VEH_CLASS)) {
builder.setVehClass(vehBasics.getVehClass());
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.VEH_CONTROL_MSG)) {
VehControl vehControl = vehBasics.getVehControlMsg();
if (vehControl != null) {
ObuBase.VehicleControl.Builder vehicleControlBuilder = ObuBase.VehicleControl.newBuilder();
vehicleControlBuilder.setUnitMask(vehControl.getUnitMask());
if (vehControl.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_CONTROL.BRAKE_PEDAL_STATUS)) {
vehicleControlBuilder.setBrakePedalStatus(vehControl.getBrakePedalStatus());
}
if (vehControl.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_CONTROL.TRANSMISSION_STATUS)) {
vehicleControlBuilder.setTransmissionStatus(vehControl.getTransmissionStatus());
}
if (vehControl.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_CONTROL.EXTERIOR_LIGHTS)) {
vehicleControlBuilder.setExteriorLights(vehControl.getExteriorLights());
}
builder.setVehControlMsg(vehicleControlBuilder);
}
if (vehBasics.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_VEH_BASICS.TARGET_POSITION)) {
builder.setTargetPosition(vehBasics.getTargetPosition());
}
}
return builder;
}
private ObuBase.V2xWarning.Builder getV2xWarning(V2xWarning v2xWarning) {
ObuBase.V2xWarning.Builder builder = ObuBase.V2xWarning.newBuilder();
builder.setUnitMask(v2xWarning.getUnitMask());
if (v2xWarning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING.WARNING_DATA)) {
List<WarningData> list = v2xWarning.getWarningData();
if (list != null && !list.isEmpty()) {
for (WarningData warningData : list) {
ObuBase.WarningData.Builder warningDataBuilder = ObuBase.WarningData.newBuilder();
warningDataBuilder.setUnitMask(warningData.getUnitMask());
if (warningData.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING_DATA.STATUS)) {
warningDataBuilder.setStatus(warningData.getStatus());
}
if (warningData.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING_DATA.WARNING_TYPE)) {
warningDataBuilder.setWarningType(warningData.getWarningType());
}
if (warningData.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING_DATA.WARNING_LEVEL)) {
warningDataBuilder.setWarningLevel(warningData.getWarningLevel());
}
if (warningData.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING_DATA.WARNING_PRIORITY)) {
warningDataBuilder.setWarningPriority(warningData.getWarningPriority());
}
builder.addWarningData(warningDataBuilder);
}
}
}
if (v2xWarning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING.WARNING_TIME)) {
DateTime dateTime = v2xWarning.getWarningTime();
if (dateTime != null) {
builder.setWarningTime(ObuBase.DateTime.newBuilder()
.setYear(dateTime.getYear())
.setMonth(dateTime.getMonth())
.setDay(dateTime.getDay())
.setHour(dateTime.getHour())
.setMinute(dateTime.getMinute())
.setMillisecond(dateTime.getMillisecond())
.setOffset(dateTime.getOffset())
);
}
}
if (v2xWarning.has(MogoObuConstants.UNIT_MASK.MOGO_OBU_V2X_WARNING.DISTANCE)) {
builder.setDistance(v2xWarning.getDistance());
}
return builder;
}
/**
* RV数据转换为转工控机障碍物数据
* 赋值的包括uuid strUuid systemTime satelliteTime latitude longitude altitude speed heading tracked_source.source type
*
* @param rvWarningData OBU RV数据
* @return 工控机障碍物数据
*/
public MessagePad.TrackedObject obuRvToTrackedObject(ObuScene.RvWarningData rvWarningData) {
if (rvWarningData != null && rvWarningData.hasVehBasicsMsg()) {
ObuBase.VehicleBasics vehBasics = rvWarningData.getVehBasicsMsg();
MessagePad.TrackedObject.Builder trackedObjectBuilder = MessagePad.TrackedObject.newBuilder();
trackedObjectBuilder.setUuid(vehBasics.getId().hashCode());
trackedObjectBuilder.setStrUuid(vehBasics.getId());
double time = vehBasics.getSecMark() / 1000.0D;
trackedObjectBuilder.setSatelliteTime(time);
trackedObjectBuilder.setSystemTime(time);
trackedObjectBuilder.setLatitude(vehBasics.getLatitude());
trackedObjectBuilder.setLongitude(vehBasics.getLongitude());
trackedObjectBuilder.setAltitude(vehBasics.getElevation());
trackedObjectBuilder.setSpeed(vehBasics.getSpeed());
trackedObjectBuilder.setHeading(vehBasics.getHeading());
trackedObjectBuilder.addTrackedSource(MessagePad.TrackedSource.newBuilder().setSource(2));
/**
* 0 未知车辆
* 1 特殊用途车辆
* 10 乘用车类型default type
* 20 轻卡default type
* 25 卡车default type
* 27 卡车Two axle, six tire single units
* 28 卡车( Three axle, single units
* 29 卡车( Four or more axle, single unit
* 30 拖挂车Four or less axle, single trailer
* 31 拖挂车Four or less axle, single trailer
* 32 拖挂车Six or more axle, single trailer
* 33 多轴拖挂车( Five or less axle, multi-trailer
* 34 多轴拖挂车( Six axle, multi-trailer
* 35 多轴拖挂车Seven or more axle, multi-trailer
* 40 摩托车default type
* 42 摩托车motorcycle-Cruiser-Standard
* 43 摩托车motorcycle - Sport Unclad
* 44 摩托车motorcycle - Sport Touring
* 45 摩托车motorcycle - Super Sport
* 46 摩托车motorcycle-Touring
* 47 摩托车motorcycle-Trike
* 48 摩托车motorcycle - w Passengers
* 50 公交车( default type
* 52 公交车transit-BRT
* 53 公交车transit-ExpressBus
* 54 公交车transit-LocalBus
* 55 公交车transit-SchoolBus
* 56 公交车transit-FixedGuideway
* 57 公交车transit-Paratransit
* 58 公交车transit-Paratransit-Ambulance
* 60 紧急车辆default type
* 62 紧急车辆emergency-Fire-Light
* 63 紧急车辆emergency-Fire-Heavy
* 64 紧急车辆emergency-Fire-Paramedic
* 65 紧急车辆emergency-Fire-Ambulance
* 66 紧急车辆emergency-Police-Light
* 67 紧急车辆emergency-Police-Heavy
* 68 紧急车辆emergency-Other-Responder
* 69 紧急车辆emergency-Other-Ambulance
* 80 其他配备 V2X 的道路参与者default type
* 82 其他配备 V2X 的道路参与者otherTraveler-Pedestrian
* 83 其他配备 V2X 的道路参与者otherTraveler-Visually-Disabled
* 84 其他配备 V2X 的道路参与者otherTraveler-Physically-Disabled
* 85 其他配备 V2X 的道路参与者otherTraveler-Bicycle
* 86 其他配备 V2X 的道路参与者otherTraveler-Vulnerable-Roadworker
*/
int vehClass = vehBasics.getVehClass();
if (vehClass >= 20 && vehClass < 30) {//卡车 20 25 27 28 29
vehClass = 8;
} else if (vehClass >= 40 && vehClass < 50) {//摩托车 40 42 43 44 45 46 47 48
vehClass = 4;
} else if (vehClass >= 50 && vehClass < 60) {//公交车 50 52 53 54 55 56 57 58
vehClass = 6;
} else if (vehClass == 82) {//其他配备 V2X 的道路参与者otherTraveler-Pedestrian
vehClass = 1;
} else if (vehClass == 85) {//其他配备 V2X 的道路参与者otherTraveler-Bicycle
vehClass = 2;
} else {
vehClass = 3;
}
trackedObjectBuilder.setType(vehClass);
return trackedObjectBuilder.build();
}
return null;
}
}

View File

@@ -0,0 +1,70 @@
package com.zhidao.support.obu;
import com.mogo.support.obu.ObuScene;
import com.mogo.support.obu.constants.Define;
import mogo.telematics.pad.MessagePad;
public interface OnObuListener {
/**
* 连接状态
*
* @param connectStatus 连接状态
*/
void onConnectStatus(@Define.ConnectStatus int connectStatus);
/**
* HV车辆基础信息
*
* @param hvBasicsData 数据
*/
// void onObuHvBasics(ObuScene.HvBasicsData hvBasicsData);
/**
* HV车辆基础信息转工控机自车数据格式
*
* @param gnssInfo 数据
*/
void onGnssInfo(MessagePad.GnssInfo gnssInfo);
/**
* V2V预警信息
* OBU RV数据转工控机障碍物数据{@link ObuManager#obuRvToTrackedObject(ObuScene.RvWarningData)}
*
* @param rvWarningData 数据
*/
void onObuRvWarning(ObuScene.RvWarningData rvWarningData);
/**
* OBU 红绿灯预警信息
*
* @param spatWarningData 数据
*/
void onObuSpatWarning(ObuScene.SpatWarningData spatWarningData);
/**
* OBU RSI预警信息
*
* @param rsiWarningData 数据
*/
void onObuRsiWarning(ObuScene.RsiWarningData rsiWarningData);
/**
* OBU RSM预警信息
*
* @param rsmWarningData 数据
*/
void onObuRsmWarning(ObuScene.RsmWarningData rsmWarningData);
/**
* OBU 地图匹配结果
*
* @param mapMatchData 数据
*/
void onObuMapMath(ObuScene.MapMatchData mapMatchData);
}