[8.2.8][i18n] adas-data ReceiveTimeoutManager.java 中文抽取
This commit is contained in:
@@ -125,4 +125,14 @@
|
||||
<string name="adas_data_report_action_MANUAL_HANDLE_IMMEDIATELY">请安全员立即接管</string>
|
||||
<string name="adas_data_report_action_REBOOT_SYSTEM">系统软重启</string>
|
||||
<string name="adas_data_report_action_KEEP_POWERON_AND_WAIT">请安全位置停车,保持上电,等待修复完成</string>
|
||||
|
||||
|
||||
<string name="adas_time_out_period">超时时间:</string>
|
||||
<string name="adas_last_refresh_time_difference">最后刷新时间时间差:</string>
|
||||
<string name="adas_last_receive_heartbeat_time">最后一条Telematics心跳接收时间</string>
|
||||
<string name="adas_last_receive_data_time">最后一条Telematics数据发送时间</string>
|
||||
<!-- <string name="adas_"></string>-->
|
||||
<!-- <string name="adas_"></string>-->
|
||||
<!-- <string name="adas_"></string>-->
|
||||
<!-- <string name="adas_"></string>-->
|
||||
</resources>
|
||||
|
||||
@@ -371,7 +371,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
private void initSocket() {
|
||||
if (mSocket == null) {
|
||||
mSocket = new FpgaSocket(context);
|
||||
context = null;
|
||||
mSocket.setWebSocketListener(this);
|
||||
if (isUseQueue) {
|
||||
WebSocketQueueManager.getInstance().registerWebSocketListener(this);
|
||||
@@ -924,7 +923,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
}
|
||||
if (args != null && args.length > 0) {
|
||||
if (status == AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT && args.length > 2) {
|
||||
reason = ReceiveTimeoutManager.buildTimeoutStr(true, (boolean) args[0], (long) args[1], (long) args[2]);
|
||||
reason = ReceiveTimeoutManager.buildTimeoutStr(context, true, (boolean) args[0], (long) args[1], (long) args[2]);
|
||||
} else {
|
||||
reason = String.valueOf(args[0]);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
|
||||
@@ -128,7 +130,7 @@ public class ReceiveTimeoutManager {
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
long difference = now - lastRefreshTime;
|
||||
boolean isTimeout = difference >= timeout;
|
||||
CupidLogUtils.e(TAG, buildTimeoutStr(isTimeout, isHaveIpcHeartbeat(), lastDataTimestamp, difference) + " 设备开机到现在的时间:" + now + "ms 最后一条数据刷新时间:" + lastRefreshTime + "ms");
|
||||
CupidLogUtils.e(TAG, buildTimeoutStr(null,isTimeout, isHaveIpcHeartbeat(), lastDataTimestamp, difference) + " 设备开机到现在的时间:" + now + "ms 最后一条数据刷新时间:" + lastRefreshTime + "ms");
|
||||
if (isTimeout) {
|
||||
if (listener != null) {
|
||||
listener.onTimeout(isHaveIpcHeartbeat(), lastDataTimestamp, difference);
|
||||
@@ -147,17 +149,35 @@ public class ReceiveTimeoutManager {
|
||||
}
|
||||
|
||||
public static String buildTimeoutStr(
|
||||
Context context,
|
||||
boolean isTimeout,
|
||||
boolean isHaveIpcHeartbeat,
|
||||
long lastDataTimestamp,
|
||||
long time
|
||||
) {
|
||||
String type = isTimeout
|
||||
? "超时时间:"
|
||||
: "最后刷新时间时间差:";
|
||||
String type1 = isHaveIpcHeartbeat
|
||||
? "最后一条Telematics心跳接收时间"
|
||||
: "最后一条Telematics数据发送时间";
|
||||
String type = null;
|
||||
String type1 = null;
|
||||
if (context != null) {
|
||||
try {
|
||||
type = isTimeout
|
||||
? context.getString(com.zhjt.mogo.adas.data.R.string.adas_time_out_period)
|
||||
: context.getString(com.zhjt.mogo.adas.data.R.string.adas_last_refresh_time_difference);
|
||||
type1 = isHaveIpcHeartbeat
|
||||
? context.getString(com.zhjt.mogo.adas.data.R.string.adas_last_receive_heartbeat_time)
|
||||
: context.getString(com.zhjt.mogo.adas.data.R.string.adas_last_receive_data_time);
|
||||
} catch (Exception e) {
|
||||
type = null;
|
||||
type1 = null;
|
||||
}
|
||||
}
|
||||
if (TextUtils.isEmpty(type) || TextUtils.isEmpty(type1)) {
|
||||
type = isTimeout
|
||||
? "超时时间:"
|
||||
: "最后刷新时间时间差:";
|
||||
type1 = isHaveIpcHeartbeat
|
||||
? "最后一条Telematics心跳接收时间"
|
||||
: "最后一条Telematics数据发送时间";
|
||||
}
|
||||
return String.format(Locale.getDefault(),
|
||||
"%s%dms %s:%d",
|
||||
type,
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">adas-high</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user