www.pudn.com > cmppNeu.rar > ActiveTestResp.java


package cmpp.v2_0; 
 
import java.util.Arrays; 
 
public class ActiveTestResp extends CMPP 
{ 
    private  final int commandId 		= CMPP.ID_CMPP_ACTIVE_TEST_RESP; 
    private	 final int commandLength 	= 1; 
     
    private	int Reserved	= 0; 
 
	public ActiveTestResp()   { 
        super(CMPP.ID_CMPP_ACTIVE_TEST_RESP); 
    } 
    public ActiveTestResp(CMPP cmpp)  { 
        super(cmpp); 
    }   
     
	/** 
	 *  
	 */ 
	protected int parseBody() { 
		 
    	if( super.bodyLength < commandLength ) {	//length too short. 
    		return -1; 
    	} 
    	 
    	byte[] abyte0 = new byte[21]; 
    	int off = 0; 
 
    	Arrays.fill(abyte0,(byte)0); 
    	CMPP.BytesCopy(super.bodybytes, abyte0, off, off, 0); 
    	Reserved = CMPP.ByteToInt(abyte0[0]); 
    	off += 1; 
    	 
        return 0; 
    } 
 
	/** 
	 *  
	 */ 
	protected int makeBody() { 
	 
    	// make bodybytes 
    	super.bodyLength = commandLength;  
    	super.bodybytes  = new byte[super.bodyLength]; 
    	Arrays.fill(super.bodybytes,(byte)0); 
 
    	// make body 
    	int off = 0; 
    	super.bodybytes[off] = CMPP.IntToByte(Reserved); 
    	off += 1; 
 
    	return 0; 
	} 
	 
	public String toString() { 
		StringBuffer sb = new StringBuffer(); 
		sb.append("Reserved=" + Reserved + "\n"); 
		return sb.toString(); 
	} 
	public int getReserved() { 
		return Reserved; 
	} 
	public void setReserved(int reserved) { 
		Reserved = reserved; 
	} 
 
}