Merge branch 'dev_robotaxi-d_240401_6.4.0' into dev_robotaxi-d_240401_6.4.0_yyk

# Conflicts:
#	app/script/vehicleFlavors/C1.gradle
This commit is contained in:
yangyakun
2024-04-15 14:54:13 +08:00
82 changed files with 1803 additions and 968 deletions

View File

@@ -22,7 +22,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_28" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28" android:layout_height="@dimen/dp_28"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_40" android:layout_marginStart="@dimen/dp_40"

View File

@@ -10,7 +10,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_28" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28" android:layout_height="@dimen/dp_28"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -54,7 +54,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_34" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_34" android:layout_height="@dimen/dp_34"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -22,7 +22,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_28" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28" android:layout_height="@dimen/dp_28"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -10,7 +10,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_28" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28" android:layout_height="@dimen/dp_28"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -20,7 +20,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_54" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_54" android:layout_height="@dimen/dp_54"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal" app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal"

View File

@@ -20,7 +20,7 @@
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView" android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_54" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_54" android:layout_height="@dimen/dp_54"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal" app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal"

View File

@@ -16,7 +16,7 @@ project.android.productFlavors {
// ②构建的是否要动态更换模型 // ②构建的是否要动态更换模型
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true' buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true'
// ③能启动自驾的档位 // ③能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}' buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_D);}}'
} }
} }

View File

@@ -23,7 +23,7 @@ project.android.productFlavors {
// ②构建的是否要动态更换模型 // ②构建的是否要动态更换模型
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'false' buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'false'
// ③M2能启动自驾的档位 // ③M2能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}' buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_D);}}'
} }
} }

View File

@@ -16,9 +16,8 @@ project.android.productFlavors {
// ②构建的是否要动态更换模型 // ②构建的是否要动态更换模型
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true' buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true'
// ③能启动自驾的档位 // ③能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null' buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'LAUNCH_AUTOPILOT_GEAR', 'null'
// ⑤清扫车 默认模式(运营/云控) // ⑤清扫车 默认模式(运营/云控)
buildConfigField 'String', 'SWEEPER_DEFAULT_MODE', '\"Cloud\"' buildConfigField 'String', 'SWEEPER_DEFAULT_MODE', '\"Cloud\"'

View File

@@ -13,9 +13,8 @@ project.android.productFlavors {
// ①标识构建的应用身份类型,具体查看 README.md APP_IDENTITY_MODE规则 // ①标识构建的应用身份类型,具体查看 README.md APP_IDENTITY_MODE规则
buildConfigField 'String', 'APP_IDENTITY_MODE_TAIL', "\"M1\"" buildConfigField 'String', 'APP_IDENTITY_MODE_TAIL', "\"M1\""
// ②构建的是否要动态更换模型 // ②M1能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null' buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_D);}}'
// ③不能启动自驾的档位 // ③不能启动自驾的档位
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'false' buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'false'

View File

@@ -17,8 +17,8 @@ project.android.productFlavors {
// ②构建的是否要动态更换模型 // ②构建的是否要动态更换模型
buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true' buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true'
// ③能启动自驾的档位 // ③能启动自驾的档位 MAP<360代码中会移除P档
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}' buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_D);add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_P);}}'
} }

View File

@@ -481,69 +481,119 @@ public class ViewPressedStateLancet {
text.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); text.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
return true; return true;
} }
ColorStateList textColor = text.getTextColors(); ColorStateList textColor = text.getTextColors();
if (textColor != null) { if (textColor != null) {
int current = text.getCurrentTextColor(); int defaultColor = textColor.getDefaultColor();
int pressed = textColor.getColorForState(new int[]{ android.R.attr.state_pressed }, Integer.MIN_VALUE); int pressedColor = Color.argb((int)(Color.alpha(defaultColor) * alpha), Color.red(defaultColor), Color.green(defaultColor), Color.blue(defaultColor));
if (pressed != Integer.MIN_VALUE && pressed != current) { if (!textColor.isStateful()) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- isStateful() => false hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- isStateful() => false hit ---" + "["+text+"]");
}*/
int[][] states = new int[2][1];
int[] colors = new int[2];
states[0] = new int[] { android.R.attr.state_pressed, -android.R.attr.state_focused, -android.R.attr.state_active };
colors[0] = pressedColor;
states[1] = StateSet.WILD_CARD;
colors[1] = defaultColor;
ColorStateList newColor = new ColorStateList(states, colors);
text.setTag(R.id.click_pressed_attr_replaced_color, textColor);
text.setTextColor(newColor);
return true;
}
int pressed = textColor.getColorForState(new int[] { android.R.attr.state_pressed }, Integer.MIN_VALUE);
if (pressed != Integer.MIN_VALUE && pressed != defaultColor) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- pressed hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- pressed hit ---" + "["+text+"]");
}*/
return false; return false;
} }
int enableColor = textColor.getColorForState(new int[] { android.R.attr.state_enabled }, Integer.MIN_VALUE); int disabledColor = textColor.getColorForState(new int[] { -android.R.attr.state_enabled }, Integer.MIN_VALUE);
int defaultColor = current;
if (enableColor == Integer.MIN_VALUE && enableColor != current) {
defaultColor = textColor.getDefaultColor();
}
int pressedColor = Color.argb((int)(Color.alpha(defaultColor) * alpha), Color.red(defaultColor), Color.green(defaultColor), Color.blue(defaultColor));
int disableColor = textColor.getColorForState(new int[] { -android.R.attr.state_enabled }, Integer.MIN_VALUE);
int size = 2;
if (disableColor != Integer.MIN_VALUE && disableColor != current) {
size += 1;
}
boolean hasChecked = false;
int checkedColor = textColor.getColorForState(new int[] { android.R.attr.state_checked }, Integer.MIN_VALUE); int checkedColor = textColor.getColorForState(new int[] { android.R.attr.state_checked }, Integer.MIN_VALUE);
if (checkedColor != Integer.MIN_VALUE && checkedColor != current) { int unCheckedColor = textColor.getColorForState(new int[] { -android.R.attr.state_checked }, Integer.MIN_VALUE);
hasChecked = true; int selectedColor = textColor.getColorForState(new int[] { android.R.attr.state_enabled }, Integer.MIN_VALUE);
size += 1; int unSelectedColor = textColor.getColorForState(new int[] { -android.R.attr.state_selected }, Integer.MIN_VALUE);
int size = 2;
if (disabledColor != Integer.MIN_VALUE && disabledColor != defaultColor) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- disabled hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- disabled hit ---" + "["+text+"]");
}*/
size++;
} }
boolean hasUnChecked = false; if (checkedColor != Integer.MIN_VALUE && checkedColor != defaultColor) {
int unCheckedColor = textColor.getColorForState(new int[]{ -android.R.attr.state_checked }, Integer.MIN_VALUE); /*if (text.getId() != View.NO_ID) {
if (unCheckedColor != Integer.MIN_VALUE && unCheckedColor != current) { Log.d("ViewPressedStateLancet", "---- checked hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
hasUnChecked = true; } else {
size += 1; Log.d("ViewPressedStateLancet", "---- checked hit ---" + "["+text+"]");
}*/
size++;
}
if (unCheckedColor != Integer.MIN_VALUE && unCheckedColor != defaultColor) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- unchecked hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- unchecked hit ---" + "["+text+"]");
}*/
size++;
}
if (selectedColor != Integer.MIN_VALUE && selectedColor != defaultColor) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- selected hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- selected hit ---" + "["+text+"]");
}*/
size++;
}
if (unSelectedColor != Integer.MIN_VALUE && unSelectedColor != defaultColor) {
/*if (text.getId() != View.NO_ID) {
Log.d("ViewPressedStateLancet", "---- unselected hit ---" + "["+text+"->"+text.getResources().getResourceName(text.getId())+"]");
} else {
Log.d("ViewPressedStateLancet", "---- unselected hit ---" + "["+text+"]");
}*/
size++;
} }
int[][] states = new int[size][1]; int[][] states = new int[size][1];
int[] colors = new int[size]; int[] colors = new int[size];
states[0] = new int[] { android.R.attr.state_pressed, -android.R.attr.state_focused, -android.R.attr.state_active }; states[0] = new int[] { android.R.attr.state_pressed };
colors[0] = pressedColor; colors[0] = pressedColor;
if (size > 2) { int index = 1;
states[1] = new int[] { -android.R.attr.state_enabled }; if (disabledColor != Integer.MIN_VALUE && disabledColor != defaultColor) {
colors[1] = disableColor; states[index] = new int[] { -android.R.attr.state_enabled };
states[2] = new int[] { android.R.attr.state_enabled }; colors[index] = disabledColor;
colors[2] = defaultColor; index++;
if (hasChecked) {
states[3] = new int[] { android.R.attr.state_checked };
colors[3] = checkedColor;
}
if (hasUnChecked) {
if (size > 4) {
states[4] = new int[] { -android.R.attr.state_checked };
colors[4] = unCheckedColor;
} else {
states[3] = new int[] { -android.R.attr.state_checked };
colors[3] = unCheckedColor;
}
}
} else {
states[1] = StateSet.WILD_CARD;
colors[1] = defaultColor;
} }
if (checkedColor != Integer.MIN_VALUE && checkedColor != defaultColor) {
states[index] = new int[] { android.R.attr.state_checked };
colors[index] = checkedColor;
index++;
}
if (unCheckedColor != Integer.MIN_VALUE && unCheckedColor != defaultColor) {
states[index] = new int[] { -android.R.attr.state_checked };
colors[index] = unCheckedColor;
index++;
}
if (selectedColor != Integer.MIN_VALUE && selectedColor != defaultColor) {
states[index] = new int[] { android.R.attr.state_selected };
colors[index] = selectedColor;
index++;
}
if (unSelectedColor != Integer.MIN_VALUE && unSelectedColor != defaultColor) {
states[index] = new int[] { -android.R.attr.state_selected };
colors[index] = unSelectedColor;
index++;
}
states[index] = StateSet.WILD_CARD;
colors[index] = defaultColor;
ColorStateList newColor = new ColorStateList(states, colors); ColorStateList newColor = new ColorStateList(states, colors);
text.setTag(R.id.click_pressed_attr_replaced_color, textColor); text.setTag(R.id.click_pressed_attr_replaced_color, textColor);
text.setTextColor(newColor); text.setTextColor(newColor);
return true; return true;
} }
return false; return false;
} }
if (view != null) { if (view != null) {

View File

@@ -51,7 +51,7 @@ object ConfigStartUp {
// 各个module需要的url // 各个module需要的url
FunctionBuildConfig.urlJson = GsonUtils.fromJson(BuildConfig.URLs, UrlConfig::class.java) FunctionBuildConfig.urlJson = GsonUtils.fromJson(BuildConfig.URLs, UrlConfig::class.java)
//不能启动自动驾驶的档位 //不能启动自动驾驶的档位
FunctionBuildConfig.unableLaunchAutopilotGear = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR FunctionBuildConfig.launchAutopilotGear = BuildConfig.LAUNCH_AUTOPILOT_GEAR
// 各车型宣传视频本地配置json // 各车型宣传视频本地配置json
FunctionBuildConfig.mediaUrlConfig = BuildConfig.mediaUrlConfig FunctionBuildConfig.mediaUrlConfig = BuildConfig.mediaUrlConfig
FunctionBuildConfig.musicUrlConfig = BuildConfig.musicUrlConfig FunctionBuildConfig.musicUrlConfig = BuildConfig.musicUrlConfig

View File

@@ -225,7 +225,7 @@ ext {
btrace : "com.bytedance.btrace:rhea-core:2.0.0", btrace : "com.bytedance.btrace:rhea-core:2.0.0",
mofang_runtime : "com.mogo.eagle.core.mofang:runtime:2.0.11", mofang_runtime : "com.mogo.eagle.core.mofang:runtime:2.0.11",
log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.50", log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.80",
// 安全证书 // 安全证书
passport_secret : "com.zhidaoauto:sdk-java:1.0.6-SNAPSHOT", passport_secret : "com.zhidaoauto:sdk-java:1.0.6-SNAPSHOT",

View File

@@ -129,10 +129,10 @@ class MoGoAutopilotControlProvider :
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING) .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList) .setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false) .setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF()) .setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear) .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)// // .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build() .build()
@@ -228,7 +228,7 @@ class MoGoAutopilotControlProvider :
val options = AdasOptions val options = AdasOptions
.newBuilder() .newBuilder()
.setPassenger(true) .setPassenger(true)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear) .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build() .build()
AdasManager.getInstance() AdasManager.getInstance()
.create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl()) .create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl())
@@ -260,10 +260,10 @@ class MoGoAutopilotControlProvider :
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING) .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList) .setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)// 乘客端直连工控机改为false .setPassenger(false)// 乘客端直连工控机改为false
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF()) .setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear) .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build() .build()
AdasManager.getInstance().create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl()) AdasManager.getInstance().create(mContext, options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听///////////////////////////////////////////// //////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
@@ -321,9 +321,9 @@ class MoGoAutopilotControlProvider :
// 设置IP地址 // 设置IP地址
val options = AdasOptions.newBuilder() val options = AdasOptions.newBuilder()
.setPassenger(false) .setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtF()) .setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED) .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED)
.setSpecifiedAddress(autoPilotIp) .setSpecifiedAddress(autoPilotIp)
.build() .build()
@@ -988,7 +988,7 @@ class MoGoAutopilotControlProvider :
* @param resultCode 上报字段code * @param resultCode 上报字段code
*/ */
override fun getReportResultDesc(resultCode: String): String { override fun getReportResultDesc(resultCode: String): String {
return MogoReport.Result.getDesc(resultCode) return MogoReport.ResultDesc.getDesc(resultCode)
} }
/** /**
@@ -996,7 +996,7 @@ class MoGoAutopilotControlProvider :
* @param actionCode 上报字段code * @param actionCode 上报字段code
*/ */
override fun getReportActionDesc(actionCode: String): String { override fun getReportActionDesc(actionCode: String): String {
return MogoReport.Action.getDesc(actionCode) return MogoReport.ActionDesc.getDesc(actionCode)
} }
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) { override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.datacenter.autopilot.adapter package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import bag_manager.BagManagerOuterClass import bag_manager.BagManagerOuterClass
import chassis.Chassis
import chassis.ChassisStatesOuterClass import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.app.AppConfigInfo
@@ -169,7 +170,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
) { ) {
if (vehicleState != null) { if (vehicleState != null) {
//转向灯数据 //转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) // CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据 //刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据 //方向盘转向角数据
@@ -231,10 +232,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
) { ) {
if (chassisStates != null) { if (chassisStates != null) {
chassisStates.bcmSystemStates?.let { bcmSystemStates -> chassisStates.bcmSystemStates?.let { bcmSystemStates ->
bcmSystemStates.turnLightState?.let { // bcmSystemStates.turnLightState?.let {
//转向灯数据 // //转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(it) // CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(it)
} // }
//刹车灯数据 //刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0) CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0)
} }
@@ -277,6 +278,19 @@ class MoGoAdasListenerImpl : OnAdasListener {
} }
} }
/**
* 底盘车灯状态 转换过的可以直接使用
* 例如:
* 原始右转数据: 0 2 0 2 0 2。。。
* 转换之后数据: 2 2 2 2 2 2。。。
*
* @param light 车灯 目前域控发送车灯有 左传{@link Chassis.LightSwitch#LIGHT_LEFT} 右转{@link Chassis.LightSwitch#LIGHT_RIGHT} 危险报警灯{@link Chassis.LightSwitch#LIGHT_FLASH}
*/
override fun onLightSwitch(light: Chassis.LightSwitch) {
//转向灯数据
CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(light)
}
//自动驾驶状态 //自动驾驶状态
@ChainLog( @ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT, linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -59,13 +60,14 @@ class MoGoAdasMsgConnectStatusListenerImpl :
private val isSentBasicInfoReq = AtomicBoolean(false)//是否已回复域控基础信息请求 private val isSentBasicInfoReq = AtomicBoolean(false)//是否已回复域控基础信息请求
@Volatile @Volatile
private var certificationResult = "" private var certificationResult = "未开启认证"
init { init {
CallerCloudListenerManager.addListener(TAG, this) CallerCloudListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED)
CallerParallelDrivingActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) CallerParallelDrivingActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED)
CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult)
} }
private fun connectToast(reason: String) { private fun connectToast(reason: String) {
@@ -249,7 +251,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
*/ */
override fun onCertification(status: AdasConstants.CertificationStatus) { override fun onCertification(status: AdasConstants.CertificationStatus) {
if (status == AdasConstants.CertificationStatus.TIMEOUT) { if (status == AdasConstants.CertificationStatus.TIMEOUT) {
certificationResult = ":认证超时"; certificationResult = "证书认证超时"
CallerLogger.d( CallerLogger.d(
"$M_D_C$TAG", "$M_D_C$TAG",
"域控证书认证超时表示域控未发送BasicInfoReq接口的数据【这种情况可能是连接出现了问题】" "域控证书认证超时表示域控未发送BasicInfoReq接口的数据【这种情况可能是连接出现了问题】"
@@ -257,24 +259,25 @@ class MoGoAdasMsgConnectStatusListenerImpl :
} else { } else {
if (status != AdasConstants.CertificationStatus.NOT_ENABLED) { if (status != AdasConstants.CertificationStatus.NOT_ENABLED) {
if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_SUCCESS) { if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_SUCCESS) {
certificationResult = ":成功校验域控证书"
CallerLogger.d( CallerLogger.d(
"$M_D_C$TAG", "$M_D_C$TAG",
"域控证书链校验成功" "成功校验域控证书"
) )
} else if (status == AdasConstants.CertificationStatus.ROOT_CRT_ERROR) { } else if (status == AdasConstants.CertificationStatus.ROOT_CRT_ERROR) {
certificationResult = "ROOT证书异常"; certificationResult = "获取ROOT证书异常"
CallerLogger.d( CallerLogger.d(
"$M_D_C$TAG", "$M_D_C$TAG",
"ROOT证书异常表示未传递证书没有拿到ROOT证书" "ROOT证书异常表示未传递证书没有拿到ROOT证书"
) )
} else if (status == AdasConstants.CertificationStatus.IPC_CRT_ERROR) { } else if (status == AdasConstants.CertificationStatus.IPC_CRT_ERROR) {
certificationResult = ":域控证书异常"; certificationResult = "获取域控证书异常"
CallerLogger.d( CallerLogger.d(
"$M_D_C$TAG", "$M_D_C$TAG",
"域控证书异常表示域控发送了BasicInfoReq接口的数据但是未传递证书或证书解码失败【失败的可能性很低】" "域控证书异常表示域控发送了BasicInfoReq接口的数据但是未传递证书或证书解码失败【失败的可能性很低】"
) )
} else if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_FAILED) { } else if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_FAILED) {
certificationResult = ":证书校验失败"; certificationResult = "域控证书校验失败"
CallerLogger.d( CallerLogger.d(
"$M_D_C$TAG", "$M_D_C$TAG",
"域控证书链校验失败(表示证书链未验证通过。证书不匹配、证书格式不正确)" "域控证书链校验失败(表示证书链未验证通过。证书不匹配、证书格式不正确)"
@@ -282,6 +285,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
} }
} }
} }
CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult)
} }
private fun saveIntoMsgBox( private fun saveIntoMsgBox(
@@ -341,7 +345,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
* 工控机获取SN * 工控机获取SN
*/ */
override fun onAutopilotSNRequest(basicInfoReq: MessagePad.BasicInfoReq) { override fun onAutopilotSNRequest(basicInfoReq: MessagePad.BasicInfoReq) {
CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求"); CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求")
isReceivedBasicInfoReq.set(true) isReceivedBasicInfoReq.set(true)
if (!TextUtils.isEmpty(SharedPrefsMgr.getInstance().sn)) { if (!TextUtils.isEmpty(SharedPrefsMgr.getInstance().sn)) {
syncBasicInfoToAutopilot() syncBasicInfoToAutopilot()
@@ -396,7 +400,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
} }
override fun tokenGot(token: String, sn: String) { override fun tokenGot(token: String, sn: String) {
CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn"); CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn")
if (isReceivedBasicInfoReq.get() && !isSentBasicInfoReq.get()) {//已收到域控基础信息请求但是之前SN没有所以还未回复现在获取到SN后再进行回复 if (isReceivedBasicInfoReq.get() && !isSentBasicInfoReq.get()) {//已收到域控基础信息请求但是之前SN没有所以还未回复现在获取到SN后再进行回复
syncBasicInfoToAutopilot() syncBasicInfoToAutopilot()
} }

View File

@@ -130,6 +130,9 @@ object DataManager {
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg) CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
} }
MsgBoxType.FMINFO -> { MsgBoxType.FMINFO -> {
synchronized(this) {
fmInfoList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.FM_INFO, msg) CallerMsgBoxListenerManager.invokeListener(MsgCategory.FM_INFO, msg)
} }
MsgBoxType.VOICE -> { MsgBoxType.VOICE -> {
@@ -250,7 +253,7 @@ object DataManager {
} }
} }
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = private suspend fun getCacheMessages(context: Context): List<MsgBoxBean?> =
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
delay(2000) delay(2000)
return@withContext MsgBoxDb.getDb(context) return@withContext MsgBoxDb.getDb(context)
@@ -326,7 +329,7 @@ object DataManager {
} }
} }
else -> { else -> {
return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg()) return@map null
} }
} }
} }
@@ -368,6 +371,13 @@ object DataManager {
recordBagList.clear() recordBagList.clear()
} }
if (fmInfoList.isNotEmpty()) {
fmInfoList.forEach {
msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp))
}
fmInfoList.clear()
}
if (msgInfoList.isNotEmpty()) { if (msgInfoList.isNotEmpty()) {
MsgBoxDb.getDb(context) MsgBoxDb.getDb(context)
.monitorDao() .monitorDao()
@@ -387,4 +397,14 @@ object DataManager {
} }
} }
} }
fun queryFMInfoList(context: Context, startTime: Long, endTime: Long): List<MsgBoxBean> {
return MsgBoxDb.getDb(context).monitorDao()
.getFMInfoList(MsgBoxType.FMINFO.ordinal, startTime, endTime)
.map { boxInfo ->
MsgBoxBean(MsgBoxType.FMINFO, GsonUtils.fromJson(boxInfo.bean2Json, FMInfoMsg::class.java)).apply {
timestamp = boxInfo.timeStamp
}
}
}
} }

