- * 埋点
- */
-public class AnalyticsUtils {
-
- @Keep
- public static void init( Context context ) {
- // 1 - debug 近实时上报,积累一条埋点上报,或者积累3秒上报一次。
- // 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。
- AnalyticsConfig.getInstance( context ).setAppKey( "0915430e5fdcbb553391f2a35cb8489f" );
- AnalyticsConfig.getInstance( context ).setUploadMode( DebugConfig.isDebug() ? UploadMode.instant : UploadMode.cache );
- AnalyticsConfig.getInstance( context ).setShouldLog( DebugConfig.isDebug() );
- AnalyticsConfig.getInstance( AbsMogoApplication.getApp() ).setParamsProvider(new IAnalyticsParamsProvider() {
- @Override
- public Map< String, Object > staticParams() {
- return ParamsUtil.getAnalyticsCustomParams();
- }
-
- @Override
- public Map< String, Object > dynamicParams() {
- return null;
- }
- } );
- Analytics.getInstance().start( context );
- }
-
- /**
- * 埋点
- *
- * @param event 事件名称
- * @param properties 事件参数
- */
- public static void track( String event, Map< String, Object > properties ) {
- Analytics.getInstance().track( event, properties );
- }
-}
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/analytics/AnalyticsManager.kt b/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/MogoAnalyticUtils.kt
similarity index 93%
rename from core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/analytics/AnalyticsManager.kt
rename to foudations/mogo-commons/src/main/java/com/mogo/commons/utils/MogoAnalyticUtils.kt
index 7fb33492fb..14a63addb2 100644
--- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/analytics/AnalyticsManager.kt
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/MogoAnalyticUtils.kt
@@ -1,4 +1,4 @@
-package com.mogo.eagle.core.function.call.analytics
+package com.mogo.commons.utils
import android.content.Context
import androidx.annotation.Keep
@@ -15,7 +15,7 @@ import com.mogo.eagle.core.utilcode.util.AppUtils
* 埋点&数据统计 管理
* @author donghongyu
*/
-object AnalyticsManager {
+object MogoAnalyticUtils {
@Keep
fun init(context: Context?, isDebug: Boolean) {
@@ -45,7 +45,7 @@ object AnalyticsManager {
* @param event 事件名称
* @param properties 事件参数
*/
- fun track(event: String?, properties: HashMap
+ * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
+ */
+public class AutopilotAbility230 {
+ private static final String TAG = AutopilotAbility230.class.getSimpleName();
+ private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
+ private volatile Timer timer;
+ private ChassisStatesOuterClass.ChassisStates chassisStates;
+
+ public AutopilotAbility230() {
+ }
+
+
+ public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
+ this.chassisStates = chassisStates;
+ }
+
+ private void onCallback() {
+ //金旅、开沃小巴乘客端 不能启动自动驾驶
+ if (AutopilotAbilityManager.getInstance().isBusPassenger()) {
+ return;
+ }
+ boolean isAutopilotAbility = true;//是否能启动自动驾驶
+ String unableAutopilotReason = null;//不能启动自动驾驶原因
+ //检测底盘相关
+ if (chassisStates != null) {
+ if (chassisStates.hasBrakeSystemStates()) {
+ float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
+ if (brake > 0) {
+ isAutopilotAbility = false;
+ unableAutopilotReason = "制动踏板被踩下";
+ }
+ }
+ if (isAutopilotAbility) {
+ /**
+ * 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃
+ * TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗 走
+ */
+ //开沃任何档位都能启动自驾
+ if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) {
+ if (chassisStates.hasGearSystemStates()) {
+ Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
+ //金旅Bus和清扫车 档位不正常
+ if (AutopilotAbilityManager.getInstance().isBusDriver()) {
+ if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) {
+ isAutopilotAbility = false;
+ unableAutopilotReason = "档位不正常";
+ }
+ } else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) {
+ if (gear == Chassis.GearPosition.GEAR_N) {
+ isAutopilotAbility = false;
+ unableAutopilotReason = "档位不正常";
+ }
+ } else {
+ //东风Taxi和红旗 司机端和乘客端 档位不正常
+ if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) {
+ isAutopilotAbility = false;
+ unableAutopilotReason = "档位不正常";
+ }
+ }
+ }
+ }
+ }
+
+ //TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
+// if (isAutopilotAbility) {
+// //电子驻车制动系统
+// if (chassisStates.hasEpbSystemStates()) {
+// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
+// if (epb.hasEpbEnableState()){
+// epb.getEpbWorkState();
+// }
+// }
+// }
+ }
+ if (AutopilotAbilityManager.getInstance().getListener() != null) {
+ AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
+ }
+ }
+
+ public synchronized void start() {
+ if (timer == null) {
+ timer = new Timer();
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ onCallback();
+ }
+ }, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
+ }
+ }
+
+ public synchronized void stop() {
+ if (timer != null) {
+ timer.cancel();
+ timer = null;
+ }
+ this.chassisStates = null;
+ }
+
+
+
+}
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java
similarity index 61%
rename from libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java
rename to libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java
index 733e87d82a..01bf359101 100644
--- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java
@@ -1,106 +1,41 @@
-package com.zhidao.support.adas.high.common;
+package com.zhidao.support.adas.high.common.autopilot.ability;
-import android.os.Handler;
import android.os.Message;
-import android.text.TextUtils;
import com.zhidao.support.adas.high.AdasManager;
-import com.zhidao.support.adas.high.OnAdasListener;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import system_master.SystemStatusInfo;
/**
- * 是否可以启动自动驾驶能力检测
+ * 是否可以启动自动驾驶能力检测 工控机版本>=250使用此类
* 目前监控了底盘的一些状态和查询节点状态应答的数据
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
*
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/
-public class AutopilotAbilityManager {
- private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
+public class AutopilotAbility250 {
+ private static final String TAG = AutopilotAbility250.class.getSimpleName();
private static final int WHAT_TIMEOUT = 0;
private static final int DEFAULT_TIMEOUT = 1500;
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
- private static volatile AutopilotAbilityManager INSTANCE;
- private OnAdasListener listener;
private volatile Timer timer;
- private final Pattern pattern = Pattern.compile("\\d+.\\d+.\\d+");
private ChassisStatesOuterClass.ChassisStates chassisStates;
- private Handler handler;
- private OnAutopilotAbilityListener onAutopilotAbilityListener;
- /**
- * 身份/车型
- */
- private String identityMode;
- public interface OnAutopilotAbilityListener {
- void onStatusQuery();//查询是被调用
+ public AutopilotAbility250() {
}
- /**
- * 身份规则定义根据app/productFlavors/README.md
- * * taxi司机屏 Taxi_Driver_Base (东风、红旗司机端)
- * * taxi乘客屏 Taxi_Passenger_Base (东风、红旗乘客端)
- * * bus司机屏 Bus_Driver_Base (金旅小巴司机端)
- * * Bus_Driver_Van (开沃小巴司机端)
- * * bus乘客屏 Bus_Passenger_Base (金旅、开沃小巴乘客端)
- * * Bus_Passenger_M1 (M1小巴乘客端)
- * * Bus_Passenger_M2 (M2小巴乘客端)
- * * 清扫车 Sweeper_Driver_FT (福田清扫车司机端)
- *
- * 此定义不区分角色,只区分业务线和车型
- */
- private interface IDENTITY_MODE {
- String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//(东风、红旗司机端)
- String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//(东风、红旗乘客端)
- String BUS_DRIVER_BASE = "Bus_Driver_Base";//(金旅小巴司机端)
- String BUS_DRIVER_VAN = "Bus_Driver_Van";//(开沃小巴司机端)
- String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//(金旅、开沃小巴乘客端)
- String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//(M1小巴乘客端)
- String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//(M2小巴乘客端)
- String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//(福田清扫车司机端)
- }
-
-
- public void setIdentityMode(String identityMode) {
- this.identityMode = identityMode;
- }
-
- public void setOnAdasListener(OnAdasListener listener) {
- this.listener = listener;
- }
-
- public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) {
- this.onAutopilotAbilityListener = onAutopilotAbilityListener;
- }
-
- private AutopilotAbilityManager() {
- }
-
- public static AutopilotAbilityManager getInstance() {
- if (INSTANCE == null) {
- synchronized (AutopilotAbilityManager.class) {
- if (INSTANCE == null) {
- INSTANCE = new AutopilotAbilityManager();
- }
- }
- }
- return INSTANCE;
- }
public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
- if (handler != null) {
- if (handler.hasMessages(WHAT_TIMEOUT))
- handler.removeMessages(WHAT_TIMEOUT);
+ if (AutopilotAbilityManager.getInstance().getHandler() != null) {
+ if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
+ AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
}
onCallback(statusInfo);
}
@@ -111,7 +46,7 @@ public class AutopilotAbilityManager {
private void onCallback(SystemStatusInfo.StatusInfo statusInfo) {
//金旅、开沃小巴乘客端 不能启动自动驾驶
- if (IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode)) {
+ if (AutopilotAbilityManager.getInstance().isBusPassenger()) {
return;
}
boolean isAutopilotAbility = true;//是否能启动自动驾驶
@@ -122,20 +57,7 @@ public class AutopilotAbilityManager {
if (statusInfo.hasMasterVersion()) {
//截取Master Version
String masterVersion = statusInfo.getMasterVersion();
- if (!TextUtils.isEmpty(masterVersion)) {
- try {
- Matcher matcher = pattern.matcher(masterVersion);
- if (matcher.find()) {
- String group = matcher.group();
- if (!TextUtils.isEmpty(group)) {
- String v = group.split("\\.")[0];
- version = Integer.parseInt(v);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ version = AutopilotAbilityManager.getInstance().parseVersion(false, masterVersion);
}
//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
if (version > 1 && statusInfo.hasAutoPilotReady()) {
@@ -204,24 +126,26 @@ public class AutopilotAbilityManager {
* 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃
* TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗 走
*/
- if (chassisStates.hasGearSystemStates()) {
- Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
- if (TextUtils.isEmpty(identityMode)) {
- identityMode = "";
- }
- //开沃任何档位都能启动自驾
- if (!IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode)) {
+ //开沃任何档位都能启动自驾
+ if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) {
+ if (chassisStates.hasGearSystemStates()) {
+ Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
//金旅Bus和清扫车 档位不正常
- if (IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode) || IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode)) {
+ if (AutopilotAbilityManager.getInstance().isBusDriver()) {
+ if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) {
+ isAutopilotAbility = false;
+ unableAutopilotReason = "档位不正常";
+ }
+ } else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) {
if (gear == Chassis.GearPosition.GEAR_N) {
isAutopilotAbility = false;
- unableAutopilotReason = "挡位不正常";
+ unableAutopilotReason = "档位不正常";
}
} else {
//东风Taxi和红旗 司机端和乘客端 档位不正常
if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
- unableAutopilotReason = "挡位不正常";
+ unableAutopilotReason = "档位不正常";
}
}
}
@@ -239,8 +163,8 @@ public class AutopilotAbilityManager {
// }
// }
}
- if (listener != null) {
- listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
+ if (AutopilotAbilityManager.getInstance().getListener() != null) {
+ AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
}
}
@@ -250,14 +174,14 @@ public class AutopilotAbilityManager {
timer.schedule(new TimerTask() {
@Override
public void run() {
- if (onAutopilotAbilityListener != null) {
- onAutopilotAbilityListener.onStatusQuery();
+ if (AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener() != null) {
+ AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener().onStatusQuery();
}
AdasManager.getInstance().sendStatusQueryReq();
- if (handler != null) {
- if (handler.hasMessages(WHAT_TIMEOUT))
- handler.removeMessages(WHAT_TIMEOUT);
- handler.sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
+ if (AutopilotAbilityManager.getInstance().getHandler() != null) {
+ if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
+ AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
+ AutopilotAbilityManager.getInstance().getHandler().sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
}
}
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
@@ -269,18 +193,15 @@ public class AutopilotAbilityManager {
timer.cancel();
timer = null;
}
- handler = null;
this.chassisStates = null;
}
- public void setHandler(Handler handler) {
- this.handler = handler;
- }
-
public void onHandleMessage(Message msg) {
if (msg.what == WHAT_TIMEOUT) {
onCallback(null);
}
}
+
+
}
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java
new file mode 100644
index 0000000000..1e80fe6805
--- /dev/null
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java
@@ -0,0 +1,274 @@
+package com.zhidao.support.adas.high.common.autopilot.ability;
+
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.zhidao.support.adas.high.AdasManager;
+import com.zhidao.support.adas.high.OnAdasListener;
+import com.zhidao.support.adas.high.common.Constants;
+import com.zhidao.support.adas.high.common.CupidLogUtils;
+
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import chassis.ChassisStatesOuterClass;
+import mogo.telematics.pad.MessagePad;
+import system_master.SystemStatusInfo;
+
+/**
+ * 是否可以启动自动驾驶能力检测
+ * 目前监控了底盘的一些状态和查询节点状态应答的数据
+ * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
+ *
+ * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
+ */
+public class AutopilotAbilityManager {
+ private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
+ private static volatile AutopilotAbilityManager INSTANCE;
+ private OnAdasListener listener;
+ private final Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
+ private Handler handler;
+ private OnAutopilotAbilityListener onAutopilotAbilityListener;
+ private int dockerVersion = -1;//工控机版本
+ private AutopilotAbility230 autopilotAbility230;
+ private AutopilotAbility250 autopilotAbility250;
+ private Timer startTimer;
+ /**
+ * 身份/车型
+ */
+ private String identityMode;
+
+ public interface OnAutopilotAbilityListener {
+ void onStatusQuery();//查询是被调用
+ }
+
+ /**
+ * 身份规则定义根据app/productFlavors/README.md
+ * * taxi司机屏 Taxi_Driver_Base (东风、红旗司机端)
+ * * taxi乘客屏 Taxi_Passenger_Base (东风、红旗乘客端)
+ * * bus司机屏 Bus_Driver_Base (金旅小巴司机端)
+ * * Bus_Driver_Van (开沃小巴司机端)
+ * * bus乘客屏 Bus_Passenger_Base (金旅、开沃小巴乘客端)
+ * * Bus_Passenger_M1 (M1小巴乘客端)
+ * * Bus_Passenger_M2 (M2小巴乘客端)
+ * * 清扫车 Sweeper_Driver_FT (福田清扫车司机端)
+ *
+ * 此定义不区分角色,只区分业务线和车型
+ */
+ private interface IDENTITY_MODE {
+ String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//(东风、红旗司机端)
+ String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//(东风、红旗乘客端)
+ String BUS_DRIVER_BASE = "Bus_Driver_Base";//(金旅小巴司机端)
+ String BUS_DRIVER_VAN = "Bus_Driver_Van";//(开沃小巴司机端)
+ String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//(金旅、开沃小巴乘客端)
+ String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//(M1小巴乘客端)
+ String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//(M2小巴乘客端)
+ String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//(福田清扫车司机端)
+ }
+
+ private AutopilotAbilityManager() {
+ }
+
+ public static AutopilotAbilityManager getInstance() {
+ if (INSTANCE == null) {
+ synchronized (AutopilotAbilityManager.class) {
+ if (INSTANCE == null) {
+ INSTANCE = new AutopilotAbilityManager();
+ }
+ }
+ }
+ return INSTANCE;
+ }
+
+ public void setIdentityMode(String identityMode) {
+ this.identityMode = identityMode;
+ }
+
+ public void setCarConfig(MessagePad.CarConfigResp carConfig) {
+ if (dockerVersion == -1) {
+ String v = carConfig.getDockVersion();
+ int version = parseVersion(true, v);
+ if (version != -1) {
+ stopTimer();
+ dockerVersion = version;
+ Log.i("dddd", "工控机版本=" + dockerVersion);
+ initAutopilotAbility();
+ }
+ }
+ }
+
+ public void setOnAdasListener(OnAdasListener listener) {
+ this.listener = listener;
+ }
+
+ public OnAdasListener getListener() {
+ return listener;
+ }
+
+ public void setHandler(Handler handler) {
+ this.handler = handler;
+ }
+
+ public Handler getHandler() {
+ return handler;
+ }
+
+ public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) {
+ this.onAutopilotAbilityListener = onAutopilotAbilityListener;
+ }
+
+ public OnAutopilotAbilityListener getOnAutopilotAbilityListener() {
+ return onAutopilotAbilityListener;
+ }
+
+
+ public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
+ if (autopilotAbility250 != null) {
+ autopilotAbility250.setStatusInfo(statusInfo);
+ }
+ }
+
+ public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
+ if (autopilotAbility230 != null) {
+ autopilotAbility230.setChassisStates(chassisStates);
+ }
+ if (autopilotAbility250 != null) {
+ autopilotAbility250.setChassisStates(chassisStates);
+ }
+ }
+
+ public void onHandleMessage(Message msg) {
+ if (autopilotAbility250 != null) {
+ autopilotAbility250.onHandleMessage(msg);
+ }
+ }
+
+ private void initAutopilotAbility() {
+ if (dockerVersion >= 250) {
+ stop230();
+ if (autopilotAbility250 == null) {
+ autopilotAbility250 = new AutopilotAbility250();
+ autopilotAbility250.start();
+ }
+ } else {
+ stop250();
+ if (autopilotAbility230 == null) {
+ autopilotAbility230 = new AutopilotAbility230();
+ autopilotAbility230.start();
+ }
+
+ }
+ }
+
+ private void stop230() {
+ if (autopilotAbility230 != null) {
+ autopilotAbility230.stop();
+ autopilotAbility230 = null;
+ }
+ }
+
+ private void stop250() {
+ if (autopilotAbility250 != null) {
+ autopilotAbility250.stop();
+ autopilotAbility250 = null;
+ }
+ }
+
+ private void stopTimer() {
+ if (startTimer != null) {
+ startTimer.cancel();
+ startTimer = null;
+ }
+ }
+
+ /**
+ * 连接工控机成功调用此函数,如果dockerVersion还未获取到将启动最低版本的启动自动驾驶能力检测
+ * 此函数为保险措施 以防无法获取工控机版本时 也能 正常执行逻辑
+ */
+ public synchronized void start() {
+ if (startTimer == null) {
+ startTimer = new Timer();
+ startTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (dockerVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
+ dockerVersion = 230;
+ initAutopilotAbility();
+ }
+ }
+ }, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步
+ }
+
+ }
+
+ public synchronized void stop() {
+ stopTimer();
+ stop230();
+ stop250();
+ handler = null;
+ dockerVersion = -1;
+ }
+
+
+ /**
+ * 解析版本 格式 xxx.xxx.xxx(x的数量不固定)
+ *
+ * @param isUserAll 是否使用全部截取数据 true:表示 12.34.56 截取之后 123456 false:表示12.34.56 截取之后 12
+ * @param ver 版本字符串
+ * @return -1表示解析失败
+ */
+ public int parseVersion(boolean isUserAll, String ver) {
+ int version = -1;
+ if (!TextUtils.isEmpty(ver)) {
+ try {
+ Matcher matcher = pattern.matcher(ver);
+ if (matcher.find()) {
+ String group = matcher.group();
+ if (!TextUtils.isEmpty(group)) {
+ if (isUserAll) {
+ group = group.replace(".", "");
+ } else {
+ group = group.split("\\.")[0];
+ }
+ version = Integer.parseInt(group);
+ }
+ }
+ } catch (Exception e) {
+ CupidLogUtils.e(TAG, "版本解析失败=" + ver, e);
+ }
+ }
+ return version;
+ }
+
+ /**
+ * 金旅、开沃小巴乘客端
+ */
+ public boolean isBusPassenger() {
+ return IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode);
+ }
+
+ /**
+ * 开沃小巴司机端
+ */
+ public boolean isBusDriverVan() {
+ return IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode);
+ }
+
+ /**
+ * 金旅小巴司机端
+ */
+ public boolean isBusDriver() {
+ return IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode);
+ }
+
+ /**
+ * 福田清扫车司机端
+ */
+ public boolean isSweeperDriverFutian() {
+ return IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode);
+ }
+}
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java
index 61c6d1b9f4..7a63aed0b6 100644
--- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java
@@ -7,6 +7,7 @@ import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.CupidLogUtils;
+import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData;
import mogo.telematics.pad.MessagePad;
@@ -20,6 +21,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler {
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
MessagePad.CarConfigResp carConfigResp = MessagePad.CarConfigResp.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
AdasChannel.calculateTimeConsumingOnDispatchRaw("车机基础信息应答", raw.receiveTime);
+ AutopilotAbilityManager.getInstance().setCarConfig(carConfigResp);
AdasManager.getInstance().setCarConfig(carConfigResp);
long nowTime = 0;
if (CupidLogUtils.isEnableLog())
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java
index 081a1a9a58..edb7d6f1a0 100644
--- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java
@@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.msg;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.OnAdasListener;
-import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
+import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData;
import chassis.ChassisStatesOuterClass;
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java
index be81f42258..2d37f3ced7 100644
--- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java
@@ -5,7 +5,7 @@ import android.os.SystemClock;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.OnAdasListener;
-import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
+import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.protocol.RawData;
diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
index 0b3575b12a..567249f372 100644
--- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
+++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
@@ -5,7 +5,7 @@ import android.os.SystemClock;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.OnAdasListener;
-import com.zhidao.support.adas.high.common.AutopilotAbilityManager;
+import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.protocol.RawData;
@@ -141,7 +141,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
ChassisStatesOuterClass.GearSystemStates.Builder gearSystemStates = null;
if (vehicleState.hasGear()) {
gearSystemStates = ChassisStatesOuterClass.GearSystemStates.newBuilder();
- //挂挡档位数据
+ //档位数据
gearSystemStates.setGearPosition(vehicleState.getGear());//鹰眼已用
}
if (vehicleState.hasGearSwitchInference()) {
diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt
new file mode 100644
index 0000000000..9492c60ba7
--- /dev/null
+++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt
@@ -0,0 +1,7 @@
+package com.mogo.map.hdcache
+
+interface IHdCacheListener {
+ fun onMapHdCacheProgress(cityId: Int, progress: Double)
+
+ fun onMapHdCacheResult(cityId: Int, state: Int)// 0失败,1成功
+}
\ No newline at end of file
diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
index 362b48f839..93093c74f7 100644
--- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
+++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
@@ -9,6 +9,9 @@ import androidx.annotation.RawRes;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MogoLatLng;
+import com.mogo.map.hdcache.IHdCacheListener;
+
+import org.json.JSONObject;
import com.mogo.eagle.core.data.map.MogoLocation;
import java.util.List;
@@ -348,4 +351,13 @@ public interface IMogoMapUIController {
* @param color // color:"#RRGGBB*
*/
void setPointCloudColor(String color);
+ void cacheHDDataByCity(IHdCacheListener listener);
+
+ /**
+ * 当前城市离线数据是否已缓存
+ * @return
+ */
+ boolean isCityDataCached();
+
+ void cancelDownloadCacheData();
}
diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
index e264f883ad..09aea37182 100644
--- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
+++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
@@ -17,12 +17,14 @@ import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
+import android.os.Looper;
import android.os.Trace;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
+import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
@@ -40,19 +42,23 @@ import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
+import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.listener.MogoMapListenerHandler;
+import com.mogo.map.location.GDLocationClient;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
+import com.mogo.map.utils.HDMapUtils;
import com.mogo.map.utils.MogoMapUtils;
import com.mogo.map.utils.ObjectUtils;
import com.mogo.map.utils.ResIdCache;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
+import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
@@ -64,6 +70,7 @@ import com.zhidaoauto.map.sdk.open.business.PointCloudHelper;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
+import com.zhidaoauto.map.sdk.open.data.CityInfo;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.location.LocationClient;
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
@@ -115,6 +122,8 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
+ private IHdCacheListener hdCacheListener;
+
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
@@ -1035,4 +1044,72 @@ public class AMapViewWrapper implements IMogoMapView,
}
+
+ @Override
+ public void cacheHDDataByCity(IHdCacheListener listener) {
+ if (mMapView.getMapAutoViewHelper() != null) {
+ String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
+ Integer id = HDMapUtils.getHDCityCode(gdCityCode);
+ if (id != null) {
+ hdCacheListener = listener;
+ mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, new OnHdDataDownByCityListener() {
+ @Override
+ public void onMapHDDataCacheProgressByCity(int cityId, double progress) {
+ if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
+ }
+ } else {
+ UiThreadHandler.post(() -> {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败,1成功
+ if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheResult(i, state);
+ }
+ } else {
+ UiThreadHandler.post(() -> {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheResult(i, state);
+ }
+ });
+ }
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public boolean isCityDataCached() {
+ if (mMapView.getMapAutoViewHelper() != null) {
+ String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
+ Integer id = HDMapUtils.getHDCityCode(gdCityCode);
+ if (id != null) {
+ List