From db21de901bb1bbc6ec66b59e7b0766d0d2c5c6cc Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 16 七月 2019 13:54:44 +0800 Subject: [PATCH] 20190716 1.提供声必可SDK,部分数据处理调整; 2.演示DemoAPP,地热和新风页面调整; --- hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java | 116 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 87 insertions(+), 29 deletions(-) diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java index 2e581fe..721b46f 100644 --- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java +++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java @@ -27,6 +27,7 @@ import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.AirFeedBackEvent; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent; +import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent; import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; @@ -169,8 +170,11 @@ case Configuration.CURTAIN_STATE_BACK_COMMAND: case Configuration.AIR_STATE_BACK_COMMAND: case Configuration.SENSOR_STATE_BACK_COMMAND: - case Configuration.FRESH_AIR_STATE_BACK_COMMAND://20190709鏂板 handleStateData(getDatas); + break; + //鑾峰彇鏂伴璁惧鐘舵�� 20190709鏂板 + case Configuration.FRESH_AIR_STATE_BACK_COMMAND: + handleFreshAirStateData(getDatas); break; //鑾峰彇鍦扮儹璁惧鐘舵�� case Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND: @@ -1040,26 +1044,32 @@ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); for (int j = 0, len2 = infos.size(); j < len2; j++) { - if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { - if(getDatas.addBytes.length >= 8){ - byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); - if(getBytes.length < 10){ - getBytes = new byte[10]; + if(getDatas.addBytes.length > 0) { + if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) { + if (getDatas.addBytes.length >= 8) { + byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); + if (getBytes == null || getBytes.length < 10) { + getBytes = new byte[10]; + } + System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//鎺у埗鍦扮儹鐘舵�佸弽棣堬紝鍙彇鍓�8浣嶆暟鎹� + devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes); + AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); + + GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true); + isGeothermalCtrlSuccess = true; + EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.SUCCESS)); + } else { + +// AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); +// GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true); +// isGeothermalCtrlSuccess = true; +// EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.DATAEMPTY)); + + HDLLog.E("鎺у埗鍦扮儹鐘舵�佸弽棣堟暟鎹紓甯�"); } - System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//鎺у埗鍦扮儹鐘舵�佸弽棣堬紝鍙彇鍓�8浣嶆暟鎹� - devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes); - AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j); - - GeothermalBackInfo info = new GeothermalBackInfo(mInfo , true); - isGeothermalCtrlSuccess = true; - EventBus.getDefault().post(new GeothermalFeedBackEvent(info, true)); - }else{ - HDLLog.E("鎺у埗鍦扮儹鐘舵�佸弽棣堟暟鎹紓甯�"); + break outter; } - - break outter; } - } } } @@ -1844,6 +1854,28 @@ devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curState); devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState((int) curState); break; + case Configuration.FRESH_AIR_BIG_TYPE://20190711鏂板 + switch (infos.get(appPos).getLittleType()) { + case Configuration.FRESH_AIR_LITTLE_TYPE_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).setFeedbackState(hvacBytes); + break; + } + break; + case Configuration.GEOTHERMAL_BIG_TYPE://20190711鏂板 + switch (infos.get(appPos).getLittleType()) { + case Configuration.GEOTHERMAL_LITTLE_TYPE_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).setFeedbackState(hvacBytes); + break; + } + break; default: HDLLog.info("鏈壘鍒版绫诲瀷璁惧锛�" + infos.get(appPos).getBigType()); break; @@ -1910,6 +1942,7 @@ ) { List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); for (int j = 0, len2 = infos.size(); j < len2; j++) { + HDLLog.info("HDL big:锛�"+devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()); switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()) { case Configuration.LIGTH_BIG_TYPE: isGetDeviceStateSuccess = true; @@ -2157,23 +2190,48 @@ HDLLog.info("鍙戦�佷紶鎰熷櫒閫氱煡鏇存柊"); EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite)); break; - case Configuration.FRESH_AIR_BIG_TYPE://20190709鏂板 - isGetDeviceStateSuccess = true; - devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes); - - EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); - - break; default: HDLLog.info("handle state 娌℃湁鎵惧埌鍖归厤绫诲瀷"); break; } - break outter; +// break outter; } break outter; } } } + + /** + * 澶勭悊鏂伴璁惧鐘舵�佹暟鎹� + * 20190710鏂板 + * @param getDatas + */ + private static void handleFreshAirStateData(UdpDataBean getDatas) { + outter: + for (int i = 0, len = devicesDataList.size(); i < len; i++) { + if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID + && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID + ) { + List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList(); + for (int j = 0, len2 = infos.size(); j < len2; j++) { + switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType()) { + case HDLApConfig.TYPE_FRESH_AIR: + isGetDeviceStateSuccess = true; + devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes); + EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true)); + + break; + default: + HDLLog.info("handleFreshAirStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷"); + break; + } + + } + break outter; + } + } + } + /** * 澶勭悊鍦扮儹璁惧鐘舵�佹暟鎹� @@ -2193,7 +2251,7 @@ if(getDatas.addBytes.length >= 10) { byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState(); - if (getBytes.length < 10) { + if (getBytes == null || getBytes.length < 10) { getBytes = new byte[10]; } System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 10);//20190710鏌ヨ鍦扮儹鐘舵�佸弽棣堬紝鍙彇鍓�10浣嶆暟鎹� @@ -2206,10 +2264,10 @@ break; default: - HDLLog.info("handle state 娌℃湁鎵惧埌鍖归厤绫诲瀷"); + HDLLog.info("handleGeothermalStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷"); break; } - break outter; + } break outter; } -- Gitblit v1.8.0