|
@@ -108,372 +108,466 @@ void setMainMode() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-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;
|
|
|
|
+ }
|
|
|
|
+ if (!isConnectServer()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
-static void getBedCount() {
|
|
|
|
- if (mActivityPtr == NULL) {
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ // 读取空间缓存的数据
|
|
|
|
+ static void getFrameInfo() {
|
|
|
|
+ mRoomNameTextViewPtr->setText(frameInfo["full_name"].asString());
|
|
}
|
|
}
|
|
- 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;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- emptyBedCount = frameBedList.size() - inBedCount;
|
|
|
|
- getBedCount();
|
|
|
|
|
|
+ static void getBedCount() {
|
|
|
|
+ if (mActivityPtr == NULL) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ mInBedNumTextViewPtr->setText(inBedCount);
|
|
|
|
+ mEmptyBedNumTextViewPtr->setText(emptyBedCount);
|
|
|
|
+ }
|
|
|
|
|
|
- if (mBedListViewPtr != NULL) {
|
|
|
|
- if (mainModeInt == 1) {
|
|
|
|
- mBedListViewPtr->refreshListView();
|
|
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ emptyBedCount = frameBedList.size() - inBedCount;
|
|
|
|
+ getBedCount();
|
|
}
|
|
}
|
|
- else if (mainModeInt == 2) {
|
|
|
|
- if (frameBedList.size() <= 3) {
|
|
|
|
|
|
+
|
|
|
|
+ if (mBedListViewPtr != NULL) {
|
|
|
|
+ if (mainModeInt == 1) {
|
|
mBedListViewPtr->refreshListView();
|
|
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);
|
|
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 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 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 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);
|
|
|
|
- }
|
|
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
|
|
- 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;
|
|
|
|
- }
|
|
|
|
- string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
|
|
|
|
- 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();
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
|
|
Json::Value getFrame() {
|
|
Json::Value getFrame() {
|
|
return frameRoom;
|
|
return frameRoom;
|
|
@@ -488,15 +582,15 @@ void dataRefresh() {
|
|
}
|
|
}
|
|
|
|
|
|
if (serverInfo) {
|
|
if (serverInfo) {
|
|
- getServerInfo();
|
|
|
|
|
|
+ udp_thread.getServerInfo();
|
|
}
|
|
}
|
|
dataInit = false;
|
|
dataInit = false;
|
|
- getDeviceInfo();
|
|
|
|
|
|
+ udp_thread.getDeviceInfo();
|
|
mBedListViewPtr->refreshListView();
|
|
mBedListViewPtr->refreshListView();
|
|
}
|
|
}
|
|
|
|
|
|
void getPartSetting() {
|
|
void getPartSetting() {
|
|
- getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
|
|
|
|
|
|
+ udp_thread.getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -517,12 +611,10 @@ static void onUI_init(){
|
|
//run("this is thread name");
|
|
//run("this is thread name");
|
|
//测试用
|
|
//测试用
|
|
LOGD("进入mainLogic页面, 触发 onUI_init");
|
|
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();
|
|
setMainMode();
|
|
|
|
|
|
}
|
|
}
|