Message81.java
1.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
package com.bsth.socket.protocol;
import com.bsth.util.ConvertUtil;
import org.joda.time.DateTime;
/**
* @author Hill
* 参数设置应答
*/
public class Message81 implements IMessageBody {
/**
* byte[6]
* 数据采集时间
*/
private long timestamp;
/**
* 参数总数
* n
*/
private byte paramNum;
@Override
public void read(byte[] bytes) {
// TODO Auto-generated method stub
int idx = 0;
timestamp = ConvertUtil.bytes2timestamp(bytes, idx); idx += 6;
paramNum = bytes[idx]; idx++;
}
@Override
public byte[] write() {
// TODO Auto-generated method stub
return new byte[0];
}
public long getTimestamp() {
return timestamp;
}
@Override
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public byte getParamNum() {
return paramNum;
}
public void setParamNum(byte paramNum) {
this.paramNum = paramNum;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(" 数据采集时间:").append(new DateTime(timestamp).toString("yyyy-MM-dd HH:mm:ss"))
.append(" 参数数量:").append(paramNum);
return sb.toString();
}
}