[code_opt_3.3.0] split autopilot status and param
This commit is contained in:
@@ -64,10 +64,8 @@ import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -84,7 +82,7 @@ import system_master.SystemStatusInfo;
|
||||
public class BusPassengerModel {
|
||||
private static final String TAG = BusPassengerModel.class.getSimpleName();
|
||||
|
||||
private List<MogoLocation> mRoutePoints = new ArrayList<>();
|
||||
private final List<MogoLocation> mRoutePoints = new ArrayList<>();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
|
||||
@@ -97,12 +95,12 @@ public class BusPassengerModel {
|
||||
private Context mContext;
|
||||
private IBusPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private IBusPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划
|
||||
private Map<String, IBusPassengerControllerStatusCallback> mControllerStatusCallbackMap = new ConcurrentHashMap<>();
|
||||
private final Map<String, IBusPassengerControllerStatusCallback> mControllerStatusCallbackMap = new ConcurrentHashMap<>();
|
||||
|
||||
private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态
|
||||
private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新
|
||||
|
||||
private MogoLocation mLocation = null;
|
||||
private MogoLocation mLocation = null;
|
||||
|
||||
private BusPassengerRoutesResult routesResult = null;
|
||||
|
||||
@@ -116,7 +114,7 @@ public class BusPassengerModel {
|
||||
private final Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if ( msg.what == MSG_QUERY_BUS_P_STATION ) {
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus();
|
||||
return true;
|
||||
}
|
||||
@@ -127,7 +125,7 @@ public class BusPassengerModel {
|
||||
private BusPassengerModel() {
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
mContext = context.getApplicationContext();
|
||||
initListeners();
|
||||
// TODO: 2022/3/31
|
||||
@@ -135,16 +133,16 @@ public class BusPassengerModel {
|
||||
startOrStopOrderLoop(true);
|
||||
}
|
||||
|
||||
public void setDriverStatusCallback(IBusPassegerDriverStatusCallback callback){
|
||||
public void setDriverStatusCallback(IBusPassegerDriverStatusCallback callback) {
|
||||
this.mDriverStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setRouteLineInfoCallback(IBusPassengerRouteLineInfoCallback callback){
|
||||
public void setRouteLineInfoCallback(IBusPassengerRouteLineInfoCallback callback) {
|
||||
this.mRouteLineInfoCallback = callback;
|
||||
}
|
||||
|
||||
private void queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_P_STATION, QUERY_BUS_P_STATION_DELAY );
|
||||
handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_P_STATION, QUERY_BUS_P_STATION_DELAY);
|
||||
}
|
||||
|
||||
private void queryDriverOperationStatus() {
|
||||
@@ -154,7 +152,7 @@ public class BusPassengerModel {
|
||||
public void onSuccess(BusPassengerOperationStatusResponse data) {
|
||||
if (data == null || data.data == null) return;
|
||||
if (mDriverStatusCallback != null) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverOperationStatus = %s", data.data.plateNumber );
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "queryDriverOperationStatus = %s", data.data.plateNumber);
|
||||
mDriverStatusCallback.changeOperationStatus(data.data.driverStatus == 1);
|
||||
mDriverStatusCallback.updatePlateNumber(data.data.plateNumber);
|
||||
}
|
||||
@@ -178,13 +176,13 @@ public class BusPassengerModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void queryDriverSiteByCoordinate(){
|
||||
public void queryDriverSiteByCoordinate() {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(mContext
|
||||
, new OchCommonServiceCallback<BusPassengerRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusPassengerRoutesResponse data) {
|
||||
if ( data == null || data.getResult() == null) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
|
||||
if (data == null || data.getResult() == null) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
|
||||
if (routesResult != null) {
|
||||
routesResult = null;
|
||||
mNextStationIndex = 0;
|
||||
@@ -192,7 +190,7 @@ public class BusPassengerModel {
|
||||
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
|
||||
if (mRouteLineInfoCallback != null){
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
mRouteLineInfoCallback.showNoTaskView();
|
||||
}
|
||||
|
||||
@@ -200,8 +198,8 @@ public class BusPassengerModel {
|
||||
|
||||
return;
|
||||
}
|
||||
if (routesResult != null && data.getResult().equals(routesResult)){
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = not update");
|
||||
if (routesResult != null && data.getResult().equals(routesResult)) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = not update");
|
||||
return;
|
||||
}
|
||||
routesResult = data.getResult();
|
||||
@@ -210,16 +208,16 @@ public class BusPassengerModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg
|
||||
+ ", sn = " +BusPassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
if (code == 1003){
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg
|
||||
+ ", sn = " + BusPassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
if (code == 1003) {
|
||||
queryDriverOperationDelay();
|
||||
}
|
||||
if (BusPassengerServiceManager.INSTANCE.getDriverAppSn().isEmpty()){
|
||||
if (BusPassengerServiceManager.INSTANCE.getDriverAppSn().isEmpty()) {
|
||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
||||
return;
|
||||
}
|
||||
if (code == 1003){
|
||||
if (code == 1003) {
|
||||
routesResult = null;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
return;
|
||||
@@ -229,35 +227,35 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
private void updatePassengerRouteInfo(BusPassengerRoutesResult result) {
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
mRouteLineInfoCallback.updateLineInfo(result.getName(), result.getRunningDur());
|
||||
mRouteLineInfoCallback.hideNoTaskView();
|
||||
if (result.getSites() != null){
|
||||
if (result.getSites() != null) {
|
||||
List<BusPassengerStation> stations = result.getSites();
|
||||
mStations.clear();
|
||||
mStations.addAll(stations);
|
||||
for (int i = 0; i< stations.size(); i++){
|
||||
BusPassengerStation station = stations.get(i);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){ //离站
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
|
||||
if(mNextStationIndex != i+1){
|
||||
mTwoStationsRouts.clear();
|
||||
startRemainRouteInfo();
|
||||
}
|
||||
mNextStationIndex = i+1;
|
||||
for (int i = 0; i < stations.size(); i++) {
|
||||
BusPassengerStation station = stations.get(i);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i + 1 < stations.size()) { //离站
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations, i + 1, false);
|
||||
if (mNextStationIndex != i + 1) {
|
||||
mTwoStationsRouts.clear();
|
||||
startRemainRouteInfo();
|
||||
}
|
||||
mNextStationIndex = i + 1;
|
||||
|
||||
updateAutopilotControlParameters(result,i);
|
||||
return;
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){ //到站
|
||||
if (i == 0){
|
||||
startOrStopRouteAndWipe(false);
|
||||
}
|
||||
mPreRouteIndex = 0;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
|
||||
clearAutopilotControlParameters();
|
||||
return;
|
||||
}
|
||||
updateAutopilotControlParameters(result, i);
|
||||
return;
|
||||
} else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()) { //到站
|
||||
if (i == 0) {
|
||||
startOrStopRouteAndWipe(false);
|
||||
}
|
||||
mPreRouteIndex = 0;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations, i, true);
|
||||
clearAutopilotControlParameters();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,7 +265,7 @@ public class BusPassengerModel {
|
||||
private void updateAutopilotControlParameters(BusPassengerRoutesResult busRoutesResult,
|
||||
int leaveIndex) {
|
||||
|
||||
AutopilotControlParameters parameters = initAutopilotControlParameters(busRoutesResult,leaveIndex);
|
||||
AutopilotControlParameters parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex);
|
||||
if (null == parameters) {
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG, "AutopilotControlParameters is empty.");
|
||||
return;
|
||||
@@ -283,11 +281,13 @@ public class BusPassengerModel {
|
||||
|
||||
private AutopilotControlParameters initAutopilotControlParameters(BusPassengerRoutesResult busRoutesResult,
|
||||
int leaveIndex) {
|
||||
if (busRoutesResult.getSites() == null){ return null ;}
|
||||
if (busRoutesResult.getSites() == null) {
|
||||
return null;
|
||||
}
|
||||
List<BusPassengerStation> stations = busRoutesResult.getSites();
|
||||
if (leaveIndex + 1 > stations.size() - 1) {
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG, "行程日志-mismatch condition1.");
|
||||
return null;
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG, "行程日志-mismatch condition1.");
|
||||
return null;
|
||||
}
|
||||
BusPassengerStation currentStation = stations.get(leaveIndex);
|
||||
BusPassengerStation nextStation = stations.get(leaveIndex + 1);
|
||||
@@ -339,7 +339,7 @@ public class BusPassengerModel {
|
||||
return;
|
||||
}
|
||||
|
||||
mControllerStatusCallbackMap.put(tag,callback);
|
||||
mControllerStatusCallbackMap.put(tag, callback);
|
||||
|
||||
}
|
||||
|
||||
@@ -347,16 +347,16 @@ public class BusPassengerModel {
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener);
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, 10,mMapLocationListener);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
|
||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG, mReceivedMsgListener);
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class BusPassengerModel {
|
||||
private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() {
|
||||
@Override
|
||||
public void onReceivedServerSn(@Nullable String sn) {
|
||||
Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedServerSn = "+sn);
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedServerSn = " + sn);
|
||||
if (mDriverStatusCallback != null) {
|
||||
mDriverStatusCallback.updateDriverSn(sn);
|
||||
}
|
||||
@@ -388,16 +388,16 @@ public class BusPassengerModel {
|
||||
|
||||
@Override
|
||||
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type){
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
|
||||
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
|
||||
Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedMsg = "+GsonUtils.toJson(baseMsg));
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg));
|
||||
|
||||
if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_COMMON.getType()){
|
||||
if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_COMMON.getType()) {
|
||||
AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class);
|
||||
if (msg.isViewShow()){ //消息盒子显示内容
|
||||
if (msg.isViewShow()) { //消息盒子显示内容
|
||||
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),msg.getMsg(),
|
||||
DateTimeUtil.getCurrentTimeStamp(), msg.getMsg(),
|
||||
OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
}
|
||||
}
|
||||
@@ -408,10 +408,10 @@ public class BusPassengerModel {
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onIntentReceived = %s", intentStr);
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intentStr)) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus();
|
||||
}
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public class BusPassengerModel {
|
||||
private final IMogoStatusChangedListener mMogoStatusChangedListener = (descriptor, isTrue) -> {
|
||||
if (StatusDescriptor.VR_MODE == descriptor) {
|
||||
if (mControllerStatusCallbackMap.size() > 0) {
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
for (IBusPassengerControllerStatusCallback callback : mControllerStatusCallbackMap.values()) {
|
||||
callback.onVRModeChanged(isTrue);
|
||||
}
|
||||
}
|
||||
@@ -432,18 +432,27 @@ public class BusPassengerModel {
|
||||
private final IMoGoChassisLocationGCJ02Listener mMapLocationListener = gnssInfo -> {
|
||||
if (null == gnssInfo) return;
|
||||
mLocation = gnssInfo;
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
for (IBusPassengerControllerStatusCallback callback : mControllerStatusCallbackMap.values()) {
|
||||
callback.onCarLocationChanged(gnssInfo);
|
||||
}
|
||||
};
|
||||
|
||||
private volatile int mPreAutoStatus = -1;
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -452,34 +461,24 @@ public class BusPassengerModel {
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
private boolean arriveAtEnd = false; //乘客app专用字段
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
mTwoStationsRouts.clear();
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
mTwoStationsRouts.clear();
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
mTwoStationsRouts.clear();
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
}
|
||||
mPreAutoStatus = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -498,60 +497,55 @@ public class BusPassengerModel {
|
||||
if (DebugConfig.isDebug()) {
|
||||
// ToastUtils.showShort("到达目的地");
|
||||
}
|
||||
if (mADASStatusCallback != null){
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onAutopilotArriveEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onAutopilotRotting = "
|
||||
+ GsonUtil.jsonFromObject(routeList));
|
||||
List<MessagePad.Location> routePoints = routeList.getWayPointsList();
|
||||
if (null != routePoints && routePoints.size() > 0){
|
||||
updateRoutePoints(routePoints);
|
||||
startToRouteAndWipe();
|
||||
}
|
||||
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = routeList -> {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onAutopilotRotting = "
|
||||
+ GsonUtil.jsonFromObject(routeList));
|
||||
List<MessagePad.Location> routePoints = routeList.getWayPointsList();
|
||||
if (null != routePoints && routePoints.size() > 0) {
|
||||
updateRoutePoints(routePoints);
|
||||
startToRouteAndWipe();
|
||||
}
|
||||
};
|
||||
|
||||
public void updateRoutePoints(List<MessagePad.Location> routePoints){
|
||||
public void updateRoutePoints(List<MessagePad.Location> routePoints) {
|
||||
mRoutePoints.clear();
|
||||
List<MogoLocation> latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjLocations(mContext,routePoints);
|
||||
.coordinateConverterWgsToGcjLocations(mContext, routePoints);
|
||||
mRoutePoints.addAll(latLngModels);
|
||||
calculateTwoStationsRoute();
|
||||
}
|
||||
|
||||
private void calculateTwoStationsRoute(){
|
||||
private void calculateTwoStationsRoute() {
|
||||
//找出前往站对应的轨迹点,拿出两站点的集合
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size());
|
||||
if (mRoutePoints.size() > 0) {
|
||||
if (mStations.size() > 1){ //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){
|
||||
if (mStations.size() > 1) { //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size() - 1 && mNextStationIndex - 1 >= 0) {
|
||||
mTwoStationsRouts.clear();
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
|
||||
//当前站在轨迹中对应的点
|
||||
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(0
|
||||
,mRoutePoints
|
||||
,stationCur.getGcjLon(),stationCur.getGcjLat());
|
||||
, mRoutePoints
|
||||
, stationCur.getGcjLon(), stationCur.getGcjLat());
|
||||
//要前往的站在轨迹中对应的点
|
||||
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(currentRouteIndex
|
||||
,mRoutePoints
|
||||
,stationNext.getGcjLon(),stationNext.getGcjLat());
|
||||
, mRoutePoints
|
||||
, stationNext.getGcjLon(), stationNext.getGcjLat());
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==currentRouteIndex = " + currentRouteIndex
|
||||
+ ", nextRouteIndex = " + nextRouteIndex);
|
||||
if (currentRouteIndex < nextRouteIndex){ //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex + 1));
|
||||
if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex, nextRouteIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,10 +553,10 @@ public class BusPassengerModel {
|
||||
// mTwoStationsRouts.clear();
|
||||
// mTwoStationsRouts.addAll(mRoutePoints);
|
||||
// }
|
||||
if (mTwoStationsRouts.size() > 0){
|
||||
if (mTwoStationsRouts.size() > 0) {
|
||||
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mTwoStationsRouts);
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, (int) sumLength);
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback.updateTotalDistance();
|
||||
}
|
||||
}
|
||||
@@ -572,46 +566,46 @@ public class BusPassengerModel {
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
//计算当前位置和下一站的剩余点集合
|
||||
//计算剩余点总里程和时间
|
||||
if (mTwoStationsRouts.size() == 0){
|
||||
if (mTwoStationsRouts.size() == 0) {
|
||||
calculateTwoStationsRoute();
|
||||
}
|
||||
if (mTwoStationsRouts.size() > 0 && mLocation != null){
|
||||
Map<Integer,List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex,mTwoStationsRouts,mLocation);
|
||||
for (int index: lastPointsMap.keySet()) {
|
||||
mPreRouteIndex = index;
|
||||
if (mTwoStationsRouts.size() > 0 && mLocation != null) {
|
||||
Map<Integer, List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex, mTwoStationsRouts, mLocation);
|
||||
for (int index : lastPointsMap.keySet()) {
|
||||
mPreRouteIndex = index;
|
||||
break;
|
||||
}
|
||||
|
||||
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
|
||||
for (List<MogoLocation> lastPoints : lastPointsMap.values()) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastPoints.size() = " + lastPoints.size());
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex >= 0){
|
||||
if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
if (mNextStationIndex <= mStations.size() - 1 && mNextStationIndex >= 0) {
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
stationNext.getGcjLon(), stationNext.getGcjLat(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
}else {
|
||||
} else {
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
}
|
||||
|
||||
double lastTime = lastSumLength / getAverageSpeed() * 3.6 ; //秒
|
||||
double lastTime = lastSumLength / getAverageSpeed() * 3.6; //秒
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastSumLength = " + lastSumLength);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long) lastSumLength, (long) lastTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getAverageSpeed(){
|
||||
public int getAverageSpeed() {
|
||||
return BusPassengerConst.BUS_AVERAGE_SPEED;
|
||||
}
|
||||
|
||||
@@ -626,19 +620,20 @@ public class BusPassengerModel {
|
||||
|
||||
/**
|
||||
* 实时轨迹擦除
|
||||
*
|
||||
* @param isStart
|
||||
*/
|
||||
public void startOrStopRouteAndWipe(boolean isStart){
|
||||
if (isStart){
|
||||
public void startOrStopRouteAndWipe(boolean isStart) {
|
||||
if (isStart) {
|
||||
BusPassengerModelLoopManager.getInstance().startOrStopRouteAndWipe();
|
||||
}else {
|
||||
} else {
|
||||
mWipePreIndex = 0;
|
||||
BusPassengerModelLoopManager.getInstance().stopOrStopRouteAndWipe();
|
||||
}
|
||||
}
|
||||
|
||||
public void loopRouteAndWipe() {
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null){
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null) {
|
||||
int haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndexNew(mWipePreIndex,
|
||||
mRoutePoints,
|
||||
@@ -646,17 +641,18 @@ public class BusPassengerModel {
|
||||
|
||||
mWipePreIndex = haveArrivedIndex;
|
||||
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = "+ Thread.currentThread().getName()+" haveArrivedIndex== " + haveArrivedIndex);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = " + Thread.currentThread().getName() + " haveArrivedIndex== " + haveArrivedIndex);
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
List<LatLng> routePoints = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterLocationToLatLng(mContext,mRoutePoints);
|
||||
mAutopilotPlanningCallback.routeResult(routePoints,haveArrivedIndex);
|
||||
.coordinateConverterLocationToLatLng(mContext, mRoutePoints);
|
||||
mAutopilotPlanningCallback.routeResult(routePoints, haveArrivedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始轮询计算剩余里程和时间
|
||||
*
|
||||
* @param isStart
|
||||
*/
|
||||
public void startOrStopCalculateRouteInfo(boolean isStart) {
|
||||
|
||||
@@ -34,8 +34,6 @@ import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,8 +43,6 @@ import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPresenter extends Presenter<BusFragment>
|
||||
implements IRefreshBusStationsCallback, ISlidePannelHideCallback
|
||||
@@ -55,7 +51,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
private int currentAutopilotStatus = -1;
|
||||
private List<BusStationBean> mStationList = new ArrayList<>();
|
||||
private final List<BusStationBean> mStationList = new ArrayList<>();
|
||||
private int mCurrentStation = 0;
|
||||
|
||||
public BusPresenter(BusFragment view) {
|
||||
@@ -168,9 +164,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
int state = autopilotStatusInfo.getState();
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus);
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
@@ -206,26 +200,21 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
&& (
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& OrderModel.getInstance().isGoingToNextStation()
|
||||
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus);
|
||||
});
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING:
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& OrderModel.getInstance().isGoingToNextStation()
|
||||
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
@@ -234,9 +223,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING;
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus);
|
||||
});
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
break;
|
||||
default:
|
||||
runOnUIThread(() -> mView.onAutopilotEnableChange(false));
|
||||
@@ -275,8 +262,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
@@ -340,4 +325,16 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onStartAdasFailure() {
|
||||
runOnUIThread(() -> mView.stopAnimAndUpdateBtnStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
@@ -77,7 +76,8 @@ object CharterPassengerModel {
|
||||
private var mContext: Context = AbsMogoApplication.getApp()
|
||||
|
||||
//Model->Presenter:自动驾驶状态相关
|
||||
var mAutoStatusChnageListener = ConcurrentHashMap<String, ICharterPassengerAutoStatusChangeCallback>()
|
||||
var mAutoStatusChnageListener =
|
||||
ConcurrentHashMap<String, ICharterPassengerAutoStatusChangeCallback>()
|
||||
|
||||
// 定位监听
|
||||
private val mControllerStatusCallbackMap =
|
||||
@@ -110,17 +110,18 @@ object CharterPassengerModel {
|
||||
* 到站是否播报 key 线路id+业务 value 是否播报
|
||||
*
|
||||
*/
|
||||
private var broadcastList : MutableMap<String,Boolean> = HashMap()
|
||||
private var broadcastList: MutableMap<String, Boolean> = HashMap()
|
||||
|
||||
// 到站仅一次
|
||||
private val endKey = "arrivedLine"
|
||||
private val endKeyRequestIng = "arrivedLineRequestIng"
|
||||
private val ending100Key = "arrivingLine"
|
||||
private val min5Speak = "min5Speak"
|
||||
|
||||
private var carTypeChageListener: IOrderChangeCallback?=null
|
||||
private var carTypeChageListener: IOrderChangeCallback? = null
|
||||
|
||||
private var subscribeCountDown: Disposable?=null
|
||||
var switchLine5minWait: Disposable?=null
|
||||
private var subscribeCountDown: Disposable? = null
|
||||
var switchLine5minWait: Disposable? = null
|
||||
|
||||
@Volatile
|
||||
var newCheckedSite: SiteInfoResponse.SiteInfo? = null
|
||||
@@ -147,7 +148,7 @@ object CharterPassengerModel {
|
||||
// 自动驾驶状态变化监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 4 ,mMapLocationListener)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 4, mMapLocationListener)
|
||||
// 自动驾驶路线规划接口 返回自动驾驶轨迹
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
// 登录状态监听
|
||||
@@ -163,6 +164,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
fun setAutoStatusCallback(tag: String, callback: ICharterPassengerAutoStatusChangeCallback?) {
|
||||
if (tag.isBlank()) return
|
||||
if (callback == null) {
|
||||
@@ -213,24 +215,17 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
// 前一个自动驾驶状体
|
||||
@Volatile
|
||||
private var mPreAutoStatus = -1
|
||||
|
||||
// 自动驾驶状态监听
|
||||
private val mGoAutopilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
object : IMoGoAutopilotStatusListener {
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val state = autoPilotStatusInfo.state
|
||||
if(mPreAutoStatus!=state){
|
||||
mPreAutoStatus = state
|
||||
mAutoStatusChnageListener.forEach {
|
||||
it.value.onAutoStatusChange(state)
|
||||
}
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
mAutoStatusChnageListener.forEach {
|
||||
it.value.onAutoStatusChange(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
CallerLogger.d(M_BUS_P + TAG,"底盘给到站信息")
|
||||
CallerLogger.d(M_BUS_P + TAG, "底盘给到站信息")
|
||||
arriveDest()
|
||||
}
|
||||
}
|
||||
@@ -260,11 +255,15 @@ object CharterPassengerModel {
|
||||
.coordinateConverterWgsToGcjLocations(mContext, routePoints)
|
||||
mRoutePoints = latLngModels
|
||||
}
|
||||
fun cleanRoutePoints(){
|
||||
|
||||
fun cleanRoutePoints() {
|
||||
mRoutePoints = null
|
||||
}
|
||||
|
||||
fun setStatusChangeListener(tag:String,orderStatusChangeListener: IOrderStatusChangeListener?) {
|
||||
fun setStatusChangeListener(
|
||||
tag: String,
|
||||
orderStatusChangeListener: IOrderStatusChangeListener?
|
||||
) {
|
||||
if (tag.isBlank()) return
|
||||
if (orderStatusChangeListener == null) {
|
||||
orderStatusChangeListeners.remove(tag)
|
||||
@@ -272,7 +271,8 @@ object CharterPassengerModel {
|
||||
}
|
||||
orderStatusChangeListeners[tag] = orderStatusChangeListener
|
||||
}
|
||||
fun setStationDistanceListener(tag:String,orderStatusChangeListener: IDistanceCallback?) {
|
||||
|
||||
fun setStationDistanceListener(tag: String, orderStatusChangeListener: IDistanceCallback?) {
|
||||
if (tag.isBlank()) return
|
||||
if (orderStatusChangeListener == null) {
|
||||
stationDistanceListener.remove(tag)
|
||||
@@ -280,7 +280,8 @@ object CharterPassengerModel {
|
||||
}
|
||||
stationDistanceListener[tag] = orderStatusChangeListener
|
||||
}
|
||||
fun setOrderLeftTimeListeners(tag:String,orderStatusChangeListener: ITimeCallback?) {
|
||||
|
||||
fun setOrderLeftTimeListeners(tag: String, orderStatusChangeListener: ITimeCallback?) {
|
||||
if (tag.isBlank()) return
|
||||
if (orderStatusChangeListener == null) {
|
||||
orderLeftTimeListeners.remove(tag)
|
||||
@@ -291,14 +292,15 @@ object CharterPassengerModel {
|
||||
orderStatusChangeListener.setOrderTimeCallBack(leftTime)
|
||||
}
|
||||
|
||||
fun setCarTypeChangeListener(carTypeChageListener: IOrderChangeCallback?){
|
||||
fun setCarTypeChangeListener(carTypeChageListener: IOrderChangeCallback?) {
|
||||
this.carTypeChageListener = carTypeChageListener
|
||||
}
|
||||
|
||||
fun getCurrentOrderStatus(): OrderStatusEnum {
|
||||
return this.orderStatus
|
||||
}
|
||||
fun getCurrentOrderInfo():OrderInfoResponse.OrderInfo?{
|
||||
|
||||
fun getCurrentOrderInfo(): OrderInfoResponse.OrderInfo? {
|
||||
return orderInfo
|
||||
}
|
||||
// endregion
|
||||
@@ -357,13 +359,13 @@ object CharterPassengerModel {
|
||||
BusPassengerServiceManager.queryOrderInfo(
|
||||
mContext, object : OchCommonServiceCallback<OrderInfoResponse> {
|
||||
override fun onSuccess(data: OrderInfoResponse?) {
|
||||
CallerLogger.d(M_BUS_P+TAG,"订单信息:$data")
|
||||
if (data?.data == null){
|
||||
if(orderInfo!=null){
|
||||
CallerLogger.d(M_BUS_P + TAG, "订单信息:$data")
|
||||
if (data?.data == null) {
|
||||
if (orderInfo != null) {
|
||||
// 启动车辆服务状态
|
||||
startCarStatusLoop()
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// 判断是否有订单
|
||||
ordrLagic(data.data)
|
||||
}
|
||||
@@ -382,21 +384,26 @@ object CharterPassengerModel {
|
||||
// 有订单有线路后结束轮训
|
||||
orderData.let { order ->
|
||||
//设置车模
|
||||
if (this.orderInfo?.productType!=orderData.productType) {
|
||||
if (this.orderInfo?.productType != orderData.productType) {
|
||||
this.carTypeChageListener?.setCarChangeListener(orderData.productType)
|
||||
CallerLogger.d(M_BUS_P+TAG,"设置车模")
|
||||
CallerLogger.d(M_BUS_P + TAG, "设置车模")
|
||||
}
|
||||
if(this.orderInfo?.siteId!=orderData.siteId){
|
||||
if (this.orderInfo?.siteId != orderData.siteId) {
|
||||
val coordinateConverterWgsToGcj =
|
||||
CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(
|
||||
mContext,
|
||||
order.wgs84Lon!!,
|
||||
order.wgs84Lat!!
|
||||
)
|
||||
this.carTypeChageListener?.setEndStationCallBack(order.siteId,order.siteName,coordinateConverterWgsToGcj.longitude,coordinateConverterWgsToGcj.latitude)
|
||||
this.carTypeChageListener?.setEndStationCallBack(
|
||||
order.siteId,
|
||||
order.siteName,
|
||||
coordinateConverterWgsToGcj.longitude,
|
||||
coordinateConverterWgsToGcj.latitude
|
||||
)
|
||||
}
|
||||
this.orderInfo?.orderNo?.let {
|
||||
if(it!=orderData.orderNo){
|
||||
if (it != orderData.orderNo) {
|
||||
// orderNo 变后清理
|
||||
SharedPrefs.getInstance(mContext).remove("${it}$min5Speak")
|
||||
}
|
||||
@@ -413,7 +420,7 @@ object CharterPassengerModel {
|
||||
this.orderInfo = orderData
|
||||
setOrderStatus(OrderStatusEnum.OrdersWithLine)
|
||||
updateAutopilotControlParameters()
|
||||
}else{
|
||||
} else {
|
||||
this.orderInfo = orderData
|
||||
}
|
||||
//计算终点距离
|
||||
@@ -433,7 +440,7 @@ object CharterPassengerModel {
|
||||
)
|
||||
// 小于15m到站
|
||||
if (calculateLineDistance < CharterPassengerConst.ARRIVE_AT_START_STATION_DISTANCE && calculateLineDistance > 0) {
|
||||
CallerLogger.d(M_BUS_P + TAG,"小于15米到站1")
|
||||
CallerLogger.d(M_BUS_P + TAG, "小于15米到站1")
|
||||
arriveDest()
|
||||
}
|
||||
if (calculateLineDistance < CharterPassengerConst.ARRIVE_SOON_AT_START_STATION_DISTANCE && calculateLineDistance > 0) {
|
||||
@@ -450,7 +457,7 @@ object CharterPassengerModel {
|
||||
fun hasSetLineAndSite(): Pair<LineInfoResponse.LineInfo, SiteInfoResponse.SiteInfo>? {
|
||||
orderInfo?.let {
|
||||
if (it.lineId != null && it.lineId > 0 && it.siteId != null && it.siteId!! > 0) {
|
||||
if(it.arriveStatus==OrderInfoResponse.ARRIVED){
|
||||
if (it.arriveStatus == OrderInfoResponse.ARRIVED) {
|
||||
return null
|
||||
}
|
||||
val lineInfo = LineInfoResponse.LineInfo(it.lineName, it.lineId)
|
||||
@@ -471,7 +478,8 @@ object CharterPassengerModel {
|
||||
}
|
||||
return null
|
||||
}
|
||||
fun hasOrder():Boolean{
|
||||
|
||||
fun hasOrder(): Boolean {
|
||||
return orderInfo != null
|
||||
}
|
||||
// endregion
|
||||
@@ -542,7 +550,7 @@ object CharterPassengerModel {
|
||||
private fun startCalibrationLoop() {
|
||||
BusPassengerModelLoopManager.setLoopFunction(
|
||||
TAGCALIBRATION,
|
||||
LoopInfo(120, ::queryBusinessTime,immediately = true)
|
||||
LoopInfo(120, ::queryBusinessTime, immediately = true)
|
||||
)
|
||||
CallerLogger.d(M_BUS_P + TAG, "启动时间校准轮询")
|
||||
}
|
||||
@@ -572,42 +580,43 @@ object CharterPassengerModel {
|
||||
}
|
||||
val leadTime = endlast / 1000
|
||||
subscribeCountDown =
|
||||
Observable.intervalRange(0L, leadTime, 0, 5, TimeUnit.SECONDS)
|
||||
.map { aLong -> leadTime - aLong }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe{millisUntilFinished->
|
||||
if (millisUntilFinished <= 300L) {
|
||||
orderInfo?.let {
|
||||
val isPlayed = SharedPrefs.getInstance(mContext)
|
||||
.getBoolean("${it.orderNo}$min5Speak", false)
|
||||
if (!isPlayed) {
|
||||
//发送 通知
|
||||
OCHSocketMessageManager.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),
|
||||
AbsMogoApplication.getApp()
|
||||
.getString(R.string.m1_end_order_5min), 2
|
||||
)
|
||||
VoiceManager.surplus5min(VoiceFocusManager.getVoiceCmdCallBack())
|
||||
CallerLogger.d(M_BUS_P+ TAG,"倒计时5分钟${it.orderNo}")
|
||||
SharedPrefs.getInstance(mContext).putBoolean("${it.orderNo}$min5Speak",true)
|
||||
Observable.intervalRange(0L, leadTime, 0, 5, TimeUnit.SECONDS)
|
||||
.map { aLong -> leadTime - aLong }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe { millisUntilFinished ->
|
||||
if (millisUntilFinished <= 300L) {
|
||||
orderInfo?.let {
|
||||
val isPlayed = SharedPrefs.getInstance(mContext)
|
||||
.getBoolean("${it.orderNo}$min5Speak", false)
|
||||
if (!isPlayed) {
|
||||
//发送 通知
|
||||
OCHSocketMessageManager.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),
|
||||
AbsMogoApplication.getApp()
|
||||
.getString(R.string.m1_end_order_5min), 2
|
||||
)
|
||||
VoiceManager.surplus5min(VoiceFocusManager.getVoiceCmdCallBack())
|
||||
CallerLogger.d(M_BUS_P + TAG, "倒计时5分钟${it.orderNo}")
|
||||
SharedPrefs.getInstance(mContext)
|
||||
.putBoolean("${it.orderNo}$min5Speak", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(orderInfo==null){
|
||||
subscribeCountDown?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
if (orderInfo == null) {
|
||||
subscribeCountDown?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
invokeOrderLeftTimeListeners(-1)
|
||||
invokeStationDistanceListener(-1, -1)
|
||||
} else {
|
||||
invokeOrderLeftTimeListeners(millisUntilFinished)
|
||||
}
|
||||
invokeOrderLeftTimeListeners(-1)
|
||||
invokeStationDistanceListener(-1,-1)
|
||||
}else{
|
||||
invokeOrderLeftTimeListeners(millisUntilFinished)
|
||||
CallerLogger.d(M_BUS_P + TAG, "订单倒计时${millisUntilFinished}")
|
||||
}
|
||||
CallerLogger.d(M_BUS_P + TAG, "订单倒计时${millisUntilFinished}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,9 +636,12 @@ object CharterPassengerModel {
|
||||
//设置全局轨迹信息
|
||||
locusInfo = data.data
|
||||
|
||||
CallerLogger.d(M_BUS_P+TAG,"查询自动驾驶轨迹信息")
|
||||
CallerLogger.d(M_BUS_P+TAG,GsonUtil.jsonFromObject(
|
||||
locusInfo))
|
||||
CallerLogger.d(M_BUS_P + TAG, "查询自动驾驶轨迹信息")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG, GsonUtil.jsonFromObject(
|
||||
locusInfo
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
@@ -667,15 +679,15 @@ object CharterPassengerModel {
|
||||
mLocationGCJ02?.let {
|
||||
orderInfo?.let { order ->
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance", "订单信息:$order")
|
||||
if(order.siteId==null||order.siteId==0L||
|
||||
order.wgs84Lat==null||order.wgs84Lat==0.0||
|
||||
order.wgs84Lon==null||order.wgs84Lon==0.0
|
||||
){
|
||||
if (order.siteId == null || order.siteId == 0L ||
|
||||
order.wgs84Lat == null || order.wgs84Lat == 0.0 ||
|
||||
order.wgs84Lon == null || order.wgs84Lon == 0.0
|
||||
) {
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance", "站点信息未获得")
|
||||
return
|
||||
}
|
||||
newCheckedSite?.let {
|
||||
if(it.siteId!=order.siteId){
|
||||
if (it.siteId != order.siteId) {
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance", "站点和已选不吻合")
|
||||
return
|
||||
}
|
||||
@@ -699,46 +711,52 @@ object CharterPassengerModel {
|
||||
mogoLocation.latitude
|
||||
)
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance", "两点距离和站点的直线距离:${lastSumLength}")
|
||||
if(lastSumLength>100) {
|
||||
if (mRoutePoints==null||mRoutePoints?.size == 0){
|
||||
if (lastSumLength > 100) {
|
||||
if (mRoutePoints == null || mRoutePoints?.size == 0) {
|
||||
//ToastCharterUtils.showLong("缺少轨迹数据暂停计算")
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance两点距离",
|
||||
CallerLogger.d(
|
||||
M_BUS_P + "calculateDistance两点距离",
|
||||
"缺少轨迹数据"
|
||||
)
|
||||
return
|
||||
}
|
||||
// 计算距离
|
||||
val templastSumLength =
|
||||
val templastSumLength =
|
||||
CoordinateCalculateRouteUtil.calculateRouteSumLength(
|
||||
mRoutePoints,
|
||||
it,
|
||||
mogoLocation
|
||||
)
|
||||
CallerLogger.d(M_BUS_P + TAG, "使用轨迹轨迹:${mRoutePoints?.size}--第一个点${mRoutePoints!![0]}--最后一个点:${mRoutePoints!!.last()}")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"使用轨迹轨迹:${mRoutePoints?.size}--第一个点${mRoutePoints!![0]}--最后一个点:${mRoutePoints!!.last()}"
|
||||
)
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance", "轨迹计算的距离$templastSumLength")
|
||||
if(templastSumLength>100){
|
||||
if (templastSumLength > 100) {
|
||||
lastSumLength = templastSumLength
|
||||
}
|
||||
}
|
||||
|
||||
val lastTime: Double = lastSumLength / CharterPassengerConst.Charter_AVERAGE_SPEED * 3.6 //秒
|
||||
val lastTime: Double =
|
||||
lastSumLength / CharterPassengerConst.Charter_AVERAGE_SPEED * 3.6 //秒
|
||||
|
||||
CallerLogger.d(M_BUS_P + "calculateDistance",
|
||||
CallerLogger.d(
|
||||
M_BUS_P + "calculateDistance",
|
||||
"最终信息:lastSumLength: ${lastSumLength}lastTime : $lastTime thread = ${Thread.currentThread().name}"
|
||||
)
|
||||
if (lastSumLength < CharterPassengerConst.ARRIVE_SOON_AT_START_STATION_DISTANCE&&lastSumLength>0) {
|
||||
CallerLogger.d(M_BUS_P + TAG,"小于100米到站2")
|
||||
if (lastSumLength < CharterPassengerConst.ARRIVE_SOON_AT_START_STATION_DISTANCE && lastSumLength > 0) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "小于100米到站2")
|
||||
arriveDestSoon()
|
||||
}
|
||||
if (lastSumLength < CharterPassengerConst.ARRIVE_AT_START_STATION_DISTANCE&&lastSumLength>0) {
|
||||
CallerLogger.d(M_BUS_P + TAG,"小于15米到站2")
|
||||
if (lastSumLength < CharterPassengerConst.ARRIVE_AT_START_STATION_DISTANCE && lastSumLength > 0) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "小于15米到站2")
|
||||
arriveDest()
|
||||
return
|
||||
}
|
||||
if(order.arriveStatus==OrderInfoResponse.ARRIVING) {
|
||||
if (order.arriveStatus == OrderInfoResponse.ARRIVING) {
|
||||
invokeStationDistanceListener(lastSumLength.toLong(), lastTime.toLong())
|
||||
}else{
|
||||
invokeStationDistanceListener(-1,-1)
|
||||
} else {
|
||||
invokeStationDistanceListener(-1, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -748,7 +766,7 @@ object CharterPassengerModel {
|
||||
|
||||
private fun setOrderStatus(orderStatus: OrderStatusEnum) {
|
||||
if (this.orderStatus != orderStatus) {
|
||||
CallerLogger.d(M_BUS_P + TAG,"${this.orderInfo?.orderNo}新的状态:$orderStatus")
|
||||
CallerLogger.d(M_BUS_P + TAG, "${this.orderInfo?.orderNo}新的状态:$orderStatus")
|
||||
this.orderStatus = orderStatus
|
||||
for (callback in orderStatusChangeListeners.values) {
|
||||
callback.onStatusChange(this.orderStatus)
|
||||
@@ -756,10 +774,10 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun setEndOrderStatus(){
|
||||
fun setEndOrderStatus() {
|
||||
UiThreadHandler.postDelayed({
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUse)
|
||||
},1000)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -786,16 +804,16 @@ object CharterPassengerModel {
|
||||
val calculateLineDistanceNext = CoordinateUtils.calculateLineDistance(
|
||||
currentInfo.longitude,
|
||||
currentInfo.latitude,
|
||||
data[index+1].GcjLon!!,
|
||||
data[index+1].GcjLat!!
|
||||
data[index + 1].GcjLon!!,
|
||||
data[index + 1].GcjLat!!
|
||||
)
|
||||
if(calculateLineDistanceNext<CharterPassengerConst.MIN_DISTANCE_STATION){
|
||||
if (calculateLineDistanceNext < CharterPassengerConst.MIN_DISTANCE_STATION) {
|
||||
if (index + 2 <= data.size - 1) {
|
||||
return Pair(index + 2, true)// 下下个站点
|
||||
}else{
|
||||
} else {
|
||||
return Pair(-1, true)// 距离最后一个站点小于30m
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
return Pair(index + 1, true)// 下个站点
|
||||
}
|
||||
} else {
|
||||
@@ -807,7 +825,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
for (mutableEntry in distanceMap) {
|
||||
CallerLogger.d(M_BUS_P+ TAG,"距离:${mutableEntry.key}-----第几个站点${mutableEntry.value}")
|
||||
CallerLogger.d(M_BUS_P + TAG, "距离:${mutableEntry.key}-----第几个站点${mutableEntry.value}")
|
||||
}
|
||||
var middle = -1
|
||||
if (distanceMap.size >= 2) {
|
||||
@@ -815,7 +833,7 @@ object CharterPassengerModel {
|
||||
middle = mutableEntry.value
|
||||
break
|
||||
}
|
||||
if(middle==0){
|
||||
if (middle == 0) {
|
||||
return Pair(1, false)
|
||||
}
|
||||
mLocationGCJ02?.let {
|
||||
@@ -824,7 +842,7 @@ object CharterPassengerModel {
|
||||
// middle middle+1
|
||||
// middle-1 middle-2
|
||||
// middle+1 middle+2
|
||||
if(middle-1>=0) {
|
||||
if (middle - 1 >= 0) {
|
||||
val degree = CoordinateCalculateRouteUtil.getDegree(
|
||||
it.longitude, it.latitude,
|
||||
data.get(middle).GcjLon!!, data.get(middle).GcjLat!!,
|
||||
@@ -834,17 +852,17 @@ object CharterPassengerModel {
|
||||
return Pair(middle, false)
|
||||
}
|
||||
}
|
||||
if(middle+1<data.size) {
|
||||
if (middle + 1 < data.size) {
|
||||
val degree = CoordinateCalculateRouteUtil.getDegree(
|
||||
it.longitude, it.latitude,
|
||||
data.get(middle + 1).GcjLon!!, data.get(middle + 1).GcjLat!!,
|
||||
data.get(middle).GcjLon!!, data.get(middle).GcjLat!!,
|
||||
)
|
||||
if (degree > 90) {
|
||||
return Pair(middle+1, false)
|
||||
return Pair(middle + 1, false)
|
||||
}
|
||||
}
|
||||
if(middle-2>=0) {
|
||||
if (middle - 2 >= 0) {
|
||||
val degree = CoordinateCalculateRouteUtil.getDegree(
|
||||
it.longitude, it.latitude,
|
||||
data.get(middle - 1).GcjLon!!, data.get(middle - 1).GcjLat!!,
|
||||
@@ -854,11 +872,11 @@ object CharterPassengerModel {
|
||||
return Pair(middle - 1, false)
|
||||
}
|
||||
}
|
||||
if(middle+2<data.size) {
|
||||
if (middle + 2 < data.size) {
|
||||
val degree = CoordinateCalculateRouteUtil.getDegree(
|
||||
it.longitude, it.latitude,
|
||||
data.get(middle + 2).GcjLon!!, data.get(middle + 2).GcjLat!!,
|
||||
data.get(middle+1).GcjLon!!, data.get(middle+1).GcjLat!!,
|
||||
data.get(middle + 1).GcjLon!!, data.get(middle + 1).GcjLat!!,
|
||||
)
|
||||
if (degree > 90) {
|
||||
return Pair(middle + 2, false)
|
||||
@@ -876,21 +894,29 @@ object CharterPassengerModel {
|
||||
BusPassengerServiceManager.endOrder(mContext, it, callback)
|
||||
}
|
||||
}
|
||||
fun getLineTrajectory(lineId: Long,callback: OchCommonServiceCallback<TrajectoriesResponse>?) {
|
||||
|
||||
fun getLineTrajectory(lineId: Long, callback: OchCommonServiceCallback<TrajectoriesResponse>?) {
|
||||
BusPassengerServiceManager.queryLineLocation(mContext, lineId = lineId.toString(), callback)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun arriveDest() {
|
||||
val (order, lineId, siteId) = getOrderInfo()
|
||||
if(order!=null&&lineId!=null&&siteId!=null){
|
||||
if (order != null && lineId != null && siteId != null) {
|
||||
val requestSuccessSign = "${siteId}$endKey"
|
||||
val requestIngSign = "${siteId}$endKeyRequestIng"//正在请求中
|
||||
CallerLogger.d(M_BUS_P + BaseDPMsg.TAG,
|
||||
"requestSuccessSign${isSuccess(requestSuccessSign)}---requestIngSign${isSuccess(requestIngSign)}")
|
||||
CallerLogger.d(
|
||||
M_BUS_P + BaseDPMsg.TAG,
|
||||
"requestSuccessSign${isSuccess(requestSuccessSign)}---requestIngSign${
|
||||
isSuccess(
|
||||
requestIngSign
|
||||
)
|
||||
}"
|
||||
)
|
||||
if (order.arriveStatus == OrderInfoResponse.ARRIVING) {
|
||||
if (isSuccess(requestSuccessSign)&&//true 请求还没有成功 false 请求成功
|
||||
isSuccess(requestIngSign)) {// true 还没有正在请求 false 正在请求中
|
||||
if (isSuccess(requestSuccessSign) &&//true 请求还没有成功 false 请求成功
|
||||
isSuccess(requestIngSign)
|
||||
) {// true 还没有正在请求 false 正在请求中
|
||||
val currentTimeStamp = DateTimeUtil.getCurrentTimeStamp()
|
||||
broadcastList[requestIngSign] = true //正在请求中
|
||||
BusPassengerServiceManager.arriveDest(
|
||||
@@ -898,23 +924,23 @@ object CharterPassengerModel {
|
||||
lindId = lineId,
|
||||
writtenVersion = currentTimeStamp,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
arrivedDeskSuccess(currentTimeStamp,true)
|
||||
broadcastList[requestIngSign] = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastCharterUtils.showShort("$code:$msg")
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
arrivedDeskSuccess(currentTimeStamp, true)
|
||||
broadcastList[requestIngSign] = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
super.onError()
|
||||
broadcastList[requestIngSign] = false
|
||||
}
|
||||
})
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastCharterUtils.showShort("$code:$msg")
|
||||
broadcastList[requestIngSign] = false
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
super.onError()
|
||||
broadcastList[requestIngSign] = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -922,16 +948,16 @@ object CharterPassengerModel {
|
||||
|
||||
fun arrivedDeskSuccess(
|
||||
currentTimeStamp: Long,
|
||||
needSendDriver:Boolean
|
||||
needSendDriver: Boolean
|
||||
) {
|
||||
val (order, lineId, siteId) = getOrderInfo()
|
||||
val requestSuccessSign = "${siteId}$endKey"
|
||||
|
||||
if (!isSuccess(requestSuccessSign)){
|
||||
if (!isSuccess(requestSuccessSign)) {
|
||||
return
|
||||
}
|
||||
|
||||
if(order!=null&&lineId!=null&&siteId!=null){
|
||||
if (order != null && lineId != null && siteId != null) {
|
||||
VoiceManager.arrivedStation(
|
||||
order.siteName!!,
|
||||
order.siteNameKr ?: "",
|
||||
@@ -948,7 +974,7 @@ object CharterPassengerModel {
|
||||
order.startSiteId ?: 0,
|
||||
order.startSiteName ?: "",
|
||||
siteId.toInt(),
|
||||
order.siteName?:"",
|
||||
order.siteName ?: "",
|
||||
true,
|
||||
OrderInfoResponse.ARRIVED,
|
||||
currentTimeStamp
|
||||
@@ -972,15 +998,15 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOrderInfo():Triple<OrderInfoResponse.OrderInfo?,Long?,Long?>{
|
||||
this.orderInfo?.let { order->
|
||||
private fun getOrderInfo(): Triple<OrderInfoResponse.OrderInfo?, Long?, Long?> {
|
||||
this.orderInfo?.let { order ->
|
||||
this.orderInfo?.lineId?.let { lineId ->
|
||||
this.orderInfo?.siteId?.let { siteId ->
|
||||
return Triple(order,lineId,siteId)
|
||||
return Triple(order, lineId, siteId)
|
||||
}
|
||||
}
|
||||
}
|
||||
return Triple(null,null,null)
|
||||
return Triple(null, null, null)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
@@ -989,7 +1015,8 @@ object CharterPassengerModel {
|
||||
order.siteId?.let { siteId ->
|
||||
if (order.arriveStatus == OrderInfoResponse.ARRIVING) {
|
||||
if (isSuccess("${siteId}$ending100Key")) {
|
||||
val string = mContext.getString(R.string.arrived_station_left_100,order.siteName)
|
||||
val string =
|
||||
mContext.getString(R.string.arrived_station_left_100, order.siteName)
|
||||
VoiceNotice.showNotice(string)
|
||||
broadcastList["${siteId}$ending100Key"] = true
|
||||
}
|
||||
@@ -1025,8 +1052,12 @@ object CharterPassengerModel {
|
||||
}
|
||||
|
||||
fun leaveStation() {
|
||||
orderInfo?.siteName?.let {cn->
|
||||
VoiceManager.leaveStation(cn,orderInfo?.siteNameKr?:"", VoiceFocusManager.getVoiceCmdCallBack())
|
||||
orderInfo?.siteName?.let { cn ->
|
||||
VoiceManager.leaveStation(
|
||||
cn,
|
||||
orderInfo?.siteNameKr ?: "",
|
||||
VoiceFocusManager.getVoiceCmdCallBack()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1050,14 +1081,17 @@ object CharterPassengerModel {
|
||||
return
|
||||
}
|
||||
orderInfo?.let {
|
||||
if(it.arriveStatus==OrderInfoResponse.ARRIVED){
|
||||
if (it.arriveStatus == OrderInfoResponse.ARRIVED) {
|
||||
ToastCharterUtils.showLong("已到达目的地请重新选择线路")
|
||||
return
|
||||
}
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
ToastCharterUtils.showShort("请选择站点")
|
||||
CallerLogger.e(SceneConstant.M_BUS + TAG, "行程日志-AutopilotControlParameters is empty.")
|
||||
CallerLogger.e(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"行程日志-AutopilotControlParameters is empty."
|
||||
)
|
||||
return
|
||||
}
|
||||
ToastCharterUtils.showShort("启动自动驾驶中")
|
||||
@@ -1118,12 +1152,14 @@ object CharterPassengerModel {
|
||||
fun sendTripInfo() {
|
||||
//发送前后屏出站消息 3:代表出站
|
||||
orderInfo?.let {
|
||||
CharterSendTripInfoManager.sendCharterTripInfo(LEAVE_STATION,
|
||||
it.lineName!!,it.startSiteName!!,it.siteName!!,false)
|
||||
CharterSendTripInfoManager.sendCharterTripInfo(
|
||||
LEAVE_STATION,
|
||||
it.lineName!!, it.startSiteName!!, it.siteName!!, false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun invokeOrderLeftTimeListeners(timeInSecond: Long){
|
||||
private fun invokeOrderLeftTimeListeners(timeInSecond: Long) {
|
||||
leftTime = timeInSecond
|
||||
UiThreadHandler.post({
|
||||
for (value in orderLeftTimeListeners.values) {
|
||||
@@ -1132,7 +1168,7 @@ object CharterPassengerModel {
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
private fun invokeStationDistanceListener(meters:Long , timeInSecond:Long){
|
||||
private fun invokeStationDistanceListener(meters: Long, timeInSecond: Long) {
|
||||
var tempMeters = meters
|
||||
var tempTimeInSecond = timeInSecond
|
||||
if (orderInfo?.arriveStatus == OrderInfoResponse.ARRIVED) {
|
||||
@@ -1141,7 +1177,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
UiThreadHandler.post({
|
||||
for (value in stationDistanceListener.values) {
|
||||
value.setDistancecAndTime(tempMeters,tempTimeInSecond)
|
||||
value.setDistancecAndTime(tempMeters, tempTimeInSecond)
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
|
||||
@@ -25,7 +24,6 @@ import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.event.DebugView
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import kotlinx.android.synthetic.main.m1_statusview_datetime.view.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@@ -47,8 +45,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
|
||||
private var mHits = LongArray(COUNTS)
|
||||
|
||||
private var preStatus = -1
|
||||
|
||||
private fun continuousClick(type:String) {
|
||||
//每次点击时,数组向前移动一位
|
||||
System.arraycopy(mHits, 1, mHits, 0, mHits.size - 1)
|
||||
@@ -94,14 +90,10 @@ class StatusBarView @JvmOverloads constructor(
|
||||
tv_power_cos.text = "50%"
|
||||
|
||||
val state = CallerAutoPilotStatusListenerManager.getState()
|
||||
setAutoPilotSatusInfo(state)
|
||||
setAutoPilotStatusInfo(state)
|
||||
}
|
||||
|
||||
private fun setAutoPilotSatusInfo(state: Int) {
|
||||
if(preStatus==state){
|
||||
return
|
||||
}
|
||||
preStatus = state
|
||||
private fun setAutoPilotStatusInfo(state: Int) {
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
@@ -126,9 +118,9 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
UiThreadHandler.post {
|
||||
setAutoPilotSatusInfo(autoPilotStatusInfo.state)
|
||||
setAutoPilotStatusInfo(state)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.magic.mogo.och.charter.fragment.DriverM1Fragment
|
||||
import com.magic.mogo.och.charter.manager.CharterTrajectoryManager
|
||||
import com.magic.mogo.och.charter.model.DriverM1Model
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -36,8 +35,9 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
IMoGoAutopilotStatusListener, StopSideStatusManager.OCHPlanningActionsCallback,
|
||||
IDriverM1ControllerStatusCallback {
|
||||
|
||||
private val TAG = DriverM1Presenter::class.java.name
|
||||
private var mCurrentAutopilotStatus : Int = -1
|
||||
companion object{
|
||||
private const val TAG = "DriverM1Presenter"
|
||||
}
|
||||
|
||||
init {
|
||||
DriverM1Model.get().init(context)
|
||||
@@ -139,19 +139,14 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
DriverM1Model.get().onAutopilotArriveAtStation()
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val status = autoPilotStatusInfo.state
|
||||
if (mCurrentAutopilotStatus == status) return
|
||||
|
||||
mView?.onAutopilotStatusChanged(status)
|
||||
mCurrentAutopilotStatus = status
|
||||
when(status){
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
mView?.onAutopilotStatusChanged(state)
|
||||
when(state){
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> { //
|
||||
//
|
||||
// }
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ->{
|
||||
DriverM1Model.get().triggerStartServiceEvent(false,true)
|
||||
DriverM1Model.get().triggerStartServiceEvent(isRestart = false, send = true)
|
||||
}
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE ->{
|
||||
//
|
||||
@@ -187,14 +182,12 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
}
|
||||
|
||||
override fun startOpenAutopilot() {
|
||||
mCurrentAutopilotStatus = -1
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.startAutopilotAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartAdasFailure() {
|
||||
mCurrentAutopilotStatus = -1
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.stopAnimAndUpdateBtnStatus()
|
||||
}
|
||||
|
||||
@@ -300,12 +300,10 @@ class PM2DrivingModel private constructor() {
|
||||
private val mAutoPilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
object : IMoGoAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
val status = autoPilotStatusInfo.state
|
||||
if (mCurrentAutoStatus == status) return
|
||||
d(SceneConstant.M_BUS_P+TAG, "onAutopilotStatusResponse ===== $status")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status){
|
||||
override fun onAutopilotStatusResponse(state: Int) { //todo yakun 检查逻辑
|
||||
super.onAutopilotStatusResponse(state)
|
||||
d(SceneConstant.M_BUS_P+TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
|
||||
@@ -314,11 +312,9 @@ class PM2DrivingModel private constructor() {
|
||||
}else{//非美化模式下
|
||||
mAutoStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
|
||||
}else{//自驾状态 2
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
mCurrentAutoStatus = status
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -167,14 +167,14 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
@@ -210,26 +210,21 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
&& (
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& OrderModel.getInstance().isGoingToNextStation()
|
||||
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus);
|
||||
});
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING:
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& OrderModel.getInstance().isGoingToNextStation()
|
||||
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
@@ -238,9 +233,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING;
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus);
|
||||
});
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
break;
|
||||
default:
|
||||
runOnUIThread(() -> mView.onAutopilotEnableChange(false));
|
||||
@@ -279,8 +272,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
@@ -345,4 +336,12 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onStartAdasFailure() {
|
||||
runOnUIThread(() -> mView.stopAnimAndUpdateBtnStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
private volatile int mPrevAPStatus = -1; //前一次自动驾驶状态值
|
||||
private volatile TaxiPassengerOrderQueryRespBean.Result mCurrentOCHOrder; //当前订单
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mInServiceList = Collections.emptyList(); //进行中订单
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mWaitServiceList = Collections.emptyList(); //待服务订单
|
||||
@@ -500,8 +499,15 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -510,31 +516,26 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
}
|
||||
|
||||
private boolean arriveAtEnd = false; //乘客app专用字段
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
int state = autopilotStatusInfo.getState();
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
// CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "state = %s", state );
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
if (mCurrentOCHOrder != null
|
||||
&& getCurOrderStatus() == TaxiPassengerOrderStatusEnum.UserArriveAtStart
|
||||
&& state != mPrevAPStatus) {
|
||||
|
||||
&& getCurOrderStatus() == TaxiPassengerOrderStatusEnum.UserArriveAtStart) {
|
||||
TaxiPassengerAnalyticsManager.getInstance().triggerStartAutopilotEvent(false, true,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.orderNo);
|
||||
|
||||
// 当高频返回autopilot 2时,不重复调用订单状态变更
|
||||
mPrevAPStatus = state; // 每个状态单独赋值,解决无订单时已经是2的状态导致的新订单来时无法进入此逻辑更新状态
|
||||
startServicePilotDone();
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
mPrevAPStatus = state;
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 当美化模式(演示模式)开启时:且是乘客app、且未到终点时,维持自动驾驶icon开启状态
|
||||
@@ -544,11 +545,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
arriveAtEnd = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
mPrevAPStatus = state;
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 当美化模式(演示模式)开启时:且是乘客app、且未到终点时,维持自动驾驶icon开启状态
|
||||
@@ -558,14 +556,12 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
arriveAtEnd = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -586,7 +582,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.mogo.och.taxi.model;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_SOURCE_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_TYPE_SOCKET_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
@@ -91,11 +96,6 @@ import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_SOURCE_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_TYPE_SOCKET_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
* <p>
|
||||
@@ -114,7 +114,6 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
private volatile int mPrevAPStatus = -1; //前一次自动驾驶状态值
|
||||
private volatile String mPrevOrderNo = ""; //前一次的新到单id(当次和前一次orderId相同时,本次不再弹出)
|
||||
private volatile OrderQueryRespBean.Result mNewBookingOrder; //新到待抢预约单
|
||||
private volatile OrderQueryRespBean.Result mCurrentOCHOrder; //当前订单
|
||||
@@ -133,7 +132,7 @@ public class TaxiModel {
|
||||
private int mPreRouteIndex = 0;
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
private MogoLocation mLocation = null;
|
||||
private MogoLocation mLocation = null;
|
||||
|
||||
private LoginService loginService;
|
||||
|
||||
@@ -248,13 +247,13 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(OCHOperationalMessage obj) {
|
||||
if (obj == null){
|
||||
if (obj == null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onMsgReceived = null");
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onMsgReceived = "+obj.getMessage());
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onMsgReceived = " + obj.getMessage());
|
||||
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(obj.getPushTimeStamp(),
|
||||
obj.getMessage(),OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
obj.getMessage(), OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -288,11 +287,11 @@ public class TaxiModel {
|
||||
|
||||
//更新接单状态
|
||||
public void updateCarStatus() {
|
||||
if(!LoginStatusManager.isLogin()){
|
||||
if (!LoginStatusManager.isLogin()) {
|
||||
loginService.queryLoginStatusByNet();
|
||||
return;
|
||||
}
|
||||
TaxiServiceManager.changeOrderServing(mContext,TaxtServingStatusManager.isOpeningOrderStatus(),
|
||||
TaxiServiceManager.changeOrderServing(mContext, TaxtServingStatusManager.isOpeningOrderStatus(),
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
@@ -347,8 +346,8 @@ public class TaxiModel {
|
||||
//1.1.2. 当本地有currentOrder:
|
||||
//orderId不一致时:通过currentOrder.orderId查询订单状态,并通知ui更新
|
||||
//orderId一致且orderStatus不一致时:则更新currentOrder,并通知ui更新
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG,"AutopilotControl-mCurrentOCHOrder = "+mCurrentOCHOrder.orderStatus
|
||||
+ ", orderStatus = " +data.data.servicing.get(0).orderStatus);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "AutopilotControl-mCurrentOCHOrder = " + mCurrentOCHOrder.orderStatus
|
||||
+ ", orderStatus = " + data.data.servicing.get(0).orderStatus);
|
||||
if (!mCurrentOCHOrder.orderNo.equals(data.data.servicing.get(0).orderNo)) {
|
||||
queryCurOrderStatus();
|
||||
} else if (mCurrentOCHOrder.orderStatus != data.data.servicing.get(0).orderStatus) {
|
||||
@@ -460,7 +459,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -489,7 +488,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -543,7 +542,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -637,7 +636,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -731,7 +730,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -747,7 +746,7 @@ public class TaxiModel {
|
||||
TaxiServiceManager.confirmAutopilotConditionByDriver(mContext,
|
||||
mCurrentOCHOrder.orderNo,
|
||||
result,
|
||||
new OchCommonServiceCallback<TaxiDataBaseRespBean>(){
|
||||
new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
@@ -761,19 +760,19 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateAutopilotStatus(boolean isSafe){
|
||||
if (mOrderStatusCallback != null){
|
||||
public void updateAutopilotStatus(boolean isSafe) {
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onDriverHasCheckedPilotCondition(isSafe);
|
||||
}
|
||||
}
|
||||
|
||||
public void queryAutopilotStatus(boolean isStart){
|
||||
if (isStart){
|
||||
public void queryAutopilotStatus(boolean isStart) {
|
||||
if (isStart) {
|
||||
queryAutopilotStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public void queryAutopilotStatus(){
|
||||
public void queryAutopilotStatus() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiServiceManager.queryAutopilotStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@@ -819,7 +818,7 @@ public class TaxiModel {
|
||||
SharedPrefsMgr.getInstance(mContext).putString(TaxiConst.SP_KEY_OCH_TAXI_ORDER,
|
||||
GsonUtil.jsonFromObject(data));
|
||||
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
@@ -830,7 +829,7 @@ public class TaxiModel {
|
||||
|
||||
updateAutopilotControlParameters();
|
||||
}
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.getCode()){
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.getCode()) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "setIPCDemoMode:false");
|
||||
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(false);
|
||||
@@ -846,7 +845,7 @@ public class TaxiModel {
|
||||
private void updateAutopilotControlParameters() {
|
||||
|
||||
AutopilotControlParameters parameters = initAutopilotControlParameters();
|
||||
if (null == parameters){
|
||||
if (null == parameters) {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "AutopilotControlParameters is empty.");
|
||||
return;
|
||||
}
|
||||
@@ -854,7 +853,7 @@ public class TaxiModel {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.updateAutopilotControlParameters(parameters);
|
||||
}
|
||||
|
||||
private void clearAutopilotControlParameters(){
|
||||
private void clearAutopilotControlParameters() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "AutopilotControlParameters is clear.");
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.updateAutopilotControlParameters(null);
|
||||
}
|
||||
@@ -905,19 +904,19 @@ public class TaxiModel {
|
||||
|
||||
//根据开关和后台是否发布轨迹启动自驾
|
||||
if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrl)
|
||||
&& TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrlDPQP)){
|
||||
&& TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrlDPQP)) {
|
||||
ToastUtils.showLong("无发布轨迹, 请发布后重试");
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
+ "busRoutesResult.csvFileUrl = "+ mCurrentOCHOrder.csvFileUrl
|
||||
+ "busRoutesResult.csvFileUrlDPQP = "+mCurrentOCHOrder.csvFileUrlDPQP);
|
||||
+ "busRoutesResult.csvFileUrl = " + mCurrentOCHOrder.csvFileUrl
|
||||
+ "busRoutesResult.csvFileUrlDPQP = " + mCurrentOCHOrder.csvFileUrlDPQP);
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand);
|
||||
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
TaxiAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
@@ -926,17 +925,11 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== CallerAutoPilotStatusListenerManager.INSTANCE.getState()) {
|
||||
// TODO: 2021/11/28 工控机存在刚开始状态为0,但是可以开启变为2,工控机解决前不显示此toast
|
||||
// ToastUtils.showShort("自动驾驶状态为不可用!");
|
||||
}
|
||||
|
||||
//点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.getCode()){
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.getCode()) {
|
||||
startServicePilotDone();
|
||||
isRestartAutopilot = false;
|
||||
}else {
|
||||
} else {
|
||||
isRestartAutopilot = true;
|
||||
}
|
||||
|
||||
@@ -950,9 +943,9 @@ public class TaxiModel {
|
||||
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "start autopilot with parameter: %s",
|
||||
GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr
|
||||
+ " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr
|
||||
+ "isRestartAutopilot = "+isRestartAutopilot);
|
||||
+ "isRestartAutopilot = " + isRestartAutopilot);
|
||||
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestartAutopilot, false,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.lineId, mCurrentOCHOrder.orderNo);
|
||||
@@ -1023,7 +1016,6 @@ public class TaxiModel {
|
||||
|
||||
if (distance <= TaxiConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
arrivedStartPoint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,7 +1026,7 @@ public class TaxiModel {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onIntentReceived = %s", intentStr);
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intentStr)) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(LoginStatusManager.isLogin()&&TaxtServingStatusManager.isOpeningOrderStatus());
|
||||
startOrStopOrderLoop(LoginStatusManager.isLogin() && TaxtServingStatusManager.isOpeningOrderStatus());
|
||||
loginService.queryLoginStatusByNet();
|
||||
}
|
||||
}
|
||||
@@ -1045,8 +1037,8 @@ public class TaxiModel {
|
||||
@Override
|
||||
public void onStartAutopilotFailure(@NotNull String startFailedCode, @NonNull String startFailedMessage) {
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage);
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode){
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "mAdasStartFailureListener = "+startFailedMessage);
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode) {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "mAdasStartFailureListener = " + startFailedMessage);
|
||||
mADASStatusCallback.onStartAdasFailure();
|
||||
}
|
||||
}
|
||||
@@ -1065,7 +1057,7 @@ public class TaxiModel {
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMoGoChassisLocationGCJ02Listener mMapLocationLIstener = new IMoGoChassisLocationGCJ02Listener() {
|
||||
private final IMoGoChassisLocationGCJ02Listener mMapLocationListener = new IMoGoChassisLocationGCJ02Listener() {
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
@@ -1075,7 +1067,7 @@ public class TaxiModel {
|
||||
judgeStartStation(gnssInfo);
|
||||
}
|
||||
if (getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd &&
|
||||
mPrevAPStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
judgeEndStation(gnssInfo);
|
||||
}
|
||||
}
|
||||
@@ -1089,7 +1081,7 @@ public class TaxiModel {
|
||||
}
|
||||
};
|
||||
|
||||
private void judgeEndStation(MogoLocation location) {
|
||||
private void judgeEndStation(MogoLocation location) {
|
||||
if (mCurrentOCHOrder == null || mCurrentOCHOrder.endSiteGcjPoint == null
|
||||
|| mCurrentOCHOrder.endSiteGcjPoint.size() < 2) {
|
||||
return;
|
||||
@@ -1109,7 +1101,6 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
arriveTerminal();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1158,8 +1149,15 @@ public class TaxiModel {
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1173,26 +1171,24 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
int state = autopilotStatusInfo.getState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (state != mPrevAPStatus && mADASStatusCallback != null){
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onAutopilotRunning();
|
||||
}
|
||||
if (mCurrentOCHOrder != null
|
||||
&& TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == mCurrentOCHOrder.orderStatus){
|
||||
if (state != mPrevAPStatus) {
|
||||
// 当高频返回autopilot 2时,不重复调用订单状态变更
|
||||
mPrevAPStatus = state; // 每个状态单独赋值,解决无订单时已经是2的状态导致的新订单来时无法进入此逻辑更新状态
|
||||
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestartAutopilot, true,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.lineId, mCurrentOCHOrder.orderNo);
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
CallerAutoPilotControlManager.INSTANCE.setIgnoreConditionDraw(true);
|
||||
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(true);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "美化模式-ignore:置为true(到达出发点且已开启自动驾驶)");
|
||||
}
|
||||
&& TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == mCurrentOCHOrder.orderStatus) {
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestartAutopilot, true,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.lineId, mCurrentOCHOrder.orderNo);
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
CallerAutoPilotControlManager.INSTANCE.setIgnoreConditionDraw(true);
|
||||
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(true);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "美化模式-ignore:置为true(到达出发点且已开启自动驾驶)");
|
||||
}
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
@@ -1203,10 +1199,9 @@ public class TaxiModel {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return;
|
||||
}
|
||||
if (mADASStatusCallback != null){
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onAutopilotEnable();
|
||||
}
|
||||
mPrevAPStatus = state;
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentOCHOrder()
|
||||
@@ -1215,34 +1210,30 @@ public class TaxiModel {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return;
|
||||
}
|
||||
if (mADASStatusCallback != null){
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onAutopilotDisable();
|
||||
}
|
||||
mPrevAPStatus = state;
|
||||
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
if (FunctionBuildConfig.isDemoMode){
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
if (checkCurrentOCHOrder()
|
||||
&& (getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)){//订单中
|
||||
|| getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)) {//订单中
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
}else { //美化模式下没订单,显示人工驾驶
|
||||
if (mADASStatusCallback != null){
|
||||
} else { //美化模式下没订单,显示人工驾驶
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onAutopilotDisable();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mADASStatusCallback != null){
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback.onManMachineCoDriving();
|
||||
}
|
||||
mPrevAPStatus = state;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1274,7 +1265,7 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList() != null){
|
||||
if (null != routeList && routeList.getWayPointsList() != null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "getWayPointsList = "
|
||||
+ routeList.getWayPointsList().size());
|
||||
}
|
||||
@@ -1288,12 +1279,11 @@ public class TaxiModel {
|
||||
|
||||
/**
|
||||
* 设置路径规划起终点
|
||||
*
|
||||
* @param latLngModels
|
||||
*/
|
||||
public void setRouteLineMarker(List<LatLng> latLngModels) {
|
||||
// List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||
// .coordinateConverterWgsToGcjListCommon(mContext,models);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback.setLineMarker(latLngModels);
|
||||
}
|
||||
}
|
||||
@@ -1348,7 +1338,7 @@ public class TaxiModel {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "--------计算出sumLength开始---------- ");
|
||||
|
||||
//转换成高德坐标系
|
||||
if (mRoutePoints.size() > 0){
|
||||
if (mRoutePoints.size() > 0) {
|
||||
mRoutePoints.clear();
|
||||
}
|
||||
mRoutePoints.addAll(CoordinateCalculateRouteUtil
|
||||
@@ -1364,14 +1354,14 @@ public class TaxiModel {
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "--------mRoutePoints.size---------- " + mRoutePoints.size());
|
||||
|
||||
if (mRoutePoints.size() > 0){
|
||||
if (mRoutePoints.size() > 0) {
|
||||
reportTotalDisAndTime();
|
||||
}
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true);
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(false,false);
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onNaviToEnd(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,18 +1376,18 @@ public class TaxiModel {
|
||||
* 实时计算当前剩余里程和时间
|
||||
*/
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
if (mLocation == null){
|
||||
if (mLocation == null) {
|
||||
return;
|
||||
}
|
||||
if (mRoutePoints.size() > 0 && mLocation != null){
|
||||
Map<Integer,List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex,mRoutePoints, mLocation);
|
||||
if (mRoutePoints.size() > 0 && mLocation != null) {
|
||||
Map<Integer, List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex, mRoutePoints, mLocation);
|
||||
|
||||
for (int index: lastPointsMap.keySet()) {
|
||||
for (int index : lastPointsMap.keySet()) {
|
||||
mPreRouteIndex = index;
|
||||
break;
|
||||
}
|
||||
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
|
||||
for (List<MogoLocation> lastPoints : lastPointsMap.values()) {
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
@@ -1410,9 +1400,9 @@ public class TaxiModel {
|
||||
double lastTime = lastSumLength / TaxiConst.TAXI_AVERAGE_SPEED * 3.6; //秒
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "dynamicCalculateRouteInfo"
|
||||
, "---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime
|
||||
+ " thread = "+ Thread.currentThread().getName());
|
||||
+ " thread = " + Thread.currentThread().getName());
|
||||
|
||||
if (mCurrentOCHOrder != null){
|
||||
if (mCurrentOCHOrder != null) {
|
||||
mCurrentOCHOrder.decreaseTravelDistance(lastSumLength);
|
||||
}
|
||||
if (mOrderStatusCallback != null) {
|
||||
@@ -1427,16 +1417,16 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
private void routeAndWipe() {
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null){
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null) {
|
||||
int haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndexNew(mPreRouteIndex,
|
||||
mRoutePoints,
|
||||
mLocation.getLongitude(),
|
||||
mLocation.getLatitude());
|
||||
List<LatLng> routePoints = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterLocationToLatLng(mContext,mRoutePoints);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routeResult(routePoints,haveArrivedIndex);
|
||||
.coordinateConverterLocationToLatLng(mContext, mRoutePoints);
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback.routeResult(routePoints, haveArrivedIndex);
|
||||
}
|
||||
setRouteLineMarker(routePoints);
|
||||
}
|
||||
@@ -1537,7 +1527,7 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void startServicePilotDone(){
|
||||
public void startServicePilotDone() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
@@ -1558,7 +1548,7 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void arrivedStartPoint(){
|
||||
public void arrivedStartPoint() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
@@ -1579,7 +1569,7 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void arriveTerminal(){
|
||||
public void arriveTerminal() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
@@ -1600,7 +1590,7 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void orderCompleted(){
|
||||
public void orderCompleted() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
@@ -1622,28 +1612,28 @@ public class TaxiModel {
|
||||
|
||||
// 登出
|
||||
public void logout() {
|
||||
loginService.loginOut(mLatitude,mLongitude);
|
||||
loginService.loginOut(mLatitude, mLongitude);
|
||||
}
|
||||
|
||||
//导航去订单终点目的地
|
||||
public void startNaviToEndStation(boolean isShow){
|
||||
if (mRoutePoints.size() > 0 ){ //使用自驾轨迹
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(false,isShow);
|
||||
public void startNaviToEndStation(boolean isShow) {
|
||||
if (mRoutePoints.size() > 0) { //使用自驾轨迹
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onNaviToEnd(false, isShow);
|
||||
}
|
||||
}else {//若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航
|
||||
if (isShow && mRoutePoints.size() == 0 && mOrderStatusCallback != null){
|
||||
} else {//若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航
|
||||
if (isShow && mRoutePoints.size() == 0 && mOrderStatusCallback != null) {
|
||||
|
||||
mOrderStatusCallback.onNaviToEnd(true,true);
|
||||
}else {
|
||||
mOrderStatusCallback.onNaviToEnd(true, true);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mRoutePoints.size() == 0 && mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(true,false);
|
||||
if (mRoutePoints.size() == 0 && mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onNaviToEnd(true, false);
|
||||
}
|
||||
}
|
||||
},2000l);
|
||||
}, 2000l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,16 +117,17 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + autopilotStatusInfo.getState());
|
||||
SweeperTaskModel.getInstance().setAutopilotState(autopilotStatusInfo.getState());
|
||||
ThreadUtils.runOnUiThread(() -> mView.startAutoBtn(autopilotStatusInfo.getState()));
|
||||
switch (autopilotStatusInfo.getState()) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
SweeperTaskModel.getInstance().setAutopilotState(state);
|
||||
ThreadUtils.runOnUiThread(() -> mView.startAutoBtn(state));
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
|
||||
@@ -207,8 +208,6 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
}
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
@@ -237,12 +236,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
|
||||
}
|
||||
|
||||
public void onArriveTaskEnd(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
@@ -251,9 +248,6 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||
if (cleanSystemState == null) {
|
||||
return;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mVehicleStateCurrentTimeMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
|
||||
return;
|
||||
@@ -279,30 +273,29 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
// 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式
|
||||
boolean clean_mode_pure_sweep = SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("开关:")
|
||||
.append(clean_open_requirement)
|
||||
.append("\n")
|
||||
.append("纯扫:")
|
||||
.append(clean_mode_wash_sweep)
|
||||
.append("纯洗:")
|
||||
.append(clean_mode_pure_wash)
|
||||
.append("纯吸:")
|
||||
.append(clean_mode_pure_draw)
|
||||
.append("纯扫:")
|
||||
.append("\n")
|
||||
.append(clean_mode_pure_sweep)
|
||||
.append("左侧:")
|
||||
.append(clean_direction_left_side)
|
||||
.append("右侧:")
|
||||
.append(clean_direction_right_side)
|
||||
.append("两侧:")
|
||||
.append("\n")
|
||||
.append(clean_direction_both_side)
|
||||
.append("标准:")
|
||||
.append(clean_intensity_standard)
|
||||
.append("强力:")
|
||||
.append(clean_intensity_strong);
|
||||
String stringBuilder = "开关:" +
|
||||
clean_open_requirement +
|
||||
"\n" +
|
||||
"纯扫:" +
|
||||
clean_mode_wash_sweep +
|
||||
"纯洗:" +
|
||||
clean_mode_pure_wash +
|
||||
"纯吸:" +
|
||||
clean_mode_pure_draw +
|
||||
"纯扫:" +
|
||||
"\n" +
|
||||
clean_mode_pure_sweep +
|
||||
"左侧:" +
|
||||
clean_direction_left_side +
|
||||
"右侧:" +
|
||||
clean_direction_right_side +
|
||||
"两侧:" +
|
||||
"\n" +
|
||||
clean_direction_both_side +
|
||||
"标准:" +
|
||||
clean_intensity_standard +
|
||||
"强力:" +
|
||||
clean_intensity_strong;
|
||||
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCleanSystemState:" + stringBuilder);
|
||||
mView.onSweeperFutianCleanSystemState(cleanSystemState);
|
||||
@@ -310,27 +303,23 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianTaskIndexData(@NonNull RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex roboSweeperTaskIndex) {
|
||||
if (roboSweeperTaskIndex == null) {
|
||||
return;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
return;
|
||||
}
|
||||
mWeltDataCurrentTimeMillis = current;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("清扫模式:")
|
||||
.append(roboSweeperTaskIndex.getCleanMode())
|
||||
.append("清扫方向:")
|
||||
.append(roboSweeperTaskIndex.getCleanDirection())
|
||||
.append("清扫强度:")
|
||||
.append(roboSweeperTaskIndex.getCleanIntensity())
|
||||
.append("贴边距离:")
|
||||
.append(roboSweeperTaskIndex.getDistToRefEdgePoint())
|
||||
.append("经度:")
|
||||
.append(roboSweeperTaskIndex.getLocLon())
|
||||
.append("纬度:")
|
||||
.append(roboSweeperTaskIndex.getLocLat());
|
||||
String stringBuilder = "清扫模式:" +
|
||||
roboSweeperTaskIndex.getCleanMode() +
|
||||
"清扫方向:" +
|
||||
roboSweeperTaskIndex.getCleanDirection() +
|
||||
"清扫强度:" +
|
||||
roboSweeperTaskIndex.getCleanIntensity() +
|
||||
"贴边距离:" +
|
||||
roboSweeperTaskIndex.getDistToRefEdgePoint() +
|
||||
"经度:" +
|
||||
roboSweeperTaskIndex.getLocLon() +
|
||||
"纬度:" +
|
||||
roboSweeperTaskIndex.getLocLat();
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianTaskIndexData:" + stringBuilder);
|
||||
String tempLongitude=NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLon(), 6);
|
||||
String tempLatitude=NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLat(), 6);
|
||||
@@ -458,4 +447,12 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
public void setRouteList(@NonNull ArrayList<SweeperRoutePlanningUpdateReqBean.Result> routeList) {
|
||||
mView.setTaskRouteList(routeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ class V2XBizTrace {
|
||||
companion object {
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_CLOUD_V2N,
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_V2X_MSG,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
fun onAck(data: Any, data1: Any) {
|
||||
|
||||
@@ -6,9 +6,9 @@ import android.util.*
|
||||
import androidx.annotation.*
|
||||
import androidx.localbroadcastmanager.content.*
|
||||
import com.mogo.eagle.core.data.config.*
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_CLOUD_V2N
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_V2X_MSG
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_CLOUD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_CLOUD_V2N
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_V2X
|
||||
import com.mogo.eagle.core.data.enums.*
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew.Companion.isRoadEvent
|
||||
@@ -144,9 +144,9 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
* V2XEvent事件回调
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_CLOUD_V2N,
|
||||
linkChainLog = CHAIN_TYPE_V2X,
|
||||
linkCode = CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = CHAIN_CODE_CLOUD_V2N,
|
||||
nodeAliasCode = CHAIN_CODE_V2X_MSG,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
override fun onAck(event: V2XEvent) {
|
||||
@@ -179,9 +179,9 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_CLOUD_V2N,
|
||||
linkChainLog = CHAIN_TYPE_V2X,
|
||||
linkCode = CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = CHAIN_CODE_CLOUD_V2N,
|
||||
nodeAliasCode = CHAIN_CODE_V2X_MSG,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
override fun onAutopilotIdentifyPlanningObj(planningObjects: List<PlanningObject>?) {
|
||||
|
||||
@@ -28,11 +28,11 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SO
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_VEHICLE
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
@@ -127,7 +127,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) {
|
||||
CallerChassisGnssListenerManager.invokeChassisGnssListener(gnssInfo)
|
||||
|
||||
if (gnssInfo != null) {
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
||||
@@ -363,8 +362,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
carConfigResp: MessagePad.CarConfigResp?
|
||||
) {
|
||||
if (carConfigResp != null) {
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.dockVersion = carConfigResp.dockVersion
|
||||
updateAutoPilotDockerInfo(carConfigResp.dockVersion)
|
||||
AppConfigInfo.dockerVersion = carConfigResp.dockVersion
|
||||
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
|
||||
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
|
||||
@@ -686,9 +684,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
* @param rsi 数据
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_CLOUD_V2N,
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_V2X_MSG,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
override fun onV2nCongestionEvent(header: MessagePad.Header, rsi: MogoV2X.RSI_PB) {
|
||||
@@ -706,9 +704,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
* @param parkingViolation 违停 ---包含 静态障碍车
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_CLOUD_V2N,
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_V2X_MSG,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
override fun onV2nGlobalPathEvents(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.datacenter.autopilot.server
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
@@ -36,7 +35,6 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
}
|
||||
|
||||
private var mPreAutoStatus = AtomicInteger(-1)
|
||||
private var createSubscribe: Disposable? = null
|
||||
|
||||
fun initServer() {
|
||||
@@ -45,16 +43,11 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
val state = autoPilotStatusInfo.state
|
||||
if (mPreAutoStatus.get() != state) {
|
||||
mPreAutoStatus.set(state)
|
||||
createSubscribe?.let {
|
||||
if (!it.isDisposed) {
|
||||
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "自动驾驶状态变化,取消前置轨迹请求,间隔2s重新请求底盘轨迹")
|
||||
createSubscribe?.dispose()
|
||||
}
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
createSubscribe?.let {
|
||||
if (!it.isDisposed) {
|
||||
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "自动驾驶状态变化,取消前置轨迹请求,间隔2s重新请求底盘轨迹")
|
||||
createSubscribe?.dispose()
|
||||
}
|
||||
|
||||
when (state) {
|
||||
|
||||
@@ -65,10 +65,7 @@ class TeleMsgHandler : IMsgHandler {
|
||||
AdasManager.getInstance().decoderRaw(it.body)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.e(
|
||||
"${SceneConstant.M_ADAS_IMPL}$TAG",
|
||||
"乘客屏解析数据过程中出现异常:${e.message}"
|
||||
)
|
||||
invokeNettyConnResult("乘客屏解析数据过程中出现异常:${e.message}")
|
||||
}
|
||||
}
|
||||
MogoProtocolMsg.SYNC_MODE_STATUS -> {
|
||||
@@ -144,11 +141,6 @@ class TeleMsgHandler : IMsgHandler {
|
||||
CallerTrafficLightListenerManager.invokeEnterCrossRoad(false)
|
||||
}
|
||||
}
|
||||
TelematicConstant.OPEN_ROMA_STATUS -> {
|
||||
ThreadUtils.runOnUiThread {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
|
||||
}
|
||||
}
|
||||
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR -> {
|
||||
ThreadUtils.runOnUiThread {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,it.body)
|
||||
@@ -223,11 +215,6 @@ class TeleMsgHandler : IMsgHandler {
|
||||
TelematicConstant.BUSINESS_STRING -> {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
|
||||
}
|
||||
TelematicConstant.OPEN_ROMA_STATUS -> {
|
||||
ThreadUtils.runOnUiThread {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow.trace
|
||||
|
||||
import android.content.*
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion.STATUS_AUTOPILOT_RUNNING
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
@@ -37,7 +36,6 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) {
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
val code = guardianInfo?.code
|
||||
@@ -70,9 +68,7 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
val state = autoPilotStatusInfo.state
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
try {
|
||||
if (ipcStatus.get() != state) {
|
||||
if (state != STATUS_AUTOPILOT_RUNNING) {
|
||||
|
||||
@@ -66,8 +66,8 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_RECORD_NATIVE_LEAK)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_ANR] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_RECORD_ANR)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_CLOUD_V2N] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_CLOUD_WEB_SOCKET_V2N)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_V2X] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_V2X)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_HD_MAP] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_HD_MAP_BIZ)
|
||||
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEAK_NETWORK] =
|
||||
@@ -96,7 +96,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
ChainLogParam(true, "Native Leak Record")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_ANR] =
|
||||
ChainLogParam(true, "ANR Record")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_CLOUD_V2N] =
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_V2X] =
|
||||
ChainLogParam(true, "Cloud WebSocket V2N")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_HD_MAP] =
|
||||
ChainLogParam(true, "HD Map Caller")
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -72,18 +71,15 @@ class IPCUpgradeManager: IMogoOnMessageListener<IPCUpgradeStateInfo> ,
|
||||
//更新下载or升级状态
|
||||
CallerHmiManager.showAdUpgradeStatus(it)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
* @param autoPilotStatusInfo 状态信息
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
//有升级任务,且不处于自动驾驶状态,进行升级提示
|
||||
autopilotStatus = state
|
||||
if(hasIPCUpgradeTask && autopilotStatus!=2){
|
||||
ipcUpgradeStateInfoTask?.let {
|
||||
var releaseId=""
|
||||
|
||||
@@ -19,14 +19,12 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.*
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chassis.Chassis
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.constants.SharedPrefsConstants
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
@@ -82,7 +80,6 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffe
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.component1
|
||||
@@ -126,8 +123,6 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
private var logInfoView: LogInfoView? = null
|
||||
private var logViewAttach = false
|
||||
|
||||
@Volatile
|
||||
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
|
||||
private var mGnssInfo: MogoLocation? = null
|
||||
|
||||
private var accelerationFloatWindow: AccelerationFloatWindow? = null
|
||||
@@ -932,7 +927,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
clipboardManager?.setPrimaryClip(
|
||||
ClipData.newPlainText(
|
||||
"DockVersion",
|
||||
mAutoPilotStatusInfo?.dockVersion
|
||||
CallerAutoPilotStatusListenerManager.getDockerVersion()?:""
|
||||
)
|
||||
)
|
||||
ToastUtils.showLong("docker版本复制成功")
|
||||
@@ -1090,13 +1085,8 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
/**
|
||||
* 设置域控制器点击监听
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setDomainControllerCheckedChangeListener() {
|
||||
|
||||
// 初始化工控机 IP信息
|
||||
val autoPilotIpAddress =
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP)
|
||||
|
||||
etAutopilotIP.setText("192.168.1.")
|
||||
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
|
||||
//设置工控机IP
|
||||
@@ -1586,8 +1576,9 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
} else {
|
||||
tvIpcProtocolVersionInfo.text = "工控机协议版本:${AppConfigInfo.protocolVersionNumber}"
|
||||
}
|
||||
tvIpcVersionInfo.text = "MAP:${mAutoPilotStatusInfo?.dockVersion}"
|
||||
tvIpcVersionInfoKey.text = "MAP:${mAutoPilotStatusInfo?.dockVersion}"
|
||||
val dockerVersion = CallerAutoPilotStatusListenerManager.getDockerVersion()
|
||||
tvIpcVersionInfo.text = "MAP:$dockerVersion"
|
||||
tvIpcVersionInfoKey.text = "MAP:$dockerVersion"
|
||||
tvMoGoMapVersion.text = "HD-Map版本:${DebugConfig.getMapVersion()}"
|
||||
tvMoGoMapVersionKey.text = "HD-Map版本:${DebugConfig.getMapVersion()}"
|
||||
tvGitBranchInfo.text = "Git分支:${AppConfigInfo.workingBranchName}"
|
||||
@@ -1658,12 +1649,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
"司机端Server启动"
|
||||
}
|
||||
else -> {
|
||||
"乘客端${
|
||||
when {
|
||||
!AppConfigInfo.serverSn.isNullOrEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn?:""})"
|
||||
else -> ""
|
||||
}
|
||||
}连接"
|
||||
"乘客端${"(司机屏SN是:${AppConfigInfo.serverSn})"}连接"
|
||||
}
|
||||
}
|
||||
}是否正常:${
|
||||
@@ -1696,11 +1682,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}"
|
||||
)
|
||||
|
||||
mAutoPilotStatusInfo?.let {
|
||||
val autopilotJson = GsonUtils.toJson(it)
|
||||
tvAutopilotInfo.text = autopilotJson
|
||||
tvIpcInfo.text = autopilotJson
|
||||
tvIpcInfoKey.text = autopilotJson
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString().let {
|
||||
tvAutopilotInfo.text = it
|
||||
tvIpcInfo.text = it
|
||||
tvIpcInfoKey.text = it
|
||||
}
|
||||
tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:""
|
||||
|
||||
@@ -1780,8 +1765,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
/**
|
||||
* 自动驾驶状态回调
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
mAutoPilotStatusInfo = autoPilotStatusInfo
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
setAutopilotConnectStatus()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,9 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
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.CallerAutopilotCarConfigListenerManager
|
||||
@@ -44,7 +42,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
), IMoGoAutopilotStatusListener {
|
||||
) {
|
||||
|
||||
companion object{
|
||||
private const val TAG = "AutoPilotAndCheckView"
|
||||
@@ -52,8 +50,6 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
private var keyBoardUtil: KeyBoardUtil? = null
|
||||
@Volatile
|
||||
private var connectStatus = false
|
||||
private var lastTime = 0L
|
||||
|
||||
init {
|
||||
@@ -174,7 +170,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
svLayout.post {
|
||||
svLayout.fullScroll(View.FOCUS_DOWN)
|
||||
}
|
||||
if (!connectStatus) { //todo 单次获取
|
||||
if (!CallerAutoPilotStatusListenerManager.getConnectStates()) {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
return@setOnTouchListener true
|
||||
@@ -267,20 +263,14 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun onClose(v: View)
|
||||
fun showDebugPanelView()
|
||||
|
||||
@@ -6,13 +6,12 @@ import android.util.TypedValue.COMPLEX_UNIT_PX
|
||||
import android.view.LayoutInflater
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.pnc.PncActionsHelper
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.currentRoadTrafficLight
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.isRed
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -40,9 +39,6 @@ class PncActionsView @JvmOverloads constructor(
|
||||
@Volatile
|
||||
private var mTrafficLightResult: TrafficLightResult? = null
|
||||
|
||||
@Volatile
|
||||
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
|
||||
|
||||
private val bgResources: Int
|
||||
private val topMargin: Float
|
||||
private val txtSize: Float
|
||||
@@ -68,7 +64,7 @@ class PncActionsView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
(tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin.toInt()
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize.toFloat())
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize)
|
||||
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
||||
@@ -82,10 +78,8 @@ class PncActionsView @JvmOverloads constructor(
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
mAutoPilotStatusInfo = autoPilotStatusInfo
|
||||
if (mAutoPilotStatusInfo!!.state != STATUS_AUTOPILOT_RUNNING) {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state != STATUS_AUTOPILOT_RUNNING) {
|
||||
UiThreadHandler.post {
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
@@ -96,45 +90,43 @@ class PncActionsView @JvmOverloads constructor(
|
||||
@BizConfig(FOUNDATION, "", BIZ_PNC_ACTIONS)
|
||||
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
||||
try {
|
||||
mAutoPilotStatusInfo?.let {
|
||||
UiThreadHandler.post {
|
||||
if (it.state == STATUS_AUTOPILOT_RUNNING) {
|
||||
var actions: String? = null
|
||||
planningActionMsg.actionMsg?.let { it ->
|
||||
try {
|
||||
actions = PncActionsHelper.getAction(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
&& mTrafficLightResult != null
|
||||
&& getWaitTrafficLightTime().isNotBlank()
|
||||
) {
|
||||
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
|
||||
} else {
|
||||
mTrafficLightResult = null
|
||||
}
|
||||
UiThreadHandler.post {
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == STATUS_AUTOPILOT_RUNNING) {
|
||||
var actions: String? = null
|
||||
planningActionMsg.actionMsg?.let { it ->
|
||||
try {
|
||||
actions = PncActionsHelper.getAction(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
// update view
|
||||
if (actions.isNullOrEmpty()) {
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
&& mTrafficLightResult != null
|
||||
&& getWaitTrafficLightTime().isNotBlank()
|
||||
) {
|
||||
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
|
||||
} else {
|
||||
this.background =
|
||||
AppCompatResources.getDrawable(context, bgResources)
|
||||
tvHmiPncActions.text = actions
|
||||
mTrafficLightResult = null
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// update view
|
||||
if (actions.isNullOrEmpty()) {
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
} else {
|
||||
this.background =
|
||||
AppCompatResources.getDrawable(context, bgResources)
|
||||
tvHmiPncActions.text = actions
|
||||
}
|
||||
} else {
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
@@ -16,7 +15,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -33,31 +31,22 @@ class TakeOverView @JvmOverloads constructor(
|
||||
const val TAG = "TakeOverView"
|
||||
}
|
||||
|
||||
private var autopilotStatus: Int = 0 //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中,7:平行驾驶中
|
||||
private var isParallel: Boolean = false //是否是平行驾驶
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_take_over, this, true)
|
||||
}
|
||||
|
||||
private var takeOver = false
|
||||
private var isParallel: Boolean = false //是否是平行驾驶
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
*
|
||||
* @param autoPilotStatusInfo 状态信息
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
if(autoPilotStatusInfo.state == 7){
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if(state == 7){
|
||||
isParallel = true
|
||||
}else if(autoPilotStatusInfo.state == 0 || autoPilotStatusInfo.state == 1){
|
||||
}else if(state == 0 || state == 1){
|
||||
isParallel = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -37,7 +36,7 @@ class AutoPilotStatusView constructor(
|
||||
|
||||
private var mAutopilotStatus: Int = 0
|
||||
|
||||
init{
|
||||
init {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
@@ -119,8 +118,8 @@ class AutoPilotStatusView constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
setAutoPilotStatus(autoPilotStatusInfo.state)
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
setAutoPilotStatus(state)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
@@ -29,12 +28,7 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
const val TAG = "CheckSystemView"
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var connectStatus = false //是否连接工控机
|
||||
@Volatile
|
||||
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var dockerRebootDialog: DockerRebootDialog? = null
|
||||
|
||||
private var downloadStatus: String = "" //下载状态
|
||||
private var upgradeStatus: String = "" //升级状态
|
||||
|
||||
@@ -54,7 +48,7 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
dockerRebootDialog = DockerRebootDialog(context)
|
||||
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
if (autopilotStatus == 2) {
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == 2) {
|
||||
//当前处于自动驾驶状态,不可进行重启,Toast提示
|
||||
ToastUtils.showShort("请先退出自动驾驶状态")
|
||||
}
|
||||
@@ -106,16 +100,15 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
connectStatus = autoPilotStatusInfo.connectStatus //单次
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
override fun onAutopilotConnectInfo(connectInfo: Boolean) {
|
||||
super.onAutopilotConnectInfo(connectInfo)
|
||||
ThreadUtils.runOnUiThread {
|
||||
setViewStatus()
|
||||
setViewStatus(connectInfo)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setViewStatus() {
|
||||
if (connectStatus) {
|
||||
private fun setViewStatus(connectInfo:Boolean) {
|
||||
if (connectInfo) {
|
||||
viewCheckShutDown.requestFocus()
|
||||
viewCheckShutDown.isClickable = true
|
||||
viewCheckReboot.requestFocus()
|
||||
@@ -124,7 +117,6 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
viewCheckShutDown.isClickable = false
|
||||
viewCheckReboot.isClickable = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -94,9 +94,8 @@ class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener,
|
||||
|
||||
private val mGoAutopilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
object : IMoGoAutopilotStatusListener {
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
val state = autoPilotStatusInfo.state
|
||||
d("$M_BUS_P$TAG", "state = %s", state)
|
||||
if (autopilotIV != null) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -44,8 +43,6 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private var dockerVersion: String? = null //工控机版本
|
||||
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
|
||||
private var ipcUpgradeStateInfo: IPCUpgradeStateInfo?=null
|
||||
|
||||
private var needQueryContainers: Boolean = false
|
||||
@@ -320,17 +317,9 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
needQueryContainers = false
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
CallerLogger.i(
|
||||
"$M_HMI$TAG",
|
||||
"onAutopilotStatusResponse dockerVersion=$dockerVersion , autopilotStatus=$autopilotStatus"
|
||||
)
|
||||
setViewStatus()
|
||||
}
|
||||
|
||||
private fun setViewStatus() {
|
||||
override fun onAutopilotDockerInfo(dockerVersion: String) {
|
||||
super.onAutopilotDockerInfo(dockerVersion)
|
||||
this.dockerVersion = dockerVersion
|
||||
showCurrentAdVersion()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,16 +5,12 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.main.AppListActivity
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_version_name.view.*
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
@@ -89,11 +85,12 @@ class VersionNameView @JvmOverloads constructor(
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
override fun onAutopilotDockerInfo(dockerVersion: String) {
|
||||
super.onAutopilotDockerInfo(dockerVersion)
|
||||
this.dockerVersion = dockerVersion
|
||||
showCurrentMapVersion()
|
||||
//将工控机版本赋值给BadCase配置常量
|
||||
CallerDevaToolsManager.dockerVersion(autoPilotStatusInfo.dockVersion)
|
||||
CallerDevaToolsManager.dockerVersion(dockerVersion)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -91,12 +91,15 @@ public class MogoRouteOverlayManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int mode = autoPilotStatusInfo.getState();
|
||||
if (mode == 2) {
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
if (state == 2) {
|
||||
isArriveAtStation.set(false);
|
||||
}
|
||||
this.autopilotMode.set(mode);
|
||||
this.autopilotMode.set(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,4 +138,12 @@ public class MogoRouteOverlayManager implements
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotConnectInfo(boolean connectInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.widget.RelativeLayout
|
||||
import androidx.annotation.UiThread
|
||||
import com.amap.api.maps.*
|
||||
import com.amap.api.maps.model.*
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -50,9 +49,6 @@ class SmallMapView @JvmOverloads constructor(
|
||||
private var mContext: Context? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
|
||||
@Volatile
|
||||
private var autoPilotStatus = 0
|
||||
|
||||
companion object {
|
||||
const val TAG = "SmallMapView"
|
||||
}
|
||||
@@ -318,14 +314,12 @@ class SmallMapView @JvmOverloads constructor(
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val tempStatus = autoPilotStatusInfo.state
|
||||
if (tempStatus != 2) {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state != 2) {
|
||||
UiThreadHandler.post {
|
||||
clearPolyline()
|
||||
}
|
||||
}
|
||||
autoPilotStatus = tempStatus
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class ChainConstant {
|
||||
const val CHAIN_TYPE_SOCKET_P_OBJECTS = 7
|
||||
const val CHAIN_TYPE_SOCKET_P_ACTIONS = 8
|
||||
const val CHAIN_TYPE_NATIVE_LEAK = 100
|
||||
const val CHAIN_TYPE_CLOUD_V2N = 200
|
||||
const val CHAIN_TYPE_V2X = 200
|
||||
const val CHAIN_TYPE_HD_MAP = 300
|
||||
const val CHAIN_TYPE_ANR = 400
|
||||
const val CHAIN_LINK_LOG_WEAK_NETWORK = 500
|
||||
@@ -44,7 +44,7 @@ class ChainConstant {
|
||||
const val CHAIN_LINK_LOG_ADAS_PLANNING_OBJECTS = "-adasWsPlanningObj"
|
||||
const val CHAIN_LINK_LOG_ADAS_PLANNING_ACTIONS = "-adasWsPlanningActions"
|
||||
const val CHAIN_LINK_LOG_RECORD_NATIVE_LEAK = "-eagleRecordNativeLeak"
|
||||
const val CHAIN_LINK_LOG_CLOUD_WEB_SOCKET_V2N = "-eagleCloudWSV2N"
|
||||
const val CHAIN_LINK_LOG_V2X = "-eagleCloudWSV2X"
|
||||
const val CHAIN_LINK_LOG_HD_MAP_BIZ = "-eagleHDMapBiz"
|
||||
const val CHAIN_LINK_LOG_RECORD_ANR = "-eagleRecordANR"
|
||||
const val CHAIN_LINK_LOG_RECORD_WEAK_NETWORK = "-eagleRecordWeakNetwork"
|
||||
@@ -90,7 +90,8 @@ class ChainConstant {
|
||||
const val CHAIN_CODE_HTTP_DNS_CITY_CODE = "CHAIN_CODE_HTTP_DNS_CITY_CODE"
|
||||
const val CHAIN_CODE_HTTP_DNS_ERROR_REASON = "CHAIN_CODE_HTTP_DNS_ERROR_REASON"
|
||||
|
||||
const val CHAIN_CODE_CLOUD_V2N = "CHAIN_CODE_CLOUD_V2N"
|
||||
const val CHAIN_CODE_V2X_MSG = "CHAIN_CODE_V2X_MSG"
|
||||
const val CHAIN_CODE_MSG_BOX = "CHAIN_CODE_MSG_BOX"
|
||||
|
||||
const val CHAIN_CODE_INIT_ON_MAP_LOADED = "CHAIN_CODE_INIT_ON_MAP_LOADED"
|
||||
const val CHAIN_CODE_INIT_ON_MAP_INIT = "CHAIN_CODE_INIT_ON_MAP_INIT"
|
||||
|
||||
@@ -10,8 +10,6 @@ class TelematicConstant {
|
||||
const val BUSINESS_STRING = 100
|
||||
const val SHOW_TRAFFIC_LIGHT = 101
|
||||
const val HIDE_TRAFFIC_LIGHT = 102
|
||||
const val OPEN_ROMA_STATUS = 103
|
||||
const val ROMA_UPDATE = 104
|
||||
const val CONTROL_PASSENGER_DRIVER_MONITOR = 105
|
||||
|
||||
const val OBU_RUNREDLIGHT_WARNING = 200 //闯红灯预警开关
|
||||
|
||||
@@ -13,18 +13,33 @@ import system_master.*
|
||||
interface IMoGoAutopilotStatusListener {
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息 TODO 接口优化,拆分业务属性字段
|
||||
* 自动驾驶状态信息
|
||||
*
|
||||
* @param autoPilotStatusInfo 状态信息
|
||||
*/
|
||||
@Deprecated("3.3.0之后不建议使用此种回调方式,按需回调,主界面暂时使用用于check检查信息透出")
|
||||
fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
*
|
||||
* @param status 状态信息
|
||||
* @param state 状态信息
|
||||
*/
|
||||
fun onAutopilotStatusResponse(status: Int) {}
|
||||
fun onAutopilotStatusResponse(state: Int) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶docker信息
|
||||
*
|
||||
* @param dockerVersion docker版本
|
||||
*/
|
||||
fun onAutopilotDockerInfo(dockerVersion:String){}
|
||||
|
||||
/**
|
||||
* 自动驾驶连接状态
|
||||
*
|
||||
* @param connectInfo 连接状态
|
||||
*/
|
||||
fun onAutopilotConnectInfo(connectInfo:Boolean){}
|
||||
|
||||
/**
|
||||
* 自动驾驶到站
|
||||
|
||||
@@ -31,8 +31,8 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
private var status: Int by Delegates.observable(0){_, oldValue, newValue ->
|
||||
if(oldValue != newValue){
|
||||
private var autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotStatusResponse(newValue)
|
||||
@@ -40,12 +40,38 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
private var dockerV: String by Delegates.observable("") { _, oldValue, newValue ->
|
||||
if (!oldValue.contentEquals(newValue)) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotDockerInfo(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var connectStatus:Boolean by Delegates.observable(false){_, oldValue, newValue ->
|
||||
if(oldValue != newValue){
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotConnectInfo(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var autoPilotMessageCode: String = ""
|
||||
|
||||
@Volatile
|
||||
private var autoPilotMessageContent: String = ""
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotStatusListener) {
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatusInfo)
|
||||
listener.onAutopilotStatusResponse(autopilotState)
|
||||
if(dockerV.isNotEmpty()){
|
||||
listener.onAutopilotDockerInfo(dockerV)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AutoPilot状态
|
||||
*/
|
||||
@@ -61,10 +87,21 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
return lineId ?: 0L
|
||||
}
|
||||
|
||||
fun getDockerInfo(): String? {
|
||||
fun getDockerVersion():String?{
|
||||
return mAutopilotStatusInfo.dockVersion
|
||||
}
|
||||
|
||||
fun getConnectStates():Boolean{
|
||||
return mAutopilotStatusInfo.connectStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时刻WGS84 卫星时间
|
||||
*/
|
||||
fun getCurWgs84SatelliteTime(): Double {
|
||||
return mAutopilotStatusInfo.satelliteTime
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AutoPilot状态
|
||||
*/
|
||||
@@ -87,21 +124,17 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
|
||||
fun updateAutoPilotStatus(state: Int, autopilotMode: Int) {
|
||||
mAutopilotStatusInfo.state = state
|
||||
fun updateAutoPilotStatus(autopilotState: Int, autopilotMode: Int) {
|
||||
this.autopilotState = autopilotState
|
||||
mAutopilotStatusInfo.state = autopilotState
|
||||
mAutopilotStatusInfo.pilotmode = autopilotMode
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时刻WGS84 卫星时间
|
||||
*/
|
||||
fun getCurWgs84SatelliteTime(): Double {
|
||||
return mAutopilotStatusInfo.satelliteTime
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotStatusListener) {
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatusInfo)
|
||||
fun updateAutoPilotDockerInfo(dockerV: String) {
|
||||
this.dockerV = dockerV
|
||||
mAutopilotStatusInfo.dockVersion = dockerV
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,6 +142,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutoPilotStatus() {
|
||||
connectStatus = mAutopilotStatusInfo.connectStatus
|
||||
invokeAutoPilotStatus(mAutopilotStatusInfo)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.mogo.eagle.core.function.call.msgbox
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
|
||||
object CallerMsgBoxManager {
|
||||
|
||||
@@ -24,6 +25,12 @@ object CallerMsgBoxManager {
|
||||
/**
|
||||
* 存储数据到消息盒子
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_MSG_BOX,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
fun saveMsgBox(bean: MsgBoxBean) {
|
||||
providerApi?.saveMsg(bean)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_INIT;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_SEND_GLOBAL_PATH;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_SEND_SYSTEM_CMD;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_SEND_TRAJECTORY_DOWNLOAD;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_START_AUTOPILOT;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_CONNECT_ADDRESS;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_ADAS_INIT;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_STATUS_CHANGE_REASON;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_SOURCE_ADAS;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_TYPE_INIT_STATUS;
|
||||
@@ -16,6 +16,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -294,7 +295,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
@ChainLog(linkChainLog = CHAIN_TYPE_INIT_STATUS,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = CHAIN_CODE_CONNECT_ADDRESS,
|
||||
paramIndexes = {0,1})
|
||||
paramIndexes = {0, 1})
|
||||
private void connectSocket(String address, int port) {
|
||||
if (mSocket != null) {
|
||||
mSocket.connectWebSocket(address, port);
|
||||
@@ -524,7 +525,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
@Override
|
||||
public void onConnecting(String msg) {
|
||||
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.CONNECTING, msg);
|
||||
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.CONNECTING, msg == null ? "" : msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -550,7 +551,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
ipcConnectedPort = Constants.DEFAULT_PORT;
|
||||
subscribeInterface = null;
|
||||
usedChassisType = Constants.CHASSIS_TYPE.UNKNOWN;
|
||||
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.DISCONNECTED, t);
|
||||
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.DISCONNECTED, t == null ? "" : t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -638,11 +639,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
* @param reason 状态描述
|
||||
* 如果ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED && reason==null 表示主动断开连接
|
||||
*/
|
||||
@ChainLog(linkChainLog = CHAIN_TYPE_INIT_STATUS,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = CHAIN_CODE_STATUS_CHANGE_REASON,
|
||||
paramIndexes = {0, 1})
|
||||
private void updateConnectStatus(@Define.IPCConnectionStatus int status, @Nullable String reason) {
|
||||
Log.d("emArrow", "status:" + status + " , reason :" + reason);
|
||||
log(status, reason);
|
||||
ipcConnectionStatus.set(status);
|
||||
if (status == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AutopilotAbilityManager.getInstance().start();
|
||||
@@ -663,6 +662,14 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
CupidLogUtils.i(TAG, "工控机连接状态 status=" + status + " reason=" + reason);
|
||||
}
|
||||
|
||||
@ChainLog(linkChainLog = CHAIN_TYPE_INIT_STATUS,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = CHAIN_CODE_STATUS_CHANGE_REASON,
|
||||
paramIndexes = {0, 1})
|
||||
private void log(int status, @Nullable String reason) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stopDispatchHandler() {
|
||||
|
||||
@@ -21,7 +21,6 @@ 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;
|
||||
@@ -391,6 +390,12 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_HD_MAP,
|
||||
linkCode = CHAIN_SOURCE_MAP,
|
||||
nodeAliasCode = CHAIN_CODE_HD_MAP_CALL,
|
||||
paramIndexes = {0}
|
||||
)
|
||||
@Override
|
||||
public void setRomaMode(int mode) {
|
||||
if (checkAMapView()) {
|
||||
@@ -818,12 +823,10 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onCameraChangeFinish(@Nullable CameraPosition cameraPosition) {
|
||||
if (cameraPosition != null) {
|
||||
Trace.beginSection("timer.onCameraChangeFinish");
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),
|
||||
cameraPosition.getZoom(),
|
||||
cameraPosition.getTilt(),
|
||||
cameraPosition.getBearing());
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,7 +930,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
/**
|
||||
* 加载3D模型
|
||||
*/
|
||||
private void loadPreVehicleModel() { //todo 耗时打印
|
||||
private void loadPreVehicleModel() {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "添加感知模型到地图中……");
|
||||
ThreadUtils.getIoPool().submit(() -> {
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
|
||||
@@ -1042,8 +1045,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
PointCloudHelper.INSTANCE.setPointCloudColor(color);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
|
||||
Reference in New Issue
Block a user