From 145de2dcd3124f236e7d06bcdee17c7be08048b1 Mon Sep 17 00:00:00 2001 From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com> Date: 星期一, 11 十一月 2024 18:34:13 +0800 Subject: [PATCH] 修改搜索按照index索引 --- HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java | 2220 +++++++++++++++++++++++++++++------------------------------ 1 files changed, 1,105 insertions(+), 1,115 deletions(-) diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java index b2ab1a2..6d8dfcc 100644 --- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java +++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java @@ -3,56 +3,76 @@ 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.HDLCommonSwitch.CommonSwitchBackInfo; -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.CommonSwitchCtrlBackEvent; -import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchStateBackEvent; -import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent; -import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode; -import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent; -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.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.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.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.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.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.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; @@ -77,22 +97,19 @@ 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; //鍒ゆ柇鏄惁涓嶮CU閫氫俊鎴愬姛 @@ -100,9 +117,12 @@ // 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鍒濆鍖� @@ -124,6 +144,14 @@ } } + public static boolean getIsGetBusLightState() { + return isGetBusLightState; + } + + public static void setIsGetBusLightState(boolean isGetBusLightState) { + HDLDeviceManager.isGetBusLightState = isGetBusLightState; + } + /** * 閲婃斁鍏抽棴涓插彛 */ @@ -138,24 +166,60 @@ * @param commandType 鍛戒护绫诲瀷 */ public static void handle(UdpDataBean getDatas, int commandType) { + 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); + case Configuration.SEARCH_GATEWAY_BACK_COMMAND: + break; + 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 { - 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; - break; - } - } - if (!isExit) { - handleSearchData(getDatas); - } + 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: + 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: @@ -168,44 +232,45 @@ 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); 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://鎶ヨ璁剧疆鍙嶉 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); break; case Configuration.SENSOR_STATE_BACK_COMMAND: - handleSensorBroadcastStateData(getDatas); - break; 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: 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; @@ -215,6 +280,7 @@ case Configuration.AIR_HVAC_STATE_BACK_COMMAND: // handleRcuAirCastData(getDatas); handleHVACStateData(getDatas);//2019-06-27 + handleTechSysStateData(getDatas);//2023-08-21 break; case Configuration.LOGIC_STATE_BACK_COMMAND: // handleRcuAirCastData(getDatas); @@ -243,8 +309,10 @@ 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; } @@ -314,31 +382,44 @@ * * @param getDatas */ - private static void handleSearchData(UdpDataBean getDatas) { + private static synchronized void handleSearchData(UdpDataBean getDatas) { DevicesData devicesData = new DevicesData(); 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); - realDevicesDataList.add(devicesData);//璁板綍鎵�鏈夌殑鎺ユ敹鍒拌澶囷紝鍖呮嫭SDK涓嶆敮鎸佺殑璁惧绉嶇被銆備綔鐢細浣滀负鍙戦�佺浜屾鎼滅储鍛戒护鏃剁敤鍒� + 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() + " 涓ā鍧� " @@ -352,22 +433,22 @@ // 鍒ゆ柇鏄惁绗﹀悎瑕佹眰鐨勫ぇ绫诲皬绫� - if (isExitData) { + if (!isExist && isExitData) { devicesDataList.add(devicesData);//璁板綍鎵�鏈夌殑鎺ユ敹鍒拌澶囷紝涓嶅寘鎷琒DK涓嶆敮鎸佺殑璁惧绉嶇被 /**2019-07-03 鍙戠幇鏂拌澶囷紝杩欓噷鍙互鍙戦�侀�氱煡浜嬩欢锛屽苟浼犻�掓柊鐨勮澶囨暟鎹�*/ EventBus.getDefault().post(new DiscoverNewDevicesEvent(devicesData)); -// 杩囨护鎺夎儗鏅煶涔愶紝鑳屾櫙闊充箰娌℃湁澶囨敞杩斿洖 - if (devicesDataList.get(devicesDataList.size() - 1).getAppliancesInfoList().get(0).getBigType() != Configuration.AUDIO_BIG_TYPE) { - for (int i = 0, len = devicesDataList.get(devicesDataList.size() - 1).getAppliancesInfoList().size(); i < len; i++) { + //杩囨护鎺夎儗鏅煶涔愶紝鑳屾櫙闊充箰娌℃湁澶囨敞杩斿洖 + if (devicesData.getAppliancesInfoList().get(0).getBigType() != Configuration.AUDIO_BIG_TYPE) { + for (int i = 0, len = devicesData.getAppliancesInfoList().size(); i < len; i++) { ListRemarks listRemarksTemp = new ListRemarks(); listRemarksTemp.setCallBack(false); - listRemarksTemp.setAppliancesInfo(devicesDataList.get(devicesDataList.size() - 1).getAppliancesInfoList().get(i)); + AppliancesInfo appliancesInfo = devicesData.getAppliancesInfoList().get(i); + Log.d("panlili", "HDLDeviceManager.java:handleSearchData----->getChannelNum= " + appliancesInfo.getChannelNum() + " getDeviceKey=" + appliancesInfo.getDeviceKey()); + listRemarksTemp.setAppliancesInfo(appliancesInfo); listRemarks.add(listRemarksTemp); } } - -// HDLCommand.HDLgetDevRemarks(devicesDataList.get(devicesDataList.size()-1).getAppliancesInfoList()); /********************杈呭姪璋冭瘯鎵撳嵃*******************/ String deviceName = ""; @@ -388,6 +469,33 @@ } /** + * 澶勭悊鎼滅储鍦烘櫙鏁版嵁 + * + * @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 * 淇娣峰悎璋冨厜娣峰悎寮�鍏� 绫绘ā鍧楅棶棰� @@ -397,8 +505,8 @@ 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++) { @@ -451,6 +559,40 @@ } + /** + * 澶勭悊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).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).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; + } + + } + } + } + } + /** * 澶勭悊璁惧鎺у埗鏁版嵁 @@ -461,69 +603,15 @@ switch (getDatas.command) { case Configuration.LIGHT_CTRL_BACK_COMMAND: handleLightCtrlData(getDatas); - + if (!HDLDeviceManager.isGetBusLightState) { + isGetDeviceStateSuccess = true; + } 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 - && 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: @@ -547,12 +635,13 @@ 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; @@ -561,16 +650,23 @@ 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; @@ -587,15 +683,11 @@ 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; - - } } } @@ -604,8 +696,8 @@ 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++) { @@ -707,226 +799,83 @@ } } } - - 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 鍘绘帀鐩稿悓寮�鍏崇姸鎬佸垽鏂�,瑙e喅寮�鐘舵�佷笅,璋冪敤寮�鍛戒护鐘舵�佷笅,涓嶅仠閲嶅彂闂 -// 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; + } + } + + /** + * 澶勭悊閫昏緫 鎺у埗鍥炶皟 + * 2024-1-19 + * + * @param getDatas + */ + private static void handleLogicCtrlData(UdpDataBean getDatas) { + switch (getDatas.command) { case Configuration.LOGIC_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 ((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) - ) { - AppliancesInfo sceneInfo = infos.get(j); - LogicMode logicMode = new LogicMode(); - logicMode.setAreaNum(getDatas.addBytes[0] & 0xFF); - logicMode.setAreaSceneNum(getDatas.addBytes[1] & 0xFF); - sceneInfo.setLogicMode(logicMode); + if (devicesDataList != null && devicesDataList.size() != 0) { + 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.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)) { + AppliancesInfo sceneInfo = infos.get(j); + LogicMode logicMode = new LogicMode(); + logicMode.setAreaNum(getDatas.addBytes[0] & 0xFF); + logicMode.setAreaSceneNum(getDatas.addBytes[1] & 0xFF); + sceneInfo.setLogicMode(logicMode); - LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo(); - logicCtrlBackInfo.setAppliancesInfo(sceneInfo); - logicCtrlBackInfo.setAreaNum(getDatas.addBytes[0] & 0xFF); - logicCtrlBackInfo.setSceneNum(getDatas.addBytes[1] & 0xFF); + LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo(); + logicCtrlBackInfo.setAppliancesInfo(sceneInfo); + logicCtrlBackInfo.setAreaNum(getDatas.addBytes[0] & 0xFF); + logicCtrlBackInfo.setSceneNum(getDatas.addBytes[1] & 0xFF); // isSceneCtrlSuccess = true; - setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); - EventBus.getDefault().post(new LogicFeedBackEvent(logicCtrlBackInfo, true)); + setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); + EventBus.getDefault().post(new LogicFeedBackEvent(logicCtrlBackInfo, true)); - break outter; + break outter; + } } } } } + 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; } } @@ -943,8 +892,8 @@ 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++) { @@ -974,8 +923,8 @@ 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(); @@ -1022,8 +971,8 @@ 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++) { @@ -1038,8 +987,6 @@ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true); EventBus.getDefault().post(new AirHVACFeedBackEvent(info, true)); break outter; - } else { - HDLLog.E("鎺у埗HVAC鐘舵�佸弽棣堟暟鎹紓甯�"); } break outter; } @@ -1049,6 +996,44 @@ 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).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_KNXTECHSYS) + && 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; + } } @@ -1078,8 +1063,8 @@ 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++) { @@ -1216,208 +1201,47 @@ 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)) - && ((infos.get(appPos).getChannelNum()) == (getDatas.addBytes[2] & 0xFF)) - ) { + if ((infos.get(appPos).getDeviceSubnetID()) == (getDatas.addBytes[0] & 0xFF) + && (infos.get(appPos).getDeviceDeviceID()) == (getDatas.addBytes[1] & 0xFF) + && ((infos.get(appPos).getDeviceIndex()) == (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); - -// 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); + HDLLog.I("remarkStr鑾峰彇鐨勫娉ㄥ悕涓猴細" + remarkStr); + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[5] & 0xFF); devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setRemarks(remarkStr); +// HDLLog.I("getRemarks()锛�" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getRemarks()); - 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: -// 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; - - 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); -// 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]; - 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://2019-07-03 灞忚斀 -// String aa = "浼犳劅鍣ㄥ娉細"; -// for (int i = 0; i < getDatas.addBytes.length; i++) { -// aa += (getDatas.addBytes[i] & 0xff) + ","; -// } -// HDLLog.I( aa); - - int curState; - if (getDatas.addBytes.length >= 26) {//2019-11-7 鐗规畩澶勭悊锛屼慨鏀瑰洖璺彿 - 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).setCurState(curState); - devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState((int) curState); - 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) - && listRemarks.get(lRPos).getAppliancesInfo().getChannelNum() == (getDatas.addBytes[2] & 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().getDeviceIndex() == (getDatas.addBytes[2] & 0xFF) + && listRemarks.get(lRPos).getAppliancesInfo().getBigType() == (getDatas.addBytes[3] & 0xFF) + && listRemarks.get(lRPos).getAppliancesInfo().getLittleType() == (getDatas.addBytes[4] & 0xFF)) { //鑻ユ病鎷垮埌鏁版嵁锛屽垯鎷挎暟鎹紱鑻ュ凡缁忔嬁鍒版暟鎹紝闇�瑕佸垽鏂璴istRemarks鍏ㄩ儴鏉$洰鏄惁鎷垮埌澶囨敞銆� @@ -1431,7 +1255,7 @@ } else { HDLLog.I("涓嶅瓨鍦ㄧ殑璁惧澶囨敞锛屽啀娆℃悳绱㈠娉ㄣ�傝澶囷細瀛愮綉鍙凤細" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() + "璁惧鍙凤細" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() - + "鍥炶矾鍙�" + listRemarks.get(lRPos).getAppliancesInfo().getChannelNum() + + "搴忓垪鍙凤細" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceIndex() + "澶囨敞锛�" + listRemarks.get(lRPos).getAppliancesInfo().getRemarks()); HandleSearch.getDevRemarks(); break listRemarksOutter; @@ -1440,7 +1264,7 @@ } else { HDLLog.I("杩斿洖澶囨敞璁惧锛氬瓙缃戝彿锛�" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() + ",璁惧鍙凤細" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() - + ",鍥炶矾鍙�" + listRemarks.get(lRPos).getAppliancesInfo().getChannelNum() + + ",搴忓垪鍙凤細" + listRemarks.get(lRPos).getAppliancesInfo().getDeviceIndex() + ",澶囨敞锛�" + listRemarks.get(lRPos).getAppliancesInfo().getRemarks()); listRemarks.get(lRPos).setCallBack(true); HandleSearch.getDevRemarks(); @@ -1458,6 +1282,70 @@ } } } + + /** + * 澶勭悊鎵�鏈夊満鏅鎯呮暟鎹�佽缃綋鍓嶅満鏅姸鎬� + * + * @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)) { + + //鑻ユ病鎷垮埌鏁版嵁锛屽垯鎷挎暟鎹紱鑻ュ凡缁忔嬁鍒版暟鎹紝闇�瑕佸垽鏂璴istRemarks鍏ㄩ儴鏉$洰鏄惁鎷垮埌澶囨敞銆� + 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; + + } + } + } + /** * 澶勭悊淇敼璁惧澶囨敞鍚庣殑鍥炶皟 @@ -1480,8 +1368,8 @@ 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++) { @@ -1494,7 +1382,6 @@ devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value); sensorInfo.setCurState(value); - String unite = ""; switch (sensorInfo.getDeviceType()) { @@ -1522,6 +1409,7 @@ 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"; @@ -1649,8 +1537,6 @@ unite = "鏈煡鍗曚綅"; break; } - - // EventBus.getDefault().post(new DeviceStateEvent(sensorInfo, true)); HDLLog.I("鍙戦�佷紶鎰熷櫒閫氱煡鏇存柊"); EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite)); @@ -1667,16 +1553,16 @@ } /** - * 澶勭悊浼犳劅鍣� 骞挎挱鏁版嵁 - * 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++) { @@ -1685,7 +1571,14 @@ && 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); @@ -1717,6 +1610,7 @@ 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"; @@ -1860,198 +1754,150 @@ } -// /** -// * 澶勭悊浼犳劅鍣� 骞挎挱鏁版嵁 -// * -// * @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; -// } -// } -// } + /** + * 澶勭悊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 + * 澶勭悊闂ㄩ攣鐘舵�佸拰鎶ヨ 骞挎挱鏁版嵁 + * + * @param getDatas + */ + private static void handleDoorMachineBroadcastStateData(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.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; + } + } + } /** @@ -2063,12 +1909,12 @@ 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++) { - 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); @@ -2076,6 +1922,37 @@ // 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).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.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; @@ -2092,8 +1969,8 @@ 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++) { @@ -2142,8 +2019,8 @@ 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++) { @@ -2151,7 +2028,6 @@ 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; @@ -2174,38 +2050,59 @@ 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) { - 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. + } 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)); + } } - if (state == 99) { - state = 100;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负99锛屽己鍒舵敼涓�100. - } - isGetDeviceStateSuccess = true; - devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF); - devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF); - AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); - curtainInfo.setCurState(state); - EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true)); - break outter; - } else { - if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) { - switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2 - case 0: - state = CurtainCtrlParser.curtainPause; - break; - case 1: - state = CurtainCtrlParser.curtainOn; - break; - case 2: - state = CurtainCtrlParser.curtainOff; - break; - default: - state = 0; - break; + } else {//鍏煎鏃у崗璁� + 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(getDatas.addBytes[1] & 0xFF); @@ -2214,12 +2111,34 @@ curtainInfo.setCurState(state); EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true)); break outter; + } else { + if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) { + switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2 + case 0: + state = CurtainCtrlParser.curtainPause; + break; + case 1: + state = CurtainCtrlParser.curtainOn; + break; + case 2: + state = CurtainCtrlParser.curtainOff; + break; + default: + state = 0; + break; + } + isGetDeviceStateSuccess = true; + devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF); + devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF); + AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); + curtainInfo.setCurState(state); + EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true)); + break outter; + } } - } } - } else { HDLLog.I("handleCurtainStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷"); @@ -2239,8 +2158,8 @@ 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++) { @@ -2292,8 +2211,8 @@ 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++) { @@ -2334,8 +2253,8 @@ 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++) { @@ -2369,8 +2288,8 @@ 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++) { @@ -2393,6 +2312,38 @@ /** + * 璇诲彇绉戞妧绯荤粺鐘舵�佸弽棣� + * + * @param getDatas + */ + private static void handleTechSysStateData(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).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; + 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鏂板 * @@ -2401,13 +2352,13 @@ 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)) {//2019-07-29 + && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) { if (getDatas.addBytes.length >= 3) { isGetDeviceStateSuccess = true; int state = getDatas.addBytes[2] & 0xFF; @@ -2437,8 +2388,8 @@ 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++) { @@ -2474,8 +2425,8 @@ 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++) { @@ -2505,286 +2456,6 @@ } } -// /** -// * 璇诲彇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( "鍙戦�佺┖璋冩敼鍙橀閫焏ata = " + 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> @@ -2794,8 +2465,8 @@ */ 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(); @@ -2854,8 +2525,8 @@ 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++) { @@ -2992,7 +2663,6 @@ */ public static void setDeviceCtrlSuccessStateWithInfo(AppliancesInfo info, Boolean success) { // if(info.getDeviceKey() == null) return; - ctrlSuccessStateHashMap.put(info.getDeviceKey(), success); } @@ -3010,6 +2680,14 @@ return success; } + public static boolean isSceneCtrlSuccess() { + return isSceneCtrlSuccess; + } + + public static void setSceneCtrlSuccess(boolean isSceneCtrlSuccess) { + HDLDeviceManager.isSceneCtrlSuccess = isSceneCtrlSuccess; + } + /** * 鎵嬪姩娣诲姞涓�涓畨闃叉ā鍧� * @@ -3019,8 +2697,8 @@ * @param mRemarks 澶囨敞 * @return Boolean */ - public static boolean addSecurityDevicesManually(int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) { - return addDevicesManuallyWithoutSearching(Configuration.SECURITY_BIG_TYPE, 0, mSubnetID, mDeviceID, mChannelNum, mRemarks); + public static boolean addSecurityDevicesManually(int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mRemarks) { + return addDevicesManuallyWithoutSearching(Configuration.SECURITY_BIG_TYPE, 0, mSubnetID, mDeviceID, mChannelNum, mIndex, mRemarks); } /** @@ -3032,8 +2710,8 @@ * @param mRemarks 澶囨敞 * @return Boolean */ - public static boolean addAudioDevicesManually(int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) { - return addDevicesManuallyWithoutSearching(Configuration.AUDIO_BIG_TYPE, 0, mSubnetID, mDeviceID, mChannelNum, mRemarks); + public static boolean addAudioDevicesManually(int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mRemarks) { + return addDevicesManuallyWithoutSearching(Configuration.AUDIO_BIG_TYPE, 0, mSubnetID, mDeviceID, mChannelNum, mIndex, mRemarks); } /** @@ -3048,9 +2726,9 @@ * @param mRemarks * @return */ - public static boolean addDevicesManuallyWithoutSearchingWithNewDevice(int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) { + public static boolean addDevicesManuallyWithoutSearchingWithNewDevice(int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mRemarks) { try { - DevicesData mDevicesData = DeviceParser.addDevicesManuallyWithoutSearching(mBigType, mLittleType, mSubnetID, mDeviceID, mChannelNum, mRemarks); + DevicesData mDevicesData = DeviceParser.addDevicesManuallyWithoutSearching(mBigType, mLittleType, mSubnetID, mDeviceID, mChannelNum, mIndex, mRemarks); if (mDevicesData != null) { devicesDataList.add(mDevicesData); HandleSearch.OnDeviceListGetSuccessCallBack(); @@ -3078,7 +2756,7 @@ * @param mRemarks * @return */ - public static boolean addDevicesManuallyWithoutSearching(int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) { + public static boolean addDevicesManuallyWithoutSearching(int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mRemarks) { try { if (!DeviceParser.isWantData(mBigType, mLittleType)) {//鍒ゆ柇鏄惁鏀寔鐨勫ぇ绫诲皬绫� @@ -3089,14 +2767,14 @@ 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); bCanAdd = getIfCanAddDevice(mDevicesData.getAppliancesInfoList(), mBigType, mLittleType, mChannelNum); if (bCanAdd) {//娣诲姞瀛愮綉鍙� 璁惧鍙� 宸插瓨鍦紝骞朵笖娌℃湁鐩稿悓鐨勫瓙缃戝彿璁惧鍙� - AppliancesInfo mAppliancesInfo = DeviceParser.getDevicesInfo(mDevicesData, mBigType, mLittleType, mChannelNum, mRemarks, mRemarks); + AppliancesInfo mAppliancesInfo = DeviceParser.getDevicesInfo(mDevicesData, mBigType, mLittleType, mChannelNum, mIndex, mRemarks, mRemarks); devicesDataList.get(i).getAppliancesInfoList().add(mAppliancesInfo); HandleSearch.OnDeviceListGetSuccessCallBack(); HDLLog.I("鏀寔鐨勮澶囷紝鍏佽娣诲姞"); @@ -3106,7 +2784,7 @@ } if (!bExistSubnetID) { - return addDevicesManuallyWithoutSearchingWithNewDevice(mBigType, mLittleType, mSubnetID, mDeviceID, mChannelNum, mRemarks); + return addDevicesManuallyWithoutSearchingWithNewDevice(mBigType, mLittleType, mSubnetID, mDeviceID, mChannelNum, mIndex, mRemarks); } return bCanAdd; @@ -3153,4 +2831,316 @@ } + /** + * 澶勭悊鏂伴璁惧鐘舵�佹暟鎹� + * 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).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.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).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.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).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.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).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.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).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.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).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.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).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)) { + + 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).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)) { + + 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).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)) { + + 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; + } + + } + } + } + } + } -- Gitblit v1.8.0