diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index f791d7dd12..bee668f3ab 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -8,6 +8,7 @@
+
diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle
index 687a17828a..aa8fc72bc4 100644
--- a/core/function-impl/mogo-core-function-hmi/build.gradle
+++ b/core/function-impl/mogo-core-function-hmi/build.gradle
@@ -54,12 +54,13 @@ dependencies {
if (Boolean.valueOf(RELEASE)) {
} else {
- api project(':services:mogo-service-api')
+ implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
+ implementation project(':core:mogo-core-function-call')
}
}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt
index 9e53b57b1b..5364c9d48a 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt
@@ -1,12 +1,16 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
-import android.content.res.TypedArray
import android.util.AttributeSet
import android.view.LayoutInflater
+import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
+import com.mogo.eagle.core.data.autopilot.AdasOCHData
+import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.LogUtils
+import com.mogo.module.common.MogoApisHandler
+import com.mogo.service.adas.IMogoAdasOCHCallback
import kotlinx.android.synthetic.main.view_autopilot_status.view.*
/**
@@ -17,20 +21,13 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.*
class AutoPilotStatusView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet
-) : ConstraintLayout(context, attrs) {
+) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
private val TAG = "AutopilotStatusView"
private var mAutopilotStatus: Int = 0
init {
- val typedArray: TypedArray =
- context.obtainStyledAttributes(attrs, R.styleable.AutopilotStatusView)
- mAutopilotStatus = typedArray.getInt(R.styleable.AutopilotStatusView_autopilotStatus, 0)
- typedArray.recycle()
-
- LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
-
initView(context)
}
@@ -40,16 +37,38 @@ class AutoPilotStatusView @JvmOverloads constructor(
val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
layoutParams = lp
+ // 设置点击监听
+ setOnClickListener(this)
+ // 首次查询自动驾驶状态
+ mAutopilotStatus = MogoApisHandler.getInstance().apis.adasControllerApi.autopilotStatus
+ // 自动驾驶状态监听
+ MogoApisHandler.getInstance().apis.adasControllerApi.addAdasOCHCallback(this)
+
+ LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
setAutoPilotStatus(mAutopilotStatus)
}
+ override fun onClick(v: View?) {
+ when (mAutopilotStatus) {
+ 0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
+ LogUtils.eTag(TAG, "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查链路")
+ }
+ 1 -> {// 可自动驾驶,目前处于人工干预状态
+ CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
+ }
+ 2 -> {// 自动驾驶中
+ CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
+ }
+ }
+ }
+
/**
* 设置自动驾驶状态
* 0-// 不可自动驾驶,adas与工控机没有链接,或工控机异常
* 1-// 可自动驾驶,目前处于人工干预状态
* 2-// 自动驾驶中
*/
- fun setAutoPilotStatus(autopilotStatus: Int) {
+ private fun setAutoPilotStatus(autopilotStatus: Int) {
mAutopilotStatus = autopilotStatus
when (autopilotStatus) {
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
@@ -67,4 +86,13 @@ class AutoPilotStatusView @JvmOverloads constructor(
}
}
+ override fun onArriveAt(data: AdasOCHData?) {
+
+ }
+
+ override fun onStateChanged(state: Int, reason: String?) {
+ setAutoPilotStatus(state)
+ }
+
+
}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
index d36076ac81..555f7c0390 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
@@ -33,7 +33,6 @@
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/flSpeedChartView"
app:layout_constraintTop_toBottomOf="@+id/flSpeedChartView"
- tools:autopilotStatus="running"
tools:visibility="visible" />
=
+ HashMap()
+
+
+ /**
+ * 添加自动驾驶按钮选中监听
+ * @param tag 标记,用来注销监听使用
+ * @param listener 监听回调
+ */
+ fun addCheckAutoPilotBtnListener(
+ @Nullable tag: String,
+ @Nullable listener: IMoGoCheckAutoPilotBtnListener
+ ) {
+ checkAutoPilotBtnListeners[tag] = listener
+ }
+
+ /**
+ * 删除自动驾驶按钮选中监听
+ * @param tag 标记,用来注销监听使用
+ */
+ fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
+ checkAutoPilotBtnListeners.remove(tag)
+ }
+
+ /**
+ * 触发自动驾驶按钮选中监听
+ * @param isChecked 选中状态
+ */
+ fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
+ LogUtils.dTag(TAG, "isChecked:$isChecked")
+ checkAutoPilotBtnListeners.forEach {
+ val tag = it.key
+ val listener = it.value
+ LogUtils.dTag(TAG, "tag:$tag listener:$listener")
+ listener.onCheck(isChecked)
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
index 0e0fe6b589..cd618ab7fa 100644
--- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.hmi
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
+import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase
diff --git a/core/mogo-core-res/src/main/res/values/styles.xml b/core/mogo-core-res/src/main/res/values/styles.xml
index 4ee346db1c..d983a865a0 100644
--- a/core/mogo-core-res/src/main/res/values/styles.xml
+++ b/core/mogo-core-res/src/main/res/values/styles.xml
@@ -12,11 +12,5 @@
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
index 9222f2e503..e786a39c67 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
@@ -1,5 +1,20 @@
package com.mogo.module.extensions.entrance;
+import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
+import static com.mogo.module.common.utils.SPConst.getSpGuide;
+import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
+import static com.mogo.module.service.receiver.MogoReceiver.ACTION_V2X_REMOVE_TIP_WINDOW;
+import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
+import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
+import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
+import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
+import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
+import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
+import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
+import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
+import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
+import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
+
import android.content.Intent;
import android.graphics.Rect;
import android.location.Location;
@@ -71,8 +86,6 @@ import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.adas.IMogoAdasOCHCallback;
-import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.entrance.ButtonIndex;
@@ -100,21 +113,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Random;
-import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
-import static com.mogo.module.common.utils.SPConst.getSpGuide;
-import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
-import static com.mogo.module.service.receiver.MogoReceiver.ACTION_V2X_REMOVE_TIP_WINDOW;
-import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
-import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
-import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
-import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
-import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
-import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
-import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
-import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
-import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
-import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
-
/**
* @author congtaowang
* @since 2020-01-07
@@ -128,9 +126,8 @@ public class EntranceFragment extends MvpFragment {
-// ctvAutopilotStatus.setChecked(isInAutopilot);
-// });
-// }
-
- private void autopilotStatusClick() {
- EntranceViewHolder.getInstance().entranceAutopilotStatusClick();
- }
-
private int debugPanelClickCount = 0;
private long lastDebugPanelClickTime = 0;
@@ -442,8 +422,7 @@ public class EntranceFragment extends MvpFragment {
-// MyLocationUtil.emphasizeMyLocation();
+ // MyLocationUtil.emphasizeMyLocation();
View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
TextView tv = v.findViewById(R.id.tvIndex);
tv.setText("sub view height: " + currentHeight + ": " + v);
@@ -1052,17 +1031,17 @@ public class EntranceFragment extends MvpFragment {
-// SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
-// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
-// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
-// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
-// ".1000_0.jpeg");
-// MyLocationUtil.setMyLocationIconUrl(getContext(),"https" +
-// "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
-// "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
-// ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
-// ".1000_0.jpeg");
-// MyLocationUtil.emphasizeMyLocation();
+ // SharedPrefsMgr.getInstance(getContext()).putString("MY_LOCATION_CONFIG", "https" +
+ // "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
+ // "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
+ // ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
+ // ".1000_0.jpeg");
+ // MyLocationUtil.setMyLocationIconUrl(getContext(),"https" +
+ // "://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1605705508574" +
+ // "&di=339d3259ad21f5f48c8abcd1bafff324&imgtype=0&src=http%3A%2F%2Fc-ssl" +
+ // ".duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423111550_4AJLr.thumb" +
+ // ".1000_0.jpeg");
+ // MyLocationUtil.emphasizeMyLocation();
View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
TextView tv = v.findViewById(R.id.tvIndex);
Random random = new Random();
@@ -1070,7 +1049,7 @@ public class EntranceFragment extends MvpFragment listeners = new ArrayList<>();
- private final List btnClickListeners = new ArrayList<>();
public void addEntranceViewListener(IMogoEntranceViewListener listener) {
listeners.add(listener);
@@ -280,20 +278,6 @@ public class EntranceViewHolder {
listeners.remove(listener);
}
- public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
- btnClickListeners.add(listener);
- }
-
- public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
- btnClickListeners.remove(listener);
- }
-
- public void entranceAutopilotStatusClick() {
- for (IMogoEntranceAutopilotStatusClickListener listener : btnClickListeners) {
- listener.click();
- }
- }
-
public void release() {
rootViewGroup = null;
featureViewGroup = null;
diff --git a/modules/mogo-module-service/build.gradle b/modules/mogo-module-service/build.gradle
index fafcb54ea5..f51f32bd73 100644
--- a/modules/mogo-module-service/build.gradle
+++ b/modules/mogo-module-service/build.gradle
@@ -61,6 +61,7 @@ dependencies {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-res')
+ implementation project(':core:mogo-core-function-call')
}
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java
index d9072f5020..9520ecc2e4 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java
@@ -10,7 +10,11 @@ import android.os.Handler;
import android.os.Message;
import com.mogo.cloud.commons.utils.CoordinateUtils;
+import com.mogo.eagle.core.data.autopilot.AdasOCHData;
+import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.data.map.MogoLatLng;
+import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
+import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
@@ -19,10 +23,7 @@ import com.mogo.module.service.dispatch.model.DispatchServiceModel;
import com.mogo.module.service.dispatch.model.IDispatch;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoAdasOCHCallback;
-import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
-import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
-import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
@@ -31,7 +32,7 @@ import java.util.List;
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
public class DispatchAutoPilotManager implements IMogoOnMessageListener
, IDispatchRemindClickListener
- , IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMogoEntranceAutopilotStatusClickListener {
+ , IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMoGoCheckAutoPilotBtnListener {
private static final String TAG = "DispatchAutoPilotManager";
private static volatile DispatchAutoPilotManager instance;
@@ -95,7 +96,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener