package safeluck.drive.evaluation.platformMessage;
|
|
import android.util.Log;
|
|
import com.anyun.im_lib.util.ByteUtil;
|
|
public class AuthMessage extends DriveExamProtocol {
|
|
private static final String TAG = "AuthMessage";
|
private static final int BODY_LENGTH = 12;
|
private long timeStamp;
|
private String hexStrPwd;
|
|
public String getHexStrPwd() {
|
return hexStrPwd;
|
}
|
|
public void setHexStrPwd(String hexStrPwd) {
|
this.hexStrPwd = hexStrPwd;
|
}
|
|
/**
|
* 构造函数
|
*
|
* @param msg_id 消息ID
|
*/
|
public AuthMessage(short msg_id) {
|
super(msg_id);
|
}
|
|
@Override
|
protected byte[] createMessageBody() {
|
byte[] messageBody = new byte[BODY_LENGTH];
|
int pos = 0;
|
timeStamp = System.currentTimeMillis();
|
Log.i(TAG, "createMessageBody: timeStamp="+timeStamp);
|
byte[] timeStampBytes = ByteUtil.intGetBytes((int)timeStamp);
|
System.arraycopy(timeStampBytes,0,messageBody,pos,timeStampBytes.length);
|
pos+= 4;
|
byte [] hexPwdBytes = ByteUtil.hexStr2Bytes(hexStrPwd);
|
System.arraycopy(hexPwdBytes,0,messageBody,pos,hexPwdBytes.length);
|
return messageBody;
|
}
|
|
@Override
|
protected short msgBodyLength() {
|
return BODY_LENGTH;
|
}
|
}
|