[Add function]增加了同步数据给域控制器的方法,TODO需要 @钟超 修改下

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-09 19:58:03 +08:00
parent 71e31852bb
commit cde1338251
7 changed files with 61 additions and 17 deletions

View File

@@ -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() {
}
}

View File

@@ -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

View File

@@ -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()
}
}

View File

@@ -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)

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.api.autopilot;
import androidx.annotation.NonNull;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
@@ -22,6 +24,12 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
*/
void startAutoPilot(AutopilotControlParameters controlParameters);
/**
* 发送json数据给 Autopilot 自动驾驶控制器
* 具体的json格式需要与@宋克难 进行沟通
*/
void sendMessageToAutopilot(@NonNull String jsonString);
/**
* 结束自动驾驶
*/

View File

@@ -1,9 +1,8 @@
package com.mogo.eagle.core.function.api.trafficlight
import com.alibaba.android.arouter.facade.template.IProvider
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
interface IMoGoTrafficLightListener :IProvider{
interface IMoGoTrafficLightListener {
/**
* 当前红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间

View File

@@ -33,6 +33,14 @@ object CallerAutoPilotManager {
providerApi.startAutoPilot(controlParameters)
}
/**
* 发送json数据给 Autopilot 自动驾驶控制器
* 具体的json格式需要与@宋克难 进行沟通
*/
fun sendDataToAutopilot(jsonString: String) {
providerApi.sendMessageToAutopilot(jsonString)
}
/**
* 结束自动驾驶
*/