JLChen
2020-10-20 c9978ac37e3e9817ab07b25dbb499b28918403fd
2020-10-20 1.增加RGB和CCT灯控制协议
11个文件已添加
9个文件已修改
1621 ■■■■■ 已修改文件
.idea/compiler.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/jarRepositories.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/misc.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/AndroidManifest.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AppliancesActivity.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlCCTLightActivity.java 320 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlRGBLightActivity.java 247 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/base/RGBLightBean.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_ctrl_cct_light.xml 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_ctrl_r_g_b_light.xml 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Config/Configuration.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/Config/HDLApConfig.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/CCTBackInfo.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/RGBBackInfo.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java 172 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/LightCCTCtrlBackEvent.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/LightRGBCtrlBackEvent.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/compiler.xml
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <bytecodeTargetLevel target="1.8" />
  </component>
</project>
.idea/jarRepositories.xml
New file
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="RemoteRepositoriesConfiguration">
    <remote-repository>
      <option name="id" value="central" />
      <option name="name" value="Maven Central repository" />
      <option name="url" value="https://repo1.maven.org/maven2" />
    </remote-repository>
    <remote-repository>
      <option name="id" value="jboss.community" />
      <option name="name" value="JBoss Community repository" />
      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
    </remote-repository>
    <remote-repository>
      <option name="id" value="BintrayJCenter" />
      <option name="name" value="BintrayJCenter" />
      <option name="url" value="https://jcenter.bintray.com/" />
    </remote-repository>
    <remote-repository>
      <option name="id" value="Google" />
      <option name="name" value="Google" />
      <option name="url" value="https://dl.google.com/dl/android/maven2/" />
    </remote-repository>
  </component>