View File

@@ -50,6 +50,14 @@ class MsgBoxProvider : IMsgBoxProvider {
return DataManager.getRecordBagData() return DataManager.getRecordBagData()
} }
override fun queryFMInfoList(
context: Context,
startTime: Long,
endTime: Long
): List<MsgBoxBean> {
return DataManager.queryFMInfoList(context, startTime, endTime)
}
override fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String) { override fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String) {
DataManager.removeRecordInfo(key, key) DataManager.removeRecordInfo(key, key)
DataManager.delMsgBoxBean(context, msgBoxBean) DataManager.delMsgBoxBean(context, msgBoxBean)

View File

@@ -16,6 +16,9 @@ interface MsgBoxDao {
@Query("SELECT * FROM t_msg_box") @Query("SELECT * FROM t_msg_box")
fun getAllCachedMessages(): List<MsgBoxInfo> fun getAllCachedMessages(): List<MsgBoxInfo>
@Query("SELECT * FROM t_msg_box WHERE json_obj_type == (:fmType) AND time_stamp >= (:startTime) AND time_stamp <= (:endTime)")
fun getFMInfoList(fmType: Int, startTime: Long, endTime: Long): List<MsgBoxInfo>
@Query("DELETE FROM t_msg_box") @Query("DELETE FROM t_msg_box")
fun deleteMsgTable() fun deleteMsgTable()
} }

View File

@@ -4,6 +4,7 @@ import android.Manifest
import android.content.* import android.content.*
import android.content.pm.PackageManager.PERMISSION_GRANTED import android.content.pm.PackageManager.PERMISSION_GRANTED
import android.os.Build import android.os.Build
import android.os.Environment
import android.os.Process import android.os.Process
import android.os.SystemClock import android.os.SystemClock
import android.util.Log import android.util.Log
@@ -14,10 +15,13 @@ import com.mogo.commons.AbsMogoApplication
import com.mogo.core.log.record.* import com.mogo.core.log.record.*
import com.mogo.core.log.record.config.* import com.mogo.core.log.record.config.*
import com.mogo.core.log.record.config.crash.CrashConfig import com.mogo.core.log.record.config.crash.CrashConfig
import com.mogo.core.log.record.config.extra.IExtraFileToUpload
import com.mogo.core.log.record.config.extra.ToUploadFile
import com.mogo.core.log.record.config.state.IStateProvider import com.mogo.core.log.record.config.state.IStateProvider
import com.mogo.core.log.record.model.UploadError import com.mogo.core.log.record.model.UploadError
import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.devatools.logcat.* import com.mogo.eagle.core.function.api.devatools.logcat.*
import com.mogo.eagle.core.utilcode.download.DownloadUtils
import com.zhidao.loglib.bean.RemoteLogPushContent import com.zhidao.loglib.bean.RemoteLogPushContent
import com.zhjt.mogo_core_function_devatools.BuildConfig import com.zhjt.mogo_core_function_devatools.BuildConfig
import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker
@@ -25,6 +29,7 @@ import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
import com.zhjt.mogo_core_function_devatools.logcat.uploader.* import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
import kotlinx.coroutines.* import kotlinx.coroutines.*
import java.io.* import java.io.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeUnit.MINUTES import java.util.concurrent.TimeUnit.MINUTES
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.AtomicLong
@@ -45,13 +50,12 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
private val lastUploadTime by lazy { AtomicLong(0) } private val lastUploadTime by lazy { AtomicLong(0) }
override fun init(context: Context) { override fun init(context: Context) {
val zip = File(context.getExternalFilesDir(null), "logcat/zip")
val builder = LogcatConfig.Builder().context(context) val builder = LogcatConfig.Builder().context(context)
.recordPeriod(MINUTES.toMillis(5)) // 5分钟一个文件 .recordPeriod(MINUTES.toMillis(5)) // 5分钟一个文件
.maxSizeInLogDir((512 * 1024 * 1024).toLong()) // 512M最大容量 .maxSizeInLogDir((512 * 1024 * 1024).toLong()) // 512M最大容量
.recordDir(File(context.getExternalFilesDir(null), "logcat")) .recordDir(File(context.getExternalFilesDir(null), "logcat"))
.pid(Process.myPid()) .pid(Process.myPid())
.generateZipDir(zip.absolutePath) .generateZipDir(File(context.getExternalFilesDir(null), "logcat/zip").absolutePath)
.stateProvider(object : IStateProvider { .stateProvider(object : IStateProvider {
override fun provide(divider: String?): Map<String, Any?> { override fun provide(divider: String?): Map<String, Any?> {
return mutableMapOf<String, Any?>().also { itx -> return mutableMapOf<String, Any?>().also { itx ->
@@ -104,6 +108,18 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
itx["协议版本号"] = AppConfigInfo.protocolVersionNumber itx["协议版本号"] = AppConfigInfo.protocolVersionNumber
itx["${divider}-7"] = divider itx["${divider}-7"] = divider
itx["角色"] = AppConfigInfo.role itx["角色"] = AppConfigInfo.role
val downloads = try {
DownloadUtils.getAllDownloadRecords()
} catch (t: Throwable) {
emptyList()
}
if (downloads.isNotEmpty()) {
itx["${divider}-8"] = divider
itx["下载汇总"] = "(${downloads.size})"
downloads.forEach {
itx[it.first] = "\n\r----------------------------------------------------------${it.second}\n\r"
}
}
} }
} }
}) })
@@ -114,26 +130,26 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
.systemTags("ActivityManager") .systemTags("ActivityManager")
.checker(AnrLogChecker()) .checker(AnrLogChecker())
} }
if (BuildConfig.DEBUG) {
// if (BuildConfig.DEBUG) { builder.crashConfig(
// builder.crashConfig( CrashConfig.Builder()
// CrashConfig.Builder() .enabled(true)
// .enabled(true) .crashDir(File(context.getExternalFilesDir(null), "crash"))
// .crashDir(File(context.getExternalFilesDir(null), "logcat/crash")) .expireDuration(TimeUnit.DAYS.toMillis(3))
// .nativeCrash(true) .javaCrash(true)
// .anr(true) .nativeCrash(true)
// .javaCrash(true) .anr(true)
// .build() .build()
// ) )
// }
LogcatManager.init(builder)
scope.launch {
try {
zip.takeIf { it.exists() }?.deleteRecursively()
} catch (t: Throwable) {
t.printStackTrace()
}
} }
builder.extraFilesToUpload(object : IExtraFileToUpload {
override fun filesToUpload(): List<ToUploadFile> {
return ArrayList<ToUploadFile>().also {
it.add(ToUploadFile(File(Environment.getExternalStorageDirectory(), "MLog")))
}
}
})
LogcatManager.init(builder)
} }
override fun target(): Class<RemoteLogPushContent> { override fun target(): Class<RemoteLogPushContent> {
@@ -195,8 +211,8 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
return LogcatManager.export() return LogcatManager.export()
} }
override fun upload(): Unit = runBlocking { override fun upload(startTime: Long, endTime: Long): Unit = runBlocking {
val state = LogcatManager.upload(0, System.currentTimeMillis()) val state = LogcatManager.upload(startTime, endTime)
if (state is UploadError) { if (state is UploadError) {
throw AssertionError(state.toString()) throw AssertionError(state.toString())
} }

View File

@@ -8,13 +8,20 @@ import android.content.IntentFilter
import android.location.LocationManager import android.location.LocationManager
import android.util.Log import android.util.Log
import androidx.core.location.LocationManagerCompat import androidx.core.location.LocationManagerCompat
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
import com.mogo.eagle.core.utilcode.util.AppStateManager import com.mogo.eagle.core.utilcode.util.AppStateManager
@@ -30,7 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean
internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx), internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoDevaToolsListener, IMoGoAutopilotStatusListener,
IConnectStatusListener, IMogoStatusChangedListener { IConnectStatusListener, IMogoStatusChangedListener, IMoGoAutopilotCarConfigListener,
IMoGoCloudListener {
companion object { companion object {
const val TAG = "OverViewImpl" const val TAG = "OverViewImpl"
@@ -56,6 +64,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
@Volatile @Volatile
private var isAutopilotException = false private var isAutopilotException = false
@Volatile
private var isAuthCrtException = false
@Volatile @Volatile
private var isFirst = true private var isFirst = true
@@ -125,6 +136,8 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance() MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
val isGranted = checkIsGpsException() val isGranted = checkIsGpsException()
if (!isGranted) { if (!isGranted) {
@@ -268,11 +281,41 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
} }
private fun checkIfNotException() { private fun checkIfNotException() {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException) { if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException && !isAuthCrtException) {
send(OverViewStatus(false)) send(OverViewStatus(false))
} }
} }
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
isAuthCrtException = false
checkIfNotException()
}
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
isAuthCrtException = true
send(OverViewStatus(true))
}
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
return
}
if(msg.contains("成功校验")){
isAuthCrtException = false
checkIfNotException()
}else{
isAuthCrtException = true
send(OverViewStatus(true))
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
// CallerDevaToolsListenerManager.removeListener(TAG) // CallerDevaToolsListenerManager.removeListener(TAG)
@@ -280,6 +323,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance() MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) .unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG) CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
try { try {
if (registered.compareAndSet(true, false) && receiver != null) { if (registered.compareAndSet(true, false) && receiver != null) {
ctx.unregisterReceiver(receiver) ctx.unregisterReceiver(receiver)

View File

@@ -1,34 +0,0 @@
package com.zhjt.mogo_core_function_devatools.status.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.zhjt.mogo_core_function_devatools.R
/**
* 状态汇总View控件
*/
class StatusSummaryView@JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(
context,
attrs,
defStyleAttr
), IMoGoAutopilotStatusListener {
companion object{
private const val TAG = "SummaryStatusView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_initiative_bad_case, this, true)
initView()
}
private fun initView() {
}
}

View File

@@ -8,13 +8,17 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.FMInfoMsg import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
@@ -97,23 +101,53 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
} }
} else if(category == MsgCategory.SYS_INFO){ } else if(category == MsgCategory.SYS_INFO){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
isShowReport = true
}
}
}
if(isShowReport){
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){ } else if(category == MsgCategory.FM_INFO){
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){ if(FunctionBuildConfig.isTakeoverRemind){
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音 //属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
if(fmInfoMsg.policyCode == "FM_DP_PNC_CHOOSE_STOP" //择机靠边停车 var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
|| fmInfoMsg.policyCode == "FM_DP_COMFORTABLE_STOP" //立刻舒适停车 fmInfoMsg.fmInfoList?.forEach { faultInfo ->
|| fmInfoMsg.policyCode == "FM_DP_EMERGENCY_STOP" //就地紧急停车 if(faultInfo.faultActionCount>0){
){ faultInfo.faultActionList.forEach {actionCode ->
//语音提示 //获取建议操作级别,得到建议操作级别最高的操作
try { if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips) curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
}catch (e: Exception){ }
e.printStackTrace() }
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
} }
//展示消息
showData(msgBoxBean)
} }
} }
} else{ } else{

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.TimeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
@@ -242,7 +243,6 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
is BubbleFmHolder ->{ is BubbleFmHolder ->{
data?.let { data?.let {
val fmMsg = it[position].msgBoxBean.bean as FMInfoMsg val fmMsg = it[position].msgBoxBean.bean as FMInfoMsg
holder.tvBubbleFmFault.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
if(fmMsg.policyTime == null){ if(fmMsg.policyTime == null){
holder.tvBubbleFmTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat()) holder.tvBubbleFmTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
}else{ }else{
@@ -250,26 +250,43 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
} }
if(fmMsg.fmInfoList?.size == 0){ if(fmMsg.fmInfoList?.size == 0){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无" holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
holder.tvBubbleFmFault.text = MsgFmData.getFmPolicyName(fmMsg.policyCode)
}else{ }else{
var curFaultLevel = 0 //默认级别遍历数组找出级别最高的level数越小,级别越高) var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmMsg.fmInfoList?.forEach { faultInfo -> fmMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){ if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode -> faultInfo.faultActionList.forEach {actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作 //获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) > curFaultLevel){ if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode) curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
} }
} }
} }
} }
val faultAction = MsgFmData.FaultAction.getFaultAction(curFaultLevel) val faultAction = MsgFmData.FaultAction.getFaultAction(curFaultLevel)
holder.tvBubbleFmFault.text = faultAction
//当出现多个建议操作时,按照整车下电重启、请求人工驾驶接管、请求平行驾驶接管、系统重启、联系硬件工程师、 //当出现多个建议操作时,按照整车下电重启、请求人工驾驶接管、请求平行驾驶接管、系统重启、联系硬件工程师、
// 联系运维工程师、联系软件工程师优先级递减的顺序,只展示最高优先级的内容 // 联系运维工程师、联系软件工程师优先级递减的顺序,只展示最高优先级的内容
if(curFaultLevel == 0){ if(curFaultLevel == 5){
holder.tvBubbleFmFaultAction.text = "建议操作:暂无" holder.tvBubbleFmFaultAction.text = "建议操作:暂无"
}else{ }else{
holder.tvBubbleFmFaultAction.text = "${faultAction}(${MsgFmData.FaultAction.getFaultActionCode(curFaultLevel)})" holder.tvBubbleFmFaultAction.text = "${faultAction}(${MsgFmData.FaultAction.getFaultActionCode(curFaultLevel)})"
} }
//不同级别的Icon显示
when(curFaultLevel){
0->{
//重度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
}
1,2,3->{
//中度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
}
4,5->{
//轻度预警样式
holder.ivBubbleFmImage.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
}
}
} }
} }
} }
@@ -409,6 +426,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvBubbleFmFault: TextView = itemView.findViewById(R.id.tvBubbleFmFault) var tvBubbleFmFault: TextView = itemView.findViewById(R.id.tvBubbleFmFault)
var tvBubbleFmFaultAction: TextView = itemView.findViewById(R.id.tvBubbleFmFaultAction) var tvBubbleFmFaultAction: TextView = itemView.findViewById(R.id.tvBubbleFmFaultAction)
var tvBubbleFmTime: TextView = itemView.findViewById(R.id.tvBubbleFmTime) var tvBubbleFmTime: TextView = itemView.findViewById(R.id.tvBubbleFmTime)
var ivBubbleFmImage: ImageView = itemView.findViewById(R.id.ivBubbleFmImage)
} }
//SSM连接消息 //SSM连接消息

