| | |
| | | |
| | | } |
| | | |
| | | //根据当前模式设置温度 |
| | | 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}; |
| | | } |
| | | |
| | | } |
| | | } |