lizhanwei
2020-02-13 2f5311a7f088f7da4742de3036d33c9abd99c23f
增加消息体长度
5个文件已修改
52 ■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/bean/GainStuMessage.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/bean/KeepaliveMessage.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/bean/RegisterMessage.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/bean/StartExamMessage.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java
@@ -79,7 +79,7 @@
     * @return
     */
    public byte[] toBytes(){
        byte[] desBytes = new byte[1+16+2+1+1];
        byte[] desBytes = new byte[1+16+msgBodyLength()+1+1];
        int pos = 0;
@@ -133,4 +133,6 @@
        return tranferbytes;
    }
    protected abstract int msgBodyLength();
}
app/src/main/java/safeluck/drive/evaluation/bean/GainStuMessage.java
@@ -8,19 +8,21 @@
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class GainStuMessage extends DriveExamProtocol {
    // TODO: 2019/12/19
    /**
     * 构造函数
     *
     * @param msg_id 消息ID
     */
    private static final int BODY_LENGTH = 0;
    public GainStuMessage(short msg_id) {
        super(msg_id);
    }
    @Override
    protected int msgBodyLength() {
        return BODY_LENGTH;
    }
    @Override
    protected byte[] createMessageBody() {
        return new byte[0];
        return new byte[BODY_LENGTH];
    }
}
app/src/main/java/safeluck/drive/evaluation/bean/KeepaliveMessage.java
@@ -9,6 +9,8 @@
 */
public class KeepaliveMessage extends DriveExamProtocol {
    private static final int BODY_LENGTH = 0;
// TODO: 2019/12/19  
    public KeepaliveMessage(short msg_id) {
@@ -16,7 +18,12 @@
    }
    @Override
    protected int msgBodyLength() {
        return BODY_LENGTH;
    }
    @Override
    protected byte[] createMessageBody() {
        return new byte[0];
        return new byte[BODY_LENGTH];
    }
}
app/src/main/java/safeluck/drive/evaluation/bean/RegisterMessage.java
@@ -8,6 +8,8 @@
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class RegisterMessage extends DriveExamProtocol {
    private static final int BODY_LENGTH = 3;
    /**
     * 构造函数
     *
@@ -18,9 +20,15 @@
    }
    @Override
    protected int msgBodyLength() {
        return BODY_LENGTH;
    }
    @Override
    protected byte[] createMessageBody() {
        byte[] messageBody = new byte[2];
        messageBody[0] = 0x65;
        byte[] messageBody = new byte[BODY_LENGTH];
        messageBody[0] = 0x7E;
        messageBody[1] = 0x66;
        return messageBody;
    }
app/src/main/java/safeluck/drive/evaluation/bean/StartExamMessage.java
@@ -8,6 +8,10 @@
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class StartExamMessage extends DriveExamProtocol {
    private static final int BODY_LENGTH = 0;
// TODO: 2019/12/19  
    /**
     * 构造函数
@@ -19,7 +23,12 @@
    }
    @Override
    protected int msgBodyLength() {
        return BODY_LENGTH;
    }
    @Override
    protected byte[] createMessageBody() {
        return new byte[0];
        return new byte[BODY_LENGTH];
    }
}