diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index c83715f9f1..9a54140635 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -67,6 +67,7 @@ public abstract class BaseBusTabFragment private RelativeLayout ctvAutopilotStatus; private ImageView ctvAutopilotStatusIv; private TextView ctvAutopilotStatusTv; + private TextView tvArrived; protected TextView tvOperationStatus; protected RelativeLayout mSettingBtn; protected RelativeLayout mBadcaseBtn; @@ -120,6 +121,7 @@ public abstract class BaseBusTabFragment // CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView); tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status); + tvArrived = findViewById(R.id.module_mogo_och_arrived_tv); flSpeed = (FrameLayout) findViewById(R.id.fl_speed); mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc); @@ -198,6 +200,10 @@ public abstract class BaseBusTabFragment tvOperationStatus.setOnClickListener(view -> { onChangeOperationStatus(); }); + + tvArrived.setOnClickListener(view -> { + onArriveStation(); + }); mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout); mSettingBtn.setOnClickListener(v -> { @@ -226,6 +232,8 @@ public abstract class BaseBusTabFragment } } + protected abstract void onArriveStation(); + private void updateSwitchMapIcon(){ if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) { mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long); @@ -284,6 +292,7 @@ public abstract class BaseBusTabFragment getActivity().runOnUiThread(() -> { slidePanelView.setText(text); slidePanelView.setVisibility(View.VISIBLE); + tvArrived.setClickable(false); }); } } @@ -294,6 +303,7 @@ public abstract class BaseBusTabFragment public void hideSlidePanel() { getActivity().runOnUiThread(() -> { slidePanelView.setVisibility(View.GONE); + tvArrived.setClickable(true); }); } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java index ff6d6b5d2c..4d6f097d3b 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java @@ -50,7 +50,7 @@ public class BusFragment extends BaseBusTabFragment private TextView mLineName; private int mCurrentStation = 0; - private View mBus; +// private View mBus; private BusStationBean startStation = null; private BusStationBean endStation = null; @@ -63,19 +63,20 @@ public class BusFragment extends BaseBusTabFragment @Override protected void initViews() { super.initViews(); - mBus = findViewById(R.id.module_och_bus_tag); +// mBus = findViewById(R.id.module_och_bus_tag); mCurrentStationName = findViewById(R.id.module_och_bus_current_station); mCurrentTag = findViewById(R.id.module_och_bus_current_station_anchor); mNextStationName = findViewById(R.id.module_och_bus_order_end_station); mNextTag = findViewById(R.id.module_och_bus_next_station_anchor); mSwitchLine = findViewById(R.id.switch_line_btn); + mSwitchLine.setTag(0); mLineName = findViewById(R.id.module_och_bus_line_name); - if (DebugConfig.isDebug()) { - mBus.setOnClickListener(view -> { - ToastUtils.showShort("重置了车站状态"); - mPresenter.queryBusRoutes(); - }); +// if (DebugConfig.isDebug()) { //任意模式下都打开调试面板 +// mBus.setOnClickListener(view -> { +// ToastUtils.showShort("重置了车站状态"); +// mPresenter.queryBusRoutes(); +// }); //debug下调用测试面板 mCurrentStationName.setOnLongClickListener(v -> { @@ -83,7 +84,7 @@ public class BusFragment extends BaseBusTabFragment showHideTestBar(); return true; }); - } +// } CallerLogger.INSTANCE.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); // 初始化的时候设置 UI 按钮状态 @@ -105,6 +106,11 @@ public class BusFragment extends BaseBusTabFragment mSwitchLine.setOnClickListener(this); } + @Override + protected void onArriveStation() { + mPresenter.onAutopilotArriveAtStation(null); + } + @Override protected void debugArrivedStation() { mPresenter.onAutopilotArriveAtStation(null); @@ -235,10 +241,14 @@ public class BusFragment extends BaseBusTabFragment } private void showOrHideSwitchLineBtn(boolean isShow) { - if (isShow){ - mSwitchLine.setVisibility(View.VISIBLE); - }else { - mSwitchLine.setVisibility(View.GONE); + if (isShow){//显示切换路线 +// mSwitchLine.setVisibility(View.VISIBLE); + mSwitchLine.setTag(0); + mSwitchLine.setText(getResources().getString(R.string.bus_switch_line_btn)); + }else {//显示结束路线 +// mSwitchLine.setVisibility(View.GONE); + mSwitchLine.setTag(1); + mSwitchLine.setText(getResources().getString(R.string.bus_close_line_btn)); } } @@ -392,12 +402,12 @@ public class BusFragment extends BaseBusTabFragment ToastUtils.showLong(getResources().getString(R.string.bus_switch_line_btn_warning1)); return; } - if (mCurrentStation > 0) { - ToastUtils.showLong(getResources().getString(R.string.bus_switch_line_btn_warning2)); - return; + if ((int)mSwitchLine.getTag() == 0){//切换路线 + Intent intent = new Intent(getContext(), BusSwitchLineActivity.class); + startActivity(intent); + }else {//结束路线 + mPresenter.resetCurrentLineStatus(); } - Intent intent = new Intent(getContext(), BusSwitchLineActivity.class); - startActivity(intent); } } } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusLineModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusLineModel.java index 3fca5e55d8..0d79156db8 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusLineModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusLineModel.java @@ -64,7 +64,7 @@ public class BusLineModel { } public void commitSwitchLineId(int lineId){ - BusServiceManager.getInstance().resetStationStatus(mContext,lineId, new IBusServiceCallback() { + BusServiceManager.getInstance().switchLine(mContext,lineId, new IBusServiceCallback() { @Override public void onSuccess(BusRoutesResponse o) { if (mBusLinesCallback != null){ diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java index d875ea8929..19b236c0c7 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java @@ -11,7 +11,6 @@ import android.location.Location; import android.os.Handler; import android.os.Message; import android.text.TextUtils; -import android.util.Log; import androidx.annotation.NonNull; @@ -444,11 +443,11 @@ public class BusOrderModel { } /** - * 测试、重置站点状态 + * 重置路线站点状态--结束路线,当前路线恢复到始发站 */ - public void debugResetStationStatus() { - CallerLogger.INSTANCE.d( M_BUS + TAG, "测试、重置站点状态"); - BusServiceManager.getInstance().resetStationStatus(mContext, currentLineId + public void resetCurrentLineStatus() { + CallerLogger.INSTANCE.d( M_BUS + TAG, "结束当前路线"); + BusServiceManager.getInstance().resetCurrentLineStatus(mContext, currentLineId , new IBusServiceCallback() { @Override public void onSuccess(BusRoutesResponse o) { @@ -520,9 +519,9 @@ public class BusOrderModel { ) private void leaveStationSuccess(BusRoutesResult result, boolean isRestart) { renderBusStationsStatus(result); - if (slidePannelHideCallback != null) { - slidePannelHideCallback.hideSlidePanel(); - } +// if (slidePannelHideCallback != null) { +// slidePannelHideCallback.hideSlidePanel(); +// } //开启自动驾驶 startAutopilot(isRestart); if (isGoingToNextStation) { diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/BusServiceManager.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/BusServiceManager.java index 5ce01cf7c4..14f80cdff6 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/BusServiceManager.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/BusServiceManager.java @@ -74,13 +74,27 @@ public class BusServiceManager { * @param lineId * @param callback */ - public void resetStationStatus(Context context, int lineId, IBusServiceCallback callback){ - mService.resetStationStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId() + public void switchLine(Context context, int lineId, IBusServiceCallback callback){ + mService.switchLine(MoGoAiCloudClientConfig.getInstance().getServiceAppId() ,MoGoAiCloudClientConfig.getInstance().getToken(),new BusResetDrivingLineRequest(lineId)) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribe(getSubscribeImpl(context,callback,"debugResetStationStatus")); } + /** + * 结束当前路线,当前路线状态重置到始发站 + * @param context + * @param lineId + * @param callback + */ + public void resetCurrentLineStatus(Context context, int lineId, IBusServiceCallback callback){ +// mService.switchLine(MoGoAiCloudClientConfig.getInstance().getServiceAppId() +// ,MoGoAiCloudClientConfig.getInstance().getToken(),new BusResetDrivingLineRequest(lineId)) +// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) +// .subscribe(getSubscribeImpl(context,callback,"debugResetStationStatus")); + // TODO 需要重置接口 + } + /** * 离站上报 * @param context diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/IBusApiService.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/IBusApiService.java index f4c50754fb..8183fb1e84 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/IBusApiService.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/net/IBusApiService.java @@ -42,8 +42,6 @@ public interface IBusApiService { Observable querySiteByCoordinate(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request); /** - * 重置巴士路线: 点击小巴车tab 或者出车后会使用 - * * @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的 * @return 返回值是重置后的车站列表 */ @@ -51,7 +49,7 @@ public interface IBusApiService { // @POST( "/autopilot-car-hailing/car/v2/bus/drivingLine/reset" ) @POST( "/autopilot-car-hailing/car/v2/driver/bus/drivingLine/reset" ) // @POST( "/mock/268/autopilot-car-hailing/bus/api/drivingLine/reset" ) - Observable resetStationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request); + Observable switchLine(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request); /** * 离站,通知服务器 diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java index fadc4ad8d1..28a590956d 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java @@ -90,8 +90,8 @@ public class BusPresenter extends Presenter BusOrderModel.getInstance().queryBusRoutes(); } - public void debugResetStationStatus() { - BusOrderModel.getInstance().debugResetStationStatus(); + public void resetCurrentLineStatus() { + BusOrderModel.getInstance().resetCurrentLineStatus(); } public void autoDriveToNextStation(boolean isRestart) { diff --git a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml index 4bd073fff0..1c385e0809 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/bus_base_fragment.xml @@ -82,8 +82,8 @@ android:background="@drawable/bus_switch_map_bg" android:elevation="@dimen/bus_dp_10" android:padding="@dimen/bus_dp_20" - app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_operation_status" - app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_operation_status" + app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_arrived_tv" + app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_arrived_tv" android:gravity="center" android:orientation="horizontal"> @@ -109,6 +109,22 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent"/> + + + + android:src="@drawable/bad_case_selector" /> - + + + + + + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@+id/module_och_bus_line_name" /> 40px + 32px 13px 12px 350px diff --git a/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1600/dimens.xml b/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1600/dimens.xml index db56121992..dee684f3e6 100644 --- a/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1600/dimens.xml +++ b/OCH/mogo-och-bus/src/main/res/values-xhdpi-2560x1600/dimens.xml @@ -91,6 +91,7 @@ 40px + 32px 13px 12px 350px diff --git a/OCH/mogo-och-bus/src/main/res/values/dimens.xml b/OCH/mogo-och-bus/src/main/res/values/dimens.xml index 85e4768fcc..ce34734e02 100644 --- a/OCH/mogo-och-bus/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-bus/src/main/res/values/dimens.xml @@ -89,6 +89,7 @@ 270px 30px + 30px 13px 12px 288px diff --git a/OCH/mogo-och-bus/src/main/res/values/strings.xml b/OCH/mogo-och-bus/src/main/res/values/strings.xml index fdbca6ea6b..992ab6c19c 100644 --- a/OCH/mogo-och-bus/src/main/res/values/strings.xml +++ b/OCH/mogo-och-bus/src/main/res/values/strings.xml @@ -11,7 +11,8 @@ 终点: 确认 切换路线 - 自动驾驶中,不可切换路线 + 结束路线 + 自动驾驶状态中,不可切换或结束路线 当前行程未完成,不可切换路线 当前车辆无路线\n请联系运营人员绑定 起点: @@ -24,4 +25,5 @@ 当前站点: 下一站: 自动驾驶状态为0不可用 + 进站 diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java index e1f8da1bc8..82551ccdac 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java @@ -165,8 +165,8 @@ public abstract class BaseTaxiTabFragment { // onAutopilotStatusChanged(false); @@ -178,7 +178,7 @@ public abstract class BaseTaxiTabFragment { if (groupTestPanel.getVisibility() == View.VISIBLE) { groupTestPanel.setVisibility(View.GONE); @@ -258,7 +258,7 @@ public abstract class BaseTaxiTabFragment() { override fun create(context: Context): Boolean { this.context = context if (ProcessUtils.isMainProcess(context)) { + initGDLoc() initHttpDns() initCloudClientConfig() } return true } + private fun initGDLoc() { + GDLocationClient.getInstance(context).start() + } + /** * 初始化 HttpDNS ,这里会通过一个接口获取所有鹰眼中使用的微服务域名以及端口号 * 后续的网络请求会通过 HttpDnsInterceptor 进行拦截替换 @@ -126,10 +132,8 @@ class HttpDnsStartUp : AndroidStartup() { //设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成,后续包名分渠道,需要做对应操作 clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ" -// todo 使用旧链路 -// clientConfig.setUseOriginSocket(true); clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation { - override fun getCurrentLocation(): HttpDnsSimpleLocation? { + override fun getCurrentLocation(): HttpDnsSimpleLocation { val envConfig = EnvChangeManager.getEnvConfig() if (envConfig != null) { return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon) @@ -141,13 +145,23 @@ class HttpDnsStartUp : AndroidStartup() { mogoLocation = locationClient.lastKnowLocation } val httpDnsSimpleLocation = - if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0 - ) { - HttpDnsSimpleLocation( - mogoLocation.cityCode, - mogoLocation.latitude, - mogoLocation.longitude - ) + if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) { + if (mogoLocation.cityCode.isNullOrEmpty() && !GDLocationClient.getInstance( + context + ).lastCityCode.isNullOrEmpty() + ) { + HttpDnsSimpleLocation( + GDLocationClient.getInstance(context).lastCityCode, + mogoLocation.latitude, + mogoLocation.longitude + ) + } else { + HttpDnsSimpleLocation( + mogoLocation.cityCode, + mogoLocation.latitude, + mogoLocation.longitude + ) + } } else { val ciyCode = SharedPrefsMgr.getInstance( @@ -172,7 +186,6 @@ class HttpDnsStartUp : AndroidStartup() { // e.printStackTrace(); HttpDnsSimpleLocation("010", 1.0, 1.0) } - //CallerLogger.INSTANCE.d(M_HMI + TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation); } return httpDnsSimpleLocation } @@ -242,10 +255,10 @@ class HttpDnsStartUp : AndroidStartup() { linkCode = CHAIN_LINK_CLOUD_SHOW, endpoint = PAD, nodeAliasCode = CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED, - paramIndexes = [0], + paramIndexes = [0, 1], clientPkFileName = "sn" ) - override fun onAddressChanged(address: Map?) { + override fun onAddressChanged(cityCode: String, address: Map?) { val dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps( host, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP @@ -323,6 +336,18 @@ class HttpDnsStartUp : AndroidStartup() { CallerLogger.d(SceneConstant.M_HMI + TAG, "socket-onConnectLost") DebugConfig.setDownloadSnapshot(false) } + + @ChainLog( + linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS, + linkCode = CHAIN_LINK_CLOUD_SHOW, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onError(code: String, msg: String?) { + CallerLogger.d(SceneConstant.M_HMI + TAG, "socket-onConnectLost") + } }) // 开启Socket长链服务 val lat = location.latitude diff --git a/build.gradle b/build.gradle index 90cb140cd4..f18c4f8215 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,6 @@ apply from: "javadoc.gradle" buildscript { repositories { - maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url "https://artifact.bytedance.com/repository/byteX/" } maven { url 'http://nexus.zhidaoauto.com/repository/maven-releases/' } @@ -33,7 +32,7 @@ buildscript { classpath "com.bytedance.android.byteX:base-plugin:0.3.0" classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}" classpath 'com.volcengine:apm_insight_plugin:1.4.1' - classpath 'com.mogo.cloud:thread_opt:1.0.1' + classpath 'com.mogo.cloud:thread_opt:5.0.5' classpath 'com.mogo.cloud:systrace:1.0.1' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_pnc_actions.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_pnc_actions.xml index c1092a0b63..1c49ca55d1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_pnc_actions.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_pnc_actions.xml @@ -8,7 +8,8 @@ android:id="@+id/tvHmiPncActions" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="@dimen/sp_30" + android:textSize="@dimen/sp_38" + android:textColor="#FFFFFF" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt index bc017b4ca1..2c5377b5b0 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt @@ -51,6 +51,7 @@ class ChainConstant { const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL" const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS" const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST" + const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR" const val CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED = "CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED" const val CHAIN_ALIAS_CODE_INIT_ON_MAP_LOADED = "CHAIN_ALIAS_CODE_INIT_ON_MAP_LOADED" diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoLifecycleListener.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoLifecycleListener.java index c97877d11c..c708576a0c 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoLifecycleListener.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoLifecycleListener.java @@ -6,4 +6,8 @@ public interface IMogoLifecycleListener { void onConnectSuccess(); void onConnectLost(); + + default void onError(String code, String msg){ + + } } diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java index 295094e447..c6ab9969de 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java @@ -4,6 +4,7 @@ import android.content.Context; import androidx.annotation.Keep; +import com.mogo.cloud.socket.IMogoCloudSocketErrorListener; import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener; import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener; import com.mogo.cloud.socket.SocketManager; @@ -24,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; * 长链实现:基于 netty */ @Keep -public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implements IMogoSocketManager { +public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implements IMogoSocketManager, IMogoCloudSocketErrorListener { private static final String TAG = "MogoAiCloudSocketManager-sdk"; @@ -70,6 +71,7 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem this.mAppId = appId; SocketManager.getInstance().init(context, lat, lon); SocketManager.getInstance().registerSocketConnCallback(this); + SocketManager.getInstance().registerSocketErrorCallback(TAG, this); } @Override @@ -140,6 +142,7 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem } public synchronized void release() { + SocketManager.getInstance().unregisterSocketErrorCallback(TAG); SocketManager.getInstance().release(); } @@ -212,4 +215,15 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem } } } + + @Override + public void onError(int code, String msg) { + if (mLifeCycleListeners.size() > 0) { + for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()) { + if (lifecycleListener != null) { + lifecycleListener.onError(code + "", msg); + } + } + } + } } diff --git a/gradle.properties b/gradle.properties index b5a4928f9d..bacab69b30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -63,23 +63,23 @@ SERVICE_CHAIN_VERSION=1.1.0 LOGLIB_VERSION=1.3.31 ######## MogoAiCloudSDK Version ######## # 网络请求LOGLIB_VERSION -MOGO_NETWORK_VERSION=1.4.3.8 +MOGO_NETWORK_VERSION=1.4.3.17 # 鉴权 -MOGO_PASSPORT_VERSION=1.4.3.8 +MOGO_PASSPORT_VERSION=1.4.3.17 # 常链接 -MOGO_SOCKET_VERSION=1.4.3.8 +MOGO_SOCKET_VERSION=1.4.3.17 # 数据采集 -MOGO_REALTIME_VERSION=1.4.3.8 +MOGO_REALTIME_VERSION=1.4.3.17 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.4.3.8 +MOGO_TANLU_VERSION=1.4.3.17 # 直播推流 -MOGO_LIVE_VERSION=1.4.3.8 +MOGO_LIVE_VERSION=1.4.3.17 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.4.3.8 +MOGO_TRAFFICLIVE_VERSION=1.4.3.17 # 定位服务 -MOGO_LOCATION_VERSION=1.4.3.8 +MOGO_LOCATION_VERSION=1.4.3.17 # 远程通讯模块 -MOGO_TELEMATIC_VERSION=1.4.3.8 +MOGO_TELEMATIC_VERSION=1.4.3.17 ######## MogoAiCloudSDK Version ######## # 自研地图 MAP_SDK_VERSION=2.4.0.1 @@ -90,8 +90,8 @@ WEBSOCKET_VERSION=1.1.7 applicationId=com.mogo.launcer applicationName=IntelligentPilot # RoboBus司机端:2.5.1;RoboTaxi司机端:2.5.1;RoboTaxi乘客端:1.0.0 -versionCode=2090000 -versionName=2.9.0 +versionCode=2100000 +versionName=2.10.0 ################# 新架构模块Maven版本管理 ################# MOGO_CORE_FUNCTION_AUTOPILOT_VERSION=0.0.58.10 @@ -155,7 +155,7 @@ MOGO_OCH_TAXI_VERSION=2.0.66 # mogoAiCloud sdk services MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10 # v2x-sdk -MOGO_V2X_SDK_VERSION=1.4.3.8 +MOGO_V2X_SDK_VERSION=1.4.3.17 ################# 旧版本架构模块版本 ################# diff --git a/libraries/mogo-map/build.gradle b/libraries/mogo-map/build.gradle index 72a0a91306..f4e1bf9862 100644 --- a/libraries/mogo-map/build.gradle +++ b/libraries/mogo-map/build.gradle @@ -48,6 +48,9 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler // 高精地图 implementation rootProject.ext.dependencies.mogocustommap + // 高德地图 + api rootProject.ext.dependencies.amaplocation + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogomapapi diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index 340c7ff3fd..1ea27213cb 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -643,6 +643,7 @@ public class AMapViewWrapper implements IMogoMapView, /** * 设置转向灯和刹车灯 + * * @param type :车尾灯类型 time: 闪烁时间 最小500ms 小于500ms 默认为500ms * @param time */ @@ -748,9 +749,11 @@ public class AMapViewWrapper implements IMogoMapView, sysLocation.setSpeed(location.getSpeed()); // 将有效经纬度暂存本地,提供给下一次的Http-DNS使用,防止首次请求位置获取不到 - if (location.getLat() > 0) { - SharedPrefsMgr.getInstance(mMapView.getContext()) - .putString(SharedPrefsConstants.LOCATION_CITY_CODE, location.getCityCode()); + if (location.getLat() > 0 && location.getLon() > 0) { + if (location.getCityCode() != null && !location.getCityCode().isEmpty()) { + SharedPrefsMgr.getInstance(mMapView.getContext()) + .putString(SharedPrefsConstants.LOCATION_CITY_CODE, location.getCityCode()); + } SharedPrefsMgr.getInstance(mMapView.getContext()) .putString(SharedPrefsConstants.LOCATION_LATITUDE, String.valueOf(location.getLat())); SharedPrefsMgr.getInstance(mMapView.getContext()) @@ -1000,7 +1003,7 @@ public class AMapViewWrapper implements IMogoMapView, bean.setAcceleration(gnssInfo.getAcceleration()); bean.setAlt(gnssInfo.getAltitude()); bean.setSystemTime(Double.valueOf(gnssInfo.getSystemTime()).longValue()); - bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime()*1000).longValue()); + bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue()); bean.setLon(gnssInfo.getLongitude()); bean.setLat(gnssInfo.getLatitude()); bean.setGnss_speed(((float) gnssInfo.getGnssSpeed())); @@ -1053,7 +1056,7 @@ public class AMapViewWrapper implements IMogoMapView, } @Override - public Double getRoadAngle(Double lon,Double lat,float angle) { + public Double getRoadAngle(Double lon, Double lat, float angle) { return MapDataApi.INSTANCE.getRoadRectInfo(lon, lat, angle).getAngle(); } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java new file mode 100644 index 0000000000..cc23b9af97 --- /dev/null +++ b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java @@ -0,0 +1,67 @@ +package com.mogo.map.location; + +import android.content.Context; + +import com.amap.api.location.AMapLocation; +import com.amap.api.location.AMapLocationClient; +import com.amap.api.location.AMapLocationClientOption; +import com.amap.api.location.AMapLocationListener; +import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.constants.SharedPrefsConstants; +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; + +public class GDLocationClient implements AMapLocationListener { + + private volatile static GDLocationClient gdLocationClient; + private static final byte[] obj = new byte[0]; + + public static GDLocationClient getInstance(Context context) { + if (gdLocationClient == null) { + synchronized (obj) { + if (gdLocationClient == null) { + gdLocationClient = new GDLocationClient(context); + } + } + } + return gdLocationClient; + } + + //声明LocationClient对象 + private final AMapLocationClient mLocationClient; + private String mCityCode; + + private GDLocationClient(Context context) { + mLocationClient = new AMapLocationClient(context); + //初始化定位参数 + //声明mLocationOption对象 + AMapLocationClientOption mLocationOption = new AMapLocationClientOption(); + //设置定位监听 + mLocationClient.setLocationListener(this); + //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 + mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); + //设置定位间隔,单位毫秒,默认为2000ms + mLocationOption.setInterval(1000); + //设置定位参数 + mLocationClient.setLocationOption(mLocationOption); + } + + public void start() { + mLocationClient.startLocation(); + } + + @Override + public void onLocationChanged(AMapLocation aMapLocation) { + if (aMapLocation != null) { + String cityCode = aMapLocation.getCityCode(); + if (cityCode != null && !cityCode.isEmpty()) { + mCityCode = aMapLocation.getCityCode(); + SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) + .putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode); + } + } + } + + public String getLastCityCode() { + return mCityCode; + } +}