View File

@@ -173,39 +173,21 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
"时间:${fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1) }}" "时间:${fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1) }}"
holder.tvFmTime.text = holder.tvFmTime.text =
fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1,getHourMinFormat()) } fmInfoMsg.policyTime?.let { it1 -> TimeUtils.millis2String(it1,getHourMinFormat()) }
//不同级别的Icon显示
if(fmInfoMsg.policyCode == "FM_DP_ONLY_WARNING"){
//警示
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
}else if(fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT1"
|| fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT2"
|| fmInfoMsg.policyCode == "FM_DP_SPEED_LIMIT3"){
//降速行驶
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_open))
}else if(fmInfoMsg.policyCode == "FM_DP_PNC_CHOOSE_STOP"
|| fmInfoMsg.policyCode == "FM_DP_COMFORTABLE_STOP"
|| fmInfoMsg.policyCode == "FM_DP_EMERGENCY_STOP"){
//安全停车
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_open))
}
//Title
holder.tvFmTitleNormal.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
holder.tvFmTitleOpen.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
//建议操作 //建议操作
if(fmInfoMsg.fmInfoList.isNullOrEmpty()){ if(fmInfoMsg.fmInfoList.isNullOrEmpty()){
//建议操作暂无 //建议操作暂无
holder.tvFmActionOpen.text = "建议操作:暂无" holder.tvFmActionOpen.text = "建议操作:暂无"
holder.tvFmActionNormal.text = "建议操作:暂无" holder.tvFmActionNormal.text = "建议操作:暂无"
//Title
holder.tvFmTitleNormal.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
holder.tvFmTitleOpen.text = MsgFmData.getFmPolicyName(fmInfoMsg.policyCode)
}else{ }else{
val receiveFaultLevel = ArrayList<Int>() val receiveFaultLevel = ArrayList<Int>()
fmInfoMsg.fmInfoList!!.forEach { info -> fmInfoMsg.fmInfoList!!.forEach { info ->
if(info.faultActionCount != 0){ if(info.faultActionCount != 0){
info.faultActionList.forEach { action -> info.faultActionList.forEach { action ->
//如果不包含此故障Level则进行添加 //如果不包含此故障Level则进行添加
if(!receiveFaultLevel.contains(MsgFmData.FaultAction.getFaultLevel(action)) && MsgFmData.FaultAction.getFaultLevel(action)!=0){ if(!receiveFaultLevel.contains(MsgFmData.FaultAction.getFaultLevel(action))){
receiveFaultLevel.add(MsgFmData.FaultAction.getFaultLevel(action)) receiveFaultLevel.add(MsgFmData.FaultAction.getFaultLevel(action))
} }
} }
@@ -216,7 +198,28 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
val faultActionStr: StringBuilder = StringBuilder() val faultActionStr: StringBuilder = StringBuilder()
faultActionStr.append("建议操作:") faultActionStr.append("建议操作:")
receiveFaultLevel.sort() receiveFaultLevel.sort()
receiveFaultLevel.reverse() // receiveFaultLevel.reverse()
//Title
holder.tvFmTitleNormal.text = MsgFmData.FaultAction.getFaultAction(receiveFaultLevel[0])
holder.tvFmTitleOpen.text = MsgFmData.FaultAction.getFaultAction(receiveFaultLevel[0])
//不同级别的Icon显示
when(receiveFaultLevel[0]){
0->{
//重度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_stop_open))
}
1,2,3->{
//中度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_reduce_open))
}
4,5->{
//轻度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
}
}
receiveFaultLevel.forEach {level-> receiveFaultLevel.forEach {level->
if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank()){ if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank()){
faultActionStr.append(MsgFmData.FaultAction.getFaultAction(level)) faultActionStr.append(MsgFmData.FaultAction.getFaultAction(level))
@@ -227,11 +230,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
faultActionStr.append(")") faultActionStr.append(")")
} }
if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank() || MsgFmData.FaultAction.getFaultActionCode(level).isNotBlank()){ if(MsgFmData.FaultAction.getFaultAction(level).isNotBlank() || MsgFmData.FaultAction.getFaultActionCode(level).isNotBlank()){
faultActionStr.append("/") faultActionStr.append(";")
} }
} }
if(faultActionStr.length > 5){ if(faultActionStr.length > 5){
if(faultActionStr.endsWith("/")){ if(faultActionStr.endsWith(";")){
faultActionStr.deleteCharAt(faultActionStr.lastIndex) faultActionStr.deleteCharAt(faultActionStr.lastIndex)
} }
holder.tvFmActionOpen.text = faultActionStr.toString() holder.tvFmActionOpen.text = faultActionStr.toString()
@@ -243,6 +246,9 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
}else{ }else{
holder.tvFmActionOpen.text = "建议操作:暂无" holder.tvFmActionOpen.text = "建议操作:暂无"
holder.tvFmActionNormal.text = "建议操作:暂无" holder.tvFmActionNormal.text = "建议操作:暂无"
//轻度预警样式
holder.ivFmImageNormal.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_normal))
holder.ivFmImageOpen.setImageDrawable(getDrawable(R.drawable.icon_fm_warning_open))
} }
} }
//故障策略 //故障策略

View File

