[Feat]乘客屏直连工控机
This commit is contained in:
@@ -80,7 +80,6 @@ class MoGoAutopilotProvider :
|
||||
// 初始化ADAS 域控制器
|
||||
CupidLogUtils.setEnableLog(false)
|
||||
msgHandler = TeleMsgHandler()
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机
|
||||
// 注册地图采集功能
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
@@ -95,11 +94,11 @@ class MoGoAutopilotProvider :
|
||||
|
||||
// "192.168.1.102"
|
||||
val options = AdasOptions.Builder()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
|
||||
.build()
|
||||
.build()
|
||||
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
|
||||
@@ -130,36 +129,34 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
}, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
} else {
|
||||
// 乘客端默认接收绘制全局路径+引导线
|
||||
//FunctionBuildConfig.isDemoMode = true
|
||||
//FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
// "192.168.1.103"
|
||||
val options = AdasOptions
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)// 乘客端直连工控机改为false
|
||||
.build()
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn,
|
||||
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode),
|
||||
object : NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(
|
||||
msg: MogoProtocolMsg?,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
msgHandler.handleMsgFromServer(msg, channel)
|
||||
}
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn,
|
||||
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode),
|
||||
object : NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(
|
||||
msg: MogoProtocolMsg?,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
msgHandler.handleMsgFromServer(msg, channel)
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(
|
||||
statusCode: Int,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
msgHandler.handleClientConnStatus(statusCode, sign, channel)
|
||||
}
|
||||
})
|
||||
override fun onClientStatusConnectChanged(
|
||||
statusCode: Int,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
msgHandler.handleClientConnStatus(statusCode, sign, channel)
|
||||
}
|
||||
})
|
||||
}
|
||||
//////////////////////////////////注意先后顺序,AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
|
||||
|
||||
@@ -169,33 +166,6 @@ class MoGoAutopilotProvider :
|
||||
if (!AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
}
|
||||
AdasManager.getInstance().setOnMultiDeviceListener(object : OnMultiDeviceListener {
|
||||
override fun onForwardingDriverIPCMessage(bytes: ByteArray?) {
|
||||
if (bytes == null)
|
||||
return
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart) {
|
||||
msgHandler.synWriteTime()
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
|
||||
} else {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "司机端Server未启动!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onForwardingPassengerIPCMessage(bytes: ByteArray?) {
|
||||
if (bytes == null)
|
||||
return
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMogoProtocolMsgToServer(
|
||||
MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes),
|
||||
null
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
|
||||
// 同步数据给工控机的服务
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
@@ -324,7 +294,7 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int, duration: Int, bduration: Int): Boolean {
|
||||
return AdasManager.getInstance().startRecordPackage(id,duration, type, bduration)
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
@@ -366,7 +336,6 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 演示模式(美化模式)设置只限定于鹰眼
|
||||
* isEnable = true 开启
|
||||
@@ -492,7 +461,10 @@ class MoGoAutopilotProvider :
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null)
|
||||
} else {
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
|
||||
// 司机屏才可关闭自动驾驶
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.os.SystemClock
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_EAGLE_START_AUTOPILOT
|
||||
@@ -10,6 +11,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LO
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants
|
||||
import kotlin.random.Random
|
||||
@@ -40,7 +42,7 @@ object CallerAutoPilotManager {
|
||||
/**
|
||||
* 断开与工控机的连接
|
||||
*/
|
||||
fun disconnectIpc(){
|
||||
fun disconnectIpc() {
|
||||
providerApi?.disconnectIpc()
|
||||
}
|
||||
|
||||
@@ -69,51 +71,70 @@ object CallerAutoPilotManager {
|
||||
* 发送红绿灯数据至工控机
|
||||
*/
|
||||
fun sendTrafficLightData(trafficLightResult: TrafficLightResult) {
|
||||
providerApi?.sendTrafficLightData(trafficLightResult)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*/
|
||||
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) {
|
||||
providerApi?.sendTrajectoryDownloadReq(autoPilotLine)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.sendTrajectoryDownloadReq(autoPilotLine)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
fun cancelAutoPilot() {
|
||||
providerApi?.cancelAutoPilot()
|
||||
// 司机屏才能取消自动驾驶
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.cancelAutoPilot()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启域控制器录制bag包
|
||||
*/
|
||||
fun recordPackage() {
|
||||
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt())
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt())
|
||||
}
|
||||
}
|
||||
|
||||
fun recordPackage(duration: Int){
|
||||
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt(),duration)
|
||||
fun recordPackage(duration: Int) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt(), duration)
|
||||
}
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int, id: Int) {
|
||||
providerApi?.recordPackage(type, id)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordPackage(type, id)
|
||||
}
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int, id: Int, duration: Int) {
|
||||
providerApi?.recordPackage(type, id, duration)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordPackage(type, id, duration)
|
||||
}
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int, id: Int, duration: Int,bduration: Int){
|
||||
providerApi?.recordPackage(type, id, duration, bduration)
|
||||
fun recordPackage(type: Int, id: Int, duration: Int, bduration: Int) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordPackage(type, id, duration, bduration)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止录制bag包
|
||||
*/
|
||||
fun stopRecord(type: Int, id: Int) {
|
||||
providerApi?.stopRecord(type, id)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.stopRecord(type, id)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,8 +148,8 @@ object CallerAutoPilotManager {
|
||||
/**
|
||||
* ADAS日志开启状态
|
||||
*/
|
||||
fun isEnableLog(): Boolean{
|
||||
return providerApi?.isEnableLog()?:false
|
||||
fun isEnableLog(): Boolean {
|
||||
return providerApi?.isEnableLog() ?: false
|
||||
}
|
||||
|
||||
|
||||
@@ -136,11 +157,19 @@ object CallerAutoPilotManager {
|
||||
* speed单位:km/h
|
||||
*/
|
||||
fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
return providerApi?.setAutoPilotSpeed(speed) ?: false
|
||||
// 司机屏才可以设置最大速度
|
||||
return if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.setAutoPilotSpeed(speed) ?: false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
|
||||
providerApi?.recordCause(key, name, id, reason)
|
||||
// 乘客屏不需要记录人工接管原因
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.recordCause(key, name, id, reason)
|
||||
}
|
||||
}
|
||||
|
||||
fun setIPCShutDown() {
|
||||
@@ -157,7 +186,9 @@ object CallerAutoPilotManager {
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
fun setDemoMode(isEnable: Boolean) {
|
||||
providerApi?.setDemoMode(isEnable)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.setDemoMode(isEnable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,8 +204,11 @@ object CallerAutoPilotManager {
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
fun setIPCDemoMode(isEnable: Boolean){
|
||||
providerApi?.setIPCDemoMode(isEnable)
|
||||
fun setIPCDemoMode(isEnable: Boolean) {
|
||||
// 司机屏才能控制美化模式(状态是在客户端维护、管理的)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.setIPCDemoMode(isEnable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,15 +216,18 @@ object CallerAutoPilotManager {
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
fun setRainMode(isEnable: Boolean){
|
||||
fun setRainMode(isEnable: Boolean) {
|
||||
providerApi?.setRainMode(isEnable)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
*/
|
||||
fun getBadCaseConfig(){
|
||||
providerApi?.getBadCaseConfig()
|
||||
fun getBadCaseConfig() {
|
||||
// 司机屏才能查询数据采集的配置
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.getBadCaseConfig()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,8 +261,10 @@ object CallerAutoPilotManager {
|
||||
/**
|
||||
* 发送工控机所有节点重启命令
|
||||
*/
|
||||
fun sendIpcReboot(){
|
||||
providerApi?.sendIpcReboot()
|
||||
fun sendIpcReboot() {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.sendIpcReboot()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,22 +286,22 @@ object CallerAutoPilotManager {
|
||||
/**
|
||||
* 查询工控机基础配置信息
|
||||
*/
|
||||
fun getCarConfig(){
|
||||
fun getCarConfig() {
|
||||
providerApi?.getCarConfig()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局路径
|
||||
*/
|
||||
fun getGlobalPath(){
|
||||
fun getGlobalPath() {
|
||||
providerApi?.getGlobalPath()
|
||||
}
|
||||
|
||||
/**
|
||||
*获取协议版本
|
||||
*/
|
||||
fun getProtocolVersion(): Int{
|
||||
return providerApi?.getProtocolVersion() ?:0
|
||||
fun getProtocolVersion(): Int {
|
||||
return providerApi?.getProtocolVersion() ?: 0
|
||||
}
|
||||
|
||||
fun connectSpecifiedServer(ip: String) {
|
||||
|
||||
Reference in New Issue
Block a user