[Feat]支持跨模块调用司乘屏通信的能力

This commit is contained in:
chenfufeng
2023-02-14 17:14:17 +08:00
parent 4f25b0fd43
commit 8c7cb487aa
7 changed files with 67 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.telematic.IMogoTelematicProvider
import com.mogo.telematic.MogoProtocolMsg
import com.mogo.telematic.NSDNettyManager
@Route(path = MogoServicePaths.PATH_TELEMATIC_PROVIDER)
@@ -26,4 +27,16 @@ class MoGoTelematicProvider: IMogoTelematicProvider {
override fun getServerToken(): String {
return NSDNettyManager.getInstance().serverSn
}
override fun sendMsgToAllClients(type: Int, byteArray: ByteArray) {
NSDNettyManager.getInstance().sendMsgToAllClients(
MogoProtocolMsg(type, byteArray.size, byteArray)
)
}
override fun sendMsgToServer(type: Int, byteArray: ByteArray) {
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
MogoProtocolMsg(type, byteArray.size, byteArray),
null)
}
}

View File

@@ -8,10 +8,12 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.telematic.TelematicConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -122,6 +124,9 @@ class TeleMsgHandler : IMsgHandler {
}
}
}
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
else -> {
}
}
@@ -166,6 +171,9 @@ class TeleMsgHandler : IMsgHandler {
invokeNettyConnResult("司机屏SN未获取到不发送给乘客屏")
}
}
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
else -> {
}
}