Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0'

Dev arch opt 3.0

See merge request zhjt/AndroidApp/MoGoEagleEye!520
This commit is contained in:
wangmingjun
2023-02-14 10:22:01 +00:00
22 changed files with 238 additions and 1 deletions

View File

@@ -7,6 +7,9 @@ import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.GsonUtils
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.properties.Delegates
import system_master.SystemStatusInfo
/**
@@ -20,6 +23,20 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
private var lineId: Long? by Delegates.observable(0) { _, _, newValue ->
if(newValue == null){
return@observable
}
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotRouteLineId(newValue)
}
}
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotStatusListener> =
ConcurrentHashMap()
@Volatile
private var autoPilotMessageCode: String = ""
@@ -167,6 +184,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
*/
fun updateAutopilotControlParameters(autopilotControlParameters: AutopilotControlParameters? = null) {
mAutopilotStatusInfo.autopilotControlParameters = autopilotControlParameters
lineId = autopilotControlParameters?.autoPilotLine?.lineId
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
}

View File

@@ -0,0 +1,14 @@
package com.mogo.eagle.core.function.call.telematic
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
import com.mogo.eagle.core.function.call.base.CallerBase
object CallerTelematicListenerManager: CallerBase<IReceivedMsgListener>() {
fun invokeReceivedMsg(type: Int, byteArray: ByteArray) {
M_LISTENERS.forEach {
val listener = it.value
listener.onReceivedMsg(type, byteArray)
}
}
}

View File

@@ -34,4 +34,20 @@ object CallerTelematicManager {
fun getServerToken(): String {
return providerApi?.getServerToken() ?: ""
}
/**
* 发送数据给所有客户端
* type保存在TelematicConstant中
*/
fun sendMsgToAllClients(type: Int, byteArray: ByteArray) {
providerApi?.sendMsgToAllClients(type, byteArray)
}
/**
* 发送数据给服务端
* type保存在TelematicConstant中
*/
fun sendMsgToServer(type: Int, byteArray: ByteArray) {
providerApi?.sendMsgToServer(type, byteArray)
}
}