JLChen
2020-03-16 7a951ecdc084ea8643e29e1ade59c1877fd7fbe5
2020-03-16 1.增加地热模块自动根据当前模式设置当前模式的温度接口.
6个文件已修改
222 ■■■■ 已修改文件
README.md 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/SettingActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -2,6 +2,36 @@
HDL XW Android SDK  Copyright (c) 2019 HDL Inc.
SDK 版本:hdl_lib_v1.6.9.20200316_beta
1.增加小类是3的音乐播放器支持;
2.加地热模块单独控制温度接口,接口自动根据当前模式设置当前模式的温度参数,不需要上层自己判断;(HDLCommand.geothermalCtrlTemp())
3.增加简易编程搜索回复,通过配置大类小类,让声必可设备模拟成第三方音乐播放器被搜索 ;
//配置简易编程搜索的参数 (SDK 初始化的时候配置一次)
/**
 * 配置简易编程搜索返回的默认参数
 * @param mSDKLocalBigClass 大类ID
 * @param mSDKLocalSmallClass 小类ID
 * @param mSDKLocalRemark 备注
 */
public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass, String mSDKLocalRemark);
声必可设备setEasyProgrammingSearchLocalData(9,1,"声必可音乐");
原地热对应关系
HDL 声必可
普通 自动
白天 手动
离开 休眠
2020-03-15 修改为
HDL 声必可
普通 手动
白天 自动
离开 休眠
SDK 版本:hdl_lib_v1.6.9.20200118_beta
1.修复RCU混合调光混合开关 类模块,使用物理回路问题;
2.增加默认获取WiFi连接的广播配置方法;
SDK 版本:hdl_lib_v1.6.8.20191016_beta
1.控制都改成广播形式了,不记录一端口的IP。
@@ -34,4 +64,4 @@
##Version 1.0.2
1.新增地热模块和新风系统控制和读取状态接口;
2.新增地热模块和新风系统控制演示页面;
3.targetSdkVersion 28;
3.targetSdkVersion 28;
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java
@@ -141,6 +141,7 @@
                }
            }
        });
@@ -161,40 +162,43 @@
                    return;
                }
                proDialog.show();
                switch (gModeState) {
                    case 1:
                        //当前地热模式为普通
                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//普通温度
                        ctrlId = GeothermalParser.gNormalTemp;
                        break;
                    case 2:
                        //当前地热模式为白天
                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gDayTemp, tempInt);//白天温度
                        ctrlId = GeothermalParser.gDayTemp;
                        break;
                    case 3:
                        //当前地热模式为夜间
                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNightTemp, tempInt);//夜间温度
                        ctrlId = GeothermalParser.gNightTemp;
                        break;
                    case 4:
                        //当前地热模式为离开
                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gLeaveTemp, tempInt);//离开温度
                        ctrlId = GeothermalParser.gLeaveTemp;
                        break;
                    case 5:
                        proDialog.dismiss();
                        //当前地热模式为自动
                        showToast("自动模式,不能控制温度");
                        break;
                    default:
                        proDialog.dismiss();
                        //当前地热模式为自动
                        showToast("未知模式,不能控制温度");
                        break;
                HDLCommand.geothermalCtrlTemp(appliancesInfo, tempInt);//自动根据当前模式设置当前模式的温度。
                }
