| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hdl.sdk.ttl.Config.Configuration; |
| | | import com.hdl.sdk.ttl.Config.MCUConstants; |
| | | import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirHVACBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser; |
| | | 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.FreshAirJinMaoBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLight.LightCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicMode; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.SceneCtrlBackInfo; |
| | | 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.HDLAppliances.HDLWarning.WarningType; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListRemarks; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListSceneRemarks; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUConfigurationBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuCurtain; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuLight; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent; |
| | | 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.CurtainDeviceStateEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent; |
| | | 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.FreshAirFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirJinMaoFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SceneFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.UpdateRemarkFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Parser.DeviceParser; |
| | | import com.hdl.sdk.ttl.Config.Configuration; |
| | | import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLight.LightCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicCtrlBackInfo; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicMode; |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLWarning.WarningType; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListRemarks; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuCurtain; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuLight; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.WarningInfoEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Parser.DeviceParser; |
| | | import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLStringUtils; |
| | | import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLUtlis; |
| | | import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog; |
| | | import com.hdl.sdk.ttl.Utils.SPUtils.SPUtils; |
| | | //import com.hdl.sdk.ttl.Utils.TransformUtils.DataConverseUtils; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | |
| | | |
| | | public class HDLDeviceManager { |
| | | public static List<String> rcuIpList = new ArrayList<>();//统计Rcu ip地址列表 |
| | | public static List<DevicesData> devicesDataList = new ArrayList<>();//统计搜索列表 |
| | | public static List<DevicesData> realDevicesDataList = new ArrayList<>();//统计搜索列表 |
| | | public static List<DevicesData> devicesDataList = new ArrayList<>();//统计设备搜索列表 |
| | | public static List<DevicesData> realDevicesDataList = new ArrayList<>();//统计设备搜索列表 |
| | | public static int totalDeviceSize = 0; |
| | | public static List<ScenesData> scenesDataList = new ArrayList<>();//统计场景搜索列表 |
| | | private static Context viewContext; |
| | | public static List<ListRemarks> listRemarks = new ArrayList<>(); |
| | | public static List<ListSceneRemarks> listSceneRemarks = new ArrayList<>(); |
| | | public static List<RcuLight> rcuLightList = new ArrayList<>(); |
| | | public static List<RcuCurtain> rcuCurtainList = new ArrayList<>(); |
| | | public static boolean isLogicCtrl = false; |
| | | public static ConcurrentHashMap<String, Boolean> ctrlSuccessStateHashMap = new ConcurrentHashMap<>();//2019-8-2 |
| | | |
| | | |
| | | // public static byte[] air1Info = null; |
| | | // public static byte[] air2Info = null; |
| | | // public static byte[] air3Info = null; |
| | | // public static byte[] air4Info = null; |
| | | |
| | | public static boolean isGetDeviceStateSuccess = false; //判断获取设备状态是否控制成功 |
| | | public static boolean isGetDeviceStateSuccess = false; //判断获取设备状态是否读取成功 |
| | | public static boolean isUpdateRemarkSuccess = false; //判断修改设备名是否成功 |
| | | public static boolean isMCUCtrlSuccess = false; //判断是否与MCU通信成功 |
| | | |
| | |
| | | // public static boolean isLightCtrlSuccess = false; //判断灯光是否控制成功 |
| | | // public static boolean isCurtainCtrlSuccess = false; //判断窗帘是否控制成功 |
| | | // public static boolean isACCtrlSuccess = false; //判断空调是否控制成功 |
| | | // public static boolean isSceneCtrlSuccess = false; //判断场景是否控制成功 |
| | | |
| | | // public static boolean isSecurityCtrlSuccess = false; //判断安防模块是否通信成功 |
| | | |
| | | public static boolean isGetBusLightState = false; |
| | | public static boolean isGetSceneRemarkSuccess = false; //判断获取场景详情成功 |
| | | public static boolean isSceneCtrlSuccess = false; //判断场景是否控制成功 |
| | | |
| | | /** |
| | | * 初始化 SDK HDLDeviceManager初始化 |
| | |
| | | } |
| | | } |
| | | |
| | | public static boolean getIsGetBusLightState() { |
| | | return isGetBusLightState; |
| | | } |
| | | |
| | | public static void setIsGetBusLightState(boolean isGetBusLightState) { |
| | | HDLDeviceManager.isGetBusLightState = isGetBusLightState; |
| | | } |
| | | |
| | | /** |
| | | * 释放关闭串口 |
| | | */ |
| | |
| | | * @param commandType 命令类型 |
| | | */ |
| | | public static void handle(UdpDataBean getDatas, int commandType) { |
| | | Log.e("panlili", "commandType=" + Integer.toHexString(commandType)+" desDeviceID=" + getDatas.desDeviceID + " sourceDeviceID=" + getDatas.sourceDeviceID); |
| | | // Log.e("panlili", "commandType=" + Integer.toHexString(commandType) + " sourceSubnetID=" + getDatas.sourceSubnetID + " sourceDeviceID=" + getDatas.sourceDeviceID); |
| | | switch (commandType) { |
| | | case Configuration.DEVICES_SEARCH_BACK_COMMAND: |
| | | if (HandleSearch.isGetRcuIp) { |
| | | // handleRcuIp(getDatas); |
| | | } else { |
| | | boolean isExit = false; |
| | | for (DevicesData value : realDevicesDataList) { |
| | | if (value.getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && value.getSourceSubnetID() == getDatas.sourceSubnetID) { |
| | | HDLLog.I("Device is Exit " + value.getRemark()); |
| | | isExit = true; |
| | | case Configuration.SEARCH_GATEWAY_BACK_COMMAND: |
| | | break; |
| | | } |
| | | } |
| | | if (!isExit) { |
| | | case Configuration.DEVICES_SEARCH_FROM_GATEWAY_BACK_COMMAND://读取网关已配置功能 |
| | | handleSearchData(getDatas); |
| | | break; |
| | | case Configuration.DEVICES_READ_FROM_GATEWAY_BACK_COMMAND://依次读取设备信息 |
| | | if (isLogicCtrl) { |
| | | isLogicCtrl = false; |
| | | handleLogicAir(getDatas); |
| | | } else { |
| | | handleRemarkCurStateData(getDatas); |
| | | } |
| | | } |
| | | break; |
| | | case Configuration.SCENE_SEARCH_FROM_GATEWAY_BACK_COMMAND: |
| | | handleSearchSceneData(getDatas); |
| | | break; |
| | | case Configuration.SCENE_READ_FROM_GATEWAY_BACK_COMMAND: |
| | | handleSceneCurStateData(getDatas); |
| | | break; |
| | | /***2020-07-20 新增新风设备**/ |
| | | case Configuration.FRESH_AIR_STATE_BACK_COMMAND: |
| | |
| | | case Configuration.LIGHT_CTRL_BACK_COMMAND: |
| | | case Configuration.CURTAIN_CTRL_BACK_COMMAND: |
| | | case Configuration.AIR_CTRL_BACK_COMMAND: |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | handleCtrlData(getDatas); |
| | | break; |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | handleLogicCtrlData(getDatas);//逻辑模块控制 |
| | | handleSceneCtrlData(getDatas);//场景控制 |
| | | break; |
| | | case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND: |
| | | handleColourLightStateData(getDatas); |
| | |
| | | case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://报警设置反馈 |
| | | handleSecurityCtrlData(getDatas); |
| | | break; |
| | | // 获取设备备注 |
| | | case Configuration.DEVICES_READ_BACK_COMMAND: |
| | | if (isLogicCtrl) { |
| | | isLogicCtrl = false; |
| | | handleLogicAir(getDatas); |
| | | } else { |
| | | handleRemarkCurStateData(getDatas); |
| | | } |
| | | break; |
| | | // 获取设备状态 |
| | | case Configuration.AIR_STATE_BACK_COMMAND: |
| | | handleAirStateData(getDatas); |
| | |
| | | case Configuration.SENSOR_STATE_BACK_COMMAND: |
| | | case Configuration.SENSOR_BROADCAST_STATE_BACK_COMMAND: |
| | | handleSensorBroadcastStateData(getDatas); |
| | | handleKNXTechSysStateData(getDatas); |
| | | break; |
| | | case Configuration.DRY_CONTACT_STATE_BACK_COMMAND: |
| | | case Configuration.DRY_CONTACT_BROADCAST_STATE_COMMAND: |
| | |
| | | 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.MANUAL_ADD_DEVICE_COMMAND: |
| | | boolean isExit = false; |
| | | for (DevicesData value : realDevicesDataList) { |
| | | if (value.getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && value.getSourceSubnetID() == getDatas.sourceSubnetID) { |
| | | if (value.getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && value.getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && value.getDeviceSubnetID() == (getDatas.addBytes[6] & 0xFF) |
| | | && value.getDeviceDeviceID() == (getDatas.addBytes[7] & 0xFF)) { |
| | | isExit = true; |
| | | break; |
| | | } |
| | |
| | | devicesData.setSourceSubnetID(getDatas.sourceSubnetID); |
| | | devicesData.setSourceDeviceID(getDatas.sourceDeviceID); |
| | | devicesData.setAddByte(getDatas.addBytes); |
| | | byte[] remarkByte; |
| | | if (getDatas.addBytes.length >= 22) { |
| | | remarkByte = new byte[20]; |
| | | System.arraycopy(getDatas.addBytes, 2, remarkByte, 0, remarkByte.length); |
| | | } else { |
| | | remarkByte = new byte[getDatas.addBytes.length - 2]; |
| | | System.arraycopy(getDatas.addBytes, 2, remarkByte, 0, getDatas.addBytes.length - 2); |
| | | } |
| | | |
| | | int size = (getDatas.addBytes[2] & 0xFF) * 256 + (getDatas.addBytes[3] & 0xFF); |
| | | int index = (getDatas.addBytes[4] & 0xFF) * 256 + (getDatas.addBytes[5] & 0xFF); |
| | | devicesData.setDeviceSize(size); |
| | | totalDeviceSize = size; |
| | | devicesData.setDeviceIndex(index); |
| | | |
| | | byte[] remarkByte = new byte[getDatas.addBytes.length]; |
| | | String remarkStr = HDLStringUtils.byte2String(remarkByte); |
| | | HDLLog.I("remarkStr:" + remarkStr); |
| | | devicesData.setRemark(remarkStr); |
| | | |
| | | boolean isExitData = DeviceParser.parse(getDatas.addBytes, devicesData, remarkStr); |
| | | |
| | | boolean isExist = false; |
| | | for (DevicesData value : realDevicesDataList) { |
| | | if (value.getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && value.getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && value.getDeviceSubnetID() == (getDatas.addBytes[6] & 0xFF) |
| | | && value.getDeviceDeviceID() == (getDatas.addBytes[7] & 0xFF)) { |
| | | HDLLog.I("Device is isExist " + value.getRemark()); |
| | | isExist = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!isExist) { |
| | | realDevicesDataList.add(devicesData);//记录所有的接收到设备,包括SDK不支持的设备种类。作用:作为发送第二次搜索命令时用到 |
| | | HDLLog.I("---totalDeviceSize=" + totalDeviceSize + " realDevicesDataList=" + realDevicesDataList.size()); |
| | | } |
| | | |
| | | /********************辅助调试打印*******************/ |
| | | String addData = ""; |
| | | for (int i = 22, len = getDatas.addBytes.length; i < len; i++) { |
| | | for (int i = 0, len = getDatas.addBytes.length; i < len; i++) { |
| | | addData += " arr" + i + " = " + (getDatas.addBytes[i] & 0xFF) + ","; |
| | | } |
| | | HDLLog.I("所有设备列表 第 " + realDevicesDataList.size() + " 个模块 " |
| | |
| | | |
| | | |
| | | // 判断是否符合要求的大类小类 |
| | | if (isExitData) { |
| | | if (!isExist && isExitData) { |
| | | devicesDataList.add(devicesData);//记录所有的接收到设备,不包括SDK不支持的设备种类 |
| | | /**2019-07-03 发现新设备,这里可以发送通知事件,并传递新的设备数据*/ |
| | | EventBus.getDefault().post(new DiscoverNewDevicesEvent(devicesData)); |
| | |
| | | listRemarks.add(listRemarksTemp); |
| | | } |
| | | } |
| | | |
| | | // HDLCommand.HDLgetDevRemarks(devicesDataList.get(devicesDataList.size()-1).getAppliancesInfoList()); |
| | | |
| | | /********************辅助调试打印*******************/ |
| | | String deviceName = ""; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理搜索场景数据 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleSearchSceneData(UdpDataBean getDatas) { |
| | | int size = getDatas.addBytes[0] * 256 + getDatas.addBytes[1]; |
| | | |
| | | /********************辅助调试打印*******************/ |
| | | for (int i = 0, len = size; i < len; i++) { |
| | | ScenesData scenesData = new ScenesData(); |
| | | scenesData.setSourceSubnetID(getDatas.sourceSubnetID); |
| | | scenesData.setSourceDeviceID(getDatas.sourceDeviceID); |
| | | scenesData.setAddByte(getDatas.addBytes); |
| | | scenesData.setIndex(i + 1); |
| | | scenesDataList.add(scenesData); |
| | | HDLLog.I("所有场景列表 第 " + scenesDataList.size() + " 个模块 " |
| | | + " \n源子网号 = " + (getDatas.sourceSubnetID) |
| | | + " \n源设备号 = " + (getDatas.sourceDeviceID) |
| | | + " \n场景索引 = " + scenesData.getIndex() |
| | | ); |
| | | } |
| | | |
| | | /********************辅助调试打印*******************/ |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理灯光返回 |
| | | * 2020-1-18 |
| | | * 修复混合调光混合开关 类模块问题 |
| | |
| | | private static void handleLightCtrlData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | switch (getDatas.command) { |
| | | case Configuration.LIGHT_CTRL_BACK_COMMAND: |
| | | handleLightCtrlData(getDatas); |
| | | |
| | | if (!HDLDeviceManager.isGetBusLightState) { |
| | | isGetDeviceStateSuccess = true; |
| | | } |
| | | break; |
| | | case Configuration.CURTAIN_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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | inner: |
| | |
| | | curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks()); |
| | | curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks()); |
| | | curtainCtrlBackInfo.setAppliancesInfo(curtainInfo); |
| | | // isCurtainCtrlSuccess = true; |
| | | setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); |
| | | |
| | | if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO |
| | | || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER) { |
| | | || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER |
| | | || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_SHANGRILA) { |
| | | if ((getDatas.addBytes[0] & 0xFF) >= 17) { |
| | | int curState = getDatas.addBytes[1] & 0xFF; |
| | | int curState = getDatas.addBytes[1] & 0xFF;//V1.0百分比 |
| | | if (curState == 1) { |
| | | //这个判断很傻,窗帘关到百分比为0,会跳到1返回回来,只能强制改为0 |
| | | curState = 0; |
| | |
| | | curState = 100; |
| | | } |
| | | curtainCtrlBackInfo.setState(curState); |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(curState); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(curState); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16); |
| | | EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true)); |
| | | } else { |
| | | if (getDatas.addBytes.length >= 3) { |
| | | curtainCtrlBackInfo = new CurtainCtrlBackInfo(devicesDataList.get(i).getAppliancesInfoList().get(j)); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF); |
| | | EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true)); |
| | | } |
| | | } |
| | | if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) { |
| | | } else if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) { |
| | | if ((getDatas.addBytes[0] & 0xFF) < 17) { |
| | | int state = getDatas.addBytes[1] & 0xFF; |
| | | switch (getDatas.addBytes[1] & 0xFF) {//这里也应该改成0,1,2 |
| | | switch (state) {//这里也应该改成0,1,2 |
| | | case 0: |
| | | state = CurtainCtrlParser.curtainPause; |
| | | break; |
| | |
| | | curtainCtrlBackInfo.setState(state); |
| | | curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(state); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true)); |
| | | } |
| | | } |
| | | |
| | | |
| | | break outter; |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | case Configuration.AIR_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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理逻辑 控制回调 |
| | | * 2024-1-19 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleLogicCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | outter: |
| | | if (devicesDataList != null && devicesDataList.size() != 0) { |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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.LOGIC_BIG_TYPE |
| | | || infos.get(j).getBigType() == Configuration.GLOBAL_LOGIC_BIG_TYPE) |
| | | && infos.get(j).getLogicMode().getAreaNum() == (getDatas.addBytes[0] & 0xFF) |
| | | && infos.get(j).getLogicMode().getAreaSceneNum() == (getDatas.addBytes[1] & 0xFF) |
| | | ) { |
| | | && infos.get(j).getLogicMode().getAreaSceneNum() == (getDatas.addBytes[1] & 0xFF)) { |
| | | AppliancesInfo sceneInfo = infos.get(j); |
| | | LogicMode logicMode = new LogicMode(); |
| | | logicMode.setAreaNum(getDatas.addBytes[0] & 0xFF); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理场景 控制回调 |
| | | * 2024-1-19 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleSceneCtrlData(UdpDataBean getDatas) { |
| | | switch (getDatas.command) { |
| | | case Configuration.LOGIC_CTRL_BACK_COMMAND: |
| | | outter: |
| | | if (scenesDataList != null && scenesDataList.size() != 0) { |
| | | for (int i = 0, len = scenesDataList.size(); i < len; i++) { |
| | | if (scenesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && scenesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && scenesDataList.get(i).getAreaCodeID() == (getDatas.addBytes[0] & 0xFF) |
| | | && scenesDataList.get(i).getSceneID() == (getDatas.addBytes[1] & 0xFF)) { |
| | | |
| | | SceneCtrlBackInfo sceneCtrlBackInfo = new SceneCtrlBackInfo(); |
| | | sceneCtrlBackInfo.setAreaCodeID(getDatas.addBytes[0] & 0xFF); |
| | | sceneCtrlBackInfo.setSceneID(getDatas.addBytes[1] & 0xFF); |
| | | sceneCtrlBackInfo.setLoopNum(getDatas.addBytes[2] & 0xFF); |
| | | |
| | | setSceneCtrlSuccess(true); |
| | | EventBus.getDefault().post(new SceneFeedBackEvent(sceneCtrlBackInfo, true)); |
| | | |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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) { |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS |
| | | || infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | |
| | | private static void handleLogicAir(UdpDataBean getDatas) { |
| | | AppliancesInfo newInfo1 = null; |
| | | for (int devPos = 0, len = devicesDataList.size(); devPos < len; devPos++) { |
| | | if (devicesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | if (devicesDataList.get(devPos).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(devPos).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(devPos).getAppliancesInfoList(); |
| | | for (int appPos = 0, len2 = infos.size(); appPos < len2; appPos++) { |
| | |
| | | outter: |
| | | for (int devPos = 0, len = devicesDataList.size(); devPos < len; devPos++) { |
| | | if (devicesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(devPos).getAppliancesInfoList(); |
| | | for (int appPos = 0, len2 = infos.size(); appPos < len2; appPos++) { |
| | | if ((infos.get(appPos).getBigType()) == (getDatas.addBytes[0] & 0xFF) |
| | | && ((infos.get(appPos).getLittleType()) == (getDatas.addBytes[1] & 0xFF)) |
| | | if ((infos.get(appPos).getDeviceSubnetID()) == (getDatas.addBytes[0] & 0xFF) |
| | | && (infos.get(appPos).getDeviceDeviceID()) == (getDatas.addBytes[1] & 0xFF) |
| | | && ((infos.get(appPos).getChannelNum()) == (getDatas.addBytes[2] & 0xFF)) |
| | | ) { |
| | | && (infos.get(appPos).getBigType()) == (getDatas.addBytes[3] & 0xFF) |
| | | && ((infos.get(appPos).getLittleType()) == (getDatas.addBytes[4] & 0xFF))) { |
| | | |
| | | //2019-8-20 |
| | | //2023-11-30 |
| | | byte[] remarkByte; |
| | | if (getDatas.addBytes.length >= 23) { |
| | | if (getDatas.addBytes.length >= 26) { |
| | | remarkByte = new byte[20]; |
| | | System.arraycopy(getDatas.addBytes, 3, remarkByte, 0, remarkByte.length); |
| | | System.arraycopy(getDatas.addBytes, 6, remarkByte, 0, remarkByte.length); |
| | | } else { |
| | | remarkByte = new byte[getDatas.addBytes.length - 3]; |
| | | System.arraycopy(getDatas.addBytes, 3, remarkByte, 0, getDatas.addBytes.length - 3); |
| | | System.arraycopy(getDatas.addBytes, 6, remarkByte, 0, getDatas.addBytes.length - 3); |
| | | } |
| | | |
| | | String remarkStr = HDLStringUtils.byte2String(remarkByte); |
| | | HDLLog.I("remarkStr回路:" + remarkStr); |
| | | HDLLog.I("remarkStr获取的备注名为:" + remarkStr); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[5] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setRemarks(remarkStr); |
| | | |
| | | switch (infos.get(appPos).getBigType()) { |
| | | case Configuration.LOGIC_BIG_TYPE: |
| | | case Configuration.GLOBAL_LOGIC_BIG_TYPE: |
| | | LogicMode logicMode = new LogicMode(); |
| | | logicMode.setAreaNum(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | logicMode.setAreaSceneNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | String key = "K" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getBigType() |
| | | + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getLittleType() |
| | | + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getDeviceSubnetID() |
| | | + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getDeviceDeviceID() |
| | | + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getChannelNum(); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setDeviceKey(key); |
| | | |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setLogicMode(logicMode); |
| | | |
| | | break; |
| | | case Configuration.LIGTH_BIG_TYPE: |
| | | switch (infos.get(appPos).getLittleType()) { |
| | | case 0: |
| | | 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; |
| | | case 1: |
| | | 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; |
| | | case 9: |
| | | RcuLight rcuLight = new RcuLight(); |
| | | rcuLight.setPhysicsChanelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | rcuLight.setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | rcuLight.setLittleType(9); |
| | | rcuLightList.add(rcuLight); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setPhysicsChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | break; |
| | | case 10: |
| | | RcuLight rcu2Light = new RcuLight(); |
| | | rcu2Light.setPhysicsChanelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | rcu2Light.setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | rcu2Light.setLittleType(10); |
| | | rcuLightList.add(rcu2Light); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setPhysicsChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF); |
| | | break; |
| | | |
| | | } |
| | | break; |
| | | case Configuration.CURTAIN_BIG_TYPE: |
| | | int curtainState; |
| | | switch (infos.get(appPos).getLittleType()) { |
| | | case 0: |
| | | curtainState = getDatas.addBytes[25] & 0xFF; |
| | | if (curtainState == 1) { |
| | | curtainState = 0; |
| | | } else if (curtainState == 99) { |
| | | curtainState = 100; |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curtainState); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState); |
| | | break; |
| | | case 1: |
| | | curtainState = getDatas.addBytes[23] & 0xFF; |
| | | if (curtainState == 1) { |
| | | curtainState = 0; |
| | | } else if (curtainState == 99) { |
| | | curtainState = 100; |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curtainState); |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState); |
| | | break; |
| | | case 2: |
| | | 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; |
| | | |
| | | case Configuration.AIR_BIG_TYPE: |
| | | switch (infos.get(appPos).getLittleType()) { |
| | | case 0: |
| | | byte[] hvacBytes = new byte[getDatas.addBytes.length - 23]; |
| | | for (int i = 23; i < getDatas.addBytes.length; i++) { |
| | | hvacBytes[i - 23] = getDatas.addBytes[i]; |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(hvacBytes); |
| | | break; |
| | | case 3: |
| | | byte[] newBytes = new byte[getDatas.addBytes.length - 24 + 1]; |
| | | for (int i = 24; i < getDatas.addBytes.length; i++) { |
| | | newBytes[i - 24] = getDatas.addBytes[i]; |
| | | } |
| | | devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(newBytes); |
| | | break; |
| | | } |
| | | break; |
| | | case Configuration.SENSOR_BIG_TYPE: |
| | | int curState; |
| | | if (getDatas.addBytes.length >= 26) {//2023-11-14 特殊处理,修改回路号为物理回路(因为ZigBee转bus转换器用的都是物理回路,将逻辑回路设为物理回路处理) |
| | | curState = (int) (getDatas.addBytes[24] & 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; |
| | | } |
| | | listRemarksOutter: |
| | | for (int lRPos = 0, len3 = listRemarks.size(); lRPos < len3; lRPos++) { |
| | | //找到E44B对应的设备回路,判断是否已经拿到了数据。 |
| | | if (listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getBigType() == (getDatas.addBytes[0] & 0xFF) |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getLittleType() == (getDatas.addBytes[1] & 0xFF) |
| | | //找到F44B对应的设备回路,判断是否已经拿到了数据。 |
| | | if (listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() == (getDatas.addBytes[0] & 0xFF) |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() == (getDatas.addBytes[1] & 0xFF) |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getChannelNum() == (getDatas.addBytes[2] & 0xFF) |
| | | ) { |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getBigType() == (getDatas.addBytes[3] & 0xFF) |
| | | && listRemarks.get(lRPos).getAppliancesInfo().getLittleType() == (getDatas.addBytes[4] & 0xFF)) { |
| | | |
| | | |
| | | //若没拿到数据,则拿数据;若已经拿到数据,需要判断listRemarks全部条目是否拿到备注。 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理所有场景详情数据、设置当前场景状态 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleSceneCurStateData(UdpDataBean getDatas) { |
| | | outter: |
| | | for (int devPos = 0, len = scenesDataList.size(); devPos < len; devPos++) { |
| | | if (scenesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && scenesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | && scenesDataList.get(devPos).getIndex() == (getDatas.addBytes[0] * 256 + getDatas.addBytes[1])) { |
| | | //2024-01-18 |
| | | byte[] remarkByte; |
| | | String remarkStr = ""; |
| | | if (getDatas.addBytes.length >= 36) { |
| | | remarkByte = new byte[32]; |
| | | System.arraycopy(getDatas.addBytes, 4, remarkByte, 0, remarkByte.length); |
| | | remarkStr = HDLStringUtils.byte2String(remarkByte); |
| | | } |
| | | |
| | | HDLLog.I("remarkStr获取的场景备注名为:" + remarkStr); |
| | | scenesDataList.get(devPos).setAreaCodeID(getDatas.addBytes[2] & 0xFF); |
| | | scenesDataList.get(devPos).setSceneID(getDatas.addBytes[3] & 0xFF); |
| | | scenesDataList.get(devPos).setRemark(remarkStr); |
| | | |
| | | listRemarksOutter: |
| | | for (int lRPos = 0, len3 = scenesDataList.size(); lRPos < len3; lRPos++) { |
| | | //找到F44B对应的设备回路,判断是否已经拿到了数据。 |
| | | if (scenesDataList.get(lRPos).getAreaCodeID() == (getDatas.addBytes[2] & 0xFF) |
| | | && scenesDataList.get(lRPos).getSceneID() == (getDatas.addBytes[3] & 0xFF)) { |
| | | |
| | | //若没拿到数据,则拿数据;若已经拿到数据,需要判断listRemarks全部条目是否拿到备注。 |
| | | if (scenesDataList.get(lRPos).isCallBack()) { |
| | | for (int lR2Pos = 0, len4 = scenesDataList.size(); lR2Pos < len4; lR2Pos++) { |
| | | if (scenesDataList.get(lR2Pos).isCallBack()) { |
| | | if (lR2Pos == (len4 - 1)) { |
| | | HDLLog.I("收到备注命令,已存在此场景备注,过滤"); |
| | | break listRemarksOutter; |
| | | } |
| | | } else { |
| | | HDLLog.I("不存在的场景备注,再次搜索备注。区号:" + scenesDataList.get(lRPos).getAreaCodeID() |
| | | + ",场景号:" + scenesDataList.get(lRPos).getSceneID()); |
| | | HandleSearch.getSceneDetails(); |
| | | break listRemarksOutter; |
| | | } |
| | | } |
| | | } else { |
| | | HDLLog.I("返回备注场景:区号:" + scenesDataList.get(lRPos).getAreaCodeID() |
| | | + ",场景号:" + scenesDataList.get(lRPos).getSceneID()); |
| | | scenesDataList.get(lRPos).setCallBack(true); |
| | | HandleSearch.getSceneDetails(); |
| | | break listRemarksOutter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | break outter; |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理修改设备备注后的回调 |
| | | * |
| | | * @param getDatas |
| | |
| | | private static void handleStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value); |
| | | |
| | | sensorInfo.setCurState(value); |
| | | |
| | | |
| | | String unite = ""; |
| | | switch (sensorInfo.getDeviceType()) { |
| | |
| | | unite = ""; |
| | | break; |
| | | case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5: |
| | | case HDLApConfig.TYPE_SENSOR_PM_10: |
| | | switch (getDatas.addBytes[4] & 0xff) { |
| | | case 0: |
| | | unite = "mg/m3"; |
| | |
| | | unite = "未知单位"; |
| | | break; |
| | | } |
| | | |
| | | |
| | | // EventBus.getDefault().post(new DeviceStateEvent(sensorInfo, true)); |
| | | HDLLog.I("发送传感器通知更新"); |
| | | EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理传感器 广播数据 |
| | | * 2019-11-4 新修改 |
| | | * 处理传感器 状态读取、广播数据 |
| | | * 2024-2-2 新支持 |
| | | * |
| | | * @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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[2] & 0xFF)) {//2019-07-29 |
| | | isGetDeviceStateSuccess = true; |
| | | AppliancesInfo sensorInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | float value = HDLUtlis.byte2Float(Arrays.copyOfRange(getDatas.addBytes, 5, 8)); |
| | | float value = 0; |
| | | if ((getDatas.addBytes[3] & 0xFF) == 1 || (getDatas.addBytes[3] & 0xFF) == 2) {//整型 |
| | | value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9)); |
| | | } else if ((getDatas.addBytes[3] & 0xFF) == 3) {//浮点型 |
| | | value = HDLUtlis.byteToFloat(getDatas.addBytes[5], getDatas.addBytes[6], getDatas.addBytes[7], getDatas.addBytes[8]); |
| | | } |
| | | |
| | | Log.d("panlili", "HDLDeviceManager.java:handleSensorBroadcastStateData----->value= " + value); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(value); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value); |
| | | |
| | |
| | | unite = ""; |
| | | break; |
| | | case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5: |
| | | case HDLApConfig.TYPE_SENSOR_PM_10: |
| | | switch (getDatas.addBytes[4] & 0xff) { |
| | | case 0: |
| | | unite = "mg/m3"; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理KNX科技希桐 状态读取、广播数据 |
| | | * 2024-5-28 新支持 |
| | | * |
| | | * @param getDatas |
| | | */ |
| | | private static void handleKNXTechSysStateData(UdpDataBean getDatas) { |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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).getLittleType() == 101 |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[2] & 0xFF)) { |
| | | |
| | | AppliancesInfo info = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | info.setGetDeviceStateSuccess(true); |
| | | float value = 0; |
| | | //00014 2024年5月29日9:44:03:806: 14 64 C8 11 F7 35 3A FF FF 05 03 01 03 00 00 00 00 36 53 81 |
| | | if ((getDatas.addBytes[3] & 0xFF) == 1 || (getDatas.addBytes[3] & 0xFF) == 2) {//整型 |
| | | value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9)); |
| | | } else if ((getDatas.addBytes[3] & 0xFF) == 3) {//浮点型 |
| | | // value = HDLUtlis.byteToFloat(getDatas.addBytes[8], getDatas.addBytes[7], getDatas.addBytes[6], getDatas.addBytes[5]); |
| | | value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9)); |
| | | } |
| | | Log.d("panlili", "HDLDeviceManager.java:handleKNXTechSysStateData----->value= " + value); |
| | | |
| | | AirTechSysBackInfo mAirTechSysBackInfo = new AirTechSysBackInfo(info); |
| | | mAirTechSysBackInfo.setIndoorHumidity(value + "");//设置湿度 |
| | | |
| | | EventBus.getDefault().post(new AirTechSysFeedBackEvent(mAirTechSysBackInfo, true)); |
| | | HDLLog.I("发送科技系统湿度通知更新"); |
| | | |
| | | break outter; |
| | | } else { |
| | | HDLLog.I("handle state 没有找到匹配类型"); |
| | | } |
| | | } |
| | | break outter; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * panlili |
| | | * 处理门锁状态和报警 广播数据 |
| | | * |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | private static void handleLightStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | private static void handleCurtainBroadcastStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | private static void handleCurtainStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | int state = 0; |
| | | if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE//窗帘模块 |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17 |
| | | |
| | | switch (getDatas.addBytes[1] & 0xFF) {//这里也应该改成0,1,2 |
| | | case 0: |
| | | state = CurtainCtrlParser.curtainPause; |
| | |
| | | EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true)); |
| | | |
| | | break outter; |
| | | } else if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER) { |
| | | } else if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER |
| | | || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_SHANGRILA) { |
| | | |
| | | if (getDatas.addBytes.length >= 3) {//新协议拓展字段 |
| | | if ((getDatas.addBytes[0] & 0xFF) >= 17 |
| | | && ((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {//窗帘号大于等于17 减 16 = 当前窗帘回路号 |
| | | state = getDatas.addBytes[1] & 0xFF; |
| | | if (state == 1) { |
| | | state = 0;//这个判断是将百分比为1,强制改为0. |
| | | } |
| | | if (state == 99) { |
| | | state = 100;//这个判断是将百分比为99,强制改为100. |
| | | } |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | |
| | | AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | |
| | | CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo(); |
| | | curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks()); |
| | | curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks()); |
| | | curtainCtrlBackInfo.setAppliancesInfo(curtainInfo); |
| | | curtainInfo.setCurState(state); |
| | | |
| | | curtainCtrlBackInfo.setState(state); |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16); |
| | | |
| | | EventBus.getDefault().post(new CurtainDeviceStateEvent(curtainCtrlBackInfo, true)); |
| | | break outter; |
| | | } else { |
| | | if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) { |
| | | isGetDeviceStateSuccess = true; |
| | | |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes); |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | | AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); |
| | | CurtainCtrlBackInfo info = new CurtainCtrlBackInfo(appliancesInfo); |
| | | EventBus.getDefault().post(new CurtainDeviceStateEvent(info, true)); |
| | | } |
| | | } |
| | | } else {//兼容旧协议 |
| | | if ((getDatas.addBytes[0] & 0xFF) >= 17 |
| | | && ((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {//窗帘号大于等于17 减 16 = 当前窗帘回路号 |
| | | state = getDatas.addBytes[1] & 0xFF; |
| | |
| | | EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true)); |
| | | break outter; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } else { |
| | | HDLLog.I("handleCurtainStateData 没有找到匹配类型"); |
| | |
| | | private static void handleAirStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | private static void handleLOGICStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | private static void handleHVACStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS |
| | | || infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-8-6 |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | |
| | | private static void handleDryContactBroadcastStateData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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.SENSOR_BIG_TYPE |
| | | && infos.get(j).getChannelNum() == ((getDatas.addBytes[1] & 0xFF) - 1)) {//2019-07-29 |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) { |
| | | if (getDatas.addBytes.length >= 3) { |
| | | isGetDeviceStateSuccess = true; |
| | | int state = getDatas.addBytes[2] & 0xFF; |
| | |
| | | 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) { |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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) { |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 读取HVAC状态反馈 |
| | | // * |
| | | // * @param getDatas |
| | | // */ |
| | | // private static void handleHVACStateData(UdpDataBean getDatas) { |
| | | // int count = getDatas.addBytes.length / 11; |
| | | // |
| | | // for (int airIndex = 0; airIndex < count; airIndex++) { |
| | | // outter: |
| | | // for (int indexI = 0, len = devicesDataList.size(); indexI < len; indexI++) { |
| | | // if (devicesDataList.get(indexI).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | // && devicesDataList.get(indexI).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | // ) { |
| | | // List<AppliancesInfo> infos = devicesDataList.get(indexI).getAppliancesInfoList(); |
| | | // for (int indexJ = 0, len2 = infos.size(); indexJ < len2; indexJ++) { |
| | | // if (infos.get(indexJ).getBigType() == Configuration.AIR_BIG_TYPE |
| | | // && infos.get(indexJ).getDeviceType() != HDLApConfig.TYPE_AC_PANEL |
| | | // && infos.get(indexJ).getChannelNum() == (getDatas.addBytes[airIndex * 11] & 0xFF)) { |
| | | // AppliancesInfo appliancesInfo = devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ); |
| | | // |
| | | // switch (getDatas.addBytes[airIndex * 11] & 0xff) { |
| | | // case 1: |
| | | // handleAirCastData(getDatas, air1Info, airIndex, appliancesInfo); |
| | | // air1Info[0] = getDatas.addBytes[1 + 0 * 11]; |
| | | // air1Info[1] = (byte) ((getDatas.addBytes[3 + 0 * 11] & 0xf0) >> 4); |
| | | // switch (air1Info[0] & 0xff) { |
| | | // case 0: |
| | | // air1Info[2] = getDatas.addBytes[2 + 0 * 11]; |
| | | // break; |
| | | // case 1: |
| | | // air1Info[2] = getDatas.addBytes[6 + 0 * 11]; |
| | | // break; |
| | | // case 3: |
| | | // air1Info[2] = getDatas.addBytes[8 + 0 * 11]; |
| | | // break; |
| | | // case 4: |
| | | // air1Info[2] = getDatas.addBytes[9 + 0 * 11]; |
| | | // break; |
| | | // |
| | | // } |
| | | // |
| | | // air1Info[3] = (byte) (getDatas.addBytes[3 + 0 * 11] & 0x0f); |
| | | // air1Info[4] = getDatas.addBytes[5 + 0 * 11]; |
| | | // air1Info[5] = getDatas.addBytes[10 + 0 * 11]; |
| | | //// HDLLog.info( "209a air1Info = " + air1Info[0] + " " + air1Info[1] + " " + air1Info[2] + " " + air1Info[3] + " " + air1Info[4] + " " + air1Info[5]); |
| | | //// String arrString = "209a 附加数据:"; |
| | | //// for (int i = 0; i < getDatas.addBytes.length; i++) { |
| | | //// arrString += (getDatas.addBytes[i] & 0xff) + ","; |
| | | //// } |
| | | //// HDLLog.info( arrString); |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air1Info); |
| | | // break; |
| | | // case 2: |
| | | // handleAirCastData(getDatas, air2Info, airIndex, appliancesInfo); |
| | | // air2Info[0] = getDatas.addBytes[1 + 1 * 11]; |
| | | // air2Info[1] = (byte) ((getDatas.addBytes[3 + 1 * 11] & 0xf0) >> 4); |
| | | // switch (air2Info[0] & 0xff) { |
| | | // case 0: |
| | | // air2Info[2] = getDatas.addBytes[2 + 1 * 11]; |
| | | // break; |
| | | // case 1: |
| | | // air2Info[2] = getDatas.addBytes[6 + 1 * 11]; |
| | | // break; |
| | | // case 3: |
| | | // air2Info[2] = getDatas.addBytes[8 + 1 * 11]; |
| | | // break; |
| | | // case 4: |
| | | // air2Info[2] = getDatas.addBytes[9 + 1 * 11]; |
| | | // break; |
| | | // |
| | | // } |
| | | // air2Info[3] = (byte) (getDatas.addBytes[3 + 1 * 11] & 0x0f); |
| | | // air2Info[4] = getDatas.addBytes[5 + 1 * 11]; |
| | | // air2Info[5] = getDatas.addBytes[10 + 1 * 11]; |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air2Info); |
| | | // break; |
| | | // case 3: |
| | | // handleAirCastData(getDatas, air3Info, airIndex, appliancesInfo); |
| | | // air3Info[0] = getDatas.addBytes[1 + 2 * 11]; |
| | | // air3Info[1] = (byte) ((getDatas.addBytes[3 + 2 * 11] & 0xf0) >> 4); |
| | | // switch (air3Info[0] & 0xff) { |
| | | // case 0: |
| | | // air3Info[2] = getDatas.addBytes[2 + 2 * 11]; |
| | | // break; |
| | | // case 1: |
| | | // air3Info[2] = getDatas.addBytes[6 + 2 * 11]; |
| | | // break; |
| | | // case 3: |
| | | // air3Info[2] = getDatas.addBytes[8 + 2 * 11]; |
| | | // break; |
| | | // case 4: |
| | | // air3Info[2] = getDatas.addBytes[9 + 2 * 11]; |
| | | // break; |
| | | // } |
| | | // air3Info[3] = (byte) (getDatas.addBytes[3 + 2 * 11] & 0x0f); |
| | | // air3Info[4] = getDatas.addBytes[5 + 2 * 11]; |
| | | // air3Info[5] = getDatas.addBytes[10 + 2 * 11]; |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air3Info); |
| | | // break; |
| | | // case 4: |
| | | // handleAirCastData(getDatas, air4Info, airIndex, appliancesInfo); |
| | | // air4Info[0] = getDatas.addBytes[1 + 3 * 11]; |
| | | // air4Info[1] = (byte) ((getDatas.addBytes[3 + 3 * 11] & 0xf0) >> 4); |
| | | // switch (air4Info[0] & 0xff) { |
| | | // case 0: |
| | | // air4Info[2] = getDatas.addBytes[2 + 3 * 11]; |
| | | // break; |
| | | // case 1: |
| | | // air4Info[2] = getDatas.addBytes[6 + 3 * 11]; |
| | | // break; |
| | | // case 3: |
| | | // air4Info[2] = getDatas.addBytes[8 + 3 * 11]; |
| | | // break; |
| | | // case 4: |
| | | // air4Info[2] = getDatas.addBytes[9 + 3 * 11]; |
| | | // break; |
| | | // } |
| | | // air4Info[3] = (byte) (getDatas.addBytes[3 + 3 * 11] & 0x0f); |
| | | // air4Info[4] = getDatas.addBytes[5 + 3 * 11]; |
| | | // air4Info[5] = getDatas.addBytes[10 + 3 * 11]; |
| | | // devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air4Info); |
| | | // break; |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 处理家居空调广播消息 |
| | | // * |
| | | // * @param getDatas |
| | | // * @param airInfo |
| | | // * @param airIndex |
| | | // * @param oldInfo |
| | | // */ |
| | | // private static void handleAirCastData(UdpDataBean getDatas, final byte[] airInfo, int airIndex, final AppliancesInfo oldInfo) { |
| | | // if (airInfo[0] != getDatas.addBytes[1 + airIndex * 11]) { |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.airSwich, airInfo[0]}); |
| | | //// HDLLog.info( "0x209A in 空调开关改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 500); |
| | | // } |
| | | // |
| | | //// HDLLog.info( "airIndex = " + airIndex + " 209a 模式值 = " + ((getDatas.addBytes[3 + airIndex * 11] & 0xf0) >> 4) + " 或 = " + ((getDatas.addBytes[7 + airIndex * 11] & 0xf0) >> 4)); |
| | | // if (airInfo[1] != (byte) ((getDatas.addBytes[3 + airIndex * 11] & 0xf0) >> 4)) { |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.airMode, airInfo[1]}); |
| | | //// HDLLog.info( "0x209A in 空调模式改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 1000); |
| | | // } |
| | | // |
| | | // |
| | | // switch (airInfo[1] & 0xff) { |
| | | // case 0: |
| | | // if (airInfo[2] != getDatas.addBytes[2 + airIndex * 11]) { |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.refTem, airInfo[2]}); |
| | | //// HDLLog.info( "0x209A in 空调温度改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 1500); |
| | | // } |
| | | // |
| | | // break; |
| | | // case 1: |
| | | // if (airInfo[2] != getDatas.addBytes[6 + airIndex * 11]) { |
| | | //// airInfo[2] = getDatas.addBytes[6 + airIndex * 11]; |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.heatTem, airInfo[2]}); |
| | | //// HDLLog.info( "0x209A in 空调温度改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 1500); |
| | | // } |
| | | // |
| | | // break; |
| | | // case 3: |
| | | // if (airInfo[2] != getDatas.addBytes[8 + airIndex * 11]) { |
| | | //// airInfo[2] = getDatas.addBytes[8 + airIndex * 11]; |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.autoTem, airInfo[2]}); |
| | | //// HDLLog.info( "0x209A in 空调温度改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 1500); |
| | | // } |
| | | // |
| | | // break; |
| | | // case 4: |
| | | // if (airInfo[2] != getDatas.addBytes[9 + airIndex * 11]) { |
| | | //// airInfo[2] = getDatas.addBytes[9 + airIndex * 11]; |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.dehumTem, airInfo[2]}); |
| | | //// HDLLog.info( "0x209A in 空调温度改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 1500); |
| | | // } |
| | | // |
| | | // break; |
| | | // } |
| | | // |
| | | //// HDLLog.info( "airInfo[3] = " + (airInfo[3] & 0xff) + " 第3位 低4位风速 = "+(getDatas.addBytes[3 + airIndex * 11] & 0x0f)); |
| | | //// HDLLog.info( "airInfo[3] = " + (airInfo[3] & 0xff) + " 第7位 低4位风速 = "+(getDatas.addBytes[7 + airIndex * 11] & 0x0f)); |
| | | // if (airInfo[3] != (byte) (getDatas.addBytes[3 + airIndex * 11] & 0x0f)) { |
| | | //// airInfo[3] = (byte) (getDatas.addBytes[3 + airIndex * 11] & 0x0f); |
| | | // |
| | | //// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // |
| | | // final AppliancesInfo newInfo = oldInfo; |
| | | // newInfo.setArrCurState(new byte[]{AirCtrlParser.airSpeed, airInfo[3]}); |
| | | //// HDLLog.info( "空调风速改变" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID() |
| | | //// + " devID = " + newInfo.getDeviceDeviceID() + " 回路号:" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType()); |
| | | //// HDLLog.info( "发送空调改变风速data = " + Arrays.toString(newInfo.getArrCurState())); |
| | | // EventBus.getDefault().post(new DeviceStateEvent(newInfo, true)); |
| | | // } |
| | | // }, 2000); |
| | | // } |
| | | // |
| | | // //室温、摆风没有返回。下个版本需要考虑 |
| | | // if (airInfo[4] != getDatas.addBytes[5 + airIndex * 11]) { |
| | | //// airInfo[4] = getDatas.addBytes[5 + airIndex * 11]; |
| | | // } |
| | | // |
| | | // if (airInfo[5] != getDatas.addBytes[10 + airIndex * 11]) { |
| | | //// airInfo[5] = getDatas.addBytes[10 + airIndex * 11]; |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 此方法基本没用到,逻辑模块的控制信息已经在handleCtrlData中处理过了 |
| | | * <p> |
| | |
| | | */ |
| | | private static void handleLogicData(UdpDataBean getDatas) { |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | |
| | | private static void handleAudioData(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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | */ |
| | | public static void setDeviceCtrlSuccessStateWithInfo(AppliancesInfo info, Boolean success) { |
| | | // if(info.getDeviceKey() == null) return; |
| | | |
| | | ctrlSuccessStateHashMap.put(info.getDeviceKey(), success); |
| | | } |
| | | |
| | |
| | | Boolean success = ctrlSuccessStateHashMap.get(info.getDeviceKey()); |
| | | if (success == null) success = false; |
| | | return success; |
| | | } |
| | | |
| | | public static boolean isSceneCtrlSuccess() { |
| | | return isSceneCtrlSuccess; |
| | | } |
| | | |
| | | public static void setSceneCtrlSuccess(boolean isSceneCtrlSuccess) { |
| | | HDLDeviceManager.isSceneCtrlSuccess = isSceneCtrlSuccess; |
| | | } |
| | | |
| | | /** |
| | |
| | | boolean bCanAdd = false; |
| | | outter: |
| | | for (int i = 0, len = devicesDataList.size(); i < len; i++) { |
| | | if (devicesDataList.get(i).getSourceSubnetID() == mSubnetID |
| | | && devicesDataList.get(i).getSourceDeviceID() == mDeviceID |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == mSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == mDeviceID |
| | | ) { |
| | | bExistSubnetID = true; |
| | | DevicesData mDevicesData = devicesDataList.get(i); |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == 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 |
| | | && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { |
| | | |
| | | isGetDeviceStateSuccess = true; |
| | | devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes); |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |
| | |
| | | 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 |
| | | if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID |
| | | && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID |
| | | ) { |
| | | List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); |
| | | for (int j = 0, len2 = infos.size(); j < len2; j++) { |