JLChen
2021-11-05 de72a7843ceb868c89fc11983e315849caa28573
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
package com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser;
 
/**
 * Created by Tommy on 2017/7/21.
 */
 
public class CurtainCtrlParser {
    public static final int curtainPause = -1;//0
    public static final int curtainOn = -2;//1
    public static final int curtainOff = -3;//2
 
    public static final int TYPE_STATE_PAUSE = 0;
    public static final int TYPE_STATE_OPEN = 1;
    public static final int TYPE_STATE_CLOSE = 2;
 
//    //这个方法只处理了窗帘号小于17的情况
    public static byte[] getCurtainAddByte(int curtainNum, int state){
        byte[] addBytes;
        int newState = state;
        switch (state){
            case curtainPause:
                newState = 0;
                break;
            case curtainOn:
                newState = 1;
                break;
            case curtainOff:
                newState = 2;
                break;
            default:
                break;
        }
        addBytes = new byte[]{(byte) curtainNum, (byte) newState};
        return addBytes;
    }
 
//    //这个方法只处理了窗帘号小于17的情况
//    public static byte[] getCurtainAddByte(int curtainNum, int state){
//        return  new byte[]{(byte) curtainNum, (byte) state};
//    }
 
}