| | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | 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}; |
| | | } |
| | | |
| | | } |
| | | } |