📄 message.java
字号:
package cn.madhouse.gateway.empp.msgformat;
import java.io.Serializable;
import cn.madhouse.gateway.empp.util.Tools;
public abstract class Message implements Serializable {
public final static int EMPP_CONNECT = 0x00000001;
public final static int EMPP_CONNECT_RESP = 0x80000001;
public final static int EMPP_TERMINATE = 0x00000002;
public final static int EMPP_TERMINATE_RESP = 0x80000002;
public final static int EMPP_SUBMIT = 0x00000004;
public final static int EMPP_SUBMIT_RESP = 0x80000004;
public final static int EMPP_DELIVER = 0x00000005;
public final static int EMPP_DELIVER_RESP = 0x80000005;
public final static int EMPP_ACTIVE_TEST = 0x00000008;
public final static int EMPP_ACTIVE_TEST_RESP = 0x80000008;
public final static int EMPP_INTRINTSEARCHMSG = 0x00000010;
public final static int EMPP_INTRINTSEARCHMSG_RESP = 0x80000010;
public final static int EMPP_SYNCADDRBOOK = 0x00000011;
public final static int EMPP_SYNCADDRBOOK_RESP = 0x80000011;
public final static int EMPP_CHANGEPASS = 0x00000012;
public final static int EMPP_CHANGEPASS_RESP = 0x80000012;
public final static int EMPP_QUESTION = 0x00000013;
public final static int EMPP_QUESTION_RESP = 0x80000013;
public final static int EMPP_ANSWER = 0x00000014;
public final static int EMPP_ANSWER_RESP = 0x80000014;
public final static int EMPP_REQNOTICE = 0x00000015;
public final static int EMPP_REQNOTICE_RESP = 0x80000015;
public final static int EMPP_SUBMIT2 = 0x00000016;
public final static int EMPP_UNAUTHORIZATION = 0x80000017;
public final static int EMPP_INTRINTMSGSTATE = 0x00000018;
public final static int EMPP_INTRINTMSGSTATE_RESP = 0x80000018;
private static int seqId;
protected Integer totalLength;
protected Integer commandId;
protected Integer sequenceId;
public Integer getCommandId() {
return commandId;
}
public Integer getSequenceId() {
return sequenceId;
}
public Integer getTotalLength() {
return totalLength;
}
public void setCommandId(Integer commandId) {
this.commandId = commandId;
}
public void setSequenceId(Integer sequenceId) {
this.sequenceId = sequenceId;
}
public void setTotalLength(Integer totalLength) {
this.totalLength = totalLength;
}
public static synchronized int genSeqId() {
if(seqId >= 0x7fffffff) {
seqId = 0;
}
seqId += 1;
return seqId;
}
public static int getTotalLength(byte[] b) {
byte[] totalLength = new byte[4];
System.arraycopy(b,0,totalLength,0,4);
return Tools.byte2int(totalLength);
}
public static int getCommandId(byte[] b) {
byte[] commandId = new byte[4];
System.arraycopy(b,4,commandId,0,4);
return Tools.byte2int(commandId);
}
public static int getSequenceId(byte[] b) {
byte[] sequenceId = new byte[4];
System.arraycopy(b,8,sequenceId,0,4);
return Tools.byte2int(sequenceId);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -