Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into dev_arch_opt_3.0

This commit is contained in:
donghongyu
2022-12-26 14:29:43 +08:00
36 changed files with 360 additions and 327 deletions

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
@@ -20,6 +22,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateLi
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import org.jetbrains.annotations.NotNull;
@@ -96,9 +99,10 @@ public class MoGoHandAdasMsgManager implements
@Override
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
if (lightSwitch != null) {
int state = setTurnLightState(lightSwitch.getNumber());
CallerLogger.INSTANCE.d(M_DEVA + "TurnLight", "---onAutopilotLightSwitchData ---state = " + state + "---lightSwitch.getNumber() = " + lightSwitch.getNumber());
if (state == 1 || state == 2) {
isShowTurnLight = true;
CallerHmiManager.INSTANCE.showBrakeLight(0);
@@ -107,7 +111,7 @@ public class MoGoHandAdasMsgManager implements
}
CallerHmiManager.INSTANCE.showTurnLight(state);
}
}
// }
}
@@ -126,7 +130,7 @@ public class MoGoHandAdasMsgManager implements
@Override
public void onAutopilotCarStateData(@Nullable MessagePad.GnssInfo gnssInfo) {
//根据加速度判断 是否刹车
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
if (gnssInfo != null) {
//设置刹车信息
if (gnssInfo.getAcceleration() < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F)) {
@@ -134,10 +138,11 @@ public class MoGoHandAdasMsgManager implements
} else {
brakeLight = 0;
}
CallerLogger.INSTANCE.d(M_DEVA + "BrakeLight", "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.getAcceleration() + "-- brakeLight = " + brakeLight);
if (!isShowTurnLight) {
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
}
}
// }
}
}

View File

@@ -89,7 +89,7 @@ class MoFangManager private constructor() {
private val bluetoothMonitorReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态 TODO
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_STATE_CHANGED action = ${intent.action}")
}

View File

