Pārlūkot izejas kodu

修改离线逻辑,增加sos cancel

vothin 5 mēneši atpakaļ
vecāks
revīzija
f8a35b6b24

+ 449 - 361
jni/logic/mainLogic.cc

@@ -91,7 +91,6 @@ static int handle6Id = 0;
 #define EVENT_TIME_HANDLE 8		// 事件定时器
 #define SLEEP_STRAT_TIME_HANDLE 9	// 息屏
 
-
 void setMainTheme() {
     LOGD("mainThemeInt =====> %d", mainThemeInt);
     if (mainThemeInt == 1) {
@@ -150,414 +149,506 @@ bool isHandleId(int id) {
 	return false;
 }
 
-static void getServerInfo(){
-
-	string url = getHttpGateway() + "/ncs_url/server_info";
-	LOGD("请求服务器信息. url = %s", url.c_str());
-	//发起HTTP GET请求
-	RestClient::Response r = RestClient::get(url);
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-	if (reader.parse(r.body, root, false)){
-		// http
-		StoragePreferences::putString(STORE_GATEWAY, root["http_local_ip"].asString());
-		StoragePreferences::putInt(STORE_HTTP_PORT, root["http_port"].asInt());
-
-		// tcp
-		StoragePreferences::putString(STORE_TCP_LOCAL_IP, root["tcp_local_ip"].asString());
-		StoragePreferences::putInt(STORE_TCP_PORT, root["tcp_port"].asInt());
-
-		// sip
-		StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());
-		StoragePreferences::putInt(SIP_REG_PORT, root["sip_port"].asInt());
-
-		serverInfo = false;	// 只有请求成功了,才不需要重复请求
+static net::Conn* udpConn;
+class UdpThread: public Thread {
+public:
+	static void getServerInfo(){
+		string url = getHttpGateway() + "/ncs_url/server_info";
+		LOGD("请求服务器信息. url = %s", url.c_str());
+		//发起HTTP GET请求
+		RestClient::Response r = RestClient::get(url);
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+		if (reader.parse(r.body, root, false)){
+			// http
+			StoragePreferences::putString(STORE_GATEWAY, root["http_local_ip"].asString());
+			StoragePreferences::putInt(STORE_HTTP_PORT, root["http_port"].asInt());
+
+			// tcp
+			StoragePreferences::putString(STORE_TCP_LOCAL_IP, root["tcp_local_ip"].asString());
+			StoragePreferences::putInt(STORE_TCP_PORT, root["tcp_port"].asInt());
+
+			// sip
+			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());
+			StoragePreferences::putInt(SIP_REG_PORT, root["sip_port"].asInt());
+
+			serverInfo = false;	// 只有请求成功了,才不需要重复请求
+		}
 	}
-}
 
-// 读取空间缓存的数据
-static void getFrameInfo() {
-	mRoomNameTextViewPtr->setText(frameInfo["full_name"].asString());
-}
+	static void getDeviceInfo(){
+		if (dataInit){
+			getFrameInfo();
+			getBedCount();
+			setDirectorAndHeadNurse();
+			return;
+		}
 
-std::string getFrameFullName() {
-	if (frameInfo.isMember("full_name")) {
-		return frameInfo["full_name"].asString();
-	}
-	else {
-		return "";
-	}
-}
 
-static void getBedCount() {
-	if (mActivityPtr == NULL) {
-		return;
+	    if (!isConnectServer()) {
+	        return;
+	    }
+		string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, std::string(ETHERNETMANAGER->getMacAddr()));
+		LOGD("请求设备信息. url = %s", url.c_str());
+		//发起HTTP GET请求
+		RestClient::Response r = RestClient::get(url);
+		LOGD("获得设备信息. result = %s", r.body.c_str());
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+		if (reader.parse(r.body, root, false)){
+			string partName = root["part_display"].asString();
+			StoragePreferences::putString(STORE_PARTNAME,partName);
+			NavibarSetPartName(partName);
+			//设备
+			StoragePreferences::putInt(STORE_DEVICE_ID, root["id"].asInt());
+			StoragePreferences::putInt(STORE_DEVICE_TYPE, root["device_type"].asInt());
+
+			//SIP存储
+	//			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());	// 应该去找配置文件里的sip-ip
+			StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
+			StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
+
+			frameInfo["frame_id"] = root["frame_id"].asInt();
+			frameInfo["full_name"] = root["full_name"].asString();
+			frameInfo["part_id"] = root["part_id"].asInt();
+			getFrameInfo();
+
+			//获取科室设置
+			string partId = root["part_id"].asString();
+			StoragePreferences::putString(STORE_PARTID, partId);
+			getPartSetting(partId);
+			getVersion();
+			getNfcInteraction();
+		}
 	}
-	mInBedNumTextViewPtr->setText(inBedCount);
-	mEmptyBedNumTextViewPtr->setText(emptyBedCount);
-}
 
-static void getFrameRoom(int frame_id) {
-	string url = getHttpGateway() + "/deviceRoom/get_frame_room/" + to_string(frame_id);
-	LOGD("请求房间信息. url = %s", url.c_str());
-	//发起HTTP GET请求
-	RestClient::Response r = RestClient::get(url);
-	LOGD("获得房间信息. result = %s", r.body.c_str());
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-	if (reader.parse(r.body, root, false)){
-		frameRoom = root;
-		frameBedList = root["frame_bed_list"];
-
-		inBedCount = 0;
-		emptyBedCount = 0;
-		if (frameBedList.size() > 0) {
-			for (int i = 0; i < frameBedList.size(); i++) {
-				string customerId = frameBedList[i]["customer_id"].asString();
-				if (customerId != "") {
-					inBedCount += 1;
-				}
+	// 读取空间缓存的数据
+	static void getFrameInfo() {
+		mRoomNameTextViewPtr->setText(frameInfo["full_name"].asString());
+	}
 
-				string bedDeviceMac = frameBedList[i]["bed_device_mac"].asString();
-				StringHelper::toLowerCase(bedDeviceMac);
-				if (bedDeviceMac == handle1Mac) {
-					handle1Id = frameBedList[i]["bed_device_id"].asInt();
-				}
-				else if (bedDeviceMac == handle2Mac) {
-					handle2Id = frameBedList[i]["bed_device_id"].asInt();
-				}
-				else if (bedDeviceMac == handle3Mac) {
-					handle3Id = frameBedList[i]["bed_device_id"].asInt();
-				}
-				else if (bedDeviceMac == handle4Mac) {
-					handle4Id = frameBedList[i]["bed_device_id"].asInt();
-				}
-				else if (bedDeviceMac == handle5Mac) {
-					handle5Id = frameBedList[i]["bed_device_id"].asInt();
-				}
-				else if (bedDeviceMac == handle6Mac) {
-					handle6Id = frameBedList[i]["bed_device_id"].asInt();
+	static void getFrameRoom(int frame_id) {
+		string url = getHttpGateway() + "/deviceRoom/get_frame_room/" + to_string(frame_id);
+		LOGD("请求房间信息. url = %s", url.c_str());
+		//发起HTTP GET请求
+		RestClient::Response r = RestClient::get(url);
+		LOGD("获得房间信息. result = %s", r.body.c_str());
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+		if (reader.parse(r.body, root, false)){
+			frameRoom = root;
+			frameBedList = root["frame_bed_list"];
+
+			inBedCount = 0;
+			emptyBedCount = 0;
+			if (frameBedList.size() > 0) {
+				for (int i = 0; i < frameBedList.size(); i++) {
+					string customerId = frameBedList[i]["customer_id"].asString();
+					if (customerId != "") {
+						inBedCount += 1;
+					}
+
+					string bedDeviceMac = frameBedList[i]["bed_device_mac"].asString();
+					StringHelper::toLowerCase(bedDeviceMac);
+					if (bedDeviceMac == handle1Mac) {
+						handle1Id = frameBedList[i]["bed_device_id"].asInt();
+					}
+					else if (bedDeviceMac == handle2Mac) {
+						handle2Id = frameBedList[i]["bed_device_id"].asInt();
+					}
+					else if (bedDeviceMac == handle3Mac) {
+						handle3Id = frameBedList[i]["bed_device_id"].asInt();
+					}
+					else if (bedDeviceMac == handle4Mac) {
+						handle4Id = frameBedList[i]["bed_device_id"].asInt();
+					}
+					else if (bedDeviceMac == handle5Mac) {
+						handle5Id = frameBedList[i]["bed_device_id"].asInt();
+					}
+					else if (bedDeviceMac == handle6Mac) {
+						handle6Id = frameBedList[i]["bed_device_id"].asInt();
+					}
 				}
+				emptyBedCount = frameBedList.size() - inBedCount;
+				getBedCount();
 			}
-			emptyBedCount = frameBedList.size() - inBedCount;
-			getBedCount();
-		}
 
-		if (mBedListViewPtr != NULL) {
-			if (mainModeInt == 1) {
-				mBedListViewPtr->refreshListView();
-			}
-			else if (mainModeInt == 2) {
-				if (frameBedList.size() <= 3) {
+			if (mBedListViewPtr != NULL) {
+				if (mainModeInt == 1) {
 					mBedListViewPtr->refreshListView();
-					mBedListViewPtr->setVisible(true);
-					mBedListView2Ptr->setVisible(false);
-					mBedListView3Ptr->setVisible(false);
 				}
-				else if (frameBedList.size() > 3 && frameBedList.size() <= 6) {
-					mBedListView2Ptr->refreshListView();
-					mBedListViewPtr->setVisible(false);
-					mBedListView2Ptr->setVisible(true);
-					mBedListView3Ptr->setVisible(false);
-
+				else if (mainModeInt == 2) {
+					if (frameBedList.size() <= 3) {
+						mBedListViewPtr->refreshListView();
+						mBedListViewPtr->setVisible(true);
+						mBedListView2Ptr->setVisible(false);
+						mBedListView3Ptr->setVisible(false);
+					}
+					else if (frameBedList.size() > 3 && frameBedList.size() <= 6) {
+						mBedListView2Ptr->refreshListView();
+						mBedListViewPtr->setVisible(false);
+						mBedListView2Ptr->setVisible(true);
+						mBedListView3Ptr->setVisible(false);
+
+					}
+					else {
+						mBedListView3Ptr->refreshListView();
+						mBedListViewPtr->setVisible(false);
+						mBedListView2Ptr->setVisible(false);
+						mBedListView3Ptr->setVisible(true);
+					}
 				}
-				else {
-					mBedListView3Ptr->refreshListView();
+				else if (mainModeInt == 3) {
+					mBedListView4Ptr->refreshListView();
 					mBedListViewPtr->setVisible(false);
-					mBedListView2Ptr->setVisible(false);
-					mBedListView3Ptr->setVisible(true);
+					mBedListView4Ptr->setVisible(true);
 				}
 			}
-			else if (mainModeInt == 3) {
-				mBedListView4Ptr->refreshListView();
-				mBedListViewPtr->setVisible(false);
-				mBedListView4Ptr->setVisible(true);
-			}
 		}
 	}
-}
 
+	static void getBedCount() {
+		if (mActivityPtr == NULL) {
+			return;
+		}
+		mInBedNumTextViewPtr->setText(inBedCount);
+		mEmptyBedNumTextViewPtr->setText(emptyBedCount);
+	}
 
-// 将医生和护士别称缓存起来
-static void setRightTitle(Json::Value partSetting) {
-	rightTitleInfo["doctor_title"] = partSetting["doctor_title"].asString();
-	rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
-	rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
-	rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
-}
 
-static void setDirectorAndHeadNurse() {
-	mDirectorTextViewPtr->setText(partSetting.partDirector);
-	mNurseHeadTextViewPtr->setText(partSetting.partNurseHead);
-}
+	// 将医生和护士别称缓存起来
+	static void setRightTitle(Json::Value partSetting) {
+		rightTitleInfo["doctor_title"] = partSetting["doctor_title"].asString();
+		rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
+		rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
+		rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
+	}
 
+	static void setDirectorAndHeadNurse() {
+		mDirectorTextViewPtr->setText(partSetting.partDirector);
+		mNurseHeadTextViewPtr->setText(partSetting.partNurseHead);
+	}
 
-static void getPartSetting(string partId){
-	string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
-	LOGD("请求科室信息. url = %s", url.c_str());
-	//发起HTTP GET请求
-	RestClient::Response r = RestClient::get(url);
-	LOGD("获得科室信息. result = %s", r.body.c_str());
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-	if (reader.parse(r.body, root, false)){
-		partSetting.partId = root["part_id"].asInt();
-		partSetting.dayStart = root["day_start"].asString();
-		partSetting.dayLight = root["day_light"].asInt();
-		partSetting.dayVol = root["day_vol"].asInt();
-		partSetting.dayRingVol = root["day_ring_vol"].asInt();
-		partSetting.dayRingTimes = root["day_ring_times"].asInt();
-		partSetting.dayNurseLed = root["day_nurse_led"].asInt();
-		partSetting.dayDoorVol = root["day_door_vol"].asInt();
-		partSetting.dayBedVol = root["day_bed_vol"].asInt();
-		partSetting.dayTransferBoxVol = root["day_transfer_box_vol"].asInt();
-		partSetting.dayTransferBoxSystemVol = root["day_transfer_box_system_vol"].asInt();
-		partSetting.nightStart = root["night_start"].asString();
-		partSetting.nightLight = root["night_light"].asInt();
-		partSetting.nightVol = root["night_vol"].asInt();
-		partSetting.nightRingVol = root["night_ring_vol"].asInt();
-		partSetting.nightRingTimes = root["night_ring_times"].asInt();
-		partSetting.nightNurseLed = root["night_nurse_led"].asInt();
-		partSetting.nightDoorVol = root["night_door_vol"].asInt();
-		partSetting.nightBedVol = root["night_bed_vol"].asInt();
-		partSetting.nightTransferBoxVol = root["night_transfer_box_vol"].asInt();
-		partSetting.nightTransferBoxSystemVol = root["night_transfer_box_system_vol"].asInt();
-		partSetting.sleepSecondsNurse = root["sleep_seconds_nurse"].asInt();
-		partSetting.sleepSecondsDoor = root["sleep_seconds_door"].asInt();
-		partSetting.sleepSecondsBed = root["sleep_seconds_bed"].asInt();
-		partSetting.sipOvertime = root["sip_overtime"].asInt();
-		partSetting.transferDuration = root["transfer_duration"].asInt();
-		partSetting.transferDurationLeader = root["transfer_duration_leader"].asInt();
-		partSetting.communicationModeBed = root["communication_mode_bed"].asInt();
-		partSetting.communicationModeNurse = root["communication_mode_nurse"].asInt();
-		partSetting.communicationModeMobile = root["communication_model_mobile"].asInt();
-		partSetting.customizeRoleCallFirst = root["customize_role_call_first"].asInt();
-		partSetting.customizeRoleCallSecond = root["customize_role_call_second"].asInt();
-		partSetting.customizeRoleCallThird = root["customize_role_call_third"].asInt();
-		partSetting.customizeRoleCallFourth = root["customize_role_call_fourth"].asInt();
-		partSetting.customizeRoleCallFifth = root["customize_role_call_fifth"].asInt();
-		partSetting.customizeHospitalCallFirst = root["customize_hospital_call_first"].asInt();
-		partSetting.customizeHospitalCallFirstName = root["customize_hospital_call_first_name"].asString();
-		partSetting.customizeHospitalCallSecond = root["customize_hospital_call_second"].asInt();
-		partSetting.customizeHospitalCallSecondName = root["customize_hospital_second_name"].asString();
-		partSetting.customizeHospitalCallThird = root["customize_hospital_call_third"].asInt();
-		partSetting.customizeHospitalCallThirdName = root["customize_hospital_call_third_name"].asString();
-		partSetting.doctorTitle = root["doctor_title"].asString();
-		partSetting.doctorValid = root["doctor_valid"].asInt();
-		partSetting.nurseTitle = root["nurse_title"].asString();
-		partSetting.nurseValid = root["nurse_valid"].asInt();
-		partSetting.doorNurseTitle = root["door_nurse_title"].asString();
-		partSetting.doorNurseValid = root["door_nurse_valid"].asInt();
-		partSetting.doorNursingTitle = root["door_nursing_title"].asString();
-		partSetting.doorNursingValid = root["door_nursing_valid"].asInt();
-		partSetting.partDirector = root["part_director"].asString();
-		partSetting.partNurseHead = root["part_nurse_head"].asString();
-		partSetting.upSeconds = root["up_seconds"].asInt();
-		partSetting.autoAccept = root["auto_accept"].asInt();
-		partSetting.eventForward = root["event_forward"].asInt();
-		partSetting.nursingColorRgb = root["nursing_color_rgb"].asString();
-		partSetting.twoColorDoorLightValid = root["two_color_door_light_valid"].asInt();
-		partSetting.qrUrl = root["qr_url"].asString();
-		partSetting.screenLight = root["screen_light"].asInt();
-		partSetting.roomCallBed = root["room_call_bed"].asInt();
-		partSetting.autoPosition = root["auto_position"].asInt();
-		partSetting.customerAgeHiddenOnDoor = root["customer_age_hidden_on_door"].asInt();
-
-		if (root.isMember("linux_bed_volume_native")) {
-			partSetting.linuxDoorVolumeNative = root["linux_door_volume_native"].asInt();
-			partSetting.linuxDoorGainSize = root["linux_door_gain_size"].asInt();
-
-			zk_audio_input_set_volume_native(0, 0);
-			zk_audio_input_set_volume_native(1, partSetting.linuxDoorVolumeNative);
-			GetTelephone()->SetInputPcmGainSize(partSetting.linuxDoorGainSize);
-
-			StoragePreferences::putInt(STORE_VOLUME_NATIVE, partSetting.linuxDoorVolumeNative);
-			StoragePreferences::putInt(STORE_GAIN_SIZE, partSetting.linuxDoorGainSize);
-		}
 
-		if (root.isMember("device_button_function")) {
-			clearDeviceButtonFunction();
-			string deviceButtonFunctionStr = root["device_button_function"].asString();
-			if (deviceButtonFunctionStr != "") {
-				deviceButtonFunctionStr = std::regex_replace(deviceButtonFunctionStr, std::regex("&gt;"), ">");
-				deviceButtonFunctionStr = std::regex_replace(deviceButtonFunctionStr, std::regex("&lt;"), "<");
-				partSetting.deviceButtonFunction = deviceButtonFunctionStr;
-				setDeviceButtonFunction(deviceButtonFunctionStr);
+	static void getPartSetting(string partId){
+		string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
+		LOGD("请求科室信息. url = %s", url.c_str());
+		//发起HTTP GET请求
+		RestClient::Response r = RestClient::get(url);
+		LOGD("获得科室信息. result = %s", r.body.c_str());
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+		if (reader.parse(r.body, root, false)){
+			partSetting.partId = root["part_id"].asInt();
+			partSetting.dayStart = root["day_start"].asString();
+			partSetting.dayLight = root["day_light"].asInt();
+			partSetting.dayVol = root["day_vol"].asInt();
+			partSetting.dayRingVol = root["day_ring_vol"].asInt();
+			partSetting.dayRingTimes = root["day_ring_times"].asInt();
+			partSetting.dayNurseLed = root["day_nurse_led"].asInt();
+			partSetting.dayDoorVol = root["day_door_vol"].asInt();
+			partSetting.dayBedVol = root["day_bed_vol"].asInt();
+			partSetting.dayTransferBoxVol = root["day_transfer_box_vol"].asInt();
+			partSetting.dayTransferBoxSystemVol = root["day_transfer_box_system_vol"].asInt();
+			partSetting.nightStart = root["night_start"].asString();
+			partSetting.nightLight = root["night_light"].asInt();
+			partSetting.nightVol = root["night_vol"].asInt();
+			partSetting.nightRingVol = root["night_ring_vol"].asInt();
+			partSetting.nightRingTimes = root["night_ring_times"].asInt();
+			partSetting.nightNurseLed = root["night_nurse_led"].asInt();
+			partSetting.nightDoorVol = root["night_door_vol"].asInt();
+			partSetting.nightBedVol = root["night_bed_vol"].asInt();
+			partSetting.nightTransferBoxVol = root["night_transfer_box_vol"].asInt();
+			partSetting.nightTransferBoxSystemVol = root["night_transfer_box_system_vol"].asInt();
+			partSetting.sleepSecondsNurse = root["sleep_seconds_nurse"].asInt();
+			partSetting.sleepSecondsDoor = root["sleep_seconds_door"].asInt();
+			partSetting.sleepSecondsBed = root["sleep_seconds_bed"].asInt();
+			partSetting.sipOvertime = root["sip_overtime"].asInt();
+			partSetting.transferDuration = root["transfer_duration"].asInt();
+			partSetting.transferDurationLeader = root["transfer_duration_leader"].asInt();
+			partSetting.communicationModeBed = root["communication_mode_bed"].asInt();
+			partSetting.communicationModeNurse = root["communication_mode_nurse"].asInt();
+			partSetting.communicationModeMobile = root["communication_model_mobile"].asInt();
+			partSetting.customizeRoleCallFirst = root["customize_role_call_first"].asInt();
+			partSetting.customizeRoleCallSecond = root["customize_role_call_second"].asInt();
+			partSetting.customizeRoleCallThird = root["customize_role_call_third"].asInt();
+			partSetting.customizeRoleCallFourth = root["customize_role_call_fourth"].asInt();
+			partSetting.customizeRoleCallFifth = root["customize_role_call_fifth"].asInt();
+			partSetting.customizeHospitalCallFirst = root["customize_hospital_call_first"].asInt();
+			partSetting.customizeHospitalCallFirstName = root["customize_hospital_call_first_name"].asString();
+			partSetting.customizeHospitalCallSecond = root["customize_hospital_call_second"].asInt();
+			partSetting.customizeHospitalCallSecondName = root["customize_hospital_second_name"].asString();
+			partSetting.customizeHospitalCallThird = root["customize_hospital_call_third"].asInt();
+			partSetting.customizeHospitalCallThirdName = root["customize_hospital_call_third_name"].asString();
+			partSetting.doctorTitle = root["doctor_title"].asString();
+			partSetting.doctorValid = root["doctor_valid"].asInt();
+			partSetting.nurseTitle = root["nurse_title"].asString();
+			partSetting.nurseValid = root["nurse_valid"].asInt();
+			partSetting.doorNurseTitle = root["door_nurse_title"].asString();
+			partSetting.doorNurseValid = root["door_nurse_valid"].asInt();
+			partSetting.doorNursingTitle = root["door_nursing_title"].asString();
+			partSetting.doorNursingValid = root["door_nursing_valid"].asInt();
+			partSetting.partDirector = root["part_director"].asString();
+			partSetting.partNurseHead = root["part_nurse_head"].asString();
+			partSetting.upSeconds = root["up_seconds"].asInt();
+			partSetting.autoAccept = root["auto_accept"].asInt();
+			partSetting.eventForward = root["event_forward"].asInt();
+			partSetting.nursingColorRgb = root["nursing_color_rgb"].asString();
+			partSetting.twoColorDoorLightValid = root["two_color_door_light_valid"].asInt();
+			partSetting.qrUrl = root["qr_url"].asString();
+			partSetting.screenLight = root["screen_light"].asInt();
+			partSetting.roomCallBed = root["room_call_bed"].asInt();
+			partSetting.autoPosition = root["auto_position"].asInt();
+			partSetting.customerAgeHiddenOnDoor = root["customer_age_hidden_on_door"].asInt();
+
+			if (root.isMember("linux_bed_volume_native")) {
+				partSetting.linuxDoorVolumeNative = root["linux_door_volume_native"].asInt();
+				partSetting.linuxDoorGainSize = root["linux_door_gain_size"].asInt();
+
+				zk_audio_input_set_volume_native(0, 0);
+				zk_audio_input_set_volume_native(1, partSetting.linuxDoorVolumeNative);
+				GetTelephone()->SetInputPcmGainSize(partSetting.linuxDoorGainSize);
+
+				StoragePreferences::putInt(STORE_VOLUME_NATIVE, partSetting.linuxDoorVolumeNative);
+				StoragePreferences::putInt(STORE_GAIN_SIZE, partSetting.linuxDoorGainSize);
+			}
+
+			if (root.isMember("device_button_function")) {
+				clearDeviceButtonFunction();
+				string deviceButtonFunctionStr = root["device_button_function"].asString();
+				if (deviceButtonFunctionStr != "") {
+					deviceButtonFunctionStr = std::regex_replace(deviceButtonFunctionStr, std::regex("&gt;"), ">");
+					deviceButtonFunctionStr = std::regex_replace(deviceButtonFunctionStr, std::regex("&lt;"), "<");
+					partSetting.deviceButtonFunction = deviceButtonFunctionStr;
+					setDeviceButtonFunction(deviceButtonFunctionStr);
+				}
 			}
-		}
 
-		StoragePreferences::putString(STORE_DAY_START, partSetting.dayStart);
-		StoragePreferences::putInt(STORE_DAY_LIGHT,partSetting.dayLight);
-		StoragePreferences::putInt(STORE_DAY_VOL,partSetting.dayDoorVol);
-		StoragePreferences::putInt(STORE_DAY_RING_TIMES,partSetting.dayRingTimes);
+			StoragePreferences::putString(STORE_DAY_START, partSetting.dayStart);
+			StoragePreferences::putInt(STORE_DAY_LIGHT,partSetting.dayLight);
+			StoragePreferences::putInt(STORE_DAY_VOL,partSetting.dayDoorVol);
+			StoragePreferences::putInt(STORE_DAY_RING_TIMES,partSetting.dayRingTimes);
 
-		StoragePreferences::putString(STORE_NIGHT_START, partSetting.nightStart);
-		StoragePreferences::putInt(STORE_NIGHT_LIGHT,partSetting.nightLight);
-		StoragePreferences::putInt(STORE_NIGHT_VOL,partSetting.nightDoorVol);
-		StoragePreferences::putInt(STORE_NIGHT_RING_TIMES,partSetting.nightRingTimes);
+			StoragePreferences::putString(STORE_NIGHT_START, partSetting.nightStart);
+			StoragePreferences::putInt(STORE_NIGHT_LIGHT,partSetting.nightLight);
+			StoragePreferences::putInt(STORE_NIGHT_VOL,partSetting.nightDoorVol);
+			StoragePreferences::putInt(STORE_NIGHT_RING_TIMES,partSetting.nightRingTimes);
 
-		StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
+			StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
 
-		StoragePreferences::putString(STORE_DOCTOR_TITLE, partSetting.doctorTitle);
-		StoragePreferences::putBool(STORE_DOCTOR_VISIBLE, partSetting.doctorValid==1);
-		StoragePreferences::putString(STORE_NURSE_TITLE, partSetting.nurseTitle);
-		StoragePreferences::putBool(STORE_NURSE_VISIBLE, partSetting.nurseValid==1);
+			StoragePreferences::putString(STORE_DOCTOR_TITLE, partSetting.doctorTitle);
+			StoragePreferences::putBool(STORE_DOCTOR_VISIBLE, partSetting.doctorValid==1);
+			StoragePreferences::putString(STORE_NURSE_TITLE, partSetting.nurseTitle);
+			StoragePreferences::putBool(STORE_NURSE_VISIBLE, partSetting.nurseValid==1);
 
-		StoragePreferences::putString(STORE_NURSING_COLOR_RGB, partSetting.nursingColorRgb);
-		StoragePreferences::putBool(STORE_AUDO_ANSWER, partSetting.autoAccept==1);
-		StoragePreferences::putInt(STORE_SCREEN_LIGHT, partSetting.screenLight);
-		StoragePreferences::putInt(STORE_ROOM_CALL_BED, partSetting.roomCallBed);
-		StoragePreferences::putInt(STORE_AUTO_POSITION, partSetting.autoPosition);
+			StoragePreferences::putString(STORE_NURSING_COLOR_RGB, partSetting.nursingColorRgb);
+			StoragePreferences::putBool(STORE_AUDO_ANSWER, partSetting.autoAccept==1);
+			StoragePreferences::putInt(STORE_SCREEN_LIGHT, partSetting.screenLight);
+			StoragePreferences::putInt(STORE_ROOM_CALL_BED, partSetting.roomCallBed);
+			StoragePreferences::putInt(STORE_AUTO_POSITION, partSetting.autoPosition);
 
-		setRightTitle(root);
-//		callBedButtonSetVisible();
-		setDirectorAndHeadNurse();
+			setRightTitle(root);
+	//		callBedButtonSetVisible();
+			setDirectorAndHeadNurse();
 
-		getFrameRoom(frameInfo["frame_id"].asInt());
+			getFrameRoom(frameInfo["frame_id"].asInt());
 
-		dataInit = true;
+			dataInit = true;
+		}
 	}
-}
 
-static void getVersion() {
-	std::string url = getHttpGateway() + "/deviceRoom/get_app_version?device_type=303&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
-	std::string content_type = std::string("application/json");
+	static void getVersion() {
+		std::string url = getHttpGateway() + "/deviceRoom/get_app_version?device_type=303&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
+		std::string content_type = std::string("application/json");
 
-	LOGD("请求版本信息. url = %s", url.c_str());
-	//发起HTTP POST请求
-	RestClient::Response r = RestClient::post(url, content_type, "");
-	if (r.code != 200) {
-		LOGD("请求版本信息-> 错误代码: %d", r.code);
-		return;
-	}
+		LOGD("请求版本信息. url = %s", url.c_str());
+		//发起HTTP POST请求
+		RestClient::Response r = RestClient::post(url, content_type, "");
+		if (r.code != 200) {
+			LOGD("请求版本信息-> 错误代码: %d", r.code);
+			return;
+		}
 
-	LOGD("获得版本信息. result = %s", r.body.c_str());
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-
-	if(reader.parse(r.body, root, false)) {
-		int currentVersionNo = getVersionNo();
-		int responseVersionNo = root["version_no"].asInt();
-		std::string responseVersion = root["version_code"].asString();
-		LOGD("服务器版本 : %s %d, 当前设备版本: %d", responseVersion.c_str(), responseVersionNo, currentVersionNo);
-
-		if (currentVersionNo < responseVersionNo) {
-			Intent* intent = new Intent();
-			intent->putExtra(appUpdate, "true");
-			EASYUICONTEXT->openActivity("updateActivity", intent);
+		LOGD("获得版本信息. result = %s", r.body.c_str());
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+
+		if(reader.parse(r.body, root, false)) {
+			int currentVersionNo = getVersionNo();
+			int responseVersionNo = root["version_no"].asInt();
+			std::string responseVersion = root["version_code"].asString();
+			LOGD("服务器版本 : %s %d, 当前设备版本: %d", responseVersion.c_str(), responseVersionNo, currentVersionNo);
+
+			if (currentVersionNo < responseVersionNo) {
+				Intent* intent = new Intent();
+				intent->putExtra(appUpdate, "true");
+				EASYUICONTEXT->openActivity("updateActivity", intent);
+			}
 		}
 	}
-}
 
-static void getNfcInteraction() {
-	std::string url = getHttpGateway() + "/deviceRoom/get_nfc_interaction_end_time_is_null/" + to_string(StoragePreferences::getInt(STORE_DEVICE_ID,0));
+	static void getNfcInteraction() {
+		std::string url = getHttpGateway() + "/deviceRoom/get_nfc_interaction_end_time_is_null/" + to_string(StoragePreferences::getInt(STORE_DEVICE_ID,0));
 
-	LOGD("请求未完成的nfc记录. url = %s", url.c_str());
-	//发起HTTP POST请求
-	RestClient::Response r = RestClient::get(url);
-	if (r.code != 200) {
-		LOGD("请求未完成的nfc记录-> 错误代码: %d", r.code);
-		return;
-	}
+		LOGD("请求未完成的nfc记录. url = %s", url.c_str());
+		//发起HTTP POST请求
+		RestClient::Response r = RestClient::get(url);
+		if (r.code != 200) {
+			LOGD("请求未完成的nfc记录-> 错误代码: %d", r.code);
+			return;
+		}
 
-	LOGD("获得未完成的nfc记录. result = %s", r.body.c_str());
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-
-	if(reader.parse(r.body, root, false)) {
-		int clerkId = 0;
-		for (int i = 0; i < root.size(); i++) {
-			if (root[i]["components_type"].asCString() == TcpType::AUTH) {
-				clerkId = root[i]["clerk_id"].asInt();
-				setClerk(root[i]["clerk_name"].asCString(), root[i]["pass_no"].asCString(), root[i]["id"].asInt());
-			}
-			else if (root[i]["components_type"].asString() == "POSITION_COMPONENT") {
-				setPosistionItId(root[i]["id"].asInt());
-				setPositionButton(true);
+		LOGD("获得未完成的nfc记录. result = %s", r.body.c_str());
+		//解析json
+		Json::Reader reader;
+		Json::Value root;
+
+		if(reader.parse(r.body, root, false)) {
+			int clerkId = 0;
+			for (int i = 0; i < root.size(); i++) {
+				if (root[i]["components_type"].asCString() == TcpType::AUTH) {
+					clerkId = root[i]["clerk_id"].asInt();
+					setClerk(root[i]["clerk_name"].asCString(), root[i]["pass_no"].asCString(), root[i]["id"].asInt());
+				}
+				else if (root[i]["components_type"].asString() == "POSITION_COMPONENT") {
+					setPosistionItId(root[i]["id"].asInt());
+					setPositionButton(true);
+				}
+				else if (root[i]["components_type"].asString() == "ROOMCHECK_COMPONENT") {
+					setRoomCheckItId(root[i]["id"].asInt());
+					setRoomPatrolButton(true);
+				}
+				else if (root[i]["components_type"].asString() == "SCREEN_TIP_SET_COMPONENT") {
+					time_t now = TimeHelper::getDateline();
+					if (now <= 0) {
+						continue;
+					}
+
+					Json::Reader Reader;
+					Json::Value operationData;
+					Reader.parse(root[i]["operation_data"].asString(), operationData);
+					int seconds = operationData["seconds"].asInt();
+
+					if (now - root[i]["start_time"].asInt() < seconds) {
+						setPromptTimeItId(root[i]["id"].asInt());
+
+						Intent* intent = new Intent();
+						intent->putExtra(promptText2, operationData["tips"].asString());
+						intent->putExtra(promptTime2, to_string(seconds - (now - root[i]["start_time"].asInt())));
+						EASYUICONTEXT->openActivity("promptActivity", intent);
+					}
+					else {
+						sendPromptQuit(root[i]["id"].asInt());
+					}
+				}
 			}
-			else if (root[i]["components_type"].asString() == "ROOMCHECK_COMPONENT") {
-				setRoomCheckItId(root[i]["id"].asInt());
-				setRoomPatrolButton(true);
+			if (clerkId != 0) {
+				goCare();
 			}
-			else if (root[i]["components_type"].asString() == "SCREEN_TIP_SET_COMPONENT") {
-				time_t now = TimeHelper::getDateline();
-				if (now <= 0) {
-					continue;
-				}
+		}
+	}
 
-				Json::Reader Reader;
-				Json::Value operationData;
-				Reader.parse(root[i]["operation_data"].asString(), operationData);
-				int seconds = operationData["seconds"].asInt();
 
-				if (now - root[i]["start_time"].asInt() < seconds) {
-					setPromptTimeItId(root[i]["id"].asInt());
+	/**
+	 * 线程创建成功后会调用该函数,可以在该函数中做一些初始化操作
+	 * return true   继续线程
+	 *        false  退出线程
+	 */
+	virtual bool readyToRun() {
+		LOGD("Thread 已经创建完成");
+		return true;
+	}
 
-					Intent* intent = new Intent();
-					intent->putExtra(promptText2, operationData["tips"].asString());
-					intent->putExtra(promptTime2, to_string(seconds - (now - root[i]["start_time"].asInt())));
-					EASYUICONTEXT->openActivity("promptActivity", intent);
-				}
-				else {
-					sendPromptQuit(root[i]["id"].asInt());
+	/**
+	 * 线程循环函数
+	 *
+	 * return true  继续线程循环
+	 *        false 推出线程
+	 */
+	virtual bool threadLoop() {
+		LOGD("线程循环函数");
+
+		//检查是否有退出线程的请求,如果有,则返回false,立即退出线程
+		if (exitPending()) {
+			return false;
+		}
+
+		udpConn = net::Dial("udp", "192.168.1.255:10010");
+		if (udpConn) {
+			byte buf[1024] = {0};
+			const char* req = "search_server";
+			//发送
+			udpConn->Write((byte*)req, strlen(req));
+			while (true && !exitPending()) {
+				//读取,超时10*1000毫秒
+				int n = udpConn->Read(buf, sizeof(buf) - 1, 10*1000);
+				if (n > 0) {
+					buf[n] = 0;
+					char serverStr[1024];
+					sprintf(serverStr,"%s",buf);
+					LOGD("读取 %d字节: %s", n, serverStr);
+
+					//解析json
+					Json::Reader reader;
+					Json::Value root;
+					if (reader.parse(serverStr, root, false)){
+						if (root.isMember("success") && root["success"].asBool()){
+							serverIP = root["data"]["third_server"].asString();
+							serverHttpPort = root["data"]["third_server_port"].asInt();
+
+							StoragePreferences::putString(STORE_GATEWAY, serverIP);
+							StoragePreferences::putInt(STORE_HTTP_PORT, serverHttpPort);
+
+							//先获取服务器信息
+							//getServerInfo();
+							//就当在获取服务器信息完成后获取用户信息,这里测试用
+							//getCustomerInfo();
+							//退出UDP线程
+							pthread_exit(NULL);
+							break;
+						}
+					}
+				} else if (n == 0) {
+					LOGD("连接正常断开");
+					break;
+				} else if (n == net::E_TIMEOUT) {
+					udpConn->Write((byte*)req, strlen(req));
+					LOGD("读取超时");
+				} else {
+					LOGD("出错");
+					break;
 				}
 			}
+			//关闭连接
+			udpConn->Close();
+			//释放内存
+			delete udpConn;
+			udpConn = NULL;
 		}
-		if (clerkId != 0) {
-			goCare();
-		}
+
+		//返回真,继续下次线程循环
+		return true;
 	}
-}
+};
 
+static UdpThread udp_thread;
 
 
-static void getDeviceInfo(){
-	if (dataInit){
-		getFrameInfo();
-		getBedCount();
-		setDirectorAndHeadNurse();
-		return;
+std::string getFrameFullName() {
+	if (frameInfo.isMember("full_name")) {
+		return frameInfo["full_name"].asString();
 	}
-	string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, std::string(ETHERNETMANAGER->getMacAddr()));
-	LOGD("请求设备信息. url = %s", url.c_str());
-	//发起HTTP GET请求
-	RestClient::Response r = RestClient::get(url);
-	LOGD("获得设备信息. result = %s", r.body.c_str());
-	//解析json
-	Json::Reader reader;
-	Json::Value root;
-	if (reader.parse(r.body, root, false)){
-		string partName = root["part_display"].asString();
-		StoragePreferences::putString(STORE_PARTNAME,partName);
-		NavibarSetPartName(partName);
-		//设备
-		StoragePreferences::putInt(STORE_DEVICE_ID, root["id"].asInt());
-		StoragePreferences::putInt(STORE_DEVICE_TYPE, root["device_type"].asInt());
-
-		//SIP存储
-//			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());	// 应该去找配置文件里的sip-ip
-		StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
-		StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
-
-		frameInfo["frame_id"] = root["frame_id"].asInt();
-		frameInfo["full_name"] = root["full_name"].asString();
-		frameInfo["part_id"] = root["part_id"].asInt();
-		getFrameInfo();
-
-		//获取科室设置
-		string partId = root["part_id"].asString();
-		StoragePreferences::putString(STORE_PARTID, partId);
-		getPartSetting(partId);
-		getVersion();
-		getNfcInteraction();
+	else {
+		return "";
 	}
 }
 
+
 Json::Value getFrame() {
 	return frameRoom;
 }
@@ -571,15 +662,15 @@ void dataRefresh() {
 	}
 
 	if (serverInfo) {
-		getServerInfo();
+		udp_thread.getServerInfo();
 	}
 	dataInit = false;
-	getDeviceInfo();
+	udp_thread.getDeviceInfo();
 	mBedListViewPtr->refreshListView();
 }
 
 void getPartSetting() {
-	getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
+	udp_thread.getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
 }
 
 
@@ -600,14 +691,11 @@ static void onUI_init(){
 	//run("this is thread name");
 	//测试用
 	LOGD("进入mainLogic页面, 触发 onUI_init");
-	if (ETHERNETMANAGER->isConnected() || WIFIMANAGER->isConnected()) {
-		if(serverInfo) {	// 如果是false,就是不需要
-			getServerInfo();
-		}
-		getDeviceInfo();
-	}
+    if(serverInfo && isConnectServer()) {    // 如果是false,就是不需要
+        udp_thread.getServerInfo();
+    }
+    udp_thread.getDeviceInfo();
 	setMainMode();
-
 }
 
 /**

+ 31 - 12
jni/logic/startLogic.cc

@@ -341,14 +341,6 @@ void lightControl(std::string typeStr, std::string lightColorStr, int time) {
 
 // 接收tcp消息
 void handleMsg(byte* inBytes){
-	LOGD("TCP received: %s", inBytes);
-	const char* cstr = reinterpret_cast<const char*>(inBytes);
-	string str = cstr;
-	if (str == "1"){
-		LOGD("get a heart beat");
-		return;
-	}
-
 	TcpModel tcpModel;
 	tcpModel = getTcpModel(inBytes);
 	LOGD("tcp model: %s, %s", tcpModel.type.c_str(), tcpModel.action.c_str());
@@ -873,8 +865,26 @@ void handleCall(string key, string roleType) {
 }
 
 
-void handleSos(string key) {
-	sosCall("");
+void handleSos(string value) {
+
+	if (value == "SOS_CANCEL") {
+		std::list<string> _sosData = getSosDataList();
+		if (_sosData.empty()) {
+			return;
+		}
+
+		std::list<string>::iterator it = _sosData.begin();
+
+		while (it != _sosData.end()) {
+			string sosDataStr = *it;
+			sendSosCancel(sosDataStr);
+			it++;
+		}
+		cleanSosDataList();
+	}
+	else {
+		sosCall("");
+	}
 }
 
 void handleEvent(string key, string id) {
@@ -970,12 +980,21 @@ void getDeviceButtonFunction(string key) {
 		else if (key == "KEY6") {
 			handleCall(key, "NURSE");
 		}
-		else if (key == "KEY7" || key == "KEY;") {
-			handleSos(key);
+		else if (key == "KEY7") {
+			handleSos("SOS");
 		}
 		else if (key == "KEY>") {
 			handleCall(key, "CANCEL");
 		}
+		else if (key == "KEY;") {
+			handleBlueCode();
+		}
+		else if (key == "KEY<") {
+			handleNursing(key, "");
+		}
+		else if (key == "KEY@") {
+			handleSos("SOS_CANCEL");
+		}
 		else if (key == "HANDKEY00" || key == "OUTKEY1") {
 			handleHCall(1);
 		}

+ 15 - 7
jni/logic/statusbar.cc

@@ -51,6 +51,19 @@ static bool tcpNowConnect = false;
 static bool sipConnect = true;
 static bool sipNowConnect = false;
 
+#define ETHERNETMANAGER		NETMANAGER->getEthernetManager()
+#define WIFIMANAGER			NETMANAGER->getWifiManager()
+
+
+bool isConnectServer() {
+    if (ETHERNETMANAGER->isConnected() || WIFIMANAGER->isConnected()) {
+        if (tcpConnect) {
+            return true;
+        }
+    }
+    return false;
+}
+
 void statusLight() {
     if (!networkConnect) {
         lightControl("CALLLED", "200F");
@@ -69,11 +82,6 @@ void statusLight() {
         }
     }
 }
-
-
-#define ETHERNETMANAGER		NETMANAGER->getEthernetManager()
-#define WIFIMANAGER			NETMANAGER->getWifiManager()
-
 static bool isLight = false;
 static net::DhcpClient _s_wifi_dhcp_client;
 static net::DhcpClient _s_eth_dhcp_client;
@@ -184,7 +192,7 @@ static void updateNetState(){
 		mRestartTimeTextViewPtr->setText(restartTimeStr);
 	}
 
-	if (ETHERNETMANAGER->isConnected() || WIFIMANAGER->isConnected()){
+    if (isConnectServer()){
 		netOffCount = 0;
 		if (isDataRefresh) {
 			dataRefresh();
@@ -303,7 +311,7 @@ void addSipRegisterStateListener() {
 }
 
 void tcpStatus(){
-	if (TcpClient::instance()->connected()){
+    if (TcpClient::instance()->isConnect()){
 		mTextViewTCPPtr->setBackgroundColor(0xFF37C127);
 		tcpConnect = true;
         if (tcpNowConnect != tcpConnect) {

+ 32 - 0
jni/net/tcp_client.cpp

@@ -20,6 +20,7 @@
 
 
 #define ETHERNETMANAGER		NETMANAGER->getEthernetManager()
+#define WIFIMANAGER			NETMANAGER->getWifiManager()
 
 void handleMsg(byte* msg);
 
@@ -36,6 +37,8 @@ TcpClient* TcpClient::instance() {
 }
 
 static net::Conn* conn;
+static bool isTcpConnect = false;
+static int heartbeatTime = 0;
 
 void TcpClient::sendMsg(const char* msg){
 	instance()->internalSendMsg(msg);
@@ -103,6 +106,12 @@ public:
 			json["software_version"] = getVersionCode();
 			json["model"] = "linux_door";
 			json["code"] = "SW10600101C-CM";
+            if (ETHERNETMANAGER->isConnected()) {
+                json["clientIp"] = ETHERNETMANAGER->getIp();
+            }
+            else if (WIFIMANAGER->isConnected()) {
+                json["clientIp"] = WIFIMANAGER->getIp();
+            }
 			tcpModel.json = json;
 
 			std::string req = getTcpModelString(tcpModel);
@@ -115,15 +124,34 @@ public:
 			while (true && !exitPending()) {
 				//读取,超时1000毫秒
 				int n = conn->Read(buf, sizeof(buf) - 1, 1000);
+
+                heartbeatTime += 1;
+                if (heartbeatTime >= 90) {
+                    isTcpConnect = false;
+                    heartbeatTime = 0;
+                    LOGD("心跳超时断开");
+                    break;
+                }
 				if (n > 0) {
+					isTcpConnect = true;
 					buf[n] = 0;
+                    LOGD("TCP received: %s", buf);
+                    const char* cstr = reinterpret_cast<const char*>(buf);
+                    std::string str = cstr;
+                    if (str == "1"){
+                        heartbeatTime = 0;
+                        LOGD("get a heart beat");
+                        continue;
+                    }
 					handleMsg(buf);
 				} else if (n == 0) {
+					isTcpConnect = false;
 					LOGD("连接正常断开");
 					break;
 				} else if (n == net::E_TIMEOUT) {
 //					LOGD("读取超时");
 				} else {
+					isTcpConnect = false;
 					LOGD("出错");
 					break;
 				}
@@ -166,4 +194,8 @@ bool TcpClient::connected() {
 	return conn != NULL;
 }
 
+bool TcpClient::isConnect() {
+	return isTcpConnect;
+}
+
 

+ 1 - 0
jni/net/tcp_client.h

@@ -26,6 +26,7 @@ public:
   void sendMsgWithCb(const char* msg, TcpCallback callback);
 
   static bool connected();
+  static bool isConnect();
   static bool busy();
 private:
   TcpClient();

+ 4 - 2
jni/service/BusinessConfig.h

@@ -90,8 +90,8 @@ static uint32_t defaultGreen = 0xFF2EA22A;
 static uint32_t defaultBlue = 0xFF68A5FF;
 static uint32_t defaultYellow = 0xFFE68024;
 
-static std::string versionCode = "v2.0.13";
-static int versionNo = 60;
+static std::string versionCode = "v2.0.14";
+static int versionNo = 61;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -242,6 +242,8 @@ void setDeviceButtonFunction(std::string deviceButtonFunctionStr);
 void addGainCallData(Json::Value data);
 void deleteGainCallData(std::string id);
 
+bool isConnectServer();
+
 enum CallFinishType {
 	CANCEL,
 	REJECT,

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/customerAffairActivity.o


BIN
obj/activity/deviceAddActivity.o


BIN
obj/activity/deviceInfoActivity.o


BIN
obj/activity/functionActivity.o


BIN
obj/activity/interactionActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/medicalCareActivity.o


BIN
obj/activity/moreActivity.o


BIN
obj/activity/navibar.o


BIN
obj/activity/promptActivity.o


BIN
obj/activity/settingActivity.o


BIN
obj/activity/sipTestActivity.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/updateActivity.o


BIN
obj/core/update_assistant.o


BIN
obj/net/tcp_client.o


BIN
obj/net/tcp_model.o


BIN
obj/net/tcp_util.o


BIN
obj/server/http_server.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o


BIN
obj/uart/UartContext.o