lizhanwei
2020-02-17 ee16db5e1cbc1c27bdbc1984567b5e61a3d005dd
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
package safeluck.drive.evaluation.platformMessage;
 
import android.text.TextUtils;
 
import com.anyun.im_lib.util.ByteUtil;
 
/**
 * 获取学员信息消息(发送身份证ID上去给平台)
 * MyApplication2
 * Created by lzw on 2019/12/19. 18:26:35
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class GainStuMessage extends DriveExamProtocol {
 
    private static final int BODY_LENGTH = 17;
 
    private String id;//卡ID
    private short examaCourse = 0;
 
    public GainStuMessage(short msg_id) {
        super(msg_id);
    }
 
    @Override
    protected short msgBodyLength() {
        return BODY_LENGTH;
    }
 
    @Override
    protected byte[] createMessageBody() {
        int pos = 0;
        byte[] messageBody = new byte[BODY_LENGTH];
        byte[] idBytes = !TextUtils.isEmpty(id)?id.getBytes():"".getBytes();
        System.arraycopy(idBytes,0,messageBody,pos,idBytes.length);
        pos+= 16;
        byte[] examBytes = ByteUtil.shortGetByte(examaCourse);
        System.arraycopy(examBytes,0,messageBody,pos,examBytes.length);
 
        return messageBody;
    }
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public short getExamaCourse() {
        return examaCourse;
    }
 
    public void setExamaCourse(short examaCourse) {
        this.examaCourse = examaCourse;
    }
}