[Update]ADAS日志样式更新

This commit is contained in:
chenfufeng
2022-05-16 15:29:17 +08:00
parent 4396901fc2
commit 0fc07997df
4 changed files with 35 additions and 9 deletions

View File

@@ -75,6 +75,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
}
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus = ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe=reason
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
}

View File

@@ -91,6 +91,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@Override
@@ -372,22 +373,31 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
mConnectInfoRV.post(() -> updateConnectInfoView(autoPilotStatusInfo));
int status = autoPilotStatusInfo.getIpcConnStatus();
if (mLastStatus != status) {
AutopilotStatusInfo statusInfo = autoPilotStatusInfo.clone();
mConnectInfoRV.post(() -> updateConnectInfoView(statusInfo));
mLastStatus = status;
}
}
@Override
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {}
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {}
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotSNRequest() {}
public void onAutopilotSNRequest() {
}
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
mConnAdapter.updateData(autoPilotStatusInfo);
mConnectInfoRV.scrollToPosition(mConnAdapter.getItemCount() - 1);
mLastStatus = autoPilotStatusInfo.getIpcConnStatus();
} else {// 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
}

View File

@@ -89,8 +89,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvConnectInfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="1200px"
android:layout_height="680px"
android:layout_gravity="bottom"
/>
</FrameLayout>

View File

@@ -9,7 +9,7 @@ import java.io.Serializable
* 不建议自己初始化此对象,建议使用 CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
*
*/
class AutopilotStatusInfo : Serializable {
open class AutopilotStatusInfo : Serializable, Cloneable {
/**
* 当前链接的IP地址, 默认地址 192.168.1.102
*/
@@ -20,6 +20,7 @@ class AutopilotStatusInfo : Serializable {
*/
var connectPort: Int = 4110
var connectStatus = false
/**
* 工控机连接状态文字描述
*/
@@ -74,11 +75,23 @@ class AutopilotStatusInfo : Serializable {
*/
var pilotmode = 0
// 默认未连接
var ipcConnStatus = 0x01
override fun toString(): String {
return "AutopilotStatusInfo(connectIP=$connectIP, connectPort=$connectPort, " +
return "connectIP=$connectIP, connectPort=$connectPort, " +
"connectStatus=$connectStatus, connectDescribe=$connectStatusDescribe, version=$version, dockVersion=$dockVersion," +
" locationStatus=$locationStatus), locationLat=$locationLat, locationLon=$locationLon," +
" satelliteTime=$satelliteTime, speed=$speed, state=$state, reason=$reason, camera=$camera," +
" radar=$radar, rtk=$rtk, pilotmode=$pilotmode)"
" radar=$radar, rtk=$rtk, pilotmode=$pilotmode, ipcConnStatus=$ipcConnStatus"
}
public override fun clone(): AutopilotStatusInfo {
try {
return super.clone() as AutopilotStatusInfo
} catch (e: Exception) {
e.printStackTrace()
}
return AutopilotStatusInfo()
}
}