@@ -12,7 +12,6 @@ import android.os.Build
import android.os.Process import android.os.Process
import android.text.Html import android.text.Html
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@@ -89,6 +88,7 @@ import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.kotlin.scope import com.mogo.eagle.core.utilcode.kotlin.scope
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -204,7 +204,8 @@ internal class DebugSettingView @JvmOverloads constructor(
// 高精地图是否已缓存 // 高精地图是否已缓存
private var isHDCached = false private var isHDCached = false
private var isClickCheckedCbSsl = false//是否已经点击且选中证书认证按钮 //是否已经点击且选中证书认证按钮
private var isCertCheck = false
private var isFirstDownLoadCertHint = false private var isFirstDownLoadCertHint = false
init { init {
@@ -1293,14 +1294,13 @@ internal class DebugSettingView @JvmOverloads constructor(
} }
} }
//是否启用证书认证 //是否启用证书认证
cbSsl.isChecked = val check = SharedPrefsMgr.getInstance().getBoolean(
SharedPrefsMgr.getInstance().getBoolean( "${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE )
) isCertCheck = check
cbSsl.isChecked = check
cbSsl.setOnCheckedChangeListener { _, isChecked -> cbSsl.setOnCheckedChangeListener { _, isChecked ->
isClickCheckedCbSsl = isChecked
// 下载证书
if (isChecked) { if (isChecked) {
if (CallerCloudCertManager.getRootCrtF().isNullOrEmpty()) { if (CallerCloudCertManager.getRootCrtF().isNullOrEmpty()) {
if (!isFirstDownLoadCertHint) { if (!isFirstDownLoadCertHint) {
@@ -1308,25 +1308,31 @@ internal class DebugSettingView @JvmOverloads constructor(
ToastUtils.showShort("证书文件不存在,正在下载") ToastUtils.showShort("证书文件不存在,正在下载")
} }
cbSsl.isChecked = false cbSsl.isChecked = false
//下载证书
CallerCloudCertManager.certFileDownLoad { errorMsg -> CallerCloudCertManager.certFileDownLoad { errorMsg ->
ThreadUtils.runOnUiThread { ThreadUtils.runOnUiThread {
isCertCheck = false
ToastUtils.showShort(errorMsg) ToastUtils.showShort(errorMsg)
} }
} }
}else{
isCertCheck = true
} }
}else{
isCertCheck = false
} }
SharedPrefsMgr.getInstance() SharedPrefsMgr.getInstance()
.putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, cbSsl.isChecked) .putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", cbSsl.isChecked)
} }
} }
override fun authCrtFile(device: String, root: String) { override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root) super.authCrtFile(device, root)
ThreadUtils.runOnUiThread { ThreadUtils.runOnUiThread {
if (isClickCheckedCbSsl) { if (isCertCheck) {
cbSsl.isChecked = true cbSsl.isChecked = true
SharedPrefsMgr.getInstance() SharedPrefsMgr.getInstance()
.putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, true) .putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", true)
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
tvCertFile.text = Html.fromHtml( tvCertFile.text = Html.fromHtml(
@@ -1576,26 +1582,48 @@ internal class DebugSettingView @JvmOverloads constructor(
//上传全量日志 //上传全量日志
exportAllLogs?.onClick { v -> exportAllLogs?.onClick { v ->
v.visibility = View.INVISIBLE ListPopupWindow(v.context).also { p ->
logLoadingView?.visibility = View.VISIBLE val items = LogcatUploadDuration.values()
v.scope.launch(Dispatchers.IO) { p.setAdapter(LogcatUploadAdapter(v.context, items))
var isUploadSuccess = false p.anchorView = v
try { p.isModal = true
CallerDevaToolsManager.logcat()?.upload() p.setBackgroundDrawable(ColorDrawable(Color.WHITE))
isUploadSuccess = true p.setOnItemClickListener { _, _, position, _ ->
} catch (t: Throwable) { val item = items[position]
t.printStackTrace() v.visibility = View.INVISIBLE
} logLoadingView?.visibility = View.VISIBLE
withContext(Dispatchers.Main) { p.dismiss()
if (isUploadSuccess) { v.scope.launch(Dispatchers.IO) {
ToastUtils.showShort("上传成功") val endTime = System.currentTimeMillis()
} else { val startTime = when(item) {
ToastUtils.showShort("上传失败") LogcatUploadDuration.IN_15M -> endTime - TimeUnit.MINUTES.toMillis(15)
LogcatUploadDuration.IN_45M -> endTime - TimeUnit.MINUTES.toMillis(45)
LogcatUploadDuration.IN_1H -> endTime - TimeUnit.HOURS.toMillis(1)
LogcatUploadDuration.IN_2H -> endTime - TimeUnit.HOURS.toMillis(2)
LogcatUploadDuration.IN_3H -> endTime - TimeUnit.HOURS.toMillis(3)
LogcatUploadDuration.IN_6H -> endTime - TimeUnit.HOURS.toMillis(6)
LogcatUploadDuration.IN_1D -> endTime - TimeUnit.DAYS.toMillis(1)
LogcatUploadDuration.ALL -> 0
}
var isUploadSuccess = false
try {
CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
isUploadSuccess = true
} catch (t: Throwable) {
t.printStackTrace()
}
withContext(Dispatchers.Main) {
if (isUploadSuccess) {
ToastUtils.showShort("上传成功")
} else {
ToastUtils.showShort("上传失败")
}
logLoadingView?.visibility = View.INVISIBLE
exportAllLogs?.visibility = View.VISIBLE
}
} }
logLoadingView?.visibility = View.INVISIBLE
exportAllLogs?.visibility = View.VISIBLE
} }
} }.show()
} }
if (JunkConfig.isSupportJunkDetect) { if (JunkConfig.isSupportJunkDetect) {
@@ -1731,6 +1759,54 @@ internal class DebugSettingView @JvmOverloads constructor(
} }
} }
private enum class LogcatUploadDuration(val text: String) {
IN_15M("15分钟内"),
IN_45M("45分钟内"),
IN_1H("1小时内"),
IN_2H("2小时内"),
IN_3H("3小时内"),
IN_6H("6小时内"),
IN_1D("一天内"),
ALL("上传所有")
}
private class LogcatUploadAdapter(private val ctx: Context, private val items: Array<LogcatUploadDuration>): BaseAdapter() {
override fun getCount(): Int {
return items.size
}
override fun getItem(position: Int): Any {
return items[position]
}
override fun getItemId(position: Int): Long {
return items[position].ordinal.toLong()
}
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
var result = convertView
val duration = items[position]
if (result == null) {
val temp = View.inflate(ctx, android.R.layout.simple_list_item_1, null)
temp.tag = Holder(temp.findViewById(android.R.id.text1))
result = temp
}
val holder = result?.tag as? Holder
if (holder != null) {
holder.text?.setTextColor(Color.BLACK)
holder.text?.text = duration.text
} else {
val text = result?.findViewById<TextView>(android.R.id.text1)
text?.setTextColor(Color.BLACK)
text?.text = duration.text
result?.tag = Holder(text)
}
return result!!
}
private inner class Holder(val text: TextView? = null)
}
private enum class ApmVLogUploadDuration(val text: String) { private enum class ApmVLogUploadDuration(val text: String) {
IN_15M("15分钟内"), IN_15M("15分钟内"),
IN_45M("45分钟内"), IN_45M("45分钟内"),
@@ -2504,6 +2580,6 @@ internal class DebugSettingView @JvmOverloads constructor(
paramIndexes = [0] paramIndexes = [0]
) )
private fun invokeCronetResult(json: String) { private fun invokeCronetResult(json: String) {
Log.d("CronetNetwork", json) CallerLogger.d(SceneConstant.M_HMI + "CronetNetwork", json)
} }
} }

View File

@@ -48,6 +48,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusS
4 -> { 4 -> {
ivFuncView.setImageResource(R.drawable.controller) ivFuncView.setImageResource(R.drawable.controller)
} }
5 -> {
ivFuncView.setImageResource(R.drawable.ssl_check)
}
} }
if (entity.isException) { if (entity.isException) {
tvStatusDesc.setTextColor(Color.parseColor("#FF4444")) tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))

View File

@@ -2,19 +2,26 @@ package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.status.StatusSummaryEntity import com.mogo.eagle.core.data.status.StatusSummaryEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
@@ -26,7 +33,7 @@ import com.zhjt.mogo.adas.data.AdasConstants
/** /**
* 状态汇总View控件 * 状态汇总View控件
*/ */
class StatusSummaryView@JvmOverloads constructor( class StatusSummaryView @JvmOverloads constructor(
context: Context, context: Context,
attrs: AttributeSet? = null, attrs: AttributeSet? = null,
defStyleAttr: Int = 0 defStyleAttr: Int = 0
@@ -35,8 +42,9 @@ class StatusSummaryView@JvmOverloads constructor(
attrs, attrs,
defStyleAttr defStyleAttr
), IConnectStatusListener, IMogoStatusChangedListener, ), IConnectStatusListener, IMogoStatusChangedListener,
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener { IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarConfigListener,
companion object{ IMoGoCloudListener {
companion object {
private const val TAG = "SummaryStatusView" private const val TAG = "SummaryStatusView"
} }
@@ -50,6 +58,13 @@ class StatusSummaryView@JvmOverloads constructor(
it.add(StatusSummaryEntity(2)) it.add(StatusSummaryEntity(2))
it.add(StatusSummaryEntity(3)) it.add(StatusSummaryEntity(3))
it.add(StatusSummaryEntity(4, "域控未连接", true)) it.add(StatusSummaryEntity(4, "域控未连接", true))
it.add(
StatusSummaryEntity(
5,
CallerAutopilotCarConfigListenerManager.getCertFileResult(),
CallerCloudCertManager.getRootCrtF().isNullOrEmpty()
)
)
} }
} }
@@ -67,6 +82,8 @@ class StatusSummaryView@JvmOverloads constructor(
MogoStatusManager.getInstance() MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
} }
private fun initView() { private fun initView() {
@@ -81,9 +98,10 @@ class StatusSummaryView@JvmOverloads constructor(
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
it.addItemDecoration( it.addItemDecoration(
CommonDividerItemDecoration.Builder() CommonDividerItemDecoration.Builder()
.spanCountTBCare(false) .spanCountTBCare(false)
.horizontalInnerSpace(10.PX) .horizontalInnerSpace(10.PX)
.build()) .build()
)
StatusSummaryAdapter(context, data).apply { StatusSummaryAdapter(context, data).apply {
adapter = this adapter = this
it.adapter = this it.adapter = this
@@ -108,6 +126,8 @@ class StatusSummaryView@JvmOverloads constructor(
MogoStatusManager.getInstance() MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) .unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG) CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
} }
/** /**
@@ -168,30 +188,39 @@ class StatusSummaryView@JvmOverloads constructor(
AdasConstants.IpcConnectionStatus.DISCONNECTED -> { AdasConstants.IpcConnectionStatus.DISCONNECTED -> {
pair = Pair("域控未连接", true) pair = Pair("域控未连接", true)
} }
AdasConstants.IpcConnectionStatus.CONNECTED -> { AdasConstants.IpcConnectionStatus.CONNECTED -> {
pair = Pair("域控已连接", false) pair = Pair("域控已连接", false)
} }
AdasConstants.IpcConnectionStatus.CONNECTING -> { AdasConstants.IpcConnectionStatus.CONNECTING -> {
pair = Pair("域控连接中", true) pair = Pair("域控连接中", true)
} }
AdasConstants.IpcConnectionStatus.RECONNECTING_TIMER, AdasConstants.IpcConnectionStatus.RECONNECTING_NETWORK -> { AdasConstants.IpcConnectionStatus.RECONNECTING_TIMER, AdasConstants.IpcConnectionStatus.RECONNECTING_NETWORK -> {
pair = Pair("域控重连中", true) pair = Pair("域控重连中", true)
} }
AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> { AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> {
pair = Pair("域控连接异常", true) pair = Pair("域控连接异常", true)
} }
AdasConstants.IpcConnectionStatus.ILLEGAL_ADDRESS -> { AdasConstants.IpcConnectionStatus.ILLEGAL_ADDRESS -> {
pair = Pair("非法域控地址", true) pair = Pair("非法域控地址", true)
} }
AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS -> { AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS -> {
pair = Pair("正在搜索域控地址", true) pair = Pair("正在搜索域控地址", true)
} }
AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> { AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> {
pair = Pair("找不到可用的域控地址", true) pair = Pair("找不到可用的域控地址", true)
} }
AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT -> { AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT -> {
pair = Pair("域控心跳超时", true) pair = Pair("域控心跳超时", true)
} }
AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED -> { AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED -> {
pair = Pair("域控主动断开连接", true) pair = Pair("域控主动断开连接", true)
} }
@@ -203,4 +232,41 @@ class StatusSummaryView@JvmOverloads constructor(
adapter?.notifyItemChanged(4) adapter?.notifyItemChanged(4)
} }
} }
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = "本机证书已下载"
data[5].isException = false
adapter?.notifyItemChanged(5)
}
}
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = "本机证书下载异常:$errorMsg"
data[5].isException = true
adapter?.notifyItemChanged(5)
}
}
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
return
}
UiThreadHandler.post {
if (data.size < 6) return@post
data[5].desc = msg
data[5].isException = !msg.contains("成功校验")
adapter?.notifyItemChanged(5)
}
}
} }

View File

@@ -119,7 +119,6 @@ class StatusBarView @JvmOverloads constructor(
private fun setTextColor(color: Int) { private fun setTextColor(color: Int) {
viewTextClock.setTextColor(color) viewTextClock.setTextColor(color)
viewStatusBarTag.setTextColor(color)
} }
override fun onDetachedFromWindow() { override fun onDetachedFromWindow() {

View File

@@ -8,19 +8,27 @@ import android.net.wifi.WifiManager
import android.os.Handler import android.os.Handler
import android.os.Message import android.os.Message
import android.util.AttributeSet import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_wifi_state.view.viewStatusBarTag
import kotlinx.android.synthetic.main.view_wifi_state.view.viewWifiStateBg
import me.jessyan.autosize.utils.AutoSizeUtils
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import kotlin.properties.Delegates
class WifiStateView @JvmOverloads constructor( class WifiStateView @JvmOverloads constructor(
context: Context, context: Context, attrs: AttributeSet? = null,defStyleAttr: Int = 0
attrs: AttributeSet? = null, ) : ConstraintLayout(context, attrs), IMoGoSkinModeChangeListener {
defStyleAttr: Int = 0
) : AppCompatImageView(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
companion object { companion object {
const val TAG = "WifiStateView" const val TAG = "WifiStateView"
@@ -37,20 +45,46 @@ class WifiStateView @JvmOverloads constructor(
override fun handleMessage(msg: Message) { override fun handleMessage(msg: Message) {
super.handleMessage(msg) super.handleMessage(msg)
val view = stateViewWeakReference?.get() val view = stateViewWeakReference?.get()
view?.updateView(msg.what) { view?.updateLevel(msg.what)
view.setImageResource(it) }
}
}
private var wifiManager: WifiManager? = null
private var wifiHandler: WifiHandler? = null
private var level: Int by Delegates.observable(0) { _, o, n ->
if (o != n) {
UiThreadHandler.post {
updateView(n){
viewWifiStateBg.setImageResource(it)
} }
} }
} }
} }
private var wifiManager: WifiManager? = null private var wifiName: String by Delegates.observable("") { _, o, n ->
private var wifiHandler: WifiHandler? = null if (o != n) {
UiThreadHandler.post {
if(n.contains("unknow")){
viewStatusBarTag.text = ""
}else{
viewStatusBarTag.text = n
}
}
}
}
@Volatile private val txtSize: Float
private var level: Int = 0
init { init {
LayoutInflater.from(context).inflate(R.layout.view_wifi_state, this, true)
val a = context.obtainStyledAttributes(attrs, R.styleable.WifiStateView, defStyleAttr, 0)
txtSize = a.getDimension(
R.styleable.WifiStateView_wifi_size,
resources.getDimension(R.dimen.dp_35)
)
a.recycle()
viewStatusBarTag.setTextSize(TypedValue.COMPLEX_UNIT_PX,AutoSizeUtils.dp2px(context,txtSize).toFloat())
wifiManager = wifiManager =
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
wifiHandler = WifiHandler(this) wifiHandler = WifiHandler(this)
@@ -67,6 +101,8 @@ class WifiStateView @JvmOverloads constructor(
return return
} }
val wifiInfo = wifiManager!!.connectionInfo val wifiInfo = wifiManager!!.connectionInfo
wifiName = wifiInfo.ssid.replace("\"","")
Log.i("emArrow", "wifiName: $wifiName")
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5) level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
wifiHandler?.sendEmptyMessage(level) wifiHandler?.sendEmptyMessage(level)
} }
@@ -95,9 +131,25 @@ class WifiStateView @JvmOverloads constructor(
override fun onSkinModeChange(skinMode: Int) { override fun onSkinModeChange(skinMode: Int) {
wifiHandler?.sendEmptyMessage(level) wifiHandler?.sendEmptyMessage(level)
UiThreadHandler.post {
when (skinMode) {
0 -> setStatusBarDarkOrLight(false)
1 -> setStatusBarDarkOrLight(true)
}
}
} }
fun updateView(wifiState: Int, resId: ((Int) -> Unit)) { private fun setStatusBarDarkOrLight(light: Boolean) = if (light) {
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_2C2E30))
} else {
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_FFFFFF))
}
fun updateLevel(wifiState: Int){
level = wifiState
}
private fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
when (FunctionBuildConfig.skinMode) { when (FunctionBuildConfig.skinMode) {
0 -> { 0 -> {
when (wifiState) { when (wifiState) {
@@ -109,6 +161,7 @@ class WifiStateView @JvmOverloads constructor(
4 -> resId.invoke(R.drawable.wifi_light_state_five) 4 -> resId.invoke(R.drawable.wifi_light_state_five)
} }
} }
1 -> { 1 -> {
when (wifiState) { when (wifiState) {
-1 -> resId.invoke(R.drawable.wifi_dark_state_one) -1 -> resId.invoke(R.drawable.wifi_dark_state_one)

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@@ -18,20 +18,9 @@
android:textSize="@dimen/dp_45" android:textSize="@dimen/dp_45"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:id="@+id/viewStatusBarTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_27"
android:gravity="center"
android:text="@string/status_bar_tag"
android:textColor="@color/color_2C2E30"
android:textSize="@dimen/dp_35" />
<!--Wifi状态--> <!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView <com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:layout_width="@dimen/dp_54" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_54" android:layout_height="@dimen/dp_54"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_18" /> android:layout_marginStart="@dimen/dp_18" />

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/viewStatusBarTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_27"
android:gravity="center_vertical"
android:maxLength="15"
android:textColor="@color/color_2C2E30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/viewWifiStateBg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/viewStatusBarTag"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -89,6 +89,10 @@
<attr name="pnc_txt_style" format="reference"/> <attr name="pnc_txt_style" format="reference"/>
</declare-styleable> </declare-styleable>
<declare-styleable name="WifiStateView">
<attr name="wifi_size" format="dimension"/>
</declare-styleable>
<style name="AudioFileInfoOverlayText"> <style name="AudioFileInfoOverlayText">
<item name="android:shadowColor">#80000000</item> <item name="android:shadowColor">#80000000</item>
<item name="android:shadowRadius">11</item> <item name="android:shadowRadius">11</item>

View File

@@ -8,6 +8,7 @@ import androidx.annotation.RequiresApi;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.geometry.S2CellId; import com.mogo.eagle.core.utilcode.geometry.S2CellId;
import com.mogo.eagle.core.utilcode.geometry.S2LatLng; import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
@@ -103,7 +104,7 @@ public class TrackManager {
MessagePad.TrackedObject cache = cacheTrack.getCache(); MessagePad.TrackedObject cache = cacheTrack.getCache();
if (cache != null) { if (cache != null) {
//相对静止物体 感知融合同位置物体,使用缓存数据做覆盖 //相对静止物体 感知融合同位置物体,使用缓存数据做覆盖
if (cacheTrack.relativeStatic()) { if (cacheTrack.relativeStatic() && data.getType() != TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.getType()) {
if (data.getColor() != null && !data.getColor().isEmpty()) { if (data.getColor() != null && !data.getColor().isEmpty()) {
cache = cache.toBuilder().setColor(data.getColor()).build(); cache = cache.toBuilder().setColor(data.getColor()).build();
} }

View File

@@ -13,7 +13,7 @@ object TrackerSourceFilterHelper {
@SuppressLint("NewApi") @SuppressLint("NewApi")
fun filterData(data: TrackedObject): Boolean { fun filterData(data: TrackedObject): Boolean {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type if (!FunctionBuildConfig.isDrawUnknownIdentifyData && (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type) || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GU.type)
) { ) {
return true return true
} }
@@ -55,6 +55,10 @@ object TrackerSourceFilterHelper {
return "" return ""
} }
if(data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type){
return ""
}
if(FunctionBuildConfig.isFusionColor){ if(FunctionBuildConfig.isFusionColor){
if(isFusion(data)){ if(isFusion(data)){
color = "#982FFFFF" color = "#982FFFFF"

View File

@@ -30,6 +30,9 @@ class CertFileManager : IMoGoCertProvider {
@Volatile @Volatile
private var rootCrtFile: String? = null private var rootCrtFile: String? = null
@Volatile
private var crtFileErrorMsg: String? = null
companion object { companion object {
private const val TAG = "CertFileManager" private const val TAG = "CertFileManager"
} }
@@ -72,6 +75,7 @@ class CertFileManager : IMoGoCertProvider {
"onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}" "onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}"
) )
certStatus.set(false) certStatus.set(false)
crtFileErrorMsg = null
deviceCrtFile = securityKey deviceCrtFile = securityKey
rootCrtFile = rootKey rootCrtFile = rootKey
SharedPrefsMgr.getInstance().putString(securityKeyTAG, securityKey) SharedPrefsMgr.getInstance().putString(securityKeyTAG, securityKey)
@@ -92,6 +96,8 @@ class CertFileManager : IMoGoCertProvider {
override fun onFailed(errorCode: Int, errorMsg: String) { override fun onFailed(errorCode: Int, errorMsg: String) {
CallerLogger.d("${SceneConstant.M_D_C}$TAG", "onFailed code:$errorCode, msg:$errorMsg") CallerLogger.d("${SceneConstant.M_D_C}$TAG", "onFailed code:$errorCode, msg:$errorMsg")
certStatus.set(false) certStatus.set(false)
crtFileErrorMsg = "$errorCode - $errorMsg"
CallerCloudListenerManager.invokeCloudCrtError(errorMsg)
onError?.invoke("证书下载失败, code:$errorCode, msg:$errorMsg") onError?.invoke("证书下载失败, code:$errorCode, msg:$errorMsg")
} }
}) })
@@ -112,4 +118,8 @@ class CertFileManager : IMoGoCertProvider {
override fun getRootCrtF(): String? { override fun getRootCrtF(): String? {
return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, null) return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, null)
} }
override fun getCrtFileErrorMsg(): String? {
return crtFileErrorMsg
}
} }

View File

@@ -32,10 +32,9 @@ public class PassPortSecret {
private IPassportSecret secretCB; private IPassportSecret secretCB;
public void init(String deviceId, String path, IPassportSecret secretCB) { public void init(String deviceId, String path, IPassportSecret secretCB) {
if (this.secretCB != null) { if (this.secretCB == null) {
return; this.secretCB = secretCB;
} }
this.secretCB = secretCB;
PassportService passportService = new PassportService(); PassportService passportService = new PassportService();
passportService.setEnableLog(DebugConfig.isDebug()); passportService.setEnableLog(DebugConfig.isDebug());
domain.R<Passport> r = initLow(passportService, deviceId, path); domain.R<Passport> r = initLow(passportService, deviceId, path);

View File

@@ -308,7 +308,7 @@ object FunctionBuildConfig {
*/ */
@Volatile @Volatile
@JvmField @JvmField
var unableLaunchAutopilotGear: Set<Chassis.GearPosition>? = null var launchAutopilotGear: Set<Chassis.GearPosition>? = null
/** /**
* 当前应用是否支持patch升级 * 当前应用是否支持patch升级

View File

@@ -8,7 +8,8 @@ enum class DataSourceType(name: String) {
MAP("HDMAP"), MAP("HDMAP"),
TELEMATIC("TELEMATIC"), TELEMATIC("TELEMATIC"),
AICLOUD("AI云"), AICLOUD("AI云"),
SUMMARY("汇总");// V2X事件汇总 SUMMARY("汇总"),// V2X事件汇总
WORKORDER("工单建议");
companion object{ companion object{
@@ -19,6 +20,7 @@ enum class DataSourceType(name: String) {
TELEMATIC -> "TELEMATIC" TELEMATIC -> "TELEMATIC"
AICLOUD -> "AI云" AICLOUD -> "AI云"
SUMMARY -> "汇总" SUMMARY -> "汇总"
WORKORDER -> "工单建议"
else -> "defalut" else -> "defalut"
} }
} }

View File

@@ -17,21 +17,6 @@ enum class TrafficTypeEnum(
var traffic3DIconId: Int, var traffic3DIconId: Int,
var traffic3DNightIconId: Int var traffic3DNightIconId: Int
) { ) {
TYPE_TRAFFIC_ID_501(
501,
"未知数据",
R.raw.traffic_xiankuang,
R.raw.traffic_xiankuang,
R.raw.traffic_xiankuang
),
TYPE_TRAFFIC_ID_502(
502,
"未知数据",
R.raw.traffic_xiankuang,
R.raw.traffic_xiankuang,
R.raw.traffic_xiankuang
),
TYPE_TRAFFIC_ID_WEI_ZHI( TYPE_TRAFFIC_ID_WEI_ZHI(
100, 100,
"未知数据", "未知数据",
@@ -95,12 +80,12 @@ enum class TrafficTypeEnum(
R.raw.special_vehicle, R.raw.special_vehicle,
R.raw.special_vehicle R.raw.special_vehicle
), ),
TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG( TYPE_TRAFFIC_ID_CONE(
12, 12,
"道路施工", "三角锥",
R.raw.v2x_shigong_warning, R.raw.sanjiaozhui,
R.raw.v2x_shigong_warning, R.raw.sanjiaozhui,
R.raw.v2x_shigong_warning R.raw.sanjiaozhui
), ),
TYPE_TRAFFIC_ID_LUCE_TA_CHE( TYPE_TRAFFIC_ID_LUCE_TA_CHE(
103, 103,
@@ -122,6 +107,20 @@ enum class TrafficTypeEnum(
R.raw.lucedaba, R.raw.lucedaba,
R.raw.lucedaba, R.raw.lucedaba,
R.raw.lucedaba R.raw.lucedaba
),
TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG(
501,
"道路施工",
R.raw.v2x_shigong_warning,
R.raw.v2x_shigong_warning,
R.raw.v2x_shigong_warning
),
TYPE_TRAFFIC_ID_DAO_LU_SHI_GU(
502,
"道路事故",
R.raw.v2x_shigu_sanjiaopai,
R.raw.v2x_shigu_sanjiaopai,
R.raw.v2x_shigu_sanjiaopai
); );
companion object { companion object {
@@ -134,6 +133,7 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE.type -> TYPE_TRAFFIC_ID_TA_CHE TYPE_TRAFFIC_ID_TA_CHE.type -> TYPE_TRAFFIC_ID_TA_CHE
TYPE_TRAFFIC_ID_MOTO.type -> TYPE_TRAFFIC_ID_MOTO TYPE_TRAFFIC_ID_MOTO.type -> TYPE_TRAFFIC_ID_MOTO
TYPE_TRAFFIC_ID_BUS.type -> TYPE_TRAFFIC_ID_BUS TYPE_TRAFFIC_ID_BUS.type -> TYPE_TRAFFIC_ID_BUS
TYPE_TRAFFIC_ID_CONE.type -> TYPE_TRAFFIC_ID_CONE
TYPE_TRAFFIC_ID_TRUCK.type -> TYPE_TRAFFIC_ID_TRUCK TYPE_TRAFFIC_ID_TRUCK.type -> TYPE_TRAFFIC_ID_TRUCK
TYPE_TRAFFIC_ID_CAMERA.type -> TYPE_TRAFFIC_ID_CAMERA TYPE_TRAFFIC_ID_CAMERA.type -> TYPE_TRAFFIC_ID_CAMERA
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> TYPE_TRAFFIC_ID_SPECIAL_VEHICLE TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> TYPE_TRAFFIC_ID_SPECIAL_VEHICLE
@@ -153,6 +153,7 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.taxi_traffic_tachexiaoche TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.taxi_traffic_tachexiaoche
TYPE_TRAFFIC_ID_MOTO.type -> R.raw.taxi_traffic_motuoche TYPE_TRAFFIC_ID_MOTO.type -> R.raw.taxi_traffic_motuoche
TYPE_TRAFFIC_ID_BUS.type -> R.raw.taxi_traffic_daba TYPE_TRAFFIC_ID_BUS.type -> R.raw.taxi_traffic_daba
TYPE_TRAFFIC_ID_CONE.type -> R.raw.sanjiaozhui
TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.taxi_traffic_daba TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.taxi_traffic_daba
TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle
@@ -170,6 +171,7 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.traffic_tachexiaoche_day TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.traffic_tachexiaoche_day
TYPE_TRAFFIC_ID_MOTO.type -> R.raw.traffic_motuoche_day TYPE_TRAFFIC_ID_MOTO.type -> R.raw.traffic_motuoche_day
TYPE_TRAFFIC_ID_BUS.type -> R.raw.traffic_daba_day TYPE_TRAFFIC_ID_BUS.type -> R.raw.traffic_daba_day
TYPE_TRAFFIC_ID_CONE.type -> R.raw.sanjiaozhui
TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.traffic_daba_day TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.traffic_daba_day
TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle
@@ -190,6 +192,7 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.taxi_traffic_tachexiaoche TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.taxi_traffic_tachexiaoche
TYPE_TRAFFIC_ID_MOTO.type -> R.raw.taxi_traffic_motuoche TYPE_TRAFFIC_ID_MOTO.type -> R.raw.taxi_traffic_motuoche
TYPE_TRAFFIC_ID_BUS.type -> R.raw.taxi_traffic_daba TYPE_TRAFFIC_ID_BUS.type -> R.raw.taxi_traffic_daba
TYPE_TRAFFIC_ID_CONE.type -> R.raw.sanjiaozhui
TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.taxi_traffic_daba TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.taxi_traffic_daba
TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle
@@ -207,6 +210,7 @@ enum class TrafficTypeEnum(
TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.traffic_tachexiaoche TYPE_TRAFFIC_ID_TA_CHE.type -> R.raw.traffic_tachexiaoche
TYPE_TRAFFIC_ID_MOTO.type -> R.raw.traffic_motuoche TYPE_TRAFFIC_ID_MOTO.type -> R.raw.traffic_motuoche
TYPE_TRAFFIC_ID_BUS.type -> R.raw.traffic_daba TYPE_TRAFFIC_ID_BUS.type -> R.raw.traffic_daba
TYPE_TRAFFIC_ID_CONE.type -> R.raw.sanjiaozhui
TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.traffic_daba TYPE_TRAFFIC_ID_TRUCK.type -> R.raw.traffic_daba
TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou TYPE_TRAFFIC_ID_CAMERA.type -> R.raw.shexiangtou
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> R.raw.special_vehicle

View File

@@ -19,5 +19,6 @@ data class FMInfoMsg(
data class FMFilterInfoMsg( data class FMFilterInfoMsg(
var fmInfoList: List<FmInfo.FaultInfo>?, var fmInfoList: List<FmInfo.FaultInfo>?,
var policyCode: String?, var policyCode: String?,
var cacheFilterList: MutableList<String>? var cacheFilterList: MutableList<String>?,
var receiveTime: Long
) )

View File

@@ -15,19 +15,19 @@ class MsgFmData{
val faultLevel: Int//故障处理级别 val faultLevel: Int//故障处理级别
){ ){
//请求平行驾驶接管 //请求平行驾驶接管
FM_ACT_NEED_PARALLEL_DERVING_TAKEOVER("恢复策略","请求平行驾驶接管","FM_ACT_NEED_PARALLEL_DERVING_TAKEOVER","如planing出站时规划失败",5), FM_ACT_NEED_PARALLEL_DERVING_TAKEOVER("恢复策略","请求平行驾驶接管","FM_ACT_NEED_PARALLEL_DERVING_TAKEOVER","如planing出站时规划失败",3),
//请求人工驾驶接管 //请求人工驾驶接管
FM_ACT_NEED_MANNUAL_DERVING("恢复策略","请求人工驾驶接管","FM_ACT_NEED_MANNUAL_DERVING","如planing规划失败且存在弱网判断",6), FM_ACT_NEED_MANNUAL_DERVING("恢复策略","请求人工驾驶接管","FM_ACT_NEED_MANNUAL_DERVING","如planing规划失败且存在弱网判断",0),
//系统重启 //系统重启
FM_ACT_NEED_RESTART_SYSTEM("恢复策略","系统重启","FM_ACT_NEED_RESTART_SYSTEM","如检测到出现多个节点奔溃",4), FM_ACT_NEED_RESTART_SYSTEM("恢复策略","系统重启","FM_ACT_NEED_RESTART_SYSTEM","如检测到出现多个节点奔溃",2),
//整车下电重启 //整车下电重启
FM_ACT_MUST_VEHICLE_POWER_RESET("恢复策略","整车下电重启","FM_ACT_MUST_VEHICLE_POWER_RESET","如底盘无数据,需要下电重启",7), FM_ACT_MUST_VEHICLE_POWER_RESET("恢复策略","整车下电重启","FM_ACT_MUST_VEHICLE_POWER_RESET","如底盘无数据,需要下电重启",1),
//请联系硬件工程师 //请联系硬件工程师
FM_ACT_CONTACT_HARDWARE_ENGINEER("人工处理","请联系硬件工程师","FM_ACT_CONTACT_HARDWARE_ENGINEER","硬件接线,域控启动等故障",3), FM_ACT_CONTACT_HARDWARE_ENGINEER("人工处理","请联系硬件工程师","FM_ACT_CONTACT_HARDWARE_ENGINEER","硬件接线,域控启动等故障",4),
//请联系运维工程师 //请联系运维工程师
FM_ACT_CONTACT_OPERATIONS_ENGINEER("人工处理","请联系运维工程师","FM_ACT_CONTACT_OPERATIONS_ENGINEER","系统配置不对,网络等故障",2), FM_ACT_CONTACT_OPERATIONS_ENGINEER("人工处理","请联系运维工程师","FM_ACT_CONTACT_OPERATIONS_ENGINEER","系统配置不对,网络等故障",4),
//请联系软件工程师 //请联系软件工程师
FM_ACT_CONTACT_SOFTWARE_ENGINEER("人工处理","请联系软件工程师","FM_ACT_CONTACT_SOFTWARE_ENGINEER","节点挂掉,无法启动等故障",1); FM_ACT_CONTACT_SOFTWARE_ENGINEER("人工处理","请联系软件工程师","FM_ACT_CONTACT_SOFTWARE_ENGINEER","节点挂掉,无法启动等故障",4);
companion object{ companion object{

View File

@@ -12,6 +12,11 @@ interface IMoGoAutopilotCarConfigListener {
* *
* @param carConfigResp 包括docker版本macAddress等基础信息详见proto * @param carConfigResp 包括docker版本macAddress等基础信息详见proto
*/ */
fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp){}
/**
* 与工控证书验证结果
*/
fun onCertificationResult(msg: String){}
} }

