[dev_minibus-d_230425_3.2.0]漫游更改为司乘屏独立漫游

This commit is contained in:
xuxinchao
2023-05-10 18:02:52 +08:00
parent 4b9691d2e8
commit 43e4d50768
8 changed files with 62 additions and 155 deletions

View File

@@ -26,8 +26,8 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
aiCloudIdentifyDataManager.initServer(AbsMogoApplication.getApp())
}
override fun trigger(romaStatus: Boolean,connectError:((Boolean) -> Unit)?) {
aiCloudIdentifyDataManager.trigger(romaStatus,connectError)
override fun trigger(romaStatus: Boolean,requestSuccess:((Boolean) -> Unit)?) {
aiCloudIdentifyDataManager.trigger(romaStatus,requestSuccess)
}
override fun onDestroy() {

View File

@@ -9,7 +9,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
import com.mogo.eagle.core.function.business.ai.net.AiCloudIdentifyNetWorkModel.Companion.aiCloudIdentifyNetWorkModel
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
@@ -18,11 +17,9 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListener
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.updateLongSightLevel
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToServer
import com.mogo.eagle.core.function.utils.MapBizTrace
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.map.MogoMapUIController
import com.mogo.map.listener.IMogoMapListener
@@ -34,7 +31,7 @@ import mogo.telematics.pad.MessagePad
import mogo.yycp.api.proto.SocketDownData
import java.util.concurrent.atomic.AtomicBoolean
class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
class AiCloudIdentifyDataManager : IMogoMapListener,
IMoGoPlanningRottingListener, IMoGoAutopilotStatusListener {
companion object {
@@ -53,56 +50,45 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
private var serverSn = ""
fun initServer(mContext: Context) {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
CallerTelematicListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerPlanningRottingListenerManager.addListener(TAG,this)
CallerAutoPilotControlManager.getGlobalPath()
MogoAiCloudSocketManager.getInstance(mContext)
.registerOnMessageListener(
0x040003, //低频数据
object : IMogoOnMessageListener<SocketDownData.SocketDownDataProto> {
override fun target(): Class<SocketDownData.SocketDownDataProto> {
return SocketDownData.SocketDownDataProto::class.java
}
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerPlanningRottingListenerManager.addListener(TAG,this)
CallerAutoPilotControlManager.getGlobalPath()
MogoAiCloudSocketManager.getInstance(mContext)
.registerOnMessageListener(
0x040003, //低频数据
object : IMogoOnMessageListener<SocketDownData.SocketDownDataProto> {
override fun target(): Class<SocketDownData.SocketDownDataProto> {
return SocketDownData.SocketDownDataProto::class.java
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED,
linkCode = ChainConstant.CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
paramIndexes = [0],
clientPkFileName = "sn"
)
override fun onMsgReceived(obj: SocketDownData.SocketDownDataProto?) {
obj?.let {
obj.data?.let {
if (showAiCloud.get()) {
if (it.allListList == null || it.allListList.size == 0) {
MapIdentifySubscriber.instance.clearAiCloudRoma()
return
}
MapIdentifySubscriber.instance.renderAiCloudResult(it.allListList)
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED,
linkCode = ChainConstant.CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
paramIndexes = [0],
clientPkFileName = "sn"
)
override fun onMsgReceived(obj: SocketDownData.SocketDownDataProto?) {
obj?.let {
obj.data?.let {
if (showAiCloud.get()) {
if (it.allListList == null || it.allListList.size == 0) {
MapIdentifySubscriber.instance.clearAiCloudRoma()
return
}
MapIdentifySubscriber.instance.renderAiCloudResult(it.allListList)
}
}
}
})
}
}
})
}
fun trigger(romaStatus: Boolean,connectError: ((Boolean) -> Unit)?) {
MapBizTrace.log(TAG, "trigger")
if (serverSn.isEmpty()) {
serverSn = CallerTelematicManager.getServerToken()
if (serverSn.isEmpty()) {
ToastUtils.showLong("未获取到司机屏设备信息")
connectError?.invoke(!romaStatus)
return
}
}
// 乘客屏单独控制漫游
// 乘客司机屏屏各自单独控制漫游
if (romaStatus) {
// 开启roma当前非漫游开启
openRoma()
@@ -111,23 +97,6 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
}
}
// 乘客屏接收开启/关闭 roma
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
MapBizTrace.log(TAG, "onReceivedMsg type : $type")
when (type) {
TelematicConstant.OPEN_ROMA_STATUS -> {
when (String(byteArray)) {
"0" -> {
openRoma()
}
"1" -> {
closeRoma()
}
}
}
}
}
private fun openRoma() {
if (!MogoMapUIController.getInstance().currentMapVisualAngle.isRoma) {
updateLongSightLevel(true)
@@ -166,10 +135,8 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
// 请求地图开始漫游
MogoMapUIController.getInstance().setRomaMode(FunctionBuildConfig.romaModeStyle)
CallerMapRomaListener.invokeMapRoma(true)
sendMsgToServer(TelematicConstant.OPEN_ROMA_STATUS, "3".toByteArray())
} else {
CallerMapRomaListener.invokeMapRoma(false)
sendMsgToServer(TelematicConstant.OPEN_ROMA_STATUS, "4".toByteArray())
}
}, {
MapBizTrace.log(
@@ -178,7 +145,6 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
)
updateLongSightLevel(false)
CallerMapRomaListener.invokeMapRoma(false)
sendMsgToServer(TelematicConstant.OPEN_ROMA_STATUS, "4".toByteArray())
if(DebugConfig.isDebug()){
ToastUtils.showShort("漫游请求异常msg:$it")
}