JLChen
2020-01-18 fd78a0c0e444b83f40a9225c98adceb87bbda329
2020-1-18 1.修复RCU混合调光混合开关 类模块,使用物理回路问题。
4个文件已修改
200 ■■■■■ 已修改文件
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/values/strings.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java
@@ -702,7 +702,7 @@
        if (event.getLightCtrlBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
                && event.getLightCtrlBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getLightCtrlBackInfo().getChannelNum() == appliancesInfo.getChannelNum()
                && event.getLightCtrlBackInfo().getChannelNum() == appliancesInfo.getChannelNum() && event.getLightCtrlBackInfo().getPhysicsChannelNum() == appliancesInfo.getPhysicsChannelNum()
                ) {
            //        先判断是否超时
            if (!event.isSuccess()) {
@@ -945,7 +945,7 @@
                case HDLApConfig.TYPE_LIGHT_RELAY:
                case HDLApConfig.TYPE_LIGHT_MIX_DIMMER:
                case HDLApConfig.TYPE_LIGHT_MIX_RELAY:
                    if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
                    if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum() && appliancesInfo.getPhysicsChannelNum() == event.getAppliancesInfo().getPhysicsChannelNum()) {
                        if (!event.isSuccess()) {
                            showToast("获取灯光状态失败,请重新再试");
                            return;
app/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
<resources>
    <string name="app_name">HDL_SDK</string>
    <string name="app_version">hdl_lib_v1.6.4.20191015_beta</string>
    <string name="app_version">hdl_lib_v1.6.5.20200117_beta</string>
</resources>
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/LightCtrlBackInfo.java
@@ -18,7 +18,7 @@
    int deviceChannelCount;//设备回路总数
    String remarks ;//备注
    String parentRemarks;//模块备注
    int physicsChannelNum;//RCU 灯光特有
    public String getParentRemarks() {
        return parentRemarks;
@@ -77,6 +77,14 @@
        this.deviceChannelCount = deviceChannelCount;
    }
    public int getPhysicsChannelNum() {
        return physicsChannelNum;
    }
    public void setPhysicsChannelNum(int physicsChannelNum) {
        this.physicsChannelNum = physicsChannelNum;
    }
    @Override
    public String toString() {
        return "LightCtrlBackInfo{" +
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -485,6 +485,116 @@
        }
    }
    /**
     * 处理灯光返回
     * 2020-1-18
     * 修复混合调光混合开关 类模块问题
     * @param getDatas
     */
    private static void handleLightCtrlData(UdpDataBean getDatas){
        if (TextUtils.isEmpty(HandleSearch.rcuIp)) {
            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).getLittleType() == 9 || infos.get(j).getLittleType() == 10 ){
                            if (infos.get(j).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF);
                                AppliancesInfo lightInfo1 = infos.get(j);
                                lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF);
                                LightCtrlBackInfo info1 = new LightCtrlBackInfo();
                                info1.setParentRemarks(lightInfo1.getParentRemarks());
                                info1.setAppliancesInfo(lightInfo1);
                                info1.setRemarks(lightInfo1.getRemarks());
                                info1.setChannelNum(lightInfo1.getChannelNum());
                                info1.setPhysicsChannelNum(lightInfo1.getPhysicsChannelNum());
                                info1.setBrightness(getDatas.addBytes[2] & 0xFF);
                                setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                EventBus.getDefault().post(new LightFeedBackEvent(info1, true));
                                break outter;
                            }
                        }else {
                            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.setIsSuccess(getDatas.AddBytes[1] & 0xFF);
                                info.setBrightness(getDatas.addBytes[2] & 0xFF);
//                                  info.setChannelCount(getDatas.AddBytes[3] & 0xFF);
//                                  info.setDeviceChannelCount(getDatas.AddBytes[4] & 0xFF);
//                                    isLightCtrlSuccess = true;
                                setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                EventBus.getDefault().post(new LightFeedBackEvent(info, true));
                                break outter;
                            }
                        }
                    }
                }
            }
        } else {
            if (getDatas.addBytes.length != 0) {
                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).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF)
                            ) {
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF);
                                for (int k = 0; k < rcuLightList.size(); k++) {
                                    if (devicesDataList.get(i).getAppliancesInfoList().get(j).getPhysicsChannelNum() == rcuLightList.get(k).getPhysicsChanelNum()
                                    ) {
                                        rcuLightList.get(k).setCurState(getDatas.addBytes[2] & 0xFF);
                                        break;
                                    }
                                }
                                AppliancesInfo lightInfo1 = infos.get(j);
                                lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF);
                                LightCtrlBackInfo info1 = new LightCtrlBackInfo();
                                info1.setParentRemarks(lightInfo1.getParentRemarks());
                                info1.setAppliancesInfo(lightInfo1);
                                info1.setRemarks(lightInfo1.getRemarks());
                                info1.setChannelNum(lightInfo1.getChannelNum());
