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
package safeluck.drive.evaluation.platformMessage;
 
import com.anyun.exam.lib.MyLog;
import com.anyun.im_lib.util.ByteUtil;
 
 
import safeluck.drive.evaluation.im.MessageProcessor;
 
public class RegisterResp extends ServerProtocol {
    private String hexpwd;
    private short result;
    private int currPos = 0;
 
    public RegisterResp(byte[] rspBytes) {
        super(rspBytes);
    }
 
    @Override
    protected void parseMsgBody(byte[] msgbodyData) {
        currPos += 2;
        result = ByteUtil.getShort(ByteUtil.subArray(msgbodyData,currPos,1));
        if (result == PlatFormConstant.SUCCESS){
            MyLog.i(PlatFormConstant.TAG,"设备注册成功");
            AuthMessage authMessage = new AuthMessage((short) 0x101);
 
            currPos +=1;
            hexpwd = ByteUtil.byte2HexStr(ByteUtil.subArray(msgbodyData,currPos,msgBodyLength-3));
            MyLog.i(PlatFormConstant.TAG,"des pwd:"+hexpwd);
            authMessage.setHexStrPwd(hexpwd);
            MessageProcessor.getInstance().sendMessage(authMessage.toBytes());
        }else{
            MyLog.i(PlatFormConstant.TAG,"设备注册失败");
        }
    }
}