loginrsp.java

来自「中国移动定位引擎的客户端」· Java 代码 · 共 114 行

JAVA
114
字号
/**
* <p>Title: Smgp协议解析</p>
* <p>Description: 登录应答包</p>
* <p>Company: 福富软件</p>
* @author chenxin
* @version 1.0 $Date 2007-07-04
*/
package ffcs.lbp.le.message;

import java.nio.ByteBuffer;



/**
 * @author chenxin
 *
 * TODO 要更改此生成的类型注释的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
public class LoginRsp extends LeMessage {
	
	
	public static final int SUCC =0;
	public static final int ERR_User =1;
	public static final int ERR_Passwd =2;
	public static final int ERR_IP =3;
	public static final int ERR_ModuleType =4;
	public static final int ERR_ModuleNo =5;
	public static final int ERR_RELOGIN =6;
	public static final int ERR_TimeOut =7;
	public static final int ERR_Parse =8;
	public static final int ERR_DB =9;
	private int Result;

	
	
	private int lenResult=4;

	
	private int lenMessageBody=lenResult;
	
	
	
	public LoginRsp() {
        super(LoginRsp);
    }
	

	
	public int getBodyLength() {
        return lenMessageBody;
    }
	
	/**
     * 读取协议包的包体
     * @param buf ByteBuffer
     * @throws MessageParseException
     * @return boolean
     */
    protected boolean readBody(ByteBuffer buf) throws
            LeProtocolException{
    	
    	Result=buf.getInt();

    	
    	return true;
    }


    /**
     * 读取协议包的包体
     * @param buf ByteBuffer
     * @return boolean
     */
    protected  boolean writeBody(ByteBuffer buf){
    	
    	
    
    	buf.putInt(Result);
    	
    	
    	return true;
    }

    /**
     * Convert this packet to a String. Not to be interpreted programmatically,
     * it's just dead handy for debugging!
     */
    public String toString() {
        StringBuffer sb=new StringBuffer("LoginRep:");
	    sb.append(super.toString());
	    
	    sb.append("Result");
        sb.append("=0");
        sb.append(Result);
        sb.append(" ");
                
        return sb.toString();
    }



	public int getResult() {
		return Result;
	}



	public void setResult(int result) {
		Result = result;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?