Parcourir la source

在更新升级过程中,无法使用串口

vothin il y a 1 an
Parent
commit
4495b56e88

+ 28 - 33
jni/logic/startLogic.cc

@@ -354,12 +354,8 @@ void handleMsg(byte* inBytes){
 	else if (tcpModel.type == TcpType::SOS) {
 		if (tcpModel.action == SosAction::CANCEL) {
 			// SOS还原成无灯光的状态
-//			std::string heartStr = "ULED,0F";
-//			const char* sendMsg = heartStr.c_str();
-//			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
 			lightControl("ULED", "0F");
 			// 进行门灯还原
-//			doorLampRestoration();
 			lightControl("DOORLED", "000F");
 			mActivityPtr->unregisterUserTimer(SOS_LAMP_TIME_HANDLE);
 		}
@@ -385,16 +381,6 @@ void handleMsg(byte* inBytes){
 				EASYUICONTEXT->goBack();
 			}
 
-//			std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
-//			std::string heartStr;
-//			if (color != "" && color.size() == 3) {
-//				heartStr = "DOORLED," + color + "F";
-//			} else {
-//				heartStr = "DOORLED,010F";
-//			}
-//			const char* sendMsg = heartStr.c_str();
-//			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
-
 			std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
 			if (color != "" && color.size() == 3) {
 				color = color + "F";
@@ -405,16 +391,10 @@ void handleMsg(byte* inBytes){
 		}
 		else if (tcpModel.action == SideAction::NURSING_END) {
 			// 收到nursing_end
-//			std::string heartStr = "DOORLED,000F";
-//			const char* sendMsg = heartStr.c_str();
-//			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
 			lightControl("DOORLED", "000F");
 		}
 		else if (tcpModel.action == SideAction::CALL) {
 			// 收到CALL,需要亮红灯
-//			std::string heartStr = "DOORLED,200F";	// 红灯闪烁
-//			const char* sendMsg = heartStr.c_str();
-//			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
 
 			lightControl("DOORLED", "200F");
 
@@ -439,7 +419,6 @@ void handleMsg(byte* inBytes){
 				}
 			}
 			// 进行门灯还原
-//			doorLampRestoration();
 			lightControl("DOORLED", "000F");
 		}
 		else if (tcpModel.action == SideAction::CANCEL) {
@@ -461,18 +440,12 @@ void handleMsg(byte* inBytes){
 				}
 			}
 			// 进行门灯还原
-//			doorLampRestoration();
 			lightControl("DOORLED", "000F");
 
 		}
 		else if (tcpModel.action == SideAction::SOS_CALL) {
 			// 收到SOS_CALL,需要亮红灯
-			// SOS亮红灯
-//			string heartStr = "ULED,1F";
 			// 门灯亮红灯
-//			std::string heartStr2 = "DOORLED,200F";
-//			const char* sendMsg2 = heartStr2.c_str();
-//			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg2), strlen(sendMsg2));
 			lightControl("DOORLED", "200F");
 
 			sosTimerRegistered = false;
@@ -499,9 +472,31 @@ void handleMsg(byte* inBytes){
 				}
 			}
 			// 进行门灯还原
-//			doorLampRestoration();
 			lightControl("DOORLED", "000F");
 		}
