[Add]
增加了设置连接工控机IP的调用 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.mogo.eagle.core.function.autopilot
|
||||
|
||||
import android.Manifest.permission
|
||||
import android.content.Context
|
||||
import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
@@ -9,8 +11,10 @@ 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.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -19,7 +23,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
|
||||
class MoGoAutopilotProvider :
|
||||
IMoGoAutopilotProvider {
|
||||
IMoGoAutopilotProvider {
|
||||
private val TAG = "MoGoAutoPilotProvider"
|
||||
|
||||
override val functionName: String
|
||||
@@ -31,8 +35,29 @@ class MoGoAutopilotProvider :
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
}
|
||||
|
||||
override fun connectAutoPilot() {
|
||||
/**
|
||||
* 连接自动驾驶域控制器
|
||||
*
|
||||
* @param autoPilotIp 指定与控制器IP
|
||||
*/
|
||||
override fun resetIpAddress(autoPilotIp: String) {
|
||||
// 关闭通信
|
||||
AdasManager.getInstance().closeAllMsg()
|
||||
// 延时执行连接指定IP地址
|
||||
ThreadUtils.executeBySingleWithDelay(object : ThreadUtils.SimpleTask<String>() {
|
||||
@RequiresPermission(permission.INTERNET)
|
||||
override fun doInBackground(): String {
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().setIPCIp(autoPilotIp)
|
||||
// 打开通讯连接
|
||||
AdasManager.getInstance().startAllMsg()
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun onSuccess(result: String?) {
|
||||
|
||||
}
|
||||
}, 1000, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
|
||||
Reference in New Issue
Block a user