View File

@@ -8,4 +8,6 @@ interface IMoGoCertProvider:IProvider {
fun getDeviceCrtF():String? fun getDeviceCrtF():String?
fun getRootCrtF(): String? fun getRootCrtF(): String?
fun getCrtFileErrorMsg(): String?
} }

View File

@@ -6,6 +6,11 @@ interface IMoGoCloudListener{
//单独线程 //单独线程
fun authCrtFile(device:String, root:String){} fun authCrtFile(device:String, root:String){}
/**
* 下载证书文件异常
*/
fun authCrtError(errorMsg: String){}
fun tokenGot(token: String, sn: String){} fun tokenGot(token: String, sn: String){}
/** /**

View File

@@ -26,6 +26,8 @@ interface IMsgBoxProvider: IMoGoFunctionServerProvider {
*/ */
fun getCachedRecordBagData(): List<MsgBoxBean> fun getCachedRecordBagData(): List<MsgBoxBean>
fun queryFMInfoList(context: Context, startTime: Long, endTime: Long): List<MsgBoxBean>
fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String) fun removeRecordInfo(context: Context, msgBoxBean: MsgBoxBean, key: String)
fun getDismissTime(): Long fun getDismissTime(): Long

View File

@@ -13,7 +13,7 @@ interface IMoGoLogRecordProvider {
fun export(): File? fun export(): File?
fun upload() fun upload(startTime: Long, endTime: Long)
fun testJavaCrash(runOnNewThread: Boolean) fun testJavaCrash(runOnNewThread: Boolean)

View File

@@ -11,11 +11,16 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
private var mCarConfigResp: MessagePad.CarConfigResp? = null private var mCarConfigResp: MessagePad.CarConfigResp? = null
@Volatile
private var certFileMsg = "未开启认证"
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotCarConfigListener) { override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotCarConfigListener) {
mCarConfigResp?.let { mCarConfigResp?.let {
listener.onAutopilotCarConfig(it) listener.onAutopilotCarConfig(it)
} }
listener.onCertificationResult(certFileMsg)
} }
/** /**
* 工控机基础信息回调 * 工控机基础信息回调
* @param carConfigResp * @param carConfigResp
@@ -33,5 +38,17 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
} }
} }
@Synchronized
fun invokeAutopilotCertFileResult(msg: String) {
certFileMsg = msg
M_LISTENERS.forEach {
val listener = it.value
listener.onCertificationResult(msg)
}
}
fun getCertFileResult(): String {
return certFileMsg
}
} }

View File

@@ -17,10 +17,10 @@ object CallerChassisLamplightListenerManager : CallerBase<IMoGoChassisLamplightL
* @param lightSwitch * @param lightSwitch
*/ */
fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) { fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) {
val switch = getTurnLightState(lightSwitch) // val switch = getTurnLightState(lightSwitch)
M_LISTENERS.forEach { M_LISTENERS.forEach {
val listener = it.value val listener = it.value
listener.onAutopilotLightSwitchData(switch) listener.onAutopilotLightSwitchData(lightSwitch)
} }
} }

View File

@@ -4,6 +4,7 @@ import com.mogo.eagle.core.data.msgbox.FMFilterInfoMsg
import com.mogo.eagle.core.data.msgbox.FMInfoMsg import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.autopilot.IMoGoFaultManagementStateListener import com.mogo.eagle.core.function.api.autopilot.IMoGoFaultManagementStateListener
import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -39,7 +40,11 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
//判断两个集合重复 true:return //判断两个集合重复 true:return
var sameResult = false var sameResult = false
list.forEach { list.forEach {
sameResult = fmFilterInfoMsg.cacheFilterList?.contains(it.faultId) == true if(fmFilterInfoMsg.cacheFilterList?.contains(it.faultId) == true){
if(System.currentTimeMillis()-fmFilterInfoMsg.receiveTime < 10*60*1000){
sameResult = true
}
}
} }
if (sameResult) { if (sameResult) {
return return
@@ -52,6 +57,7 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
fmFilterInfoMsg.cacheFilterList?.clear() fmFilterInfoMsg.cacheFilterList?.clear()
fmFilterInfoMsg.cacheFilterList = cacheFaultList fmFilterInfoMsg.cacheFilterList = cacheFaultList
fmFilterInfoMsg.fmInfoList = list fmFilterInfoMsg.fmInfoList = list
fmFilterInfoMsg.receiveTime = System.currentTimeMillis()
cachePolicyMap[policyCode] = fmFilterInfoMsg cachePolicyMap[policyCode] = fmFilterInfoMsg
CallerTrace.write("FaultMsg",fmInfo) CallerTrace.write("FaultMsg",fmInfo)
CallerMsgBoxManager.saveMsgBoxHasPB( CallerMsgBoxManager.saveMsgBoxHasPB(
@@ -66,7 +72,7 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
list.forEach { list.forEach {
cacheFaultList.add(it.faultId) cacheFaultList.add(it.faultId)
} }
cachePolicyMap[policyCode] = FMFilterInfoMsg(list, policyCode, cacheFaultList) cachePolicyMap[policyCode] = FMFilterInfoMsg(list, policyCode, cacheFaultList,System.currentTimeMillis())
CallerTrace.write("FaultMsg",fmInfo) CallerTrace.write("FaultMsg",fmInfo)
CallerMsgBoxManager.saveMsgBoxHasPB( CallerMsgBoxManager.saveMsgBoxHasPB(
MsgBoxBean( MsgBoxBean(

View File

@@ -27,6 +27,14 @@ object CallerCloudCertManager {
} }
fun getDeviceCrtF(): String? { fun getDeviceCrtF(): String? {
return certProviderApi.getDeviceCrtF()
}
fun getRootCrtF(): String? {
return certProviderApi.getRootCrtF()
}
fun getDeviceCrtFDecode(): String? {
var crt = certProviderApi.getDeviceCrtF() var crt = certProviderApi.getDeviceCrtF()
if (!crt.isNullOrEmpty()) { if (!crt.isNullOrEmpty()) {
crt = String(Base64.decode(crt, Base64.NO_WRAP), StandardCharsets.UTF_8) crt = String(Base64.decode(crt, Base64.NO_WRAP), StandardCharsets.UTF_8)
@@ -34,11 +42,15 @@ object CallerCloudCertManager {
return crt return crt
} }
fun getRootCrtF(): String? { fun getRootCrtFDecode(): String? {
var crt = certProviderApi.getRootCrtF() var crt = certProviderApi.getRootCrtF()
if (!crt.isNullOrEmpty()) { if (!crt.isNullOrEmpty()) {
crt = String(Base64.decode(crt, Base64.NO_WRAP), StandardCharsets.UTF_8) crt = String(Base64.decode(crt, Base64.NO_WRAP), StandardCharsets.UTF_8)
} }
return crt return crt
} }
fun getCrtFileErrorMsg(): String? {
return certProviderApi.getCrtFileErrorMsg()
}
} }

View File

@@ -17,6 +17,12 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) { if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) {
listener.tokenGot(token!!, sn!!) listener.tokenGot(token!!, sn!!)
} }
if(CallerCloudCertManager.getDeviceCrtF()!= null && CallerCloudCertManager.getRootCrtF()!= null){
listener.authCrtFile(CallerCloudCertManager.getDeviceCrtF()!!, CallerCloudCertManager.getRootCrtF()!!)
}
if(CallerCloudCertManager.getCrtFileErrorMsg()!= null){
listener.authCrtError(CallerCloudCertManager.getCrtFileErrorMsg()!!)
}
} }
fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) { fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) {
@@ -26,6 +32,13 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
} }
} }
fun invokeCloudCrtError(errorMsg: String){
M_LISTENERS.forEach {
val listener = it.value
listener.authCrtError(errorMsg)
}
}
/** /**
* 分发获取到的设备sn * 分发获取到的设备sn
*/ */

View File

@@ -64,6 +64,13 @@ object CallerMsgBoxManager {
return providerApi?.getCachedRecordBagData() return providerApi?.getCachedRecordBagData()
} }
/**
* 查询一段时间范围内的FM数据集合
*/
fun queryFMInfoList(context: Context, startTime: Long, endTime: Long): List<MsgBoxBean>? {
return providerApi?.queryFMInfoList(context, startTime, endTime)
}
/** /**
* 用户已处理的Bag包需要删除(上传或取消都包含) * 用户已处理的Bag包需要删除(上传或取消都包含)
* key: Bag包的唯一标识key, msgBoxBean: UI展示的那个对象而不是重新new的 * key: Bag包的唯一标识key, msgBoxBean: UI展示的那个对象而不是重新new的

View File

@@ -84,4 +84,13 @@ object DownloadUtils {
} }
.launchIn(scope) .launchIn(scope)
} }
fun getAllDownloadRecords(): List<Pair<String, String>> {
if (Downloader.hasInit()) {
return runBlocking {
Downloader.getAllDownloadRecords() ?: emptyList()
}
}
return emptyList()
}
} }

View File

@@ -1,6 +1,6 @@
apply plugin: 'LancetX' apply plugin: 'LancetX'
LancetX { LancetX {
enable true enable false
enableInDebug true enableInDebug true
blackList = [ blackList = [
"com.mogo.launcher.lancet.jank", "com.mogo.launcher.lancet.jank",

View File

@@ -2,7 +2,7 @@ if (!rootProject.isReleaseBuild()) {
apply plugin: 'bytex.matrix' apply plugin: 'bytex.matrix'
matrix { matrix {
trace { trace {
enable = true //if you don't want to use trace canary, set false enable = false //if you don't want to use trace canary, set false
baseMethodMapFile = "${project.buildDir}/matrix_output/customMethodMapping.txt" baseMethodMapFile = "${project.buildDir}/matrix_output/customMethodMapping.txt"
blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt" blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt"
} }

View File

@@ -1,6 +1,6 @@
apply plugin: 'bytex.threadOpt' apply plugin: 'bytex.threadOpt'
thread_opt { thread_opt {
enable true enable false
enableInDebug true enableInDebug true
logLevel "DEBUG" logLevel "DEBUG"
trace_enable !rootProject.isReleaseBuild() trace_enable !rootProject.isReleaseBuild()

View File

@@ -1,7 +1,9 @@
package com.zhjt.mogo.adas.data.bean; package com.zhjt.mogo.adas.data.bean;
public class ReportCodeInfo { import android.text.TextUtils;
public final String code;
public class ReportInfo {
public final String name;
/** /**
* 开始支持的版本包含 * 开始支持的版本包含
*/ */
@@ -12,17 +14,14 @@ public class ReportCodeInfo {
*/ */
public final String deprecatedVersion; public final String deprecatedVersion;
public ReportCodeInfo(String code, String sinceVersion, String deprecatedVersion) { public ReportInfo(String name, String sinceVersion, String deprecatedVersion) {
this.code = code; this.name = name;
this.sinceVersion = sinceVersion; this.sinceVersion = sinceVersion;
this.deprecatedVersion = deprecatedVersion; this.deprecatedVersion = deprecatedVersion;
} }
@Override @Override
public String toString() { public String toString() {
return code + return name + " 开始支持版本(包含)=" + sinceVersion + (TextUtils.isEmpty(deprecatedVersion) ? "" : ", 弃用版本(不包含)='" + deprecatedVersion);
" sinceVersion='" + sinceVersion + '\'' +
", deprecatedVersion='" + deprecatedVersion + '\'' +
'}';
} }
} }

View File

