.idea/deploymentTargetSelector.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_TTLSDK485/build.gradle | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
README.md | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
.idea/deploymentTargetSelector.xml
@@ -4,10 +4,10 @@ <selectionStates> <SelectionState runConfigName="app"> <option name="selectionMode" value="DROPDOWN" /> <DropdownSelection timestamp="2024-11-11T02:28:48.057319600Z"> <DropdownSelection timestamp="2024-11-12T03:27:29.888475400Z"> <Target type="DEFAULT_BOOT"> <handle> <DeviceId pluginId="Default" identifier="serial=192.168.1.113:5555;connection=edc26430" /> <DeviceId pluginId="Default" identifier="serial=192.168.1.103:5555;connection=3ecbcada" /> </handle> </Target> </DropdownSelection> HDL_TTLSDK485/build.gradle
@@ -7,8 +7,8 @@ defaultConfig { minSdkVersion 17 targetSdkVersion 30 versionCode 7 versionName "1.2.4" versionCode 8 versionName "1.2.5" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" ndk { HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java
@@ -1,7 +1,5 @@ package com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition; import android.util.Log; import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo; import java.io.Serializable; @@ -18,8 +16,19 @@ private String indoorHumidity;//室内湿度 0-100 private int indoorTempInt;//室内温度点整数部分 private int indoorTempFloat;//室内温度点小数部分 private int refTemp;//制冷温度点 0-84 private int heatTemp;//制热温度点 0-84 private String coldTemp;//制冷温度点,支持小数的用这个 private int refTemp;//制冷温度点整数部分 0-84 private int refTempFloat;//制冷温度点小数部分 private String hotTemp;//制冷温度点,支持小数的用这个 private int heatTemp;//制热温度点整数部分 0-84 private int heatTempFloat;//制热温度点小数部分 private String setTemp;//制冷温度点 0-84 private int setTempInt;//制热温度点整数部分 0-84 private int setTempFloat;//制热温度点小数部分 private int airMode;//空调模式0 = 制冷, 1 = 制热 private byte[] curState;//控制回馈信息 @@ -34,7 +43,27 @@ if (this.curState == null) return; if (this.curState.length >= 14) { if (this.curState.length >= 19) { this.channelNum = this.curState[0] & 0xFF; this.indoorTempInt = this.curState[2] & 0xFF; this.refTemp = this.curState[3] & 0xFF;//制冷温度点 0-84 this.heatTemp = this.curState[4] & 0xFF;//制热温度点 0-84 this.isOn = this.curState[8] & 0xFF;//只取低4位 this.airMode = this.curState[9] & 0xFF; this.setTempInt = this.curState[11] & 0xFF; this.indoorTempFloat = this.curState[13] & 0xFF; this.indoorTemp = indoorTempInt + "." + indoorTempFloat; this.refTempFloat = this.curState[14] & 0xFF; this.coldTemp = refTemp + "." + refTempFloat; this.heatTempFloat = this.curState[15] & 0xFF; this.hotTemp = heatTemp + "." + heatTempFloat; this.setTempFloat = this.curState[18] & 0xFF; this.setTemp = setTempInt + "." + setTempFloat; } else if (this.curState.length >= 14) { this.channelNum = this.curState[0] & 0xFF; this.indoorTempInt = this.curState[2] & 0xFF; this.refTemp = this.curState[3] & 0xFF;//制冷温度点 0-84 @@ -118,6 +147,30 @@ this.airMode = airMode; } public String getColdTemp() { return coldTemp; } public void setColdTemp(String coldTemp) { this.coldTemp = coldTemp; } public String getHotTemp() { return hotTemp; } public void setHotTemp(String hotTemp) { this.hotTemp = hotTemp; } public String getSetTemp() { return setTemp; } public void setSetTemp(String setTemp) { this.setTemp = setTemp; } public byte[] getCurState() { return curState; } 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}; } } } HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java
@@ -7,6 +7,7 @@ import com.hdl.sdk.ttl.Config.MCUConstants; import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig; import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo; import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo; import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser; import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio; import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo; @@ -32,6 +33,7 @@ import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData; import com.hdl.sdk.ttl.HDLDeviceManger.Bean.SendDatas; import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent; import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirTechSysFeedBackEvent; import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent; import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent; import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent; @@ -411,6 +413,47 @@ AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); airCtrlBackInfo.setAppliancesInfo(info); EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, false)); } } }, mRequestTimeout); } else { HDLLog.I("空调设备控制不在范围内" + " LittleType = " + info.getLittleType() + " BigType = " + info.getBigType() ); } } /** * 控制空调温度(温度为浮点型) * * @param info * @param type * @param temp 温度 */ public static void airCtrlTemp(final AppliancesInfo info, int type, float temp) { HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false); if (acCtrlFailTimer != null) { acCtrlFailTimer.cancel(); acCtrlFailTimer = null; } if (info.getBigType() == Configuration.AIR_BIG_TYPE) { if (info.getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) { byte[] airbytes = AirCtrlParser.getAirKNXTechAddByte(info, type, temp); if (airbytes != null) { addSendData(info, airbytes, Configuration.CONTROL); } } acCtrlFailTimer = new Timer(); acCtrlFailTimer.schedule(new TimerTask() { @Override public void run() { if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) { AirTechSysBackInfo AirTechSysBackInfo = new AirTechSysBackInfo(info); EventBus.getDefault().post(new AirTechSysFeedBackEvent(AirTechSysBackInfo, false)); } } }, mRequestTimeout); @@ -1880,6 +1923,7 @@ Crc sendDatas = new Crc(command, subnetID, deviceID, addBytes); HDLSerialPortCore.sendData(sendDatas); } else { SendDatas.AddSendData(command, subnetID, deviceID, addBytes); } } HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java
@@ -26,7 +26,7 @@ */ public class HDLSerialPortCore { //串口设备路径名 private static String mPathname = "/dev/ttyS9"; private static String mPathname = "/dev/ttyS1"; //波特率 private static int mBaudrate = 115200; README.md
@@ -1,8 +1,19 @@ ## Android_HDL_SDK_TTL485 ## Android_HDL_SDK_TTL HDL TTL485 Android SDK Copyright (c) 2019 HDL Inc. HDL TTL Android SDK Copyright (c) 2019 HDL Inc. 魔镜SDK项目 485 BUS SDK项目 2020-03-25 1.去掉MCU小板协议 2024-5-31 V1.2.4 1.SDK新增KNX科技系统支持,温度控制支持小数,步进支持0.5 1)设置温度显示: 根据制冷/制热模式,取getColdTemp()/getHotTemp() 根据设置温度,取getSetTemp() 2.设置温度: 调用airCtrlTemp(info,type,temp)方法 2024-11-12 V1.2.5 1.修改搜索设备备注按照index索引 2.优化搜索设备流程 app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java
@@ -9,7 +9,7 @@ */ public class HDLApplication extends Application { public static final String HDL_UART_PATH = "/dev/ttyS9"; //串口设备路径名 public static final String HDL_UART_PATH = "/dev/ttyS1"; //串口设备路径名 public static final int HDL_BAUDRATE = 115200; //波特率 @Override app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java
@@ -138,9 +138,10 @@ showToast("设置的温度不能为空"); return; } int tempInt = Integer.parseInt(tempStr); //2024.5.30修改,温度修改为浮点型 Float temp = Float.parseFloat(tempStr); if (tempInt < 5 || tempInt > 35) { if (temp < 5 || temp > 35) { showToast("温度设置范围为:5~35摄氏度(℃)"); return; } @@ -148,11 +149,11 @@ switch (airModeState) { case 0: //当前空调模式为制冷 HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.refTem, tempInt);//制冷温度 HDLCommand.airCtrlTemp(appliancesInfo, AirCtrlParser.refTem, temp);//制冷温度,2024.5.30修改,温度控制调用airCtrlTemp方法 break; case 1: //当前空调模式为制热 HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.heatTem, tempInt);//制热温度 HDLCommand.airCtrlTemp(appliancesInfo, AirCtrlParser.heatTem, temp);//制热温度,2024.5.30修改,温度控制调用airCtrlTemp方法 break; } } @@ -173,9 +174,13 @@ stringState += "\n室内温度:" + mAirTechSysBackInfo.getIndoorTemp(); if (AirCtrlParser.airModeRefTem == mAirTechSysBackInfo.getAirMode()) { stringState += "\n制冷模式温度:" + mAirTechSysBackInfo.getRefTemp(); stringState += "\n制冷模式温度:" + mAirTechSysBackInfo.getColdTemp();//2024.5.30更新 } else if (AirCtrlParser.airModeHeatTem == mAirTechSysBackInfo.getAirMode()) { stringState += "\n制热模式温度:" + mAirTechSysBackInfo.getHeatTemp(); stringState += "\n制热模式温度:" + mAirTechSysBackInfo.getHotTemp();//2024.5.30更新 } if (!TextUtils.isEmpty(mAirTechSysBackInfo.getSetTemp())){//2024.5.30更新 stringState += "\n设置温度:" + mAirTechSysBackInfo.getSetTemp(); } } else { @@ -244,9 +249,13 @@ message += "\n室内温度:" + mAirTechSysBackInfo.getIndoorTemp(); if (AirCtrlParser.airModeRefTem == mAirTechSysBackInfo.getAirMode()) { message += "\n制冷模式温度:" + mAirTechSysBackInfo.getRefTemp(); message += "\n制冷模式温度:" + mAirTechSysBackInfo.getColdTemp();//2024.5.30更新 } else if (AirCtrlParser.airModeHeatTem == mAirTechSysBackInfo.getAirMode()) { message += "\n制热模式温度:" + mAirTechSysBackInfo.getHeatTemp(); message += "\n制热模式温度:" + mAirTechSysBackInfo.getHotTemp();//2024.5.30更新 } if (!TextUtils.isEmpty(mAirTechSysBackInfo.getSetTemp())){//2024.5.30更新 message += "\n设置温度:" + mAirTechSysBackInfo.getSetTemp(); } } else { @@ -276,7 +285,7 @@ } AirTechSysBackInfo mAirTechSysBackInfo = event.getAirTechSysBackInfo(); showAirTechSysBackInfo(mAirTechSysBackInfo); if (!TextUtils.isEmpty(mAirTechSysBackInfo.getIndoorHumidity())){ if (!TextUtils.isEmpty(mAirTechSysBackInfo.getIndoorHumidity())) { airHumidity.setText("室内湿度:" + mAirTechSysBackInfo.getIndoorHumidity()); } }