From 69afac92a320033297d71e901e3c5b65e690f0b2 Mon Sep 17 00:00:00 2001
From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com>
Date: 星期二, 12 十一月 2024 11:42:15 +0800
Subject: [PATCH] 增加knx科技系统温度0.5支持

---
 HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java |   68 +++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
index 6b0ec25..bada758 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
@@ -413,4 +413,70 @@
         }
 
     }
-}
+
+    public static byte[] getAirKNXTechAddByte(AppliancesInfo appliancesInfo, int type, float temp) {
+
+        try {
+            AppliancesInfo newInfo = null;
+            byte[] airBytes = null;
+            outter:
+            for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+                if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+                        && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
+                    for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+                        if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.AIR_BIG_TYPE
+                                && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS
+                                && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+
+                            newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+                            if (newInfo.getArrCurState() == null) {
+                                newInfo.setArrCurState(new byte[19]);
+                            }
+                            airBytes = newInfo.getArrCurState();
+                            break outter;
+                        }
+                    }
+                }
+            }
+            byte[] addBytes = new byte[19];
+            if (airBytes != null && airBytes.length >= 19) {
+                System.arraycopy(airBytes, 0, addBytes, 0, airBytes.length);
+                addBytes[0] = (byte) newInfo.getChannelNum();
+
+                Log.d("panlili", "---temp=" + temp);
+                String tempStr = String.valueOf(temp).trim();
+                String[] strByte = tempStr.split("\\.");
+                int tempInt = Integer.parseInt(strByte[0]);
+                int tempFloat = Integer.parseInt(strByte[1]);
+
+                switch (type) {
+                    case refTem:
+                    case heatTem:
+                    case autoTem:
+                    case dehumTem://璁剧疆娓╁害
+                        addBytes[8] = 1;
+
+                        addBytes[3] = (byte) tempInt;
+                        addBytes[4] = (byte) tempInt;
+                        addBytes[5] = (byte) tempInt;
+                        addBytes[6] = (byte) tempInt;
+                        addBytes[11] = (byte) tempInt;
+
+                        addBytes[14] = (byte) tempFloat;
+                        addBytes[15] = (byte) tempFloat;
+                        addBytes[16] = (byte) tempFloat;
+                        addBytes[17] = (byte) tempFloat;
+                        addBytes[18] = (byte) tempFloat;
+
+                        break;
+                }
+            }
+
+            return addBytes;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new byte[]{fail};
+        }
+
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0