@@ -7,13 +7,13 @@ import java.lang.annotation.Target;
/** /**
* MAP系统消息报告版本管理 * MAP系统消息报告版本管理
* 主要用于标记新增Code的版本以及标记弃用的的Code * 主要用于标记新增ResultActionCode的版本以及标记弃用的ResultActionCode
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface CodeInfo { public @interface ReportState {
String value();//Code新增版本 String value();//新增版本
String deprecated() default "";//Code弃用版本 String deprecated() default "";//弃用版本
} }

View File

@@ -29,7 +29,6 @@ public class UnableLaunchReason {
CHASSIS_THROTTLE,//油门 CHASSIS_THROTTLE,//油门
CHASSIS_STEERING,//方向盘 CHASSIS_STEERING,//方向盘
CHASSIS_HAZARD_LIGHTS,//危险报警灯 CHASSIS_HAZARD_LIGHTS,//危险报警灯
PARKING_BRAKE,//制动系统,手刹,电子驻车制动系统
SSM_OFFER,//SSM提供的原因 SSM_OFFER,//SSM提供的原因
FSM_OFFER,//FSM提供的原因 FSM_OFFER,//FSM提供的原因
SSM_TIMEOUT//SSM超时 SSM_TIMEOUT//SSM超时

View File

@@ -207,7 +207,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
this.adasOptions = options; this.adasOptions = options;
} }
ReceiveTimeoutManager.getInstance().setEnable(adasOptions.isEnableTimeoutDetection(), getIpcConnectionStatus()); ReceiveTimeoutManager.getInstance().setEnable(adasOptions.isEnableTimeoutDetection(), getIpcConnectionStatus());
setUnableLaunchAutopilotGear(adasOptions.getUnableLaunchAutopilotGear()); setLaunchAutopilotGear(adasOptions.getLaunchAutopilotGear());
} }
/** /**
@@ -850,6 +850,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
ipcConnectedIp = (String) args[0]; ipcConnectedIp = (String) args[0];
ipcConnectedPort = (int) args[1]; ipcConnectedPort = (int) args[1];
} }
myMessageFactory.initTurnLightState();
seqSpecialVehicle = 0; seqSpecialVehicle = 0;
AutopilotAbilityManager.getInstance().start(); AutopilotAbilityManager.getInstance().start();
ParallelDrivingManager.getInstance().start(); ParallelDrivingManager.getInstance().start();
@@ -1119,9 +1120,14 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
adasOptionsBuild(adasOptionsToBuilder().setAutoConnect(enable)); adasOptionsBuild(adasOptionsToBuilder().setAutoConnect(enable));
} }
/**
* 设置可以启动自动驾驶的档位
*
* @param launchAutopilotGear 能起自驾档位 null表示所有档位都可启动
*/
@Override @Override
public void setUnableLaunchAutopilotGear(Set<Chassis.GearPosition> unableLaunchAutopilotGear) { public void setLaunchAutopilotGear(@Nullable Set<Chassis.GearPosition> launchAutopilotGear) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(unableLaunchAutopilotGear); AutopilotAbilityManager.getInstance().setLaunchAutopilotGear(launchAutopilotGear);
} }
/** /**

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.zhidao.support.adas.high.bean.VersionCompatibility; import com.zhidao.support.adas.high.bean.VersionCompatibility;
@@ -1794,13 +1795,13 @@ public class AdasManager implements IAdasNetCommApi {
} }
/** /**
* 设置不能启动自动驾驶的档位 * 设置可以启动自动驾驶的档位
* *
* @param unableLaunchAutopilotGear 能起自驾档位 * @param launchAutopilotGear 能起自驾档位 null表示所有档位都可启动
*/ */
@Override @Override
public void setUnableLaunchAutopilotGear(Set<Chassis.GearPosition> unableLaunchAutopilotGear) { public void setLaunchAutopilotGear(@Nullable Set<Chassis.GearPosition> launchAutopilotGear) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(unableLaunchAutopilotGear); AutopilotAbilityManager.getInstance().setLaunchAutopilotGear(launchAutopilotGear);
} }
/** /**

View File

@@ -51,7 +51,7 @@ public class AdasOptions {
private final String deviceCrt; private final String deviceCrt;
private final boolean isAutoConnect; private final boolean isAutoConnect;
private final Set<SubscribeInterfaceOption> subscribeInterfaceOptions; private final Set<SubscribeInterfaceOption> subscribeInterfaceOptions;
private final Set<Chassis.GearPosition> unableLaunchAutopilotGear; private final Set<Chassis.GearPosition> launchAutopilotGear;
private AdasOptions(Builder builder) { private AdasOptions(Builder builder) {
@@ -66,7 +66,7 @@ public class AdasOptions {
this.deviceCrt = builder.deviceCrt; this.deviceCrt = builder.deviceCrt;
this.isAutoConnect = builder.isAutoConnect; this.isAutoConnect = builder.isAutoConnect;
this.subscribeInterfaceOptions = builder.subscribeInterfaceOptions; this.subscribeInterfaceOptions = builder.subscribeInterfaceOptions;
this.unableLaunchAutopilotGear = builder.unableLaunchAutopilotGear; this.launchAutopilotGear = builder.launchAutopilotGear;
} }
public boolean isPassenger() { public boolean isPassenger() {
@@ -113,8 +113,8 @@ public class AdasOptions {
return subscribeInterfaceOptions; return subscribeInterfaceOptions;
} }
public Set<Chassis.GearPosition> getUnableLaunchAutopilotGear() { public Set<Chassis.GearPosition> getLaunchAutopilotGear() {
return unableLaunchAutopilotGear; return launchAutopilotGear;
} }
public static Builder newBuilder() { public static Builder newBuilder() {
@@ -141,7 +141,7 @@ public class AdasOptions {
private String deviceCrt; private String deviceCrt;
private boolean isAutoConnect = DEFAULT.IS_AUTO_CONNECT; private boolean isAutoConnect = DEFAULT.IS_AUTO_CONNECT;
private Set<SubscribeInterfaceOption> subscribeInterfaceOptions; private Set<SubscribeInterfaceOption> subscribeInterfaceOptions;
private Set<Chassis.GearPosition> unableLaunchAutopilotGear; private Set<Chassis.GearPosition> launchAutopilotGear;
private Builder() { private Builder() {
@@ -159,7 +159,7 @@ public class AdasOptions {
this.deviceCrt = options.deviceCrt; this.deviceCrt = options.deviceCrt;
this.isAutoConnect = options.isAutoConnect; this.isAutoConnect = options.isAutoConnect;
this.subscribeInterfaceOptions = options.subscribeInterfaceOptions; this.subscribeInterfaceOptions = options.subscribeInterfaceOptions;
this.unableLaunchAutopilotGear = options.unableLaunchAutopilotGear; this.launchAutopilotGear = options.launchAutopilotGear;
} }
@@ -276,8 +276,8 @@ public class AdasOptions {
/** /**
* 设备证书 * 设备证书
* 启用认证后如果不传递,必须在调用以下方法时传递 * 启用认证后如果不传递,必须在调用以下方法时传递
* {@link AdasManager#sendBasicInfoResp(String, AdasConstants.Environment, AdasConstants.TerminalRole, String)} * {@link AdasManager#sendBasicInfoResp(String, int, int, String)}
* {@link AdasManager#sendBasicInfoResp(String, AdasConstants.Environment, AdasConstants.TerminalRole, int, String, String)} * {@link AdasManager#sendBasicInfoResp(String, int, int, int, String, String)}
* *
* @param deviceCrt root证书 * @param deviceCrt root证书
* @return Builder * @return Builder
@@ -325,13 +325,13 @@ public class AdasOptions {
} }
/** /**
* 能启动自驾的档位 * 能启动自驾的档位
* *
* @param unableLaunchAutopilotGear 档位 * @param launchAutopilotGear 能起自驾档位 null表示所有档位都可启动
* @return Builder * @return Builder
*/ */
public Builder setUnableLaunchAutopilotGear(Set<Chassis.GearPosition> unableLaunchAutopilotGear) { public Builder setLaunchAutopilotGear(Set<Chassis.GearPosition> launchAutopilotGear) {
this.unableLaunchAutopilotGear = unableLaunchAutopilotGear; this.launchAutopilotGear = launchAutopilotGear;
return this; return this;
} }

View File

@@ -1,6 +1,7 @@
package com.zhidao.support.adas.high; package com.zhidao.support.adas.high;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.zhidao.support.adas.high.bean.VersionCompatibility; import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.Constants; import com.zhidao.support.adas.high.common.Constants;
@@ -145,11 +146,11 @@ public interface IAdasNetCommApi {
void setAutoConnect(boolean enable); void setAutoConnect(boolean enable);
/** /**
* 设置不能启动自动驾驶的档位 * 设置可以启动自动驾驶的档位
* *
* @param unableLaunchAutopilotGear 能起自驾档位 * @param launchAutopilotGear 能起自驾档位 null表示所有档位都可启动
*/ */
void setUnableLaunchAutopilotGear(Set<Chassis.GearPosition> unableLaunchAutopilotGear); void setLaunchAutopilotGear(@Nullable Set<Chassis.GearPosition> launchAutopilotGear);
/** /**
* 自动驾驶设备基础信息应答 * 自动驾驶设备基础信息应答

View File

@@ -26,6 +26,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import java.util.ArrayList; import java.util.ArrayList;
import bag_manager.BagManagerOuterClass; import bag_manager.BagManagerOuterClass;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass; import chassis.ChassisStatesOuterClass;
import chassis.VehicleStateOuterClass; import chassis.VehicleStateOuterClass;
import fault_management.FmInfo; import fault_management.FmInfo;
@@ -98,6 +99,16 @@ public interface OnAdasListener {
*/ */
void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates); void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates);
/**
* 底盘车灯状态 转换过的可以直接使用
* 例如:
* 原始右转数据: 0 2 0 2 0 2。。。
* 转换之后数据: 2 2 2 2 2 2。。。
*
* @param light 车灯 目前域控发送车灯有 左传{@link Chassis.LightSwitch#LIGHT_LEFT} 右转{@link Chassis.LightSwitch#LIGHT_RIGHT} 危险报警灯{@link Chassis.LightSwitch#LIGHT_FLASH}
*/
void onLightSwitch(@NonNull Chassis.LightSwitch light);
/** /**
* 自动驾驶状态 * 自动驾驶状态
* *

View File

@@ -0,0 +1,34 @@
package com.zhidao.support.adas.high.common;
public class TurnLightState {
private boolean m_state;
private double m_lastOnTime;
public TurnLightState() {
init();
}
public void init() {
this.m_state = false;
this.m_lastOnTime = 0.0;
}
public boolean update(boolean state) {
long t = System.currentTimeMillis();
if (state) {
// on!
m_state = true;
m_lastOnTime = t;
} else {
// off?
if (m_state && (t - m_lastOnTime > 500)) {
m_state = false;
}
}
return m_state;
}
public boolean getState() {
return m_state;
}
}

View File

@@ -1,5 +1,7 @@
package com.zhidao.support.adas.high.common.autopilot.ability; package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData; import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
@@ -7,9 +9,6 @@ import java.util.ArrayList;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
/** /**
* 是否可以启动自动驾驶能力检测 工控机版本>=230&& <250 使用此类 * 是否可以启动自动驾驶能力检测 工控机版本>=230&& <250 使用此类
* 目前监控了底盘的一些状态和查询节点状态应答的数据 * 目前监控了底盘的一些状态和查询节点状态应答的数据
@@ -17,58 +16,27 @@ import chassis.ChassisStatesOuterClass;
* <p> * <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/ */
public class AutopilotAbility230 { public class AutopilotAbility230 extends BaseAutopilotAbilityChassis {
private static final String TAG = AutopilotAbility230.class.getSimpleName();
private volatile Timer timer; private volatile Timer timer;
private ChassisStatesOuterClass.ChassisStates chassisStates;
private OnAutopilotAbilityListener listener;
protected AutopilotAbility230() { public AutopilotAbility230(@NonNull AutopilotAbilityManager manager) {
} super(manager);
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
this.chassisStates = chassisStates;
} }
private void onCallback() { private void onCallback() {
boolean isAutopilotAbility = true;//是否能启动自动驾驶
ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因 ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
//检测底盘相关 unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (chassisStates != null) {
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_BRAKE, AutopilotAbilityManager.REASON_CHASSIS_BRAKE);
}
}
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_GEAR, AutopilotAbilityManager.REASON_CHASSIS_GEAR);
}
}
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
// //电子驻车制动系统
// if (chassisStates.hasEpbSystemStates()) {
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
// if (epb.hasEpbEnableState()){
// epb.getEpbWorkState();
// }
// }
}
if (listener != null) { if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, null, null), unableAutopilotReasons); listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, null, null), unableAutopilotReasons);
} }
} }
protected synchronized void start(OnAutopilotAbilityListener listener) { @Override
this.listener = listener; public synchronized void start(OnAutopilotAbilityListener listener) {
super.start(listener);
if (timer == null) { if (timer == null) {
timer = new Timer(); timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@@ -80,12 +48,13 @@ public class AutopilotAbility230 {
} }
} }
@Override
protected synchronized void stop() { protected synchronized void stop() {
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
timer = null; timer = null;
} }
this.chassisStates = null; super.stop();
this.listener = null;
} }
} }

View File

@@ -1,5 +1,7 @@
package com.zhidao.support.adas.high.common.autopilot.ability; package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData; import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
@@ -10,9 +12,6 @@ import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import chassis.VehicleStateOuterClass;
import system_master.SystemStatusInfo; import system_master.SystemStatusInfo;
/** /**
@@ -22,24 +21,13 @@ import system_master.SystemStatusInfo;
* <p> * <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/ */
public class AutopilotAbility250 { public class AutopilotAbility250 extends BaseAutopilotAbilityChassis {
private static final String TAG = AutopilotAbility250.class.getSimpleName();
private volatile Timer timer; private volatile Timer timer;
private ChassisStatesOuterClass.ChassisStates chassisStates;
private VehicleStateOuterClass.VehicleState vehicleState;
private int mapVersion = -1;//MAP版本
private int masterVersion = -1;//Master版本 private int masterVersion = -1;//Master版本
private boolean isHQ = false;//是否是HQ
private boolean isDF = false;//是否是DF
private boolean isM1 = false;//是否是M1
private OnAutopilotAbilityListener listener;
protected AutopilotAbility250(int mapVersion, boolean isHQ, boolean isDF, boolean isM1) {
this.mapVersion = mapVersion; public AutopilotAbility250(@NonNull AutopilotAbilityManager manager) {
this.isHQ = isHQ; super(manager);
this.isDF = isDF;
this.isM1 = isM1;
this.masterVersion = -1;
} }
@@ -47,16 +35,8 @@ public class AutopilotAbility250 {
onCallback(statusInfo); onCallback(statusInfo);
} }
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
this.chassisStates = chassisStates;
}
protected void setVehicleState(VehicleStateOuterClass.VehicleState vehicleState) {
this.vehicleState = vehicleState;
}
private void onCallback(SystemStatusInfo.StatusInfo statusInfo) { private void onCallback(SystemStatusInfo.StatusInfo statusInfo) {
boolean isAutopilotAbility = true;//是否能启动自动驾驶
ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因 ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
//检测节点状态相关 //检测节点状态相关
if (statusInfo != null) { if (statusInfo != null) {
@@ -67,13 +47,11 @@ public class AutopilotAbility250 {
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion); CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
//SSM 3版本兼容 //SSM 3版本兼容
if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady(); if (!statusInfo.getAutoPilotReady()) {
if (!isAutopilotAbility) { unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
} }
} else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 } else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady(); if (!statusInfo.getAutoPilotReady()) {
if (!isAutopilotAbility) {
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList(); SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
if (nodeFaultList.getSum() > 0) { if (nodeFaultList.getSum() > 0) {
List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList(); List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList();
@@ -81,20 +59,20 @@ public class AutopilotAbility250 {
String nodeName = info.getNodeName(); String nodeName = info.getNodeName();
int state = info.getState(); int state = info.getState();
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) { if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常");
} }
} }
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点");
} }
} }
} else { } else {
SystemStatusInfo.SystemState systemState = statusInfo.getSysState(); SystemStatusInfo.SystemState systemState = statusInfo.getSysState();
// 目前已知可以下发启动自驾命令的状态: SystemState.SYS_RUNNING、SystemState.PILOT_READY、SystemState.AUTO_PILOT_STARTING、SystemState.AUTO_PILOT_RUNNING // 目前已知可以下发启动自驾命令的状态: SystemState.SYS_RUNNING、SystemState.PILOT_READY、SystemState.AUTO_PILOT_STARTING、SystemState.AUTO_PILOT_RUNNING
if (systemState != SystemStatusInfo.SystemState.SYS_RUNNING && systemState != SystemStatusInfo.SystemState.PILOT_READY) { if (systemState != SystemStatusInfo.SystemState.SYS_RUNNING && systemState != SystemStatusInfo.SystemState.PILOT_READY) {
isAutopilotAbility = false; boolean isAutopilotAbility = false;
String unableAutopilotReason = null; String unableAutopilotReason = null;
if (systemState == SystemStatusInfo.SystemState.SYS_STARTING) { if (systemState == SystemStatusInfo.SystemState.SYS_STARTING) {
unableAutopilotReason = "系统正在启动"; unableAutopilotReason = "系统正在启动";
@@ -118,51 +96,24 @@ public class AutopilotAbility250 {
unableAutopilotReason = "未知系统状态"; unableAutopilotReason = "未知系统状态";
} }
if (!isAutopilotAbility) { if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason);
} }
} }
} }
} else { } else {
isAutopilotAbility = false;//是否能启动自动驾驶 unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM查询超时无响应");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM查询超时无响应");
} }
//检测底盘相关 //检测底盘相关
if (chassisStates != null) { unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_BRAKE, AutopilotAbilityManager.REASON_CHASSIS_BRAKE);
}
}
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_GEAR, AutopilotAbilityManager.REASON_CHASSIS_GEAR);
}
}
}
if ((!isHQ && !isDF && !isM1) || mapVersion < 30600) {
if (vehicleState != null) {
//TODO 关于手刹目前只有老底盘中存在这个字段df360开始其他车型未知
//电子驻车制动系统
if (vehicleState.hasParkingBrake()) {
boolean isBrake = vehicleState.getParkingBrake();
if (isBrake) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.PARKING_BRAKE, AutopilotAbilityManager.REASON_CHASSIS_PARKING_BRAKE);
}
}
}
}
if (listener != null) { if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, null), unableAutopilotReasons); listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, null), unableAutopilotReasons);
} }
} }
protected synchronized void start(OnAutopilotAbilityListener listener) { @Override
this.listener = listener; public synchronized void start(OnAutopilotAbilityListener listener) {
super.start(listener);
if (timer == null) { if (timer == null) {
timer = new Timer(); timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@@ -174,17 +125,17 @@ public class AutopilotAbility250 {
} }
} }
@Override
protected synchronized void stop() { protected synchronized void stop() {
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
timer = null; timer = null;
} }
this.chassisStates = null; masterVersion = -1;
this.masterVersion = -1; super.stop();
this.listener = null;
} }
protected void onCallTimeout() { protected void onCallTimeout() {
onCallback(null); onCallback(null);
} }

View File