</project>
.idea/misc.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
app/src/main/AndroidManifest.xml
@@ -18,7 +18,9 @@
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".activity.AddDevicesActivity"></activity>
        <activity android:name=".activity.CtrlCCTLightActivity"></activity>
        <activity android:name=".activity.CtrlRGBLightActivity" />
        <activity android:name=".activity.AddDevicesActivity" />
        <activity android:name=".activity.SettingActivity" />
        <activity android:name=".activity.AddDevicesManuallyActivity" />
        <activity android:name=".activity.MainActivity">
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AppliancesActivity.java
@@ -10,6 +10,7 @@
import android.widget.ListView;
import com.hdl.sdk.hdl_core.Config.Configuration;
import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
import java.util.ArrayList;
@@ -66,6 +67,17 @@
                }else  if (appliancesInfos.get(position).getBigType() == Configuration.SENSOR_BIG_TYPE) {
                    //大类是传感器 则跳转到SensorActivity 干节点指令类型
                    intent.setClass(AppliancesActivity.this, SensorActivity.class);
                }else  if (appliancesInfos.get(position).getBigType() == Configuration.LIGTH_BIG_TYPE) {
                    //大类是灯光
                    if(appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB){
                        intent.setClass(AppliancesActivity.this, CtrlRGBLightActivity.class);
                    }else if(appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT){
                        intent.setClass(AppliancesActivity.this, CtrlCCTLightActivity.class);
                    }else {
                        //普通灯
                        intent.setClass(AppliancesActivity.this, CtrlActivity.class);
                    }
                }
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlCCTLightActivity.java
New file
@@ -0,0 +1,320 @@
package com.hdl.sdk.hdl_sdk.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.CCTBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightCCTCtrlBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightRGBCtrlBackEvent;
import com.hdl.sdk.hdl_sdk.R;
import com.hdl.sdk.hdl_sdk.base.BaseActivity;
import com.hdl.sdk.hdl_sdk.utlis.HDLLog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class CtrlCCTLightActivity extends BaseActivity {
    /**
     * Topbar
     */
    private RelativeLayout topBarBack;
    private TextView topBarTitle;
    private Button btnOpen, btnClose;
    //    private EditText etR,etG,etB;
    private SeekBar seekBar, seekBarCCT;
    private TextView switchText;
    private AppliancesInfo appliancesInfo;
    private int settingBrightness = 0;
    private int settingCCT = 2000;
    private CCTBackInfo mCCTBackInfo;
    //默认色温范围值 2000K 到7000K,不一定所有设备都是这个范围
    private int MIN_CCT = 2000;
    private int MAX_CCT = 7000;
    /**
     * 复写isRegisterEventBus()  要注册使用EventBus,这里要设置返回true
     *
     * @return true
     */
    @Override
    protected boolean isRegisterEventBus() {
        return true;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ctrl_cct_light);
        initToolbar();
        initcurState();
        initView();
        initOnClick();
        displayStateView();
        mCCTBackInfo = new CCTBackInfo(appliancesInfo);
        //读取状态
        HDLCommand.getRGBCCTStateFromNetwork(appliancesInfo);
    }
    /**
     * 初始化Toolbar
     */
    private void initToolbar() {
//        topBarBack = findViewById(R.id.ll_top_b_left);
//        setViewVisible(topBarBack);
//        topBarTitle = findViewById(R.id.tv_top_b_header_title);
//        topBarBack.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                finish();
//            }
//        });
    }
    private void initcurState() {
        appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
    }
    private void initView() {
        btnOpen = findViewById(R.id.btnOpen);
        btnClose = findViewById(R.id.btnClose);
        seekBar = findViewById(R.id.sb_brightness);
        seekBarCCT = findViewById(R.id.sb_cct);
        switchText = findViewById(R.id.switchText);
    }
    private void initOnClick() {
        btnOpen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int brightness = settingBrightness == 0 ? 100 : settingBrightness;
                if (settingCCT > MAX_CCT) {
                    settingCCT = MAX_CCT;
                } else if (settingCCT < MIN_CCT) {
                    settingCCT = MIN_CCT;
                }
                HDLCommand.lightCCTCtrl(appliancesInfo, brightness, settingCCT);
            }
        });
        btnClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (settingCCT > MAX_CCT) {
                    settingCCT = MAX_CCT;
                } else if (settingCCT < MIN_CCT) {
                    settingCCT = MIN_CCT;
                }
                HDLCommand.lightCCTCtrl(appliancesInfo, 0, settingCCT);
            }
        });
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            }
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                if (seekBar.getProgress() > 0) {
                    settingBrightness = seekBar.getProgress();
                }
                if (settingCCT > MAX_CCT) {
                    settingCCT = MAX_CCT;
                } else if (settingCCT < MIN_CCT) {
                    settingCCT = MIN_CCT;
                }
                HDLCommand.lightCCTCtrl(appliancesInfo, seekBar.getProgress(), settingCCT);
            }
        });
        seekBarCCT.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            }
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                settingCCT = seekBarProgressToValue(MIN_CCT, MAX_CCT, seekBar.getProgress());
                if (settingCCT > MAX_CCT) {
                    settingCCT = MAX_CCT;
                } else if (settingCCT < MIN_CCT) {
                    settingCCT = MIN_CCT;
                }
                HDLLog.I("色温设置:" + settingCCT + "K");
                int brightness = settingBrightness == 0 ? 100 : settingBrightness;
                HDLCommand.lightCCTCtrl(appliancesInfo, brightness, settingCCT);
            }
        });
    }
    private void displayStateView() {
        switch (appliancesInfo.getDeviceType()) {
            case HDLApConfig.TYPE_LIGHT_CCT:
                break;
            default:
                finish();//设备类型不对结束页面
                break;
        }
        /**根据需求是否发送一次获取刷新状态请求*/
    }
    /**
     * showCCTBackInfo
     *
     * @param mCCTBackInfo
     */
    private void showCCTBackInfo(CCTBackInfo mCCTBackInfo) {
        String message = "";
        if (mCCTBackInfo.getBrightness() > 0) {
            //如果大于0才记住当前设置的亮度值,下次打开时继续这个亮度值
            settingBrightness = mCCTBackInfo.getBrightness();
            message = "当前状态:开";
            message += "\n" + "亮度:" + mCCTBackInfo.getBrightness();
            message += "\n" + "色温值:" + mCCTBackInfo.getCctValue() + "K";
        } else {
            message = "当前状态:关";
        }
        settingCCT = mCCTBackInfo.getCctValue();
        seekBar.setProgress(mCCTBackInfo.getBrightness());
        int cctProgress = seekBarValueToProgress(MIN_CCT, MAX_CCT, mCCTBackInfo.getCctValue());
        seekBarCCT.setProgress(cctProgress);
        switchText.setText(message);
        showToast(message);
        HDLLog.I(message);
    }
    /**
     * RGB控制回调Event
     *
     * @param event
     */
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onLightCCTCtrlBackEventMain(LightCCTCtrlBackEvent event) {
        if (event.getCCTBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
                && event.getCCTBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getCCTBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
        ) {
            if (!event.isSuccess()) {
                showToast("RGB灯控制超时,请重新再试");
                return;
            }
//            showToast("RGB灯控制成功");
            mCCTBackInfo = event.getCCTBackInfo();
            showCCTBackInfo(mCCTBackInfo);
        }
    }
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onDeviceStateEventMain(DeviceStateEvent event) {
//        proDialog.dismiss();
        if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
        ) {
            //这个返回的信息是当前状态的
            switch (event.getAppliancesInfo().getDeviceType()) {
                case HDLApConfig.TYPE_LIGHT_CCT:
                    if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
                        if (!event.isSuccess()) {
                            showToast("获取CCT灯状态失败,请重新再试");
                            return;
                        }
                        String message = "";
                        CCTBackInfo cctBackInfo = new CCTBackInfo(event.appliancesInfo);
                        if (cctBackInfo == null) {
                            showToast("获取CCT灯状态失败,请重新再试");
                            return;
                        }
                        mCCTBackInfo = cctBackInfo;
                        showCCTBackInfo(mCCTBackInfo);
                    }
                    break;
            }
        }
    }
    /**
     * 根据滑条刻度值,给定最大最小值 计算出对应显示值
     * 滑条刻度值范围0~100
     *
     * @param maxValue  最大值
     * @param minValue  最小值
     * @param mProgress 滑条值
     * @return 计算后的显示值
     */
    private int seekBarProgressToValue(int minValue, int maxValue, int mProgress) {
        int progress = mProgress;
        if (progress < 0) {
            progress = 0;
        } else if (progress > 100) {
            progress = 100;
        }
        int intValue = 0;
        intValue = (maxValue - minValue) * progress / 100 + minValue;
        return intValue;
    }
    /**
     * 根据显示值,给定最大最小值 计算出对滑条刻度
     * 滑条刻度值范围0~100
     *
     * @param maxValue  最大值
     * @param minValue  最小值
     * @param mIntValue 显示值
     * @return 计算后的滑条值
     */
    private int seekBarValueToProgress(int minValue, int maxValue, int mIntValue) {
        int intValue = mIntValue;
        if (intValue < minValue) {
            intValue = minValue;
        } else if (intValue > maxValue) {
            intValue = maxValue;
        }
        int progress = 0;
        progress = (intValue - minValue) * 100 / (maxValue - minValue);
        return progress;
    }
}
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlRGBLightActivity.java
New file
@@ -0,0 +1,247 @@
package com.hdl.sdk.hdl_sdk.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightRGBCtrlBackEvent;
import com.hdl.sdk.hdl_sdk.R;
import com.hdl.sdk.hdl_sdk.base.BaseActivity;
import com.hdl.sdk.hdl_sdk.utlis.HDLLog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class CtrlRGBLightActivity extends BaseActivity {
    /**
     * Topbar
     */
    private RelativeLayout topBarBack;
    private TextView topBarTitle;
    private Button btnOpen, btnClose, btnRGB;
    private EditText etR, etG, etB;
    private SeekBar seekBar;
    private TextView switchText;
    private AppliancesInfo appliancesInfo;
    private int settingBrightness = 0;
    private RGBBackInfo mRGBBackInfo;
//    private RGBLightBean mRGBLightBean;
    /**
     * 复写isRegisterEventBus()  要注册使用EventBus,这里要设置返回true
     *
     * @return true
     */
    @Override
    protected boolean isRegisterEventBus() {
        return true;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ctrl_r_g_b_light);
        initToolbar();
        initcurState();
        initView();
        initOnClick();
        displayStateView();
        mRGBBackInfo = new RGBBackInfo(appliancesInfo);
        //读取状态
        HDLCommand.getRGBCCTStateFromNetwork(appliancesInfo);
    }
    /**
     * 初始化Toolbar
     */
    private void initToolbar() {
//        topBarBack = findViewById(R.id.ll_top_b_left);
//        setViewVisible(topBarBack);
//        topBarTitle = findViewById(R.id.tv_top_b_header_title);
//        topBarBack.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                finish();
//            }
//        });
    }
    private void initcurState() {
        appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
    }
    private void initView() {
        btnOpen = findViewById(R.id.btnOpen);
        btnClose = findViewById(R.id.btnClose);
        btnRGB = findViewById(R.id.btnRGB);
        seekBar = findViewById(R.id.sb_brightness);
        etR = findViewById(R.id.et_r);
        etG = findViewById(R.id.et_g);
        etB = findViewById(R.id.et_b);
        switchText = findViewById(R.id.switchText);
    }
    private void initOnClick() {
        btnRGB.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int rStatus = Integer.parseInt(etR.getText().toString());
                int gStatus = Integer.parseInt(etG.getText().toString());
                int bStatus = Integer.parseInt(etB.getText().toString());
                if (rStatus < 0 || rStatus > 255 || gStatus < 0 || gStatus > 255 || bStatus < 0 || bStatus > 255) {
                    showToast("RGB值范围 0~255");
                    return;
                }
                int brightness = settingBrightness == 0 ? 100 : settingBrightness;
                HDLCommand.lightRGBCtrl(appliancesInfo, brightness, rStatus, gStatus, bStatus);
            }
        });
        btnOpen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int brightness = settingBrightness == 0 ? 100 : settingBrightness;
                HDLCommand.lightRGBCtrl(appliancesInfo, brightness, mRGBBackInfo.getrStatus(), mRGBBackInfo.getgStatus(), mRGBBackInfo.getbStatus());
            }
        });
        btnClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                HDLCommand.lightRGBCtrl(appliancesInfo, 0, mRGBBackInfo.getrStatus(), mRGBBackInfo.getgStatus(), mRGBBackInfo.getbStatus());
            }
        });
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            }
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                if (seekBar.getProgress() > 0) {
                    settingBrightness = seekBar.getProgress();
                }
                HDLCommand.lightRGBCtrl(appliancesInfo, seekBar.getProgress(), mRGBBackInfo.getrStatus(), mRGBBackInfo.getgStatus(), mRGBBackInfo.getbStatus());
            }
        });
    }
    private void displayStateView() {
        switch (appliancesInfo.getDeviceType()) {
            case HDLApConfig.TYPE_LIGHT_RGB:
                break;
            default:
                finish();//设备类型不对结束页面
                break;
        }
        /**根据需求是否发送一次获取刷新状态请求*/
    }
    /**
     * showRGBBackInfoInfo
     *
     * @param mRGBBackInfo
     */
    private void showRGBBackInfoInfo(RGBBackInfo mRGBBackInfo) {
        String message = "";
        if (mRGBBackInfo.getBrightness() > 0) {
            //如果大于0才记住当前设置的亮度值,下次打开时继续这个亮度值
            settingBrightness = mRGBBackInfo.getBrightness();
            message = "当前状态:开";
            message += "\n" + "亮度:" + mRGBBackInfo.getBrightness();
            message += "\n" + "R:" + mRGBBackInfo.getrStatus();
            message += "\n" + "G:" + mRGBBackInfo.getgStatus();
            message += "\n" + "B:" + mRGBBackInfo.getbStatus();
        } else {
            message = "当前状态:关";
        }
        seekBar.setProgress(mRGBBackInfo.getBrightness());
        etR.setText(String.valueOf(mRGBBackInfo.getrStatus()));
        etG.setText(String.valueOf(mRGBBackInfo.getgStatus()));
        etB.setText(String.valueOf(mRGBBackInfo.getbStatus()));
        switchText.setText(message);
        showToast(message);
        HDLLog.I(message);
    }
    /**
     * RGB控制回调Event
     *
     * @param event
     */
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onRGBCtrlBackEventMain(LightRGBCtrlBackEvent event) {
        if (event.getRGBBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
                && event.getRGBBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getRGBBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
        ) {
            if (!event.isSuccess()) {
                showToast("RGB灯控制超时,请重新再试");
                return;
            }
//            showToast("RGB灯控制成功");
            mRGBBackInfo = event.getRGBBackInfo();
            showRGBBackInfoInfo(mRGBBackInfo);
        }
    }
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onDeviceStateEventMain(DeviceStateEvent event) {
//        proDialog.dismiss();
        if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
        ) {
            //这个返回的信息是当前状态的
            switch (event.getAppliancesInfo().getDeviceType()) {
                case HDLApConfig.TYPE_LIGHT_RGB:
                    if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
                        if (!event.isSuccess()) {
                            showToast("获取RGB状态失败,请重新再试");
                            return;
                        }
                        String message = "";
                        RGBBackInfo rgbBackInfo = new RGBBackInfo(event.appliancesInfo);
                        if (rgbBackInfo == null) {
                            showToast("获取RGB状态失败,请重新再试");
                            return;
                        }
                        mRGBBackInfo = rgbBackInfo;
                        showRGBBackInfoInfo(mRGBBackInfo);
                    }
                    break;
            }
        }
    }
}
app/src/main/java/com/hdl/sdk/hdl_sdk/base/RGBLightBean.java
New file
@@ -0,0 +1,53 @@
package com.hdl.sdk.hdl_sdk.base;
/**
 * Created by jlchen on 2020/10/20.
 */