@@ -65,8 +65,8 @@ dependencies {
// implementation rootProject.ext.dependencies.crashSdk
implementation rootProject.ext.dependencies.boostmultidex
debugImplementation rootProject.ext.dependencies.debugleakcanary
releaseImplementation rootProject.ext.dependencies.releaseleakcanary
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler

View File

@@ -89,6 +89,7 @@ import com.mogo.eagle.core.function.main.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
@@ -1378,6 +1379,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
* 显示转向灯效果 if (HmiBuildConfig.isShowBadCaseView) {
*/
override fun showTurnLight(light: Int) {
CallerLogger.d("${SceneConstant.M_DEVA}${"TurnLight"}", "---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight")
if (HmiBuildConfig.isShowTurnLightView) {
ThreadUtils.runOnUiThread {
if (light == 1 || light == 2) {
@@ -1391,26 +1393,28 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
CallerVisualAngleManager.changeVisualAngle(Turning(false))
}
}
if (light == 1) {
if (light == 1) { //左转灯
if (!isLeftLight) {
isLeftLight = true
isRightLight = false
isDisappare = false
//TODO
CallerLogger.d("${SceneConstant.M_DEVA}${"TurnLight"}", "---showTurnLight ---light = 1")
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
}
} else if (light == 2) {
} else if (light == 2) { //右转灯
if (!isRightLight) {
isRightLight = true
isLeftLight = false
isDisappare = false
CallerLogger.d("${SceneConstant.M_DEVA}${"TurnLight"}", "---showTurnLight ---light = 2")
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
} else {
if (!isDisappare) {
if (!isDisappare) { //默认 不亮灯
isDisappare = true
isLeftLight = false
isRightLight = false
CallerLogger.d("${SceneConstant.M_DEVA}${"TurnLight"}", "---showTurnLight ---light other")
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
@@ -1433,11 +1437,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
if (light == 1) { //刹车灯亮
if (!isBrake) {
isBrake = true
CallerLogger.d("${SceneConstant.M_DEVA}${"BrakeLight"}", " showBrakeLight light = 1 ")
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(0, 500)
}
} else {
if (isBrake) {
if (isBrake) {//默认 不亮灯
isBrake = false
CallerLogger.d("${SceneConstant.M_DEVA}${"BrakeLight"}", " showBrakeLight light != 1 ")
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}

View File

@@ -201,8 +201,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
@Subscribe(threadMode = ThreadMode.MAIN)
fun notifyList(msgBoxList: MsgBoxBean){
badCaseList?.let {
it.remove(msgBoxList)
driverMsgBoxListAdapter?.notifyItemRemoved(it.indexOf(msgBoxList))
it.remove(msgBoxList)
}
}
}

View File

@@ -83,7 +83,6 @@ import com.zhidao.easysocket.utils.L
import com.zhjt.mogo_core_function_devatools.env.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import java.text.SimpleDateFormat
@@ -583,15 +582,15 @@ class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode.isChecked = FunctionBuildConfig.isDemoMode
// 演示模式
tbIsDemoMode.setOnCheckedChangeListener { _, isChecked ->
CallerHmiManager.updateStatusBarLeftView(isChecked, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(isChecked)
if (!isChecked) {
tbIsDemoMode.setOnCheckedChangeListener { _, _ ->
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(isChecked)
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
FunctionBuildConfig.isDemoMode = isChecked
tbIsDrawAutopilotTrajectoryData.isEnabled = !isChecked
tbIsDrawAutopilotTrajectoryData.isEnabled = !FunctionBuildConfig.isDemoMode
if (!FunctionBuildConfig.isDemoMode) {
tbIsDrawAutopilotTrajectoryData.isChecked = false
}
@@ -1833,6 +1832,13 @@ class DebugSettingView @JvmOverloads constructor(
mUnknownIdentifyDataSize = 0
mTrajectoryInfoSize = 0
mRouteInfoSize = 0
if(FunctionBuildConfig.isDemoMode){
tbIsDemoMode.text = "关闭美化模式"
}else{
tbIsDemoMode.text = "开启美化模式"
}
}
/**

View File

@@ -20,9 +20,11 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect
import java.util.*
/**
* SOP设置窗口
@@ -109,7 +111,6 @@ class SOPSettingView @JvmOverloads constructor(
tbObuV2vView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
HmiBuildConfig.isShowObuV2vView = isChecked
Log.d("liyz", "v2v isChecked = $isChecked")
}
/**
@@ -118,7 +119,15 @@ class SOPSettingView @JvmOverloads constructor(
tbObuV2iView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
HmiBuildConfig.isShowObuV2iView = isChecked
Log.d("liyz", "viv isChecked = $isChecked")
}
/**
* obu 数据通过dc 传输V2i事件 开关 TODO pm确定下开关功能 HmiBuildConfig.isShowObuToDcV2iView
*/
tbObuToDcView.setOnCheckedChangeListener { _, isChecked ->
//默认开启
HmiBuildConfig.isShowObuToDcV2iView = !isChecked
// Log.d("liyz", "HmiBuildConfig.isShowObuToDcV2iView = " + HmiBuildConfig.isShowObuToDcV2iView)
}
//红绿灯标识
@@ -146,14 +155,14 @@ class SOPSettingView @JvmOverloads constructor(
// 演示模式,上一次勾选的数据
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
// 演示模式
tbDemoMode.setOnCheckedChangeListener { _, isChecked ->
CallerHmiManager.updateStatusBarLeftView(isChecked, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(isChecked)
if (!isChecked) {
tbDemoMode.setOnCheckedChangeListener { _, _ ->
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(isChecked)
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
FunctionBuildConfig.isDemoMode = isChecked
}
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
@@ -239,12 +248,32 @@ class SOPSettingView @JvmOverloads constructor(
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(
FuncBizConfig.FOUNDATION, TAG, true, this
)
// 开启定时查询速度
Timer().schedule(timerTaskRefresh, Date(), 500)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 移除 业务配置监听
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(FuncBizConfig.FOUNDATION, TAG)
try {
timerTaskRefresh.cancel()
} catch (e: Exception) {
e.printStackTrace()
}
}
private val timerTaskRefresh = object : TimerTask(){
override fun run() {
UiThreadHandler.post{
if(FunctionBuildConfig.isDemoMode){
tbDemoMode.text = "关闭美化模式"
}else{
tbDemoMode.text = "开启美化模式"
}
}
}
}
override fun updateBizView(type: String, lock: Boolean) {

View File

@@ -230,22 +230,22 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME);
if (!isPressEnd) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent bluetoothName = " + bluetoothName);
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
}
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (!isPressEnd) {
isPressEnd = true;
startPressTime = System.currentTimeMillis();
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > 320 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
if ((pressADownTime - startPressTime) > 360 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 -2 ");
}
@@ -264,7 +264,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
if ((pressAUpTime - startPressTime) < 300 && isCombinationKey != 3) {
if ((pressAUpTime - startPressTime) < 350 && isCombinationKey != 3) {
isCombinationKey = 1;
if (isShowToast) {
ToastUtils.showShort("方块 单击A -1 ");
@@ -285,7 +285,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > 320 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
if ((pressBDownTime - startPressTime) > 360 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 ");
}
@@ -304,7 +304,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
if ((pressBUpTime - startPressTime) < 300 && isCombinationKey != 3) {
if ((pressBUpTime - startPressTime) < 350 && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ");
}
@@ -325,8 +325,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressCDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
if ((pressCDownTime - startPressTime) > 1320) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 ");
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ");
}
@@ -334,8 +334,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressCUpTime = System.currentTimeMillis();
isPressEnd = false;
if ((pressCUpTime - startPressTime) < 300) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 ");
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
if ((pressCUpTime - startPressTime) < 350) {
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
@@ -346,8 +346,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
if ((pressDDownTime - startPressTime) > 1320) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 ");
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ");
}
@@ -355,11 +355,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressDUpTime = System.currentTimeMillis();
isPressEnd = false;
if ((pressDUpTime - startPressTime) < 300) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
if ((pressDUpTime - startPressTime) < 350) {
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
@@ -367,11 +367,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressEDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
if ((pressEDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
@@ -387,11 +387,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressEUpTime = System.currentTimeMillis();
isPressEnd = false;
if ((pressEUpTime - startPressTime) < 300) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
if ((pressEUpTime - startPressTime) < 350) {
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击E 开启自动驾驶 ");
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}

View File

@@ -154,13 +154,25 @@
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbObuWeaknessTrafficSop"
android:id="@+id/tbObuToDcView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
app:layout_constraintTop_toBottomOf="@id/tbObuV2iView"
android:textOff="关闭OBU到工控机V2I显示"
android:textOn="打开OBU到工控机V2I显示"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbObuWeaknessTrafficSop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
app:layout_constraintTop_toBottomOf="@id/tbObuToDcView"
android:textOff="关闭路侧弱势群体预警"
android:textOn="打开路侧弱势群体预警"
android:textSize="@dimen/dp_24" />

View File

@@ -168,9 +168,6 @@ object TrafficMarkerDrawer {
TAG,
"drawObuRecognizedDataMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
// Log.d("liyz",
// "drawObuRecognizedDataMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
// )
if (trafficData.type != null) {
val resId: Int = trafficData.type.traffic3DIconId

View File

@@ -114,5 +114,12 @@ object HmiBuildConfig {
@Volatile
var isShowObuV2iView = false
/**
* 是否展示obu通过工控机展示的v2i
*/
@JvmField
@Volatile
var isShowObuToDcV2iView = true
}

View File

@@ -50,6 +50,8 @@ dependencies {
// MoGo 数据埋点工具
implementation rootProject.ext.dependencies.analytics
compileOnly rootProject.ext.dependencies.mogocustommap
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -9,7 +9,6 @@ import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import com.mogo.cloud.commons.utils.CoordinateUtils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
@@ -20,6 +19,7 @@ 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
@@ -63,42 +63,43 @@ object CallerVisualAngleManager {
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
}
private val beginLocation = AtomicReference<MogoLocation>()
private val triggerLocation = AtomicReference<MogoLocation>()
private val distanceOfCarToStopLine = AtomicReference<Double>()
private val distanceOfCarToStopLine = AtomicReference(0.0)
private val travelled by lazy { AtomicReference(0.0) }
private val listener = object : OnRoadListener {
private var roadId = ""
private val roadId = AtomicReference<String>()
private val triggerRoadId = AtomicReference<String>()
override fun onRoadIdInfo(roadId: String) {
val oldRoadId = this.roadId
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.roadId} -> curr: $roadId")
val startLoc = beginLocation.get()
val currLoc = CallerMapLocationListenerManager.getCurrentLocation()
this.roadId.set(roadId)
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.triggerRoadId.get()} -> curr: $roadId")
val loc = CallerMapLocationListenerManager.getCurrentLocation()
var triggerClose = false
val distance = distanceOfCarToStopLine.get()
if (hasCrossRoad && distance > 0 && oldRoadId != roadId && startLoc != null && currLoc != null && CoordinateUtils.calculateLineDistance(startLoc.longitude, startLoc.latitude, currLoc.longitude, currLoc.latitude).also {
Log.d(TAG, "d1: $it, d2: $distance")
} >= distance) {
distanceOfCarToStopLine.set(0.0)
hasCrossRoad = false
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
triggerClose = true
}
if (!triggerClose && hasCrossRoad && oldRoadId == roadId) {
val beginLoc = beginLocation.get()
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
Log.d(TAG, "-- onRoadIdInfo --: trigger close 2 --")
triggerClose = true
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
beginLocation.set(null)
triggerRoadId.set(null)
travelled.set(0.0)
triggerLocation.set(null)
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
triggerClose = true
}
}
if (triggerClose) {
changeVisualAngle(CrossRoad(false))
}
this.roadId = roadId
}
@@ -106,8 +107,9 @@ object CallerVisualAngleManager {
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
hasCrossRoad = true
triggerRoadId.set(this.roadId.get())
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
beginLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
triggerLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
changeVisualAngle(CrossRoad(true))
}
}
@@ -236,12 +238,11 @@ object CallerVisualAngleManager {
}
}
private val heap by lazy {
private val queue by lazy {
PriorityQueue<Record>()
}
@OptIn(InternalCoroutinesApi::class)
fun changeVisualAngle(scene: Scene) {
fun changeVisualAngle(current: Scene) {
val appIdentityMode = FunctionBuildConfig.appIdentityMode
if (AppIdentityModeUtils.isBus(appIdentityMode) && AppIdentityModeUtils.isPassenger(appIdentityMode)) {
return
@@ -252,87 +253,87 @@ object CallerVisualAngleManager {
val displayed = getDisplayed()
if (displayed == null) {
Log.d("${M_DEVA}${TAG}", "--- 2 ---")
val top = getTop() //堆顶
if (top != null) {
if (top.target.priority >= scene.priority) {
Log.d("${M_DEVA}${TAG}", "--- 3 ---")
top.triggerTime = triggerTime
doChangeAngle(top)
synchronized(heap){
heap += Record(scene, triggerTime = -1)
}
} else {
Log.d("${M_DEVA}${TAG}", "--- 4 ---")
doChangeAngle(Record(scene, triggerTime = triggerTime))
if (current is Turning) {
if (!current.open) {
changeVisualAngle(Default())
return@launch
}
} else {
Log.d("${M_DEVA}${TAG}", "--- 5 ---")
doChangeAngle(Record(scene, triggerTime = triggerTime))
}
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}", "--- 6 --- old: $prev -> cur: $scene")
Log.d("${M_DEVA}${TAG}", "--- 3 --- old: $prev -> cur: $current")
val prevTriggerTime = displayed.triggerTime
if (scene !is Default && prev.priority >= scene.priority && (prev is RoadEvent || prev is TooClose)) {
if (current !is Default && prev.priority > current.priority && (prev is RoadEvent || prev is TooClose)) {
val displayDuration = triggerTime - prevTriggerTime
Log.d("${M_DEVA}${TAG}", "--- 7 ---:duration: $displayDuration")
Log.d("${M_DEVA}${TAG}", "--- 4 ---:场景[$prev], 已展示时长: duration: $displayDuration")
if (displayDuration < prev.displayThreshold) {
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $scene")
Log.d("${M_DEVA}${TAG}", "--- 5 --- 场景[$prev]:仍在保护展示时长内直接return")
return@launch
}
}
if (prev.priority > scene.priority) {
Log.d("${M_DEVA}${TAG}", "--- 9 --- old: $prev -> cur: $scene")
if (prev.displayThreshold < 0) {
return@launch
}
}
if (scene is Turning) {
val isOpen = scene.open
if (prev is Turning && current is Turning) {
val isOpen = current.open
if (!isOpen) {
Log.d("${M_DEVA}${TAG}", "--- 10 --- old: $prev -> cur: $scene")
Log.d("${M_DEVA}${TAG}", "--- 7 --- 场景[$current], 收到关闭通知")
queue -= displayed
changeVisualAngle(Default())
heap -= displayed
return@launch
}
}
if (scene is CrossRoad) {
val isOpen = scene.open
if (prev is CrossRoad && current is CrossRoad) {
val isOpen = current.open
if (!isOpen) {
Log.d("${M_DEVA}${TAG}", "--- 11 --- old: $prev -> cur: $scene")
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $current")
queue -= displayed
changeVisualAngle(Default())
heap -= displayed
return@launch
}
}
if (scene is Default) {
Log.d("${M_DEVA}${TAG}", "--- 12 ---")
defaultDelayJob?.safeCancel()
launch {
val delay = scene.unit.toMillis(scene.delay)
Log.d("${M_DEVA}${TAG}", "--- 13 ---")
delay(delay)
Log.d("${M_DEVA}${TAG}", "--- 14 ---")
doChangeAngle(Record(scene, triggerTime = triggerTime))
heap -= displayed
}.also { itx ->
itx.invokeOnCompletion {
if (it is CancellationException) {
Log.d("${M_DEVA}${TAG}", "--- 15 ---")
}
}
defaultDelayJob = itx
}
} else {
Log.d("${M_DEVA}${TAG}", "--- 16 ---")
defaultDelayJob?.safeCancel()
if (displayed.target.priority < scene.priority) {
Log.d("${M_DEVA}${TAG}", "--- 17 ---")
doChangeAngle(Record(scene, triggerTime = triggerTime))
if (prev.priority > current.priority && prev.displayThreshold < 0) {
Log.d("${M_DEVA}${TAG}", "--- 6 --- 场景[$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 ---")
defaultDelayJob?.safeCancel()
launch {
val delay = target.unit.toMillis(target.delay)
Log.d("${M_DEVA}${TAG}", "--- doRealVisualAngleChange --- 2 ---")
delay(delay)
displayed?.also {
queue -= it
}
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 ---")
queue -= displayed
doChangeAngle(Record(target, triggerTime = triggerTime))
}
}
}
@@ -344,8 +345,8 @@ object CallerVisualAngleManager {
Log.d("${M_DEVA}${TAG}", "--- doChangeAngle --- ${record.target}")
if (record.target !is Default) {
record.isDisplay = true
synchronized(heap) {
heap += record
synchronized(queue) {
queue += record
}
}
it.changeMapVisualAngle(angle, null)
@@ -356,8 +357,6 @@ object CallerVisualAngleManager {
* 是否有正在展示的
*/
@Synchronized
private fun getDisplayed() = heap.find { it.isDisplay }
private fun getDisplayed() = queue.firstOrNull()
@Synchronized
private fun getTop() = heap.firstOrNull()
}