@@ -28,11 +28,6 @@ public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusList
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
@@ -14,10 +14,12 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
@@ -42,7 +44,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener {
|
||||
|
||||
private val TAG = "DebugSettingView"
|
||||
|
||||
@@ -55,12 +57,14 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
super.onAttachedToWindow()
|
||||
CallerObuListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerObuListenerManager.removeListener(TAG)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
|
||||
@@ -5,7 +5,10 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
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.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -123,9 +126,6 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/11/2 2:06 下午
|
||||
* 车辆状态&定位 数据 数据 回调监听
|
||||
*/
|
||||
interface IMoGoAutopilotCarStateListener {
|
||||
|
||||
/**
|
||||
* 车辆状态&定位 数据
|
||||
*
|
||||
* @param autoPilotCarStateInfo
|
||||
*/
|
||||
fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import java.util.*
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -25,13 +25,6 @@ interface IMoGoAutopilotStatusListener {
|
||||
*/
|
||||
fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?)
|
||||
|
||||
/**
|
||||
* 车辆状态数据
|
||||
*
|
||||
* @param autoPilotCarStateInfo
|
||||
*/
|
||||
fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?)
|
||||
|
||||
/**
|
||||
* 工控机获取SN
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
@@ -121,22 +120,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆状态数据 回调
|
||||
* @param autoPilotCarStateInfo
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
//Logger.d(TAG, "$autoPilotCarStateInfo")
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
//Logger.d(TAG, "tag:$tag listener:$listener")
|
||||
listener.onAutopilotCarStateData(autoPilotCarStateInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工控机获取SN 回调
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* 车辆状态&定位 数据 数据 回调监听
|
||||
*/
|
||||
object CallerAutopilotCarStatusListenerManager : CallerBase() {
|
||||
private val TAG = "CallerAutopilotCarStatusListenerManager"
|
||||
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val M_AUTOPILOT_STATUS_LISTENERS: HashMap<String, IMoGoAutopilotCarStateListener> =
|
||||
HashMap()
|
||||
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoAutopilotCarStateListener
|
||||
) {
|
||||
if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
|
||||
Logger.e(TAG, "Tag:$tag already exists,please use other tag")
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_STATUS_LISTENERS[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeListener(@Nullable tag: String) {
|
||||
if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
|
||||
Logger.e(TAG, "Tag:$tag not exists")
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_STATUS_LISTENERS.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(@Nullable listener: IMoGoAutopilotCarStateListener) {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
if (it.value == listener) {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆状态数据 回调
|
||||
* @param autoPilotCarStateInfo
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
//Logger.d(TAG, "$autoPilotCarStateInfo")
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
//Logger.d(TAG, "tag:$tag listener:$listener")
|
||||
listener.onAutopilotCarStateData(autoPilotCarStateInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,10 +13,12 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
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.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
@@ -43,7 +45,8 @@ public class AdasEventManager implements
|
||||
OnAdasMsgConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoAutopilotPlanningListener,
|
||||
IMoGoAutopilotIdentifyListener {
|
||||
IMoGoAutopilotIdentifyListener ,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
@@ -67,6 +70,7 @@ public class AdasEventManager implements
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static AdasEventManager getInstance() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -50,7 +51,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
|
||||
//can数据转发
|
||||
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
|
||||
|
||||
Reference in New Issue
Block a user