//                switch (gModeState) {
//
//                    case 1:
//                        //当前地热模式为普通
//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//普通温度
//                        ctrlId = GeothermalParser.gNormalTemp;
//                        break;
//                    case 2:
//                        //当前地热模式为白天
//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gDayTemp, tempInt);//白天温度
//                        ctrlId = GeothermalParser.gDayTemp;
//                        break;
//                    case 3:
//                        //当前地热模式为夜间
//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNightTemp, tempInt);//夜间温度
//                        ctrlId = GeothermalParser.gNightTemp;
//                        break;
//                    case 4:
//                        //当前地热模式为离开
//                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gLeaveTemp, tempInt);//离开温度
//                        ctrlId = GeothermalParser.gLeaveTemp;
//                        break;
//                    case 5:
//                        proDialog.dismiss();
//                        //当前地热模式为自动
//                        showToast("自动模式,不能控制温度");
//                        break;
//                    default:
//                        proDialog.dismiss();
//                        //当前地热模式为自动
//                        showToast("未知模式,不能控制温度");
//                        break;
//
//                }
            }
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/SettingActivity.java
@@ -95,7 +95,7 @@
        deviceIDEditText.setText(strDeviceID);
        //配置简易编程搜索的参数
        HDLDeviceManager.setEasyProgrammingSearchLocalData(9, 90);
        HDLDeviceManager.setEasyProgrammingSearchLocalData(9, 1);
    }
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
@@ -118,5 +118,81 @@
    }
    //根据当前模式设置温度
    public static byte[] getGeothermalAddByteTemp(AppliancesInfo appliancesInfo, int state) {
        try {
            AppliancesInfo newInfo = null;
            byte[] airBytes = null;
            outter:
            for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
                if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
                        && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
                    for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
                        if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
                                && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE
                                && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
                            newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
                            if (newInfo.getFeedbackState() == null) {
                                newInfo.setFeedbackState(new byte[10]);
                            }
                            airBytes = newInfo.getFeedbackState();
                            break outter;
                        }
                    }
                }
            }
            byte[] addBytes = new byte[10];
            if (airBytes != null && airBytes.length >= 10) {
                addBytes[0] = (byte) newInfo.getChannelNum();
                addBytes[1] = airBytes[1];
                addBytes[2] = 0;
                addBytes[3] = airBytes[3];
                addBytes[4] = airBytes[4];
                addBytes[5] = airBytes[5];
                addBytes[6] = airBytes[6];
                addBytes[7] = airBytes[7];
                addBytes[8] = 0;
                addBytes[9] = 0;
            } else {
                addBytes[0] = (byte) newInfo.getChannelNum();
                addBytes[1] = 0;
                addBytes[2] = 0;
                addBytes[3] = 1;
                addBytes[4] = 30;
                addBytes[5] = 30;
                addBytes[6] = 30;
                addBytes[7] = 30;
                addBytes[8] = 0;
                addBytes[9] = 0;
            }
            switch (addBytes[3]) {
                case gModeNormal:
                    addBytes[1] = 1;//打开
                    addBytes[4] = (byte) state;
                    break;
                case gModeDay:
                    addBytes[1] = 1;//打开
                    addBytes[5] = (byte) state;
                    break;
                case gModeNight:
                    addBytes[1] = 1;//打开
                    addBytes[6] = (byte) state;
                    break;
                case gModeLeave:
                    addBytes[1] = 1;//打开
                    addBytes[7] = (byte) state;
                    break;
            }
            return addBytes;
        } catch (Exception e) {
            e.printStackTrace();
            return new byte[]{fail};
        }
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
@@ -402,6 +402,44 @@
    }
    /**
     * 控制地热模块温度
     *
     * @param info
     * @param state 2020-03-15
     */
    public static void geothermalCtrlTemp(final AppliancesInfo info, int state) {
//        HDLDeviceManager.isGeothermalCtrlSuccess = false;
        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
        if (geothermalCtrlFailTimer != null) {
            geothermalCtrlFailTimer.cancel();
            geothermalCtrlFailTimer = null;
        }
        if (info.getBigType() == Configuration.GEOTHERMAL_BIG_TYPE) {
            byte[] sendbytes = GeothermalParser.getGeothermalAddByteTemp(info, state);
            addSendData(info, sendbytes, Configuration.CONTROL);
            geothermalCtrlFailTimer = new Timer();
            geothermalCtrlFailTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                        GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo();
                        mGeothermalBackInfo.setAppliancesInfo(info);
                        EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, EventCode.FAILURE));
                    }
                }
            }, 5000);
        } else {
            HDLLog.info("地热模块控制不在范围内"
                    + " LittleType = " + info.getLittleType()
                    + " BigType = " + info.getBigType()
            );
        }
    }
    /**
     * 控制地热模块
     *
     * @param info
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -111,9 +111,9 @@
    /**
     * 配置简易编程搜索返回的默认参数
     * @param mSDKLocalBigClass
     * @param mSDKLocalSmallClass
     * @param mSDKLocalRemark
     * @param mSDKLocalBigClass 大类ID
     * @param mSDKLocalSmallClass 小类ID
     * @param mSDKLocalRemark 备注
     */
    public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass, String mSDKLocalRemark){
        SDKLocalBigClass = mSDKLocalBigClass;