BaseStatusChangeResponse.java
5.13 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
package com.sunvote.cmd.push;
import com.sunvote.cmd.BaseCmd;
import com.sunvote.cmd.ICmd;
/**
* Created by Elvis on 2017/8/8.
* Email:Eluis@psunsky.com
* Description:
* SDK应答表示收到:
* 字节 标识符 描述
1 REQUEST_CMD 0xF1
2 BADDH 基站编号
3-24 暂和原指令相同
*/
public class BaseStatusChangeResponse extends PushBaseCmd {
public static final byte RESPONSE_CMD = (byte) 0xF1;
public static final int CMD_LENGTH = 24 ;
public BaseStatusChangeResponse(){
}
public BaseStatusChangeResponse(BaseStatusChangeRequest request){
parseCmd(request.toBytes());
setCmd(RESPONSE_CMD);
}
/**
* 0x71 基础信标变化
*/
private byte cmd = RESPONSE_CMD;
/**
* 基站编号
*/
private byte baddh;
/**
* 基站识别模式
* 1编号、2序列号
* SDK要依据此模式来判断提交数据时候的打包格式
*/
private byte idmode;
/**
* 2字节,会议资料UID编号,1-65535,高位字节在前
* (对应系统使用后创见的会议文件的唯一编号)
*/
private byte[] confid = new byte[2];
/**
* 议题编号或索引(1-255),对应到具体用户待机时候可以浏览的议案文件内容
* 值=0,表示不浏览内容 ,值=255,表示自由浏览所有内容
* 其他值,指定议案编号浏览
*/
private byte voteid;
/**
* 授权号,2字节,高位在前,0-0xFFFF
* =0时候不使用授权模式,表决器可以参与表决
* >0时候,表决器保存的授权号相同才能参与表决
*/
private byte[] authcode = new byte[2];
/**
* 登录申请模式(后台签到模式),是否需要IC卡、登录码(用户编号\
*/
private byte login;
/**
* 表决器报告状态模式和指定语言
*/
private byte reportLanguage;
/**
*自动关机时间
*/
private byte offtime;
/**
* 表决器特性:背光模式+蜂鸣器模式等等
*/
private byte attrib;
public byte getCmd() {
return cmd;
}
public void setCmd(byte cmd) {
this.cmd = cmd;
}
public byte getBaddh() {
return baddh;
}
public void setBaddh(byte baddh) {
this.baddh = baddh;
}
public byte getIdmode() {
return idmode;
}
public void setIdmode(byte idmode) {
this.idmode = idmode;
}
public byte[] getConfid() {
return confid;
}
public void setConfid(byte[] confid) {
this.confid = confid;
}
public byte getVoteid() {
return voteid;
}
public void setVoteid(byte voteid) {
this.voteid = voteid;
}
public byte[] getAuthcode() {
return authcode;
}
public void setAuthcode(byte[] authcode) {
this.authcode = authcode;
}
public byte getLogin() {
return login;
}
public void setLogin(byte login) {
this.login = login;
}
public byte getReportLanguage() {
return reportLanguage;
}
public void setReportLanguage(byte reportLanguage) {
this.reportLanguage = reportLanguage;
}
public byte getOfftime() {
return offtime;
}
public void setOfftime(byte offtime) {
this.offtime = offtime;
}
public byte getAttrib() {
return attrib;
}
public void setAttrib(byte attrib) {
this.attrib = attrib;
}
public byte[] getBasename() {
return basename;
}
public void setBasename(byte[] basename) {
this.basename = basename;
}
/**
*基站名称,最多12字节
*/
private byte[] basename = new byte[12];
@Override
public byte[] toBytes() {
byte[] result = new byte[CMD_LENGTH];
result[0] = cmd;
result[1] = baddh;
result[2] = idmode;
for(int i= 0 ;i < 2 ; i++) {
result[3+i] = confid[i];
}
result[5] = voteid;
for(int i= 0 ;i < 2 ; i++) {
result[6+i] = authcode[i];
}
result[8] = login;
result[9] = reportLanguage ;
result[10] = offtime;
result[11] = attrib;
for(int i= 0 ; i < 12 && i < basename.length;i++){
result[12+i] = basename[i];
}
return result;
}
@Override
public ICmd parseCmd(byte[] source, int start) {
if(source != null && source.length >= start + CMD_LENGTH){
cmd = source[start];
baddh = source[start + 1];
idmode = source[start + 2];
for(int i= 0 ;i < 2 ; i++) {
confid[i] = source[start + 3+i];
}
voteid = source[start + 5];
for(int i= 0 ;i < 2 ; i++) {
authcode[i] = source[start + 6 + i];
}
login = source[start + 8];
reportLanguage = source[start + 9];
offtime = source[start + 10];
attrib = source[start + 11];
for(int i= 0 ; i < 12 && i < basename.length;i++){
basename[i] = source[start + 12 + i];
}
}
return this;
}
}