[状态栏]优化CAN和RTK状态判断;RTK状态增加文字描述
This commit is contained in:
@@ -52,6 +52,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
|
||||
@@ -337,6 +338,10 @@ public class BusPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
@@ -283,4 +284,9 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
|
||||
|
||||
@@ -566,6 +567,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
|
||||
|
||||
@@ -82,6 +82,7 @@ import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
@@ -1148,6 +1149,10 @@ public class TaxiModel {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "美化模式-ignore:置为false(到达目的地)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
};
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
|
||||
|
||||
|
||||
@@ -525,4 +525,9 @@ class MoGoAutopilotProvider :
|
||||
override fun getTeleTimeStamp(): Long {
|
||||
return msgHandler.getTeleTimeStamp()
|
||||
}
|
||||
|
||||
override fun sendStatusQueryReq() {
|
||||
Log.d(TAG, "---- sendStatusQueryReq ----")
|
||||
AdasManager.getInstance().sendStatusQueryReq()
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
@@ -43,6 +44,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudList
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.network.utils.*
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
@@ -369,6 +371,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
statusInfo: SystemStatusInfo.StatusInfo?
|
||||
) {
|
||||
//状态查询应答
|
||||
statusInfo?.let {
|
||||
Log.d(TAG, GsonUtil.jsonFromObject(it))
|
||||
}
|
||||
invokeAutopilotStatusRespByQuery(statusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.*
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.zhjt.mogo_core_function_devatools.ext.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||
@@ -78,8 +79,13 @@ object StatusManager {
|
||||
for (f in flows) {
|
||||
f.onCreate()
|
||||
}
|
||||
ctx.lifeCycleScope.launch(Dispatchers.IO) {
|
||||
while (true) {
|
||||
CallerAutoPilotManager.sendStatusQueryReq()
|
||||
delay(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.normalPop(content,
|
||||
width = 665.PX,
|
||||
height = WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
|
||||
@@ -81,7 +81,7 @@ internal class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean =
|
||||
/**
|
||||
* RTK/GNSS定位状态
|
||||
*/
|
||||
internal class RTKStatus(var enabled: Boolean = false): Status() {
|
||||
internal class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK"): Status() {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow.can
|
||||
|
||||
import android.content.*
|
||||
import android.util.*
|
||||
import chassis.Chassis.GearPosition
|
||||
import chassis.Chassis.LightSwitch
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
@@ -11,6 +10,8 @@ import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||
import kotlinx.coroutines.*
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import system_master.SystemStatusInfo.StatusInfo
|
||||
import java.util.concurrent.atomic.*
|
||||
|
||||
internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
|
||||
|
||||
@@ -19,6 +20,7 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehic
|
||||
}
|
||||
|
||||
private var job: Job? = null
|
||||
private val state: AtomicInteger by lazy { AtomicInteger(Int.MIN_VALUE) }
|
||||
|
||||
override fun onCreate() {
|
||||
send(CanStatus(CallerAutoPilotManager.isConnected()))
|
||||
@@ -33,7 +35,7 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehic
|
||||
|
||||
private fun isCanEnabled(): Boolean {
|
||||
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
|
||||
return CallerAutoPilotManager.isConnected() && code != "EHW_CAN"
|
||||
return CallerAutoPilotManager.isConnected() && code != "EHW_CAN" && (state.get() == Int.MIN_VALUE || state.get() == 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -69,12 +71,18 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehic
|
||||
timeOutCheck()
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: StatusInfo) {
|
||||
val state = status.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal
|
||||
if (state != null) {
|
||||
this.state.set(state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun timeOutCheck() {
|
||||
job?.safeCancel()
|
||||
launch(Dispatchers.Default) {
|
||||
delay(4000)
|
||||
send(CanStatus(false))
|
||||
send(CanStatus(isCanEnabled()))
|
||||
}.also { job = it }
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import com.zhjt.mogo_core_function_devatools.status.entity.RTKStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad.GnssInfo
|
||||
import system_master.SystemStatusInfo.HealthInfo
|
||||
import system_master.SystemStatusInfo.StatusInfo
|
||||
import java.util.concurrent.atomic.*
|
||||
|
||||
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotCarStateListener, IMoGoAutopilotStatusListener {
|
||||
companion object {
|
||||
@@ -17,6 +20,10 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotCarSt
|
||||
|
||||
private var job: Job? = null
|
||||
|
||||
private val desc by lazy {
|
||||
AtomicReference<HealthInfo>(null)
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
send(RTKStatus(isRTKEnabled()))
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
@@ -27,29 +34,41 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotCarSt
|
||||
private fun isRTKEnabled(): Boolean {
|
||||
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
|
||||
val gnssInfo = CallerAutopilotCarStatusListenerManager.getCurrentGnssInfo()
|
||||
val status = desc.get()
|
||||
return CallerAutoPilotManager.isConnected() && (
|
||||
code != "EHW_RTK" &&
|
||||
code != "EHW_GNSS" &&
|
||||
code != "ESYS_RTK_STATUS_FAULT" &&
|
||||
code != "ELCT_RTK_STATUS_FAULT" &&
|
||||
code != "ELCT_RTK_STATUS_UNKNOWN") && gnssInfo != null
|
||||
code != "ELCT_RTK_STATUS_UNKNOWN") && gnssInfo != null && (status == null || status.state?.ordinal == 0)
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: GnssInfo?) {
|
||||
send(RTKStatus(isRTKEnabled()))
|
||||
send(RTKStatus(isRTKEnabled(), getDesc()))
|
||||
timeOutCheck()
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
send(RTKStatus(isRTKEnabled()))
|
||||
send(RTKStatus(isRTKEnabled(), getDesc()))
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: StatusInfo) {
|
||||
val state = status.healthInfoList?.find { "localization".equals(it.name, true) }
|
||||
if (state != null) {
|
||||
desc.set(state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDesc(): String {
|
||||
return desc.get()?.desc?.uppercase() ?: "RTK"
|
||||
}
|
||||
|
||||
private fun timeOutCheck() {
|
||||
job?.safeCancel()
|
||||
launch(Dispatchers.Default) {
|
||||
delay(4000)
|
||||
send(RTKStatus(false))
|
||||
send(RTKStatus(isRTKEnabled(), getDesc()))
|
||||
}.also { job = it }
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
} else {
|
||||
iv.background = ContextCompat.getDrawable(itemView.context, drawable.icon_dev_status_rtk_disable)
|
||||
}
|
||||
tv.text = "RTK"
|
||||
tv.text = status.desc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,12 @@ import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIR
|
||||
import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
@@ -339,4 +341,8 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
@@ -142,13 +143,17 @@ public class SteeringWheelView extends ConstraintLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
|
||||
|
||||
@@ -63,6 +63,7 @@ import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -396,6 +397,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
public void onAutopilotSNRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
|
||||
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
|
||||
mConnAdapter.updateData(autoPilotStatusInfo);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -25,6 +26,7 @@ import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -176,4 +178,9 @@ public class SmallMapFragment extends BaseFragment
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,4 +190,9 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
* 或乘客屏解析数据的时间戳
|
||||
*/
|
||||
fun getTeleTimeStamp(): Long
|
||||
|
||||
/**
|
||||
* 主动查询工控机的各topic状态
|
||||
*/
|
||||
fun sendStatusQueryReq()
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.api.autopilot
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -41,6 +42,11 @@ interface IMoGoAutopilotStatusListener {
|
||||
fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {}
|
||||
|
||||
|
||||
/**
|
||||
* 工控机主动查询 AdasManager#sendStatusQueryReq(),后会收到如下回调
|
||||
*/
|
||||
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) { }
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
|
||||
@@ -252,4 +252,11 @@ object CallerAutoPilotManager {
|
||||
fun getTeleTimeStamp(): Long {
|
||||
return providerApi?.getTeleTimeStamp() ?: 0L
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动查询工控机的各topic状态
|
||||
*/
|
||||
fun sendStatusQueryReq() {
|
||||
providerApi?.sendStatusQueryReq()
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
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
|
||||
|
||||
/**
|
||||
@@ -184,5 +185,15 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主动调查询接口:AdasManager#sendStatusQueryReq(), 会收到以下回调
|
||||
*/
|
||||
fun invokeAutopilotStatusRespByQuery(statusInfo: SystemStatusInfo.StatusInfo?) {
|
||||
statusInfo?.also {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach{ itx ->
|
||||
val listener = itx.value
|
||||
listener.onAutopilotStatusRespByQuery(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
public class MogoRouteOverlayManager implements
|
||||
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener,
|
||||
@@ -143,4 +144,9 @@ public class MogoRouteOverlayManager implements
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @androidx.annotation.Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user