[Add function]增加了同步数据给域控制器的方法,TODO需要 @钟超 修改下
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
@@ -26,16 +27,11 @@ class MoGoAutopilotProvider :
|
||||
override fun init(context: Context) {
|
||||
// 初始化ADAS 域控制器
|
||||
//AdasManager.getInstance().create(context)
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
}
|
||||
|
||||
override fun connectAutoPilot() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
@@ -47,6 +43,10 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendMessageToAutopilot(jsonString: String) {
|
||||
AdasManager.getInstance().sendMessage(jsonString)
|
||||
}
|
||||
|
||||
override fun cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().isSocketConnect) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
@@ -59,4 +59,8 @@ class MoGoAutopilotProvider :
|
||||
return AdasManager.getInstance().recordPackage()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,19 +3,15 @@ package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
import androidx.annotation.NonNull;
|
||||
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;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/10/20 1:02 下午
|
||||
* 自动驾驶状态回调用
|
||||
*/
|
||||
public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusListener {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.eagle.core.function.autopilot.server
|
||||
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/11/08 8:43 下午
|
||||
*
|
||||
*
|
||||
* 异步同步数据给 Autopilot 控制器
|
||||
* 数据源(不限于):OBU、网络等
|
||||
*/
|
||||
class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListener {
|
||||
companion object {
|
||||
const val TAG = "AsyncDataToAutopilotServer"
|
||||
val INSTANCE: AsyncDataToAutopilotServer by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
AsyncDataToAutopilotServer()
|
||||
}
|
||||
}
|
||||
|
||||
fun initServer() {
|
||||
Logger.d(TAG, "initServer……")
|
||||
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
// TODO 这里替换成与克难沟通的JSON格式 @钟超
|
||||
// CallerAutoPilotManager.sendDataToAutopilot()
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
private var turnLightEnd = true
|
||||
private var result: TrafficLightResult? = null
|
||||
|
||||
override fun init(context: Context?) {
|
||||
Logger.d(TAG, "init provider")
|
||||
}
|
||||
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
|
||||
|
||||
Reference in New Issue
Block a user