public class RGBLightBean {
//    private int lightType; //1-5//1单路 2CCT 3RGB 4RGBW 5RGBWY
    private int rStatus;    //R
    private int gStatus;    //G
    private int bStatus;    //B
    private int brightness; //当前真实亮度brightness
    private int setbrightness; //上一次设置的亮度
    public int getrStatus() {
        return rStatus;
    }
    public void setrStatus(int rStatus) {
        this.rStatus = rStatus;
    }
    public int getgStatus() {
        return gStatus;
    }
    public void setgStatus(int gStatus) {
        this.gStatus = gStatus;
    }
    public int getbStatus() {
        return bStatus;
    }
    public void setbStatus(int bStatus) {
        this.bStatus = bStatus;
    }
    public int getBrightness() {
        return brightness;
    }
    public void setBrightness(int brightness) {
        this.brightness = brightness;
    }
    public int getSetbrightness() {
        return setbrightness;
    }
    public void setSetbrightness(int setbrightness) {
        this.setbrightness = setbrightness;
    }
}
app/src/main/res/layout/activity_ctrl_cct_light.xml
New file
@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_ctrl"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!--    <include-->
    <!--        android:id="@+id/hdl_top_bar_layout"-->
    <!--        layout="@layout/hdl_toolbar_top_view_b"/>-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:gravity="center|left"
            android:text="CCT灯设备"
            android:textSize="@dimen/ts_24"
            />
        <TextView
            android:id="@+id/switchText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="这个按钮做CCT灯的演示"
            android:textSize="@dimen/ts_20" />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp">
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:text="亮度:"
                android:textSize="12sp"></TextView>
            <SeekBar
                android:id="@+id/sb_brightness"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:max="100"
                android:min="0"></SeekBar>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp">
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:text="色温:"
                android:textSize="12sp"></TextView>
            <SeekBar
                android:id="@+id/sb_cct"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:max="100"
                android:min="0"></SeekBar>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="20dp"
            android:layout_marginLeft="40dp">
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:text="暖"
                android:textSize="12sp"></TextView>
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:textSize="12sp"></TextView>
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:text="冷"
                android:textSize="12sp"></TextView>
        </LinearLayout>
<!--        <LinearLayout-->
<!--            android:layout_width="match_parent"-->
<!--            android:layout_height="40dp"-->
<!--            android:layout_marginTop="20dp">-->
<!--            <TextView-->
<!--                android:layout_width="20dp"-->
<!--                android:layout_height="match_parent"-->
<!--                android:gravity="center"-->
<!--                android:text="R:"-->
<!--                android:textSize="18sp"></TextView>-->
<!--            <EditText-->
<!--                android:id="@+id/et_r"-->
<!--                android:layout_width="match_parent"-->
<!--                android:layout_height="match_parent"-->
<!--                android:layout_weight="1"-->
<!--                android:inputType="number"-->
<!--                android:maxLength="3"-->
<!--                android:text="255"></EditText>-->
<!--            <TextView-->
<!--                android:layout_width="20dp"-->
<!--                android:layout_height="match_parent"-->
<!--                android:text="G:"-->
<!--                android:gravity="center"-->
<!--                android:textSize="18sp"></TextView>-->
<!--            <EditText-->
<!--                android:id="@+id/et_g"-->
<!--                android:layout_width="match_parent"-->
<!--                android:layout_height="match_parent"-->
<!--                android:layout_weight="1"-->
<!--                android:inputType="number"-->
<!--                android:maxLength="3"-->
<!--                android:text="255"></EditText>-->
<!--            <TextView-->
<!--                android:layout_width="20dp"-->
<!--                android:layout_height="match_parent"-->
<!--                android:text="B:"-->
<!--                android:gravity="center"-->
<!--                android:textSize="18sp"></TextView>-->
<!--            <EditText-->
<!--                android:id="@+id/et_b"-->
<!--                android:layout_width="match_parent"-->
<!--                android:layout_height="match_parent"-->
<!--                android:layout_weight="1"-->
<!--                android:inputType="number"-->
<!--                android:maxLength="3"-->
<!--                android:text="255"></EditText>-->
<!--        </LinearLayout>-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp">
            <Button
                android:id="@+id/btnOpen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="开灯" />
            <Button
                android:id="@+id/btnClose"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="关灯" />
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>
app/src/main/res/layout/activity_ctrl_r_g_b_light.xml
New file
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_ctrl"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!--    <include-->
    <!--        android:id="@+id/hdl_top_bar_layout"-->
    <!--        layout="@layout/hdl_toolbar_top_view_b"/>-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:gravity="center|left"
            android:text="RGB灯设备"
            android:textSize="@dimen/ts_24"
            />
        <TextView
            android:id="@+id/switchText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="这个按钮做RGB灯的演示"
            android:textSize="@dimen/ts_20" />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp">
            <TextView
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:text="亮度:"
                android:textSize="12sp"></TextView>
            <SeekBar
                android:id="@+id/sb_brightness"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:max="100"
                android:min="0"></SeekBar>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp">
            <TextView
                android:layout_width="20dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="R:"
                android:textSize="18sp"></TextView>
            <EditText
                android:id="@+id/et_r"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:inputType="number"
                android:maxLength="3"
                android:text="255"></EditText>
            <TextView
                android:layout_width="20dp"
                android:layout_height="match_parent"
                android:text="G:"
                android:gravity="center"
                android:textSize="18sp"></TextView>
            <EditText
                android:id="@+id/et_g"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:inputType="number"
                android:maxLength="3"
                android:text="255"></EditText>
            <TextView
                android:layout_width="20dp"
                android:layout_height="match_parent"
                android:text="B:"
                android:gravity="center"
                android:textSize="18sp"></TextView>
            <EditText
                android:id="@+id/et_b"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:inputType="number"
                android:maxLength="3"
                android:text="255"></EditText>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginTop="20dp">
            <Button
                android:id="@+id/btnRGB"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="单独设置RGB" />
            <Button
                android:id="@+id/btnOpen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="开灯" />
            <Button
                android:id="@+id/btnClose"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="关灯" />
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Config/Configuration.java
@@ -19,7 +19,7 @@
    public static final int SECURITY_BIG_TYPE = 10;
    public static final int LOGIC_BIG_TYPE = 12;
    public static final int GLOBAL_LOGIC_BIG_TYPE = 17;
    /**
    /**E3D8
     * 新风系统
     */
    public static final int FRESH_AIR_BIG_TYPE = 19;
@@ -79,6 +79,18 @@
    public static final int LIGHT_STATE_COMMAND = 0x0033;
    public static final int LIGHT_STATE_BACK_COMMAND = 0x0034;
    //RGB CCT 灯光操作码、状态读取码
    public static final int LIGHT_RGB_CTRL_COMMAND = 0xE45C;
    public static final int LIGHT_RGB_CTRL_BACK_COMMAND = 0xE45D;
    public static final int LIGHT_RGB_STATE_COMMAND = 0xE472;
    public static final int LIGHT_RGB_STATE_BACK_COMMAND = 0xE473;
//    //CCT灯光操作码、状态读取码
//    public static final int LIGHT_CCT_CTRL_COMMAND = 0xE45C;
//    public static final int LIGHT_CCT_CTRL_BACK_COMMAND = 0xE45D;
//    public static final int LIGHT_CCT_STATE_COMMAND = 0xE472;
//    public static final int LIGHT_CCT_STATE_BACK_COMMAND = 0xE473;
    //窗帘操作码、状态读取码
    public static final int CURTAIN_CTRL_COMMAND = 0xE3E0;
    public static final int CURTAIN_CTRL_BACK_COMMAND = 0xE3E1;
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/Config/HDLApConfig.java
@@ -10,6 +10,10 @@
    public static final int TYPE_LIGHT_RELAY = 102;
    public static final int TYPE_LIGHT_MIX_DIMMER = 103;
    public static final int TYPE_LIGHT_MIX_RELAY = 104;
    public static final int TYPE_LIGHT_CCT = 107;
    public static final int TYPE_LIGHT_RGB = 108;
    public static final int TYPE_CURTAIN_GLYSTRO = 201;
    public static final int TYPE_CURTAIN_ROLLER = 202;
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/CCTBackInfo.java
New file
@@ -0,0 +1,76 @@
package com.hdl.sdk.hdl_core.HDLAppliances.HDLLight;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
/**
 * Created by JLChen on 2020/10/20
 */
