[6.2.10][蘑方功能优化] 代码提交
This commit is contained in:
@@ -5,9 +5,14 @@ import android.util.*
|
||||
import android.view.KeyEvent
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.config.*
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.*
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport.Code.Info.IMF
|
||||
@@ -45,6 +50,7 @@ import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companio
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_EXECUTE_PARAMS_TYPE
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
internal class MoFangCommandExecutor {
|
||||
|
||||
@@ -64,6 +70,10 @@ internal class MoFangCommandExecutor {
|
||||
@Volatile
|
||||
private var linkedLog: MoFangLinkedLog? = null
|
||||
|
||||
private val autoPilotState by lazy { AtomicInteger(CallerAutoPilotStatusListenerManager.getState()) }
|
||||
|
||||
private val ipcConnectState by lazy { AtomicBoolean(CallerAutoPilotStatusListenerManager.isConnect()) }
|
||||
|
||||
fun setLinkedLog(log: MoFangLinkedLog) {
|
||||
this.linkedLog = log
|
||||
}
|
||||
@@ -104,6 +114,36 @@ internal class MoFangCommandExecutor {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
val last = autoPilotState.get()
|
||||
Log.d(TAG, "收到工控机自驾状态回调 -> state: $state, last: $last")
|
||||
if (last != state) {
|
||||
if (last == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
// 由自驾状态改为非自驾,发送复原指令
|
||||
handleSingleClick(KeyEvent.KEYCODE_B)
|
||||
}
|
||||
autoPilotState.set(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
Log.d(TAG, "收到工控机连接状态回调 -> status: $status, reason: $reason")
|
||||
val prev = ipcConnectState.get()
|
||||
val current = CallerAutoPilotStatusListenerManager.isConnect()
|
||||
if (!current && prev) {
|
||||
Log.d(TAG, "工控机连接断开了: -> status: $status, reason: $reason")
|
||||
CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.V2X, V2XMsg(
|
||||
EventTypeEnumNew.TYPE_IPC_DISCONNECT_FOR_MO_FANG.poiType,
|
||||
EventTypeEnumNew.TYPE_IPC_DISCONNECT_FOR_MO_FANG.content,
|
||||
EventTypeEnumNew.TYPE_VERIFICATION_SUCCESSFUL.tts,
|
||||
""
|
||||
)))
|
||||
}
|
||||
ipcConnectState.set(current)
|
||||
}
|
||||
}
|
||||
|
||||
private val handlerCallback = Handler.Callback { msg ->
|
||||
|
||||
Reference in New Issue
Block a user