[Update]支持乘客屏连接指定ip的司机屏,支持乘客屏请求司机屏车牌号
This commit is contained in:
@@ -57,5 +57,5 @@ dependencies {
|
||||
// api "com.zhidao.support.adas:high:1.2.1.2_bate21"
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.50'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.51'
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context
|
||||
import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.toRouteInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -19,19 +20,22 @@ import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
import com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA
|
||||
import com.mogo.telematic.MogoProtocolMsg.SYNC_MODE_STATUS
|
||||
import com.mogo.telematic.MogoProtocolMsg.*
|
||||
import com.mogo.telematic.NSDNettyManager
|
||||
import com.mogo.telematic.client.listener.MessageStateListener
|
||||
import com.mogo.telematic.client.listener.NettyClientListener
|
||||
import com.mogo.telematic.client.status.ConnectState
|
||||
import com.mogo.telematic.server.netty.NettyServerListener
|
||||
import com.mogo.telematic.server.netty.NettyTcpServer
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.AdasOptions
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
|
||||
@@ -78,6 +82,26 @@ class MoGoAutopilotProvider :
|
||||
NettyServerListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Receive client data is:${msg?.toString()}")
|
||||
msg?.let {
|
||||
when (it.protocolType) {
|
||||
REQ_CAR_NUMBER -> {
|
||||
if (!AppConfigInfo.plateNumber.isNullOrEmpty()) {
|
||||
val platNumberArray = AppConfigInfo.plateNumber!!.toByteArray()
|
||||
NSDNettyManager.getInstance().sendMsgToSpecifiedClient(
|
||||
MogoProtocolMsg(
|
||||
REQ_CAR_NUMBER,
|
||||
platNumberArray.size, platNumberArray
|
||||
), channel
|
||||
) {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "司机端发送车牌号到乘客端是否成功:${it.isSuccess}")
|
||||
}
|
||||
} else {
|
||||
CallerAutoPilotManager.getCarConfig()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartServer() {
|
||||
@@ -91,8 +115,15 @@ class MoGoAutopilotProvider :
|
||||
override fun onChannelConnect(channel: Channel?) {
|
||||
val socketAddress = channel?.remoteAddress().toString()
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Client ip is:${socketAddress}")
|
||||
val byteArray = if(FunctionBuildConfig.isDemoMode) byteArrayOf(1) else byteArrayOf(0)
|
||||
NSDNettyManager.getInstance().sendMsgToSpecifiedClient(MogoProtocolMsg(SYNC_MODE_STATUS, byteArray.size, byteArray), channel) {
|
||||
val byteArray =
|
||||
if (FunctionBuildConfig.isDemoMode) byteArrayOf(1) else byteArrayOf(0)
|
||||
NSDNettyManager.getInstance().sendMsgToSpecifiedClient(
|
||||
MogoProtocolMsg(
|
||||
SYNC_MODE_STATUS,
|
||||
byteArray.size,
|
||||
byteArray
|
||||
), channel
|
||||
) {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步美化模式状态是否成功:${it.isSuccess}")
|
||||
}
|
||||
}
|
||||
@@ -114,41 +145,21 @@ class MoGoAutopilotProvider :
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object :
|
||||
NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(msg: MogoProtocolMsg?, sign: String?) {
|
||||
override fun onMessageResponseClient(
|
||||
msg: MogoProtocolMsg?,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
try {
|
||||
msg?.let {
|
||||
when(it.protocolType) {
|
||||
NORMAL_DATA -> AdasManager.getInstance().parseIPCData(it.body)
|
||||
3 -> {
|
||||
FunctionBuildConfig.isDemoMode = when(it.body[0].toInt()) {
|
||||
1 -> true
|
||||
else -> false
|
||||
}
|
||||
setDemoMode(FunctionBuildConfig.isDemoMode)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "乘客屏解析数据流程中出现异常:${e.message}")
|
||||
}
|
||||
handleMsgFromServer(msg, channel)
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(statusCode: Int, sign: String?) {
|
||||
when (statusCode) {
|
||||
ConnectState.STATUS_CONNECT_SUCCESS -> {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showLong("和司机端连接异常!")
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG",
|
||||
"client statusCode is:${statusCode}"
|
||||
)
|
||||
}
|
||||
}
|
||||
override fun onClientStatusConnectChanged(
|
||||
statusCode: Int,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
handleConnStatusWithServer(statusCode, sign)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -284,7 +295,7 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
return AdasManager.getInstance().sendAutopilotSpeedReq(speed/3.6)
|
||||
return AdasManager.getInstance().sendAutopilotSpeedReq(speed / 3.6)
|
||||
}
|
||||
|
||||
override fun setIPCShutDown() {
|
||||
@@ -332,7 +343,13 @@ class MoGoAutopilotProvider :
|
||||
var byteArray = if (isEnable) byteArrayOf(1) else byteArrayOf(0)
|
||||
if (NSDNettyManager.getInstance().isServerStart) {
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMsgToAllClients(MogoProtocolMsg(SYNC_MODE_STATUS, byteArray.size, byteArray))
|
||||
.sendMsgToAllClients(
|
||||
MogoProtocolMsg(
|
||||
SYNC_MODE_STATUS,
|
||||
byteArray.size,
|
||||
byteArray
|
||||
)
|
||||
)
|
||||
} else {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步美化模式状态时司机端Server未启动!")
|
||||
}
|
||||
@@ -380,5 +397,76 @@ class MoGoAutopilotProvider :
|
||||
return AdasManager.getInstance().protocolVersion
|
||||
}
|
||||
|
||||
override fun connectSpecifiedServer(ip: String) {
|
||||
NSDNettyManager.getInstance().connectSpecifiedServer(
|
||||
ip,
|
||||
NettyTcpServer.SERVER_PORT,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
object : NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(
|
||||
msg: MogoProtocolMsg?,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
handleMsgFromServer(msg, channel)
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(
|
||||
statusCode: Int,
|
||||
sign: String?,
|
||||
channel: Channel
|
||||
) {
|
||||
handleConnStatusWithServer(statusCode, sign)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun handleMsgFromServer(msg: MogoProtocolMsg?, channel: Channel) {
|
||||
try {
|
||||
msg?.let {
|
||||
when (it.protocolType) {
|
||||
NORMAL_DATA -> AdasManager.getInstance().parseIPCData(it.body)
|
||||
SYNC_MODE_STATUS -> {
|
||||
FunctionBuildConfig.isDemoMode = when (it.body[0].toInt()) {
|
||||
1 -> true
|
||||
else -> false
|
||||
}
|
||||
setDemoMode(FunctionBuildConfig.isDemoMode)
|
||||
}
|
||||
REQ_CAR_NUMBER -> {
|
||||
AppConfigInfo.plateNumber = String(msg.body)
|
||||
ToastUtils.showShort(AppConfigInfo.plateNumber)
|
||||
// TODO:("获取到车牌号")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "乘客屏解析数据流程中出现异常:${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleConnStatusWithServer(statusCode: Int, sign: String?) {
|
||||
when (statusCode) {
|
||||
ConnectState.STATUS_CONNECT_SUCCESS -> {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
if (AppConfigInfo.plateNumber.isNullOrEmpty()) {
|
||||
var byteArray = byteArrayOf(0)
|
||||
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
|
||||
MogoProtocolMsg(REQ_CAR_NUMBER, byteArray.size, byteArray)
|
||||
) {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "请求车牌号数据发送是否成功:${it}")
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showLong("和司机端连接异常!")
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG",
|
||||
"client statusCode is:${statusCode}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,8 +565,18 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
tbChangeAutoPilotStatus.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
CallerAutoPilotManager.setControlAutopilotCarAuto(isChecked)
|
||||
}
|
||||
|
||||
|
||||
when {
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) -> {
|
||||
brakeThresholdDivider.visibility = View.GONE
|
||||
btnConnectServerIp.visibility = View.GONE
|
||||
etConnectServerIp.visibility = View.GONE
|
||||
}
|
||||
else -> {
|
||||
brakeThresholdDivider.visibility = View.VISIBLE
|
||||
btnConnectServerIp.visibility = View.VISIBLE
|
||||
etConnectServerIp.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -600,8 +610,10 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
//设置连接司机屏IP
|
||||
btnConnectServerIp.setOnClickListener {
|
||||
//TODO 连接设置 输入框:etConnectServerIp
|
||||
|
||||
val ip = etConnectServerIp.text.toString()
|
||||
if (!ip.isNullOrEmpty()) {
|
||||
CallerAutoPilotManager.connectSpecifiedServer(ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,4 +152,6 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
*获取协议版本
|
||||
*/
|
||||
fun getProtocolVersion(): Int
|
||||
|
||||
fun connectSpecifiedServer(ip: String)
|
||||
}
|
||||
@@ -173,4 +173,8 @@ object CallerAutoPilotManager {
|
||||
fun getProtocolVersion(): Int{
|
||||
return providerApi?.getProtocolVersion() ?:0
|
||||
}
|
||||
|
||||
fun connectSpecifiedServer(ip: String) {
|
||||
providerApi?.connectSpecifiedServer(ip)
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ kotlin.parallel.tasks.in.project=true
|
||||
#优化kapt
|
||||
#并行运行kapt1.2.60版本以上支持
|
||||
kapt.use.worker.api=true
|
||||
#增量编译 kapt1.3.50版本以上支持
|
||||
#增量编译 kapt1.3.51版本以上支持
|
||||
kapt.incremental.apt=true
|
||||
#kapt avoiding 如果用kapt依赖的内容没有变化,会完全重用编译内容,省掉app:kaptGenerateStubsDebugKotlin的时间
|
||||
kapt.include.compile.classpath=false
|
||||
@@ -63,23 +63,23 @@ SERVICE_CHAIN_VERSION=1.1.0
|
||||
LOGLIB_VERSION=1.2.24
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 网络请求LOGLIB_VERSION
|
||||
MOGO_NETWORK_VERSION=1.3.50
|
||||
MOGO_NETWORK_VERSION=1.3.51
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.3.50
|
||||
MOGO_PASSPORT_VERSION=1.3.51
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.3.50
|
||||
MOGO_SOCKET_VERSION=1.3.51
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.3.50
|
||||
MOGO_REALTIME_VERSION=1.3.51
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.3.50
|
||||
MOGO_TANLU_VERSION=1.3.51
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.3.50
|
||||
MOGO_LIVE_VERSION=1.3.51
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.50
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.51
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.3.50
|
||||
MOGO_LOCATION_VERSION=1.3.51
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.3.50
|
||||
MOGO_TELEMATIC_VERSION=1.3.51
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 自研地图
|
||||
MAP_SDK_VERSION=2.0.9.11
|
||||
@@ -155,5 +155,5 @@ MOGO_OCH_TAXI_VERSION=2.0.66
|
||||
# mogoAiCloud sdk services
|
||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
|
||||
# v2x-sdk
|
||||
MOGO_V2X_SDK_VERSION=1.3.50
|
||||
MOGO_V2X_SDK_VERSION=1.3.51
|
||||
################# 旧版本架构模块版本 #################
|
||||
|
||||
Reference in New Issue
Block a user