Browse Source

优化获取网络刷新的逻辑

vothin 2 năm trước cách đây
mục cha
commit
3a63608402
2 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 4 0
      jni/logic/mainLogic.cc
  2. 7 2
      jni/logic/startLogic.cc

+ 4 - 0
jni/logic/mainLogic.cc

@@ -851,6 +851,10 @@ bool removePainterInfo(int deviceId, const std::string type) {
 void dataRefresh() {
 	LOGD("DATA-REFRESH, 数据刷新");
 
+	if (mActivityPtr == NULL) {
+		return;
+	}
+
 	if (serverInfo) {
 		udp_thread.getServerInfo();
 	}

+ 7 - 2
jni/logic/startLogic.cc

@@ -20,6 +20,7 @@
 static bool sosTimerRegistered = true;
 static bool isSleepTimerRegistered = false;		// 是否开启息屏定时任务
 static bool isSleep = false;	// 是否在息屏
+static string callTid = "";
 #define HELP_TIMER_HANDLE 3	// 增援的定时器id
 #define SOS_CLICK_TIME_HANDLE 4	// sos的定时器id
 #define SOS_LAMP_TIME_HANDLE 5	// sos的门灯定时器id
@@ -190,7 +191,7 @@ void handleMsg(byte* inBytes){
 			LOGD("transfered time : %s", pDate);
 			TimeHelper::setDateTime(pDate);
 
-//			dataRefresh();
+			dataRefresh();
 		}
 	} else if (tcpModel.type == TcpType::REINFORCE){
 		if (tcpModel.action == ReinforceAction::RESPONSED){
@@ -422,7 +423,10 @@ void handleMsg(byte* inBytes){
 			if (callback.tid != "0"){
 				callback.onFalied(tcpModel.json);
 			}
-			callActivityFinish(CallFinishType::FAILED);
+
+			if (tcpModel.tid == callTid){
+				callActivityFinish(CallFinishType::FAILED);
+			}
 		}
 
 	}
@@ -467,6 +471,7 @@ void scrrenOn() {
 	BRIGHTNESSHELPER->screenOn();
 }
 
+
 //================================= IO 口操作
 //紧急按钮灯,明/灭
 void setSOS_A5(bool light){