| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hdl.sdk.ttl.Config.MCUConstants; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirHVACBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineFristBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineWaringBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirJinMaoBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLSecurity.SecurityBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLSensor.DryContactSensorBackEvent; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLSensor.SensorStateBackInfo; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUConfigurationBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirHVACFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirTechSysFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchStateBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedFristBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirJinMaoFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent; |
| | |
| | | * @param commandType 命令类型 |
| | | */ |
| | | public static void handle(UdpDataBean getDatas, int commandType) { |
| | | Log.e("panlili", "commandType=" + Integer.toHexString(commandType)+" desDeviceID=" + getDatas.desDeviceID + " sourceDeviceID=" + getDatas.sourceDeviceID); |
| | | switch (commandType) { |
| | | case Configuration.DEVICES_SEARCH_BACK_COMMAND: |
| | | if (HandleSearch.isGetRcuIp) { |
| | |
| | | } |
| | | } |
| | | break; |
| | | /***2020-07-20 新增新风设备**/ |
| | | case Configuration.FRESH_AIR_STATE_BACK_COMMAND: |
| | | handleFreshAirStateData(getDatas); |
| | | break; |
| | | case Configuration.FRESH_AIR_CTRL_BACK_COMMAND: |
| | | handleFreshAirCtrlBackData(getDatas); |
| | | break; |
| | | /***2020-07-20 金茂新风设备**/ |
| | | case Configuration.FRESH_AIR_JINMAO_STATE_BACK_COMMAND: |
| | | handleFreshAirJINMAOStateData(getDatas); |
| | | break; |
| | | case Configuration.FRESH_AIR_JINMAO_CTRL_BACK_COMMAND: |
| | | handleFreshAirJINMAOCtrlBackData(getDatas); |
| | | break; |
| | | /***2020-07-20 地热模块**/ |
| | | case Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND: |
| | | handleGeothermalStateData(getDatas); |
| | | break; |
| | | case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND: |
| | | handleGeothermalCtrlData(getDatas); |
| | | break; |
| | | /***2023-08-22 门锁模块**/ |
| | | case Configuration.DOOR_MACHINE_MODULE_STATE_BACK_COMMAND: |
| | | handleDoorMachineStateData(getDatas); |
| | | break; |
| | | case Configuration.DOOR_MACHINE_MODULE_CTRL_FRIST_BACK_COMMAND: |
| | | handleDoorMachineCtrlFristBackData(getDatas); |
| | | break; |
| | | case Configuration.DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND: |
| | | handleDoorMachineCtrlBackData(getDatas); |
| | | break; |
| | | case Configuration.DOOR_MACHINE_BROADCAST_STATE_BACK_COMMAND: |
| | | handleDoorMachineBroadcastStateData(getDatas); |
| | | break; |
| | | /***2020-04-01 新增通用开关**/ |
| | | case Configuration.COMMON_SWITCH_CTRL_BACK_COMMAND: |
| | | handleCommonSwitchCtrlData(getDatas); |
| | |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | handleCtrlData(getDatas); |
| | | break; |
| | | case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND: |
| | | handleColourLightStateData(getDatas); |
| | | break; |
| | | case Configuration.AIR_HVAC_CTRL_BACK_COMMAND: |
| | | handleHVACCtrlData(getDatas); |
| | | handleTechSysCtrlData(getDatas);//2023-08-21 |
| | | break; |
| | | case Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND://20190729新增 |
| | | case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://报警设置反馈 |
| | |
| | | handleAirStateData(getDatas); |
| | | break; |
| | | case Configuration.SENSOR_STATE_BACK_COMMAND: |
| | | handleSensorBroadcastStateData(getDatas); |
| | | break; |
| | | case Configuration.SENSOR_BROADCAST_STATE_BACK_COMMAND: |
| | | handleSensorBroadcastStateData(getDatas); |
| | | break; |
| | |
| | | case Configuration.DRY_CONTACT_BROADCAST_STATE_COMMAND: |
| | | handleDryContactBroadcastStateData(getDatas); |
| | | break; |
| | | |
| | | case Configuration.LIGHT_STATE_BACK_COMMAND: |
| | | handleLightStateData(getDatas); |
| | | break; |
| | | case Configuration.LIGHT_RGB_STATE_BACK_COMMAND: |
| | | handleColourLightStateData(getDatas);//2023-08-22 |
| | | break; |
| | | case Configuration.CURTAIN_STATE_BACK_COMMAND: |
| | | handleCurtainStateData(getDatas); |
| | | break; |
| | | case Configuration.CURTAIN_STATE_BROADCAST_BACK_COMMAND: |
| | | handleCurtainBroadcastStateData(getDatas); |
| | | break; |
| | |
| | | break; |
| | | case Configuration.AIR_HVAC_STATE_BACK_COMMAND: |
| | | // handleRcuAirCastData(getDatas); |
| | | HDLLog.I("发送第一次家居搜索"); |
| | | handleHVACStateData(getDatas);//2019-06-27 |
| | | handleTechSysStateData(getDatas);//2023-08-21 |
| | | break; |
| | | case Configuration.LOGIC_STATE_BACK_COMMAND: |
| | | // handleRcuAirCastData(getDatas); |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理CCT OR RGB灯光返回 |
| | | * 2023-8-22 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleColourLightCtrlData(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).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | AppliancesInfo lightInfo = infos.get(j); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF); |
| | | LightCtrlBackInfo info = new LightCtrlBackInfo(); |
| | | info.setParentRemarks(lightInfo.getParentRemarks()); |
| | | info.setAppliancesInfo(lightInfo); |
| | | info.setRemarks(lightInfo.getRemarks()); |
| | | info.setChannelNum(getDatas.addBytes[0] & 0xFF); |
| | | info.setBrightness(getDatas.addBytes[1] & 0xFF); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new LightFeedBackEvent(info, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理设备控制数据 |
| | |
| | | |
| | | break; |
| | | case Configuration.CURTAIN_CTRL_BACK_COMMAND: |
| | | // if (TextUtils.isEmpty(HandleSearch.rcuIp)){ |
| | | // |
| | | // }else{ |
| | | // AppliancesInfo curtainInfo = new AppliancesInfo(); |
| | | // 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.CURTAIN_BIG_TYPE |
| | | // && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) { |
| | | // for (int k = 0; k < rcuCurtainList.size(); k++) { |
| | | // if (devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum() == rcuCurtainList.get(k).getChanelNum() |
| | | // && devicesDataList.get(i).getAppliancesInfoList().get(j).getLittleType() == rcuCurtainList.get(k).getLittleType() |
| | | // ) { |
| | | // int state; |
| | | // switch (getDatas.addBytes[2] & 0xFF) { |
| | | // case 0: |
| | | // state = CurtainCtrlParser.curtainPause; |
| | | // break; |
| | | // case 1: |
| | | // state = CurtainCtrlParser.curtainOn; |
| | | // break; |
| | | // case 2: |
| | | // state = CurtainCtrlParser.curtainOff; |
| | | // break; |
| | | // default: |
| | | // state = 0; |
| | | // break; |
| | | // } |
| | | // rcuCurtainList.get(k).setCurState(state); |
| | | // devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF); |
| | | //// HDLLog.I("控制 rcuCurtainList回路号:"+rcuCurtainList.get(k).getChanelNum() |
| | | //// + " state = "+rcuCurtainList.get(k).getCurState() |
| | | //// ); |
| | | // } |
| | | // } |
| | | // |
| | | // curtainInfo = infos.get(j); |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo(); |
| | | // curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks()); |
| | | // curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks()); |
| | | // curtainCtrlBackInfo.setAppliancesInfo(curtainInfo); |
| | | // curtainCtrlBackInfo.setNum(getDatas.addBytes[1] & 0xFF); |
| | | // curtainCtrlBackInfo.setState(getDatas.addBytes[2] & 0xFF); |
| | | // isCurtainCtrlSuccess = true; |
| | | // EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true)); |
| | | // } |
| | | |
| | | |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | break; |
| | | // case Configuration.AIR_HVAC_CTRL_BACK_COMMAND: //2019-8-6 屏蔽 |
| | | // outter: |
| | | // for (int devIndex = 0, len = devicesDataList.size(); devIndex < len; devIndex++) { |
| | | // if (devicesDataList.get(devIndex).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | // && devicesDataList.get(devIndex).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | // ) { |
| | | // List<AppliancesInfo> infos = devicesDataList.get(devIndex).getAppliancesInfoList(); |
| | | // for (int appIndex = 0, len2 = infos.size(); appIndex < len2; appIndex++) { |
| | | // if ((infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_HVAC |
| | | // || infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_COOLMASTER |
| | | // || infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_INFRARED) |
| | | // && infos.get(appIndex).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | //// String airbytes = "193b 附加数据:"; |
| | | //// for (int i = 0; i < getDatas.addBytes.length; i++) { |
| | | //// airbytes += (getDatas.addBytes[i] & 0xff) + ","; |
| | | //// } |
| | | //// HDLLog.I( airbytes); |
| | | // AppliancesInfo airInfo = infos.get(appIndex); |
| | | // int indexI = devIndex; |
| | | // int indexJ = appIndex; |
| | | // |
| | | // final byte[] oldAirInfo; |
| | | //// HDLLog.I("KKKKKKDD"+(getDatas.addBytes[0] & 0xFF)); |
| | | // switch (getDatas.addBytes[0] & 0xFF) { |
| | | // case 1: |
| | | // oldAirInfo = air1Info; |
| | | // break; |
| | | // case 2: |
| | | // oldAirInfo = air2Info; |
| | | // break; |
| | | // case 3: |
| | | // oldAirInfo = air3Info; |
| | | // break; |
| | | // case 4: |
| | | // oldAirInfo = air4Info; |
| | | // break; |
| | | // default: |
| | | // oldAirInfo = new byte[1]; |
| | | // break; |
| | | // } |
| | | // byte[] newAirInfo = getDatas.addBytes; |
| | | // byte[] curAirInfo = new byte[]{0}; |
| | | // boolean isModeChange = false; |
| | | // if (oldAirInfo == null || oldAirInfo.length == 0) { |
| | | // return; |
| | | // } |
| | | // for (int oldAirInedx = 0; oldAirInedx < oldAirInfo.length; oldAirInedx++) { |
| | | // if (oldAirInedx == 0) { |
| | | // setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // if (oldAirInfo[0] != newAirInfo[8]) {//2019-8-2 去掉相同开关状态判断,解决开状态下,调用开命令状态下,不停重发问题 |
| | | // oldAirInfo[0] = newAirInfo[8]; |
| | | // curAirInfo = new byte[]{AirCtrlParser.airSwich, newAirInfo[8]}; |
| | | // if (curAirInfo.length > 1) { |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo); |
| | | // airInfo.setArrCurState(oldAirInfo); |
| | | // AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | // airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | // airCtrlBackInfo.setCurState(curAirInfo); |
| | | //// isACCtrlSuccess = true; |
| | | //// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | // |
| | | // } |
| | | // |
| | | // } |
| | | // } else if (oldAirInedx == 1) { |
| | | //// int mode = ((newAirInfo[4] & 0xf0) >> 4); |
| | | // int mode = newAirInfo[9] & 0xff; |
| | | // setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // if (oldAirInfo[1] != (byte) mode) { |
| | | // isModeChange = true; |
| | | // oldAirInfo[1] = (byte) mode; |
| | | // curAirInfo = new byte[]{AirCtrlParser.airMode, (byte) mode}; |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo); |
| | | // airInfo.setArrCurState(oldAirInfo); |
| | | // AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | // airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | // airCtrlBackInfo.setCurState(curAirInfo); |
| | | //// isACCtrlSuccess = true; |
| | | //// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | // |
| | | // } |
| | | // } else if (oldAirInedx == 2) { |
| | | // int mode = newAirInfo[9] & 0xff; |
| | | // byte newAirTem = newAirInfo[11]; |
| | | // setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // |
| | | // if (oldAirInfo[2] != newAirTem) { |
| | | // oldAirInfo[2] = newAirTem; |
| | | // switch (mode) { |
| | | // case 0: |
| | | // curAirInfo = new byte[]{AirCtrlParser.refTem, newAirTem}; |
| | | // break; |
| | | // case 1: |
| | | // curAirInfo = new byte[]{AirCtrlParser.heatTem, newAirTem}; |
| | | // break; |
| | | // case 3: |
| | | // curAirInfo = new byte[]{AirCtrlParser.autoTem, newAirTem}; |
| | | // break; |
| | | // case 4: |
| | | // curAirInfo = new byte[]{AirCtrlParser.dehumTem, newAirTem}; |
| | | // break; |
| | | // } |
| | | // if (curAirInfo.length > 1) { |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo); |
| | | // airInfo.setArrCurState(oldAirInfo); |
| | | // AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | // airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | // airCtrlBackInfo.setCurState(curAirInfo); |
| | | //// isACCtrlSuccess = true; |
| | | //// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | // |
| | | // } |
| | | // } |
| | | // } else if (oldAirInedx == 3) { |
| | | //// int speed = (newAirInfo[4] & 0x0f);//获取低4位 |
| | | // int speed = newAirInfo[10]; |
| | | // setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // if (oldAirInfo[3] != (byte) speed) { |
| | | // oldAirInfo[3] = (byte) speed; |
| | | // curAirInfo = new byte[]{AirCtrlParser.airSpeed, (byte) speed}; |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo); |
| | | // airInfo.setArrCurState(oldAirInfo); |
| | | // AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | // airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | // airCtrlBackInfo.setCurState(curAirInfo); |
| | | //// isACCtrlSuccess = true; |
| | | //// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | // EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // switch (getDatas.addBytes[0] & 0xFF) { |
| | | // case 1: |
| | | // air1Info = oldAirInfo; |
| | | // break; |
| | | // case 2: |
| | | // air2Info = oldAirInfo; |
| | | // break; |
| | | // case 3: |
| | | // air3Info = oldAirInfo; |
| | | // break; |
| | | // case 4: |
| | | // air4Info = oldAirInfo; |
| | | // break; |
| | | // } |
| | | // |
| | | // |
| | | //// if (curAirInfo.length > 1) { |
| | | ////// if (isModeChange) { |
| | | ////// isACCtrlSuccess = true; |
| | | ////// getAirInfo(hvacInfo); |
| | | ////// } else {f |
| | | ////// airInfo.setArrCurState(oldAirInfo); |
| | | ////// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | ////// airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | ////// airCtrlBackInfo.setCurState(curAirInfo); |
| | | ////// isACCtrlSuccess = true; |
| | | ////// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | ////// } |
| | | //// |
| | | //// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo); |
| | | //// airInfo.setArrCurState(oldAirInfo); |
| | | //// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo(); |
| | | //// airCtrlBackInfo.setAppliancesInfo(airInfo); |
| | | //// airCtrlBackInfo.setCurState(curAirInfo); |
| | | ////// isACCtrlSuccess = true; |
| | | //// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true); |
| | | //// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true)); |
| | | //// |
| | | //// } |
| | | // |
| | | // |
| | | // break outter; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // break; |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new AirHVACFeedBackEvent(info, true)); |
| | | break outter; |
| | | } else { |
| | | HDLLog.E("控制HVAC状态反馈数据异常"); |
| | | } |
| | | break outter; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理科技系统 控制回调 |
| | | * 2023-8-21 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleTechSysCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | case Configuration.AIR_HVAC_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.AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo mTechSysAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | AirTechSysBackInfo info = new AirTechSysBackInfo(mTechSysAirInfo); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new AirTechSysFeedBackEvent(info, true)); |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | String remarkStr = HDLStringUtils.byte2String(remarkByte); |
| | | HDLLog.I("remarkStr回路:" + remarkStr); |
| | | |
| | | // byte[] remark = new byte[20]; |
| | | // //硬件的字节流协议提供有误,收到某硬件提供备注不足20长度,解决这问题的权宜之计 |
| | | // int length; |
| | | // if (getDatas.addBytes.length < 20) { |
| | | // length = getDatas.addBytes.length; |
| | | // } else { |
| | | // length = remark.length; |
| | | // } |
| | | // System.arraycopy(getDatas.addBytes, 3, remark, 0, length); |
| | | |
| | | // String remarkStr = HDLStringUtils.byte2String(remark); |
| | | // HDLLog.I("remarkStr回路:" + remarkStr); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setRemarks(remarkStr); |
| | | |
| | | switch (infos.get(appPos).getBigType()) { |
| | |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState); |
| | | break; |
| | | case 2: |
| | | // if (!TextUtils.isEmpty(HandleSearch.rcuIp)) { |
| | | // RcuCurtain rcuCurtain = new RcuCurtain(); |
| | | // rcuCurtain.setChanelNum(getDatas.addBytes[2] & 0xFF); |
| | | // rcuCurtain.setLittleType(2); |
| | | // int state = -1; |
| | | // switch (getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF) { |
| | | // case 0: |
| | | // state = CurtainCtrlParser.curtainPause; |
| | | // break; |
| | | // case 1: |
| | | // state = CurtainCtrlParser.curtainOn; |
| | | // break; |
| | | // case 2: |
| | | // state = CurtainCtrlParser.curtainOff; |
| | | // break; |
| | | // } |
| | | // rcuCurtain.setCurState(state); |
| | | // rcuCurtainList.add(rcuCurtain); |
| | | // } |
| | | |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | break; |
| | | |
| | | } |
| | | break; |
| | | |
| | |
| | | hvacBytes[i - 23] = getDatas.addBytes[i]; |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(hvacBytes); |
| | | // switch (devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getChannelNum()) { |
| | | // case 1: |
| | | // if (air1Info == null) { |
| | | // air1Info = hvacBytes; |
| | | // } |
| | | // break; |
| | | // case 2: |
| | | // if (air2Info == null) { |
| | | // air2Info = hvacBytes; |
| | | // } |
| | | // break; |
| | | // case 3: |
| | | // if (air3Info == null) { |
| | | // air3Info = hvacBytes; |
| | | // } |
| | | // break; |
| | | // case 4: |
| | | // if (air4Info == null) { |
| | | // air4Info = hvacBytes; |
| | | // } |
| | | // break; |
| | | // |
| | | // } |
| | | break; |
| | | case 3: |
| | | byte[] newBytes = new byte[getDatas.addBytes.length - 24 + 1]; |
| | |
| | | break; |
| | | } |
| | | break; |
| | | case Configuration.SENSOR_BIG_TYPE://2019-07-03 屏蔽 |
| | | // String aa = "传感器备注:"; |
| | | // for (int i = 0; i < getDatas.addBytes.length; i++) { |
| | | // aa += (getDatas.addBytes[i] & 0xff) + ","; |
| | | // } |
| | | // HDLLog.I( aa); |
| | | |
| | | case Configuration.SENSOR_BIG_TYPE: |
| | | int curState; |
| | | if (getDatas.addBytes.length >= 26) {//2019-11-7 特殊处理,修改回路号 |
| | | if (getDatas.addBytes.length >= 26) {//2023-11-14 特殊处理,修改回路号为物理回路(因为ZigBee转bus转换器用的都是物理回路,将逻辑回路设为物理回路处理) |
| | | curState = (int) (getDatas.addBytes[24] & 0xff); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[25] & 0xff); |
| | | |
| | | } else { |
| | | curState = (int) (getDatas.addBytes[getDatas.addBytes.length - 1] & 0xff); |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curState); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState((int) curState); |
| | | break; |
| | | case Configuration.DOOR_MACHINE_BIG_TYPE: |
| | | switch (infos.get(appPos).getLittleType()) { |
| | | case 4: |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | break; |
| | | } |
| | | break; |
| | | default: |
| | | HDLLog.I("未找到此类型设备:" + infos.get(appPos).getBigType()); |
| | | break; |
| | |
| | | |
| | | } |
| | | |
| | | // /** |
| | | // * 处理传感器 广播数据 |
| | | // * |
| | | // * @param getDatas |
| | | // */ |
| | | // private static void handleSensorBroadcastStateData(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++) { |
| | | // switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()) { |
| | | // case Configuration.SENSOR_BIG_TYPE://2019-07-03 屏蔽 |
| | | // isGetDeviceStateSuccess = true; |
| | | // AppliancesInfo sensorInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | // float value = HDLUtlis.byte2Float(Arrays.copyOfRange(getDatas.addBytes, 5, 8)); |
| | | // devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(value); |
| | | // devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value); |
| | | // |
| | | // sensorInfo.setCurState(value); |
| | | // |
| | | // |
| | | // String unite = ""; |
| | | // switch (sensorInfo.getDeviceType()) { |
| | | // case HDLApConfig.TYPE_SENSOR_DRY_CONTACT: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_TEMP: |
| | | // if ((getDatas.addBytes[4] & 0xff) == 0) { |
| | | // unite = "°C"; |
| | | // } else { |
| | | // unite = "°F"; |
| | | // } |
| | | // |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_HUMIDITY: |
| | | // unite = "%"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_ILLUMINACE: |
| | | // unite = "LUX"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_VOC: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5: |
| | | // switch (getDatas.addBytes[4] & 0xff) { |
| | | // case 0: |
| | | // unite = "mg/m3"; |
| | | // break; |
| | | // case 1: |
| | | // unite = "ppm"; |
| | | // break; |
| | | // case 2: |
| | | // unite = "μm"; |
| | | // break; |
| | | // default: |
| | | // unite = ""; |
| | | // break; |
| | | // } |
| | | // |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_C02: |
| | | // switch (getDatas.addBytes[4] & 0xff) { |
| | | // case 0: |
| | | // unite = "mg/m3"; |
| | | // break; |
| | | // case 1: |
| | | // unite = "ppm"; |
| | | // break; |
| | | // default: |
| | | // unite = ""; |
| | | // break; |
| | | // } |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_LPG: |
| | | // unite = "ppm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_CO_H2: |
| | | // unite = "ppm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_CH4: |
| | | // unite = "ppm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_SMOG: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_WIND_SPEED: |
| | | // unite = "m/s"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_WIND_PRESSURE: |
| | | // unite = "Pa"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_LIQUID_FLOW: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_LIQUID_PRESSURE: |
| | | // unite = "Pa"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_LIQUID_DEPTH: |
| | | // unite = "mm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_RAIN_FALL: |
| | | // switch (getDatas.addBytes[4] & 0xff) { |
| | | // case 0: |
| | | // unite = "无雨"; |
| | | // break; |
| | | // case 1: |
| | | // unite = "小雨"; |
| | | // break; |
| | | // case 2: |
| | | // unite = "大雨"; |
| | | // break; |
| | | // default: |
| | | // unite = ""; |
| | | // break; |
| | | // } |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_WEIGHT: |
| | | // unite = "KG"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_HEIGHT_LENGTH: |
| | | // unite = "mm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_OBJECT_SPEED: |
| | | // unite = "m/s"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_SHAKE: |
| | | // unite = "mm"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_VOLTAGE: |
| | | // switch (getDatas.addBytes[4] & 0xff) { |
| | | // case 0: |
| | | // unite = "V"; |
| | | // break; |
| | | // case 1: |
| | | // unite = "μV"; |
| | | // break; |
| | | // default: |
| | | // unite = ""; |
| | | // break; |
| | | // } |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_ELECTRICITY: |
| | | // switch (getDatas.addBytes[4] & 0xff) { |
| | | // case 0: |
| | | // unite = "A"; |
| | | // break; |
| | | // case 1: |
| | | // unite = "μA"; |
| | | // break; |
| | | // default: |
| | | // unite = ""; |
| | | // break; |
| | | // } |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_POWER: |
| | | // unite = "W"; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_FLOODING: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET: |
| | | // unite = ""; |
| | | // break; |
| | | // case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON: |
| | | // unite = ""; |
| | | // break; |
| | | // default: |
| | | // unite = "未知单位"; |
| | | // break; |
| | | // } |
| | | // |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(sensorInfo, true)); |
| | | // HDLLog.I("发送传感器通知更新"); |
| | | // EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite)); |
| | | // break; |
| | | // default: |
| | | // HDLLog.I("handle state 没有找到匹配类型"); |
| | | // break; |
| | | // } |
| | | // |
| | | // } |
| | | // break outter; |
| | | // } |
| | | // } |
| | | // } |
| | | /** |
| | | * panlili |
| | | * 处理门锁状态和报警 广播数据 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleDoorMachineBroadcastStateData(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.DOOR_MACHINE_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE) { |
| | | String type = ""; |
| | | /*开锁: |
| | | 0x*1:指纹开锁 |
| | | 0x*2:密码开锁 |
| | | 0x*3:感应卡开锁 |
| | | 0x*4:机械钥匙开锁 |
| | | 0x*5:远程授权开锁 |
| | | 0x*6:临时密码开锁 |
| | | 0x*7-0x*f:(预留) |
| | | |
| | | 报警: |
| | | 0x1*:密码验证错误报警(密码连续3次次错误) |
| | | 0x2*:门未锁好报警(门锁未关好, 当门锁好时上报解除报警) |
| | | 0x3*:劫持报警(输入防劫持密码或者防劫持指纹开锁时报警) |
| | | 0x4*:防撬报警(门锁被撬开时报警) |
| | | 0x5*:电量不足报警(电量不足时报警) |
| | | 0x6*:指纹验证错误报警(开门验证输入指纹连续错误次数达到门锁规定3次时报警) |
| | | 0x7*:卡片验证错误报警(开门验证输入卡片连续错误次数达到门锁规定3次报警) |
| | | 0x8*:门锁恢复出厂设置 |
| | | 0x9*-0xf*:(预留)*/ |
| | | switch (getDatas.addBytes[2] & 0xFF) { |
| | | case 1: |
| | | type = "指纹开锁"; |
| | | break; |
| | | case 2: |
| | | type = "密码开锁"; |
| | | break; |
| | | case 3: |
| | | type = "感应卡开锁"; |
| | | break; |
| | | case 4: |
| | | type = "机械钥匙开锁"; |
| | | break; |
| | | case 5: |
| | | type = "远程授权开锁"; |
| | | break; |
| | | case 6: |
| | | type = "临时密码开锁"; |
| | | break; |
| | | case 10: |
| | | type = "密码验证错误报警"; |
| | | break; |
| | | case 20: |
| | | type = "门未锁好报警"; |
| | | break; |
| | | case 30: |
| | | type = "劫持报警"; |
| | | break; |
| | | case 40: |
| | | type = "防撬报警"; |
| | | break; |
| | | case 50: |
| | | type = "电量不足报警"; |
| | | break; |
| | | case 60: |
| | | type = "指纹验证错误报警"; |
| | | break; |
| | | case 70: |
| | | type = "卡片验证错误报警"; |
| | | break; |
| | | case 80: |
| | | type = "门锁恢复出厂设置"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[j] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[j] & 0xFF); |
| | | |
| | | AppliancesInfo doorMachineInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | int state = getDatas.addBytes[2] & 0xFF; |
| | | doorMachineInfo.setCurState(state); |
| | | |
| | | HDLLog.I("发送门锁状态和报警通知"); |
| | | EventBus.getDefault().post(new DoorMachineWaringBackInfo(doorMachineInfo, true, type)); |
| | | } else { |
| | | HDLLog.I("handleDoorMachineBroadcastStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE) { //2019-07-26因为查灯光状态是查询所以回路,所以要把所有回路灯光状态都推送一次 |
| | | if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE && (infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_CCT && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_RGB && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_DALI && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_DMX)) { //2019-07-26因为查灯光状态是查询所以回路,所以要把所有回路灯光状态都推送一次 |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[j + 1] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[j + 1] & 0xFF); |
| | |
| | | // HDLLog.I("HDLlightState" + devicesDataList.get(i).getAppliancesInfoList().get(j).toString()); |
| | | } else { |
| | | HDLLog.I("handleLightStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理CCT OR RGB灯光模块回调 |
| | | * 20230822新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleColourLightStateData(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.LIGTH_BIG_TYPE && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX)) { |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | ColourLightCtrlBackInfo colourLightCtrlBackInfo = new ColourLightCtrlBackInfo(appliancesInfo); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new ColourLightFeedBackEvent(colourLightCtrlBackInfo, true)); |
| | | |
| | | } else { |
| | | HDLLog.I("handleColourLightStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | |
| | | |
| | | |
| | | /** |
| | | * 读取科技系统状态反馈 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleTechSysStateData(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.AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-8-6 |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handleTechSysStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 干接点广播状态反馈反馈 |
| | | * 20191105新增 |
| | | * |
| | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | | if (infos.get(j).getBigType() == Configuration.SENSOR_BIG_TYPE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) {//2019-07-29 |
| | | && infos.get(j).getChannelNum() == ((getDatas.addBytes[1] & 0xFF) - 1)) {//2019-07-29 |
| | | if (getDatas.addBytes.length >= 3) { |
| | | isGetDeviceStateSuccess = true; |
| | | int state = getDatas.addBytes[2] & 0xFF; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理新风设备状态数据 |
| | | * 2020-07-20 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleFreshAirStateData(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.FRESH_AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handleFreshAirStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理新风控制成功状态数据 |
| | | * 2020-07-20 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleFreshAirCtrlBackData(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.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).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo mFreshAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | FreshAirBackInfo info = new FreshAirBackInfo(mFreshAirInfo); |
| | | // isFreshAirCtrlSuccess = true; |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new FreshAirFeedBackEvent(info, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理金茂新风设备状态数据 |
| | | * 2020-07-20 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleFreshAirJINMAOStateData(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.FRESH_AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handleFreshAirStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理金茂新风控制成功状态数据 |
| | | * 2020-07-20 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleFreshAirJINMAOCtrlBackData(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.FRESH_AIR_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo mFreshAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | FreshAirJinMaoBackInfo info = new FreshAirJinMaoBackInfo(mFreshAirInfo); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new FreshAirJinMaoFeedBackEvent(info, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理地热设备状态数据 |
| | | * 2020-07-20 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleGeothermalStateData(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.GEOTHERMAL_BIG_TYPE |
| | | && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE || infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO) |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | if (getDatas.addBytes.length >= 10) { |
| | | byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getArrCurState(); |
| | | 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).setArrCurState(getBytes); |
| | | isGetDeviceStateSuccess = true; |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | } else { |
| | | HDLLog.E("地热状态反馈数据异常"); |
| | | } |
| | | |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handleFreshAirStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理地热设备控制数据 |
| | | * 2020-07-20 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleGeothermalCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | //2019-07-09 地热模块 |
| | | case Configuration.GEOTHERMAL_MODULE_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.GEOTHERMAL_BIG_TYPE |
| | | && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE || infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO) |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | if (getDatas.addBytes.length >= 8) { |
| | | byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getArrCurState(); |
| | | if (getBytes == null || getBytes.length < 10) { |
| | | getBytes = new byte[10]; |
| | | } |
| | | System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//控制地热状态反馈,只取前8位数据 |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getBytes); |
| | | AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | |
| | | GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true); |
| | | // isGeothermalCtrlSuccess = true; |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.SUCCESS)); |
| | | } else { |
| | | |
| | | HDLLog.E("控制地热状态反馈数据异常"); |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理门锁设备状态数据 |
| | | * 2023-08-22 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleDoorMachineStateData(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.DOOR_MACHINE_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handleDoorMachineStateData 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理门锁远程开锁连接控制成功状态数据 |
| | | * 2023-08-22 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleDoorMachineCtrlFristBackData(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.DOOR_MACHINE_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo mDoorMachineInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | DoorMachineFristBackInfo info = new DoorMachineFristBackInfo(mDoorMachineInfo); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new DoorMachineFeedFristBackEvent(info, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理门锁远程开锁控制成功状态数据 |
| | | * 2023-08-22 新增 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleDoorMachineCtrlBackData(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.DOOR_MACHINE_BIG_TYPE |
| | | && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | DoorMachineBackInfo doorMachineBackInfo = new DoorMachineBackInfo(appliancesInfo); |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | EventBus.getDefault().post(new DoorMachineFeedBackEvent(doorMachineBackInfo, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |