package safeluck.drive.evaluation.platformMessage;
|
|
import android.text.TextUtils;
|
|
import com.anyun.im_lib.util.ByteUtil;
|
|
/**
|
* 上报开始考试
|
*/
|
public class StartExam2Server extends DriveExamProtocol {
|
private static final short BODY_LENGTH = 29;
|
|
private String ID;//身份证
|
private String BCDStr;//时间BCD[6] YYMMDDhhmmss
|
private int exam_id;// DWORD 4字节 唯一考试ID标志
|
private short examaCourse = 0;
|
private int currPos = 0;
|
|
/**
|
* 构造函数
|
*
|
* @param msg_id 消息ID
|
*/
|
public StartExam2Server(short msg_id) {
|
super(msg_id);
|
}
|
|
@Override
|
protected byte[] createMessageBody() {
|
byte [] messageBody = new byte[BODY_LENGTH];
|
byte[] idBytes = !TextUtils.isEmpty(ID)?ID.getBytes():"".getBytes();
|
byte[] timeStampBCD = ByteUtil.str2Bcd(BCDStr);
|
byte[] examIdBytes = ByteUtil.intGetBytes(exam_id);
|
byte[] examBytes = ByteUtil.shortGetByte(examaCourse);
|
|
System.arraycopy(idBytes,0,messageBody,currPos,idBytes.length);
|
currPos += 18;
|
|
System.arraycopy(timeStampBCD,0,messageBody,currPos,timeStampBCD.length);
|
currPos += timeStampBCD.length;
|
|
System.arraycopy(examIdBytes,0,messageBody,currPos,examIdBytes.length);
|
currPos += 4;
|
|
System.arraycopy(examBytes,0,messageBody,currPos,examBytes.length);
|
return messageBody;
|
}
|
|
@Override
|
protected short msgBodyLength() {
|
return BODY_LENGTH;
|
}
|
|
public String getID() {
|
return ID;
|
}
|
|
public void setID(String ID) {
|
this.ID = ID;
|
}
|
|
public String getBCDStr() {
|
return BCDStr;
|
}
|
|
public void setBCDStr(String BCDStr) {
|
this.BCDStr = BCDStr;
|
}
|
|
public int getExam_id() {
|
return exam_id;
|
}
|
|
public void setExam_id(int exam_id) {
|
this.exam_id = exam_id;
|
}
|
|
public short getExamaCourse() {
|
return examaCourse;
|
}
|
|
public void setExamaCourse(short examaCourse) {
|
this.examaCourse = examaCourse;
|
}
|
}
|