fac86401
孙向锦
初始化C5 Vote
|
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.sunvote.cmd.upload;
import com.sunvote.cmd.ICmd;
/**
* Created by Elvis on 2017/8/9.
* Email:Eluis@psunsky.com
* Description:编号模式结果
* SDK提交给模块:
* <p>
* 字节 标识符 描述
* 1 REQUEST_CMD 0x73
* 2 MSGID 流水号 1-255
* 3 MSGTYPE 后继信息包的打包格式
* 1 编号模式
* 4 ANSTYPE 使用编号模式时候的数据包类型
* 例如:
* 0状态
* 1 单值(签到、表决、评议)
* 2 单选多选
* 3 评分
* 4 排序
* 5 填空
* ...
* 21 批次单值结果
* 26另选他人
* 5-24 ANSDATA 根据结果类型ANSTYPE的不同,有不同的数据长度和含义
* 具体参考《通讯协议-政务商务-表决器部分-V5.0.docx》第三章 上传单包类的描述
* 对于要传递按键时间KEYTIME值的,需要SDK自己计算
*/
public class NumberingModeResult extends UploadBaseCmd {
public NumberingModeResult(){}
public static final int CMD_LENGTH = 24 ;
/**
* REQUEST_CMD 0x73
*/
private byte cmd = REQUEST_CMD;
/**
* 流水号 1-255
*/
private byte msgId = 0;
/**
* 后继信息包的打包格式
* 1 编号模式
*/
private byte msgType;
/**
* ANSTYPE 使用编号模式时候的数据包类型
* 例如:
* 0状态
* 1 单值(签到、表决、评议)
* 2 单选多选
* 3 评分
* 4 排序
* 5 填空
* ...
* 21 批次单值结果
* 26另选他人
*/
private byte ansType;
/**
* 根据结果类型ANSTYPE的不同,有不同的数据长度和含义
* 具体参考《通讯协议-政务商务-表决器部分-V5.0.docx》第三章 上传单包类的描述
* 对于要传递按键时间KEYTIME值的,需要SDK自己计算
*/
private byte[] ansData = new byte[20];
public byte getCmd() {
return cmd;
}
public void setCmd(byte cmd) {
this.cmd = cmd;
}
public byte getMsgId() {
return msgId;
}
public void setMsgId(byte msgId) {
this.msgId = msgId;
}
public byte getMsgType() {
return msgType;
}
public void setMsgType(byte msgType) {
this.msgType = msgType;
}
public byte getAnsType() {
return ansType;
}
public void setAnsType(byte ansType) {
this.ansType = ansType;
}
public void setAnsData(byte[] ansData) {
this.ansData = ansData;
}
public byte[] getAnsData() {
return ansData;
}
@Override
public byte[] toBytes() {
byte[] result = new byte[CMD_LENGTH];
result[0] = cmd;
result[1] = msgId;
result[2] = msgType ;
result[3] = ansType ;
for(int i=0; i < 32 && i < ansData.length ;i++){
result[i + 4] = ansData[i] ;
}
return result;
}
@Override
public ICmd parseCmd(byte[] source, int start) {
if(source != null && source.length >= start + CMD_LENGTH) {
cmd = source[start];
msgId = source[start + 1];
msgType = source[start + 2];
ansType = source[start + 3];
for (int i = 0; i < 20 && i < ansData.length; i++) {
ansData[i] = source[start + i+ 4];
}
}
return this;
}
}
|