| | |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLAirCondition.AirCtrlBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLAudio.HDLAudio; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLFreshAir.FreshAirBackInfo; |
| | |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.LightCtrlBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLLogic.LogicCtrlBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLLogic.LogicMode; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLSecurity.SecurityBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLSensor.SensorStateBackInfo; |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.HDLWarning.WarningType; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo; |
| | |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.RcuLight; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.UdpDataBean; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.AirFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CommonSwitchStateBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode; |
| | |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.WarningInfoEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Parser.DeviceParser; |
| | | import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog; |
| | |
| | | case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND://20190709新增 |
| | | handleGeothermalCtrlData(getDatas); |
| | | break; |
| | | |
| | | /***2020-06-23 新增通用开关**/ |
| | | case Configuration.COMMON_SWITCH_CTRL_BACK_COMMAND: |
| | | handleCommonSwitchCtrlData(getDatas); |
| | | break; |
| | | case Configuration.COMMON_SWITCH_STATE_BACK_COMMAND: |
| | | handleCommonSwitchStateData(getDatas); |
| | | break; |
| | | case Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND://20190729新增 |
| | | case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://报警设置反馈 |
| | | handleSecurityCtrlData(getDatas); |
| | | break; |
| | | case Configuration.SECURITY_STATE_BACK_COMMAND: |
| | | handleSecurityStateData(getDatas); |
| | | break; |
| | | // 获取设备备注 |
| | | case Configuration.DEVICES_READ_BACK_COMMAND: |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通用开关控制反馈 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleCommonSwitchCtrlData(UdpDataBean getDatas) { |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getBigType() == Configuration.COMMON_SWITCH_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_COMMON_SWITCH) { |
| | | |
| | | if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | //大类、小类、回路号都匹配 |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF); |
| | | AppliancesInfo mSwitchInfo = infos.get(j); |
| | | CommonSwitchBackInfo info = new CommonSwitchBackInfo(); |
| | | info.setAppliancesInfo(mSwitchInfo); |
| | | info.setSwitchNum(getDatas.addBytes[0] & 0xFF); |
| | | info.setSwitchState(getDatas.addBytes[1] & 0xFF); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new CommonSwitchCtrlBackEvent(info, true)); |
| | | break outter;//跳出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | break outter;//跳出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /**************************************2020-06-23新增***************************************/ |
| | | /** |
| | | * 通用开关读状态反馈反馈 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleCommonSwitchStateData(UdpDataBean getDatas) { |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getBigType() == Configuration.COMMON_SWITCH_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_COMMON_SWITCH) { |
| | | |
| | | if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | //大类、小类、回路号都匹配 |
| | | if (getDatas.addBytes.length >= 2) { |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF); |
| | | AppliancesInfo mSwitchInfo = infos.get(j); |
| | | CommonSwitchBackInfo info = new CommonSwitchBackInfo(); |
| | | info.setAppliancesInfo(mSwitchInfo); |
| | | info.setSwitchNum(getDatas.addBytes[0] & 0xFF); |
| | | info.setSwitchState(getDatas.addBytes[1] & 0xFF); |
| | | EventBus.getDefault().post(new CommonSwitchStateBackEvent(info, true)); |
| | | } |
| | | break outter;//跳出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | break outter;//跳出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 读取安防设置反馈 |
| | | * 2020-06-23 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleSecurityStateData(UdpDataBean getDatas) { |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getBigType() == Configuration.SECURITY_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_SECURITY_MODULE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-29 |
| | | if (getDatas.addBytes.length >= 2) { |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | } else { |
| | | isGetDeviceStateSuccess = true; |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), false)); |
| | | HDLLog.info("handleSecurityStateData 返回addBytes数据异常"); |
| | | } |
| | | break outter; |
| | | } else { |
| | | HDLLog.info("handleSecurityStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理安防设备 |
| | | * 2020-06-23 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleSecurityCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | //Arming 布防设置反馈 |
| | | case Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND: |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | 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).getBigType() == Configuration.SECURITY_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_SECURITY_MODULE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (getDatas.addBytes.length >= 2) { |
| | | AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | // isSecurityCtrlSuccess = true; |
| | | setDeviceCtrlSuccessStateWithInfo(mInfo, true); |
| | | EventBus.getDefault().post(new SecurityArmingFeedBackEvent(mInfo, getDatas.addBytes[1] & 0xFF, true)); |
| | | } else { |
| | | HDLLog.E("布防设置 反馈数据异常"); |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | |
| | | break; |
| | | |
| | | //ALARM 报警设置反馈 |
| | | case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND: |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | |
| | | 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).getBigType() == Configuration.SECURITY_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_SECURITY_MODULE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (getDatas.addBytes.length >= 3) { |
| | | //byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getArrCurState(); |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | |
| | | SecurityBackInfo info = new SecurityBackInfo(mInfo); |
| | | // isSecurityCtrlSuccess = true; |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new SecurityAlarmFeedBackEvent(info, true)); |
| | | } else { |
| | | HDLLog.E("报警设置反馈 反馈数据异常"); |
| | | } |
| | | |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |