panlili2024
2024-11-08 81d297dd33911dbfdc93dbc3fa9747e511b7ce8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package com.hdl.sdk.ttl.HDLAppliances.HDLLight;
 
 
import android.graphics.Color;
 
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
 
import java.io.Serializable;
import java.util.Arrays;
 
/**
 * Created by panlili on 2023/8/22.
 * CCT OR RGB
 */
 
public class ColourLightCtrlBackInfo implements Serializable {
    AppliancesInfo appliancesInfo;
    int channelNum;//回路号
    String remarks;//备注
    int brightness;//亮度
    int type = 0;//类型:1单路,2CCT,3RGB
    int colorTemp = 0;//色温
    int color;//RGB
    /**
     * 逻辑灯类型_单路调节
     */
    public static final int CONTROL_TYPE_SINGLE = 1;
    /**
     * 逻辑灯类型_CCT
     */
    public static final int CONTROL_TYPE_CCT = 2;
    /**
     * 逻辑灯类型_RGB
     */
    public static final int CONTROL_TYPE_RGB = 3;
 
    private byte[] curState;//控制回馈信息
 
    public ColourLightCtrlBackInfo() {
 
    }
 
    public ColourLightCtrlBackInfo(AppliancesInfo mAppliancesInfo) {
        this.appliancesInfo = mAppliancesInfo;
        this.curState = mAppliancesInfo.getArrCurState();
        this.remarks = mAppliancesInfo.getRemarks();
 
        if (this.curState == null) return;
 
        if (this.curState.length >= 10) {
            this.channelNum = this.curState[0] & 0xFF;
            this.brightness = this.curState[1] & 0xFF;
            this.type = this.curState[5] & 0xFF;
            if (this.type == CONTROL_TYPE_CCT) {
                this.colorTemp = (this.curState[6] & 0xFF) * 256 + (this.curState[7] & 0xFF);
            } else if (this.type == CONTROL_TYPE_RGB) {
                int color_r = this.curState[6] & 0xFF;
                int color_g = this.curState[7] & 0xFF;
                int color_b = this.curState[8] & 0xFF;
                this.color = Color.rgb(color_r, color_g, color_b);
            }
        }
 
    }
 
 
    public String getRemarks() {
        return remarks;
    }
 
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
 
    public AppliancesInfo getAppliancesInfo() {
        return appliancesInfo;
    }
 
    public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
        this.appliancesInfo = appliancesInfo;
    }
 
    public int getChannelNum() {
        return channelNum;
    }
 
    public void setChannelNum(int channelNum) {
        this.channelNum = channelNum;
    }
 
 
    public int getBrightness() {
        return brightness;
    }
 
    public void setBrightness(int brightness) {
        this.brightness = brightness;
    }
 
    public int getType() {
        return type;
    }
 
    public void setType(int type) {
        this.type = type;
    }
 
    public int getColorTemp() {
        return colorTemp;
    }
 
    public void setColorTemp(int colorTemp) {
        this.colorTemp = colorTemp;
    }
 
    public int getColor() {
        return color;
    }
 
    public void setColor(int color) {
        this.color = color;
    }
 
    public byte[] getCurState() {
        return curState;
    }
 
    public void setCurState(byte[] curState) {
        this.curState = curState;
    }
 
    @Override
    public String toString() {
        return "ColourLightCtrlBackInfo{" +
                "appliancesInfo=" + appliancesInfo +
                ", channelNum=" + channelNum +
                ", remarks='" + remarks + '\'' +
                ", brightness=" + brightness +
                ", type=" + type +
                ", colorTemp=" + colorTemp +
                ", color=" + color +
                ", curState=" + Arrays.toString(curState) +
                '}';
    }
}