| | |
| | | public static boolean isGeothermalCtrlSuccess = false; //判断地热模块是否控制成功 |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始化SDK |
| | | * |
| | |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes); |
| | | AppliancesInfo mFreshAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | |
| | | |
| | | /** |
| | | * 处理地热设备控制数据 |
| | | * 20190710 |
| | | * 20190710 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleGeothermalCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | //2019-07-09 地热模块 |
| | | //2019-07-09 地热模块 |
| | | case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND: |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if(getDatas.addBytes.length > 0) { |
| | | if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (getDatas.addBytes.length > 0) { |
| | | if (infos.get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (getDatas.addBytes.length >= 8) { |
| | | byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); |
| | | if (getBytes == null || getBytes.length < 10) { |
| | |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | HDLLog.info("HDL big::"+devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()); |
| | | HDLLog.info("HDL big::" + devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()); |
| | | switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()) { |
| | | case Configuration.LIGTH_BIG_TYPE: |
| | | isGetDeviceStateSuccess = true; |
| | |
| | | HDLLog.info("handle state 没有找到匹配类型"); |
| | | break; |
| | | } |
| | | // break outter; |
| | | |
| | | } |
| | | break outter; |
| | | } |
| | |
| | | /** |
| | | * 处理新风设备状态数据 |
| | | * 20190710新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleFreshAirStateData(UdpDataBean getDatas) { |
| | |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType()) { |
| | | case HDLApConfig.TYPE_FRESH_AIR: |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | |
| | | break; |
| | | default: |
| | | HDLLog.info("handleFreshAirStateData 没有找到匹配类型"); |
| | | break; |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | break outter; |
| | | }else { |
| | | HDLLog.info("handleFreshAirStateData 没有找到匹配类型"); |
| | | } |
| | | |
| | | } |
| | | break outter; |
| | | } |
| | |
| | | /** |
| | | * 处理地热设备状态数据 |
| | | * 20190710新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleGeothermalStateData(UdpDataBean getDatas) { |
| | |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType()) { |
| | | case HDLApConfig.TYPE_GEOTHERMAL_MODULE: |
| | | |
| | | if(getDatas.addBytes.length >= 10) { |
| | | byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); |
| | | if (getBytes == null || getBytes.length < 10) { |
| | | getBytes = new byte[10]; |
| | | } |
| | | System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 10);//20190710查询地热状态反馈,只取前10位数据 |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes); |
| | | isGetDeviceStateSuccess = true; |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | }else { |
| | | HDLLog.E("地热状态反馈数据异常"); |
| | | if (infos.get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | if (getDatas.addBytes.length >= 10) { |
| | | byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); |
| | | if (getBytes == null || getBytes.length < 10) { |
| | | getBytes = new byte[10]; |
| | | } |
| | | System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 10);//20190710查询地热状态反馈,只取前10位数据 |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes); |
| | | isGetDeviceStateSuccess = true; |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | } else { |
| | | HDLLog.E("地热状态反馈数据异常"); |
| | | } |
| | | |
| | | break; |
| | | default: |
| | | HDLLog.info("handleGeothermalStateData 没有找到匹配类型"); |
| | | break; |
| | | break outter; |
| | | }else { |
| | | HDLLog.info("handleFreshAirStateData 没有找到匹配类型"); |
| | | } |
| | | |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 此方法基本没用到,逻辑模块的控制信息已经在handleCtrlData中处理过了 |
| | | * <p> |