@@ -2,6 +2,8 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData; import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
@@ -25,6 +27,8 @@ import system_master.SystemStatusInfo;
*/ */
public class AutopilotAbility330 { public class AutopilotAbility330 {
private static final String TAG = AutopilotAbility330.class.getSimpleName(); private static final String TAG = AutopilotAbility330.class.getSimpleName();
@NonNull
private final AutopilotAbilityManager manager;
private volatile Timer timer; private volatile Timer timer;
private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因 private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因
@@ -32,7 +36,8 @@ public class AutopilotAbility330 {
private int masterVersion = -1;//Master版本 private int masterVersion = -1;//Master版本
private OnAutopilotAbilityListener listener; private OnAutopilotAbilityListener listener;
protected AutopilotAbility330(int mapVersion) { protected AutopilotAbility330(@NonNull AutopilotAbilityManager manager, int mapVersion) {
this.manager = manager;
this.mapVersion = mapVersion; this.mapVersion = mapVersion;
this.masterVersion = -1; this.masterVersion = -1;
} }
@@ -60,7 +65,7 @@ public class AutopilotAbility330 {
if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady(); isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) { if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason()); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
} }
} else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 } else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady(); isAutopilotAbility = statusInfo.getAutoPilotReady();
@@ -72,13 +77,13 @@ public class AutopilotAbility330 {
String nodeName = info.getNodeName(); String nodeName = info.getNodeName();
int state = info.getState(); int state = info.getState();
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) { if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常");
} }
} }
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点");
} }
} }
} else { } else {
@@ -109,13 +114,13 @@ public class AutopilotAbility330 {
unableAutopilotReason = "未知系统状态"; unableAutopilotReason = "未知系统状态";
} }
if (!isAutopilotAbility) { if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason);
} }
} }
} }
} else { } else {
isAutopilotAbility = false;//是否能启动自动驾驶 isAutopilotAbility = false;//是否能启动自动驾驶
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM查询超时无响应"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM查询超时无响应");
} }
if (fsmStatusReasonRespond != null) { if (fsmStatusReasonRespond != null) {
int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount(); int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount();
@@ -124,11 +129,11 @@ public class AutopilotAbility330 {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i); String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i);
if (!TextUtils.isEmpty(respond)) { if (!TextUtils.isEmpty(respond)) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.FSM, UnableLaunchReason.UnableType.FSM_OFFER, respond); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.FSM, UnableLaunchReason.UnableType.FSM_OFFER, respond);
} }
} }
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) { if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.FSM_ERROR, "FSM数据异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.FSM_ERROR, "FSM数据异常");
} }
} }
} }

View File

@@ -1,5 +1,7 @@
package com.zhidao.support.adas.high.common.autopilot.ability; package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData; import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
@@ -7,9 +9,6 @@ import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList; import java.util.ArrayList;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import chassis.VehicleStateOuterClass;
import system_master.SsmInfo; import system_master.SsmInfo;
/** /**
@@ -18,42 +17,21 @@ import system_master.SsmInfo;
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
* <p> * <p>
*/ */
public class AutopilotAbility350And360 { public class AutopilotAbility350And360 extends BaseAutopilotAbilityChassis {
private static final String TAG = AutopilotAbility250.class.getSimpleName();
private ChassisStatesOuterClass.ChassisStates chassisStates;
private VehicleStateOuterClass.VehicleState vehicleState;
private int mapVersion = -1;//MAP版本
private int masterVersion = -1;//Master版本 private int masterVersion = -1;//Master版本
private boolean isHQ = false;//是否是HQ
private boolean isDF = false;//是否是DF
private boolean isM1 = false;//是否是M1
private OnAutopilotAbilityListener listener;
public AutopilotAbility350And360(@NonNull AutopilotAbilityManager manager) {
protected AutopilotAbility350And360(int mapVersion, boolean isHQ, boolean isDF, boolean isM1) { super(manager);
this.mapVersion = mapVersion;
this.isHQ = isHQ;
this.isDF = isDF;
this.isM1 = isM1;
this.masterVersion = -1;
} }
protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) { protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
onCallback(statusInfo); onCallback(statusInfo);
} }
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
this.chassisStates = chassisStates;
}
protected void setVehicleState(VehicleStateOuterClass.VehicleState vehicleState) {
this.vehicleState = vehicleState;
}
private void onCallback(SsmInfo.SsmStatusInf statusInfo) { private void onCallback(SsmInfo.SsmStatusInf statusInfo) {
boolean isAutopilotAbility = true;//是否能启动自动驾驶
ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因 ArrayList<UnableLaunchReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
//检测节点状态相关 //检测节点状态相关
if (statusInfo != null) { if (statusInfo != null) {
@@ -64,13 +42,11 @@ public class AutopilotAbility350And360 {
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion); CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
//SSM 3版本兼容 //SSM 3版本兼容
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady(); if (!statusInfo.getAutoPilotReady()) {
if (!isAutopilotAbility) { unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
} }
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 } else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady(); if (!statusInfo.getAutoPilotReady()) {
if (!isAutopilotAbility) {
int count = statusInfo.getAutoPilotUnreadyListCount(); int count = statusInfo.getAutoPilotUnreadyListCount();
if (count > 0) { if (count > 0) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@@ -78,19 +54,18 @@ public class AutopilotAbility350And360 {
String nodeName = info.getNodeName(); String nodeName = info.getNodeName();
int state = info.getState().getNumber(); int state = info.getState().getNumber();
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) { if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常");
} }
} }
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点");
} }
} }
} else { } else {
SsmInfo.ModeState modeState = statusInfo.getModeState(); SsmInfo.ModeState modeState = statusInfo.getModeState();
if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) { if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) {
isAutopilotAbility = false;
String unableAutopilotReason = null; String unableAutopilotReason = null;
if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) { if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) {
unableAutopilotReason = "系统处于停止模式(未就绪)"; unableAutopilotReason = "系统处于停止模式(未就绪)";
@@ -103,56 +78,29 @@ public class AutopilotAbility350And360 {
} else { } else {
unableAutopilotReason = "未知系统模式"; unableAutopilotReason = "未知系统模式";
} }
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason);
} }
} }
} else { } else {
isAutopilotAbility = false;//是否能启动自动驾驶 unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM超时无响应");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM超时无响应");
} }
//检测底盘相关 //检测底盘相关
if (chassisStates != null) { unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_BRAKE, AutopilotAbilityManager.REASON_CHASSIS_BRAKE);
}
}
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_GEAR, AutopilotAbilityManager.REASON_CHASSIS_GEAR);
}
}
}
if ((!isHQ && !isDF && !isM1) || mapVersion < 30600) {
if (vehicleState != null) {
//TODO 关于手刹目前只有老底盘中存在这个字段df360开始其他车型未知
//电子驻车制动系统
if (vehicleState.hasParkingBrake()) {
boolean isBrake = vehicleState.getParkingBrake();
if (isBrake) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.PARKING_BRAKE, AutopilotAbilityManager.REASON_CHASSIS_PARKING_BRAKE);
}
}
}
}
if (listener != null) { if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, null), unableAutopilotReasons); listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, null), unableAutopilotReasons);
} }
} }
protected void start(OnAutopilotAbilityListener listener) { @Override
this.listener = listener; public synchronized void start(OnAutopilotAbilityListener listener) {
super.start(listener);
} }
protected void stop() { @Override
this.chassisStates = null; protected synchronized void stop() {
this.masterVersion = -1; masterVersion = -1;
this.listener = null; super.stop();
} }
protected void onCallTimeout() { protected void onCallTimeout() {

View File

@@ -2,6 +2,8 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData; import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
@@ -20,12 +22,15 @@ import system_master.SsmInfo;
*/ */
public class AutopilotAbility360 { public class AutopilotAbility360 {
private static final String TAG = AutopilotAbility360.class.getSimpleName(); private static final String TAG = AutopilotAbility360.class.getSimpleName();
@NonNull
private final AutopilotAbilityManager manager;
private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因 private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因
private int masterVersion = -1;//Master版本 private int masterVersion = -1;//Master版本
private OnAutopilotAbilityListener listener; private OnAutopilotAbilityListener listener;
protected AutopilotAbility360() { protected AutopilotAbility360(@NonNull AutopilotAbilityManager manager) {
this.manager = manager;
this.masterVersion = -1; this.masterVersion = -1;
} }
@@ -52,7 +57,7 @@ public class AutopilotAbility360 {
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady(); isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) { if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason()); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, statusInfo.getAutoPilotUnreadyReason());
} }
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 } else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady(); isAutopilotAbility = statusInfo.getAutoPilotReady();
@@ -64,13 +69,13 @@ public class AutopilotAbility360 {
String nodeName = info.getNodeName(); String nodeName = info.getNodeName();
int state = info.getState().getNumber(); int state = info.getState().getNumber();
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) { if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, nodeName + "未知异常");
} }
} }
} else { } else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_ERROR, "未知异常节点");
} }
} }
} else { } else {
@@ -89,12 +94,12 @@ public class AutopilotAbility360 {
} else { } else {
unableAutopilotReason = "未知系统模式"; unableAutopilotReason = "未知系统模式";
} }
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.SSM, UnableLaunchReason.UnableType.SSM_OFFER, unableAutopilotReason);
} }
} }
} else { } else {
isAutopilotAbility = false;//是否能启动自动驾驶 isAutopilotAbility = false;//是否能启动自动驾驶
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM超时无响应"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.SSM_TIMEOUT, "SSM超时无响应");
} }
if (fsmStatusReasonRespond != null) { if (fsmStatusReasonRespond != null) {
int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount(); int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount();
@@ -103,11 +108,11 @@ public class AutopilotAbility360 {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i); String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i);
if (!TextUtils.isEmpty(respond)) { if (!TextUtils.isEmpty(respond)) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.FSM, UnableLaunchReason.UnableType.FSM_OFFER, respond); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.FSM, UnableLaunchReason.UnableType.FSM_OFFER, respond);
} }
} }
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) { if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.FSM_ERROR, "FSM数据异常"); unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.LIB, UnableLaunchReason.UnableType.FSM_ERROR, "FSM数据异常");
} }
} }
} }

View File

@@ -11,7 +11,6 @@ import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@@ -19,7 +18,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import chassis.Chassis; import chassis.Chassis;
import chassis.ChassisStatesOuterClass; import chassis.ChassisStatesOuterClass;
import chassis.VehicleStateOuterClass;
import function_state_management.FSMStatusReasonQueryOuterClass; import function_state_management.FSMStatusReasonQueryOuterClass;
import mogo.telematics.pad.MessagePad; import mogo.telematics.pad.MessagePad;
import system_master.SsmInfo; import system_master.SsmInfo;
@@ -38,17 +36,13 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
protected static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测周期 protected static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测周期
protected static final String[] NODE_INFO_STATE = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "人为启动状态", "人为关闭状态"}; protected static final String[] NODE_INFO_STATE = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "人为启动状态", "人为关闭状态"};
protected static final String[] NODE_INFO_STATE_FIXED_FREQUENCY = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "非自动启动状态", "非自动关闭状态"}; protected static final String[] NODE_INFO_STATE_FIXED_FREQUENCY = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "非自动启动状态", "非自动关闭状态"};
protected static final String REASON_CHASSIS_BRAKE = "请检查刹车踏板";
protected static final String REASON_CHASSIS_GEAR = "当前档位无法启动";
protected static final String REASON_CHASSIS_PARKING_BRAKE = "请检查手刹";
private static volatile AutopilotAbilityManager INSTANCE; private static volatile AutopilotAbilityManager INSTANCE;
private OnAdasListener listener; private OnAdasListener listener;
private int mapVersion = -1;//工控机版本 private int mapVersion = -1;//工控机版本
private boolean isFutianSweeper = false;//是否是福田清扫车 private boolean isFutianSweeper = false;//是否是福田清扫车
private boolean isJinlvM1 = false;//是否是M1 private boolean isJinlvM1 = false;//是否是M1
private boolean isHQ = false;//是否是HQ private boolean isHQ = false;//是否是HQ
private boolean isDF = false;//是否是DF
private boolean isM1 = false;//是否是M1
private AutopilotAbility230 autopilotAbility230; private AutopilotAbility230 autopilotAbility230;
private AutopilotAbility250 autopilotAbility250; private AutopilotAbility250 autopilotAbility250;
private AutopilotAbility330 autopilotAbility330; private AutopilotAbility330 autopilotAbility330;
@@ -61,9 +55,9 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
private final AtomicBoolean isOldSsmTimeout = new AtomicBoolean(false);//SSM是否超时 老状态 private final AtomicBoolean isOldSsmTimeout = new AtomicBoolean(false);//SSM是否超时 老状态
private final AtomicBoolean isInitCarConfig = new AtomicBoolean(false);//车辆信息是否初始化 private final AtomicBoolean isInitCarConfig = new AtomicBoolean(false);//车辆信息是否初始化
/** /**
* 能启动自动驾驶的档位 * 能启动自动驾驶的档位
*/ */
private Set<Chassis.GearPosition> unableLaunchAutopilotGear; private Set<Chassis.GearPosition> launchAutopilotGear;
private AutopilotAbilityManager() { private AutopilotAbilityManager() {
@@ -80,27 +74,17 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
return INSTANCE; return INSTANCE;
} }
public void setUnableLaunchAutopilotGear(Set<Chassis.GearPosition> unableLaunchAutopilotGear) { public void setLaunchAutopilotGear(Set<Chassis.GearPosition> launchAutopilotGear) {
if (unableLaunchAutopilotGear != null) { this.launchAutopilotGear = launchAutopilotGear;
this.unableLaunchAutopilotGear = new HashSet<>(unableLaunchAutopilotGear); if (autopilotAbility230 != null) {
taxiUnmanned(); autopilotAbility230.setLaunchAutopilotGear(launchAutopilotGear);
} else if (autopilotAbility250 != null) {
autopilotAbility250.setLaunchAutopilotGear(launchAutopilotGear);
} else if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setLaunchAutopilotGear(launchAutopilotGear);
} }
} }
/**
* 获取当前档位是否能启动自动驾驶 如果不传递默认可以启动
* 不能启动自驾档位规则app/README.md/不能启动自动驾驶的档位
*
* @param currentGear 当前档位
* @return 是否能启动自驾
*/
public boolean isLaunchAutopilot(Chassis.GearPosition currentGear) {
if (unableLaunchAutopilotGear != null && !unableLaunchAutopilotGear.isEmpty()) {
return !unableLaunchAutopilotGear.contains(currentGear);
}
return true;
}
/** /**
* 添加不能启动自驾的原因 * 添加不能启动自驾的原因
* *
@@ -117,16 +101,6 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
return unableAutopilotReasons; return unableAutopilotReasons;
} }
/**
* Taxi无人化相关从MAP360开始去掉P档限制和手刹限制
*/
private void taxiUnmanned() {
if ((isHQ || isDF) && mapVersion >= 30600) {
if (unableLaunchAutopilotGear != null) {
unableLaunchAutopilotGear.remove(Chassis.GearPosition.GEAR_P);
}
}
}
public void setCarConfig(@NonNull MessagePad.CarConfigResp carConfig) { public void setCarConfig(@NonNull MessagePad.CarConfigResp carConfig) {
if (!isInitCarConfig.get()) { if (!isInitCarConfig.get()) {
@@ -137,10 +111,17 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
isFutianSweeper = carConfig.getIsFutianSweeper(); isFutianSweeper = carConfig.getIsFutianSweeper();
isJinlvM1 = carConfig.getIsJinlvM1(); isJinlvM1 = carConfig.getIsJinlvM1();
isHQ = carConfig.getIsHQ(); isHQ = carConfig.getIsHQ();
isDF = carConfig.getIsDF();
isM1 = carConfig.getIsJinlvM1();
taxiUnmanned();
initAutopilotAbility(); initAutopilotAbility();
if (autopilotAbility230 != null) {
autopilotAbility230.setCarConfig(carConfig);
autopilotAbility230.setLaunchAutopilotGear(launchAutopilotGear);
} else if (autopilotAbility250 != null) {
autopilotAbility250.setCarConfig(carConfig);
autopilotAbility250.setLaunchAutopilotGear(launchAutopilotGear);
} else if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setCarConfig(carConfig);
autopilotAbility350And360.setLaunchAutopilotGear(launchAutopilotGear);
}
} }
} }
} }
@@ -189,29 +170,13 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
* *
* @param chassisStates 底盘 * @param chassisStates 底盘
*/ */
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) { public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates, Chassis.LightSwitch light) {
if (autopilotAbility230 != null) { if (autopilotAbility230 != null) {
autopilotAbility230.setChassisStates(chassisStates); autopilotAbility230.setChassisStates(chassisStates, light);
} } else if (autopilotAbility250 != null) {
if (autopilotAbility250 != null) { autopilotAbility250.setChassisStates(chassisStates, light);
autopilotAbility250.setChassisStates(chassisStates); } else if (autopilotAbility350And360 != null) {
} autopilotAbility350And360.setChassisStates(chassisStates, light);
if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setChassisStates(chassisStates);
}
}
/**
* 老底盘中手刹状态更新新底盘PB中没有所以单独传递
*
* @param vehicleState 底盘
*/
public void setVehicleState(VehicleStateOuterClass.VehicleState vehicleState) {
if (autopilotAbility250 != null) {
autopilotAbility250.setVehicleState(vehicleState);
}
if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setVehicleState(vehicleState);
} }
} }
@@ -235,33 +200,33 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
if (mapVersion >= 30600 && isFutianSweeper) { if (mapVersion >= 30600 && isFutianSweeper) {
CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本360清扫车专用"); CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本360清扫车专用");
if (autopilotAbility360 == null) { if (autopilotAbility360 == null) {
autopilotAbility360 = new AutopilotAbility360(); autopilotAbility360 = new AutopilotAbility360(this);
autopilotAbility360.start(this); autopilotAbility360.start(this);
} }
} else if ((mapVersion >= 30500 && (isJinlvM1 || isHQ)) || mapVersion >= 30600) { } else if ((mapVersion >= 30500 && (isJinlvM1 || isHQ)) || mapVersion >= 30600) {
CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本350和360共用"); CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本350和360共用");
if (autopilotAbility350And360 == null) { if (autopilotAbility350And360 == null) {
autopilotAbility350And360 = new AutopilotAbility350And360(mapVersion, isHQ, isDF, isM1); autopilotAbility350And360 = new AutopilotAbility350And360(this);
autopilotAbility350And360.start(this); autopilotAbility350And360.start(this);
} }
} else if (mapVersion >= 30300 && isFutianSweeper) {//目前只有MAP330的清扫车用的新的FSM状态原因查询 } else if (mapVersion >= 30300 && isFutianSweeper) {//目前只有MAP330的清扫车用的新的FSM状态原因查询
CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本330清扫车专用"); CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本330清扫车专用");
if (autopilotAbility330 == null) { if (autopilotAbility330 == null) {
autopilotAbility330 = new AutopilotAbility330(mapVersion); autopilotAbility330 = new AutopilotAbility330(this, mapVersion);
autopilotAbility330.start(this); autopilotAbility330.start(this);
} }
} else if (mapVersion >= 20500) { } else if (mapVersion >= 20500) {
CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本250"); CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本250");
if (autopilotAbility250 == null) { if (autopilotAbility250 == null) {
autopilotAbility250 = new AutopilotAbility250(mapVersion, isHQ, isDF, isM1); autopilotAbility250 = new AutopilotAbility250(this);
autopilotAbility250.start(this); autopilotAbility250.start(this);
} }
} else { } else {
CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本230"); CupidLogUtils.log(TAG, "能否启动自驾能力检测使用版本230");
if (autopilotAbility230 == null) { if (autopilotAbility230 == null) {
autopilotAbility230 = new AutopilotAbility230(); autopilotAbility230 = new AutopilotAbility230(this);
autopilotAbility230.start(this); autopilotAbility230.start(this);
} }
} }

