JLChen
2020-02-28 52f8575a2fa0590c28b5d784399c51a8af2f790a
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -671,60 +671,64 @@
                        List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                        inner:
                        for (int j = 0, len2 = infos.size(); j < len2; j++) {
                            AppliancesInfo curtainInfo;
                            if ((getDatas.addBytes[0] & 0xFF) >= 17) {
                                if (((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {
                                    curtainInfo = infos.get(j);
                                } else {
                                    continue inner;
                                }
                            } else {
                                if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) {
                                    curtainInfo = infos.get(j);
                                } else {
                                    continue inner;
                                }
                            }
                            if(infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO
                                    || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER
                                    || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE
                            ) {
                            CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
                            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) {
                                AppliancesInfo curtainInfo;
                                if ((getDatas.addBytes[0] & 0xFF) >= 17) {
                                    int curState = getDatas.addBytes[1] & 0xFF;
                                    if (curState == 1) {
                                        //这个判断很傻,窗帘关到百分比为0,会跳到1返回回来,只能强制改为0
                                        curState = 0;
                                    if (((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {
                                        curtainInfo = infos.get(j);
                                    } else {
                                        continue inner;
                                    }
                                    if (curState == 99) {
                                        curState = 100;
                                } else {
                                    if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) {
                                        curtainInfo = infos.get(j);
                                    } else {
                                        continue inner;
                                    }
                                    curtainCtrlBackInfo.setState(curState);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(curState);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(curState);
                                    curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16);
                                    EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
                                }
                            }
                            if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
                                if ((getDatas.addBytes[0] & 0xFF) < 17) {
                                    curtainCtrlBackInfo.setState(getDatas.addBytes[1] & 0xFF);
                                    curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF);
                                    EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
                                CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
                                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) {
                                    if ((getDatas.addBytes[0] & 0xFF) >= 17) {
                                        int curState = getDatas.addBytes[1] & 0xFF;
                                        if (curState == 1) {
                                            //这个判断很傻,窗帘关到百分比为0,会跳到1返回回来,只能强制改为0
                                            curState = 0;
                                        }
                                        if (curState == 99) {
                                            curState = 100;
                                        }
                                        curtainCtrlBackInfo.setState(curState);
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(curState);
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(curState);
                                        curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16);
                                        EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
                                    }
                                }
                                if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
                                    if ((getDatas.addBytes[0] & 0xFF) < 17) {
                                        curtainCtrlBackInfo.setState(getDatas.addBytes[1] & 0xFF);
                                        curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF);
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF);
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF);
                                        EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
                                    }
                                }
                                break outter;
                            }
                            break outter;
                        }
                    }
                }