//                    info1.setIsSuccess(getDatas.AddBytes[1] & 0xFF);
                                info1.setBrightness(getDatas.addBytes[2] & 0xFF);
                                info1.setChannelCount(getDatas.addBytes[3] & 0xFF);
                                info1.setDeviceChannelCount(getDatas.addBytes[4] & 0xFF);
//                                        isLightCtrlSuccess = true;
                                setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                EventBus.getDefault().post(new LightFeedBackEvent(info1, true));
                                break outter;
                            }
                        }
                    }
                }
            }
        }
    }
    /**
     * 处理设备控制数据
     *
@@ -493,79 +603,7 @@
    private static void handleCtrlData(UdpDataBean getDatas) {
        switch (getDatas.command) {
            case Configuration.LIGHT_CTRL_BACK_COMMAND:
                if (TextUtils.isEmpty(HandleSearch.rcuIp)) {
                    outter:
                    for (int i = 0, len = devicesDataList.size(); i < len; i++) {
                        if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
                                && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
                        ) {
                            List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                            for (int j = 0, len2 = infos.size(); j < len2; j++) {
                                if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
                                    AppliancesInfo lightInfo = infos.get(j);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF);
                                    LightCtrlBackInfo info = new LightCtrlBackInfo();
                                    info.setParentRemarks(lightInfo.getParentRemarks());
                                    info.setAppliancesInfo(lightInfo);
                                    info.setRemarks(lightInfo.getRemarks());
                                    info.setChannelNum(getDatas.addBytes[0] & 0xFF);
//                                  info.setIsSuccess(getDatas.AddBytes[1] & 0xFF);
                                    info.setBrightness(getDatas.addBytes[2] & 0xFF);
//                                  info.setChannelCount(getDatas.AddBytes[3] & 0xFF);
//                                  info.setDeviceChannelCount(getDatas.AddBytes[4] & 0xFF);
//                                    isLightCtrlSuccess = true;
                                    setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                    EventBus.getDefault().post(new LightFeedBackEvent(info, true));
                                    break outter;
                                }
                            }
                        }
                    }
                } else {
                    if (getDatas.addBytes.length != 0) {
                        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).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF)
                                    ) {
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF);
                                        for (int k = 0; k < rcuLightList.size(); k++) {
                                            if (devicesDataList.get(i).getAppliancesInfoList().get(j).getPhysicsChannelNum() == rcuLightList.get(k).getPhysicsChanelNum()
                                            ) {
                                                rcuLightList.get(k).setCurState(getDatas.addBytes[2] & 0xFF);
                                                break;
                                            }
                                        }
                                        AppliancesInfo lightInfo1 = infos.get(j);
                                        lightInfo1.setCurState(getDatas.addBytes[2] & 0xFF);
                                        LightCtrlBackInfo info1 = new LightCtrlBackInfo();
                                        info1.setParentRemarks(lightInfo1.getParentRemarks());
                                        info1.setAppliancesInfo(lightInfo1);
                                        info1.setRemarks(lightInfo1.getRemarks());
                                        info1.setChannelNum(lightInfo1.getChannelNum());
//                    info1.setIsSuccess(getDatas.AddBytes[1] & 0xFF);
                                        info1.setBrightness(getDatas.addBytes[2] & 0xFF);
                                        info1.setChannelCount(getDatas.addBytes[3] & 0xFF);
                                        info1.setDeviceChannelCount(getDatas.addBytes[4] & 0xFF);
//                                        isLightCtrlSuccess = true;
                                        setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                        EventBus.getDefault().post(new LightFeedBackEvent(info1, true));
                                        break outter;
                                    }
                                }
                            }
                        }
                    }
                }
                handleLightCtrlData(getDatas);
                break;
            case Configuration.CURTAIN_CTRL_BACK_COMMAND: