From 7a951ecdc084ea8643e29e1ade59c1877fd7fbe5 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 16 三月 2020 09:49:07 +0800
Subject: [PATCH] 2020-03-16 1.增加地热模块自动根据当前模式设置当前模式的温度接口.

---
 app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java |  177 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 96 insertions(+), 81 deletions(-)

diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java
index 740955b..9fe35d5 100644
--- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java
+++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java
@@ -141,6 +141,7 @@
                 }
 
 
+
             }
         });
 
@@ -150,7 +151,7 @@
             public void onClick(View view) {
 
                 String tempStr = tempEditText.getText().toString();
-                if (TextUtils.isEmpty(tempStr) || TextUtils.isEmpty(tempStr)) {
+                if (TextUtils.isEmpty(tempStr)) {
                     showToast("璁剧疆鐨勬俯搴︿笉鑳戒负绌�");
                     return;
                 }
@@ -161,40 +162,43 @@
                     return;
                 }
                 proDialog.show();
-                switch (gModeState) {
 
-                    case 1:
-                        //褰撳墠鍦扮儹妯″紡涓烘櫘閫�
-                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//鏅�氭俯搴�
-                        ctrlId = GeothermalParser.gNormalTemp;
-                        break;
-                    case 2:
-                        //褰撳墠鍦扮儹妯″紡涓虹櫧澶�
-                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gDayTemp, tempInt);//鐧藉ぉ娓╁害
-                        ctrlId = GeothermalParser.gDayTemp;
-                        break;
-                    case 3:
-                        //褰撳墠鍦扮儹妯″紡涓哄闂�
-                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNightTemp, tempInt);//澶滈棿娓╁害
-                        ctrlId = GeothermalParser.gNightTemp;
-                        break;
-                    case 4:
-                        //褰撳墠鍦扮儹妯″紡涓虹寮�
-                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gLeaveTemp, tempInt);//绂诲紑娓╁害
-                        ctrlId = GeothermalParser.gLeaveTemp;
-                        break;
-                    case 5:
-                        proDialog.dismiss();
-                        //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
-                        showToast("鑷姩妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
-                        break;
-                    default:
-                        proDialog.dismiss();
-                        //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
-                        showToast("鏈煡妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
-                        break;
+                HDLCommand.geothermalCtrlTemp(appliancesInfo, tempInt);//鑷姩鏍规嵁褰撳墠妯″紡璁剧疆褰撳墠妯″紡鐨勬俯搴︺��
 
-                }
+//                switch (gModeState) {
+//
+//                    case 1:
+//                        //褰撳墠鍦扮儹妯″紡涓烘櫘閫�
+//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//鏅�氭俯搴�
+//                        ctrlId = GeothermalParser.gNormalTemp;
+//                        break;
+//                    case 2:
+//                        //褰撳墠鍦扮儹妯″紡涓虹櫧澶�
+//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gDayTemp, tempInt);//鐧藉ぉ娓╁害
+//                        ctrlId = GeothermalParser.gDayTemp;
+//                        break;
+//                    case 3:
+//                        //褰撳墠鍦扮儹妯″紡涓哄闂�
+//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNightTemp, tempInt);//澶滈棿娓╁害
+//                        ctrlId = GeothermalParser.gNightTemp;
+//                        break;
+//                    case 4:
+//                        //褰撳墠鍦扮儹妯″紡涓虹寮�
+//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gLeaveTemp, tempInt);//绂诲紑娓╁害
+//                        ctrlId = GeothermalParser.gLeaveTemp;
+//                        break;
+//                    case 5:
+//                        proDialog.dismiss();
+//                        //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
+//                        showToast("鑷姩妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
+//                        break;
+//                    default:
+//                        proDialog.dismiss();
+//                        //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
+//                        showToast("鏈煡妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
+//                        break;
+//
+//                }
 
 
             }
@@ -309,41 +313,43 @@
                 showToast("鍦扮儹妯″潡,杩斿洖鏁版嵁涓虹┖");
                 return;
             }
-
-            String message = "";
             GeothermalBackInfo mGeothermalBackInfo = event.getGeothermalBackInfo();
+            showGeothermalBackInfo(mGeothermalBackInfo);
 
-            switch (ctrlId) {   //ctrlId 褰撳墠鎺у埗绫诲瀷,鍙弽棣堟帶鍒剁殑鐘舵��
-                case GeothermalParser.gSwich:
-                    message = getSwichStateString(mGeothermalBackInfo.getIsOn());
-                    break;
-                case GeothermalParser.gMode:
-                    message = getModeStateString(mGeothermalBackInfo.getgMode());
-                    break;
-                case GeothermalParser.gNormalTemp:
-//                    gTempState = mGeothermalBackInfo.getgNormalTemp();
-                    message = "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
-                    break;
+//            String message = "";
+//            GeothermalBackInfo mGeothermalBackInfo = event.getGeothermalBackInfo();
 
-
-                case GeothermalParser.gDayTemp:
-                    message = "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
-                    break;
-                case GeothermalParser.gNightTemp:
-                    message = "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
-                    break;
-                case GeothermalParser.gLeaveTemp:
-                    message = "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
-                    break;
-                default:
-                    break;
-
-            }
-
-
-            mTextView.setText(message);
-            showToast(message);
-            HDLLog.I(message);
+//            switch (ctrlId) {   //ctrlId 褰撳墠鎺у埗绫诲瀷,鍙弽棣堟帶鍒剁殑鐘舵��
+//                case GeothermalParser.gSwich:
+//                    message = getSwichStateString(mGeothermalBackInfo.getIsOn());
+//                    break;
+//                case GeothermalParser.gMode:
+//                    message = getModeStateString(mGeothermalBackInfo.getgMode());
+//                    break;
+//                case GeothermalParser.gNormalTemp:
+////                    gTempState = mGeothermalBackInfo.getgNormalTemp();
+//                    message = "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
+//                    break;
+//
+//
+//                case GeothermalParser.gDayTemp:
+//                    message = "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
+//                    break;
+//                case GeothermalParser.gNightTemp:
+//                    message = "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
+//                    break;
+//                case GeothermalParser.gLeaveTemp:
+//                    message = "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
+//                    break;
+//                default:
+//                    break;
+//
+//            }
+//
+//
+//            mTextView.setText(message);
+//            showToast(message);
+//            HDLLog.I(message);
         }
     }
 
@@ -369,26 +375,35 @@
                             return;
                         }
 
-                        if(mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
-                            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
-
-                            message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
-                            message += "\n" + "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
-                            message += "\n" + "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
-                            message += "\n" + "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
-                            message += "\n" + "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
-                        }else {
-                            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
-                        }
-
-
-                        mTextView.setText(message);
-                        showToast(message);
-                        HDLLog.I(message);
+                        showGeothermalBackInfo(mGeothermalBackInfo);
 
                     }
                     break;
             }
         }
     }
+
+    /**
+     * showGeothermalBackInfo
+     * @param mGeothermalBackInfo
+     */
+    private void showGeothermalBackInfo(GeothermalBackInfo mGeothermalBackInfo){
+        String message = "";
+        if(mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
+            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
+
+            message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
+            message += "\n" + "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
+            message += "\n" + "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
+            message += "\n" + "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
+            message += "\n" + "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
+        }else {
+            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
+        }
+
+
+        mTextView.setText(message);
+        showToast(message);
+        HDLLog.I(message);
+    }
 }

--
Gitblit v1.8.0