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.增加地热模块自动根据当前模式设置当前模式的温度接口.

---
 hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java |   76 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
index f099917..75b6587 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
@@ -118,5 +118,81 @@
 
     }
 
+    //鏍规嵁褰撳墠妯″紡璁剧疆娓╁害
+    public static byte[] getGeothermalAddByteTemp(AppliancesInfo appliancesInfo, int state) {
+        try {
+            AppliancesInfo newInfo = null;
+            byte[] airBytes = null;
+            outter:
+            for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+                if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+                        && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+                    for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+                        if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
+                                && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE
+                                && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+                            newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+                            if (newInfo.getFeedbackState() == null) {
+                                newInfo.setFeedbackState(new byte[10]);
+                            }
+                            airBytes = newInfo.getFeedbackState();
+                            break outter;
+                        }
 
+                    }
+                }
+            }
+
+            byte[] addBytes = new byte[10];
+            if (airBytes != null && airBytes.length >= 10) {
+                addBytes[0] = (byte) newInfo.getChannelNum();
+                addBytes[1] = airBytes[1];
+                addBytes[2] = 0;
+                addBytes[3] = airBytes[3];
+                addBytes[4] = airBytes[4];
+                addBytes[5] = airBytes[5];
+                addBytes[6] = airBytes[6];
+                addBytes[7] = airBytes[7];
+                addBytes[8] = 0;
+                addBytes[9] = 0;
+            } else {
+                addBytes[0] = (byte) newInfo.getChannelNum();
+                addBytes[1] = 0;
+                addBytes[2] = 0;
+                addBytes[3] = 1;
+                addBytes[4] = 30;
+                addBytes[5] = 30;
+                addBytes[6] = 30;
+                addBytes[7] = 30;
+                addBytes[8] = 0;
+                addBytes[9] = 0;
+            }
+
+            switch (addBytes[3]) {
+                case gModeNormal:
+                    addBytes[1] = 1;//鎵撳紑
+                    addBytes[4] = (byte) state;
+                    break;
+                case gModeDay:
+                    addBytes[1] = 1;//鎵撳紑
+                    addBytes[5] = (byte) state;
+                    break;
+                case gModeNight:
+                    addBytes[1] = 1;//鎵撳紑
+                    addBytes[6] = (byte) state;
+                    break;
+                case gModeLeave:
+                    addBytes[1] = 1;//鎵撳紑
+                    addBytes[7] = (byte) state;
+                    break;
+            }
+            return addBytes;
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new byte[]{fail};
+        }
+
+    }
 }

--
Gitblit v1.8.0