增加了设置连接工控机IP的调用

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-12-21 18:03:55 +08:00
parent 9bbb5ede54
commit cee45c4fb4
21 changed files with 145 additions and 317 deletions

View File

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

View File

@@ -165,6 +165,24 @@ class DebugSettingView @JvmOverloads constructor(
}
}
// 初始化工控机 IP信息
val autoPilotIpAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
etAutopilotIP.setText(autoPilotIpAddress)
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
btnSetAutopilotIP.setOnClickListener {
val autoPilotIp = etAutopilotIP.text.toString()
if (autoPilotIp.isNotEmpty()) {
CallerAutoPilotManager.resetIpAddress(autoPilotIp)
// 保存本地 AutoPilot IP地址
SharedPrefsMgr.getInstance(context).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
} else {
ToastUtils.showShort("请输入正确的IP地址")
}
}
// 域控制器
btnRecordPackage.setOnClickListener {
CallerAutoPilotManager.recordPackage()

View File

@@ -409,6 +409,25 @@
android:textColor="#000"
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etAutopilotIP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#32009688"
android:gravity="center"
android:minHeight="48dp"
android:padding="@dimen/dp_5"
android:text="192.168.1.102"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/btnSetAutopilotIP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="设置IP"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/btnRecordPackage"

View File

@@ -63,73 +63,73 @@ dependencies {
implementation rootProject.ext.dependencies.mogoami
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogoaicloudservicesdk
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogoservice
implementation rootProject.ext.dependencies.moduleV2x
implementation rootProject.ext.dependencies.moduleshare
implementation rootProject.ext.dependencies.tanluupload
implementation rootProject.ext.dependencies.mogomonitor
implementation rootProject.ext.dependencies.moduleextensions
implementation rootProject.ext.dependencies.modulemap
implementation rootProject.ext.dependencies.moduleADAS
implementation rootProject.ext.dependencies.modulepushbase
implementation rootProject.ext.dependencies.modulepush
implementation rootProject.ext.dependencies.callchat
implementation rootProject.ext.dependencies.callchatprovider
implementation rootProject.ext.dependencies.mapcustom
implementation rootProject.ext.dependencies.crashreportupgrade
// implementation rootProject.ext.dependencies.crashreportbugly
implementation rootProject.ext.dependencies.moduleservice
api rootProject.ext.dependencies.mogoaicloudservicesdk
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.modulecommon
api rootProject.ext.dependencies.mogoservice
api rootProject.ext.dependencies.moduleV2x
api rootProject.ext.dependencies.moduleshare
api rootProject.ext.dependencies.tanluupload
api rootProject.ext.dependencies.mogomonitor
api rootProject.ext.dependencies.moduleextensions
api rootProject.ext.dependencies.modulemap
api rootProject.ext.dependencies.moduleADAS
api rootProject.ext.dependencies.modulepushbase
api rootProject.ext.dependencies.modulepush
api rootProject.ext.dependencies.callchat
api rootProject.ext.dependencies.callchatprovider
api rootProject.ext.dependencies.mapcustom
api rootProject.ext.dependencies.crashreportupgrade
// api rootProject.ext.dependencies.crashreportbugly
api rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_obu_mogo
implementation rootProject.ext.dependencies.mogo_core_function_smp
implementation rootProject.ext.dependencies.mogo_core_function_hmi
implementation rootProject.ext.dependencies.mogo_core_function_notice
implementation rootProject.ext.dependencies.mogo_core_function_autopilot
implementation rootProject.ext.dependencies.mogo_core_function_check
implementation rootProject.ext.dependencies.mogo_core_function_map
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_monitoring
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_utils
api rootProject.ext.dependencies.mogo_core_function_obu_mogo
api rootProject.ext.dependencies.mogo_core_function_smp
api rootProject.ext.dependencies.mogo_core_function_hmi
api rootProject.ext.dependencies.mogo_core_function_notice
api rootProject.ext.dependencies.mogo_core_function_autopilot
api rootProject.ext.dependencies.mogo_core_function_check
api rootProject.ext.dependencies.mogo_core_function_map
api rootProject.ext.dependencies.mogo_core_function_v2x
api rootProject.ext.dependencies.mogo_core_function_monitoring
implementation rootProject.ext.dependencies.modulemain
api rootProject.ext.dependencies.modulemain
} else {
implementation project(':foudations:mogo-aicloud-services-sdk')
implementation project(':foudations:mogo-commons')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-v2x')
implementation project(':modules:mogo-module-share')
implementation project(':modules:tanlulib')
implementation project(':modules:mogo-module-monitor')
implementation project(':modules:mogo-module-extensions')
implementation project(':modules:mogo-module-map')
implementation project(':modules:mogo-module-adas')
implementation project(":modules:mogo-module-push-base")
implementation project(":modules:mogo-module-push")
implementation project(':modules:mogo-module-carchatting')
implementation project(':modules:mogo-module-carchattingprovider')
implementation project(':libraries:map-custom')
implementation project(':test:crashreport-upgrade')
// implementation project(':test:crashreport-bugly')
implementation project(':modules:mogo-module-service')
api project(':foudations:mogo-aicloud-services-sdk')
api project(':foudations:mogo-commons')
api project(':modules:mogo-module-common')
api project(':modules:mogo-module-service')
api project(':modules:mogo-module-v2x')
api project(':modules:mogo-module-share')
api project(':modules:tanlulib')
api project(':modules:mogo-module-monitor')
api project(':modules:mogo-module-extensions')
api project(':modules:mogo-module-map')
api project(':modules:mogo-module-adas')
api project(":modules:mogo-module-push-base")
api project(":modules:mogo-module-push")
api project(':modules:mogo-module-carchatting')
api project(':modules:mogo-module-carchattingprovider')
api project(':libraries:map-custom')
api project(':test:crashreport-upgrade')
// api project(':test:crashreport-bugly')
api project(':modules:mogo-module-service')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:function-impl:mogo-core-function-obu-mogo')
implementation project(':core:function-impl:mogo-core-function-smp')
implementation project(':core:function-impl:mogo-core-function-hmi')
implementation project(':core:function-impl:mogo-core-function-autopilot')
implementation project(':core:function-impl:mogo-core-function-check')
implementation project(':core:function-impl:mogo-core-function-map')
implementation project(':core:function-impl:mogo-core-function-notice')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-monitoring')
api project(':core:mogo-core-data')
api project(':core:mogo-core-utils')
api project(':core:function-impl:mogo-core-function-obu-mogo')
api project(':core:function-impl:mogo-core-function-smp')
api project(':core:function-impl:mogo-core-function-hmi')
api project(':core:function-impl:mogo-core-function-autopilot')
api project(':core:function-impl:mogo-core-function-check')
api project(':core:function-impl:mogo-core-function-map')
api project(':core:function-impl:mogo-core-function-notice')
api project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-monitoring')
implementation project(":modules:mogo-module-main")
api project(":modules:mogo-module-main")
}
}

View File

@@ -312,7 +312,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
// 自动驾驶系统检测模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, PushUIConstants.NAME));
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
// ADAS模块慢慢被 域控制器模块 替换掉)
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
// 全局语音唤醒