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
146
147
148
package com.hdl.sdk.ttl.HDLAppliances.HDLCurtain;
 
 
import android.util.Log;
 
import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
 
import java.io.Serializable;
import java.util.Arrays;
 
/**
 * Created by djl on 2017/4/1.
 * 窗帘模块
 */
 
public class CurtainCtrlBackInfo implements Serializable {
    public AppliancesInfo appliancesInfo;
    //窗帘号
    int num;
 
    int state;//0=停;1=开;2=关
    int precent;//百分比
    int type;//功能类型
 
    String remarks;
 
    String parentRemarks;
    private byte[] curState;//控制回馈信息
 
    public CurtainCtrlBackInfo() {
 
    }
 
    public CurtainCtrlBackInfo(AppliancesInfo mAppliancesInfo) {
        this.appliancesInfo = mAppliancesInfo;
        this.curState = mAppliancesInfo.getArrCurState();
        this.remarks = mAppliancesInfo.getRemarks();
 
        if (this.curState == null) return;
 
        if (this.curState.length >= 3) {
            this.type = this.curState[2] & 0xFF;
            Log.d("panlili", "CurtainCtrlBackInfo.java:CurtainCtrlBackInfo----->type= " + type);
            if (type == 1) {//=窗帘控制V1.1开关停
                this.state = this.curState[1] & 0xFF;
                switch (state) {//这里改成0,1,2
                    case 0:
                        state = CurtainCtrlParser.curtainPause;
                        break;
                    case 1:
                        state = CurtainCtrlParser.curtainOn;
                        break;
                    case 2:
                        state = CurtainCtrlParser.curtainOff;
                        break;
                    default:
                        state = 0;
                        break;
                }
            } else if (type == 2) {//=窗帘控制V1.1百分比
                this.precent = this.curState[1] & 0xFF;
            } else if (type == 0) {
                this.state = this.curState[1] & 0xFF;
            }
        }
 
    }
 
 
    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 getNum() {
        return num;
    }
 
    public void setNum(int num) {
        this.num = num;
    }
 
    public int getState() {
        return state;
    }
 
    public void setState(int state) {
        this.state = state;
    }
 
    public String getParentRemarks() {
        return parentRemarks;
    }
 
    public void setParentRemarks(String parentRemarks) {
        this.parentRemarks = parentRemarks;
    }
 
    public int getPrecent() {
        return precent;
    }
 
    public void setPrecent(int precent) {
        this.precent = precent;
    }
 
    public int getType() {
        return type;
    }
 
    public void setType(int type) {
        this.type = type;
    }
 
    public byte[] getCurState() {
        return curState;
    }
 
    public void setCurState(byte[] curState) {
        this.curState = curState;
    }
 
    @Override
    public String toString() {
        return "CurtainCtrlBackInfo{" +
                "appliancesInfo=" + appliancesInfo +
                ", num=" + num +
                ", state=" + state +
                ", precent=" + precent +
                ", type=" + type +
                ", remarks='" + remarks + '\'' +
                ", parentRemarks='" + parentRemarks + '\'' +
                ", curState=" + Arrays.toString(curState) +
                '}';
    }
}