+		else if (tcpModel.action == SideAction::SHOW) {
+			int deviceId = tcpModel.json["fromDeviceId"].asInt();
+			string fromFrameFullName = tcpModel.json["fromFrameFullName"].asString();
+			string actionType = tcpModel.json["actionType"].asString();
+			if (actionType == TcpType::VOICE) {
+				setPainterInfo(deviceId, 0xFF2F9DF1, fromFrameFullName + " " + LANGUAGEMANAGER->getValue("CallInfo"), "VOICE", "ADD", 60);
+			}
+			else if (actionType == TcpType::SOS) {
+				setPainterInfo(deviceId, 0xFFFF0000, fromFrameFullName + " " + LANGUAGEMANAGER->getValue("SOSCallInfo"), "SOS", "ADD", 120);
+			}
+
+		}
+		else if (tcpModel.action == SideAction::CLEAR) {
+			int deviceId = tcpModel.json["fromDeviceId"].asInt();
+			string fromFrameFullName = tcpModel.json["fromFrameFullName"].asString();
+			string actionType = tcpModel.json["actionType"].asString();
+			if (actionType == TcpType::VOICE) {
+				setPainterInfo(deviceId, 0xFFFFFFFF, "", "VOICE", "DELETE", 0);
+			}
+			else if (actionType == TcpType::SOS) {
+				setPainterInfo(deviceId, 0xFFFFFFFF, "", "SOS", "DELETE", 0);
+			}
+		}
 	}
 	else if (tcpModel.type == TcpType::CALLBACK) {
 		if (tcpModel.action == CallbackAction::ACK) {
@@ -795,6 +790,11 @@ static void onUI_quit() {
  */
 static void onProtocolDataUpdate(const SProtocolData &data) {
 	LOGD("cmd = %s", data.cmd.c_str());
+	if (getIsUpdate()) {
+		LOGD("处于升级过程中,串口不可使用");
+		return;
+	}
+
 	if (data.state!=""){
 		LOGD("state = %s",data.state.c_str());
 	}
@@ -889,12 +889,8 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 					TcpClient::instance()->sendMsg(req.c_str());
 
 					// SOS亮红灯
-//					heartStr = "ULED,1F";
 					lightControl("ULED", "1F");
 					// 门灯亮红灯
-//					std::string heartStr2 = "DOORLED,200F";
-//					const char* sendMsg2 = heartStr2.c_str();
-//					sendProtocolTo(UART_TTYS2, (byte*)(sendMsg2), strlen(sendMsg2));
 					lightControl("DOORLED", "200F");
 
 					mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000);		// 10秒后才能触发
@@ -909,7 +905,6 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 				if (isSleep) {
 					scrrenOn();
 				}
-//				heartStr = "DOORLED,000F";
 			}
 			else if (data.cmd == "KEY>") {	// key>是面板挂断按钮
 				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {

+ 9 - 0
jni/logic/updateLogic.cc

@@ -116,6 +116,10 @@ void NavibarDialog1ClickOk() {
 }
 
 struct sysinfo info2;
+static bool isUpdate = false;
+bool getIsUpdate() {
+	return isUpdate;
+}
 
 void updateDevice(){
 
@@ -134,6 +138,8 @@ void updateDevice(){
     LOGD("关闭页面后,存在延迟,totalram == %ld", info2.totalram);
     LOGD("关闭页面后,存在延迟,freeram == %ld", info2.freeram);
 
+    isUpdate = true;
+
 	PopupService::Show([](PopupService* srv){
 
 		base::HttpClient client;
@@ -163,6 +169,7 @@ void updateDevice(){
 		if (response.StatusCode() != 200) {	// 下载失败
 			string msg = LANGUAGEMANAGER->getValue("DownloadFailed") + "%d";
 		  srv->SetMessage(base::format(msg.c_str(), response.ErrorCode()));
+		  isUpdate = false;
 		  return -1;
 		}
 
@@ -217,6 +224,8 @@ static void onUI_intent(const Intent *intentPtr) {
     LOGD("跳转到升级页面,totalram == %ld", info2.totalram);
     LOGD("跳转到升级页面,freeram == %ld", info2.freeram);
 
+    isUpdate = false;
+
     if (intentPtr != NULL) {
     	std::string _appUpdate = intentPtr->getExtra(appUpdate);
     	if (_appUpdate == "true") {

+ 5 - 1
jni/net/tcp_client.cpp

@@ -151,7 +151,11 @@ void TcpClient::startTcp(){
 }
 
 void TcpClient::closeTcp() {
-	my_thread.requestExitAndWait();
+	bool result = my_thread.isRunning();
+	if (result) {
+		my_thread.requestExitAndWait();
+		LOGD("my_thread已关闭");
+	}
 //		my_thread.requestExit();
 }
 

+ 2 - 0
jni/net/tcp_model.h

@@ -94,6 +94,8 @@ public:
 	inline static std::string SOS_CANCEL = "SOS_CANCEL";	// sos取消
 	inline static std::string NURSING = "NURSING";	// 护理
 	inline static std::string NURSING_END = "NURSING_END";	// 护理结束
+	inline static std::string SHOW = "SHOW";	// 显示
+	inline static std::string CLEAR = "CLEAR";	// 清除
 };
 
 class CallbackAction {

+ 4 - 2
jni/service/BusinessConfig.h

@@ -62,8 +62,8 @@
 
 #define STORE_MAC_ADDR "mac_addr"
 
-static std::string version = "v1.0.49";
-static int versionNo = 49;
+static std::string version = "v1.0.51";
+static int versionNo = 51;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -167,6 +167,8 @@ void setIsLight(bool _isLight);
 
 void pingThreadExitPending();
 
+bool getIsUpdate();
+
 
 enum CallFinishType {
 	CANCEL,

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/settingActivity.o


BIN
obj/activity/sipTestActivity.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/ui3Activity.o


BIN
obj/activity/updateActivity.o


BIN
obj/activity/warnActivity.o


BIN
obj/core/update_assistant.o


BIN
obj/net/tcp_client.o


BIN
obj/net/tcp_model.o


BIN
obj/server/http_server.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o