View File

@@ -0,0 +1,175 @@
package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import mogo.telematics.pad.MessagePad;
/**
* 所有需要使用底盘检测数据的版本父类
*/
public abstract class BaseAutopilotAbilityChassis {
protected final String TAG = this.getClass().getSimpleName();
private static final String REASON_CHASSIS_BRAKE = "刹车踏板";
private static final String REASON_CHASSIS_THROTTLE = "油门踏板";
private static final String REASON_CHASSIS_GEAR = "档位";
private static final String REASON_CHASSIS_HAZARD_LIGHTS = "危险报警灯";
private static final String REASON_CHASSIS_STEERING = "方向盘";
@NonNull
protected final AutopilotAbilityManager manager;
private ChassisStatesOuterClass.ChassisStates chassisStates;
protected OnAutopilotAbilityListener listener;
protected int mapVersion = -1;//工控机版本
protected boolean isJinlv = false;//是否是金旅小巴
protected boolean isJinlvM1 = false;//是否是M1
protected boolean isJinlvM2 = false;//是否是M2
protected boolean isHQ = false;//是否是HQ
protected boolean isDF = false;//是否是DF
private final AtomicReference<Chassis.LightSwitch> currentLight = new AtomicReference<>(Chassis.LightSwitch.LIGHT_NONE);
/**
* 能启动自动驾驶的档位
*/
private Set<Chassis.GearPosition> launchAutopilotGear;
private float oldThrottle = Float.MAX_VALUE;//方向盘转角
public BaseAutopilotAbilityChassis(@NonNull AutopilotAbilityManager manager) {
this.manager = manager;
}
public void setCarConfig(@NonNull MessagePad.CarConfigResp carConfig) {
mapVersion = carConfig.getMapVersion();
isJinlv = carConfig.getIsJinlv();
isJinlvM1 = carConfig.getIsJinlvM1();
isJinlvM2 = carConfig.getIsJinlvM2();
isHQ = carConfig.getIsHQ();
isDF = carConfig.getIsDF();
taxiUnmanned();
}
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates, Chassis.LightSwitch light) {
this.chassisStates = chassisStates;
currentLight.set(light);
}
public void setLaunchAutopilotGear(Set<Chassis.GearPosition> launchAutopilotGear) {
this.launchAutopilotGear = launchAutopilotGear;
taxiUnmanned();
}
/**
* Taxi无人化相关从MAP360开始去掉P档限制和手刹限制
*/
private void taxiUnmanned() {
if ((isHQ || isDF) && mapVersion < 30600) {
if (launchAutopilotGear != null) {
launchAutopilotGear.remove(Chassis.GearPosition.GEAR_P);
}
}
}
/**
* 获取当前档位是否能启动自动驾驶 如果不传递默认可以启动
* 不能启动自驾档位规则app/README.md/不能启动自动驾驶的档位
*
* @param currentGear 当前档位
* @return 是否能启动自驾
*/
private boolean isLaunchAutopilotGear(Chassis.GearPosition currentGear) {
if (launchAutopilotGear != null && !launchAutopilotGear.isEmpty()) {
return launchAutopilotGear.contains(currentGear);
}
return true;
}
/**
* 获取当前是否开启危险报警灯
* 双闪处于打开状态taxi可以进自驾金旅bus不可以
*
* @return 是否能启动自驾
*/
public boolean isLaunchAutopilotLight() {
if (isJinlv || isJinlvM1 || isJinlvM2) {
return currentLight.get() != Chassis.LightSwitch.LIGHT_FLASH;
}
return true;
}
protected ArrayList<UnableLaunchReason> onCallbackChassis(ArrayList<UnableLaunchReason> unableAutopilotReasons) {
//检测底盘相关
if (chassisStates != null) {
//制动踏板
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_BRAKE, REASON_CHASSIS_BRAKE);
}
}
//油门踏板
if (chassisStates.hasDrivingSystemStates()) {
float throttle = chassisStates.getDrivingSystemStates().getThrottleResponsePosition();
if (throttle > 0) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_THROTTLE, REASON_CHASSIS_THROTTLE);
}
}
//档位
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!isLaunchAutopilotGear(gear)) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_GEAR, REASON_CHASSIS_GEAR);
}
}
//危险报警灯
if (!isLaunchAutopilotLight()) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS, REASON_CHASSIS_HAZARD_LIGHTS);
}
//方向盘
if (chassisStates.hasSteerSystemStates()) {
ChassisStatesOuterClass.SteerSystemStates steerSystemStates = chassisStates.getSteerSystemStates();
if (steerSystemStates.hasSteeringWheelAngle()) {
float throttle = steerSystemStates.getSteeringWheelAngle();
if (oldThrottle == Float.MAX_VALUE) {
oldThrottle = throttle;
} else {
CupidLogUtils.log(TAG, "方向盘当前角度=" + oldThrottle + " 方向盘1秒前角度=" + throttle);
boolean isTurning = Math.abs(throttle - oldThrottle) > 2.0F;
oldThrottle = throttle;
CupidLogUtils.log(TAG, "方向盘是否转动=" + isTurning);
if (isTurning) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_STEERING, REASON_CHASSIS_STEERING);
}
}
}
}
}
return unableAutopilotReasons;
}
public synchronized void start(OnAutopilotAbilityListener listener) {
this.listener = listener;
}
protected synchronized void stop() {
this.chassisStates = null;
this.listener = null;
mapVersion = -1;
isHQ = false;
isJinlv = false;
isJinlvM1 = false;
isJinlvM2 = false;
}
}

View File

@@ -3,24 +3,56 @@ package com.zhidao.support.adas.high.msg;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.ParallelDrivingManager; import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.common.TurnLightState;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData; import com.zhidao.support.adas.high.protocol.RawData;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass; import chassis.ChassisStatesOuterClass;
/** /**
* 重构后的底盘状态 * 重构后的底盘状态
*/ */
public class ChassisStatesMessage extends MyAbstractMessageHandler { public class ChassisStatesMessage extends MyAbstractMessageHandler {
private final TurnLightState lightLeft;
private final TurnLightState lightRight;
public ChassisStatesMessage(TurnLightState lightLeft, TurnLightState lightRight) {
this.lightLeft = lightLeft;
this.lightRight = lightRight;
}
@Override @Override
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
ChassisStatesOuterClass.ChassisStates chassisStates = ChassisStatesOuterClass.ChassisStates.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); ChassisStatesOuterClass.ChassisStates chassisStates = ChassisStatesOuterClass.ChassisStates.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
AutopilotAbilityManager.getInstance().setChassisStates(chassisStates); Chassis.LightSwitch light = updateLight(chassisStates, adasListener);
AutopilotAbilityManager.getInstance().setChassisStates(chassisStates, light);
ParallelDrivingManager.getInstance().setChassisStates(chassisStates); ParallelDrivingManager.getInstance().setChassisStates(chassisStates);
if (adasListener != null) { if (adasListener != null) {
adasListener.onChassisStates(raw.getHeader(), chassisStates); adasListener.onChassisStates(raw.getHeader(), chassisStates);
adasListener.onLightSwitch(light);
} }
} }
private Chassis.LightSwitch updateLight(ChassisStatesOuterClass.ChassisStates chassisStates, OnAdasListener adasListener) {
Chassis.LightSwitch light = Chassis.LightSwitch.LIGHT_NONE;
if (chassisStates.hasBcmSystemStates()) {
ChassisStatesOuterClass.BCMSystemStates bcm = chassisStates.getBcmSystemStates();
light = bcm.getTurnLightState();
}
boolean isTurnLightLeft = lightLeft.update((light.getNumber() & Chassis.LightSwitch.LIGHT_LEFT.getNumber()) != 0);
boolean isTurnLightRight = lightRight.update((light.getNumber() & Chassis.LightSwitch.LIGHT_RIGHT.getNumber()) != 0);
if (isTurnLightLeft && isTurnLightRight) {
//双闪
light = Chassis.LightSwitch.LIGHT_FLASH;
} else if (isTurnLightLeft) {
//左传
light = Chassis.LightSwitch.LIGHT_LEFT;
} else if (isTurnLightRight) {
//右转
light = Chassis.LightSwitch.LIGHT_RIGHT;
}
return light;
}
} }

View File

@@ -1,6 +1,7 @@
package com.zhidao.support.adas.high.msg; package com.zhidao.support.adas.high.msg;
import com.zhidao.support.adas.high.common.AutopilotReview; import com.zhidao.support.adas.high.common.AutopilotReview;
import com.zhidao.support.adas.high.common.TurnLightState;
import com.zhjt.mogo.adas.common.MessageType; import com.zhjt.mogo.adas.common.MessageType;
import mogo.telematics.pad.MessagePad; import mogo.telematics.pad.MessagePad;
@@ -47,11 +48,18 @@ public class MyMessageFactory implements IMyMessageFactory {
private IMsg fSMStatusReasonRespondMessage;//FSM状态原因查询 private IMsg fSMStatusReasonRespondMessage;//FSM状态原因查询
private final AutopilotReview autopilotReview; private final AutopilotReview autopilotReview;
private final TurnLightState lightLeft = new TurnLightState();
private final TurnLightState lightRight = new TurnLightState();
public MyMessageFactory(AutopilotReview autopilotReview) { public MyMessageFactory(AutopilotReview autopilotReview) {
this.autopilotReview = autopilotReview; this.autopilotReview = autopilotReview;
} }
public void initTurnLightState() {
lightLeft.init();
lightRight.init();
}
@Override @Override
public IMsg createMessage(MessagePad.MessageType messageType) { public IMsg createMessage(MessagePad.MessageType messageType) {
if (messageType == MessageType.TYPE_RECEIVE_TRAJECTORY.typeCode) { if (messageType == MessageType.TYPE_RECEIVE_TRAJECTORY.typeCode) {
@@ -75,13 +83,13 @@ public class MyMessageFactory implements IMyMessageFactory {
} else if (messageType == MessageType.TYPE_RECEIVE_VEHICLE_STATE.typeCode) { } else if (messageType == MessageType.TYPE_RECEIVE_VEHICLE_STATE.typeCode) {
//底盘信息, 透传底盘状态pb参考底盘 //底盘信息, 透传底盘状态pb参考底盘
if (vehicleStateMessage == null) { if (vehicleStateMessage == null) {
vehicleStateMessage = new VehicleStateMessage(); vehicleStateMessage = new VehicleStateMessage(lightLeft, lightRight);
} }
return vehicleStateMessage; return vehicleStateMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_CHASSIS_STATES.typeCode) { } else if (messageType == MessageType.TYPE_RECEIVE_CHASSIS_STATES.typeCode) {
//重构后的底盘状态 //重构后的底盘状态
if (chassisStatesMessage == null) { if (chassisStatesMessage == null) {
chassisStatesMessage = new ChassisStatesMessage(); chassisStatesMessage = new ChassisStatesMessage(lightLeft, lightRight);
} }
return chassisStatesMessage; return chassisStatesMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_AUTOPILOT_STATE.typeCode) { } else if (messageType == MessageType.TYPE_RECEIVE_AUTOPILOT_STATE.typeCode) {

View File

@@ -5,9 +5,10 @@ import android.os.SystemClock;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.AdasChannel; import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.common.TurnLightState;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData; import com.zhidao.support.adas.high.protocol.RawData;
import chassis.Chassis; import chassis.Chassis;
@@ -19,6 +20,13 @@ import common.HeaderOuterClass;
* 底盘信息, 透传底盘状态pb参考底盘 * 底盘信息, 透传底盘状态pb参考底盘
*/ */
public class VehicleStateMessage extends MyAbstractMessageHandler { public class VehicleStateMessage extends MyAbstractMessageHandler {
private final TurnLightState lightLeft;
private final TurnLightState lightRight;
public VehicleStateMessage(TurnLightState lightLeft, TurnLightState lightRight) {
this.lightLeft = lightLeft;
this.lightRight = lightRight;
}
@Override @Override
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
@@ -27,18 +35,40 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
long nowTime = 0; long nowTime = 0;
if (CupidLogUtils.isEnableLog()) if (CupidLogUtils.isEnableLog())
nowTime = SystemClock.elapsedRealtime(); nowTime = SystemClock.elapsedRealtime();
AutopilotAbilityManager.getInstance().setVehicleState(vehicleState);
ParallelDrivingManager.getInstance().setVehicleState(vehicleState); ParallelDrivingManager.getInstance().setVehicleState(vehicleState);
ChassisStatesOuterClass.ChassisStates chassisStates = compatibility(adasListener, raw, vehicleState); Chassis.LightSwitch light = updateLight(vehicleState, adasListener);
ChassisStatesOuterClass.ChassisStates chassisStates = compatibility(vehicleState, light);
if (adasListener != null) { if (adasListener != null) {
//TODO 暂时关闭老底盘转发 后期 会删除 onVehicleState //TODO 暂时关闭老底盘转发 后期 会删除 onVehicleState
//adasListener.onChassisStates(raw.getHeader(), chassisStates); //adasListener.onChassisStates(raw.getHeader(), chassisStates);
adasListener.onVehicleState(raw.getHeader(), vehicleState); adasListener.onVehicleState(raw.getHeader(), vehicleState);
adasListener.onLightSwitch(light);
} }
AdasChannel.calculateTimeConsumingBusiness("底盘信息", nowTime); AdasChannel.calculateTimeConsumingBusiness("底盘信息", nowTime);
// CupidLogUtils.e("底盘信息--->" + vehicleState.toString()); // CupidLogUtils.e("底盘信息--->" + vehicleState.toString());
} }
private Chassis.LightSwitch updateLight(VehicleStateOuterClass.VehicleState vehicleState, OnAdasListener adasListener) {
Chassis.LightSwitch light = Chassis.LightSwitch.LIGHT_NONE;
if (vehicleState.hasLight()) {
light = vehicleState.getLight();
}
boolean isTurnLightLeft = lightLeft.update((light.getNumber() & Chassis.LightSwitch.LIGHT_LEFT.getNumber()) != 0);
boolean isTurnLightRight = lightRight.update((light.getNumber() & Chassis.LightSwitch.LIGHT_RIGHT.getNumber()) != 0);
if (isTurnLightLeft && isTurnLightRight) {
//双闪
light = Chassis.LightSwitch.LIGHT_FLASH;
} else if (isTurnLightLeft) {
//左传
light = Chassis.LightSwitch.LIGHT_LEFT;
} else if (isTurnLightRight) {
//右转
light = Chassis.LightSwitch.LIGHT_RIGHT;
}
return light;
}
/** /**
* 将老地盘数据转换成新地盘数据 * 将老地盘数据转换成新地盘数据
* 字段注释中 鹰眼已用 的 已和底盘相关开发 确认过,其他字段均为确认对应关系 * 字段注释中 鹰眼已用 的 已和底盘相关开发 确认过,其他字段均为确认对应关系
@@ -49,7 +79,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
* fuel_value robo_taxi_state robo_bus_state * fuel_value robo_taxi_state robo_bus_state
* robo_bus_jinlv_m1_state * robo_bus_jinlv_m1_state
*/ */
private ChassisStatesOuterClass.ChassisStates compatibility(OnAdasListener adasListener, RawData raw, VehicleStateOuterClass.VehicleState vehicleState) throws InvalidProtocolBufferException { private ChassisStatesOuterClass.ChassisStates compatibility(VehicleStateOuterClass.VehicleState vehicleState, Chassis.LightSwitch light) throws InvalidProtocolBufferException {
/**************老地盘转换成新地盘PB***************/ /**************老地盘转换成新地盘PB***************/
ChassisStatesOuterClass.ChassisStates.Builder builder = ChassisStatesOuterClass.ChassisStates.newBuilder(); ChassisStatesOuterClass.ChassisStates.Builder builder = ChassisStatesOuterClass.ChassisStates.newBuilder();
//工控机所用Header //工控机所用Header
@@ -114,7 +144,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
.setSweeperFutianTaskSystemStates(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.parseFrom(bytes)));//鹰眼已用 清扫车专用 .setSweeperFutianTaskSystemStates(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.parseFrom(bytes)));//鹰眼已用 清扫车专用
} }
ChassisStatesOuterClass.ChassisStates chassisStates = builder.build(); ChassisStatesOuterClass.ChassisStates chassisStates = builder.build();
AutopilotAbilityManager.getInstance().setChassisStates(chassisStates); AutopilotAbilityManager.getInstance().setChassisStates(chassisStates, light);
ParallelDrivingManager.getInstance().setChassisStates(chassisStates); ParallelDrivingManager.getInstance().setChassisStates(chassisStates);
return chassisStates; return chassisStates;
} }

View File

@@ -750,6 +750,10 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS,
"添加感知模型到地图中……preVehicleStrBus=" "添加感知模型到地图中……preVehicleStrBus="
) )
addPreVehicleModelWeiZhi(
TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE,
"添加感知模型到地图中……preVehicleStrCone="
)
addPreVehicleModelWeiZhi( addPreVehicleModelWeiZhi(
TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK,
"添加感知模型到地图中……preVehicleStrTruck=" "添加感知模型到地图中……preVehicleStrTruck="