public class CCTBackInfo {
    private AppliancesInfo appliancesInfo;
    private int brightness; //亮度
    private int lightType; //1-5//1单路 2CCT 3RGB 4RGBW 5RGBWY
    private int cctValue; //当前色温值
    private byte[] curState;//控制回馈信息
    public int getCctValue() {
        return cctValue;
    }
    public void setCctValue(int cctValue) {
        this.cctValue = cctValue;
    }
    public CCTBackInfo() {
    }
    /**
     * GeothermalBackInfo
     * @param mAppliancesInfo
     */
    public CCTBackInfo(AppliancesInfo mAppliancesInfo) {
        this.appliancesInfo = mAppliancesInfo;
        this.curState = mAppliancesInfo.getFeedbackState();
        if (this.curState == null) return;
        if (this.curState.length >= 9) {
            this.brightness = this.curState[1] & 0xFF;
            this.lightType = this.curState[5] & 0xFF;
            int high = this.curState[6] & 0xFF;
            int low = this.curState[7] & 0xFF;
            this.cctValue = high * 256 + low;
        }
    }
    public AppliancesInfo getAppliancesInfo() {
        return appliancesInfo;
    }
    public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
        this.appliancesInfo = appliancesInfo;
    }
    public int getBrightness() {
        return brightness;
    }
    public void setBrightness(int brightness) {
        this.brightness = brightness;
    }
    public int getLightType() {
        return lightType;
    }
    public void setLightType(int lightType) {
        this.lightType = lightType;
    }
    public byte[] getCurState() {
        return curState;
    }
    public void setCurState(byte[] curState) {
        this.curState = curState;
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLLight/RGBBackInfo.java
New file
@@ -0,0 +1,113 @@
package com.hdl.sdk.hdl_core.HDLAppliances.HDLLight;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
/**
 * Created by JLChen on 2020/10/20
 * ///1 逻辑回路号
 * ///2 整体亮度
 * ///3 颜色号 固定为 254
 * ///4 运行时间 高位
 * ///5 运行时间 低位
 * ///6 逻辑灯类型 1-5    //1单路 2CCT 3RGB 4RGBW 5RGBWY
 * ///7 逻辑回路 通道1的值 //RGB最大值是255 其它类为最大为100
 * ///8 逻辑回路 通道2的值 //RGB最大值是255 其它类为最大为100
 * ///9 逻辑回路 通道3的值 //RGB最大值是255 其它类为最大为100
 * ///10 逻辑回路 通道4的值 //RGB最大值是255 其它类为最大为100
 * ///11 逻辑回路 通道5的值 //RGB最大值是255 其它类为最大为100
 *
 * (7~11位数据)
 * 或CCT时:一般2000-7000K(高位在前、低位在后) 2BYTE+3BYTE(无效)   (5BYTE)
 * 或RGB时:R、G、B(0-255),        3BYTE+2BYTE(无效)            (5BYTE)
 */
public class RGBBackInfo {
    private AppliancesInfo appliancesInfo;
    private int brightness; //亮度
    private int lightType; //1-5//1单路 2CCT 3RGB 4RGBW 5RGBWY
    private int rStatus;    //R
    private int gStatus;    //G
    private int bStatus;    //B
    private byte[] curState;//控制回馈信息
    public RGBBackInfo() {
    }
    /**
     * GeothermalBackInfo
     *
     * @param mAppliancesInfo
     */
    public RGBBackInfo(AppliancesInfo mAppliancesInfo) {
        this.appliancesInfo = mAppliancesInfo;
        this.curState = mAppliancesInfo.getFeedbackState();
        if (this.curState == null) return;
        if (this.curState.length >= 9) {
            this.brightness = this.curState[1] & 0xFF;
            this.lightType = this.curState[5] & 0xFF;
            this.rStatus = this.curState[6] & 0xFF;
            this.gStatus = this.curState[7] & 0xFF;
            this.bStatus = this.curState[8] & 0xFF;
        }
    }
    public AppliancesInfo getAppliancesInfo() {
        return appliancesInfo;
    }
    public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
        this.appliancesInfo = appliancesInfo;
    }
    public int getBrightness() {
        return brightness;
    }
    public void setBrightness(int brightness) {
        this.brightness = brightness;
    }
    public int getLightType() {
        return lightType;
    }
    public void setLightType(int lightType) {
        this.lightType = lightType;
    }
    public int getrStatus() {
        return rStatus;
    }
    public void setrStatus(int rStatus) {
        this.rStatus = rStatus;
    }
    public int getgStatus() {
        return gStatus;
    }
    public void setgStatus(int gStatus) {
        this.gStatus = gStatus;
    }
    public int getbStatus() {
        return bStatus;
    }
    public void setbStatus(int bStatus) {
        this.bStatus = bStatus;
    }
    public byte[] getCurState() {
        return curState;
    }
    public void setCurState(byte[] curState) {
        this.curState = curState;
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
@@ -16,6 +16,7 @@
import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.Parser.GeothermalParser;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.LightCtrlBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLogic.LogicCtrlBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLSecurity.Parser.SecurityParser;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
@@ -29,6 +30,7 @@
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightRGBCtrlBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent;
import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog;
import com.hdl.sdk.hdl_core.Util.NetUtil.NetWorkUtil;
@@ -60,6 +62,8 @@
    private static Timer securityCtrlFailTimer = null;//安防模块操作失败Timer
    private static Timer commonSwitchCtrlFailTimer = null;//通用开关失败Timer
    private static Timer lightRgbCtrlFailTimer = null;//RGB失败Timer
    private static Timer lightCCTCtrlFailTimer = null;//CCT失败Timer
    /**
     * 初始化
@@ -73,6 +77,7 @@
    /**
     * 开启bus模式
     * 启用6000端口
     *
     * @param context
     */
    public static void startHomeMode(Context context) {
@@ -86,6 +91,7 @@
    /**
     * 开启RCU模式
     * 启用6008端口
     *
     * @param context
     * @param newRcuIp RCU的IP地址
     */
@@ -107,15 +113,17 @@
    /**
     * 获取本地广播IP
     *
     * @return
     */
    public static String getLocalBroadCastIp(){
    public static String getLocalBroadCastIp() {
        return NetWorkUtil.getLocalBroadCast();
    }
    /**
     * 是否开启SDK日志打印
     * 2019-07-10新增
     *
     * @param bOpen
     */
    public static void setHDLLogOpen(boolean bOpen) {
@@ -133,7 +141,6 @@
//    private static void devicesSearch() {
//        HandleSearch.getRcuIp();
//    }
    /**
@@ -762,8 +769,8 @@
                            && info.getChannelNum() == infos.get(j).getChannelNum()
                    ) {
                        //这里应该是要修复的,暂时未找到。
                         //20190712解决强制转换int类型闪退
                        int  state = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject());
                        //20190712解决强制转换int类型闪退
                        int state = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject());
                        switch (state) {
                            case -1:
                                curState = 0;
@@ -1139,6 +1146,7 @@
    /**
     * 获取通用开关状态
     *
     * @param info
     */
    public static void getCommonSwitchStateFromNetwork(final AppliancesInfo info) {
@@ -1159,6 +1167,7 @@
    /**
     * 获取安防模块状态
     *
     * @param info
     */
    public static void getSecurityStateFromNetwork(final AppliancesInfo info) {
@@ -1180,6 +1189,7 @@
    /**
     * 安防模块 布防设置
     * 2020-06-23
     *
     * @param info
     */
    public static void securityArmingCtrl(final AppliancesInfo info, int state) {
@@ -1197,7 +1207,7 @@
                @Override
                public void run() {
                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                        EventBus.getDefault().post(new SecurityArmingFeedBackEvent(info,0, false));
                        EventBus.getDefault().post(new SecurityArmingFeedBackEvent(info, 0, false));
                    }
                }
            }, 5000);
@@ -1231,6 +1241,7 @@
    /**
     * 获取干接点传感器模块状态
     *
     * @param info
     */
    public static void getDryContactSensorStateFromNetwork(final AppliancesInfo info) {
@@ -1281,4 +1292,130 @@
        }
    }
    /**************************************2020-10-20 新增***************************************/
    /**
     * 控制RGB
     *
     * @param info
     */
    public static void lightRGBCtrl(final AppliancesInfo info, int brightness, int rStatus, int gStatus, int bStatus) {
        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
        if (info.getBigType() == Configuration.LIGTH_BIG_TYPE) {
            if (lightRgbCtrlFailTimer != null) {
                lightRgbCtrlFailTimer.cancel();
                lightRgbCtrlFailTimer = null;
            }
            byte[] bytes = new byte[]{
                    (byte) info.getChannelNum(),
                    (byte) brightness,
                    (byte) 254,
                    0,
                    0,
                    3,
                    (byte) rStatus,
                    (byte) gStatus,
                    (byte) bStatus,
                    0,
                    0
            };
            addSendData(info, bytes, Configuration.CONTROL);
            lightRgbCtrlFailTimer = new Timer();
            lightRgbCtrlFailTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                        HDLLog.info("RGB控制失败");
                        RGBBackInfo mRGBBackInfo = new RGBBackInfo();
                        mRGBBackInfo.setAppliancesInfo(info);
                        EventBus.getDefault().post(new LightRGBCtrlBackEvent(mRGBBackInfo, false));
                    }
                }
            }, mRequestTimeout);
        } else {
            HDLLog.info("djlCtrl: 设备控制不在范围内"
                    + " LittleType = " + info.getLittleType()
                    + " BigType = " + info.getBigType()
            );
        }
    }
    /**
     * 获取CCT 或者RGB灯状态
     *
     * @param info
     */
    public static void getRGBCCTStateFromNetwork(final AppliancesInfo info) {
        if (info == null) {
            return;
        }
        HDLDeviceManager.isGetDeviceStateSuccess = false;
        switch (info.getDeviceType()) {
            case HDLApConfig.TYPE_LIGHT_RGB:
            case HDLApConfig.TYPE_LIGHT_CCT:
                //发送CCT RGB状态数据
                addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
                break;
            default:
                HDLLog.info("不是安防模块");
                break;
        }
    }
    /**
     * 控制CCT
     *
     * @param info
     */
    public static void lightCCTCtrl(final AppliancesInfo info, int brightness, int cctStatus) {
        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
        if (info.getBigType() == Configuration.LIGTH_BIG_TYPE) {
            if (lightCCTCtrlFailTimer != null) {
                lightCCTCtrlFailTimer.cancel();
                lightCCTCtrlFailTimer = null;
            }
            byte[] bytes = new byte[]{
                    (byte) info.getChannelNum(),
                    (byte) brightness,
                    (byte) 254,
                    0,
                    0,
                    2,
                    (byte) (cctStatus / 256),
                    (byte) (cctStatus % 256),
                    0,
                    0,
                    0
            };
            addSendData(info, bytes, Configuration.CONTROL);
            lightCCTCtrlFailTimer = new Timer();
            lightCCTCtrlFailTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                        HDLLog.info("RGB控制失败");
                        RGBBackInfo mRGBBackInfo = new RGBBackInfo();
                        mRGBBackInfo.setAppliancesInfo(info);
                        EventBus.getDefault().post(new LightRGBCtrlBackEvent(mRGBBackInfo, false));
                    }
                }
            }, mRequestTimeout);
        } else {
            HDLLog.info("djlCtrl: 设备控制不在范围内"
                    + " LittleType = " + info.getLittleType()
                    + " BigType = " + info.getBigType()
            );
        }
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -17,7 +17,9 @@
import com.hdl.sdk.hdl_core.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLFreshAir.FreshAirBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.CCTBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.LightCtrlBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLogic.LogicCtrlBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLogic.LogicMode;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLSecurity.SecurityBackInfo;
@@ -38,8 +40,10 @@
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.LightCCTCtrlBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightRGBCtrlBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.WarningInfoEvent;
@@ -118,28 +122,30 @@
    /**
     * 配置简易编程搜索返回的默认参数
     * @param mSDKLocalBigClass 大类ID
     *
     * @param mSDKLocalBigClass   大类ID
     * @param mSDKLocalSmallClass 小类ID
     * @param mSDKLocalRemark 备注
     * @param mSDKLocalRemark     备注
     */
    public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass, String mSDKLocalRemark){
    public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass, String mSDKLocalRemark) {
        SDKLocalBigClass = mSDKLocalBigClass;
        SDKLocalSmallClass = mSDKLocalSmallClass;
        if(mSDKLocalRemark != null){
        if (mSDKLocalRemark != null) {
            SDKLocalRemark = mSDKLocalRemark;
        }
        isAllowEasyProgrammingSearch = true;
    }
    public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass){
        setEasyProgrammingSearchLocalData(mSDKLocalBigClass, mSDKLocalSmallClass,null);
    public static void setEasyProgrammingSearchLocalData(int mSDKLocalBigClass, int mSDKLocalSmallClass) {
        setEasyProgrammingSearchLocalData(mSDKLocalBigClass, mSDKLocalSmallClass, null);
    }
    /**
     * 设置是否允许被简易编程搜索
     *
     * @param isAllow
     */
    public static void setIsAllowEasyProgrammingSearch(boolean isAllow){
    public static void setIsAllowEasyProgrammingSearch(boolean isAllow) {
        isAllowEasyProgrammingSearch = isAllow;
    }
@@ -180,6 +186,12 @@
            case Configuration.AIR_HVAC_CTRL_BACK_COMMAND:
            case Configuration.FRESH_AIR_CTRL_BACK_COMMAND:     //20190709新增
                handleCtrlData(getDatas);
                break;
            case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND:     //2020-10-19新增
                handleRGBCCTCtrlData(getDatas);
                break;
            case Configuration.LIGHT_RGB_STATE_BACK_COMMAND:     //2020-10-19新增
                handleRGBCCTStateData(getDatas);
                break;
            case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND://20190709新增
                handleGeothermalCtrlData(getDatas);
@@ -326,7 +338,7 @@
     * @param getDatas
     */
    private static void sendDeviceSearchBackInfo(UdpDataBean getDatas) {
        byte[]  remarkByte = StringUtil.stringtoBytes(SDKLocalRemark);
        byte[] remarkByte = StringUtil.stringtoBytes(SDKLocalRemark);
        byte[] addBytes = new byte[25];
        addBytes[0] = getDatas.addBytes[0];
        addBytes[1] = getDatas.addBytes[1];
@@ -352,11 +364,12 @@
    /**
     * 收到简易编程搜索非网络设备
     *
     * @param getDatas
     */
    public static void handleDeviceSearchBackData(UdpDataBean getDatas){
    public static void handleDeviceSearchBackData(UdpDataBean getDatas) {
        //判断是否允许被简易编程搜索和回复
        if(!isAllowEasyProgrammingSearch) return;
        if (!isAllowEasyProgrammingSearch) return;
        if (getDatas.addBytes.length == 2) {
            sendDeviceSearchBackInfo(getDatas);
@@ -365,7 +378,7 @@
            for (int i = 2, len = getDatas.addBytes.length; i < len; i++) {
                if (i % 2 == 0) {
                    if ((getDatas.addBytes[i] & 0xFF) == Crc.localSubnetID
                            && (getDatas.addBytes[i + 1] & 0xFF) ==  Crc.localDeviceID
                            && (getDatas.addBytes[i + 1] & 0xFF) == Crc.localDeviceID
                    ) {
                        isExit = true;
                        break;
@@ -373,14 +386,13 @@
                }
            }
            if(!isExit){
            if (!isExit) {
                sendDeviceSearchBackInfo(getDatas);
            }
        }
    }
    /**
@@ -595,9 +607,10 @@
     * 处理灯光返回
     * 2020-1-18
     * 修复混合调光混合开关 类模块问题
     *
     * @param getDatas
     */
    private static void handleLightCtrlData(UdpDataBean getDatas){
    private static void handleLightCtrlData(UdpDataBean getDatas) {
        if (TextUtils.isEmpty(HandleSearch.rcuIp)) {
            outter:
@@ -607,7 +620,7 @@
                ) {
                    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).getLittleType() == 9 || infos.get(j).getLittleType() == 10) {
                            if (infos.get(j).getPhysicsChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
@@ -628,7 +641,7 @@
                            }
                        }else {
                        } else {
                            if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
@@ -776,7 +789,7 @@
                        List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                        inner:
                        for (int j = 0, len2 = infos.size(); j < len2; j++) {
                            if(infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO
                            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
                            ) {
@@ -1981,7 +1994,7 @@
                                            hvacBytes[i - 23] = getDatas.addBytes[i];
                                        }
                                        HDLLog.info("获取备注Configuration.AIR_BIG_TYPE:  "+ StringUtil.ByteArrToHex(hvacBytes,0, hvacBytes.length));
                                        HDLLog.info("获取备注Configuration.AIR_BIG_TYPE:  " + StringUtil.ByteArrToHex(hvacBytes, 0, hvacBytes.length));
                                        devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(hvacBytes);
//                                        switch (devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getChannelNum()) {
@@ -2409,7 +2422,7 @@
                        devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes);
                        EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
                        break outter;
                    }else {
                    } else {
                        HDLLog.info("handleFreshAirStateData 没有找到匹配类型");
                    }
                }
@@ -2450,7 +2463,7 @@
                        }
                        break outter;
                    }else {
                    } else {
                        HDLLog.info("handleFreshAirStateData 没有找到匹配类型");
                    }
                }
@@ -2458,7 +2471,6 @@
            }
        }
    }
    /**
@@ -2554,21 +2566,23 @@
    /**
     * 设置控制是否成功状态
     *
     * @param info
     * @param success
     */
    public static void setDeviceCtrlSuccessStateWithInfo(AppliancesInfo info, Boolean success){
    public static void setDeviceCtrlSuccessStateWithInfo(AppliancesInfo info, Boolean success) {
        ctrlSuccessStateHashMap.put(info.getDeviceKey(), success);
    }
    /**
     * 获取是否控制成功
     *
     * @param info
     * @return 结果
     */
    public static Boolean getDeviceCtrlSuccessStateWithInfo(AppliancesInfo info){
        Boolean success =  ctrlSuccessStateHashMap.get(info.getDeviceKey());
        if(success == null) success = false;
    public static Boolean getDeviceCtrlSuccessStateWithInfo(AppliancesInfo info) {
        Boolean success = ctrlSuccessStateHashMap.get(info.getDeviceKey());
        if (success == null) success = false;
        return success;
    }
@@ -2576,6 +2590,7 @@
     * 保存设备数据列表
     * 根据需要,实时保存当前数据
     * 2019-10-14
     *
     * @return boolean
     */
    public static boolean saveDevicesDataList() {
@@ -2619,7 +2634,7 @@
            HandleSearch.curSearchMode = HandleSearch.GET_RCU_DEVICES;
            HDLUdpCore.closeSocket6000();
            HDLUdpCore.init6008();
        }else {
        } else {
            HandleSearch.curSearchMode = HandleSearch.GET_BUS_DEVICES;
            HDLUdpCore.closeSocket6008();
            HDLUdpCore.init6000();
@@ -2629,8 +2644,7 @@
    }
    private static void setRemarkList(){
    private static void setRemarkList() {
        listRemarks.clear();
        for (int j = 0; j < devicesDataList.size(); j++) {
            if (devicesDataList.get(j).getAppliancesInfoList().get(0).getBigType() != Configuration.AUDIO_BIG_TYPE) {
@@ -2877,4 +2891,106 @@
    }
    /**
     * RGB CCT设备控制数据
     * 2020-10-20 新增
     *
     * @param getDatas
     */
    private static void handleRGBCCTCtrlData(UdpDataBean getDatas) {
        if (getDatas.addBytes.length >= 9) {
            //1-5//1单路 2CCT 3RGB 4RGBW 5RGBWY
            if (getDatas.addBytes[5] == 3) {//RGB
                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.LIGTH_BIG_TYPE
                                    && infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB
                                    && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)
                            ) {
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes);
                                AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
                                RGBBackInfo info = new RGBBackInfo(mInfo);
                                setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                EventBus.getDefault().post(new LightRGBCtrlBackEvent(info, true));
                            }
                        }
                        break outter;//跳出循环
                    }
                }
            } else if (getDatas.addBytes[5] == 2) {//CCT
                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.LIGTH_BIG_TYPE
                                    && infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT
                                    && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)
                            ) {
                                devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes);
                                AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
                                CCTBackInfo info = new CCTBackInfo(mInfo);
                                setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
                                EventBus.getDefault().post(new LightCCTCtrlBackEvent(info, true));
                            }
                        }
                        break outter;//跳出循环
                    }
                }
            }
        }
    }
    /**
     * RGB CCT 状态读取回复数据
     * 2020-10-20 新增
     *
     * @param getDatas
     */
    private static void handleRGBCCTStateData(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++) {
                    if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE
                            && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT)
                            && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
                        if (getDatas.addBytes.length >= 9) {
                            byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState();
                            if (getBytes == null || getBytes.length < 9) {//标准协议长度是11,但是抓包发现有的设备会少于11
                                getBytes = new byte[11];
                            }
                            System.arraycopy(getDatas.addBytes, 0, getBytes, 0, Math.min(getDatas.addBytes.length, 11));
                            devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes);
                            isGetDeviceStateSuccess = true;
                            EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
                        } else {
                            HDLLog.E("RGB CCT状态反馈数据异常");
                        }
                        break outter;
                    } else {
//                        HDLLog.info("handleFreshAirStateData 没有找到匹配类型");
                    }
                }
                break outter;
            }
        }
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java
@@ -31,8 +31,6 @@
    private static DatagramSocket datagramSocket6000 = null;
    /**
     * 发送数据包
     * 点对点或广播
@@ -40,7 +38,7 @@
     * @param sendDatas
     */
    public static void sendData(final Crc sendDatas) {
        HDLLog.info("HDLsendData:  "+ StringUtil.ByteArrToHex(sendDatas.GetSendBytes(),0, sendDatas.GetSendBytes().length));
        HDLLog.info("HDLsendData:  " + StringUtil.ByteArrToHex(sendDatas.GetSendBytes(), 0, sendDatas.GetSendBytes().length));
//        sendTestCMD(sendDatas.GetSendBytes(), HDLTest.SEND_TEST_PORT);
        new Thread(new Runnable() {
@@ -71,12 +69,11 @@
                    sendSocket.send(packet);
                    sendSocket.close();
                } catch (Exception e) {
                    HDLLog.info( "HDL 发送操作命令失败:" + e);
                    HDLLog.info("HDL 发送操作命令失败:" + e);
                }
            }
        }).start();
    }
    /**
@@ -178,9 +175,9 @@
     */
    public static void init6008() {
        if (datagramSocket6008 != null) {
            HDLLog.info( "HDL SDK 6008 已启动");
            HDLLog.info("HDL SDK 6008 已启动");
        } else {
            HDLLog.info( "HDLSocket 6008 init");
            HDLLog.info("HDLSocket 6008 init");
//            sdkHeartBeat();
            new Thread(new Runnable() {
                @Override
@@ -221,9 +218,9 @@
     */
    public static void init6000() {
        if (datagramSocket6000 != null) {
            HDLLog.info( "HDL SDK 6000 已启动");
            HDLLog.info("HDL SDK 6000 已启动");
        } else {
            HDLLog.info( "HDLSocket 6000 init");
            HDLLog.info("HDLSocket 6000 init");
//            sdkHeartBeat();
            new Thread(new Runnable() {
                @Override
@@ -338,7 +335,7 @@
            return;
        }
        HDLLog.info("HDL ReceiveBytes:  "+ StringUtil.ByteArrToHex(receiveBytes,0, receiveBytes.length));
//        HDLLog.info("HDL ReceiveBytes:  " + StringUtil.ByteArrToHex(receiveBytes, 0, receiveBytes.length));
        //校验是否为HDL 数据
        byte[] hdlDataVerify = new byte[10];
@@ -391,7 +388,7 @@
//        }
        //2019-10-8 目标子网号设备号过滤判断
        if((targetSubnetID == 0xFF && targetDeviceID == 0xFF) || (targetSubnetID == Crc.localSubnetID && targetDeviceID == Crc.localDeviceID)) {
        if ((targetSubnetID == 0xFF && targetDeviceID == 0xFF) || (targetSubnetID == Crc.localSubnetID && targetDeviceID == Crc.localDeviceID)) {
            HandleOutsideData(targetSubnetID, targetDeviceID, command, usefulBytes, receiveBytes, udpDataBean);
            HandleInsideData(udpDataBean);
        }
@@ -416,7 +413,7 @@
                    if (sendDatas.addBytes[0] == HandleSearch.random1
                            && sendDatas.addBytes[1] == HandleSearch.random2
                            && HandleSearch.rcuIp.equals(sendDatas.ipAddress)
                            ) {
                    ) {
                        HDLDeviceManager.handle(sendDatas, sendDatas.command);
                    }
@@ -440,6 +437,9 @@
            case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://20190729 报警设置反馈
            case Configuration.DRY_CONTACT_STATE_BACK_COMMAND:
            case Configuration.DRY_CONTACT_BROADCAST_STATE_COMMAND://2020-06-23 增加干接点状态回复
            case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND://2020-10-19  增加RGB CCT控制回复
            case Configuration.LIGHT_RGB_STATE_BACK_COMMAND://2020-10-19  增加RGB CCT状态回复
            case Configuration.CURTAIN_STATE_BACK_COMMAND:
            case Configuration.AIR_STATE_BACK_COMMAND:
@@ -472,7 +472,7 @@
            case Configuration.RCU_SEARCH_COMMAND:
                if (sendDatas.port == Configuration.RCU_SEND_PORT) {
                    HDLLog.info( "收到搜索RCU命令");
                    HDLLog.info("收到搜索RCU命令");
                    HDLDeviceManager.handle(sendDatas, sendDatas.command);
                }
@@ -484,7 +484,7 @@
//                    HDLDeviceManager.handle(sendDatas, Configuration.RCU_READ);
//                }
                if (sendDatas.port == Configuration.RCU_SEND_PORT) {
                    HDLLog.info( "收到读取SDK信息命令");
                    HDLLog.info("收到读取SDK信息命令");
                    HDLDeviceManager.handle(sendDatas, sendDatas.command);
                }
@@ -585,14 +585,13 @@
//        }
        if (command == Configuration.AUDIO_CTRL_READ_COMMAND
                || command == Configuration.AUDIO_CTRL_READ_BACK_COMMAND
                || command == Configuration.MUSIC2_COMMAND
                || command == Configuration.MUSIC3_COMMAND
                || command == Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND
                || command == Configuration.AUDIO_MenuPlay_INSTRUCTION_BACK_COMMAND
                ) {
        ) {
            //处理向往的音乐模块
            new Thread(new Runnable() {
                @Override
@@ -608,7 +607,7 @@
                        socket6001.send(packet);
                        socket6001.close();
                    } catch (Exception e) {
                        HDLLog.info( "HDL 发送命令失败:" + e);
                        HDLLog.info("HDL 发送命令失败:" + e);
                    }
                }
            }).start();
@@ -645,6 +644,7 @@
    /**
     * 判断是否为HDL数据
     *
     * @param bytes
     * @return
     */
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/LightCCTCtrlBackEvent.java
New file
@@ -0,0 +1,24 @@
package com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.CCTBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
/**
 * Created by jlchen on 2020/10/20.
 */
public class LightCCTCtrlBackEvent {
    CCTBackInfo mCCTBackInfo;
    boolean isSuccess;
    public LightCCTCtrlBackEvent(CCTBackInfo cctBackInfo, boolean isSuccess){
        this.isSuccess = isSuccess;
        this.mCCTBackInfo = cctBackInfo;
    }
    public CCTBackInfo getCCTBackInfo() {
        return mCCTBackInfo;
    }
    public boolean isSuccess() {
        return isSuccess;
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/LightRGBCtrlBackEvent.java
New file
@@ -0,0 +1,23 @@
package com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLLight.RGBBackInfo;
/**
 * Created by jlchen on 2020/10/20.
 */
public class LightRGBCtrlBackEvent {
    RGBBackInfo mRGBBackInfo;
    boolean isSuccess;
    public LightRGBCtrlBackEvent(RGBBackInfo rgbBackInfo, boolean isSuccess){
        this.isSuccess = isSuccess;
        this.mRGBBackInfo = rgbBackInfo;
    }
    public RGBBackInfo getRGBBackInfo() {
        return mRGBBackInfo;
    }
    public boolean isSuccess() {
        return isSuccess;
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java
@@ -40,11 +40,18 @@
            appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
            appliancesInfoList.add(appliancesInfo);
        }
        int curCount = 0;//循环遍历所有设备次数
        while (curCount < sumCount) {
            int bigType = addBytes[21 + (2 * curCount) + (curCount + 1)] & 0xFF;
            int littleType = addBytes[21 + (2 * curCount) + (curCount + 2)] & 0xFF;
            int channelNum = addBytes[21 + (2 * curCount) + (curCount + 3)] & 0xFF;
            if(bigType == Configuration.LIGTH_BIG_TYPE && (littleType == 7 || littleType == 8)){
                //2020-10-20 如果是RGBhuozCCT先只使用1回路,后面看需要再修改,因为发现简易编程搜索,我发现这CCT或者RGB设备只用1,2个回路,但是他还是回复有60多个回路,后面讨论再处理
                //回路总数强制修改成1先
                channelNum = 1;
            }
            curCount++;
            int curChannelNum = 0;
            while (curChannelNum < channelNum) {
@@ -126,6 +133,12 @@
                        isWant = true;
                        break;
                    case 1:
                        isWant = true;
                        break;
                    case 7:
                        isWant = true;
                        break;
                    case 8:
                        isWant = true;
                        break;
                    case 9:
@@ -288,9 +301,11 @@
                break;
            case 7:
                appliancesInfo.setDeviceName("DALI");
                appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_CCT);
                break;
            case 8:
                appliancesInfo.setDeviceName("自定义逻辑灯");
                appliancesInfo.setDeviceName("自定义逻辑灯RGB");
                appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RGB);
                break;
            case 9:
                appliancesInfo.setDeviceName("混合调光类");
@@ -317,6 +332,14 @@
            appliancesInfo.setParentRemarks(parentRemarks);
            appliancesInfo.setPort(port);
            appliancesInfo.setIpAddress(ipAddress);
            if(littleType == 7 || littleType == 8){
                appliancesInfo.setCtrlCommand(Configuration.LIGHT_RGB_CTRL_COMMAND);
                appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_RGB_CTRL_BACK_COMMAND);
                appliancesInfo.setStateCommand(Configuration.LIGHT_RGB_STATE_COMMAND);
                appliancesInfo.setStateBackCommand(Configuration.LIGHT_RGB_STATE_BACK_COMMAND);
            }
        }
    }