| | |
| | | |
| | | |
| | | public static final int gMode = 4; //模式 |
| | | public static final int gModeNormal = 0;//普通模式 |
| | | public static final int gModeDay = 1;//白天模式 |
| | | public static final int gModeNight = 2;//夜间模式 |
| | | public static final int gModeLeave = 3;//离开模式 |
| | | public static final int gModeAuto = 4;//自动模式 |
| | | public static final int gModeNormal = 1;//普通模式 |
| | | public static final int gModeDay = 2;//白天模式 |
| | | public static final int gModeNight = 3;//夜间模式 |
| | | public static final int gModeLeave = 4;//离开模式 |
| | | public static final int gModeAuto = 5;//自动模式 |
| | | |
| | | public static final int gNormalTemp = 5;//普通模式温度 |
| | | public static final int gDayTemp = 6;//白天模式温度 |
| | | public static final int gNightTemp = 7;//夜间模式温度 |
| | | public static final int gLeaveTemp = 8;//离开模式温度 |
| | | |
| | | // [回路,开关状态,温度类型,模式,普通温度,白天温度,夜间温度,离开温度,自动温度,当前温度] |
| | | // feedbackState [回路,开关状态,温度类型,模式,普通温度,白天温度,夜间温度,离开温度,自动温度,当前温度] |
| | | public static byte[] getGeothermalAddByte(AppliancesInfo appliancesInfo, int type, int state) { |
| | | 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.AIR_BIG_TYPE |
| | | && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() != HDLApConfig.TYPE_AC_PANEL |
| | | && 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]); |
| | | 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; |
| | | } |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | airBytes = newInfo.getFeedbackState(); |
| | | |
| | | if (airBytes != null && airBytes.length >= 10) { |
| | | byte[] addBytes = new byte[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] = airBytes[8]; |
| | | addBytes[9] = 0; |
| | | addBytes[10] = 0; |
| | | |
| | | 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 (type) { |
| | | case gSwich: |
| | |
| | | break; |
| | | case gMode: |
| | | addBytes[1] = 1; |
| | | addBytes[3] = (byte) state; |
| | | addBytes[3] = (byte) state; |
| | | break; |
| | | case gNormalTemp: |
| | | addBytes[1] = 1;//打开 |
| | |
| | | break; |
| | | } |
| | | return addBytes; |
| | | } else { |
| | | return null; |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new byte[]{fail}; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |